Collection<Class<?>> classes = PackageScanner.loadClasses();
ApplicationClient5MetaDataCreator creator = new ApplicationClient5MetaDataCreator(finder, classMainName);
ApplicationClient5MetaData clientMD = creator.create(classes);
ApplicationClient5MetaData xmlMD = super.unmarshal(ApplicationClient5MetaData.class);
EnvironmentEntryMetaData msg = xmlMD.getEnvironmentEntryByName("msg");
assertNotNull(msg);
ApplicationClient5MetaData merged = new ApplicationClient5MetaData();
AnnotationMergedView.merge(merged, xmlMD, clientMD);
msg = merged.getEnvironmentEntryByName("msg");
assertNotNull(msg);
assertEquals("java.lang.String", msg.getType());
assertEquals("how are you?", msg.getValue());
LifecycleCallbacksMetaData postConstructs = merged.getPostConstructs();
assertNotNull(postConstructs);
// 2 because of the null class name in the xml
assertEquals(2, postConstructs.size());
LifecycleCallbackMetaData pc0 = postConstructs.get(0);
assertEquals("postConstruct", pc0.getMethodName());
LifecycleCallbacksMetaData preDestroys = merged.getPreDestroys();
assertNotNull(preDestroys);
// 2 because of the null class name in the xml
assertEquals(2, preDestroys.size());
LifecycleCallbackMetaData pd0 = preDestroys.get(0);
assertEquals("preDestroy", pd0.getMethodName());
assertEquals("org.jboss.ejb3.test.applicationclient.client.TestCallbackHandler", merged.getCallbackHandler());
// ORB maps to a resource-env-ref
ResourceEnvironmentReferenceMetaData orbRes = clientMD.getResourceEnvironmentReferenceByName(Client.class.getName() + "/orb");
assertNotNull(orbRes);
assertEquals(ORB.class.getName(), orbRes.getType());
ResourceEnvironmentReferenceMetaData messageReplier = merged.getResourceEnvironmentReferenceByName("messageReplier");
assertNotNull(messageReplier);
assertEquals("javax.jms.Queue", messageReplier.getType());
// String maps to env-entry
EnvironmentEntryMetaData queueNameEntry = clientMD.getEnvironmentEntryByName("queueName");
assertNotNull(queueNameEntry);
assertEquals("queue/testQueueOverride", queueNameEntry.getValue());
Set<ResourceInjectionTargetMetaData> queueNameEntryTargets = queueNameEntry.getInjectionTargets();
assertNotNull(queueNameEntryTargets);
assertEquals(1, queueNameEntryTargets.size());
ResourceInjectionTargetMetaData queueNameEntryField = queueNameEntryTargets.iterator().next();
assertEquals(Client.class.getName(), queueNameEntryField.getInjectionTargetClass());
assertEquals("queueName", queueNameEntryField.getInjectionTargetName());