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 2016/08/11 19:38:42 UTC

[1/6] brooklyn-server git commit: brooklyn.parameter: accept more basic types

Repository: brooklyn-server
Updated Branches:
  refs/heads/master 6f148be98 -> b4b48b3fd


brooklyn.parameter: accept more basic types

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

Branch: refs/heads/master
Commit: 611c75f774c484785ee2ab3e30e674ae72a660fd
Parents: bbe8e7a3
Author: Aled Sage <al...@gmail.com>
Authored: Wed Aug 10 21:13:57 2016 +0100
Committer: Aled Sage <al...@gmail.com>
Committed: Thu Aug 11 20:37:25 2016 +0100

----------------------------------------------------------------------
 .../camp/brooklyn/ConfigParametersYamlTest.java | 66 ++++++++++++++++++++
 .../brooklyn/core/objs/BasicSpecParameter.java  |  7 ++-
 2 files changed, 71 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/611c75f7/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ConfigParametersYamlTest.java
----------------------------------------------------------------------
diff --git a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ConfigParametersYamlTest.java b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ConfigParametersYamlTest.java
index 4f9ead8..f187b6c 100644
--- a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ConfigParametersYamlTest.java
+++ b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ConfigParametersYamlTest.java
@@ -21,17 +21,22 @@ package org.apache.brooklyn.camp.brooklyn;
 import static org.testng.Assert.assertEquals;
 import static org.testng.Assert.assertNotNull;
 
+import java.util.Date;
+import java.util.List;
 import java.util.Map;
 
 import org.apache.brooklyn.api.entity.Entity;
+import org.apache.brooklyn.api.location.PortRange;
 import org.apache.brooklyn.config.ConfigKey;
 import org.apache.brooklyn.core.config.ConfigKeys;
 import org.apache.brooklyn.core.test.entity.TestEntity;
 import org.apache.brooklyn.entity.software.base.VanillaSoftwareProcess;
 import org.apache.brooklyn.test.Asserts;
+import org.apache.brooklyn.util.collections.MutableList;
 import org.apache.brooklyn.util.core.internal.ssh.ExecCmdAsserts;
 import org.apache.brooklyn.util.core.internal.ssh.RecordingSshTool;
 import org.apache.brooklyn.util.core.internal.ssh.RecordingSshTool.ExecCmd;
+import org.apache.brooklyn.util.time.Duration;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.testng.annotations.BeforeMethod;
@@ -332,4 +337,65 @@ public class ConfigParametersYamlTest extends AbstractYamlTest {
         assertEquals(cmd.env.get("KEY_IN_SUPER"), "myDefaultVal", "cmd="+cmd);
         assertEquals(cmd.env.get("KEY_IN_SUB"), "myBoringVal", "cmd="+cmd);
     }
