brooklyn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From henev...@apache.org
Subject [04/18] incubator-brooklyn git commit: Catalog versioning - Using AssemblyTemplate.getName() for getting catalog items is wrong.
Date Thu, 13 Nov 2014 22:23:37 GMT
Catalog versioning - Using AssemblyTemplate.getName() for getting catalog items is wrong.

Catalog items are registered by id+version in the brooklyn.config section,
the name is unrelated which means that the items were never found.
The code path in BrooklynEntityMatcher is not needed anyway, already
handled by the instantiator.


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

Branch: refs/heads/master
Commit: 53809f3d29790cda11e4efd9ee951a963057d4a5
Parents: 268aaf6
Author: Svetoslav Neykov <svetoslav.neykov@cloudsoftcorp.com>
Authored: Thu Jul 24 12:29:31 2014 +0300
Committer: Svetoslav Neykov <svetoslav.neykov@cloudsoftcorp.com>
Committed: Thu Nov 13 11:49:49 2014 +0200

----------------------------------------------------------------------
 .../brooklyn/spi/creation/BrooklynEntityMatcher.java     |  5 -----
 .../camp/brooklyn/catalog/CatalogYamlEntityTest.java     | 11 +++++++++++
 2 files changed, 11 insertions(+), 5 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/53809f3d/usage/camp/src/main/java/io/brooklyn/camp/brooklyn/spi/creation/BrooklynEntityMatcher.java
----------------------------------------------------------------------
diff --git a/usage/camp/src/main/java/io/brooklyn/camp/brooklyn/spi/creation/BrooklynEntityMatcher.java
b/usage/camp/src/main/java/io/brooklyn/camp/brooklyn/spi/creation/BrooklynEntityMatcher.java
index 54bd4a6..db64c0c 100644
--- a/usage/camp/src/main/java/io/brooklyn/camp/brooklyn/spi/creation/BrooklynEntityMatcher.java
+++ b/usage/camp/src/main/java/io/brooklyn/camp/brooklyn/spi/creation/BrooklynEntityMatcher.java
@@ -68,11 +68,6 @@ public class BrooklynEntityMatcher implements PdpMatcher {
     protected String lookupType(Object deploymentPlanItem) {
         if (deploymentPlanItem instanceof Service) {
             Service service = (Service)deploymentPlanItem;
-            
-            String name = service.getName();
-            if (mgmt.getCatalog().getCatalogItem(name) != null) {
-                return name;
-            }
 
             String serviceType = service.getServiceType();
             BrooklynClassLoadingContext loader = BasicBrooklynCatalog.BrooklynLoaderTracker.getLoader();

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/53809f3d/usage/camp/src/test/java/io/brooklyn/camp/brooklyn/catalog/CatalogYamlEntityTest.java
----------------------------------------------------------------------
diff --git a/usage/camp/src/test/java/io/brooklyn/camp/brooklyn/catalog/CatalogYamlEntityTest.java
b/usage/camp/src/test/java/io/brooklyn/camp/brooklyn/catalog/CatalogYamlEntityTest.java
index f5ad95c..dc51569 100644
--- a/usage/camp/src/test/java/io/brooklyn/camp/brooklyn/catalog/CatalogYamlEntityTest.java
+++ b/usage/camp/src/test/java/io/brooklyn/camp/brooklyn/catalog/CatalogYamlEntityTest.java
@@ -28,6 +28,7 @@ import java.util.Collection;
 import org.junit.Assert;
 import org.testng.annotations.Test;
 
+import brooklyn.catalog.BrooklynCatalog;
 import brooklyn.catalog.CatalogItem;
 import brooklyn.entity.Entity;
 import brooklyn.entity.basic.BasicEntity;
@@ -307,6 +308,16 @@ public class CatalogYamlEntityTest extends AbstractYamlTest {
         }
     }
 
+    @Test
+    public void testCreateSpecFromCatalogItem() {
+        String id = "my.catalog.app.id.create_spec";
+        addCatalogOSGiEntity(id);
+        BrooklynCatalog catalog = mgmt().getCatalog();
+        CatalogItem<?, ?> item = catalog.getCatalogItem(id, TEST_VERSION);
+        Object spec = catalog.createSpec(item);
+        Assert.assertNotNull(spec);
+    }
+
     private void registerAndLaunchAndAssertSimpleEntity(String registeredTypeName, String
serviceType) throws Exception {
         addCatalogOSGiEntity(registeredTypeName, serviceType);
         String yaml = "name: simple-app-yaml\n" +


Mime
View raw message