类org.junit.rules.TestName源码实例Demo

下面列出了怎么用org.junit.rules.TestName的API类实例代码及写法,或者点击链接到github查看源代码。

源代码1 项目: hbase   文件: TestMajorCompaction.java
/** 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);
}
 
源代码2 项目: ghidra   文件: MergeScreenShotGenerator.java
public MergeScreenShotGenerator(String testFilename, String testNameStr,
		MergeTestFacilitator mtf, TestName testName) {
	super();
	this.testName = testName;
	this.testFilename = testFilename;
	this.mtf = mtf;
	
}
 
源代码3 项目: kubernetes-plugin   文件: KubernetesTestUtil.java
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;
}
 
源代码4 项目: kubernetes-plugin   文件: KubernetesTestUtil.java
/**
 * 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;
}
 
源代码5 项目: dremio-oss   文件: TestTools.java
public static TestRule getTimeoutRule(int timeout, TimeUnit unit) {
  return IS_DEBUG ? new TestName() : Timeout.builder().withTimeout(timeout, unit).build();
}
 
源代码6 项目: dremio-oss   文件: TestTools.java
/**
 * 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();
}
 
源代码7 项目: kubernetes-plugin   文件: KubernetesTestUtil.java
public static Map<String, String> getLabels(Object o, TestName name) {
    return getLabels(null, o, name);
}
 
源代码8 项目: hbase   文件: SpaceQuotaHelperForTests.java
public SpaceQuotaHelperForTests(
    HBaseTestingUtility testUtil, TestName testName, AtomicLong counter) {
  this.testUtil = Objects.requireNonNull(testUtil);
  this.testName = Objects.requireNonNull(testName);
  this.counter = Objects.requireNonNull(counter);
}
 
源代码9 项目: brave   文件: ITJms_2_0_TracingMessageConsumer.java
@Override JmsTestRule newJmsTestRule(TestName testName) {
  return new ArtemisJmsTestRule(testName);
}
 
源代码10 项目: brave   文件: ITJms_2_0_TracingMessageProducer.java
@Override JmsTestRule newJmsTestRule(TestName testName) {
  return new ArtemisJmsTestRule(testName);
}
 
源代码11 项目: brave   文件: ArtemisJmsTestRule.java
ArtemisJmsTestRule(TestName testName) {
  super(testName);
  factory = new ActiveMQJMSConnectionFactory("vm://0");
  factory.setProducerMaxRate(1); // to allow tests to use production order
}
 
源代码12 项目: brave   文件: JmsTestRule.java
JmsTestRule(TestName testName) {
  this.testName = testName;
}
 
源代码13 项目: brave   文件: JmsTestRule.java
ActiveMQ(TestName testName) {
  super(testName);
}
 
源代码14 项目: brave   文件: ITJms_1_1_TracingMessageConsumer.java
JmsTestRule newJmsTestRule(TestName testName) {
  return new JmsTestRule.ActiveMQ(testName);
}
 
源代码15 项目: brave   文件: ITJms_1_1_TracingMessageProducer.java
JmsTestRule newJmsTestRule(TestName testName) {
  return new JmsTestRule.ActiveMQ(testName);
}