@Test
public void testApplicationDescriptor() {

	ApplicationTemplateDescriptor desc = new ApplicationTemplateDescriptor();
	Iterator<ModelError> iterator = RuntimeModelValidator.validate( desc ).iterator();
	Assert.assertEquals( ErrorCode.RM_MISSING_APPLICATION_NAME, iterator.next().getErrorCode());
	Assert.assertEquals( ErrorCode.RM_MISSING_APPLICATION_VERSION, iterator.next().getErrorCode());
	Assert.assertEquals( ErrorCode.RM_MISSING_APPLICATION_DSL_ID, iterator.next().getErrorCode());
	Assert.assertEquals( ErrorCode.RM_MISSING_APPLICATION_GEP, iterator.next().getErrorCode());
	Assert.assertFalse( iterator.hasNext());
	desc.setName( "My Application #!" );
	iterator = RuntimeModelValidator.validate( desc ).iterator();
	Assert.assertEquals( ErrorCode.RM_INVALID_APPLICATION_NAME, iterator.next().getErrorCode());
	Assert.assertEquals( ErrorCode.RM_MISSING_APPLICATION_VERSION, iterator.next().getErrorCode());
	Assert.assertEquals( ErrorCode.RM_MISSING_APPLICATION_DSL_ID, iterator.next().getErrorCode());
	Assert.assertEquals( ErrorCode.RM_MISSING_APPLICATION_GEP, iterator.next().getErrorCode());
	Assert.assertFalse( iterator.hasNext());
	desc.setName( "My Àppliçation" );
	iterator = RuntimeModelValidator.validate( desc ).iterator();
	Assert.assertEquals( ErrorCode.RM_MISSING_APPLICATION_VERSION, iterator.next().getErrorCode());
	Assert.assertEquals( ErrorCode.RM_MISSING_APPLICATION_DSL_ID, iterator.next().getErrorCode());
	Assert.assertEquals( ErrorCode.RM_MISSING_APPLICATION_GEP, iterator.next().getErrorCode());
	Assert.assertFalse( iterator.hasNext());
	desc.setName( "My Application" );
	iterator = RuntimeModelValidator.validate( desc ).iterator();
	Assert.assertEquals( ErrorCode.RM_MISSING_APPLICATION_VERSION, iterator.next().getErrorCode());
	Assert.assertEquals( ErrorCode.RM_MISSING_APPLICATION_DSL_ID, iterator.next().getErrorCode());
	Assert.assertEquals( ErrorCode.RM_MISSING_APPLICATION_GEP, iterator.next().getErrorCode());
	Assert.assertFalse( iterator.hasNext());
	desc.setVersion( "Snapshot Build #2401" );
	iterator = RuntimeModelValidator.validate( desc ).iterator();
	Assert.assertEquals( ErrorCode.RM_INVALID_APPLICATION_VERSION, iterator.next().getErrorCode());
	Assert.assertEquals( ErrorCode.RM_MISSING_APPLICATION_DSL_ID, iterator.next().getErrorCode());
	Assert.assertEquals( ErrorCode.RM_MISSING_APPLICATION_GEP, iterator.next().getErrorCode());
	Assert.assertFalse( iterator.hasNext());
	desc.setDslId( "roboconf-1.0" );
	desc.setVersion( "1.4" );
	iterator = RuntimeModelValidator.validate( desc ).iterator();
	Assert.assertEquals( ErrorCode.RM_MISSING_APPLICATION_GEP, iterator.next().getErrorCode());
	Assert.assertFalse( iterator.hasNext());
	desc.setGraphEntryPoint( "graph.graph" );
	Assert.assertEquals( 0, RuntimeModelValidator.validate( desc ).size());
	desc.invalidExternalExports.add( "oops" );
	iterator = RuntimeModelValidator.validate( desc ).iterator();
	Assert.assertEquals( ErrorCode.PROJ_INVALID_EXTERNAL_EXPORTS, iterator.next().getErrorCode());
	Assert.assertEquals( ErrorCode.RM_MISSING_APPLICATION_EXPORT_PREFIX, iterator.next().getErrorCode());
	Assert.assertFalse( iterator.hasNext());
	desc.invalidExternalExports.clear();
	desc.externalExports.put( "comp.valid", "ok" );
	desc.externalExports.put( "comp.!nvalid", "ko" );
	iterator = RuntimeModelValidator.validate( desc ).iterator();
	Assert.assertEquals( ErrorCode.RM_INVALID_VARIABLE_NAME, iterator.next().getErrorCode());
	Assert.assertEquals( ErrorCode.RM_MISSING_APPLICATION_EXPORT_PREFIX, iterator.next().getErrorCode());
	Assert.assertFalse( iterator.hasNext());
	desc.externalExports.remove( "comp.!nvalid" );
	iterator = RuntimeModelValidator.validate( desc ).iterator();
	Assert.assertEquals( ErrorCode.RM_MISSING_APPLICATION_EXPORT_PREFIX, iterator.next().getErrorCode());
	Assert.assertFalse( iterator.hasNext());
	desc.setExternalExportsPrefix( "prefix" );
	Assert.assertEquals( 0, RuntimeModelValidator.validate( desc ).size());
	desc.externalExports.put( "comp.valid", "!nvalid" );
	iterator = RuntimeModelValidator.validate( desc ).iterator();
	Assert.assertEquals( ErrorCode.RM_INVALID_VARIABLE_NAME, iterator.next().getErrorCode());
	Assert.assertFalse( iterator.hasNext());
}