You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by sj...@apache.org on 2015/07/14 11:37:16 UTC

[1/4] incubator-brooklyn git commit: Fix java version check

Repository: incubator-brooklyn
Updated Branches:
  refs/heads/master 31b8471f7 -> 076bf52ee


Fix java version check

- if it is used openjdk java -version returns `openjdk version "1.8.0_45"'
  which wasn't matched correctly previously


Project: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/commit/407c7a1a
Tree: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/tree/407c7a1a
Diff: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/diff/407c7a1a

Branch: refs/heads/master
Commit: 407c7a1a60f4a1f936c54318766f1b3e2b70df82
Parents: 32960be
Author: Valentin Aitken <va...@cloudsoftcorp.com>
Authored: Fri Jun 26 13:13:21 2015 +0300
Committer: Valentin Aitken <va...@cloudsoftcorp.com>
Committed: Sun Jun 28 01:43:34 2015 +0300

----------------------------------------------------------------------
 .../java/brooklyn/entity/java/JavaSoftwareProcessSshDriver.java    | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/407c7a1a/software/base/src/main/java/brooklyn/entity/java/JavaSoftwareProcessSshDriver.java
----------------------------------------------------------------------
diff --git a/software/base/src/main/java/brooklyn/entity/java/JavaSoftwareProcessSshDriver.java b/software/base/src/main/java/brooklyn/entity/java/JavaSoftwareProcessSshDriver.java
index 08ccfcb..79cef17 100644
--- a/software/base/src/main/java/brooklyn/entity/java/JavaSoftwareProcessSshDriver.java
+++ b/software/base/src/main/java/brooklyn/entity/java/JavaSoftwareProcessSshDriver.java
@@ -336,7 +336,7 @@ public abstract class JavaSoftwareProcessSshDriver extends AbstractSoftwareProce
         log.debug("Checking Java version at {}@{}", getEntity(), getLocation());
         // sed gets stdin like 'java version "1.7.0_45"'
         ProcessTaskWrapper<Integer> versionCommand = Entities.submit(getEntity(), SshTasks.newSshExecTaskFactory(
-                getLocation(), "java -version 2>&1 | grep \"java version\" | sed 's/.*\"\\(.*\\).*\"/\\1/'"));
+                getLocation(), "java -version 2>&1 | grep \" version\" | sed 's/.*\"\\(.*\\).*\"/\\1/'"));
         versionCommand.get();
         String stdOut = versionCommand.getStdout().trim();
         if (!Strings.isBlank(stdOut)) {


[3/4] incubator-brooklyn git commit: Fix NodeJS Integration test to stop the service with the generic stop

Posted by sj...@apache.org.
Fix NodeJS Integration test to stop the service with the generic stop


Project: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/commit/625bc6fa
Tree: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/tree/625bc6fa
Diff: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/diff/625bc6fa

Branch: refs/heads/master
Commit: 625bc6fa51dfbc7591a136e957027af322703ca3
Parents: dbeef91
Author: Valentin Aitken <va...@cloudsoftcorp.com>
Authored: Fri Jun 26 17:10:43 2015 +0300
Committer: Valentin Aitken <va...@cloudsoftcorp.com>
Committed: Thu Jul 9 13:05:48 2015 +0300

----------------------------------------------------------------------
 .../AbstractWebAppFixtureIntegrationTest.java   |  3 +-
 .../NodeJsWebAppFixtureIntegrationTest.java     | 74 ++++++--------------
 2 files changed, 23 insertions(+), 54 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/625bc6fa/software/webapp/src/test/java/brooklyn/entity/webapp/AbstractWebAppFixtureIntegrationTest.java
----------------------------------------------------------------------
diff --git a/software/webapp/src/test/java/brooklyn/entity/webapp/AbstractWebAppFixtureIntegrationTest.java b/software/webapp/src/test/java/brooklyn/entity/webapp/AbstractWebAppFixtureIntegrationTest.java
index 7bc175c..6498c32 100644
--- a/software/webapp/src/test/java/brooklyn/entity/webapp/AbstractWebAppFixtureIntegrationTest.java
+++ b/software/webapp/src/test/java/brooklyn/entity/webapp/AbstractWebAppFixtureIntegrationTest.java
@@ -37,6 +37,7 @@ import java.util.concurrent.CopyOnWriteArrayList;
 import java.util.concurrent.TimeUnit;
 import java.util.concurrent.atomic.AtomicInteger;
 
+import brooklyn.entity.basic.SoftwareProcessDriver;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.testng.annotations.AfterClass;
@@ -235,7 +236,7 @@ public abstract class AbstractWebAppFixtureIntegrationTest {
      * Stop the given underlying entity, but without our entity instance being told!
      */
     protected void killEntityBehindBack(Entity tokill) throws Exception {
-        ((JavaWebAppDriver)((DriverDependentEntity<?>)Entities.deproxy(entity)).getDriver()).stop();
+        ((SoftwareProcessDriver)((DriverDependentEntity<?>) Entities.deproxy(entity)).getDriver()).stop();
         // old method of doing this did some dodgy legacy rebind and failed due to too many dangling refs; above is better in any case
         // but TODO we should have some rebind tests for these!
     }

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/625bc6fa/software/webapp/src/test/java/brooklyn/entity/webapp/nodejs/NodeJsWebAppFixtureIntegrationTest.java
----------------------------------------------------------------------
diff --git a/software/webapp/src/test/java/brooklyn/entity/webapp/nodejs/NodeJsWebAppFixtureIntegrationTest.java b/software/webapp/src/test/java/brooklyn/entity/webapp/nodejs/NodeJsWebAppFixtureIntegrationTest.java
index 3221c05..d567448 100644
--- a/software/webapp/src/test/java/brooklyn/entity/webapp/nodejs/NodeJsWebAppFixtureIntegrationTest.java
+++ b/software/webapp/src/test/java/brooklyn/entity/webapp/nodejs/NodeJsWebAppFixtureIntegrationTest.java
@@ -18,44 +18,32 @@
  */
 package brooklyn.entity.webapp.nodejs;
 
-import static org.testng.Assert.assertFalse;
-import static org.testng.Assert.assertTrue;
-
-import java.io.File;
-import java.util.concurrent.TimeUnit;
-
-import org.slf4j.Logger;
-import org.slf4j.LoggerFactory;
-import org.testng.annotations.AfterMethod;
-import org.testng.annotations.BeforeMethod;
-import org.testng.annotations.Test;
-
 import brooklyn.entity.Entity;
 import brooklyn.entity.basic.Entities;
-import brooklyn.entity.basic.EntityInternal;
-import brooklyn.entity.basic.SoftwareProcess;
+import brooklyn.entity.basic.SoftwareProcessDriver;
+import brooklyn.entity.drivers.DriverDependentEntity;
 import brooklyn.entity.proxying.EntitySpec;
-import brooklyn.entity.rebind.PersistenceExceptionHandlerImpl;
-import brooklyn.entity.rebind.dto.MementosGenerators;
-import brooklyn.entity.rebind.persister.BrooklynMementoPersisterToMultiFile;
 import brooklyn.entity.trait.Startable;
 import brooklyn.entity.webapp.WebAppService;
 import brooklyn.location.Location;
 import brooklyn.location.basic.PortRanges;
 import brooklyn.management.ManagementContext;
-import brooklyn.management.ha.ManagementNodeState;
-import brooklyn.management.internal.ManagementContextInternal;
-import brooklyn.mementos.BrooklynMemento;
 import brooklyn.test.Asserts;
 import brooklyn.test.EntityTestUtils;
 import brooklyn.test.HttpTestUtils;
-import brooklyn.test.entity.LocalManagementContextForTests;
 import brooklyn.test.entity.TestApplication;
 import brooklyn.util.collections.MutableMap;
 import brooklyn.util.net.Urls;
-import brooklyn.util.os.Os;
-
+import brooklyn.util.time.Duration;
 import com.google.common.collect.ImmutableList;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.testng.annotations.AfterMethod;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+import static org.testng.Assert.assertFalse;
+import static org.testng.Assert.assertTrue;
 
 /**
  * Integration tests for NodeJS.
@@ -104,7 +92,7 @@ public class NodeJsWebAppFixtureIntegrationTest {
         app = TestApplication.Factory.newManagedInstanceForTests();
         mgmt = app.getManagementContext();
         loc = app.newLocalhostProvisioningLocation();
-        
+
         entity = app.createAndManageChild(EntitySpec.create(NodeJsWebAppService.class)
                 .configure(NodeJsWebAppService.HTTP_PORT, PortRanges.fromString(DEFAULT_HTTP_PORT))
                 .configure("gitRepoUrl", GIT_REPO_URL)
@@ -124,7 +112,7 @@ public class NodeJsWebAppFixtureIntegrationTest {
     @Test(groups = "Integration")
     public void testCanStartAndStop() {
         LOG.info("test=canStartAndStop; entity="+entity+"; app="+entity.getApplication());
-        
+
         Entities.start(entity.getApplication(), ImmutableList.of(loc));
         Asserts.succeedsEventually(MutableMap.of("timeout", 120*1000), new Runnable() {
             public void run() {
@@ -134,7 +122,7 @@ public class NodeJsWebAppFixtureIntegrationTest {
         entity.stop();
         assertFalse(entity.getAttribute(Startable.SERVICE_UP));
     }
-    
+
     /**
      * Checks an entity can start, set SERVICE_UP to true and shutdown again.
      */
@@ -143,7 +131,7 @@ public class NodeJsWebAppFixtureIntegrationTest {
         LOG.info("test=testReportsServiceDownWithKilled; entity="+entity+"; app="+entity.getApplication());
         
         Entities.start(entity.getApplication(), ImmutableList.of(loc));
-        EntityTestUtils.assertAttributeEqualsEventually(MutableMap.of("timeout", 120*1000), entity, Startable.SERVICE_UP, true);
+        EntityTestUtils.assertAttributeEqualsEventually(MutableMap.of("timeout", Duration.minutes(2)), entity, Startable.SERVICE_UP, true);
 
         // Stop the underlying entity, but without our entity instance being told!
         killEntityBehindBack(entity);
@@ -153,36 +141,16 @@ public class NodeJsWebAppFixtureIntegrationTest {
         
         LOG.info("success getting service up false in primary mgmt universe");
     }
-    
+
     /**
      * Stop the given underlying entity, but without our entity instance being told!
      */
     protected void killEntityBehindBack(Entity tokill) throws Exception {
-        // Previously was calling entity.getDriver().kill(); but now our entity instance is a proxy so can't do that
-        ManagementContext newManagementContext = null;
-        File tempDir = Os.newTempDir(getClass());
-        try {
-            ManagementContext managementContext = ((EntityInternal)tokill).getManagementContext();
-            BrooklynMemento brooklynMemento = MementosGenerators.newBrooklynMemento(managementContext);
-            
-            BrooklynMementoPersisterToMultiFile oldPersister = new BrooklynMementoPersisterToMultiFile(tempDir , getClass().getClassLoader());
-            oldPersister.checkpoint(brooklynMemento, PersistenceExceptionHandlerImpl.builder().build());
-            oldPersister.waitForWritesCompleted(30*1000, TimeUnit.MILLISECONDS);
-
-            BrooklynMementoPersisterToMultiFile newPersister = new BrooklynMementoPersisterToMultiFile(tempDir , getClass().getClassLoader());
-            newManagementContext = new LocalManagementContextForTests();
-            newManagementContext.getRebindManager().setPersister(newPersister, PersistenceExceptionHandlerImpl.builder().build());
-            newManagementContext.getRebindManager().rebind(getClass().getClassLoader(), null, ManagementNodeState.MASTER);
-            newManagementContext.getRebindManager().startPersistence();
-            SoftwareProcess entity2 = (SoftwareProcess) newManagementContext.getEntityManager().getEntity(tokill.getId());
-            entity2.stop();
-        } finally {
-            if (newManagementContext != null) ((ManagementContextInternal)newManagementContext).terminate();
-            Os.deleteRecursively(tempDir.getAbsolutePath());
-        }
-        LOG.info("called to stop {} in parallel mgmt universe", entity);
+        ((SoftwareProcessDriver)((DriverDependentEntity<?>) Entities.deproxy(tokill)).getDriver()).stop();
+        // old method of doing this did some dodgy legacy rebind and failed due to too many dangling refs; above is better in any case
+        // but TODO we should have some rebind tests for these!
     }
-    
+
     @Test(groups = "Integration")
     public void testInitialNamedDeployments() {
         final String urlSubPathToWebApp = APP_NAME;
@@ -191,7 +159,7 @@ public class NodeJsWebAppFixtureIntegrationTest {
         
         Entities.start(entity.getApplication(), ImmutableList.of(loc));
 
-        Asserts.succeedsEventually(MutableMap.of("timeout", 60*1000), new Runnable() {
+        Asserts.succeedsEventually(MutableMap.of("timeout", Duration.minutes(1)), new Runnable() {
             public void run() {
                 // TODO get this URL from a web-app entity of some kind?
                 String url = Urls.mergePaths(entity.getAttribute(WebAppService.ROOT_URL), urlSubPathToWebApp, urlSubPathToPageToQuery);


[2/4] incubator-brooklyn git commit: yum fix - Add EPEL if missing

Posted by sj...@apache.org.
yum fix - Add EPEL if missing

- This fixes installation of nodejs for CentOS 7
  and the NodeJsWebAppFixtureIntegrationTest respectively


Project: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/commit/dbeef918
Tree: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/tree/dbeef918
Diff: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/diff/dbeef918

Branch: refs/heads/master
Commit: dbeef9187d9a5e7907f7bd9e58ac68173c8b0f3d
Parents: 407c7a1
Author: Valentin Aitken <va...@cloudsoftcorp.com>
Authored: Fri Jun 26 15:52:00 2015 +0300
Committer: Valentin Aitken <va...@cloudsoftcorp.com>
Committed: Mon Jun 29 14:36:46 2015 +0300

----------------------------------------------------------------------
 utils/common/src/main/java/brooklyn/util/ssh/BashCommands.java     | 1 +
 .../src/test/java/brooklyn/util/ssh/IptablesCommandsTest.java      | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/dbeef918/utils/common/src/main/java/brooklyn/util/ssh/BashCommands.java
----------------------------------------------------------------------
diff --git a/utils/common/src/main/java/brooklyn/util/ssh/BashCommands.java b/utils/common/src/main/java/brooklyn/util/ssh/BashCommands.java
index 21b87d1..570551d 100644
--- a/utils/common/src/main/java/brooklyn/util/ssh/BashCommands.java
+++ b/utils/common/src/main/java/brooklyn/util/ssh/BashCommands.java
@@ -376,6 +376,7 @@ public class BashCommands {
                     chainGroup(
                         "echo yum exists, doing update",
                         ok(sudo("yum check-update")),
+                        ok(sudo("yum -y install epel-release")),
                         sudo(yumInstall))));
         if (brewInstall != null)
             commands.add(ifExecutableElse1("brew", brewInstall));

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/dbeef918/utils/common/src/test/java/brooklyn/util/ssh/IptablesCommandsTest.java
----------------------------------------------------------------------
diff --git a/utils/common/src/test/java/brooklyn/util/ssh/IptablesCommandsTest.java b/utils/common/src/test/java/brooklyn/util/ssh/IptablesCommandsTest.java
index afec6be..7d90dbf 100644
--- a/utils/common/src/test/java/brooklyn/util/ssh/IptablesCommandsTest.java
+++ b/utils/common/src/test/java/brooklyn/util/ssh/IptablesCommandsTest.java
@@ -40,7 +40,7 @@ public class IptablesCommandsTest {
     private static final String saveIptablesRules = "( ( if test \"$UID\" -eq 0; then ( service iptables save ); else sudo -E -n -S -- service iptables save; fi ) || " +
             "( ( { which zypper && { echo zypper exists, doing refresh && (( if test \"$UID\" -eq 0; then ( zypper --non-interactive --no-gpg-checks refresh ); else sudo -E -n -S -- zypper --non-interactive --no-gpg-checks refresh; fi ) || true) && ( if test \"$UID\" -eq 0; then ( zypper --non-interactive --no-gpg-checks install iptables-persistent ); else sudo -E -n -S -- zypper --non-interactive --no-gpg-checks install iptables-persistent; fi ) ; } ; } || " +
             "{ which apt-get && { echo apt-get exists, doing update && export DEBIAN_FRONTEND=noninteractive && (( if test \"$UID\" -eq 0; then ( apt-get update ); else sudo -E -n -S -- apt-get update; fi ) || true) && ( if test \"$UID\" -eq 0; then ( apt-get install -y --allow-unauthenticated iptables-persistent ); else sudo -E -n -S -- apt-get install -y --allow-unauthenticated iptables-persistent; fi ) ; } ; } || " +
-            "{ which yum && { echo yum exists, doing update && (( if test \"$UID\" -eq 0; then ( yum check-update ); else sudo -E -n -S -- yum check-update; fi ) || true) && ( if test \"$UID\" -eq 0; then ( yum -y --nogpgcheck install iptables-persistent ); else sudo -E -n -S -- yum -y --nogpgcheck install iptables-persistent; fi ) ; } ; } || " +
+            "{ which yum && { echo yum exists, doing update && (( if test \"$UID\" -eq 0; then ( yum check-update ); else sudo -E -n -S -- yum check-update; fi ) || true) && (( if test \"$UID\" -eq 0; then ( yum -y install epel-release ); else sudo -E -n -S -- yum -y install epel-release; fi ) || true) && ( if test \"$UID\" -eq 0; then ( yum -y --nogpgcheck install iptables-persistent ); else sudo -E -n -S -- yum -y --nogpgcheck install iptables-persistent; fi ) ; } ; } || " +
             "{ which brew && brew install iptables-persistent ; } || " +
             "{ which port && ( if test \"$UID\" -eq 0; then ( port install iptables-persistent ); else sudo -E -n -S -- port install iptables-persistent; fi ) ; } || " +
             "(( echo \"WARNING: no known/successful package manager to install iptables-persistent, may fail subsequently\" | tee /dev/stderr ) || true) ) && ( if test \"$UID\" -eq 0; then ( /etc/init.d/iptables-persistent save ); else sudo -E -n -S -- /etc/init.d/iptables-persistent save; fi ) ) )";


[4/4] incubator-brooklyn git commit: This closes #722

Posted by sj...@apache.org.
This closes #722


Project: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/repo
Commit: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/commit/076bf52e
Tree: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/tree/076bf52e
Diff: http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/diff/076bf52e

Branch: refs/heads/master
Commit: 076bf52eec23fb98d7f3572f110873f23b8c7c98
Parents: 31b8471 625bc6f
Author: Sam Corbett <sa...@cloudsoftcorp.com>
Authored: Tue Jul 14 10:36:55 2015 +0100
Committer: Sam Corbett <sa...@cloudsoftcorp.com>
Committed: Tue Jul 14 10:36:55 2015 +0100

----------------------------------------------------------------------
 .../java/JavaSoftwareProcessSshDriver.java      |  2 +-
 .../AbstractWebAppFixtureIntegrationTest.java   |  3 +-
 .../NodeJsWebAppFixtureIntegrationTest.java     | 74 ++++++--------------
 .../java/brooklyn/util/ssh/BashCommands.java    |  1 +
 .../brooklyn/util/ssh/IptablesCommandsTest.java |  2 +-
 5 files changed, 26 insertions(+), 56 deletions(-)
----------------------------------------------------------------------