MessageDestinationReferenceMetaData mailQueue = msgRefs.get(MyServlet.class.getName() + "/mailQueue");
assertNotNull(mailQueue);
assertEquals("javax.jms.Queue", mailQueue.getType());
// WebServiceRef(s)
ServiceReferencesMetaData serviceRefs = env.getServiceReferences();
assertNotNull(serviceRefs);
assertEquals(6, serviceRefs.size());
ServiceReferenceMetaData serviceRef1 = serviceRefs.get("service2");
assertNotNull(serviceRef1);
assertEquals(TestEndpointService.class.getName(), serviceRef1.getServiceInterface());
assertEquals(MyServlet.class.getName(), serviceRef1.getServiceRefType());
assertNull(serviceRef1.getInjectionTargets());
ServiceReferenceMetaData serviceRef2 = serviceRefs.get("port1");
assertNotNull(serviceRef2);
assertEquals(TestEndpointService.class.getName(), serviceRef2.getServiceInterface());
assertEquals(TestEndpoint.class.getName(), serviceRef2.getServiceRefType());
assertNull(serviceRef2.getInjectionTargets());
ServiceReferenceMetaData serviceRef3 = serviceRefs
.get("org.jboss.test.metadata.annotation.web.MyServlet/service");
assertNotNull(serviceRef3);
assertEquals(MyServlet.class.getDeclaredField("service"), serviceRef3.getAnnotatedElement());
assertNull(serviceRef3.getServiceInterface());
assertEquals(TestEndpointService.class.getName(), serviceRef3.getServiceRefType());
//InjectionTarget on a FIELD
Set<ResourceInjectionTargetMetaData> injectionTargets3 = serviceRef3.getInjectionTargets();
assertNotNull(injectionTargets3);
assertEquals(1, injectionTargets3.size());
ResourceInjectionTargetMetaData injectionTarget = new ResourceInjectionTargetMetaData();
injectionTarget.setInjectionTargetClass(MyServlet.class.getName());
injectionTarget.setInjectionTargetName("service");
assertTrue(injectionTargets3.contains(injectionTarget));
ServiceReferenceMetaData serviceRef4 = serviceRefs.get(MyServlet.class.getName() + "/endpoint");
assertNotNull(serviceRef4);
assertEquals(MyServlet.class.getDeclaredField("endpoint"), serviceRef4.getAnnotatedElement());
assertNull(serviceRef4.getServiceInterface());
assertEquals(TestEndpoint.class.getName(), serviceRef4.getServiceRefType());
//InjectionTarget on a FIELD
Set<ResourceInjectionTargetMetaData> injectionTargets4 = serviceRef4.getInjectionTargets();
assertNotNull(injectionTargets4);
assertEquals(1, injectionTargets4.size());
injectionTarget = new ResourceInjectionTargetMetaData();
injectionTarget.setInjectionTargetClass(MyServlet.class.getName());
injectionTarget.setInjectionTargetName("endpoint");
assertTrue(injectionTargets4.contains(injectionTarget));
ServiceReferenceMetaData serviceRef5 = serviceRefs.get(MyServlet.class.getName() + "/anotherWebRef");
assertNotNull(serviceRef5);
assertNull(serviceRef5.getServiceInterface());
assertEquals(TestEndpoint.class.getName(), serviceRef5.getServiceRefType());
//InjectionTarget on a METHOD
Set<ResourceInjectionTargetMetaData> injectionTargets5 = serviceRef5.getInjectionTargets();
assertNotNull(injectionTargets5);
assertEquals(1, injectionTargets5.size());
injectionTarget = new ResourceInjectionTargetMetaData();
injectionTarget.setInjectionTargetClass(MyServlet.class.getName());
injectionTarget.setInjectionTargetName("setAnotherWebRef");
assertTrue(injectionTargets5.contains(injectionTarget));
ServiceReferenceMetaData serviceRef6 = serviceRefs.get("method/service");
assertNotNull(serviceRef6);
assertNull(serviceRef6.getServiceInterface());
assertEquals(TestEndpoint.class.getName(), serviceRef6.getServiceRefType());
//InjectionTarget on a METHOD
Set<ResourceInjectionTargetMetaData> injectionTargets6 = serviceRef6.getInjectionTargets();