@Test
public void testDeploymentDesciptorMergeMergeCollections() {

	DeploymentDescriptor master = new DeploymentDescriptorImpl("org.jbpm.domain");
	master.getBuilder()
	.addMarshalingStrategy(new ObjectModel("org.jbpm.test.CustomStrategy", new Object[]{"param2"}))
	.setLimitSerializationClasses(true);
	assertNotNull(master);
	assertEquals("org.jbpm.domain", master.getPersistenceUnit());
	assertEquals("org.jbpm.domain", master.getAuditPersistenceUnit());
	assertEquals(AuditMode.JPA, master.getAuditMode());
	assertEquals(PersistenceMode.JPA, master.getPersistenceMode());
	assertEquals(RuntimeStrategy.SINGLETON, master.getRuntimeStrategy());
	assertEquals(1, master.getMarshallingStrategies().size());
	assertEquals(0, master.getConfiguration().size());
	assertEquals(0, master.getEnvironmentEntries().size());
	assertEquals(0, master.getEventListeners().size());
	assertEquals(0, master.getGlobals().size());
	assertEquals(0, master.getTaskEventListeners().size());
	assertEquals(0, master.getWorkItemHandlers().size());
	assertTrue(master.getLimitSerializationClasses());
	DeploymentDescriptor slave = new DeploymentDescriptorImpl("org.jbpm.domain");
	slave.getBuilder()
	.auditMode(AuditMode.JMS)
	.persistenceMode(PersistenceMode.JPA)
	.persistenceUnit(null)
	.auditPersistenceUnit("")
	.addMarshalingStrategy(new ObjectModel("org.jbpm.test.AnotherCustomStrategy", new Object[]{"param2"}))
	.setLimitSerializationClasses(false);
	assertNotNull(slave);
	assertEquals(null, slave.getPersistenceUnit());
	assertEquals("", slave.getAuditPersistenceUnit());
	assertEquals(AuditMode.JMS, slave.getAuditMode());
	assertEquals(PersistenceMode.JPA, slave.getPersistenceMode());
	assertEquals(RuntimeStrategy.SINGLETON, slave.getRuntimeStrategy());
	assertEquals(1, slave.getMarshallingStrategies().size());
	assertEquals(0, slave.getConfiguration().size());
	assertEquals(0, slave.getEnvironmentEntries().size());
	assertEquals(0, slave.getEventListeners().size());
	assertEquals(0, slave.getGlobals().size());
	assertEquals(0, slave.getTaskEventListeners().size());
	assertEquals(0, slave.getWorkItemHandlers().size());
	assertFalse(slave.getLimitSerializationClasses());
	// and now let's merge them
	DeploymentDescriptorMerger merger = new DeploymentDescriptorMerger();
	DeploymentDescriptor outcome = merger.merge(master, slave, MergeMode.MERGE_COLLECTIONS);
	assertNotNull(outcome);
	assertEquals("org.jbpm.domain", outcome.getPersistenceUnit());
	assertEquals("org.jbpm.domain", outcome.getAuditPersistenceUnit());
	assertEquals(AuditMode.JMS, outcome.getAuditMode());
	assertEquals(PersistenceMode.JPA, outcome.getPersistenceMode());
	assertEquals(RuntimeStrategy.SINGLETON, outcome.getRuntimeStrategy());
	assertEquals(2, outcome.getMarshallingStrategies().size());
	assertEquals(0, outcome.getConfiguration().size());
	assertEquals(0, outcome.getEnvironmentEntries().size());
	assertEquals(0, outcome.getEventListeners().size());
	assertEquals(0, outcome.getGlobals().size());
	assertEquals(0, outcome.getTaskEventListeners().size());
	assertEquals(0, outcome.getWorkItemHandlers().size());
	assertFalse(outcome.getLimitSerializationClasses());
}