// Integration test because requires ssh'ing (and takes about 5 seconds) // See also SoftwareProcessEntityTest.testCustomInstallDirX for a lot more mocked variants @Test(groups = "Integration") public void testCanInstallMultipleVersionsOnSameMachine() throws Exception { managementContext .getBrooklynProperties() .put(BrooklynConfigKeys.ONBOX_BASE_DIR, tempDataDir.getAbsolutePath()); MyService entity = app.createAndManageChild( EntitySpec.create(MyService.class) .configure(SoftwareProcess.SUGGESTED_VERSION, "0.1.0")); MyService entity2 = app.createAndManageChild( EntitySpec.create(MyService.class) .configure(SoftwareProcess.SUGGESTED_VERSION, "0.2.0")); app.start(ImmutableList.of(machine127)); String installDir1 = entity.getAttribute(SoftwareProcess.INSTALL_DIR); String installDir2 = entity2.getAttribute(SoftwareProcess.INSTALL_DIR); assertNotEquals(installDir1, installDir2); assertTrue(installDir1.contains("0.1.0"), "installDir1=" + installDir1); assertTrue(installDir2.contains("0.2.0"), "installDir2=" + installDir2); assertTrue(new File(new File(installDir1), "myfile").isFile()); assertTrue(new File(new File(installDir2), "myfile").isFile()); }
@Test(groups = "Integration") @Deprecated public void testMachineInCustomFromDataDir() throws Exception { managementContext .getBrooklynProperties() .put(BrooklynConfigKeys.BROOKLYN_DATA_DIR, tempDataDir.getAbsolutePath()); MyService entity = app.createAndManageChild(EntitySpec.create(MyService.class)); app.start(ImmutableList.of(machine127)); String installDir = entity.getAttribute(SoftwareProcess.INSTALL_DIR); assertTrue( installDir.startsWith(tempDataDir.getAbsolutePath() + "/installs/"), "installed in " + installDir); }
@BeforeMethod(alwaysRun = true) public void setUp() throws Exception { managementContext = LocalManagementContextForTests.newInstance(); brooklynProperties = managementContext.getBrooklynProperties(); }