Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id 98360200C82 for ; Sat, 22 Apr 2017 00:55:25 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 96D8F160BB2; Fri, 21 Apr 2017 22:55:25 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id 9867D160B97 for ; Sat, 22 Apr 2017 00:55:24 +0200 (CEST) Received: (qmail 49928 invoked by uid 500); 21 Apr 2017 22:55:22 -0000 Mailing-List: contact commits-help@brooklyn.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@brooklyn.apache.org Delivered-To: mailing list commits@brooklyn.apache.org Received: (qmail 49325 invoked by uid 99); 21 Apr 2017 22:55:20 -0000 Received: from git1-us-west.apache.org (HELO git1-us-west.apache.org) (140.211.11.23) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 21 Apr 2017 22:55:20 +0000 Received: by git1-us-west.apache.org (ASF Mail Server at git1-us-west.apache.org, from userid 33) id D9CA2F49F6; Fri, 21 Apr 2017 22:55:20 +0000 (UTC) Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit From: heneveld@apache.org To: commits@brooklyn.apache.org Date: Fri, 21 Apr 2017 22:55:39 -0000 Message-Id: In-Reply-To: <9b085cf2e76f4919908bcc60c564e3fc@git.apache.org> References: <9b085cf2e76f4919908bcc60c564e3fc@git.apache.org> X-Mailer: ASF-Git Admin Mailer Subject: [20/39] brooklyn-server git commit: Fix tests after rebase with master archived-at: Fri, 21 Apr 2017 22:55:25 -0000 Fix tests after rebase with master Project: http://git-wip-us.apache.org/repos/asf/brooklyn-server/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-server/commit/c6094973 Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-server/tree/c6094973 Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-server/diff/c6094973 Branch: refs/heads/master Commit: c60949739d4eaa00ef2647d6aba920b449a5c95b Parents: 5c37de2 Author: Geoff Macartney Authored: Mon Feb 20 13:45:06 2017 +0000 Committer: Geoff Macartney Committed: Thu Apr 20 11:20:36 2017 +0100 ---------------------------------------------------------------------- .../catalog/CatalogOsgiYamlEntityTest.java | 112 +++++++++++++------ .../brooklyn/catalog/CatalogYamlEntityTest.java | 47 +------- .../rebind/RebindConfigInheritanceTest.java | 1 + 3 files changed, 78 insertions(+), 82 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/c6094973/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogOsgiYamlEntityTest.java ---------------------------------------------------------------------- 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 53b27f1..102f476 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 @@ -57,6 +57,8 @@ public class CatalogOsgiYamlEntityTest extends AbstractYamlTest { // 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"; @Override protected boolean disableOsgi() { @@ -743,43 +745,81 @@ public class CatalogOsgiYamlEntityTest extends AbstractYamlTest { deleteCatalogEntity(symbolicNameOuter); } - // The test is disabled as it fails. The entity will get assigned the outer-most catalog - // item which doesn't have the necessary libraries with visibility to the entity's classpath - // When loading resources from inside the entity then we will use the wrong BCLCS. A workaround - // has been implemented which explicitly adds the entity's class loader to the fallbacks. - @Test(groups="WIP") - public void testCatalogItemIdInReferencedItems() throws Exception { - TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_PATH); - - String symbolicNameInner = "my.catalog.app.id.inner"; - String symbolicNameOuter = "my.catalog.app.id.outer"; - addCatalogItems( - "brooklyn.catalog:", - " version: " + TEST_VERSION, - " items:", - " - id: " + symbolicNameInner, - " name: My Catalog App", - " description: My description", - " icon_url: classpath://path/to/myicon.jpg", - " libraries:", - " - url: " + OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_URL, - " item: " + SIMPLE_ENTITY_TYPE, - " - id: " + symbolicNameOuter, - " item: " + symbolicNameInner); - - String yaml = "name: " + symbolicNameOuter + "\n" + - "services: \n" + - " - serviceType: "+ver(symbolicNameOuter); - Entity app = createAndStartApplication(yaml); - Entity entity = app.getChildren().iterator().next(); - - // Fails - assertEquals(entity.getCatalogItemId(), ver(symbolicNameInner)); - - deleteCatalogEntity(symbolicNameInner); - deleteCatalogEntity(symbolicNameOuter); - } + @Test + public void testDeepCatalogItemCanLoadResources() throws Exception { + TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_PATH); + TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), OsgiStandaloneTest.BROOKLYN_TEST_OSGI_MORE_ENTITIES_0_1_0_PATH); + + String symbolicNameInner = "my.catalog.app.id.inner"; + String symbolicNameFiller = "my.catalog.app.id.filler"; + String symbolicNameOuter = "my.catalog.app.id.outer"; + addCatalogItems( + "brooklyn.catalog:", + " version: " + TEST_VERSION, + " items:", + " - id: " + symbolicNameInner, + " name: My Catalog App", + " brooklyn.libraries:", + " - url: " + OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_URL, + " item: " + SIMPLE_ENTITY_TYPE, + " - id: " + symbolicNameFiller, + " name: Filler App", + " brooklyn.libraries:", + " - url: " + OsgiStandaloneTest.BROOKLYN_TEST_OSGI_MORE_ENTITIES_0_1_0_URL, + " item: " + symbolicNameInner, + " - id: " + symbolicNameOuter, + " item: " + symbolicNameFiller); + + String yaml = "name: " + symbolicNameOuter + "\n" + + "services: \n" + + " - serviceType: "+ver(symbolicNameOuter); + Entity app = createAndStartApplication(yaml); + Entity entity = app.getChildren().iterator().next(); + + final String catalogBom = ResourceUtils.create(entity).getResourceAsString("classpath://" + MORE_ENTITIES_POM_PROPERTIES_PATH); + assertTrue(catalogBom.contains("artifactId=brooklyn-test-osgi-more-entities")); + + deleteCatalogEntity(symbolicNameOuter); + deleteCatalogEntity(symbolicNameFiller); + deleteCatalogEntity(symbolicNameInner); + } + + @Test + public void testCatalogItemIdInReferencedItems() throws Exception { + TestResourceUnavailableException.throwIfResourceUnavailable(getClass(), OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_PATH); + + String symbolicNameInner = "my.catalog.app.id.inner"; + String symbolicNameOuter = "my.catalog.app.id.outer"; + addCatalogItems( + "brooklyn.catalog:", + " version: " + TEST_VERSION, + " items:", + " - id: " + symbolicNameInner, + " name: My Catalog App", + " description: My description", + " icon_url: classpath://path/to/myicon.jpg", + " brooklyn.libraries:", + " - url: " + OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_URL, + " item: " + SIMPLE_ENTITY_TYPE, + " - id: " + symbolicNameOuter, + " item: " + symbolicNameInner); + + String yaml = "name: " + symbolicNameOuter + "\n" + + "services: \n" + + " - serviceType: "+ver(symbolicNameOuter); + + Entity app = createAndStartApplication(yaml); + + Entity entity = app.getChildren().iterator().next(); + assertEquals(entity.getCatalogItemId(), ver(symbolicNameOuter)); + assertEquals(entity.getCatalogItemSuperIds().size(), 2); + assertEquals(entity.getCatalogItemSuperIds().get(0), ver(symbolicNameOuter)); + assertEquals(entity.getCatalogItemSuperIds().get(1), ver(symbolicNameInner)); + + deleteCatalogEntity(symbolicNameInner); + deleteCatalogEntity(symbolicNameOuter); + } private void registerAndLaunchAndAssertSimpleEntity(String symbolicName, String serviceType) throws Exception { addCatalogOSGiEntity(symbolicName, serviceType); http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/c6094973/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogYamlEntityTest.java ---------------------------------------------------------------------- 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 cc26c22..d491860 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 @@ -18,9 +18,6 @@ */ package org.apache.brooklyn.camp.brooklyn.catalog; -import static org.apache.brooklyn.util.osgi.OsgiTestResources.BROOKLYN_TEST_OSGI_ENTITIES_MESSAGE_RESOURCE; -import static org.apache.commons.io.FileUtils.getFile; -import static org.apache.commons.io.FileUtils.readFileToString; import static com.google.common.base.Preconditions.checkNotNull; import static org.testng.Assert.assertEquals; import static org.testng.Assert.assertNotNull; @@ -37,20 +34,15 @@ import org.apache.brooklyn.camp.brooklyn.AbstractYamlTest; import org.apache.brooklyn.config.ConfigKey; import org.apache.brooklyn.core.catalog.internal.CatalogUtils; import org.apache.brooklyn.core.config.ConfigKeys; -import org.apache.brooklyn.core.entity.BrooklynConfigKeys; -import org.apache.brooklyn.core.mgmt.osgi.OsgiStandaloneTest; import org.apache.brooklyn.core.test.entity.TestEntity; import org.apache.brooklyn.core.test.entity.TestEntityImpl; import org.apache.brooklyn.core.typereg.RegisteredTypes; -import org.apache.brooklyn.entity.software.base.SoftwareProcess; -import org.apache.brooklyn.entity.software.base.VanillaSoftwareProcess; +import org.apache.brooklyn.entity.software.base.EmptySoftwareProcess; import org.apache.brooklyn.entity.stock.BasicApplication; import org.apache.brooklyn.entity.stock.BasicEntity; -import org.apache.brooklyn.test.support.TestResourceUnavailableException; import org.apache.brooklyn.util.core.ResourceUtils; import org.apache.brooklyn.util.exceptions.Exceptions; import org.apache.brooklyn.util.osgi.OsgiTestResources; -import org.apache.commons.io.FileUtils; import org.testng.Assert; import org.testng.annotations.Test; @@ -632,43 +624,6 @@ public class CatalogYamlEntityTest extends AbstractYamlTest { mgmt().getCatalog().deleteCatalogItem(id, version); } - @Test - public void testDeepCatalogItemCanLoadResources() throws Exception { - - String symbolicNameInner = "my.catalog.app.id.inner"; - String symbolicNameFiller = "my.catalog.app.id.filler"; - String symbolicNameOuter = "my.catalog.app.id.outer"; - addCatalogItems( - "brooklyn.catalog:", - " version: " + TEST_VERSION, - " items:", - " - id: " + symbolicNameInner, - " name: My Catalog App", - " brooklyn.libraries:", - " - url: " + OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_URL, - " item: " + SIMPLE_ENTITY_TYPE, - " - id: " + symbolicNameFiller, - " name: Filler App", - " brooklyn.libraries:", - " - url: " + OsgiStandaloneTest.BROOKLYN_TEST_OSGI_MORE_ENTITIES_0_1_0_URL, - " item: " + symbolicNameInner, - " - id: " + symbolicNameOuter, - " item: " + symbolicNameFiller); - - String yaml = "name: " + symbolicNameOuter + "\n" + - "services: \n" + - " - serviceType: "+ver(symbolicNameOuter); - Entity app = createAndStartApplication(yaml); - Entity entity = app.getChildren().iterator().next(); - - final String catalogBom = ResourceUtils.create(entity).getResourceAsString("classpath://" + MORE_ENTITIES_POM_PROPERTIES_PATH); - assertTrue(catalogBom.contains("artifactId=brooklyn-test-osgi-more-entities")); - - deleteCatalogEntity(symbolicNameOuter); - deleteCatalogEntity(symbolicNameFiller); - deleteCatalogEntity(symbolicNameInner); - } - @Test public void testCatalogItemIdInReferencedItems() throws Exception { String symbolicNameInner = "my.catalog.app.id.inner"; http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/c6094973/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindConfigInheritanceTest.java ---------------------------------------------------------------------- diff --git a/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindConfigInheritanceTest.java b/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindConfigInheritanceTest.java index 06ad60f..f48a53a 100644 --- a/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindConfigInheritanceTest.java +++ b/core/src/test/java/org/apache/brooklyn/core/mgmt/rebind/RebindConfigInheritanceTest.java @@ -117,6 +117,7 @@ public class RebindConfigInheritanceTest extends RebindTestFixtureWithApp { checkNewAppNonInheritingKey1(rebindedApp); String origMementoTidied = origMemento.substring(origMemento.indexOf("")); + origMementoTidied = origMementoTidied.replaceFirst("", "\n "); origMementoTidied = Strings.replaceAllNonRegex(origMementoTidied, "VERSION", BrooklynVersion.get()); Asserts.assertEquals(origMementoTidied, newMemento); }