@Test
public void testFindAllImportedVariables() {

	Component root = new Component( "root" );
	Component serverWithApp = new Component( "server with app" );
	Component serverWithAnotherApp = new Component( "server with another app" );
	Component db = new Component( "database" );
	root.addChild( db );
	root.addChild( serverWithAnotherApp );
	root.addChild( serverWithApp );
	serverWithApp.addImportedVariable( new ImportedVariable( "database.ip", false, false ));
	serverWithApp.addImportedVariable( new ImportedVariable( "database.port", true, false ));
	serverWithApp.addExportedVariable( new ExportedVariable( "url", "something" ));
	serverWithAnotherApp.extendComponent( serverWithApp );
	// Override the optional or mandatory aspect of an imported variable
	serverWithAnotherApp.addImportedVariable( new ImportedVariable( "database.port", false, false ));
	serverWithAnotherApp.addImportedVariable( new ImportedVariable( "whatever", false, false ));
	db.addExportedVariable( new ExportedVariable( "ip", null ));
	db.addExportedVariable( new ExportedVariable( "port", "3306" ));
	Assert.assertEquals( 0, ComponentHelpers.findAllImportedVariables( db ).size());
	Assert.assertEquals( 0, ComponentHelpers.findAllImportedVariables( root ).size());
	Map<String,ImportedVariable> imports = ComponentHelpers.findAllImportedVariables( serverWithApp );
	Assert.assertEquals( 2, imports.size());
	Assert.assertTrue( imports.containsKey( "database.ip" ));
	Assert.assertTrue( imports.containsKey( "database.port" ));
	Assert.assertTrue( imports.get( "database.port" ).isOptional());
	Assert.assertFalse( imports.get( "database.ip" ).isOptional());
	imports = ComponentHelpers.findAllImportedVariables( serverWithAnotherApp );
	Assert.assertEquals( 3, imports.size());
	Assert.assertTrue( imports.containsKey( "database.ip" ));
	Assert.assertTrue( imports.containsKey( "database.port" ));
	Assert.assertTrue( imports.containsKey( "whatever" ));
	Assert.assertFalse( imports.get( "database.ip" ).isOptional());
	Assert.assertFalse( imports.get( "database.port" ).isOptional());
	Assert.assertFalse( imports.get( "whatever" ).isOptional());
}