{
DeploymentFactory factory = createDeploymentFactory();
Deployment deployment = createDeployment();
List<ClassPathEntry> classPath = factory.createClassPath("ClassPath");
ContextInfo context1 = factory.addContext(deployment, "path1", "metaDataPath", classPath);
assertEquals("path1", context1.getPath());
assertDefaultMetaDataPath(context1.getMetaDataPath());
assertEquals(classPath, context1.getClassPath());
StructureMetaData structure = assertStructureMetaData(deployment);
assertContexts(structure, context1);
deployment = serializeDeserialize(deployment, Deployment.class);
structure = assertStructureMetaData(deployment);
assertContexts(structure, context1);
ContextInfo context2 = factory.addContext(deployment, "path2");
assertEquals("path2", context2.getPath());
assertDefaultNonPath(context2);
structure = assertStructureMetaData(deployment);
assertContexts(structure, context1, context2);
deployment = serializeDeserialize(deployment, Deployment.class);
structure = assertStructureMetaData(deployment);
assertContexts(structure, context1, context2);
ContextInfo testContext = structure.getContext("path2");
ContextInfo child1 = factory.addContext(testContext, "child1");
assertEquals("child1", child1.getPath());
assertDefaultNonPath(child1);
ContextInfo child2 = factory.addContext(testContext, "child2");
assertEquals("child2", child2.getPath());
assertDefaultNonPath(child2);
ContextInfo child3 = factory.addContext(testContext, "child3");
assertEquals("child3", child3.getPath());
assertDefaultNonPath(child3);
assertContexts(structure, context1, context2);
StructureMetaData childStructure = assertStructureMetaData(testContext);
assertContexts(childStructure, child1, child2, child3);