@Test public void testOverride() { // All tomcat group nodes are placed first loadTomcatGroup(); loadGigaSpacesGroup(); Assert.assertEquals(2, loader.getDependenciesMap().keySet().size()); Assert.assertTrue(loader.getDependenciesMap().containsKey(baseTypesV2)); Assert.assertTrue(loader.getDependenciesMap().containsKey(javaTypesV2)); Assert.assertEquals( Sets.newHashSet( "tosca.nodes.Compute", "tosca.nodes.Java", "tosca.nodes.Tomcat", "tosca.relationships.HostedOn", "tosca.relationships.DependsOn", "tosca.relationships.WarDeployedOn", "tosca.nodes.War", "tosca.nodes.GigaSpaces", "tosca.relationships.ConnectedTo"), loader.getDependenciesMap().get(baseTypesV2)); Assert.assertEquals( Sets.newHashSet( "tosca.nodes.Java", "tosca.nodes.Tomcat", "tosca.nodes.War", "tosca.nodes.GigaSpaces", "tosca.relationships.WarDeployedOn"), loader.getDependenciesMap().get(javaTypesV2)); unloadTomcatGroup(); unloadGigaSpacesGroup(); Assert.assertTrue(loader.getDependenciesMap().isEmpty()); Assert.assertTrue(loader.getTypeUsagesMap().isEmpty()); }
@Test public void testStandardUseCase() { loadTomcatGroup(); Assert.assertEquals(2, loader.getDependenciesMap().keySet().size()); Assert.assertTrue(loader.getDependenciesMap().containsKey(baseTypes)); Assert.assertTrue(loader.getDependenciesMap().containsKey(javaTypes)); Assert.assertEquals( Sets.newHashSet( "tosca.nodes.Compute", "tosca.nodes.Java", "tosca.relationships.HostedOn", "tosca.relationships.DependsOn", "tosca.relationships.WarDeployedOn", "tosca.nodes.War", "tosca.nodes.Tomcat"), loader.getDependenciesMap().get(baseTypes)); Assert.assertEquals( Sets.newHashSet( "tosca.nodes.Java", "tosca.nodes.Tomcat", "tosca.nodes.War", "tosca.relationships.WarDeployedOn"), loader.getDependenciesMap().get(javaTypes)); Assert.assertEquals(1, loader.getTypeUsagesMap().get("tosca.nodes.Compute").intValue()); Assert.assertEquals(1, loader.getTypeUsagesMap().get("tosca.nodes.Java").intValue()); Assert.assertEquals(1, loader.getTypeUsagesMap().get("tosca.nodes.Tomcat").intValue()); Assert.assertEquals(1, loader.getTypeUsagesMap().get("tosca.nodes.War").intValue()); Assert.assertEquals( 2, loader.getTypeUsagesMap().get("tosca.relationships.HostedOn").intValue()); Assert.assertEquals( 1, loader.getTypeUsagesMap().get("tosca.relationships.DependsOn").intValue()); Assert.assertEquals( 1, loader.getTypeUsagesMap().get("tosca.relationships.WarDeployedOn").intValue()); unloadTomcatGroup(); Assert.assertTrue(loader.getDependenciesMap().isEmpty()); Assert.assertTrue(loader.getTypeUsagesMap().isEmpty()); }