当前位置: 首页>>代码示例>>Java>>正文


Java InSequence类代码示例

本文整理汇总了Java中org.jboss.arquillian.junit.InSequence的典型用法代码示例。如果您正苦于以下问题:Java InSequence类的具体用法?Java InSequence怎么用?Java InSequence使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


InSequence类属于org.jboss.arquillian.junit包,在下文中一共展示了InSequence类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: cachedMethodNotCalledYet

import org.jboss.arquillian.junit.InSequence; //导入依赖的package包/类
@Test
@InSequence(1)
public void cachedMethodNotCalledYet() {
    assertThat("Metrics are not registered correctly", registry.getMetrics(),
        allOf(
            hasKey(CALLS_METRIC),
            hasKey(HITS_METRIC),
            hasKey(CACHE_HITS_METRIC)
        )
    );
    Timer calls = registry.getTimers().get(CALLS_METRIC);
    Meter hits = registry.getMeters().get(HITS_METRIC);
    @SuppressWarnings("unchecked")
    Gauge<Double> gauge = (Gauge<Double>) registry.getGauges().get(CACHE_HITS_METRIC);

    assertThat("Gauge value is incorrect", gauge.getValue(), is(equalTo(((double) hits.getCount() / (double) calls.getCount()))));
}
 
开发者ID:eclipse,项目名称:microprofile-metrics,代码行数:18,代码来源:MetricProducerMethodBeanTest.java

示例2: testCount

import org.jboss.arquillian.junit.InSequence; //导入依赖的package包/类
@Test
@InSequence(1)
public void testCount() throws Exception {
    // test mark()
    long countBefore = injectedMeter.getCount();
    injectedMeter.mark();
    long countAfter = injectedMeter.getCount();
    Assert.assertEquals(countBefore + 1, countAfter);

    // test mark(2)
    countBefore = injectedMeter.getCount();
    injectedMeter.mark(2);
    countAfter = injectedMeter.getCount();
    Assert.assertEquals(countBefore + 2, countAfter);

    // test mark(-3)
    countBefore = injectedMeter.getCount();
    injectedMeter.mark(-3);
    countAfter = injectedMeter.getCount();
    Assert.assertEquals(countBefore - 3, countAfter);
}
 
开发者ID:eclipse,项目名称:microprofile-metrics,代码行数:22,代码来源:MeterTest.java

示例3: testTimerRegistry

import org.jboss.arquillian.junit.InSequence; //导入依赖的package包/类
@Test
@InSequence(3)
public void testTimerRegistry() throws Exception {
    String timerLongName = "test.longData.timer";
    //String timerRateName = "testRate";
    String timerTimeName = "testTime";

    SortedMap<String, Timer> timers = registry.getTimers();
    Assert.assertTrue(timers.size() > 0);

    Assert.assertTrue(timers.containsKey(timerLongName));
    Assert.assertTrue(timers.containsKey(timerTimeName));

    //Assert.assertEquals(1, timers.get(timerRateName).getCount(), 0);
    //Assert.assertEquals(1, registry.timer("testRate").getCount(), 0);
    Assert.assertEquals(480, timers.get(timerLongName).getSnapshot().getValue(0.5), 0);
}
 
开发者ID:eclipse,项目名称:microprofile-metrics,代码行数:18,代码来源:TimerTest.java

示例4: removeMeterFromRegistry

import org.jboss.arquillian.junit.InSequence; //导入依赖的package包/类
@Test
@InSequence(3)
public void removeMeterFromRegistry() {
    assertThat("Meter is not registered correctly", registry.getMeters(), hasKey(METER_NAME));
    Meter meter = registry.getMeters().get(METER_NAME);

    // Remove the meter from metrics registry
    registry.remove(METER_NAME);

    try {
        // Call the metered method and assert an exception is thrown
        bean.meteredMethod();
    }
    catch (RuntimeException cause) {
        assertThat(cause, is(instanceOf(IllegalStateException.class)));
        assertThat(cause.getMessage(), is(equalTo("No meter with name [" + METER_NAME + "] found in registry [" + registry + "]")));
        // Make sure that the meter hasn't been marked
        assertThat("Meter count is incorrect", meter.getCount(), is(equalTo(METER_COUNT.get())));
        return;
    }

    fail("No exception has been re-thrown!");
}
 
