JBossSessionBeanMetaData original = new JBossSessionBeanMetaData();
original.setEjbName("session");
JBossEnvironmentRefsGroupMetaData originalEnv = new JBossEnvironmentRefsGroupMetaData();
original.setJndiEnvironmentRefsGroup(originalEnv);
originalEnv.setAnnotatedEjbReferences(new AnnotatedEJBReferencesMetaData());
EJBLocalReferencesMetaData localRefs = new EJBLocalReferencesMetaData();
EJBLocalReferenceMetaData localRef = new EJBLocalReferenceMetaData();
localRef.setEjbRefName("localRef1");
localRef.setJndiName(localRef.getEjbRefName() + "Original");
localRefs.add(localRef);
localRef = new EJBLocalReferenceMetaData();
localRef.setEjbRefName("localRef2");
localRef.setJndiName(localRef.getEjbRefName() + "Original");
localRefs.add(localRef);
originalEnv.setEjbLocalReferences(localRefs);
EJBReferencesMetaData ejbRefs = new EJBReferencesMetaData();
EJBReferenceMetaData ejbRef = new EJBReferenceMetaData();
ejbRef.setEjbRefName("ejbRef1");
ejbRef.setJndiName(ejbRef.getEjbRefName() + "Original");
ejbRefs.add(ejbRef);
ejbRef = new EJBReferenceMetaData();
ejbRef.setEjbRefName("ejbRef2");
ejbRef.setJndiName(ejbRef.getEjbRefName() + "Original");
ejbRefs.add(ejbRef);
originalEnv.setEjbReferences(ejbRefs);
EnvironmentEntriesMetaData envEntries = new EnvironmentEntriesMetaData();
EnvironmentEntryMetaData envEntry = new EnvironmentEntryMetaData();
envEntry.setEnvEntryName("entry1");
envEntry.setJndiName(envEntry.getEnvEntryName() + "Original");
envEntries.add(envEntry);
envEntry = new EnvironmentEntryMetaData();
envEntry.setEnvEntryName("entry2");
envEntry.setJndiName(envEntry.getEnvEntryName() + "Original");
envEntries.add(envEntry);
originalEnv.setEnvironmentEntries(envEntries);
MessageDestinationReferencesMetaData destRefs = new MessageDestinationReferencesMetaData();
MessageDestinationReferenceMetaData destRef = new MessageDestinationReferenceMetaData();
destRef.setMessageDestinationRefName("destRef1");
destRef.setJndiName(destRef.getMessageDestinationRefName() + "Original");
destRefs.add(destRef);
destRef = new MessageDestinationReferenceMetaData();
destRef.setMessageDestinationRefName("destRef2");
destRef.setJndiName(destRef.getMessageDestinationRefName() + "Original");
destRefs.add(destRef);
originalEnv.setMessageDestinationReferences(destRefs);
PersistenceContextReferencesMetaData pctxRefs = new PersistenceContextReferencesMetaData();
PersistenceContextReferenceMetaData pctxRef = new PersistenceContextReferenceMetaData();
pctxRef.setPersistenceContextRefName("pctxRef1");
pctxRef.setJndiName(pctxRef.getPersistenceContextRefName() + "Original");
pctxRefs.add(pctxRef);
pctxRef = new PersistenceContextReferenceMetaData();
pctxRef.setPersistenceContextRefName("pctxRef2");
pctxRef.setJndiName(pctxRef.getPersistenceContextRefName() + "Original");
pctxRefs.add(pctxRef);
originalEnv.setPersistenceContextRefs(pctxRefs);
PersistenceUnitReferencesMetaData pUnitRefs = new PersistenceUnitReferencesMetaData();
PersistenceUnitReferenceMetaData pUnitRef = new PersistenceUnitReferenceMetaData();
pUnitRef.setPersistenceUnitRefName("pUnitRef1");
pUnitRef.setJndiName(pUnitRef.getPersistenceUnitRefName() + "Original");
pUnitRefs.add(pUnitRef);
pUnitRef = new PersistenceUnitReferenceMetaData();
pUnitRef.setPersistenceUnitRefName("pUnitRef2");
pUnitRef.setJndiName(pUnitRef.getPersistenceUnitRefName() + "Original");
pUnitRefs.add(pUnitRef);
originalEnv.setPersistenceUnitRefs(pUnitRefs);
LifecycleCallbacksMetaData callbacks = new LifecycleCallbacksMetaData();
LifecycleCallbackMetaData callback = new LifecycleCallbackMetaData();
callback.setClassName("class1");
callback.setMethodName("postCtor1Original");
callbacks.add(callback);
callback = new LifecycleCallbackMetaData();
callback.setClassName("class2");
callback.setMethodName("postCtor2Original");
callbacks.add(callback);
originalEnv.setPostConstructs(callbacks);
callbacks = new LifecycleCallbacksMetaData();
callback = new LifecycleCallbackMetaData();
callback.setClassName("class1");
callback.setMethodName("preDestroy1Original");
callbacks.add(callback);
callback = new LifecycleCallbackMetaData();
callback.setClassName("class2");
callback.setMethodName("preDestroy2Original");
callbacks.add(callback);
originalEnv.setPreDestroys(callbacks);
ResourceEnvironmentReferencesMetaData resEnvRefs = new ResourceEnvironmentReferencesMetaData();
ResourceEnvironmentReferenceMetaData resEnvRef = new ResourceEnvironmentReferenceMetaData();
resEnvRef.setResourceEnvRefName("resEnvRef1");
resEnvRef.setJndiName(resEnvRef.getResourceEnvRefName() + "Original");
resEnvRefs.add(resEnvRef);
resEnvRef = new ResourceEnvironmentReferenceMetaData();
resEnvRef.setResourceEnvRefName("resEnvRef2");
resEnvRef.setJndiName(resEnvRef.getResourceEnvRefName() + "Original");
resEnvRefs.add(resEnvRef);
originalEnv.setResourceEnvironmentReferences(resEnvRefs);
ResourceReferencesMetaData resRefs = new ResourceReferencesMetaData();
ResourceReferenceMetaData resRef = new ResourceReferenceMetaData();
resRef.setResourceRefName("resRef1");
resRef.setJndiName(resRef.getResourceRefName() + "Original");
resRefs.add(resRef);
resRef = new ResourceReferenceMetaData();
resRef.setResourceRefName("resRef2");
resRef.setJndiName(resRef.getResourceRefName() + "Original");
resRefs.add(resRef);
originalEnv.setResourceReferences(resRefs);
JBossServiceReferencesMetaData serviceRefs = new JBossServiceReferencesMetaData();
JBossServiceReferenceMetaData serviceRef = new JBossServiceReferenceMetaData();
serviceRef.setServiceRefName("serviceRef1");
serviceRef.setJndiName(serviceRef.getServiceRefName() + "Original");
serviceRefs.add(serviceRef);
serviceRef = new JBossServiceReferenceMetaData();
serviceRef.setServiceRefName("serviceRef2");
serviceRef.setJndiName(serviceRef.getServiceRefName() + "Original");
serviceRefs.add(serviceRef);
originalEnv.setServiceReferences(serviceRefs);
// override
JBossSessionBeanMetaData override = new JBossSessionBeanMetaData();
override.setEjbName("session");
JBossEnvironmentRefsGroupMetaData overrideEnv = new JBossEnvironmentRefsGroupMetaData();
override.setJndiEnvironmentRefsGroup(overrideEnv);
overrideEnv.setAnnotatedEjbReferences(new AnnotatedEJBReferencesMetaData());
localRefs = new EJBLocalReferencesMetaData();
localRef = new EJBLocalReferenceMetaData();
localRef.setEjbRefName("localRef2");
localRef.setJndiName(localRef.getEjbRefName() + "Override");