Source:
<code>public void run() throws Exception { configureManagerForInMemoryUsage(); String appLocation = System.getProperty( APP_LOCATION ); ApplicationTemplate tpl = this.manager.applicationTemplateMngr().loadApplicationTemplate( new File( appLocation )); ManagedApplication ma = this.manager.applicationMngr().createApplication( "test", null, tpl ); Assert.assertNotNull( ma ); Assert.assertEquals( 1, this.manager.applicationMngr().getManagedApplications().size()); String targetId = this.manager.targetsMngr().findTargetId(ma.getApplication(), "/MySQL VM"); File dir = new File( this.manager.configurationMngr().getWorkingDirectory(), ConfigurationUtils.TARGETS + "/" + targetId ); <START> Utils.writeStringInto( "#!/bin/bash\necho toto > toto.txt", new File( dir, "totoscript-all.sh")); <END> Utils.writeStringInto( "Bonjour le monde cruel", new File( dir, "titiscript.py")); Instance mysql = InstanceHelpers.findInstanceByPath( ma.getApplication(), "/MySQL VM/MySQL" ); Assert.assertNotNull( mysql ); this.manager.instancesMngr().deployAndStartAll(ma, null); Thread.sleep( 7000 ); this.manager.instancesMngr().changeInstanceState( ma, mysql.getParent(), InstanceStatus.DEPLOYED_STARTED ); Assert.assertEquals( InstanceStatus.DEPLOYED_STARTED, mysql.getParent().getStatus()); File vmDir = InstanceHelpers.findInstanceDirectoryOnAgent( mysql.getParent() ); File toto = new File( vmDir, "toto.txt" ); Assert.assertTrue( toto.exists() ); String s = Utils.readFileContent( toto ); List<File> files = Utils.listAllFiles(vmDir); Assert.assertEquals( "toto", s.trim() ); Assert.assertEquals( 3, files.size() ); }</code><technical_language>Do write "toto.txt". Write this file a system's temporary folder. get using... java System.getProperty( "java.io.tmpdir" )</technical_language>

Target:
public void run() throws Exception { configureManagerForInMemoryUsage(); String appLocation = System.getProperty( APP_LOCATION ); ApplicationTemplate tpl = this.manager.applicationTemplateMngr().loadApplicationTemplate( new File( appLocation )); ManagedApplication ma = this.manager.applicationMngr().createApplication( "test", null, tpl ); Assert.assertNotNull( ma ); Assert.assertEquals( 1, this.manager.applicationMngr().getManagedApplications().size()); String targetId = this.manager.targetsMngr().findTargetId(ma.getApplication(), "/MySQL VM"); File dir = new File( this.manager.configurationMngr().getWorkingDirectory(), ConfigurationUtils.TARGETS + "/" + targetId ); Utils.writeStringInto( "#!/bin/bash\necho toto > toto.txt", new File( dir, "toto-script.sh")); Instance mysql = InstanceHelpers.findInstanceByPath( ma.getApplication(), "/MySQL VM/MySQL" ); Assert.assertNotNull( mysql ); this.manager.instancesMngr().deployAndStartAll(ma, null); Thread.sleep( 7000 ); this.manager.instancesMngr().changeInstanceState( ma, mysql.getParent(), InstanceStatus.DEPLOYED_STARTED ); Assert.assertEquals( InstanceStatus.DEPLOYED_STARTED, mysql.getParent().getStatus()); File vmDir = InstanceHelpers.findInstanceDirectoryOnAgent( mysql.getParent() ); List<File> files = Utils.listAllFiles(vmDir); Assert.assertEquals( 2, files.size() ); File script = new File( vmDir, "toto-script.sh"); File toto = new File( vmDir, "toto.txt" ); Assert.assertTrue( script.exists() ); Assert.assertTrue( toto.exists() ); String s = Utils.readFileContent( toto ); Assert.assertEquals( "toto", s.trim() ); }