+    
+    @Test
+    public void testConfigParametersTypes() throws Exception {
+        Map<String, Class<?>> keys = ImmutableMap.<String, Class<?>>builder()
+                .put("bool", Boolean.class)
+                .put("boolean", Boolean.class)
+                .put("Boolean", Boolean.class)
+                .put("byte", Byte.class)
+                .put("Byte", Byte.class)
+                .put("char", Character.class)
+                .put("character", Character.class)
+                .put("Character", Character.class)
+                .put("short", Short.class)
+                .put("Short", Short.class)
+                .put("int", Integer.class)
+                .put("integer", Integer.class)
+                .put("Integer", Integer.class)
+                .put("long", Long.class)
+                .put("Long", Long.class)
+                .put("float", Float.class)
+                .put("Float", Float.class)
+                .put("double", Double.class)
+                .put("Double", Double.class)
+                .put("string", String.class)
+                .put("String", String.class)
+                .put("duration", Duration.class)
+                .put("Duration", Duration.class)
+                .put("timestamp", Date.class)
+                .put("Timestamp", Date.class)
+                .put("port", PortRange.class)
+                .put("Port", PortRange.class)
+                .build();
+        
+        List<String> catalogYaml = MutableList.of(
+                "brooklyn.catalog:",
+                "  itemType: entity",
+                "  items:",
+                "  - id: entity-with-keys",
+                "    item:",
+                "      type: "+TestEntity.class.getName(),
+                "      brooklyn.parameters:");
+        for (Map.Entry<String, Class<?>> entry : keys.entrySet()) {
+                catalogYaml.add("      - name: "+entry.getKey()+"_key");
+                catalogYaml.add("        type: "+entry.getKey());
+        }
+        
+        addCatalogItems(catalogYaml);
+        
+        String yaml = Joiner.on("\n").join(
+                "services:",
+                "- type: entity-with-keys");
+        
+        Entity app = createStartWaitAndLogApplication(yaml);
+        TestEntity entity = (TestEntity) Iterables.getOnlyElement(app.getChildren());
+
+        // Check config key is listed
+        for (Map.Entry<String, Class<?>> entry : keys.entrySet()) {
+            String keyName = entry.getKey()+"_key";
+            assertEquals(entity.getEntityType().getConfigKey(keyName).getType(), entry.getValue());
+        }
+    }
 }

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/611c75f7/core/src/main/java/org/apache/brooklyn/core/objs/BasicSpecParameter.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/brooklyn/core/objs/BasicSpecParameter.java b/core/src/main/java/org/apache/brooklyn/core/objs/BasicSpecParameter.java
index e525fc6..08d0ad3 100644
--- a/core/src/main/java/org/apache/brooklyn/core/objs/BasicSpecParameter.java
+++ b/core/src/main/java/org/apache/brooklyn/core/objs/BasicSpecParameter.java
@@ -185,11 +185,14 @@ public class BasicSpecParameter<T> implements SpecParameter<T>{
         private static final String DEFAULT_TYPE = "string";
         private static final Map<String, Class<?>> BUILT_IN_TYPES = ImmutableMap.<String, Class<?>>builder()
                 .put(DEFAULT_TYPE, String.class)
+                .put("bool", Boolean.class)
                 .put("boolean", Boolean.class)
                 .put("byte", Byte.class)
                 .put("char", Character.class)
+                .put("character", Character.class)
                 .put("short", Short.class)
                 .put("integer", Integer.class)
+                .put("int", Integer.class)
                 .put("long", Long.class)
                 .put("float", Float.class)
                 .put("double", Double.class)
@@ -258,8 +261,8 @@ public class BasicSpecParameter<T> implements SpecParameter<T>{
         private static TypeToken inferType(String typeRaw, BrooklynClassLoadingContext loader) {
             if (typeRaw == null) return TypeToken.of(String.class);
             String type = typeRaw.trim();
-            if (BUILT_IN_TYPES.containsKey(type)) {
-                return TypeToken.of(BUILT_IN_TYPES.get(type));
+            if (BUILT_IN_TYPES.containsKey(type.toLowerCase())) {
+                return TypeToken.of(BUILT_IN_TYPES.get(type.toLowerCase()));
             } else {
                 // Assume it's a Java type
                 Maybe<Class<?>> inputType = loader.tryLoadClass(type);


[3/6] brooklyn-server git commit: Add more tests to ConfigParametersYamlTests

Posted by al...@apache.org.
Add more tests to ConfigParametersYamlTests

Including for BROOKLYN-328 and BROOKLYN-329


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

Branch: refs/heads/master
Commit: bbe8e7a3d856a6291548a2b974222a9bd25c159a
Parents: ea87091
Author: Aled Sage <al...@gmail.com>
Authored: Wed Aug 10 21:13:31 2016 +0100
Committer: Aled Sage <al...@gmail.com>
Committed: Thu Aug 11 20:37:25 2016 +0100

----------------------------------------------------------------------
 .../camp/brooklyn/ConfigParametersYamlTest.java | 263 ++++++++++++++++++-
 1 file changed, 261 insertions(+), 2 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/bbe8e7a3/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ConfigParametersYamlTest.java
----------------------------------------------------------------------
diff --git a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ConfigParametersYamlTest.java b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ConfigParametersYamlTest.java
index 3350686..4f9ead8 100644
--- a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ConfigParametersYamlTest.java
+++ b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/ConfigParametersYamlTest.java
@@ -21,14 +21,20 @@ package org.apache.brooklyn.camp.brooklyn;
 import static org.testng.Assert.assertEquals;
 import static org.testng.Assert.assertNotNull;
 
-import java.io.StringReader;
 import java.util.Map;
 
 import org.apache.brooklyn.api.entity.Entity;
 import org.apache.brooklyn.config.ConfigKey;
+import org.apache.brooklyn.core.config.ConfigKeys;
 import org.apache.brooklyn.core.test.entity.TestEntity;
+import org.apache.brooklyn.entity.software.base.VanillaSoftwareProcess;
+import org.apache.brooklyn.test.Asserts;
+import org.apache.brooklyn.util.core.internal.ssh.ExecCmdAsserts;
+import org.apache.brooklyn.util.core.internal.ssh.RecordingSshTool;
+import org.apache.brooklyn.util.core.internal.ssh.RecordingSshTool.ExecCmd;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
+import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
 import com.google.api.client.repackaged.com.google.common.base.Joiner;
@@ -39,6 +45,13 @@ public class ConfigParametersYamlTest extends AbstractYamlTest {
     @SuppressWarnings("unused")
     private static final Logger LOG = LoggerFactory.getLogger(ConfigParametersYamlTest.class);
 
+    @BeforeMethod(alwaysRun=true)
+    @Override
+    public void setUp() throws Exception {
+        super.setUp();
+        RecordingSshTool.clear();
+    }
+    
     @Test
     public void testConfigParametersListedInType() throws Exception {
         addCatalogItems(
@@ -47,7 +60,7 @@ public class ConfigParametersYamlTest extends AbstractYamlTest {
                 "  items:",
                 "  - id: entity-with-keys",
                 "    item:",
-                "      type: org.apache.brooklyn.core.test.entity.TestEntity",
+                "      type: "+TestEntity.class.getName(),
                 "      brooklyn.parameters:",
                 "      - name: testConfigParametersListedInType.mykey",
                 "        description: myDescription",
@@ -73,4 +86,250 @@ public class ConfigParametersYamlTest extends AbstractYamlTest {
         // Check get default value
         assertEquals(entity.config().get(key), ImmutableMap.of("myDefaultKey", "myDefaultVal"));
     }
+    
+    @Test
+    public void testConfigParameterDefault() throws Exception {
+        addCatalogItems(
+                "brooklyn.catalog:",
+                "  itemType: entity",
+                "  items:",
+                "  - id: entity-with-keys",
+                "    item:",
+                "      type: "+TestEntity.class.getName(),
+                "      brooklyn.parameters:",
+                "      - name: my.param.key",
+                "        type: string",
+                "        default: myDefaultVal",
+                "      brooklyn.config:",
+                "        my.other.key: $brooklyn:config(\"my.param.key\")");
+
+        addCatalogItems(
+                "brooklyn.catalog:",
+                "  itemType: entity",
+                "  items:",
+                "  - id: sub-entity",
+                "    item:",
+                "      type: entity-with-keys");
+        
+        addCatalogItems(
+                "brooklyn.catalog:",
+                "  itemType: template",
+                "  items:",
+                "  - id: wrapper-entity",
+                "    item:",
+                "      services:",
+                "      - type: entity-with-keys");
+
+        {
+            String yaml = Joiner.on("\n").join(
+                    "services:",
+                    "- type: entity-with-keys");
+            Entity app = createStartWaitAndLogApplication(yaml);
+            TestEntity entity = (TestEntity) Iterables.getOnlyElement(app.getChildren());
+            assertEquals(entity.config().get(ConfigKeys.newStringConfigKey("my.other.key")), "myDefaultVal");
+        }
+        
+        {
+            String yaml = Joiner.on("\n").join(
+                    "services:",
+                    "- type: entity-with-keys",
+                    "  brooklyn.config:",
+                    "    my.param.key: myOverrideVal");
+            Entity app = createStartWaitAndLogApplication(yaml);
+            TestEntity entity = (TestEntity) Iterables.getOnlyElement(app.getChildren());
+            assertEquals(entity.config().get(ConfigKeys.newStringConfigKey("my.other.key")), "myOverrideVal");
+        }
+        
+        {
+            String yaml = Joiner.on("\n").join(
+                    "services:",
+                    "- type: sub-entity");
+            Entity app = createStartWaitAndLogApplication(yaml);
+            TestEntity entity = (TestEntity) Iterables.getOnlyElement(app.getChildren());
+            assertEquals(entity.config().get(ConfigKeys.newStringConfigKey("my.other.key")), "myDefaultVal");
+        }
+        
+        {
+            String yaml = Joiner.on("\n").join(
+                    "services:",
+                    "- type: sub-entity",
+                    "  brooklyn.config:",
+                    "    my.param.key: myOverrideVal");
+            Entity app = createStartWaitAndLogApplication(yaml);
+            TestEntity entity = (TestEntity) Iterables.getOnlyElement(app.getChildren());
+            assertEquals(entity.config().get(ConfigKeys.newStringConfigKey("my.other.key")), "myOverrideVal");
+        }
+        
+        {
+            String yaml = Joiner.on("\n").join(
+                    "services:",
+                    "- type: wrapper-entity");
+            Entity app = createStartWaitAndLogApplication(yaml);
+            TestEntity entity = (TestEntity) Iterables.getOnlyElement(app.getChildren());
+            assertEquals(entity.config().get(ConfigKeys.newStringConfigKey("my.other.key")), "myDefaultVal");
+        }
+        
+        {
+            String yaml = Joiner.on("\n").join(
+                    "services:",
+                    "- type: wrapper-entity",
+                    "  brooklyn.config:",
+                    "    my.param.key: myOverrideVal");
+            Entity app = createStartWaitAndLogApplication(yaml);
+            TestEntity entity = (TestEntity) Iterables.getOnlyElement(app.getChildren());
+            assertEquals(entity.config().get(ConfigKeys.newStringConfigKey("my.other.key")), "myOverrideVal");
+        }
+    }
+    
+    @Test
+    public void testSubTypeUsesDefaultsFromSuper() throws Exception {
+        addCatalogItems(
+                "brooklyn.catalog:",
+                "  itemType: entity",
+                "  items:",
+                "  - id: entity-with-keys",
+                "    item:",
+                "      type: "+TestEntity.class.getName(),
+                "      brooklyn.parameters:",
+                "      - name: my.param.key",
+                "        type: string",
+                "        default: myDefaultVal",
+                "      brooklyn.config:",
+                "        my.other.key: $brooklyn:config(\"my.param.key\")");
+
+        addCatalogItems(
+                "brooklyn.catalog:",
+                "  itemType: entity",
+                "  items:",
+                "  - id: sub-entity",
+                "    item:",
+                "      type: entity-with-keys",
+                "      brooklyn.config:",
+                "        my.sub.key: $brooklyn:config(\"my.param.key\")");
+        
+        String yaml = Joiner.on("\n").join(
+                "services:",
+                "- type: sub-entity");
+        Entity app = createStartWaitAndLogApplication(yaml);
+        TestEntity entity = (TestEntity) Iterables.getOnlyElement(app.getChildren());
+        assertEquals(entity.config().get(ConfigKeys.newStringConfigKey("my.other.key")), "myDefaultVal");
+        assertEquals(entity.config().get(ConfigKeys.newStringConfigKey("my.sub.key")), "myDefaultVal");
+    }
+
+    // TODO: fails; it presumably gets the config key defined in java, rather than the brooklyn.parameters key
+    // See https://issues.apache.org/jira/browse/BROOKLYN-328
+    @Test(groups={"WIP", "Broken"})
+    public void testConfigParameterOverridingJavaConfig() throws Exception {
+        String confName = TestEntity.CONF_OBJECT.getName();
+        addCatalogItems(
+                "brooklyn.catalog:",
+                "  itemType: entity",
+                "  items:",
+                "  - id: entity-with-keys",
+                "    item:",
+                "      type: "+TestEntity.class.getName(),
+                "      brooklyn.parameters:",
+                "      - name: "+confName,
+                "        type: java.lang.Object",
+                "        default: myDefaultObj",
+                "      brooklyn.config:",
+                "        my.other.obj: $brooklyn:config(\""+confName+"\")");
+
+        String yaml = Joiner.on("\n").join(
+                "services:",
+                "- type: entity-with-keys");
+        Entity app = createStartWaitAndLogApplication(yaml);
+        TestEntity entity = (TestEntity) Iterables.getOnlyElement(app.getChildren());
+        assertEquals(entity.config().get(ConfigKeys.newStringConfigKey("my.other.obj")), "myDefaultObj");
+    }
+    
+    // TODO: fails; times out getting config. Problem is that scopeRoot() resolves to entity-with-keys!
+    // Presumably because it is resolved from inside the entity-with-keys?
+    // https://issues.apache.org/jira/browse/BROOKLYN-329
+    @Test(groups={"WIP", "Broken"})
+    public void testConfigParameterPassedFromOuterConfigParameter() throws Exception {
+        addCatalogItems(
+                "brooklyn.catalog:",
+                "  itemType: entity",
+                "  items:",
+                "  - id: entity-with-keys",
+                "    item:",
+                "      type: "+TestEntity.class.getName(),
+                "      brooklyn.parameters:",
+                "      - name: my.param.key",
+                "        type: string",
+                "        default: myDefaultVal",
+                "      brooklyn.config:",
+                "        my.other.key: $brooklyn:config(\"my.param.key\")");
+
+        addCatalogItems(
+                "brooklyn.catalog:",
+                "  itemType: entity",
+                "  items:",
+                "  - id: wrapper-entity",
+                "    item:",
+                "      brooklyn.parameters:",
+                "      - name: my.param.key",
+                "        type: string",
+                "        default: myDefaultValInOuter",
+                "      type: entity-with-keys",
+                "      brooklyn.config:",
+                "        my.param.key: $brooklyn:scopeRoot().config(\"my.param.key\")");
+        
+        String yaml = Joiner.on("\n").join(
+                "services:",
+                "- type: wrapper-entity");
+        
+        Entity app = createStartWaitAndLogApplication(yaml);
+        final TestEntity entity = (TestEntity) Iterables.getOnlyElement(app.getChildren());
+        Asserts.assertReturnsEventually(new Runnable() {
+            public void run() {
+                assertEquals(entity.config().get(ConfigKeys.newStringConfigKey("my.other.key")), "myDefaultValInOuter");
+            }},
+            Asserts.DEFAULT_LONG_TIMEOUT);
+    }
+    
+    @Test
+    public void testSubTypeUsesDefaultsFromSuperInConfigMerging() throws Exception {
+        RecordingSshTool.setCustomResponse(".*myCommand.*", new RecordingSshTool.CustomResponse(0, "myResponse", null));
+        
+        addCatalogItems(
+                "brooklyn.catalog:",
+                "  itemType: entity",
+                "  items:",
+                "  - id: entity-with-keys",
+                "    item:",
+                "      type: "+VanillaSoftwareProcess.class.getName(),
+                "      brooklyn.parameters:",
+                "      - name: my.param.key",
+                "        type: string",
+                "        default: myDefaultVal",
+                "      brooklyn.config:",
+                "        shell.env:",
+                "          KEY_IN_SUPER: $brooklyn:config(\"my.param.key\")",
+                "        launch.command: myLaunchCmd");
+
+        addCatalogItems(
+                "brooklyn.catalog:",
+                "  itemType: entity",
+                "  items:",
+                "  - id: sub-entity",
+                "    item:",
+                "      type: entity-with-keys",
+                "      brooklyn.config:",
+                "        shell.env:",
+                "          KEY_IN_SUB: myBoringVal");
+        
+        String yaml = Joiner.on("\n").join(
+                "location:",
+                "  localhost:",
+                "    sshToolClass: "+RecordingSshTool.class.getName(),
+                "services:",
+                "- type: sub-entity");
+        Entity app = createStartWaitAndLogApplication(yaml);
+        
+        ExecCmd cmd = ExecCmdAsserts.findExecContaining(RecordingSshTool.getExecCmds(), "myLaunchCmd");
+        assertEquals(cmd.env.get("KEY_IN_SUPER"), "myDefaultVal", "cmd="+cmd);
+        assertEquals(cmd.env.get("KEY_IN_SUB"), "myBoringVal", "cmd="+cmd);
+    }
 }


[4/6] brooklyn-server git commit: Tidy FixedListMachineProvisioningLocationTset

Posted by al...@apache.org.
Tidy FixedListMachineProvisioningLocationTset

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

Branch: refs/heads/master
Commit: 3d5501882ae6003794240307d948bae99edf7862
Parents: 611c75f
Author: Aled Sage <al...@gmail.com>
Authored: Wed Aug 10 21:15:14 2016 +0100
Committer: Aled Sage <al...@gmail.com>
Committed: Thu Aug 11 20:37:26 2016 +0100

----------------------------------------------------------------------
 ...ixedListMachineProvisioningLocationTest.java | 33 ++++++--------------
 1 file changed, 10 insertions(+), 23 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/3d550188/core/src/test/java/org/apache/brooklyn/location/byon/FixedListMachineProvisioningLocationTest.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/brooklyn/location/byon/FixedListMachineProvisioningLocationTest.java b/core/src/test/java/org/apache/brooklyn/location/byon/FixedListMachineProvisioningLocationTest.java
index 43d5c6e..b3e0e95 100644
--- a/core/src/test/java/org/apache/brooklyn/location/byon/FixedListMachineProvisioningLocationTest.java
+++ b/core/src/test/java/org/apache/brooklyn/location/byon/FixedListMachineProvisioningLocationTest.java
@@ -33,21 +33,15 @@ import org.apache.brooklyn.api.location.MachineLocation;
 import org.apache.brooklyn.api.location.NoMachinesAvailableException;
 import org.apache.brooklyn.config.ConfigKey;
 import org.apache.brooklyn.core.config.ConfigKeys;
-import org.apache.brooklyn.core.entity.Entities;
 import org.apache.brooklyn.core.location.RecordingMachineLocationCustomizer;
-import org.apache.brooklyn.core.location.RecordingMachineLocationCustomizer.Call;
-import org.apache.brooklyn.core.mgmt.internal.LocalManagementContext;
-import org.apache.brooklyn.core.test.entity.LocalManagementContextForTests;
-import org.apache.brooklyn.location.byon.FixedListMachineProvisioningLocation;
+import org.apache.brooklyn.core.test.BrooklynMgmtUnitTestSupport;
 import org.apache.brooklyn.location.ssh.SshMachineLocation;
 import org.apache.brooklyn.util.collections.MutableList;
 import org.apache.brooklyn.util.collections.MutableMap;
 import org.apache.brooklyn.util.net.Networking;
-import org.apache.brooklyn.util.stream.Streams;
 import org.slf4j.Logger;
 import org.slf4j.LoggerFactory;
 import org.testng.Assert;
-import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
@@ -61,33 +55,26 @@ import com.google.common.collect.Lists;
 /**
  * Provisions {@link SshMachineLocation}s in a specific location from a list of known machines
  */
-public class FixedListMachineProvisioningLocationTest {
+public class FixedListMachineProvisioningLocationTest extends BrooklynMgmtUnitTestSupport {
     
     private static final Logger LOG = LoggerFactory.getLogger(FixedListMachineProvisioningLocationTest.class);
 
     SshMachineLocation machine;
-    LocalManagementContext mgmt;
     FixedListMachineProvisioningLocation<SshMachineLocation> provisioner;
     FixedListMachineProvisioningLocation<SshMachineLocation> provisioner2;
     
-    @SuppressWarnings("unchecked")
     @BeforeMethod(alwaysRun=true)
-    public void createProvisioner() throws UnknownHostException {
-        mgmt = LocalManagementContextForTests.newInstance();
+    @SuppressWarnings("unchecked")
+    @Override
+    public void setUp() throws Exception {
+        super.setUp();
         
-        machine = mgmt.getLocationManager().createLocation(MutableMap.of("address", Inet4Address.getByName("192.168.144.200")), SshMachineLocation.class);
-        provisioner = mgmt.getLocationManager().createLocation(
-                MutableMap.of("machines", MutableList.of(machine)),
-                FixedListMachineProvisioningLocation.class);
+        machine = mgmt.getLocationManager().createLocation(LocationSpec.create(SshMachineLocation.class)
+                .configure("address", Inet4Address.getByName("192.168.144.200")));
+        provisioner = mgmt.getLocationManager().createLocation(LocationSpec.create(FixedListMachineProvisioningLocation.class)
+                .configure("machines", MutableList.of(machine)));
     }
 
-    @AfterMethod(alwaysRun=true)
-    public void tearDown() throws Exception {
-        if (provisioner != null) Streams.closeQuietly(provisioner);
-        if (provisioner2 != null) Streams.closeQuietly(provisioner2);
-        Entities.destroyAll(mgmt);
-    }
-    
     @Test
     public void testSetsChildLocations() throws NoMachinesAvailableException {
         // Available machines should be listed as children


[6/6] brooklyn-server git commit: This closes #296

Posted by al...@apache.org.
This closes #296


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

Branch: refs/heads/master
Commit: b4b48b3fdf257b8fda77aa2badd2be3f1c1818ef
Parents: 6f148be 3eb85d3
Author: Aled Sage <al...@gmail.com>
Authored: Thu Aug 11 20:38:26 2016 +0100
Committer: Aled Sage <al...@gmail.com>
Committed: Thu Aug 11 20:38:26 2016 +0100

----------------------------------------------------------------------
 .../camp/brooklyn/ConfigParametersYamlTest.java | 329 ++++++++++++++++++-
 .../camp/brooklyn/SshCommandSensorYamlTest.java |  73 ++++
 .../brooklyn/core/objs/BasicSpecParameter.java  |   7 +-
 ...ixedListMachineProvisioningLocationTest.java |  33 +-
 .../util/core/internal/ssh/ExecCmdAsserts.java  |  97 ++++++
 .../base/VanillaSoftwareProcessTest.java        |  82 +----
 6 files changed, 523 insertions(+), 98 deletions(-)
----------------------------------------------------------------------



[5/6] brooklyn-server git commit: Adds SshCommandSensorYamlTest

Posted by al...@apache.org.
Adds SshCommandSensorYamlTest


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

Branch: refs/heads/master
Commit: 3eb85d361ee77597adf7cf282e07bb6149f49289
Parents: 3d55018
Author: Aled Sage <al...@gmail.com>
Authored: Wed Aug 10 21:17:40 2016 +0100
Committer: Aled Sage <al...@gmail.com>
Committed: Thu Aug 11 20:37:26 2016 +0100

----------------------------------------------------------------------
 .../camp/brooklyn/SshCommandSensorYamlTest.java | 73 ++++++++++++++++++++
 1 file changed, 73 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/3eb85d36/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/SshCommandSensorYamlTest.java
----------------------------------------------------------------------
diff --git a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/SshCommandSensorYamlTest.java b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/SshCommandSensorYamlTest.java
new file mode 100644
index 0000000..cb4473b
--- /dev/null
+++ b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/SshCommandSensorYamlTest.java
@@ -0,0 +1,73 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements.  See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership.  The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied.  See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+package org.apache.brooklyn.camp.brooklyn;
+
+import org.apache.brooklyn.api.entity.Entity;
+import org.apache.brooklyn.core.entity.EntityAsserts;
+import org.apache.brooklyn.core.sensor.Sensors;
+import org.apache.brooklyn.entity.software.base.VanillaSoftwareProcess;
+import org.apache.brooklyn.util.core.internal.ssh.RecordingSshTool;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.Iterables;
+
+public class SshCommandSensorYamlTest extends AbstractYamlTest {
+    private static final Logger log = LoggerFactory.getLogger(SshCommandSensorYamlTest.class);
+
+    @BeforeMethod(alwaysRun=true)
+    @Override
+    public void setUp() throws Exception {
+        super.setUp();
+        RecordingSshTool.clear();
+    }
+    
+    @Test
+    public void testSshCommandSensorWithEffectorInEnv() throws Exception {
+        RecordingSshTool.setCustomResponse(".*myCommand.*", new RecordingSshTool.CustomResponse(0, "myResponse", null));
+        
+        Entity app = createAndStartApplication(
+            "location:",
+            "  localhost:",
+            "    sshToolClass: "+RecordingSshTool.class.getName(),
+            "services:",
+            "- type: " + VanillaSoftwareProcess.class.getName(),
+            "  brooklyn.config:",
+            "    onbox.base.dir.skipResolution: true",
+            "  brooklyn.initializers:",
+            "  - type: org.apache.brooklyn.core.sensor.ssh.SshCommandSensor",
+            "    brooklyn.config:",
+            "      name: mySensor",
+            "      command: myCommand",
+            "      period: 10ms",
+            "      onlyIfServiceUp: false");
+        waitForApplicationTasks(app);
+
+        VanillaSoftwareProcess entity = (VanillaSoftwareProcess) Iterables.getOnlyElement(app.getChildren());
+        EntityAsserts.assertAttributeEqualsEventually(entity, Sensors.newStringSensor("mySensor"), "myResponse");
+    }
+    
+    @Override
+    protected Logger getLogger() {
+        return log;
+    }
+    
+}


[2/6] brooklyn-server git commit: Extract execCmdAsserts

Posted by al...@apache.org.
Extract execCmdAsserts


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

Branch: refs/heads/master
Commit: ea87091c1e7aba6ae21d572740cbccffce3f3e15
Parents: ddb6acc
Author: Aled Sage <al...@gmail.com>
Authored: Wed Aug 10 21:14:58 2016 +0100
Committer: Aled Sage <al...@gmail.com>
Committed: Thu Aug 11 20:37:25 2016 +0100

----------------------------------------------------------------------
 .../util/core/internal/ssh/ExecCmdAsserts.java  | 97 ++++++++++++++++++++
 .../base/VanillaSoftwareProcessTest.java        | 82 +++--------------
 2 files changed, 108 insertions(+), 71 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/ea87091c/core/src/test/java/org/apache/brooklyn/util/core/internal/ssh/ExecCmdAsserts.java
----------------------------------------------------------------------
diff --git a/core/src/test/java/org/apache/brooklyn/util/core/internal/ssh/ExecCmdAsserts.java b/core/src/test/java/org/apache/brooklyn/util/core/internal/ssh/ExecCmdAsserts.java
new file mode 100644
index 0000000..f5fcab5
--- /dev/null
+++ b/core/src/test/java/org/apache/brooklyn/util/core/internal/ssh/ExecCmdAsserts.java
@@ -0,0 +1,97 @@
+/*
+ * Copyright 2016 The Apache Software Foundation.
+ *
+ * Licensed under the Apache License, Version 2.0 (the "License");
+ * you may not use this file except in compliance with the License.
+ * You may obtain a copy of the License at
+ *
+ *      http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.brooklyn.util.core.internal.ssh;
+
+import static org.testng.Assert.assertTrue;
+import static org.testng.Assert.fail;
+
+import java.util.List;
+
+import org.apache.brooklyn.util.core.internal.ssh.RecordingSshTool.ExecCmd;
+
+import com.google.common.annotations.Beta;
+import com.google.common.base.Predicate;
+
+@Beta
+public class ExecCmdAsserts {
+
+    public static void assertExecsContain(List<ExecCmd> actuals, List<String> expectedCmds) {
+        String errMsg = "actuals="+actuals+"; expected="+expectedCmds;
+        assertTrue(actuals.size() >= expectedCmds.size(), "actualSize="+actuals.size()+"; expectedSize="+expectedCmds.size()+"; "+errMsg);
+        for (int i = 0; i < expectedCmds.size(); i++) {
+            assertExecContains(actuals.get(i), expectedCmds.get(i), errMsg);
+        }
+    }
+
+    public static void assertExecContains(ExecCmd actual, String expectedCmdRegex) {
+        assertExecContains(actual, expectedCmdRegex, null);
+    }
+    
+    public static void assertExecContains(ExecCmd actual, String expectedCmdRegex, String errMsg) {
+        for (String cmd : actual.commands) {
+            if (cmd.matches(expectedCmdRegex)) {
+                return;
+            }
+        }
+        fail(expectedCmdRegex + " not matched by any commands in " + actual+(errMsg != null ? "; "+errMsg : ""));
+    }
+
+    public static void assertExecsNotContains(List<? extends ExecCmd> actuals, List<String> expectedNotCmdRegexs) {
+        for (ExecCmd actual : actuals) {
+            assertExecNotContains(actual, expectedNotCmdRegexs);
+        }
+    }
+    
+    public static void assertExecNotContains(ExecCmd actual, List<String> expectedNotCmdRegexs) {
+        for (String cmdRegex : expectedNotCmdRegexs) {
+            for (String subActual : actual.commands) {
+                if (subActual.matches(cmdRegex)) {
+                    fail("Exec should not contain " + cmdRegex + ", but matched by " + actual);
+                }
+            }
+        }
+    }
+
+    public static void assertExecsSatisfy(List<ExecCmd> actuals, List<? extends Predicate<? super ExecCmd>> expectedCmds) {
+        String errMsg = "actuals="+actuals+"; expected="+expectedCmds;
+        assertTrue(actuals.size() >= expectedCmds.size(), "actualSize="+actuals.size()+"; expectedSize="+expectedCmds.size()+"; "+errMsg);
+        for (int i = 0; i < expectedCmds.size(); i++) {
+            assertExecSatisfies(actuals.get(i), expectedCmds.get(i), errMsg);
+        }
+    }
+
+    public static void assertExecSatisfies(ExecCmd actual, Predicate<? super ExecCmd> expected) {
+        assertExecSatisfies(actual, expected, null);
+    }
+    
+    public static void assertExecSatisfies(ExecCmd actual, Predicate<? super ExecCmd> expected, String errMsg) {
+        if (!expected.apply(actual)) {
+            fail(expected + " not matched by " + actual + (errMsg != null ? "; "+errMsg : ""));
+        }
+    }
+
+    public static ExecCmd findExecContaining(List<ExecCmd> actuals, String cmdRegex) {
+        for (ExecCmd actual : actuals) {
+            for (String subActual : actual.commands) {
+                if (subActual.matches(cmdRegex)) {
+                    return actual;
+                }
+            }
+        }
+        fail("No match for '"+cmdRegex+"' in "+actuals);
+        throw new IllegalStateException("unreachable code");
+    }
+}

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/ea87091c/software/base/src/test/java/org/apache/brooklyn/entity/software/base/VanillaSoftwareProcessTest.java
----------------------------------------------------------------------
diff --git a/software/base/src/test/java/org/apache/brooklyn/entity/software/base/VanillaSoftwareProcessTest.java b/software/base/src/test/java/org/apache/brooklyn/entity/software/base/VanillaSoftwareProcessTest.java
index 3b30328..45b7cc6 100644
--- a/software/base/src/test/java/org/apache/brooklyn/entity/software/base/VanillaSoftwareProcessTest.java
+++ b/software/base/src/test/java/org/apache/brooklyn/entity/software/base/VanillaSoftwareProcessTest.java
@@ -18,10 +18,6 @@
  */
 package org.apache.brooklyn.entity.software.base;
 
-import static org.testng.Assert.assertTrue;
-import static org.testng.Assert.fail;
-
-import java.util.List;
 import java.util.Map;
 import java.util.concurrent.atomic.AtomicBoolean;
 
@@ -33,15 +29,14 @@ import org.apache.brooklyn.core.entity.Entities;
 import org.apache.brooklyn.core.test.BrooklynAppUnitTestSupport;
 import org.apache.brooklyn.location.byon.FixedListMachineProvisioningLocation;
 import org.apache.brooklyn.location.ssh.SshMachineLocation;
+import org.apache.brooklyn.util.core.internal.ssh.ExecCmdAsserts;
 import org.apache.brooklyn.util.core.internal.ssh.RecordingSshTool;
 import org.apache.brooklyn.util.core.internal.ssh.RecordingSshTool.CustomResponse;
-import org.apache.brooklyn.util.core.internal.ssh.RecordingSshTool.ExecCmd;
 import org.apache.brooklyn.util.core.internal.ssh.RecordingSshTool.ExecCmdPredicates;
 import org.apache.brooklyn.util.core.internal.ssh.RecordingSshTool.ExecParams;
 import org.testng.annotations.BeforeMethod;
 import org.testng.annotations.Test;
 
-import com.google.common.base.Predicate;
 import com.google.common.base.Predicates;
 import com.google.common.collect.ImmutableList;
 import com.google.common.collect.ImmutableMap;
@@ -85,7 +80,7 @@ public class VanillaSoftwareProcessTest extends BrooklynAppUnitTestSupport {
                 .configure(VanillaSoftwareProcess.STOP_COMMAND, "stopCommand"));
         app.start(ImmutableList.of(loc));
 
-        assertExecsContain(RecordingSshTool.getExecCmds(), ImmutableList.of(
+        ExecCmdAsserts.assertExecsContain(RecordingSshTool.getExecCmds(), ImmutableList.of(
                 "preInstallCommand", "installCommand", "postInstallCommand", 
                 "preCustomizeCommand", "customizeCommand", "postCustomizeCommand", 
                 "preLaunchCommand", "launchCommand", "postLaunchCommand", 
@@ -93,7 +88,7 @@ public class VanillaSoftwareProcessTest extends BrooklynAppUnitTestSupport {
         
         app.stop();
 
-        assertExecContains(RecordingSshTool.getLastExecCmd(), "stopCommand");
+        ExecCmdAsserts.assertExecContains(RecordingSshTool.getLastExecCmd(), "stopCommand");
     }
 
     // See https://issues.apache.org/jira/browse/BROOKLYN-273
@@ -127,7 +122,7 @@ public class VanillaSoftwareProcessTest extends BrooklynAppUnitTestSupport {
                 VanillaSoftwareProcess.RestartSoftwareParameters.RESTART_MACHINE.getName(), VanillaSoftwareProcess.RestartSoftwareParameters.RestartMachineMode.FALSE))
                 .get();
 
-        assertExecsContain(RecordingSshTool.getExecCmds(), ImmutableList.of(
+        ExecCmdAsserts.assertExecsContain(RecordingSshTool.getExecCmds(), ImmutableList.of(
                 "checkRunningCommand", "stopCommand",  
                 "preLaunchCommand", "launchCommand", "postLaunchCommand", 
                 "checkRunningCommand"));
@@ -151,12 +146,12 @@ public class VanillaSoftwareProcessTest extends BrooklynAppUnitTestSupport {
                 .configure(VanillaSoftwareProcess.STOP_COMMAND, "stopCommand"));
         app.start(ImmutableList.of(loc));
 
-        assertExecsContain(RecordingSshTool.getExecCmds(), ImmutableList.of(
+        ExecCmdAsserts.assertExecsContain(RecordingSshTool.getExecCmds(), ImmutableList.of(
                 "preCustomizeCommand", "customizeCommand", "postCustomizeCommand", 
                 "preLaunchCommand", "launchCommand", "postLaunchCommand", 
                 "checkRunningCommand"));
         
-        assertExecsNotContains(RecordingSshTool.getExecCmds(), ImmutableList.of(
+        ExecCmdAsserts.assertExecsNotContains(RecordingSshTool.getExecCmds(), ImmutableList.of(
                 "preInstallCommand", "installCommand", "postInstallCommand"));
     }
 
@@ -177,10 +172,10 @@ public class VanillaSoftwareProcessTest extends BrooklynAppUnitTestSupport {
                 .configure(VanillaSoftwareProcess.STOP_COMMAND, "stopCommand"));
         app.start(ImmutableList.of(loc));
 
-        assertExecsContain(RecordingSshTool.getExecCmds(), ImmutableList.of(
+        ExecCmdAsserts.assertExecsContain(RecordingSshTool.getExecCmds(), ImmutableList.of(
                 "checkRunningCommand"));
         
-        assertExecsNotContains(RecordingSshTool.getExecCmds(), ImmutableList.of(
+        ExecCmdAsserts.assertExecsNotContains(RecordingSshTool.getExecCmds(), ImmutableList.of(
                 "launchCommand"));
     }
 
@@ -219,7 +214,7 @@ public class VanillaSoftwareProcessTest extends BrooklynAppUnitTestSupport {
                 .configure(VanillaSoftwareProcess.STOP_COMMAND, "stopCommand"));
         app.start(ImmutableList.of(loc));
 
-        assertExecsContain(RecordingSshTool.getExecCmds(), ImmutableList.of(
+        ExecCmdAsserts.assertExecsContain(RecordingSshTool.getExecCmds(), ImmutableList.of(
                 "checkRunningCommand",
                 "preInstallCommand", "installCommand", "postInstallCommand", 
                 "preCustomizeCommand", "customizeCommand", "postCustomizeCommand", 
@@ -246,7 +241,7 @@ public class VanillaSoftwareProcessTest extends BrooklynAppUnitTestSupport {
 
         Map<String, String> expectedEnv = ImmutableMap.of("KEY1", "VAL1");
         
-        assertExecsSatisfy(RecordingSshTool.getExecCmds(), ImmutableList.of(
+        ExecCmdAsserts.assertExecsSatisfy(RecordingSshTool.getExecCmds(), ImmutableList.of(
                 Predicates.and(ExecCmdPredicates.containsCmd("preInstallCommand"), ExecCmdPredicates.containsEnv(expectedEnv)),
                 Predicates.and(ExecCmdPredicates.containsCmd("installCommand"), ExecCmdPredicates.containsEnv(expectedEnv)),
                 Predicates.and(ExecCmdPredicates.containsCmd("postInstallCommand"), ExecCmdPredicates.containsEnv(expectedEnv)),
@@ -260,63 +255,8 @@ public class VanillaSoftwareProcessTest extends BrooklynAppUnitTestSupport {
         
         app.stop();
 
-        assertExecSatisfies(
+        ExecCmdAsserts.assertExecSatisfies(
                 RecordingSshTool.getLastExecCmd(),
                 Predicates.and(ExecCmdPredicates.containsCmd("stopCommand"), ExecCmdPredicates.containsEnv(expectedEnv)));
     }
-    
-    protected void assertExecsContain(List<ExecCmd> actuals, List<String> expectedCmds) {
-        String errMsg = "actuals="+actuals+"; expected="+expectedCmds;
-        assertTrue(actuals.size() >= expectedCmds.size(), "actualSize="+actuals.size()+"; expectedSize="+expectedCmds.size()+"; "+errMsg);
-        for (int i = 0; i < expectedCmds.size(); i++) {
-            assertExecContains(actuals.get(i), expectedCmds.get(i), errMsg);
-        }
-    }
-
-    protected void assertExecContains(ExecCmd actual, String expectedCmdRegex) {
-        assertExecContains(actual, expectedCmdRegex, null);
-    }
-    
-    protected void assertExecContains(ExecCmd actual, String expectedCmdRegex, String errMsg) {
-        for (String cmd : actual.commands) {
-            if (cmd.matches(expectedCmdRegex)) {
-                return;
-            }
-        }
-        fail(expectedCmdRegex + " not matched by any commands in " + actual+(errMsg != null ? "; "+errMsg : ""));
-    }
-
-    protected void assertExecsNotContains(List<? extends ExecCmd> actuals, List<String> expectedNotCmdRegexs) {
-        for (ExecCmd actual : actuals) {
-            assertExecContains(actual, expectedNotCmdRegexs);
-        }
-    }
-    
-    protected void assertExecContains(ExecCmd actual, List<String> expectedNotCmdRegexs) {
-        for (String cmdRegex : expectedNotCmdRegexs) {
-            for (String subActual : actual.commands) {
-                if (subActual.matches(cmdRegex)) {
-                    fail("Exec should not contain " + cmdRegex + ", but matched by " + actual);
-                }
-            }
-        }
-    }
-
-    protected void assertExecsSatisfy(List<ExecCmd> actuals, List<? extends Predicate<? super ExecCmd>> expectedCmds) {
-        String errMsg = "actuals="+actuals+"; expected="+expectedCmds;
-        assertTrue(actuals.size() >= expectedCmds.size(), "actualSize="+actuals.size()+"; expectedSize="+expectedCmds.size()+"; "+errMsg);
-        for (int i = 0; i < expectedCmds.size(); i++) {
-            assertExecSatisfies(actuals.get(i), expectedCmds.get(i), errMsg);
-        }
-    }
-
-    protected void assertExecSatisfies(ExecCmd actual, Predicate<? super ExecCmd> expected) {
-        assertExecSatisfies(actual, expected, null);
-    }
-    
-    protected void assertExecSatisfies(ExecCmd actual, Predicate<? super ExecCmd> expected, String errMsg) {
-        if (!expected.apply(actual)) {
-            fail(expected + " not matched by " + actual + (errMsg != null ? "; "+errMsg : ""));
-        }
-    }
 }