brooklyn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject [01/11] brooklyn-server git commit: failing test to illustrate osgi entity spec descendant rebind bug
Date Thu, 08 Jun 2017 09:37:35 GMT
Repository: brooklyn-server
Updated Branches:
  refs/heads/master 381b7e63f -> 42f1a5d82


failing test to illustrate osgi entity spec descendant rebind bug


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

Branch: refs/heads/master
Commit: a3d256d7ddf28f76bd6e0b00b0b17b446025752b
Parents: f3aa339
Author: Alex Heneveld <alex.heneveld@cloudsoftcorp.com>
Authored: Tue Jun 6 14:20:21 2017 +0100
Committer: Alex Heneveld <alex.heneveld@cloudsoftcorp.com>
Committed: Tue Jun 6 15:18:08 2017 +0100

----------------------------------------------------------------------
 .../CatalogOsgiVersionMoreEntityRebindTest.java | 50 ++++++++++++++++++++
 1 file changed, 50 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/a3d256d7/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogOsgiVersionMoreEntityRebindTest.java
----------------------------------------------------------------------
diff --git a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogOsgiVersionMoreEntityRebindTest.java
b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogOsgiVersionMoreEntityRebindTest.java
index d71142c..ac04cd5 100644
--- a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogOsgiVersionMoreEntityRebindTest.java
+++ b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogOsgiVersionMoreEntityRebindTest.java
@@ -24,6 +24,7 @@ import java.util.Map;
 
 import org.apache.brooklyn.api.effector.Effector;
 import org.apache.brooklyn.api.entity.Entity;
+import org.apache.brooklyn.api.entity.EntitySpec;
 import org.apache.brooklyn.api.location.Location;
 import org.apache.brooklyn.api.location.LocationSpec;
 import org.apache.brooklyn.api.policy.Policy;
@@ -31,12 +32,15 @@ import org.apache.brooklyn.api.typereg.ManagedBundle;
 import org.apache.brooklyn.api.typereg.RegisteredType;
 import org.apache.brooklyn.camp.brooklyn.AbstractYamlRebindTest;
 import org.apache.brooklyn.core.effector.Effectors;
+import org.apache.brooklyn.core.entity.Entities;
 import org.apache.brooklyn.core.entity.EntityInternal;
 import org.apache.brooklyn.core.entity.StartableApplication;
+import org.apache.brooklyn.core.entity.trait.Startable;
 import org.apache.brooklyn.core.mgmt.ha.OsgiBundleInstallationResult;
 import org.apache.brooklyn.core.mgmt.internal.ManagementContextInternal;
 import org.apache.brooklyn.core.mgmt.osgi.OsgiVersionMoreEntityTest;
 import org.apache.brooklyn.core.test.entity.TestEntity;
+import org.apache.brooklyn.entity.group.DynamicCluster;
 import org.apache.brooklyn.entity.stock.BasicApplication;
 import org.apache.brooklyn.test.Asserts;
 import org.apache.brooklyn.test.support.TestResourceUnavailableException;
@@ -52,6 +56,7 @@ import org.slf4j.LoggerFactory;
 import org.testng.Assert;
 import org.testng.annotations.Test;
 
+import com.google.common.base.Preconditions;
 import com.google.common.collect.ImmutableList;
 import com.google.common.collect.ImmutableMap;
 import com.google.common.collect.Iterables;
@@ -310,5 +315,50 @@ public class CatalogOsgiVersionMoreEntityRebindTest extends AbstractYamlRebindTe
             "HO ERIC FROM V2 EVIL TWIN");
     }
     
+    @Test
+    public void testClusterWithEntitySpecFromOsgi() throws Exception {
+        // install dependencies
+        ((ManagementContextInternal)mgmt()).getOsgiManager().get().install( 
+            new ResourceUtils(getClass()).getResourceFromUrl(BROOKLYN_TEST_OSGI_ENTITIES_URL)
).checkNoError();
+        ((ManagementContextInternal)mgmt()).getOsgiManager().get().install( 
+            new ResourceUtils(getClass()).getResourceFromUrl(BROOKLYN_TEST_MORE_ENTITIES_V2_URL)
).get();
+        
+        RegisteredType ci = Preconditions.checkNotNull( mgmt().getTypeRegistry().get(BROOKLYN_TEST_MORE_ENTITIES_MORE_ENTITY)
);
+        EntitySpec<DynamicCluster> clusterSpec = EntitySpec.create(DynamicCluster.class)
+            .configure(DynamicCluster.INITIAL_SIZE, 1)
+            .configure(DynamicCluster.MEMBER_SPEC, origManagementContext.getTypeRegistry().createSpec(ci,
null, EntitySpec.class));
+        
+        final Entity app = mgmt().getEntityManager().createEntity(EntitySpec.create(BasicApplication.class).child(clusterSpec));
+        app.invoke(Startable.START, MutableMap.of()).get();
+        
+        rebind();
+    }
+
+    @Test
+    public void testClusterWithEntitySpecDescendedFromOsgi() throws Exception {
+        // install dependencies
+        ((ManagementContextInternal)mgmt()).getOsgiManager().get().install( 
+            new ResourceUtils(getClass()).getResourceFromUrl(BROOKLYN_TEST_OSGI_ENTITIES_URL)
).checkNoError();
+        ((ManagementContextInternal)mgmt()).getOsgiManager().get().install( 
+            new ResourceUtils(getClass()).getResourceFromUrl(BROOKLYN_TEST_MORE_ENTITIES_V2_URL)
).get();
+        
+        addCatalogItems(
+            "brooklyn.catalog:",
+            "  id: wrapped-more-entity",
+            "  version: 1.0",
+            "  item:",
+            "    services:",
+            "    - type: " + BROOKLYN_TEST_MORE_ENTITIES_MORE_ENTITY);
+        
+        RegisteredType ci = Preconditions.checkNotNull( mgmt().getTypeRegistry().get("wrapped-more-entity")
);
+        EntitySpec<DynamicCluster> clusterSpec = EntitySpec.create(DynamicCluster.class)
+            .configure(DynamicCluster.INITIAL_SIZE, 1)
+            .configure(DynamicCluster.MEMBER_SPEC, origManagementContext.getTypeRegistry().createSpec(ci,
null, EntitySpec.class));
+        
+        final Entity app = mgmt().getEntityManager().createEntity(EntitySpec.create(BasicApplication.class).child(clusterSpec));
+        app.invoke(Startable.START, MutableMap.of()).get();
+        
+        rebind();
+    }
 
 }


Mime
View raw message