brooklyn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aleds...@apache.org
Subject [1/2] brooklyn-server git commit: Adds ConfigParametersYamlTest.testPortSetAsAttributeOnSoftwareProcess
Date Thu, 24 Nov 2016 09:45:53 GMT
Repository: brooklyn-server
Updated Branches:
  refs/heads/master acd8631eb -> 8cb244236


Adds ConfigParametersYamlTest.testPortSetAsAttributeOnSoftwareProcess

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

Branch: refs/heads/master
Commit: 240e8f26307a344def74b6d453d9d61faac5319b
Parents: 24fa6fe
Author: Aled Sage <aled.sage@gmail.com>
Authored: Mon Nov 21 17:23:25 2016 +0000
Committer: Aled Sage <aled.sage@gmail.com>
Committed: Mon Nov 21 17:23:25 2016 +0000

----------------------------------------------------------------------
 .../camp/brooklyn/ConfigParametersYamlTest.java | 31 ++++++++++++++++++++
 1 file changed, 31 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/240e8f26/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 4795d3b..7d6828a 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
@@ -32,7 +32,10 @@ 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.entity.BrooklynConfigKeys;
+import org.apache.brooklyn.core.location.PortRanges;
+import org.apache.brooklyn.core.sensor.Sensors;
 import org.apache.brooklyn.core.test.entity.TestEntity;
+import org.apache.brooklyn.entity.software.base.EmptySoftwareProcess;
 import org.apache.brooklyn.entity.software.base.VanillaSoftwareProcess;
 import org.apache.brooklyn.entity.stock.BasicApplication;
 import org.apache.brooklyn.location.ssh.SshMachineLocation;
@@ -583,4 +586,32 @@ public class ConfigParametersYamlTest extends AbstractYamlTest {
         Entity child = entity.addChild((EntitySpec<?>)defaultVal);
         assertTrue(child instanceof BasicApplication, "child="+child);
     }
+    
+    @Test
+    public void testPortSetAsAttributeOnSoftwareProcess() throws Exception {
+        addCatalogItems(
+                "brooklyn.catalog:",
+                "  itemType: entity",
+                "  items:",
+                "  - id: entity-with-keys",
+                "    item:",
+                "      type: "+EmptySoftwareProcess.class.getName(),
+                "      brooklyn.parameters:",
+                "      - name: my.param.key",
+                "        type: port",
+                "        default: 1234");
+
+        String yaml = Joiner.on("\n").join(
+                "location:",
+                "  localhost:",
+                "    " + SshMachineLocation.SSH_TOOL_CLASS.getName() + ": " + RecordingSshTool.class.getName(),
+                "services:",
+                "- type: entity-with-keys");
+
+        Entity app = createStartWaitAndLogApplication(yaml);
+        EmptySoftwareProcess entity = (EmptySoftwareProcess) Iterables.getOnlyElement(app.getChildren());
+
+        assertEquals(entity.config().get(ConfigKeys.newConfigKey(Object.class, "my.param.key")),
PortRanges.fromInteger(1234));
+        assertEquals(entity.sensors().get(Sensors.newSensor(Object.class, "my.param.key")),
1234);
+    }
 }


Mime
View raw message