本文整理匯總了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()))));
}
示例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);
}
示例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);
}
示例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!");
}
示例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\"}"))
;
}
示例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!");
}
示例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"))));
}
示例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));
}
示例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))));
}
示例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()))));
}
示例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()))));
}
示例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));
}
}
}
示例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()))));
}
示例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!");
}
示例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()))));
}