@Test
public void testFindAllExportedVariables_withFacets() {

	Component component = new Component( "comp 1" );
	component.addExportedVariable( new ExportedVariable( "var1", "another value" ));
	component.addExportedVariable( new ExportedVariable( "var2", "var 2 value" ));
	component.addExportedVariable( new ExportedVariable( "ip", null ));
	Facet f1 = new Facet( "f1" );
	f1.addExportedVariable( new ExportedVariable( "param1", "value1" ));
	component.associateFacet( f1 );
	Facet f2 = new Facet( "f2" );
	f2.addExportedVariable( new ExportedVariable( "param2", "value2" ));
	component.associateFacet( f2 );
	Facet f3 = new Facet( "f3" );
	f3.addExportedVariable( new ExportedVariable( "param3", "value3" ));
	component.associateFacet( f3 );
	component.addExportedVariable( new ExportedVariable( "f3.param3", "component overrides facet" ));
	Facet f4 = new Facet( "f4" );
	f4.addExportedVariable( new ExportedVariable( "param4-1", "value4" ));
	f4.addExportedVariable( new ExportedVariable( "param4-2", "value4" ));
	f2.extendFacet( f4 );
	f2.addExportedVariable( new ExportedVariable( "f4.param4-1", "facet overrides facet" ));
	Instance instance = new Instance( "inst 1" );
	instance.setComponent( component );
	instance.overriddenExports.put( "var1", "some value" );
	instance.overriddenExports.put( "toto.ip", null );
	instance.overriddenExports.put( "f1.param1", "my-value" );
	instance.data.put( Instance.IP_ADDRESS, "192.168.1.18" );
	Component extendedComponent = new Component( "extended" );
	extendedComponent.addExportedVariable( new ExportedVariable( "v", "hop" ));
	component.extendComponent( extendedComponent );
	component.addExportedVariable( new ExportedVariable( "extended.v", "nop" ));
	Map<String,String> map = InstanceHelpers.findAllExportedVariables( instance );
	Assert.assertEquals( 16, map.size());
	Assert.assertEquals( "some value", map.get( "comp 1.var1" ));
	Assert.assertEquals( "var 2 value", map.get( "comp 1.var2" ));
	Assert.assertEquals( "192.168.1.18", map.get( "comp 1.ip" ));
	Assert.assertEquals( "192.168.1.18", map.get( "toto.ip" ));
	Assert.assertEquals( "nop", map.get( "extended.v" ));
	// The first one was specifically overridden in the instance
	Assert.assertEquals( "my-value", map.get( "f1.param1" ));
	Assert.assertEquals( "value1", map.get( "comp 1.param1" ));
	Assert.assertEquals( "value2", map.get( "f2.param2" ));
	Assert.assertEquals( "value2", map.get( "comp 1.param2" ));
	Assert.assertEquals( "component overrides facet", map.get( "f3.param3" ));
	Assert.assertEquals( "component overrides facet", map.get( "comp 1.param3" ));
	Assert.assertEquals( "facet overrides facet", map.get( "f4.param4-1" ));
	Assert.assertEquals( "value4", map.get( "f4.param4-2" ));
}