brooklyn-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From s...@apache.org
Subject [2/6] brooklyn-server git commit: Fix SpecParameterUnwrappingTest
Date Wed, 16 Nov 2016 06:44:17 GMT
Fix SpecParameterUnwrappingTest

The number of default config keys on app had changed, breaking the tests.

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

Branch: refs/heads/master
Commit: 838c5554329cc725dc26652051491f4b32a2284a
Parents: b968d7f
Author: Aled Sage <aled.sage@gmail.com>
Authored: Tue Nov 8 23:49:04 2016 +0000
Committer: Aled Sage <aled.sage@gmail.com>
Committed: Mon Nov 14 11:09:54 2016 +0000

----------------------------------------------------------------------
 .../catalog/SpecParameterUnwrappingTest.java    | 30 ++++++++++++--------
 1 file changed, 18 insertions(+), 12 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/838c5554/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/SpecParameterUnwrappingTest.java
----------------------------------------------------------------------
diff --git a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/SpecParameterUnwrappingTest.java
b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/SpecParameterUnwrappingTest.java
index 4bbf137..5f74f9e 100644
--- a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/SpecParameterUnwrappingTest.java
+++ b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/SpecParameterUnwrappingTest.java
@@ -61,6 +61,11 @@ import org.apache.brooklyn.entity.stock.BasicApplication;
 import org.apache.brooklyn.entity.stock.BasicStartable;
 
 public class SpecParameterUnwrappingTest extends AbstractYamlTest {
+    
+    // Expect app to have the following config keys already: 
+    // "application.stop.shouldDestroy", "defaultDisplayName", "quorum.running", "quorum.up",
"start.latch"
+    private static final int NUM_APP_DEFAULT_CONFIG_KEYS = 5;
+    
     private static final String SYMBOLIC_NAME = "my.catalog.app.id.load";
 
     private static final ConfigKey<String> SHARED_CONFIG = ConfigKeys.newStringConfigKey("sample.config");
@@ -141,7 +146,7 @@ public class SpecParameterUnwrappingTest extends AbstractYamlTest {
         CatalogItem<?, ?> item = catalog.getCatalogItem(SYMBOLIC_NAME, TEST_VERSION);
         AbstractBrooklynObjectSpec<?,?> spec = createSpec(item);
         List<SpecParameter<?>> params = spec.getParameters();
-        assertEquals(params.size(), 4);
+        assertEquals(params.size(), NUM_APP_DEFAULT_CONFIG_KEYS + 1, "params="+params);
         assertTrue(Iterables.tryFind(params, nameEqualTo("simple")).isPresent());
     }
 
@@ -356,7 +361,7 @@ public class SpecParameterUnwrappingTest extends AbstractYamlTest {
         EntitySpec<?> parentSpec = (EntitySpec<?>) catalog.createSpec((CatalogItem)item);
         EntitySpec<?> spec = parentSpec.getChildren().get(0);
         List<SpecParameter<?>> params = spec.getParameters();
-        assertEquals(params.size(), 3);
+        assertEquals(params.size(), 3, "params="+params);
         assertTrue(Iterables.tryFind(params, nameEqualTo("simple")).isPresent());
         assertTrue(Iterables.tryFind(params, labelEqualTo("simple")).isPresent());
     }
@@ -377,7 +382,7 @@ public class SpecParameterUnwrappingTest extends AbstractYamlTest {
                 "services:",
                 "- type: " + ver(SYMBOLIC_NAME));
         List<SpecParameter<?>> params = spec.getParameters();
-        assertEquals(params.size(), 4);
+        assertEquals(params.size(), NUM_APP_DEFAULT_CONFIG_KEYS + 1, "params="+params);
         assertTrue(Iterables.tryFind(params, nameEqualTo("simple")).isPresent());
         assertTrue(Iterables.tryFind(params, labelEqualTo("simple")).isPresent());
     }
@@ -399,7 +404,7 @@ public class SpecParameterUnwrappingTest extends AbstractYamlTest {
                 "services:",
                 "- type: " + ver(SYMBOLIC_NAME));
         List<SpecParameter<?>> params = spec.getParameters();
-        assertEquals(params.size(), 4);
+        assertEquals(params.size(), NUM_APP_DEFAULT_CONFIG_KEYS + 1, "params="+params);
         assertTrue(Iterables.tryFind(params, nameEqualTo("simple")).isPresent());
         assertTrue(Iterables.tryFind(params, labelEqualTo("simple")).isPresent());
     }
@@ -421,7 +426,7 @@ public class SpecParameterUnwrappingTest extends AbstractYamlTest {
                 "services:",
                 "- type: " + ver(SYMBOLIC_NAME));
         List<SpecParameter<?>> params = spec.getParameters();
-        assertEquals(params.size(), 4);
+        assertEquals(params.size(), NUM_APP_DEFAULT_CONFIG_KEYS + 1, "params="+params);
         assertTrue(Iterables.tryFind(params, nameEqualTo("simple")).isPresent());
         assertTrue(Iterables.tryFind(params, labelEqualTo("simple")).isPresent());
     }
@@ -448,7 +453,7 @@ public class SpecParameterUnwrappingTest extends AbstractYamlTest {
                 "services:",
                 "- type: " + ver(SYMBOLIC_NAME));
         List<SpecParameter<?>> params = spec.getParameters();
-        assertEquals(params.size(), 4, "Wrong number of params: "+params); // sample + defaultDisplayName
+ destroy_on_stop + start.latch
+        assertEquals(params.size(), NUM_APP_DEFAULT_CONFIG_KEYS + 1, "params="+params);
         assertEquals(ImmutableSet.copyOf(params), ImmutableSet.copyOf(BasicSpecParameter.fromClass(mgmt(),
ConfigAppForTest.class)));
     }
 
@@ -571,9 +576,10 @@ public class SpecParameterUnwrappingTest extends AbstractYamlTest {
                 "- simple",
                 "services:",
                 "- type: " + BasicApplication.class.getName());
-        List<SpecParameter<?>> inputs = spec.getParameters();
-        assertEquals(inputs.size(), 4);
-        SpecParameter<?> firstInput = inputs.get(0);
+        List<SpecParameter<?>> params = spec.getParameters();
+        assertEquals(params.size(), NUM_APP_DEFAULT_CONFIG_KEYS + 1, "params="+params);
+
+        SpecParameter<?> firstInput = params.get(0);
         assertEquals(firstInput.getLabel(), "simple");
     }
 
@@ -584,9 +590,9 @@ public class SpecParameterUnwrappingTest extends AbstractYamlTest {
                 "- type: " + BasicApplication.class.getName(),
                 "  brooklyn.parameters:",
                 "  - simple");
-        List<SpecParameter<?>> inputs = spec.getParameters();
-        assertEquals(inputs.size(), 4);
-        SpecParameter<?> firstInput = inputs.get(0);
+        List<SpecParameter<?>> params = spec.getParameters();
+        assertEquals(params.size(), NUM_APP_DEFAULT_CONFIG_KEYS + 1, "params="+params);
+        SpecParameter<?> firstInput = params.get(0);
         assertEquals(firstInput.getLabel(), "simple");
     }
 


Mime
View raw message