org.junit.rules.TestName Java Examples

The following examples show how to use org.junit.rules.TestName. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TestMajorCompaction.java    From hbase with Apache License 2.0 6 votes vote down vote up
/** constructor */
public TestMajorCompaction(String compType) {
  super();
  name = new TestName();
  // Set cache flush size to 1MB
  conf.setInt(HConstants.HREGION_MEMSTORE_FLUSH_SIZE, 1024 * 1024);
  conf.setInt(HConstants.HREGION_MEMSTORE_BLOCK_MULTIPLIER, 100);
  compactionThreshold = conf.getInt("hbase.hstore.compactionThreshold", 3);
  conf.set(CompactingMemStore.COMPACTING_MEMSTORE_TYPE_KEY, String.valueOf(compType));

  secondRowBytes = START_KEY_BYTES.clone();
  // Increment the least significant character so we get to next row.
  secondRowBytes[START_KEY_BYTES.length - 1]++;
  thirdRowBytes = START_KEY_BYTES.clone();
  thirdRowBytes[START_KEY_BYTES.length - 1] =
    (byte) (thirdRowBytes[START_KEY_BYTES.length - 1] + 2);
}
 
Example #2
Source File: MergeScreenShotGenerator.java    From ghidra with Apache License 2.0 5 votes vote down vote up
public MergeScreenShotGenerator(String testFilename, String testNameStr,
		MergeTestFacilitator mtf, TestName testName) {
	super();
	this.testName = testName;
	this.testFilename = testFilename;
	this.mtf = mtf;
	
}
 
Example #3
Source File: KubernetesTestUtil.java    From kubernetes-plugin with Apache License 2.0 5 votes vote down vote up
public static KubernetesCloud setupCloud(Object test, TestName name) throws KubernetesAuthException, IOException {
    KubernetesCloud cloud = new KubernetesCloud("kubernetes");
    // unique labels per test
    cloud.setPodLabels(PodLabel.fromMap(getLabels(cloud, test, name)));
    KubernetesClient client = cloud.connect();

    // Run in our own testing namespace

    // if there is a namespace specific for this branch (ie. kubernetes-plugin-test-master), use it
    String branch = System.getenv("BRANCH_NAME");
    if (StringUtils.isNotBlank(branch)) {
        String namespaceWithBranch = String.format("%s-%s", DEFAULT_TESTING_NAMESPACE, branch);
        LOGGER.log(FINE, "Trying to use namespace: {0}", testingNamespace);
        try {
            if (client.namespaces().withName(namespaceWithBranch).get() != null) {
                testingNamespace = namespaceWithBranch;
            }
        } catch (KubernetesClientException e) {
            // nothing to do
        }
    }
    if (testingNamespace == null) {
        testingNamespace = DEFAULT_TESTING_NAMESPACE;
        if (client.namespaces().withName(testingNamespace).get() == null) {
            LOGGER.log(INFO, "Creating namespace: {0}", testingNamespace);
            client.namespaces().create(
                    new NamespaceBuilder().withNewMetadata().withName(testingNamespace).endMetadata().build());
        }
    }
    LOGGER.log(INFO, "Using namespace {0} for branch {1}", new String[] { testingNamespace, branch });
    cloud.setNamespace(testingNamespace);
    client = cloud.connect();

    return cloud;
}
 
Example #4
Source File: KubernetesTestUtil.java    From kubernetes-plugin with Apache License 2.0 5 votes vote down vote up
/**
 * Labels to add to the pods so we can match them to a specific build run, test class and method
 */
public static Map<String, String> getLabels(KubernetesCloud cloud, Object o, TestName name) {
    HashMap<String, String> l = Maps.newHashMap(DEFAULT_LABELS);
    if (cloud != null) {
        l.putAll(cloud.getPodLabelsMap());
    }
    l.put("class", o.getClass().getSimpleName());
    l.put("test", name.getMethodName());
    return l;
}
 
Example #5
Source File: TestTools.java    From dremio-oss with Apache License 2.0 4 votes vote down vote up
public static TestRule getTimeoutRule(int timeout, TimeUnit unit) {
  return IS_DEBUG ? new TestName() : Timeout.builder().withTimeout(timeout, unit).build();
}
 
Example #6
Source File: TestTools.java    From dremio-oss with Apache License 2.0 4 votes vote down vote up
/**
 * If not enforced, the repeat rule applies only if the test is run in non-debug mode.
 */
public static TestRule getRepeatRule(final boolean enforce) {
  return enforce || !IS_DEBUG ? new RepeatTestRule() : new TestName();
}
 
Example #7
Source File: KubernetesTestUtil.java    From kubernetes-plugin with Apache License 2.0 4 votes vote down vote up
public static Map<String, String> getLabels(Object o, TestName name) {
    return getLabels(null, o, name);
}
 
Example #8
Source File: SpaceQuotaHelperForTests.java    From hbase with Apache License 2.0 4 votes vote down vote up
public SpaceQuotaHelperForTests(
    HBaseTestingUtility testUtil, TestName testName, AtomicLong counter) {
  this.testUtil = Objects.requireNonNull(testUtil);
  this.testName = Objects.requireNonNull(testName);
  this.counter = Objects.requireNonNull(counter);
}
 
Example #9
Source File: ITJms_2_0_TracingMessageConsumer.java    From brave with Apache License 2.0 4 votes vote down vote up
@Override JmsTestRule newJmsTestRule(TestName testName) {
  return new ArtemisJmsTestRule(testName);
}
 
Example #10
Source File: ITJms_2_0_TracingMessageProducer.java    From brave with Apache License 2.0 4 votes vote down vote up
@Override JmsTestRule newJmsTestRule(TestName testName) {
  return new ArtemisJmsTestRule(testName);
}
 
Example #11
Source File: ArtemisJmsTestRule.java    From brave with Apache License 2.0 4 votes vote down vote up
ArtemisJmsTestRule(TestName testName) {
  super(testName);
  factory = new ActiveMQJMSConnectionFactory("vm://0");
  factory.setProducerMaxRate(1); // to allow tests to use production order
}
 
Example #12
Source File: JmsTestRule.java    From brave with Apache License 2.0 4 votes vote down vote up
JmsTestRule(TestName testName) {
  this.testName = testName;
}
 
Example #13
Source File: JmsTestRule.java    From brave with Apache License 2.0 4 votes vote down vote up
ActiveMQ(TestName testName) {
  super(testName);
}
 
Example #14
Source File: ITJms_1_1_TracingMessageConsumer.java    From brave with Apache License 2.0 4 votes vote down vote up
JmsTestRule newJmsTestRule(TestName testName) {
  return new JmsTestRule.ActiveMQ(testName);
}
 
Example #15
Source File: ITJms_1_1_TracingMessageProducer.java    From brave with Apache License 2.0 4 votes vote down vote up
JmsTestRule newJmsTestRule(TestName testName) {
  return new JmsTestRule.ActiveMQ(testName);
}