brooklyn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject [1/3] brooklyn-server git commit: Set properties of target entity for use in tests
Date Mon, 25 Jul 2016 08:20:43 GMT
Repository: brooklyn-server
Updated Branches:
  refs/heads/master 9077ade06 -> 840150c53


Set properties of target entity for use in tests


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

Branch: refs/heads/master
Commit: 9a31d8ac76ea3df9df5233a2a68a1df8aa89a719
Parents: fad2435
Author: Andrew Donald Kennedy <andrew.kennedy@cloudsoftcorp.com>
Authored: Mon Jul 18 13:26:32 2016 +0100
Committer: Andrew Donald Kennedy <andrew.kennedy@cloudsoftcorp.com>
Committed: Thu Jul 21 10:52:12 2016 +0100

----------------------------------------------------------------------
 .../brooklyn/test/framework/TargetableTestComponent.java       | 6 ++++++
 .../brooklyn/test/framework/TargetableTestComponentImpl.java   | 3 +++
 2 files changed, 9 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/9a31d8ac/test-framework/src/main/java/org/apache/brooklyn/test/framework/TargetableTestComponent.java
----------------------------------------------------------------------
diff --git a/test-framework/src/main/java/org/apache/brooklyn/test/framework/TargetableTestComponent.java
b/test-framework/src/main/java/org/apache/brooklyn/test/framework/TargetableTestComponent.java
index 7280ef1..70edfbe 100644
--- a/test-framework/src/main/java/org/apache/brooklyn/test/framework/TargetableTestComponent.java
+++ b/test-framework/src/main/java/org/apache/brooklyn/test/framework/TargetableTestComponent.java
@@ -20,10 +20,12 @@ package org.apache.brooklyn.test.framework;
 
 import org.apache.brooklyn.api.entity.Entity;
 import org.apache.brooklyn.api.entity.ImplementedBy;
+import org.apache.brooklyn.api.sensor.AttributeSensor;
 import org.apache.brooklyn.config.ConfigKey;
 import org.apache.brooklyn.core.config.ConfigKeys;
 import org.apache.brooklyn.core.entity.trait.Startable;
 import org.apache.brooklyn.core.sensor.AttributeSensorAndConfigKey;
+import org.apache.brooklyn.core.sensor.Sensors;
 import org.apache.brooklyn.util.time.Duration;
 
 /**
@@ -55,6 +57,10 @@ public interface TargetableTestComponent extends Entity, Startable {
             "Time to wait for targetId to exist (defaults to zero, i.e. must exist immediately)",
             Duration.ZERO);
 
+    AttributeSensor<String> TARGET_ENTITY_ID = Sensors.newStringSensor("test.target.entity.id",
"Id of the target entity");
+    AttributeSensor<String> TARGET_ENTITY_NAME = Sensors.newStringSensor("test.target.entity.name",
"Display name of the target entity");
+    AttributeSensor<String> TARGET_ENTITY_TYPE = Sensors.newStringSensor("test.target.entity.type",
"Type of the target entity");
+
     /**
      * Get the target of the test.
      *

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/9a31d8ac/test-framework/src/main/java/org/apache/brooklyn/test/framework/TargetableTestComponentImpl.java
----------------------------------------------------------------------
diff --git a/test-framework/src/main/java/org/apache/brooklyn/test/framework/TargetableTestComponentImpl.java
b/test-framework/src/main/java/org/apache/brooklyn/test/framework/TargetableTestComponentImpl.java
index 0d59507..9e279a2 100644
--- a/test-framework/src/main/java/org/apache/brooklyn/test/framework/TargetableTestComponentImpl.java
+++ b/test-framework/src/main/java/org/apache/brooklyn/test/framework/TargetableTestComponentImpl.java
@@ -56,6 +56,9 @@ public abstract class TargetableTestComponentImpl extends AbstractEntity
impleme
     public Entity resolveTarget() {
         Entity target = resolveTarget(getExecutionContext(), this);
         sensors().set(TARGET_ENTITY, target);
+        sensors().set(TARGET_ENTITY_ID, target.getId());
+        sensors().set(TARGET_ENTITY_NAME, target.getDisplayName());
+        sensors().set(TARGET_ENTITY_TYPE, target.getEntityType().getName());
         return target;
     }
 


Mime
View raw message