开发者ID:eclipse,项目名称:microprofile-metrics,代码行数:24,代码来源:MeteredMethodBeanTest.java

示例5: testApplicationHistogramUnitNonePrometheus

import org.jboss.arquillian.junit.InSequence; //导入依赖的package包/类
@Test
@RunAsClient
@InSequence(26)
public void testApplicationHistogramUnitNonePrometheus() {

    String prefix = "metric_test_test1_histogram2";

    given().header("Accept", TEXT_PLAIN).when().get("/metrics/application/metricTest.test1.histogram2")
        .then().statusCode(200)
        .and()
        .body(containsString(prefix + "_count"))
        .body(containsString("# TYPE application:" + prefix + " summary"))
        .body(containsString(prefix + "_mean"))
        .body(containsString(prefix + "_min"))
        .body(containsString(prefix + "_max"))
        .body(containsString(prefix + "_stddev"))
        .body(containsString(prefix + "{tier=\"integration\",quantile=\"0.5\"}"))
        .body(containsString(prefix + "{tier=\"integration\",quantile=\"0.75\"}"))
        .body(containsString(prefix + "{tier=\"integration\",quantile=\"0.95\"}"))
        .body(containsString(prefix + "{tier=\"integration\",quantile=\"0.98\"}"))
        .body(containsString(prefix + "{tier=\"integration\",quantile=\"0.99\"}"))
        .body(containsString(prefix + "{tier=\"integration\",quantile=\"0.999\"}"))
    ;
}
 
开发者ID:eclipse,项目名称:microprofile-metrics,代码行数:25,代码来源:MpMetricTest.java

示例6: removeTimerFromRegistry

import org.jboss.arquillian.junit.InSequence; //导入依赖的package包/类
@Test
@InSequence(3)
public void removeTimerFromRegistry() {
    // Get a contextual instance of the bean
    TimedMethodBean1 bean = instance.get();

    assertThat("Timer is not registered correctly", registry.getTimers(), hasKey(TIMER_NAME));
    Timer timer = registry.getTimers().get(TIMER_NAME);

    // Remove the timer from metrics registry
    registry.remove(TIMER_NAME);

    try {
        // Call the timed method and assert an exception is thrown
        bean.timedMethod();
    }
    catch (RuntimeException cause) {
        assertThat(cause, is(instanceOf(IllegalStateException.class)));
        assertThat(cause.getMessage(), is(equalTo("No timer with name [" + TIMER_NAME + "] found in registry [" + registry + "]")));
        // Make sure that the timer hasn't been called
        assertThat("Timer count is incorrect", timer.getCount(), is(equalTo(TIMER_COUNT.get())));
        return;
    }

    fail("No exception has been re-thrown!");
}
 
开发者ID:eclipse,项目名称:microprofile-metrics,代码行数:27,代码来源:TimedMethodBeanLookupTest.java

示例7: callMetricsMethodOnce

import org.jboss.arquillian.junit.InSequence; //导入依赖的package包/类
@Test
@InSequence(2)
public void callMetricsMethodOnce() {
    assertThat("Metrics are not registered correctly", registry.getMetrics().keySet(), is(equalTo(absoluteMetricNames())));

    // Call the monitored method and assert it's been instrumented
    bean.metricsMethod();

    // Make sure that the metrics have been called
    assertThat("Counter count is incorrect", registry.getCounters().get(absoluteMetricName("counter")).getCount(), is(equalTo(1L)));
    assertThat("Meter count is incorrect", registry.getMeters().get(absoluteMetricName("meter")).getCount(), is(equalTo(1L)));
    assertThat("Timer count is incorrect", registry.getTimers().get(absoluteMetricName("timer")).getCount(), is(equalTo(1L)));
    // Let's call the gauge at the end as Weld is intercepting the gauge
    // invocation while OWB not
    assertThat("Gauge value is incorrect", registry.getGauges().get(absoluteMetricName("gauge")).getValue(), hasToString((equalTo("value"))));
}
 
开发者ID:eclipse,项目名称:microprofile-metrics,代码行数:17,代码来源:MultipleMetricsMethodBeanTest.java

示例8: only_one_note_after_add

