You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by al...@apache.org on 2014/07/09 16:39:15 UTC
[2/4] git commit: Adds integration test for pre and post launch
commands
Adds integration test for pre and post launch commands
Project: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/commit/f8893bdd
Tree: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/tree/f8893bdd
Diff: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/diff/f8893bdd
Branch: refs/heads/master
Commit: f8893bdd6934034513d52e5f3b1fc2685ee8e08e
Parents: 74bf465
Author: Martin Harris <gi...@nakomis.com>
Authored: Thu Jul 3 17:33:52 2014 +0100
Committer: Martin Harris <gi...@nakomis.com>
Committed: Thu Jul 3 17:33:52 2014 +0100
----------------------------------------------------------------------
.../SoftwareProcessSshDriverIntegrationTest.java | 19 +++++++++++++++++++
1 file changed, 19 insertions(+)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/f8893bdd/software/base/src/test/java/brooklyn/entity/basic/SoftwareProcessSshDriverIntegrationTest.java
----------------------------------------------------------------------
diff --git a/software/base/src/test/java/brooklyn/entity/basic/SoftwareProcessSshDriverIntegrationTest.java b/software/base/src/test/java/brooklyn/entity/basic/SoftwareProcessSshDriverIntegrationTest.java
index f812bb9..73c2298 100644
--- a/software/base/src/test/java/brooklyn/entity/basic/SoftwareProcessSshDriverIntegrationTest.java
+++ b/software/base/src/test/java/brooklyn/entity/basic/SoftwareProcessSshDriverIntegrationTest.java
@@ -6,6 +6,7 @@ import static org.testng.Assert.assertTrue;
import static org.testng.Assert.fail;
import java.io.File;
+import java.io.IOException;
import java.io.StringReader;
import java.util.ArrayList;
import java.util.List;
@@ -204,6 +205,24 @@ public class SoftwareProcessSshDriverIntegrationTest {
}
}
+ @Test(groups="Integration")
+ public void testPreAndPostLaunchCommands() throws IOException {
+ File tempPreLaunchFile = new File(tempDataDir, "prelaunch.txt");
+ File tempPostLaunchFile = new File(tempDataDir, "postlaunch.txt");
+ localhost.setConfig(BrooklynConfigKeys.ONBOX_BASE_DIR, tempDataDir.getAbsolutePath());
+ app.createAndManageChild(EntitySpec.create(MyService.class)
+ .configure(SoftwareProcess.PRE_LAUNCH_COMMAND, String.format("echo foo > %s", tempPreLaunchFile.getAbsoluteFile()))
+ .configure(SoftwareProcess.POST_LAUNCH_COMMAND, String.format("echo bar > %s", tempPostLaunchFile.getAbsoluteFile())));
+ app.start(ImmutableList.of(localhost));
+ List<String> prelaunch = Files.readLines(tempPreLaunchFile, Charsets.UTF_8);
+ List<String> postlaunch = Files.readLines(tempPostLaunchFile, Charsets.UTF_8);
+ assertEquals(prelaunch.size(), 1);
+ assertEquals(postlaunch.size(), 1);
+ assertEquals(postlaunch.get(0), "bar");
+ assertEquals(prelaunch.get(0), "foo");
+ tempPreLaunchFile.delete();
+ tempPostLaunchFile.delete();
+ }
@ImplementedBy(MyServiceImpl.class)
public interface MyService extends SoftwareProcess {