Repository: brooklyn-dist Updated Branches: refs/heads/master c181d595a -> 97fa7dc04
Allow a user to add or override deserialize configuration in karaf Project: http://git-wip-us.apache.org/repos/asf/brooklyn-dist/repo Commit: http://git-wip-us.apache.org/repos/asf/brooklyn-dist/commit/ba5c22ce Tree: http://git-wip-us.apache.org/repos/asf/brooklyn-dist/tree/ba5c22ce Diff: http://git-wip-us.apache.org/repos/asf/brooklyn-dist/diff/ba5c22ce Branch: refs/heads/master Commit: ba5c22ce599a4975cdda9ed8edcfacd58160184c Parents: c181d59 Author: Thomas Bouron <thomas.bou...@cloudsoftcorp.com> Authored: Tue Dec 20 18:03:32 2016 +0000 Committer: Thomas Bouron <thomas.bou...@cloudsoftcorp.com> Committed: Mon Jan 9 10:01:42 2017 +0000 ---------------------------------------------------------------------- .../etc/org.apache.brooklyn.classrename.cfg | 21 ++++++++++++++++++++ .../launcher/osgi/OsgiLauncherTest.java | 18 ++++++++++++++++- 2 files changed, 38 insertions(+), 1 deletion(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/brooklyn-dist/blob/ba5c22ce/karaf/apache-brooklyn/src/main/resources/etc/org.apache.brooklyn.classrename.cfg ---------------------------------------------------------------------- diff --git a/karaf/apache-brooklyn/src/main/resources/etc/org.apache.brooklyn.classrename.cfg b/karaf/apache-brooklyn/src/main/resources/etc/org.apache.brooklyn.classrename.cfg new file mode 100644 index 0000000..839eead --- /dev/null +++ b/karaf/apache-brooklyn/src/main/resources/etc/org.apache.brooklyn.classrename.cfg @@ -0,0 +1,21 @@ +################################################################################ +# +# 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. +# +################################################################################ + +# This file can contains custom deserialization class mappings for the persistence state +# Syntax should be <old-class>=<new-class> \ No newline at end of file http://git-wip-us.apache.org/repos/asf/brooklyn-dist/blob/ba5c22ce/karaf/itest/src/test/java/org/apache/brooklyn/launcher/osgi/OsgiLauncherTest.java ---------------------------------------------------------------------- diff --git a/karaf/itest/src/test/java/org/apache/brooklyn/launcher/osgi/OsgiLauncherTest.java b/karaf/itest/src/test/java/org/apache/brooklyn/launcher/osgi/OsgiLauncherTest.java index b825112..17035e4 100644 --- a/karaf/itest/src/test/java/org/apache/brooklyn/launcher/osgi/OsgiLauncherTest.java +++ b/karaf/itest/src/test/java/org/apache/brooklyn/launcher/osgi/OsgiLauncherTest.java @@ -25,14 +25,17 @@ import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.editConfi import static org.ops4j.pax.exam.karaf.options.KarafDistributionOption.features; import java.io.IOException; +import java.util.Map; import javax.inject.Inject; import org.apache.brooklyn.KarafTestUtils; import org.apache.brooklyn.api.mgmt.ManagementContext; +import org.apache.brooklyn.core.mgmt.persist.DeserializingClassRenamesProvider; import org.apache.brooklyn.test.Asserts; import org.apache.brooklyn.test.IntegrationTest; import org.apache.karaf.features.BootFinished; +import org.junit.Before; import org.junit.Test; import org.junit.experimental.categories.Category; import org.junit.runner.RunWith; @@ -53,7 +56,8 @@ public class OsgiLauncherTest { private static final String TEST_KEY_RUNTIME = "test.key"; private static final String TEST_VALUE_IN_CFG = "test.cfg"; private static final String TEST_KEY_IN_CFG = "test.key.in.cfg"; - + private static final String TEST_CLASS_IN_CFG = "com.acme"; + private static final String TEST_CLASS_RENAME_IN_CFG = "org.apache.brooklyn"; @Inject @Filter(timeout = 120000) protected ManagementContext mgmt; @@ -70,12 +74,18 @@ public class OsgiLauncherTest { @Filter(timeout = 120000) BootFinished bootFinished; + @Before + public void setup() { + DeserializingClassRenamesProvider.reset(); + } + @Configuration public static Option[] configuration() throws Exception { return defaultOptionsWith( editConfigurationFilePut("etc/org.apache.brooklyn.osgilauncher.cfg", "globalBrooklynPropertiesFile", ""), editConfigurationFilePut("etc/org.apache.brooklyn.osgilauncher.cfg", "localBrooklynPropertiesFile", ""), editConfigurationFilePut("etc/brooklyn.cfg", TEST_KEY_IN_CFG, TEST_VALUE_IN_CFG), + editConfigurationFilePut("etc/org.apache.brooklyn.class-rename.cfg", TEST_CLASS_IN_CFG, TEST_CLASS_RENAME_IN_CFG), features(KarafTestUtils.brooklynFeaturesRepository(), "brooklyn-osgi-launcher") // Uncomment this for remote debugging the tests on port 5005 // ,KarafDistributionOption.debugConfiguration() @@ -96,4 +106,10 @@ public class OsgiLauncherTest { } }); } + + @Test + public void testClassRenameConfig() throws IOException { + final Map<String, String> map = DeserializingClassRenamesProvider.loadDeserializingClassRenames(); + assertEquals(TEST_CLASS_RENAME_IN_CFG, map.get(TEST_CLASS_IN_CFG)); + } }