brooklyn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From grk...@apache.org
Subject [2/6] brooklyn-server git commit: Allow snapshot catalog items to be updated
Date Mon, 06 Jun 2016 14:27:47 GMT
Allow snapshot catalog items to be updated


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

Branch: refs/heads/master
Commit: 4628803752657d43a0e904668ce5aae721c4f678
Parents: 784e18f
Author: Svetoslav Neykov <svetoslav.neykov@cloudsoftcorp.com>
Authored: Thu Jun 2 18:30:23 2016 +0300
Committer: Svetoslav Neykov <svetoslav.neykov@cloudsoftcorp.com>
Committed: Thu Jun 2 18:30:23 2016 +0300

----------------------------------------------------------------------
 .../brooklyn/catalog/CatalogYamlVersioningTest.java     | 12 ++++++++++++
 .../core/catalog/internal/BasicBrooklynCatalog.java     |  2 ++
 2 files changed, 14 insertions(+)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/46288037/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogYamlVersioningTest.java
----------------------------------------------------------------------
diff --git a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogYamlVersioningTest.java
b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogYamlVersioningTest.java
index 36d3739..e740383 100644
--- a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogYamlVersioningTest.java
+++ b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogYamlVersioningTest.java
@@ -80,6 +80,18 @@ public class CatalogYamlVersioningTest extends AbstractYamlTest {
     }
     
     @Test
+    public void testAddSameSnapshotVersionSucceedsWhenIconIsDifferent() {
+        String symbolicName = "sampleId";
+        String version = "0.1.0-SNAPSHOT";
+        addCatalogEntity(symbolicName, version);
+        String icon = "classpath:/another/icon.png";
+        addCatalogEntity(symbolicName, version, BasicEntity.class.getName(), icon);
+        assertSingleCatalogItem(symbolicName, version);
+        RegisteredType item = types.get(symbolicName, version);
+        assertTrue(item.getIconUrl().equals(icon), "Unexpected iconUrl: " + item.getIconUrl());
+    }
+    
+    @Test
     public void testAddSameVersionForce() {
         String symbolicName = "sampleId";
         String version = "0.1.0";

http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/46288037/core/src/main/java/org/apache/brooklyn/core/catalog/internal/BasicBrooklynCatalog.java
----------------------------------------------------------------------
diff --git a/core/src/main/java/org/apache/brooklyn/core/catalog/internal/BasicBrooklynCatalog.java
b/core/src/main/java/org/apache/brooklyn/core/catalog/internal/BasicBrooklynCatalog.java
index 3587976..c4a2a50 100644
--- a/core/src/main/java/org/apache/brooklyn/core/catalog/internal/BasicBrooklynCatalog.java
+++ b/core/src/main/java/org/apache/brooklyn/core/catalog/internal/BasicBrooklynCatalog.java
@@ -965,6 +965,8 @@ public class BasicBrooklynCatalog implements BrooklynCatalog {
      * throwing if item cannot be added */
     private CatalogItem<?, ?> checkItemAllowedAndIfSoReturnAnyDuplicate(CatalogItem<?,?>
itemDto, boolean allowDuplicates, boolean forceUpdate) {
         if (forceUpdate) return null;
+        // Can update same snapshot version - very useful while developing blueprints
+        if (itemDto.getVersion().contains("SNAPSHOT")) return null;
         CatalogItemDo<?, ?> existingItem = getCatalogItemDo(itemDto.getSymbolicName(),
itemDto.getVersion());
         if (existingItem == null) return null;
         // check if they are equal


Mime
View raw message