You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by gr...@apache.org on 2016/07/04 09:33:20 UTC
[1/3] brooklyn-server git commit: Added identity method to DSL
Repository: brooklyn-server
Updated Branches:
refs/heads/master a941963c9 -> 586795b32
Added identity method to DSL
Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/2c80d164
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/2c80d164
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/2c80d164
Branch: refs/heads/master
Commit: 2c80d164eefe605c07f14b51d763e310a6314b3f
Parents: a941963
Author: Andrew Donald Kennedy <an...@cloudsoftcorp.com>
Authored: Wed Jun 8 18:18:47 2016 +0100
Committer: Andrew Donald Kennedy <an...@cloudsoftcorp.com>
Committed: Sat Jun 25 23:36:56 2016 +0100
----------------------------------------------------------------------
.../spi/dsl/methods/BrooklynDslCommon.java | 4 +
.../brooklyn/spi/dsl/methods/DslComponent.java | 41 +++++++++-
.../camp/brooklyn/IdentityYamlTest.java | 82 ++++++++++++++++++++
.../test/resources/test-entity-identity.yaml | 30 +++++++
4 files changed, 154 insertions(+), 3 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/2c80d164/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/methods/BrooklynDslCommon.java
----------------------------------------------------------------------
diff --git a/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/methods/BrooklynDslCommon.java b/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/methods/BrooklynDslCommon.java
index 48ea03f..07c127e 100644
--- a/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/methods/BrooklynDslCommon.java
+++ b/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/methods/BrooklynDslCommon.java
@@ -112,6 +112,10 @@ public class BrooklynDslCommon {
return new DslComponent(Scope.THIS, "").attributeWhenReady(sensorName);
}
+ public static BrooklynDslDeferredSupplier<?> identity() {
+ return new DslComponent(Scope.THIS, "").identity();
+ }
+
/** Returns a {@link Sensor}, looking up the sensor on the context if available and using that,
* or else defining an untyped (Object) sensor */
public static BrooklynDslDeferredSupplier<Sensor<?>> sensor(String sensorName) {
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/2c80d164/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/methods/DslComponent.java
----------------------------------------------------------------------
diff --git a/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/methods/DslComponent.java b/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/methods/DslComponent.java
index 9dd3a04..c43f3bb 100644
--- a/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/methods/DslComponent.java
+++ b/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/methods/DslComponent.java
@@ -46,6 +46,7 @@ import com.google.common.base.Optional;
import com.google.common.base.Preconditions;
import com.google.common.collect.ImmutableSet;
import com.google.common.collect.Iterables;
+import com.google.common.util.concurrent.Callables;
public class DslComponent extends BrooklynDslDeferredSupplier<Entity> {
@@ -184,19 +185,53 @@ public class DslComponent extends BrooklynDslDeferredSupplier<Entity> {
}
// DSL words which return things
-
+
+ public BrooklynDslDeferredSupplier<?> identity() {
+ return new Identity(this);
+ }
+ protected static class Identity extends BrooklynDslDeferredSupplier<Object> {
+ private static final long serialVersionUID = -1L;
+ private final DslComponent component;
+ public Identity(DslComponent component) {
+ this.component = Preconditions.checkNotNull(component);
+ }
+
+ @Override
+ public Task<Object> newTask() {
+ Entity targetEntity = component.get();
+ return Tasks.create("identity", Callables.<Object>returning(targetEntity.getId()));
+ }
+
+ @Override
+ public int hashCode() {
+ return Objects.hashCode(component);
+ }
+ @Override
+ public boolean equals(Object obj) {
+ if (this == obj) return true;
+ if (obj == null || getClass() != obj.getClass()) return false;
+ Identity that = Identity.class.cast(obj);
+ return Objects.equal(this.component, that.component);
+ }
+ @Override
+ public String toString() {
+ return (component.scope==Scope.THIS ? "" : component.toString()+".") + "identity()";
+ }
+ }
+
public BrooklynDslDeferredSupplier<?> attributeWhenReady(final String sensorName) {
return new AttributeWhenReady(this, sensorName);
}
- // class simply makes the memento XML files nicer
protected static class AttributeWhenReady extends BrooklynDslDeferredSupplier<Object> {
private static final long serialVersionUID = 1740899524088902383L;
private final DslComponent component;
private final String sensorName;
+
public AttributeWhenReady(DslComponent component, String sensorName) {
this.component = Preconditions.checkNotNull(component);
this.sensorName = sensorName;
}
+
@SuppressWarnings("unchecked")
@Override
public Task<Object> newTask() {
@@ -207,11 +242,11 @@ public class DslComponent extends BrooklynDslDeferredSupplier<Entity> {
}
return (Task<Object>) DependentConfiguration.attributeWhenReady(targetEntity, (AttributeSensor<?>)targetSensor);
}
+
@Override
public int hashCode() {
return Objects.hashCode(component, sensorName);
}
-
@Override
public boolean equals(Object obj) {
if (this == obj) return true;
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/2c80d164/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/IdentityYamlTest.java
----------------------------------------------------------------------
diff --git a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/IdentityYamlTest.java b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/IdentityYamlTest.java
new file mode 100644
index 0000000..c059e68
--- /dev/null
+++ b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/IdentityYamlTest.java
@@ -0,0 +1,82 @@
+/*
+uniqueSshConnection * 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.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+import com.google.common.collect.Iterables;
+
+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.entity.Entities;
+import org.apache.brooklyn.core.entity.EntityPredicates;
+import org.apache.brooklyn.core.test.entity.TestEntity;
+import org.apache.brooklyn.util.text.StringPredicates;
+
+@Test
+public class IdentityYamlTest extends AbstractYamlTest {
+ private static final Logger log = LoggerFactory.getLogger(IdentityYamlTest.class);
+
+ private static final ConfigKey<String> TEST_ENTITY_ONE_ID = ConfigKeys.newStringConfigKey("testentityone.id");
+ private static final ConfigKey<String> TEST_ENTITY_TWO_ID = ConfigKeys.newStringConfigKey("testentitytwo.id");
+
+ protected Iterable<? extends Entity> setupAndCheckTestEntityInBasicYamlWith() throws Exception {
+ Entity app = createAndStartApplication(loadYaml("test-entity-identity.yaml"));
+ waitForApplicationTasks(app);
+
+ Assert.assertEquals(app.getDisplayName(), "test-entity-identity");
+
+ log.info("App started:");
+ Entities.dumpInfo(app);
+
+ Assert.assertEquals(Iterables.size(app.getChildren()), 2, "Expected app to have child entity");
+ Iterable<? extends Entity> testEntities = Iterables.filter(app.getChildren(), TestEntity.class);
+ Assert.assertEquals(Iterables.size(testEntities), 2, "Expected app to have two test entities");
+
+ return testEntities;
+ }
+
+ @Test
+ public void testYamlParsing() throws Exception {
+ setupAndCheckTestEntityInBasicYamlWith();
+ }
+
+ @Test
+ public void testBrooklynIdentityFunction() throws Exception {
+ Iterable<? extends Entity> testEntities = setupAndCheckTestEntityInBasicYamlWith();
+ Entity testEntityOne = Iterables.find(testEntities, EntityPredicates.displayNameSatisfies(StringPredicates.containsLiteral("One")));
+ Entity testEntityTwo = Iterables.find(testEntities, EntityPredicates.displayNameSatisfies(StringPredicates.containsLiteral("Two")));
+
+ Assert.assertNotNull(testEntityOne, "Test entity one should be present");
+ Assert.assertNotNull(testEntityTwo, "Test entity two should be present");
+
+ Assert.assertEquals(testEntityOne.config().get(TEST_ENTITY_ONE_ID), testEntityOne.getId(), "Entity one IDs should match");
+ Assert.assertEquals(testEntityOne.config().get(TEST_ENTITY_TWO_ID), testEntityTwo.getId(), "Entity two IDs should match");
+ }
+
+ @Override
+ protected Logger getLogger() {
+ return log;
+ }
+
+}
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/2c80d164/camp/camp-brooklyn/src/test/resources/test-entity-identity.yaml
----------------------------------------------------------------------
diff --git a/camp/camp-brooklyn/src/test/resources/test-entity-identity.yaml b/camp/camp-brooklyn/src/test/resources/test-entity-identity.yaml
new file mode 100644
index 0000000..d238ec8
--- /dev/null
+++ b/camp/camp-brooklyn/src/test/resources/test-entity-identity.yaml
@@ -0,0 +1,30 @@
+# 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.
+#
+name: test-entity-identity
+description: TestEntity with references to other entity ids
+origin: https://github.com/apache/brooklyn
+services:
+ - type: org.apache.brooklyn.core.test.entity.TestEntity
+ id: testentityone
+ name: "Test Entity One"
+ brooklyn.config:
+ testentityone.id: $brooklyn:identity()
+ testentitytwo.id: $brooklyn:entity("testentitytwo").identity()
+ - type: org.apache.brooklyn.core.test.entity.TestEntity
+ id: testentitytwo
+ name: "test Entity Two"
[2/3] brooklyn-server git commit: Change DSL method to entityId from
identity
Posted by gr...@apache.org.
Change DSL method to entityId from identity
Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/d91d420f
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/d91d420f
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/d91d420f
Branch: refs/heads/master
Commit: d91d420f3b1c8ed1608878c34db0b220ec185ebf
Parents: 2c80d16
Author: Andrew Donald Kennedy <an...@cloudsoftcorp.com>
Authored: Sat Jun 25 23:36:27 2016 +0100
Committer: Andrew Donald Kennedy <an...@cloudsoftcorp.com>
Committed: Sat Jun 25 23:37:09 2016 +0100
----------------------------------------------------------------------
.../spi/dsl/methods/BrooklynDslCommon.java | 4 +-
.../brooklyn/spi/dsl/methods/DslComponent.java | 74 ++++++++++----------
.../camp/brooklyn/IdentityYamlTest.java | 42 +++++------
.../test/resources/test-entity-identity.yaml | 30 --------
4 files changed, 61 insertions(+), 89 deletions(-)
----------------------------------------------------------------------
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d91d420f/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/methods/BrooklynDslCommon.java
----------------------------------------------------------------------
diff --git a/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/methods/BrooklynDslCommon.java b/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/methods/BrooklynDslCommon.java
index 07c127e..9f767e3 100644
--- a/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/methods/BrooklynDslCommon.java
+++ b/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/methods/BrooklynDslCommon.java
@@ -112,8 +112,8 @@ public class BrooklynDslCommon {
return new DslComponent(Scope.THIS, "").attributeWhenReady(sensorName);
}
- public static BrooklynDslDeferredSupplier<?> identity() {
- return new DslComponent(Scope.THIS, "").identity();
+ public static BrooklynDslDeferredSupplier<?> entityId() {
+ return new DslComponent(Scope.THIS, "").entityId();
}
/** Returns a {@link Sensor}, looking up the sensor on the context if available and using that,
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d91d420f/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/methods/DslComponent.java
----------------------------------------------------------------------
diff --git a/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/methods/DslComponent.java b/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/methods/DslComponent.java
index c43f3bb..19ea766 100644
--- a/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/methods/DslComponent.java
+++ b/camp/camp-brooklyn/src/main/java/org/apache/brooklyn/camp/brooklyn/spi/dsl/methods/DslComponent.java
@@ -41,6 +41,8 @@ import org.apache.brooklyn.util.core.task.Tasks;
import org.apache.brooklyn.util.guava.Maybe;
import org.apache.brooklyn.util.text.StringEscapes.JavaStringEscapes;
+import com.google.common.base.CaseFormat;
+import com.google.common.base.Converter;
import com.google.common.base.Objects;
import com.google.common.base.Optional;
import com.google.common.base.Preconditions;
@@ -186,13 +188,13 @@ public class DslComponent extends BrooklynDslDeferredSupplier<Entity> {
// DSL words which return things
- public BrooklynDslDeferredSupplier<?> identity() {
- return new Identity(this);
+ public BrooklynDslDeferredSupplier<?> entityId() {
+ return new EntityId(this);
}
- protected static class Identity extends BrooklynDslDeferredSupplier<Object> {
- private static final long serialVersionUID = -1L;
+ protected static class EntityId extends BrooklynDslDeferredSupplier<Object> {
private final DslComponent component;
- public Identity(DslComponent component) {
+
+ public EntityId(DslComponent component) {
this.component = Preconditions.checkNotNull(component);
}
@@ -210,12 +212,12 @@ public class DslComponent extends BrooklynDslDeferredSupplier<Entity> {
public boolean equals(Object obj) {
if (this == obj) return true;
if (obj == null || getClass() != obj.getClass()) return false;
- Identity that = Identity.class.cast(obj);
+ EntityId that = EntityId.class.cast(obj);
return Objects.equal(this.component, that.component);
}
@Override
public String toString() {
- return (component.scope==Scope.THIS ? "" : component.toString()+".") + "identity()";
+ return (component.scope==Scope.THIS ? "" : component.toString()+".") + "entityId()";
}
}
@@ -358,40 +360,40 @@ public class DslComponent extends BrooklynDslDeferredSupplier<Entity> {
}
public static enum Scope {
- GLOBAL ("global"),
- CHILD ("child"),
- PARENT ("parent"),
- SIBLING ("sibling"),
- DESCENDANT ("descendant"),
- ANCESTOR("ancestor"),
- ROOT("root"),
- SCOPE_ROOT("scopeRoot"),
- THIS ("this");
-
- public static final Set<Scope> VALUES = ImmutableSet.of(GLOBAL, CHILD, PARENT, SIBLING, DESCENDANT, ANCESTOR, ROOT, SCOPE_ROOT, THIS);
-
- private final String name;
-
- private Scope(String name) {
- this.name = name;
- }
-
+ GLOBAL,
+ CHILD,
+ PARENT,
+ SIBLING,
+ DESCENDANT,
+ ANCESTOR,
+ ROOT,
+ SCOPE_ROOT,
+ THIS;
+
+ private static Converter<String, String> converter = CaseFormat.LOWER_CAMEL.converterTo(CaseFormat.UPPER_UNDERSCORE);
+
public static Scope fromString(String name) {
- return tryFromString(name).get();
+ Maybe<Scope> parsed = tryFromString(name);
+ return parsed.get();
}
-
+
public static Maybe<Scope> tryFromString(String name) {
- for (Scope scope : VALUES)
- if (scope.name.toLowerCase().equals(name.toLowerCase()))
- return Maybe.of(scope);
- return Maybe.absent(new IllegalArgumentException(name + " is not a valid scope"));
+ try {
+ Scope scope = valueOf(converter.convert(name));
+ return Maybe.of(scope);
+ } catch (Exception cause) {
+ return Maybe.absent(cause);
+ }
}
-
+
public static boolean isValid(String name) {
- for (Scope scope : VALUES)
- if (scope.name.toLowerCase().equals(name.toLowerCase()))
- return true;
- return false;
+ Maybe<Scope> check = tryFromString(name);
+ return check.isPresentAndNonNull();
+ }
+
+ @Override
+ public String toString() {
+ return converter.reverse().convert(name());
}
}
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d91d420f/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/IdentityYamlTest.java
----------------------------------------------------------------------
diff --git a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/IdentityYamlTest.java b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/IdentityYamlTest.java
index c059e68..480931d 100644
--- a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/IdentityYamlTest.java
+++ b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/IdentityYamlTest.java
@@ -28,10 +28,8 @@ import com.google.common.collect.Iterables;
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.entity.Entities;
import org.apache.brooklyn.core.entity.EntityPredicates;
import org.apache.brooklyn.core.test.entity.TestEntity;
-import org.apache.brooklyn.util.text.StringPredicates;
@Test
public class IdentityYamlTest extends AbstractYamlTest {
@@ -41,37 +39,39 @@ public class IdentityYamlTest extends AbstractYamlTest {
private static final ConfigKey<String> TEST_ENTITY_TWO_ID = ConfigKeys.newStringConfigKey("testentitytwo.id");
protected Iterable<? extends Entity> setupAndCheckTestEntityInBasicYamlWith() throws Exception {
- Entity app = createAndStartApplication(loadYaml("test-entity-identity.yaml"));
+ Entity app = createAndStartApplication(
+ "services:",
+ " - type: " + TestEntity.class.getName(),
+ " id: testentityone",
+ " name: \"Test Entity One\"",
+ " brooklyn.config:",
+ " testentityone.id: $brooklyn:entityId()",
+ " testentitytwo.id: $brooklyn:entity(\"testentitytwo\").entityId()",
+ " - type: " + TestEntity.class.getName(),
+ " id: testentitytwo",
+ " name: \"Test Entity Two\"");
waitForApplicationTasks(app);
-
- Assert.assertEquals(app.getDisplayName(), "test-entity-identity");
-
- log.info("App started:");
- Entities.dumpInfo(app);
-
- Assert.assertEquals(Iterables.size(app.getChildren()), 2, "Expected app to have child entity");
- Iterable<? extends Entity> testEntities = Iterables.filter(app.getChildren(), TestEntity.class);
- Assert.assertEquals(Iterables.size(testEntities), 2, "Expected app to have two test entities");
-
- return testEntities;
+ return Iterables.filter(app.getChildren(), TestEntity.class);
}
@Test
public void testYamlParsing() throws Exception {
- setupAndCheckTestEntityInBasicYamlWith();
+ Iterable<? extends Entity> testEntities = setupAndCheckTestEntityInBasicYamlWith();
+
+ Assert.assertEquals(Iterables.size(testEntities), 2, "Should be two entities");
}
@Test
public void testBrooklynIdentityFunction() throws Exception {
Iterable<? extends Entity> testEntities = setupAndCheckTestEntityInBasicYamlWith();
- Entity testEntityOne = Iterables.find(testEntities, EntityPredicates.displayNameSatisfies(StringPredicates.containsLiteral("One")));
- Entity testEntityTwo = Iterables.find(testEntities, EntityPredicates.displayNameSatisfies(StringPredicates.containsLiteral("Two")));
+ Entity entityOne = Iterables.find(testEntities, EntityPredicates.displayNameEqualTo("Test Entity One"));
+ Entity entityTwo = Iterables.find(testEntities, EntityPredicates.displayNameEqualTo("Test Entity Two"));
- Assert.assertNotNull(testEntityOne, "Test entity one should be present");
- Assert.assertNotNull(testEntityTwo, "Test entity two should be present");
+ Assert.assertNotNull(entityOne, "Test entity one should be present");
+ Assert.assertNotNull(entityTwo, "Test entity two should be present");
- Assert.assertEquals(testEntityOne.config().get(TEST_ENTITY_ONE_ID), testEntityOne.getId(), "Entity one IDs should match");
- Assert.assertEquals(testEntityOne.config().get(TEST_ENTITY_TWO_ID), testEntityTwo.getId(), "Entity two IDs should match");
+ Assert.assertEquals(entityOne.config().get(TEST_ENTITY_ONE_ID), entityOne.getId(), "Entity one IDs should match");
+ Assert.assertEquals(entityOne.config().get(TEST_ENTITY_TWO_ID), entityTwo.getId(), "Entity two IDs should match");
}
@Override
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/d91d420f/camp/camp-brooklyn/src/test/resources/test-entity-identity.yaml
----------------------------------------------------------------------
diff --git a/camp/camp-brooklyn/src/test/resources/test-entity-identity.yaml b/camp/camp-brooklyn/src/test/resources/test-entity-identity.yaml
deleted file mode 100644
index d238ec8..0000000
--- a/camp/camp-brooklyn/src/test/resources/test-entity-identity.yaml
+++ /dev/null
@@ -1,30 +0,0 @@
-# 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.
-#
-name: test-entity-identity
-description: TestEntity with references to other entity ids
-origin: https://github.com/apache/brooklyn
-services:
- - type: org.apache.brooklyn.core.test.entity.TestEntity
- id: testentityone
- name: "Test Entity One"
- brooklyn.config:
- testentityone.id: $brooklyn:identity()
- testentitytwo.id: $brooklyn:entity("testentitytwo").identity()
- - type: org.apache.brooklyn.core.test.entity.TestEntity
- id: testentitytwo
- name: "test Entity Two"
[3/3] brooklyn-server git commit: This closes #219
Posted by gr...@apache.org.
This closes #219
* github/pr/219:
Change DSL method to entityId from identity
Added identity method to DSL
Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo
Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/586795b3
Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/586795b3
Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/586795b3
Branch: refs/heads/master
Commit: 586795b327576ceeded65f760828da1d51b9257d
Parents: a941963 d91d420
Author: Andrew Donald Kennedy <an...@cloudsoftcorp.com>
Authored: Mon Jul 4 10:33:14 2016 +0100
Committer: Andrew Donald Kennedy <an...@cloudsoftcorp.com>
Committed: Mon Jul 4 10:33:14 2016 +0100
----------------------------------------------------------------------
.../spi/dsl/methods/BrooklynDslCommon.java | 4 +
.../brooklyn/spi/dsl/methods/DslComponent.java | 101 +++++++++++++------
.../camp/brooklyn/IdentityYamlTest.java | 82 +++++++++++++++
3 files changed, 155 insertions(+), 32 deletions(-)
----------------------------------------------------------------------