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");
localRefs.add(localRef);
overrideEnv.setEjbLocalReferences(localRefs);
ejbRefs = new EJBReferencesMetaData();
ejbRef = new EJBReferenceMetaData();
ejbRef.setEjbRefName("ejbRef2");
ejbRef.setJndiName(ejbRef.getEjbRefName() + "Override");
ejbRefs.add(ejbRef);
overrideEnv.setEjbReferences(ejbRefs);
envEntries = new EnvironmentEntriesMetaData();
envEntry = new EnvironmentEntryMetaData();
envEntry.setEnvEntryName("entry2");
envEntry.setJndiName(envEntry.getEnvEntryName() + "Override");
envEntries.add(envEntry);
envEntry = new EnvironmentEntryMetaData();
envEntry.setEnvEntryName("entry3");
envEntry.setJndiName(envEntry.getEnvEntryName() + "Override");
envEntries.add(envEntry);
overrideEnv.setEnvironmentEntries(envEntries);
destRefs = new MessageDestinationReferencesMetaData();
destRef = new MessageDestinationReferenceMetaData();
destRef.setMessageDestinationRefName("destRef2");
destRef.setJndiName(destRef.getMessageDestinationRefName() + "Override");
destRefs.add(destRef);
overrideEnv.setMessageDestinationReferences(destRefs);
pctxRefs = new PersistenceContextReferencesMetaData();
pctxRef = new PersistenceContextReferenceMetaData();
pctxRef.setPersistenceContextRefName("pctxRef2");
pctxRef.setJndiName(pctxRef.getPersistenceContextRefName() + "Override");
pctxRefs.add(pctxRef);
pctxRef = new PersistenceContextReferenceMetaData();
pctxRef.setPersistenceContextRefName("pctxRef3");
pctxRef.setJndiName(pctxRef.getPersistenceContextRefName() + "Override");
pctxRefs.add(pctxRef);
overrideEnv.setPersistenceContextRefs(pctxRefs);
pUnitRefs = new PersistenceUnitReferencesMetaData();
pUnitRef = new PersistenceUnitReferenceMetaData();
pUnitRef.setPersistenceUnitRefName("pUnitRef2");
pUnitRef.setJndiName(pUnitRef.getPersistenceUnitRefName() + "Override");
pUnitRefs.add(pUnitRef);
pUnitRef = new PersistenceUnitReferenceMetaData();
pUnitRef.setPersistenceUnitRefName("pUnitRef3");
pUnitRef.setJndiName(pUnitRef.getPersistenceUnitRefName() + "Override");
pUnitRefs.add(pUnitRef);
overrideEnv.setPersistenceUnitRefs(pUnitRefs);
callbacks = new LifecycleCallbacksMetaData();
callback = new LifecycleCallbackMetaData();
callback.setClassName("class2");
callback.setMethodName("postCtor2Override");
callbacks.add(callback);
callback = new LifecycleCallbackMetaData();
callback.setClassName("class3");
callback.setMethodName("postCtor3Override");
callbacks.add(callback);
overrideEnv.setPostConstructs(callbacks);
callbacks = new LifecycleCallbacksMetaData();
callback = new LifecycleCallbackMetaData();
callback.setClassName("class2");
callback.setMethodName("preDestroy2Override");
callbacks.add(callback);
callback = new LifecycleCallbackMetaData();
callback.setClassName("class3");
callback.setMethodName("preDestroy3Override");
callbacks.add(callback);
overrideEnv.setPreDestroys(callbacks);
resEnvRefs = new ResourceEnvironmentReferencesMetaData();
resEnvRef = new ResourceEnvironmentReferenceMetaData();