You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by al...@apache.org on 2018/01/18 09:06:29 UTC

[2/4] brooklyn-server git commit: fix tests (deprecate/delete both the RT and the item)

fix tests (deprecate/delete both the RT and the item)


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

Branch: refs/heads/master
Commit: 1f734a854b807dac1c9a4b87b420f886f412ab7d
Parents: 8bcf0cb
Author: Alex Heneveld <al...@cloudsoftcorp.com>
Authored: Mon Jan 15 15:58:46 2018 +0000
Committer: Alex Heneveld <al...@cloudsoftcorp.com>
Committed: Mon Jan 15 15:58:46 2018 +0000

----------------------------------------------------------------------
 .../core/catalog/internal/CatalogUtils.java     | 20 ++++++++++++--------
 1 file changed, 12 insertions(+), 8 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/1f734a85/core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogUtils.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogUtils.java b/core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogUtils.java
index f9f68e4..a25e19d 100644
--- a/core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogUtils.java
+++ b/core/src/main/java/org/apache/brooklyn/core/catalog/internal/CatalogUtils.java
@@ -346,11 +346,13 @@ public class CatalogUtils {
         if (item!=null) {
             item.setDeprecated(newValue);
             mgmt.getCatalog().persist(item);
+        }
+        RegisteredType type = mgmt.getTypeRegistry().get(symbolicName, version);
+        if (type!=null) {
+            // won't be persisted
+            RegisteredTypes.setDeprecated(type, newValue);
         } else {
-            RegisteredType type = mgmt.getTypeRegistry().get(symbolicName, version);
-            if (type!=null) {
-                RegisteredTypes.setDeprecated(type, newValue);
-            } else {
+            if (item==null) {
                 throw new NoSuchElementException(symbolicName+":"+version);
             }
         }
@@ -363,11 +365,13 @@ public class CatalogUtils {
         if (item!=null) {
             item.setDisabled(newValue);
             mgmt.getCatalog().persist(item);
+        }
+        RegisteredType type = mgmt.getTypeRegistry().get(symbolicName, version);
+        if (type!=null) {
+            // won't be persisted
+            RegisteredTypes.setDisabled(type, newValue);
         } else {
-            RegisteredType type = mgmt.getTypeRegistry().get(symbolicName, version);
-            if (type!=null) {
-                RegisteredTypes.setDisabled(type, newValue);
-            } else {
+            if (item==null) {
                 throw new NoSuchElementException(symbolicName+":"+version);
             }
         }