@Test
public void testFindScriptForDm() throws Exception {

	// Precondition: all the right scripts were copied in the target directory.
	// Prepare our resources
	TestApplication app = new TestApplication();
	String targetId1 = this.mngr.createTarget( "id: tid1\nhandler: h" );
	File dir1 = new File( this.configurationMngr.getWorkingDirectory(), ConfigurationUtils.TARGETS + "/" + targetId1 + "/" + Constants.PROJECT_SUB_DIR_SCRIPTS );
	Assert.assertTrue( new File( dir1, "sub" ).mkdirs());
	Utils.writeStringInto( "#!/bin/bash\necho Bonjour le monde cruel > toto.txt", new File( dir1, "sub/whatever.sh" ));
	Utils.writeStringInto( "#!/bin/bash\necho Bonjour le monde cruel > toto.txt", new File( dir1, "sub/" + Constants.LOCAL_RESOURCE_PREFIX + "whatever.sh" ));
	Utils.writeStringInto( "#!/bin/bash\necho Bonjour le monde cruel > toto.txt", new File( dir1, "sub/properties-for-whatever.properties" ));
	// Associate the application with the first target ID
	this.mngr.associateTargetWith( targetId1, app, null );
	File dmScript = this.mngr.findScriptForDm( app, app.getMySqlVm());
	Assert.assertNull( dmScript );
	Utils.writeStringInto(
			"#!/bin/bash\necho Bonjour le monde cruel > toto.txt",
			new File( dir1, "target." + Constants.SCOPED_SCRIPT_AT_DM_CONFIGURE_SUFFIX + ".sh" ));
	dmScript = this.mngr.findScriptForDm( app, app.getMySqlVm());
	Assert.assertNotNull( dmScript );
	Assert.assertEquals( "target." + Constants.SCOPED_SCRIPT_AT_DM_CONFIGURE_SUFFIX + ".sh", dmScript.getName());
}