This is an automated email from the ASF dual-hosted git repository.

heneveld pushed a commit to branch master
in repository https://gitbox.apache.org/repos/asf/brooklyn-server.git

commit 329ef405c4d646ac1dc5ff80e71b46722724cd90
Author: Alex Heneveld <[email protected]>
AuthorDate: Thu Oct 1 13:40:27 2020 +0100

    add failing osgi bean load test, and new-syntax loop detection test, plus 
some misc code tidies
---
 .../brooklyn/CustomTypeConfigYamlOsgiTest.java     | 49 ++++++++++++++++++++++
 .../camp/brooklyn/CustomTypeConfigYamlTest.java    |  8 ++--
 .../catalog/CatalogOsgiYamlEntityTest.java         |  6 +--
 .../brooklyn/catalog/CatalogYamlEntityTest.java    | 23 ++++++++++
 4 files changed, 79 insertions(+), 7 deletions(-)

diff --git 
a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/CustomTypeConfigYamlOsgiTest.java
 
b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/CustomTypeConfigYamlOsgiTest.java
new file mode 100644
index 0000000..b118aa1
--- /dev/null
+++ 
b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/CustomTypeConfigYamlOsgiTest.java
@@ -0,0 +1,49 @@
+/*
+ * 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 org.apache.brooklyn.camp.brooklyn;
+
+import java.util.Map;
+import org.apache.brooklyn.api.entity.Entity;
+import org.apache.brooklyn.api.typereg.BrooklynTypeRegistry.RegisteredTypeKind;
+import org.apache.brooklyn.api.typereg.RegisteredType;
+import org.apache.brooklyn.config.ConfigKey;
+import org.apache.brooklyn.core.config.ConfigKeys;
+import org.apache.brooklyn.core.entity.Dumper;
+import org.apache.brooklyn.core.resolve.jackson.BeanWithTypePlanTransformer;
+import org.apache.brooklyn.core.test.entity.TestEntity;
+import org.apache.brooklyn.core.typereg.BasicBrooklynTypeRegistry;
+import org.apache.brooklyn.core.typereg.BasicTypeImplementationPlan;
+import org.apache.brooklyn.core.typereg.JavaClassNameTypePlanTransformer;
+import org.apache.brooklyn.core.typereg.RegisteredTypes;
+import org.apache.brooklyn.test.Asserts;
+import org.apache.brooklyn.util.text.Strings;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+import org.testng.Assert;
+import org.testng.annotations.Test;
+
+@Test
+public class CustomTypeConfigYamlOsgiTest extends CustomTypeConfigYamlTest {
+    private static final Logger log = 
LoggerFactory.getLogger(CustomTypeConfigYamlOsgiTest.class);
+
+    @Override
+    protected boolean disableOsgi() {
+        return false;
+    }
+}
diff --git 
a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/CustomTypeConfigYamlTest.java
 
b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/CustomTypeConfigYamlTest.java
index 0b83a34..71064b2 100644
--- 
a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/CustomTypeConfigYamlTest.java
+++ 
b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/CustomTypeConfigYamlTest.java
@@ -154,8 +154,8 @@ public class CustomTypeConfigYamlTest extends 
AbstractYamlTest {
                 "  version: "+TEST_VERSION,
                 "  items:",
                 "  - id: custom-type",
-//                "    itemType: bean",   // optional
-                "    format: bean-with-type",
+//                "    itemType: bean",             // optional
+//                "    format: bean-with-type",     // optional
                 "    item:",
                 "      type: 
"+CustomTypeConfigYamlTest.TestingCustomType.class.getName(),
                 "      x: unfoo",
@@ -194,8 +194,8 @@ public class CustomTypeConfigYamlTest extends 
AbstractYamlTest {
                             "  version: " + TEST_VERSION,
                             "  items:",
                             "  - id: custom-type",
-//                            "    itemType: bean",   // optional
-                            "    format: bean-with-type",
+                            "    itemType: bean",         // optional - but 
force it here
+                            "    format: bean-with-type", // optional - but 
force it here
                             "    item:",
                             "      type: " + 
CustomTypeConfigYamlTest.TestingCustomType.class.getName(),
                             "      x: {}");
diff --git 
a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogOsgiYamlEntityTest.java
 
b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogOsgiYamlEntityTest.java
index 90ed525..c88bc46 100644
--- 
a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogOsgiYamlEntityTest.java
+++ 
b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogOsgiYamlEntityTest.java
@@ -52,15 +52,15 @@ import com.google.common.collect.Iterables;
 
 public class CatalogOsgiYamlEntityTest extends AbstractYamlTest {
     
-    // Some of these testes duplicate several of the non-osgi test. However, 
that is important 
+    // Some of these tests duplicate several of the non-osgi test. However, 
that is important 
     // because there are subtleties of which OSGi bundles a catalog item will 
use for loading,
     // particularly when nesting and/or sub-typing entities.
     //
     // The non-osgi tests are much faster to run!
 
     private static final String SIMPLE_ENTITY_TYPE = 
OsgiTestResources.BROOKLYN_TEST_OSGI_ENTITIES_SIMPLE_ENTITY;
-   private static final String MORE_ENTITIES_POM_PROPERTIES_PATH =
-      
"META-INF/maven/org.apache.brooklyn.test.resources.osgi/brooklyn-test-osgi-more-entities/pom.properties";
+    private static final String MORE_ENTITIES_POM_PROPERTIES_PATH =
+        
"META-INF/maven/org.apache.brooklyn.test.resources.osgi/brooklyn-test-osgi-more-entities/pom.properties";
 
     @Override
     protected boolean disableOsgi() {
diff --git 
a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogYamlEntityTest.java
 
b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogYamlEntityTest.java
index 4b33c6a..12edf35 100644
--- 
a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogYamlEntityTest.java
+++ 
b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogYamlEntityTest.java
@@ -19,6 +19,7 @@
 package org.apache.brooklyn.camp.brooklyn.catalog;
 
 import static com.google.common.base.Preconditions.checkNotNull;
+import com.google.common.base.Throwables;
 import java.util.Collection;
 import static org.testng.Assert.assertEquals;
 import static org.testng.Assert.assertNotNull;
@@ -381,6 +382,28 @@ public class CatalogYamlEntityTest extends 
AbstractYamlTest {
             Asserts.shouldHaveFailedPreviously();
         } catch (Exception e) {
             Asserts.expectedFailureContains(e, referrerSymbolicName);
+            
Asserts.assertStringDoesNotContain(Throwables.getStackTraceAsString(e), 
"StackOverflow");
+        }
+    }
+
+    @Test(groups="WIP")
+    public void testLaunchApplicationChildLoopCatalogIdFailsWithNewSyntax() 
throws Exception {
+        String referrerSymbolicName = "my.catalog.app.id.child.referring";
+        try {
+            // TODO previous test using 'services' fails nicely, but this 
doesn't; it throws an SO exception, doesn't see the cyclic dependency
+            addCatalogItems(
+                    "brooklyn.catalog:",
+                    "  id: " + referrerSymbolicName,
+                    "  version: " + TEST_VERSION,
+                    "  itemType: entity",
+                    "  item:",
+                    "      type: " + BasicEntity.class.getName(),
+                    "      brooklyn.children:",
+                    "      - type: " + ver(referrerSymbolicName, 
TEST_VERSION));
+            Asserts.shouldHaveFailedPreviously();
+        } catch (Exception e) {
+            Asserts.expectedFailureContains(e, referrerSymbolicName);
+            
Asserts.assertStringDoesNotContain(Throwables.getStackTraceAsString(e), 
"StackOverflow");
         }
     }
 

Reply via email to