@Test
public void testOverriddenExports() throws Exception {

	Component vmComponent = new Component( "VM" ).installerName( "target" );
	Component tomcatComponent = new Component( "Tomcat" ).installerName( "puppet" );
	tomcatComponent.addExportedVariable( new ExportedVariable( "Tomcat.ip", null ));
	tomcatComponent.addExportedVariable( new ExportedVariable( "Tomcat.port", "8080" ));
	vmComponent.addChild( tomcatComponent );
	Graphs graphs = new Graphs();
	graphs.getRootComponents().add( vmComponent );
	File f = TestUtils.findTestFile( "/configurations/valid/instance-overridden-exports.instances" );
	FromInstanceDefinition fromDef = new FromInstanceDefinition( f.getParentFile());
	Collection<Instance> rootInstances = fromDef.buildInstances( graphs, f );
	Assert.assertEquals( 0, fromDef.getErrors().size());
	Assert.assertEquals( 1, rootInstances.size());
	Instance rootInstance = rootInstances.iterator().next();
	Collection<Instance> instances = InstanceHelpers.buildHierarchicalList( rootInstance );
	Assert.assertEquals( 2, instances.size());
	Collection<ModelError> errors = RuntimeModelValidator.validate( instances );
	Assert.assertEquals( 1, errors.size());
	Assert.assertEquals( ErrorCode.RM_MAGIC_INSTANCE_VARIABLE, errors.iterator().next().getErrorCode());
}