brooklyn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From aleds...@apache.org
Subject [4/5] incubator-brooklyn git commit: BROOKLYN-149: incorporate more review comments
Date Tue, 09 Jun 2015 15:49:43 GMT
BROOKLYN-149: incorporate more review comments


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

Branch: refs/heads/master
Commit: 636afe611654676f7b5884f1c5399c11e5971032
Parents: bfe52d4
Author: Aled Sage <aled.sage@gmail.com>
Authored: Mon Jun 8 21:38:09 2015 +0100
Committer: Aled Sage <aled.sage@gmail.com>
Committed: Mon Jun 8 21:41:57 2015 +0100

----------------------------------------------------------------------
 .../brooklyn/entity/rebind/RebindIteration.java | 53 ++++++--------------
 .../camp/brooklyn/AbstractYamlRebindTest.java   | 18 +++++++
 .../brooklyn/catalog/CatalogYamlRebindTest.java | 18 +++++++
 3 files changed, 50 insertions(+), 39 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/636afe61/core/src/main/java/brooklyn/entity/rebind/RebindIteration.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/brooklyn/entity/rebind/RebindIteration.java b/core/src/main/java/brooklyn/entity/rebind/RebindIteration.java
index 8c606ff..89c125a 100644
--- a/core/src/main/java/brooklyn/entity/rebind/RebindIteration.java
+++ b/core/src/main/java/brooklyn/entity/rebind/RebindIteration.java
@@ -924,18 +924,20 @@ public abstract class RebindIteration {
             
             if (catalogItemId != null) {
                 CatalogItem<?, ?> catalogItem = rebindContext.lookup().lookupCatalogItem(catalogItemId);
-                if (catalogItem == null && BrooklynFeatureEnablement.isEnabled(BrooklynFeatureEnablement.FEATURE_AUTO_FIX_CATALOG_REF_ON_REBIND))
{
-                    // See https://issues.apache.org/jira/browse/BROOKLYN-149
-                    // This is a dangling reference to the catalog item (which will have
been logged by lookupCatalogItem).
-                    // Try loading as any version.
-                    if (CatalogUtils.looksLikeVersionedId(catalogItemId)) {
-                        String symbolicName = CatalogUtils.getIdFromVersionedId(catalogItemId);
-                        catalogItem = rebindContext.lookup().lookupCatalogItem(symbolicName);
-                        
-                        if (catalogItem != null) {
-                            LOG.warn("Unable to load catalog item "+catalogItemId+" for "+contextSuchAsId
-                                    +" ("+bType.getSimpleName()+"); will auto-upgrade to
"+catalogItem.getCatalogItemId());
-                            catalogItemId = catalogItem.getCatalogItemId();
+                if (catalogItem == null) {
+                    if (BrooklynFeatureEnablement.isEnabled(BrooklynFeatureEnablement.FEATURE_AUTO_FIX_CATALOG_REF_ON_REBIND))
{
+                        // See https://issues.apache.org/jira/browse/BROOKLYN-149
+                        // This is a dangling reference to the catalog item (which will have
been logged by lookupCatalogItem).
+                        // Try loading as any version.
+                        if (CatalogUtils.looksLikeVersionedId(catalogItemId)) {
+                            String symbolicName = CatalogUtils.getIdFromVersionedId(catalogItemId);
+                            catalogItem = rebindContext.lookup().lookupCatalogItem(symbolicName);
+                            
+                            if (catalogItem != null) {
+                                LOG.warn("Unable to load catalog item "+catalogItemId+" for
"+contextSuchAsId
+                                        +" ("+bType.getSimpleName()+"); will auto-upgrade
to "+catalogItem.getCatalogItemId());
+                                catalogItemId = catalogItem.getCatalogItemId();
+                            }
                         }
                     }
                 }
@@ -973,33 +975,6 @@ public abstract class RebindIteration {
             }
         }
 
-        @SuppressWarnings("unchecked")
-        protected String transformCatalogId(Class<?> bType, String jType, String catalogItemId,
String contextSuchAsId) {
-            if (catalogItemId != null) {
-                CatalogItem<?, ?> catalogItem = rebindContext.lookup().lookupCatalogItem(catalogItemId);
-                if (catalogItem == null && BrooklynFeatureEnablement.isEnabled(BrooklynFeatureEnablement.FEATURE_AUTO_FIX_CATALOG_REF_ON_REBIND))
{
-                    // See https://issues.apache.org/jira/browse/BROOKLYN-149
-                    // This is a dangling reference to the catalog item (which will have
been logged by lookupCatalogItem).
-                    // Try loading as any version.
-                    if (CatalogUtils.looksLikeVersionedId(catalogItemId)) {
-                        String symbolicName = CatalogUtils.getIdFromVersionedId(catalogItemId);
-                        catalogItem = rebindContext.lookup().lookupCatalogItem(symbolicName);
-                        
-                        if (catalogItem != null) {
-                            LOG.warn("Unable to load catalog item "+catalogItemId+" for "+contextSuchAsId
-                                    +" ("+bType.getSimpleName()+"); will auto-upgrade to
"+catalogItem.getCatalogItemId());
-                            catalogItemId = catalogItem.getCatalogItemId();
-                        } else {
-                            LOG.warn("Unable to load catalog item "+catalogItemId+" for "+contextSuchAsId
-                                    +" ("+bType.getSimpleName()+"); no alternative version
available");
-                        }
-                    }
-                }
-            }
-            
-            return catalogItemId;
-        }
-
         /**
          * Constructs a new location, passing to its constructor the location id and all
of memento.getFlags().
          */

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/636afe61/usage/camp/src/test/java/io/brooklyn/camp/brooklyn/AbstractYamlRebindTest.java
----------------------------------------------------------------------
diff --git a/usage/camp/src/test/java/io/brooklyn/camp/brooklyn/AbstractYamlRebindTest.java
b/usage/camp/src/test/java/io/brooklyn/camp/brooklyn/AbstractYamlRebindTest.java
index 6814c92..226ec67 100644
--- a/usage/camp/src/test/java/io/brooklyn/camp/brooklyn/AbstractYamlRebindTest.java
+++ b/usage/camp/src/test/java/io/brooklyn/camp/brooklyn/AbstractYamlRebindTest.java
@@ -1,3 +1,21 @@
+/*
+ * 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 io.brooklyn.camp.brooklyn;
 
 import io.brooklyn.camp.spi.Assembly;

http://git-wip-us.apache.org/repos/asf/incubator-brooklyn/blob/636afe61/usage/camp/src/test/java/io/brooklyn/camp/brooklyn/catalog/CatalogYamlRebindTest.java
----------------------------------------------------------------------
diff --git a/usage/camp/src/test/java/io/brooklyn/camp/brooklyn/catalog/CatalogYamlRebindTest.java
b/usage/camp/src/test/java/io/brooklyn/camp/brooklyn/catalog/CatalogYamlRebindTest.java
index 2562d5e..a5dde16 100644
--- a/usage/camp/src/test/java/io/brooklyn/camp/brooklyn/catalog/CatalogYamlRebindTest.java
+++ b/usage/camp/src/test/java/io/brooklyn/camp/brooklyn/catalog/CatalogYamlRebindTest.java
@@ -1,3 +1,21 @@
+/*
+ * 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 io.brooklyn.camp.brooklyn.catalog;
 
 import static org.testng.Assert.assertEquals;


Mime
View raw message