You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@brooklyn.apache.org by ge...@apache.org on 2017/07/19 16:25:46 UTC

[16/39] brooklyn-server git commit: remove osgi deprecation, disable, and transform tests

remove osgi deprecation, disable, and transform tests

these are no longer supported; need to think through how to address


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

Branch: refs/heads/master
Commit: 580c00da07e6956b911ec48e2626540805702f83
Parents: 02cfe50
Author: Alex Heneveld <al...@cloudsoftcorp.com>
Authored: Fri Jun 30 09:54:11 2017 +0100
Committer: Alex Heneveld <al...@cloudsoftcorp.com>
Committed: Fri Jun 30 14:08:25 2017 +0100

----------------------------------------------------------------------
 .../brooklyn/catalog/CatalogYamlRebindTest.java | 93 ++++----------------
 1 file changed, 16 insertions(+), 77 deletions(-)
----------------------------------------------------------------------


http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/580c00da/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogYamlRebindTest.java
----------------------------------------------------------------------
diff --git a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogYamlRebindTest.java b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogYamlRebindTest.java
index a962dbe..d8cd514 100644
--- a/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogYamlRebindTest.java
+++ b/camp/camp-brooklyn/src/test/java/org/apache/brooklyn/camp/brooklyn/catalog/CatalogYamlRebindTest.java
@@ -51,7 +51,6 @@ import org.apache.brooklyn.entity.stock.BasicEntity;
 import org.apache.brooklyn.test.Asserts;
 import org.apache.brooklyn.test.support.TestResourceUnavailableException;
 import org.apache.brooklyn.util.exceptions.Exceptions;
-import org.apache.brooklyn.util.osgi.OsgiTestResources;
 import org.apache.brooklyn.util.text.Strings;
 import org.testng.annotations.AfterMethod;
 import org.testng.annotations.BeforeMethod;