import org.jboss.arquillian.junit.InSequence; //导入依赖的package包/类
@Test
@InSequence(3)
public void only_one_note_after_add() {
    Collection<Note> notes = noteRestApi()
            .request(MediaType.APPLICATION_JSON_TYPE)
            .get(new GenericType<List<Note>>() {});

    assertThat(notes, iterableWithSize(1));
    Note aloneNote = notes.stream().findAny().orElseThrow(AssertionError::new);
    assertThat(aloneNote, notNullValue());

    Note noteByApi = noteRestApi()
            .path(aloneNote.getId())
            .request(MediaType.APPLICATION_JSON_TYPE)
            .get(Note.class);

    assertThat(aloneNote, is(noteByApi));
}
 
开发者ID:anton-tregubov,项目名称:javaee-design-patterns,代码行数:19,代码来源:SampleProjectIT.java

示例9: callTimedMethodsOnce

import org.jboss.arquillian.junit.InSequence; //导入依赖的package包/类
@Test
@InSequence(2)
public void callTimedMethodsOnce() {
    assertThat("Timers are not registered correctly", registry.getTimers().keySet(), is(equalTo(absoluteMetricNames())));

    // Call the timed methods and assert they've all been timed once
    bean.publicTimedMethod();
    bean.protectedTimedMethod();
    bean.packagePrivateTimedMethod();

    // Call the methods of the parent and assert they've also been timed once
    bean.timedMethodOne();
    bean.timedMethodTwo();
    bean.timedMethodProtected();
    bean.timedMethodPackagedPrivate();

    assertThat("Timer counts are incorrect", registry.getTimers().values(), everyItem(Matchers.<Timer>hasProperty("count", equalTo(1L))));
}
 
开发者ID:eclipse,项目名称:microprofile-metrics,代码行数:19,代码来源:InheritedTimedMethodBeanTest.java

示例10: countersNotIncrementedYet

import org.jboss.arquillian.junit.InSequence; //导入依赖的package包/类
@Test
@InSequence(1)
public void countersNotIncrementedYet() {
    assertThat("Counters are not registered correctly", registry.getCounters(),
        allOf(
            hasKey("counter1"),
            hasKey("counter2"),
            not(hasKey("not_registered_counter"))
        )
    );
    Counter counter1 = registry.getCounters().get("counter1");
    Counter counter2 = registry.getCounters().get("counter2");

    assertThat("Gauge is not registered correctly", registry.getGauges(), hasKey("ratioGauge"));
    @SuppressWarnings("unchecked")
    Gauge<Double> gauge = (Gauge<Double>) registry.getGauges().get("ratioGauge");

    assertThat("Gauge value is incorrect", gauge.getValue(), is(equalTo(((double) counter1.getCount()) / ((double) counter2.getCount()))));
}
 
开发者ID:eclipse,项目名称:microprofile-metrics,代码行数:20,代码来源:MetricProducerFieldBeanTest.java

示例11: incrementCountersFromRegistry

import org.jboss.arquillian.junit.InSequence; //导入依赖的package包/类
@Test
@InSequence(2)
public void incrementCountersFromRegistry() {
    assertThat("Counters are not registered correctly", registry.getCounters(),
        allOf(
            hasKey("counter1"),
            hasKey("counter2"),
            not(hasKey("not_registered_counter"))
        )
    );
    Counter counter1 = registry.getCounters().get("counter1");
    Counter counter2 = registry.getCounters().get("counter2");

    assertThat("Gauge is not registered correctly", registry.getGauges(), hasKey("ratioGauge"));
    @SuppressWarnings("unchecked")
    Gauge<Double> gauge = (Gauge<Double>) registry.getGauges().get("ratioGauge");

    counter1.inc(Math.round(Math.random() * Integer.MAX_VALUE));
    counter2.inc(Math.round(Math.random() * Integer.MAX_VALUE));

    assertThat("Gauge value is incorrect", gauge.getValue(), is(equalTo(((double) counter1.getCount()) / ((double) counter2.getCount()))));
}
 
开发者ID:eclipse,项目名称:microprofile-metrics,代码行数:23,代码来源:MetricProducerFieldBeanTest.java

示例12: testOptionalBaseMetrics

