use of org.eclipse.microprofile.metrics.Tag in project Payara by payara.
the class BulkheadMetricTckTest method bulkheadMetricRejectionTest.
/**
* Scenario is equivalent to the TCK test of same name but not 100% identical
*/
@Test(timeout = 3000)
public void bulkheadMetricRejectionTest() {
callMethodWithNewThreadAndWaitFor(commonWaiter);
callMethodWithNewThreadAndWaitFor(commonWaiter);
waitUntilPermitsAquired(2, 0);
assertFurtherThreadThrowsBulkheadException(1);
commonWaiter.complete(null);
waitUntilPermitsAquired(0, 0);
String methodName = "fish.payara.microprofile.faulttolerance.policy.BulkheadMetricTckTest.bulkheadMetricRejectionTest_Method";
@SuppressWarnings("unchecked") Gauge<Long> excutionsRunning = (Gauge<Long>) registry.getGauge(new MetricID("ft.bulkhead.executionsRunning", new Tag("method", methodName)));
assertNotNull(excutionsRunning);
assertEquals(0, excutionsRunning.getValue().intValue());
Counter acceptedCalls = registry.getCounter(new MetricID("ft.bulkhead.calls.total", new Tag("method", methodName), new Tag("bulkheadResult", "accepted")));
assertNotNull(acceptedCalls);
assertEquals(2, acceptedCalls.getCount());
Counter rejectedCalls = registry.getCounter(new MetricID("ft.bulkhead.calls.total", new Tag("method", methodName), new Tag("bulkheadResult", "rejected")));
assertNotNull(rejectedCalls);
assertEquals(1, rejectedCalls.getCount());
}
Aggregations