@@ -70,12 +69,10 @@ public class CatalogYamlRebindTest extends AbstractYamlRebindTest {
     //   - config/attribute cannot be instantiated (e.g. because class no longer on classpath)
     //   - entity file corrupt
 
-    private static final String OSGI_BUNDLE_SYMBOLID_NAME_FULL = OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_SYMBOLIC_NAME_FULL;
-    private static final String OSGI_BUNDLE_URL = OsgiStandaloneTest.BROOKLYN_TEST_OSGI_ENTITIES_URL;
-    private static final String OSGI_SIMPLE_ENTITY_TYPE = OsgiTestResources.BROOKLYN_TEST_OSGI_ENTITIES_SIMPLE_ENTITY;
-    private static final String OSGI_SIMPLE_POLICY_TYPE = OsgiTestResources.BROOKLYN_TEST_OSGI_ENTITIES_SIMPLE_POLICY;
-    private static final String OSGI_SIMPLE_EFFECTOR_TYPE = OsgiTestResources.BROOKLYN_TEST_OSGI_ENTITIES_SIMPLE_EFFECTOR;
-
+    // Since 0.12.0 OSGi reads from bundles so many of the things this used to test are no longer supported;
+    // deprecation and disablement will have to be done on a bundle-wide basis
+    // and transforms will have to be done by forcibly replacing a bundle or another "upgrade" mechanism
+    
     enum RebindWithCatalogTestMode {
         NO_OP,
         STRIP_DEPRECATION_AND_ENABLEMENT_FROM_CATALOG_ITEM,
@@ -87,8 +84,6 @@ public class CatalogYamlRebindTest extends AbstractYamlRebindTest {
     
     enum OsgiMode {
         NONE,
-        LIBRARY,
-        PREFIX
     }
 
     private Boolean defaultEnablementOfFeatureAutoFixatalogRefOnRebind;
@@ -111,27 +106,19 @@ public class CatalogYamlRebindTest extends AbstractYamlRebindTest {
     
     @Override
     protected boolean useOsgi() {
-        return true;
+        return false;
     }
 
     @DataProvider
     public Object[][] dataProvider() {
         return new Object[][] {
             {RebindWithCatalogTestMode.NO_OP, OsgiMode.NONE},
-            {RebindWithCatalogTestMode.NO_OP, OsgiMode.LIBRARY},
-            {RebindWithCatalogTestMode.NO_OP, OsgiMode.PREFIX},
             
             {RebindWithCatalogTestMode.STRIP_DEPRECATION_AND_ENABLEMENT_FROM_CATALOG_ITEM, OsgiMode.NONE},
-            {RebindWithCatalogTestMode.STRIP_DEPRECATION_AND_ENABLEMENT_FROM_CATALOG_ITEM, OsgiMode.LIBRARY},
-            {RebindWithCatalogTestMode.STRIP_DEPRECATION_AND_ENABLEMENT_FROM_CATALOG_ITEM, OsgiMode.PREFIX},
             
             {RebindWithCatalogTestMode.DEPRECATE_CATALOG, OsgiMode.NONE},
-            {RebindWithCatalogTestMode.DEPRECATE_CATALOG, OsgiMode.LIBRARY},
-            {RebindWithCatalogTestMode.DEPRECATE_CATALOG, OsgiMode.PREFIX},
             
             {RebindWithCatalogTestMode.DISABLE_CATALOG, OsgiMode.NONE},
-            {RebindWithCatalogTestMode.DISABLE_CATALOG, OsgiMode.LIBRARY},
-            {RebindWithCatalogTestMode.DISABLE_CATALOG, OsgiMode.PREFIX},
             
             // For DELETE_CATALOG, see https://issues.apache.org/jira/browse/BROOKLYN-149.
             // Deletes the catalog item before rebind, but the referenced types are still on the 
@@ -143,8 +130,6 @@ public class CatalogYamlRebindTest extends AbstractYamlRebindTest {
             // Upgrades the catalog item before rebind, deleting the old version.
             // Will automatically upgrade. Test will enable "FEATURE_AUTO_FIX_CATALOG_REF_ON_REBIND"
             {RebindWithCatalogTestMode.REPLACE_CATALOG_WITH_NEWER_VERSION, OsgiMode.NONE},
-            {RebindWithCatalogTestMode.REPLACE_CATALOG_WITH_NEWER_VERSION, OsgiMode.LIBRARY},
-            {RebindWithCatalogTestMode.REPLACE_CATALOG_WITH_NEWER_VERSION, OsgiMode.PREFIX},
         };
     }
 
@@ -216,63 +201,17 @@ public class CatalogYamlRebindTest extends AbstractYamlRebindTest {
         String appSymbolicName = "my.catalog.app.id.load";
         String appVersion = "0.1.0";
 
-        String appCatalogFormat;
-        if (osgiMode == OsgiMode.LIBRARY) {
-            appCatalogFormat = Joiner.on("\n").join(
-                    "brooklyn.catalog:",
-                    "  id: " + appSymbolicName,
-                    "  version: %s",
-                    "  itemType: entity",
-                    "  libraries:",
-                    "  - url: " + OSGI_BUNDLE_URL,
-                    "  item:",
-                    "    type: " + OSGI_SIMPLE_ENTITY_TYPE,
-                    "    brooklyn.enrichers:",
-                    "    - type: " + TestEnricher.class.getName(),
-                    "    brooklyn.policies:",
-                    "    - type: " + OSGI_SIMPLE_POLICY_TYPE,
-                    "    brooklyn.initializers:",
-                    "    - type: " + OSGI_SIMPLE_EFFECTOR_TYPE);
-        } else if (osgiMode == OsgiMode.PREFIX) {
-            // This catalog item is just meant to load the bundle in the OSGi environment. Its content is irrelevant.
-            String libraryItem = Joiner.on("\n").join(
-                    "brooklyn.catalog:",
-                    "  id: dummy",
-                    "  version: %s",
-                    "  itemType: entity",
-                    "  libraries:",
-                    "  - url: " + OSGI_BUNDLE_URL,
-                    "  item: " + BasicEntity.class.getName());
-            addCatalogItems(String.format(libraryItem, appVersion));
-
-            // Use bundle prefixes here, pointing to the bundle already loaded above
-            appCatalogFormat = Joiner.on("\n").join(
-                    "brooklyn.catalog:",
-                    "  id: " + appSymbolicName,
-                    "  version: %s",
-                    "  itemType: entity",
-                    "  item:",
-                    "    type: " + OSGI_BUNDLE_SYMBOLID_NAME_FULL + ":" + OSGI_SIMPLE_ENTITY_TYPE,
-                    "    brooklyn.enrichers:",
-                    "    - type: " + TestEnricher.class.getName(),
-                    "    brooklyn.policies:",
-                    "    - type: " + OSGI_BUNDLE_SYMBOLID_NAME_FULL + ":" + OSGI_SIMPLE_POLICY_TYPE,
-                    "    brooklyn.initializers:",
-                    "    - type: " + OSGI_BUNDLE_SYMBOLID_NAME_FULL + ":" + OSGI_SIMPLE_EFFECTOR_TYPE);
-        } else {
-            appCatalogFormat = Joiner.on("\n").join(
-                "brooklyn.catalog:",
-                "  id: " + appSymbolicName,
-                "  version: %s",
-                "  itemType: entity",
-                "  item:",
-                "    type: " + BasicEntity.class.getName(),
-                "    brooklyn.enrichers:",
-                "    - type: " + TestEnricher.class.getName(),
-                "    brooklyn.policies:",
-                "    - type: " + TestPolicy.class.getName());
-        }
-
+        String appCatalogFormat = Joiner.on("\n").join(
+            "brooklyn.catalog:",
+            "  id: " + appSymbolicName,
+            "  version: %s",
+            "  itemType: entity",
+            "  item:",
+            "    type: " + BasicEntity.class.getName(),
+            "    brooklyn.enrichers:",
+            "    - type: " + TestEnricher.class.getName(),
+            "    brooklyn.policies:",
+            "    - type: " + TestPolicy.class.getName());
 
         String locSymbolicName = "my.catalog.loc.id.load";
         String locVersion = "1.0.0";