import org.jboss.arquillian.junit.InSequence; //导入依赖的package包/类
@Test
@RunAsClient
@InSequence(31)
public void testOptionalBaseMetrics() {
    Header wantJson = new Header("Accept", APPLICATION_JSON);

    JsonPath jsonPath = given().header(wantJson).options("/metrics/base").jsonPath();

    Map<String, Object> elements = jsonPath.getMap(".");
    Map<String, MiniMeta> names = getExpectedMetadataFromXmlFile(MetricRegistry.Type.BASE);

    for (String item : names.keySet()) {
        if (elements.containsKey(item) && names.get(item).optional) {
            String prefix = names.get(item).name;
            String type = "\""+prefix+"\""+".type";
            String unit= "\""+prefix+"\""+".unit";

            given().header(wantJson).options("/metrics/base/"+prefix).then().statusCode(200)
            .body(type, equalTo(names.get(item).type))
            .body(unit, equalTo(names.get(item).unit));
        }
    }

}
 
开发者ID:eclipse,项目名称:microprofile-metrics,代码行数:25,代码来源:MpMetricTest.java

示例13: callTimedMethodsOnce

import org.jboss.arquillian.junit.InSequence; //导入依赖的package包/类
@Test
@InSequence(2)
public void callTimedMethodsOnce() {
    assertThat("Timers are not registered correctly", registry.getTimers().keySet(), is(equalTo(TIMER_NAMES)));
    
    assertThat("Constructor timer count is incorrect", registry.getTimers().get(CONSTRUCTOR_TIMER_NAME).getCount(), is(equalTo(1L)));

    // Call the timed methods and assert they've been timed
    bean.timedMethodOne();
    bean.timedMethodTwo();
    // Let's call the non-public methods as well
    bean.timedMethodProtected();
    bean.timedMethodPackagedPrivate();

    // Make sure that the method timers have been timed
    assertThat("Method timer counts are incorrect", registry.getTimers(METHOD_TIMERS).values(),
            everyItem(Matchers.<Timer> hasProperty("count", equalTo(METHOD_COUNT.incrementAndGet()))));
}
 
开发者ID:eclipse,项目名称:microprofile-metrics,代码行数:19,代码来源:TimedClassBeanTest.java

示例14: removeTimerFromRegistry

import org.jboss.arquillian.junit.InSequence; //导入依赖的package包/类
@Test
@InSequence(4)
public void removeTimerFromRegistry() {
    assertThat("Timer is not registered correctly", registry.getTimers(), hasKey(TIMER_NAME));
    Timer timer = registry.getTimers().get(TIMER_NAME);

    // Remove the timer from metrics registry
    registry.remove(TIMER_NAME);

    try {
        // Call the timed method and assert an exception is thrown
        bean.timedMethod();
    }
    catch (RuntimeException cause) {
        assertThat(cause, is(instanceOf(IllegalStateException.class)));
        assertThat(cause.getMessage(), is(equalTo("No timer with name [" + TIMER_NAME + "] found in registry [" + registry + "]")));
        // Make sure that the timer hasn't been called
        assertThat("Timer count is incorrect", timer.getCount(), is(equalTo(TIMER_COUNT.get())));
        return;
    }

    fail("No exception has been re-thrown!");
}
 
开发者ID:eclipse,项目名称:microprofile-metrics,代码行数:24,代码来源:TimedMethodBeanTest.java

示例15: callMeteredMethodsOnce

import org.jboss.arquillian.junit.InSequence; //导入依赖的package包/类
@Test
@InSequence(2)
public void callMeteredMethodsOnce() {
    assertThat("Meters are not registered correctly", registry.getMeters().keySet(), is(equalTo(METER_NAMES)));
    
    assertThat("Constructor meter count is incorrect", registry.getMeters().get(CONSTRUCTOR_METER_NAME).getCount(),
            is(equalTo(CONSTRUCTOR_COUNT.incrementAndGet())));

    // Call the metered methods and assert they've been marked
    bean.meteredMethodOne();
    bean.meteredMethodTwo();
    // Let's call the non-public methods as well
    bean.meteredMethodProtected();
    bean.meteredMethodPackagedPrivate();

    // Make sure that the method meters have been marked
    assertThat("Method meter counts are incorrect", registry.getMeters(METHOD_METERS).values(),
            everyItem(Matchers.<Meter> hasProperty("count", equalTo(METHOD_COUNT.incrementAndGet()))));
}
 
开发者ID:eclipse,项目名称:microprofile-metrics,代码行数:20,代码来源:MeteredClassBeanTest.java


注:本文中的org.jboss.arquillian.junit.InSequence类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。