use of org.jboss.weld.probe.tests.integration.deployment.beans.DummyBean in project core by weld.
the class ProbeExtensionsTest method testExtensionVisibleInProbe.
@Test
public void testExtensionVisibleInProbe() throws IOException {
JsonObject beansInTestArchive = getPageAsJSONObject(BEANS_PATH_ALL, url);
assertNotNull(beansInTestArchive);
JsonArray beansArray = beansInTestArchive.getJsonArray(DATA);
ReadContext ctx = JsonPath.parse(beansInTestArchive.toString());
List<String> beanClasses = ctx.read("$." + DATA + "[*]." + BEAN_CLASS, List.class);
assertBeanClassVisibleInProbe(TestExtension.class, beanClasses);
// test extension attributes
JsonObject extensionBeanDetail = getBeanDetail(BEANS_PATH_ALL, TestExtension.class, url);
assertEquals(BeanType.EXTENSION.name(), extensionBeanDetail.getString(KIND));
ctx = JsonPath.parse(extensionBeanDetail.toString());
List<String> observedTypes = ctx.read("$." + DECLARED_OBSERVERS + "[*]." + OBSERVED_TYPE, List.class);
assertTrue("Cannot find ProcessAnnotatedType observer method!", observedTypes.contains(ProcessAnnotatedType.class.getName() + "<DummyBean>"));
// test bean altered by extension
JsonObject dummyBeanDetail = getBeanDetail(BEANS_PATH_ALL, DummyBean.class, url);
ctx = JsonPath.parse(dummyBeanDetail.toString());
List<String> qualifiers = ctx.read("$." + QUALIFIERS + "[*]", List.class);
assertTrue("Cannot find " + Collector.class + " qualifier on " + DummyBean.class, qualifiers.contains("@" + Collector.class.getName().concat("(value=\"\")")));
}
Aggregations