http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/02b71ffb/core/src/test/java/org/apache/brooklyn/core/config/MapConfigKeyAndFriendsDeprecationTest.java ---------------------------------------------------------------------- diff --git a/core/src/test/java/org/apache/brooklyn/core/config/MapConfigKeyAndFriendsDeprecationTest.java b/core/src/test/java/org/apache/brooklyn/core/config/MapConfigKeyAndFriendsDeprecationTest.java new file mode 100644 index 0000000..6103c86 --- /dev/null +++ b/core/src/test/java/org/apache/brooklyn/core/config/MapConfigKeyAndFriendsDeprecationTest.java @@ -0,0 +1,124 @@ +/* + * 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.core.config; + +import static org.testng.Assert.assertEquals; + +import org.apache.brooklyn.api.entity.EntitySpec; +import org.apache.brooklyn.api.entity.ImplementedBy; +import org.apache.brooklyn.core.entity.AbstractEntity; +import org.apache.brooklyn.core.entity.EntityInternal; +import org.apache.brooklyn.core.test.BrooklynAppUnitTestSupport; +import org.apache.brooklyn.core.test.entity.TestEntity; +import org.testng.annotations.Test; + +import com.google.common.collect.ImmutableMap; + +public class MapConfigKeyAndFriendsDeprecationTest extends BrooklynAppUnitTestSupport { + + @Test + public void testUsingDeprecatedName() throws Exception { + EntityInternal entity = app.addChild(EntitySpec.create(MyEntity.class) + .configure("oldConfMapDeepMerge", ImmutableMap.of("mykey", "myval"))); + assertEquals(entity.config().get(MyEntity.CONF_MAP_DEEP_MERGE), ImmutableMap.of("mykey", "myval")); + } + + @Test + public void testUsingDeprecatedNameSubkey() throws Exception { + EntityInternal entity = app.addChild(EntitySpec.create(MyEntity.class) + .configure("confMapDeepMerge.mykey", "myval")); + assertEquals(entity.config().get(MyEntity.CONF_MAP_DEEP_MERGE), ImmutableMap.of("mykey", "myval")); + } + + @Test + public void testPrefersNonDeprecatedName() throws Exception { + EntityInternal entity = app.addChild(EntitySpec.create(MyEntity.class) + .configure("confMapDeepMerge", ImmutableMap.of("mykey", "myval")) + .configure("oldConfMapDeepMerge", ImmutableMap.of("wrongkey", "wrongval"))); + assertEquals(entity.config().get(MyEntity.CONF_MAP_DEEP_MERGE), ImmutableMap.of("mykey", "myval")); + } + + @Test + public void testInheritsDeprecatedKeyFromRuntimeParent() throws Exception { + EntityInternal entity = app.addChild(EntitySpec.create(TestEntity.class) + .configure("oldConfMapDeepMerge", ImmutableMap.of("mykey", "myval")) + .configure("oldConfMapNotReinherited", ImmutableMap.of("mykey", "myval"))); + EntityInternal child = entity.addChild(EntitySpec.create(MyEntity.class)); + assertEquals(child.config().get(MyEntity.CONF_MAP_DEEP_MERGE), ImmutableMap.of("mykey", "myval")); + assertEquals(child.config().get(MyEntity.CONF_MAP_NOT_REINHERITED), ImmutableMap.of("mykey", "myval")); + } + + @Test + public void testMergesDeprecatedKeyFromRuntimeParent() throws Exception { + EntityInternal entity = app.addChild(EntitySpec.create(TestEntity.class) + .configure("oldConfMapDeepMerge", ImmutableMap.of("mykey", "myval"))); + EntityInternal child = entity.addChild(EntitySpec.create(MyEntity.class) + .configure("oldConfMapDeepMerge", ImmutableMap.of("mykey2", "myval2"))); + assertEquals(child.config().get(MyEntity.CONF_MAP_DEEP_MERGE), ImmutableMap.of("mykey", "myval", "mykey2", "myval2")); + } + + @Test + public void testMergesDeprecatedKeyFromRuntimeParentWithOwn() throws Exception { + EntityInternal entity = app.addChild(EntitySpec.create(TestEntity.class) + .configure("oldConfMapDeepMerge", ImmutableMap.of("mykey", "myval"))); + EntityInternal child = entity.addChild(EntitySpec.create(MyEntity.class) + .configure("confMapDeepMerge", ImmutableMap.of("mykey2", "myval2"))); + assertEquals(child.config().get(MyEntity.CONF_MAP_DEEP_MERGE), ImmutableMap.of("mykey", "myval", "mykey2", "myval2")); + } + + @Test + public void testMergesKeyFromRuntimeParentWithOwnDeprecated() throws Exception { + EntityInternal entity = app.addChild(EntitySpec.create(TestEntity.class) + .configure("confMapDeepMerge", ImmutableMap.of("mykey", "myval"))); + EntityInternal child = entity.addChild(EntitySpec.create(MyEntity.class) + .configure("oldConfMapDeepMerge", ImmutableMap.of("mykey2", "myval2"))); + assertEquals(child.config().get(MyEntity.CONF_MAP_DEEP_MERGE), ImmutableMap.of("mykey", "myval", "mykey2", "myval2")); + } + + @Test + public void testDeprecatedKeyNotReinheritedIfNotSupposedToBe() throws Exception { + EntityInternal entity = app.addChild(EntitySpec.create(MyEntity.class) + .configure("oldConfMapNotReinherited", ImmutableMap.of("mykey", "myval"))); + EntityInternal child = entity.addChild(EntitySpec.create(MyEntity.class)); + assertEquals(entity.config().get(MyEntity.CONF_MAP_NOT_REINHERITED), ImmutableMap.of("mykey", "myval")); + assertEquals(child.config().get(MyEntity.CONF_MAP_NOT_REINHERITED), null); + } + + @ImplementedBy(MyEntityImpl.class) + public interface MyEntity extends EntityInternal { + MapConfigKey<String> CONF_MAP_DEEP_MERGE = new MapConfigKey.Builder<String>(String.class, "confMapDeepMerge") + .deprecatedNames("oldConfMapDeepMerge") + .runtimeInheritance(BasicConfigInheritance.DEEP_MERGE) + .build(); + + MapConfigKey<Object> CONF_MAP_NOT_REINHERITED = new MapConfigKey.Builder<Object>(Object.class, "confMapNotReinherited") + .deprecatedNames("oldConfMapNotReinherited") + .runtimeInheritance(BasicConfigInheritance.NOT_REINHERITED) + .build(); + + // FIXME Need to support deprecatedNames for ListConfigKey and SetConfigKey? + ListConfigKey<String> CONF_LIST_THING = new ListConfigKey<String>(String.class, "test.confListThing", "Configuration key that's a list thing"); + ListConfigKey<Object> CONF_LIST_OBJ_THING = new ListConfigKey<Object>(Object.class, "test.confListObjThing", "Configuration key that's a list thing, of objects"); + SetConfigKey<String> CONF_SET_THING = new SetConfigKey<String>(String.class, "test.confSetThing", "Configuration key that's a set thing"); + SetConfigKey<Object> CONF_SET_OBJ_THING = new SetConfigKey<Object>(Object.class, "test.confSetObjThing", "Configuration key that's a set thing, of objects"); + } + + public static class MyEntityImpl extends AbstractEntity implements MyEntity { + } +}
http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/02b71ffb/core/src/test/java/org/apache/brooklyn/core/entity/internal/ConfigUtilsInternalTest.java ---------------------------------------------------------------------- diff --git a/core/src/test/java/org/apache/brooklyn/core/entity/internal/ConfigUtilsInternalTest.java b/core/src/test/java/org/apache/brooklyn/core/entity/internal/ConfigUtilsInternalTest.java new file mode 100644 index 0000000..44d3ffb --- /dev/null +++ b/core/src/test/java/org/apache/brooklyn/core/entity/internal/ConfigUtilsInternalTest.java @@ -0,0 +1,71 @@ +/* + * 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.core.entity.internal; + +import static org.testng.Assert.assertEquals; + +import java.util.Map; + +import org.apache.brooklyn.config.ConfigKey; +import org.apache.brooklyn.core.config.ConfigKeys; +import org.apache.brooklyn.core.test.BrooklynAppUnitTestSupport; +import org.testng.annotations.Test; + +import com.google.common.collect.ImmutableList; +import com.google.common.collect.ImmutableMap; + +public class ConfigUtilsInternalTest extends BrooklynAppUnitTestSupport { + + final ConfigKey<String> key1 = ConfigKeys.builder(String.class, "key1") + .deprecatedNames("oldKey1", "oldKey1b") + .build(); + + @Test + public void testSetConfig() throws Exception { + Map<?,?> remaining = ConfigUtilsInternal.setAllConfigKeys(ImmutableMap.of("key1", "myval"), ImmutableList.of(key1), app); + assertEquals(app.config().get(key1), "myval"); + assertEquals(remaining, ImmutableMap.of()); + } + + @Test + public void testSetConfigUsingDeprecatedValue() throws Exception { + Map<?,?> remaining = ConfigUtilsInternal.setAllConfigKeys(ImmutableMap.of("oldKey1", "myval"), ImmutableList.of(key1), app); + assertEquals(app.config().get(key1), "myval"); + assertEquals(remaining, ImmutableMap.of()); + } + + @Test + public void testSetConfigPrefersNonDeprecated() throws Exception { + Map<?,?> remaining = ConfigUtilsInternal.setAllConfigKeys( + ImmutableMap.of("key1", "myval", "oldKey1", "myOldVal1", "oldKey1b", "myOldVal1b"), + ImmutableList.of(key1), + app); + assertEquals(app.config().get(key1), "myval"); + + // Should remove deprecated value as well (and warn about it) + assertEquals(remaining, ImmutableMap.of()); + } + + @Test + public void testReturnsUnmatched() throws Exception { + Map<?,?> remaining = ConfigUtilsInternal.setAllConfigKeys(ImmutableMap.of("wrong", "myval"), ImmutableList.of(key1), app); + assertEquals(app.config().get(key1), null); + assertEquals(remaining, ImmutableMap.of("wrong", "myval")); + } +} http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/02b71ffb/core/src/test/resources/org/apache/brooklyn/core/config/config-deprecated-enricher-j8rvs5fc16 ---------------------------------------------------------------------- diff --git a/core/src/test/resources/org/apache/brooklyn/core/config/config-deprecated-enricher-j8rvs5fc16 b/core/src/test/resources/org/apache/brooklyn/core/config/config-deprecated-enricher-j8rvs5fc16 new file mode 100644 index 0000000..9b15e24 --- /dev/null +++ b/core/src/test/resources/org/apache/brooklyn/core/config/config-deprecated-enricher-j8rvs5fc16 @@ -0,0 +1,36 @@ +<!-- +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. +--> + +<enricher> + <brooklynVersion>0.12.0-SNAPSHOT</brooklynVersion> + <type>org.apache.brooklyn.core.config.ConfigKeyDeprecationRebindTest$MyEnricher</type> + <id>j8rvs5fc16</id> + <displayName>org.apache.brooklyn.core.config.ConfigKeyDeprecationRebindTest.MyEnricher</displayName> + <searchPath class="ImmutableList"/> + <config> + <oldKey1>myval1</oldKey1> + <field1>myval2</field1> + <uniqueTag> + <null/> + </uniqueTag> + <tags> + <set/> + </tags> + </config> +</enricher> http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/02b71ffb/core/src/test/resources/org/apache/brooklyn/core/config/config-deprecated-enricherOwner-sb5w8w5tq0 ---------------------------------------------------------------------- diff --git a/core/src/test/resources/org/apache/brooklyn/core/config/config-deprecated-enricherOwner-sb5w8w5tq0 b/core/src/test/resources/org/apache/brooklyn/core/config/config-deprecated-enricherOwner-sb5w8w5tq0 new file mode 100644 index 0000000..6abc5fc --- /dev/null +++ b/core/src/test/resources/org/apache/brooklyn/core/config/config-deprecated-enricherOwner-sb5w8w5tq0 @@ -0,0 +1,36 @@ +<!-- +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. +--> + +<entity> + <brooklynVersion>0.12.0-SNAPSHOT</brooklynVersion> + <type>org.apache.brooklyn.core.config.ConfigKeyDeprecationRebindTest$MyAppImpl</type> + <id>sb5w8w5tq0</id> + <displayName>MyApp:sb5w</displayName> + <searchPath class="ImmutableList"/> + <attributes> + <entity.id>sb5w8w5tq0</entity.id> + <application.id>sb5w8w5tq0</application.id> + <catalog.id> + <null/> + </catalog.id> + </attributes> + <enrichers> + <string>j8rvs5fc16</string> + </enrichers> +</entity> http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/02b71ffb/core/src/test/resources/org/apache/brooklyn/core/config/config-deprecated-feed-km6gu420a0 ---------------------------------------------------------------------- diff --git a/core/src/test/resources/org/apache/brooklyn/core/config/config-deprecated-feed-km6gu420a0 b/core/src/test/resources/org/apache/brooklyn/core/config/config-deprecated-feed-km6gu420a0 new file mode 100644 index 0000000..1d7f108 --- /dev/null +++ b/core/src/test/resources/org/apache/brooklyn/core/config/config-deprecated-feed-km6gu420a0 @@ -0,0 +1,30 @@ +<!-- +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. +--> + +<feed> + <brooklynVersion>0.12.0-SNAPSHOT</brooklynVersion> + <type>org.apache.brooklyn.core.config.ConfigKeyDeprecationRebindTest$MyFeed</type> + <id>km6gu420a0</id> + <displayName>org.apache.brooklyn.core.config.ConfigKeyDeprecationRebindTest.MyFeed</displayName> + <searchPath class="ImmutableList"/> + <config> + <oldKey1>myval1</oldKey1> + <oldKey2>myval2</oldKey2> + </config> +</feed> http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/02b71ffb/core/src/test/resources/org/apache/brooklyn/core/config/config-deprecated-feedOwner-d8p4p8o4x7 ---------------------------------------------------------------------- diff --git a/core/src/test/resources/org/apache/brooklyn/core/config/config-deprecated-feedOwner-d8p4p8o4x7 b/core/src/test/resources/org/apache/brooklyn/core/config/config-deprecated-feedOwner-d8p4p8o4x7 new file mode 100644 index 0000000..b2aacbf --- /dev/null +++ b/core/src/test/resources/org/apache/brooklyn/core/config/config-deprecated-feedOwner-d8p4p8o4x7 @@ -0,0 +1,36 @@ +<!-- +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. +--> + +<entity> + <brooklynVersion>0.12.0-SNAPSHOT</brooklynVersion> + <type>org.apache.brooklyn.core.config.ConfigKeyDeprecationRebindTest$MyAppImpl</type> + <id>d8p4p8o4x7</id> + <displayName>MyApp:d8p4</displayName> + <searchPath class="ImmutableList"/> + <attributes> + <entity.id>d8p4p8o4x7</entity.id> + <application.id>d8p4p8o4x7</application.id> + <catalog.id> + <null/> + </catalog.id> + </attributes> + <feeds> + <string>km6gu420a0</string> + </feeds> +</entity> http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/02b71ffb/core/src/test/resources/org/apache/brooklyn/core/config/config-deprecated-flagNameOnField-e86eode5yy ---------------------------------------------------------------------- diff --git a/core/src/test/resources/org/apache/brooklyn/core/config/config-deprecated-flagNameOnField-e86eode5yy b/core/src/test/resources/org/apache/brooklyn/core/config/config-deprecated-flagNameOnField-e86eode5yy new file mode 100644 index 0000000..ebeea74 --- /dev/null +++ b/core/src/test/resources/org/apache/brooklyn/core/config/config-deprecated-flagNameOnField-e86eode5yy @@ -0,0 +1,48 @@ +<!-- +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. +--> + +<entity> + <brooklynVersion>0.12.0-SNAPSHOT</brooklynVersion> + <type>org.apache.brooklyn.core.config.ConfigKeyDeprecationRebindTest$MyAppImpl</type> + <id>e86eode5yy</id> + <displayName>MyApp:e86e</displayName> + <searchPath class="ImmutableList"/> + <config> + <field1>myval</field1> + </config> + <attributes> + <entity.id>e86eode5yy</entity.id> + <application.id>e86eode5yy</application.id> + <catalog.id> + <null/> + </catalog.id> + </attributes> + <configKeys> + <field1> + <configKey> + <name>field1</name> + <deprecatedNames class="ImmutableList" reference="../../../../searchPath"/> + <type>java.lang.Object</type> + <description>field1</description> + <reconfigurable>false</reconfigurable> + <constraint class="com.google.common.base.Predicates$ObjectPredicate">ALWAYS_TRUE</constraint> + </configKey> + </field1> + </configKeys> +</entity> http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/02b71ffb/core/src/test/resources/org/apache/brooklyn/core/config/config-deprecated-flagNameOnField-location-f4kj5hxcvx ---------------------------------------------------------------------- diff --git a/core/src/test/resources/org/apache/brooklyn/core/config/config-deprecated-flagNameOnField-location-f4kj5hxcvx b/core/src/test/resources/org/apache/brooklyn/core/config/config-deprecated-flagNameOnField-location-f4kj5hxcvx new file mode 100644 index 0000000..8e100a0 --- /dev/null +++ b/core/src/test/resources/org/apache/brooklyn/core/config/config-deprecated-flagNameOnField-location-f4kj5hxcvx @@ -0,0 +1,35 @@ +<!-- +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. +--> + +<location> + <brooklynVersion>0.12.0-SNAPSHOT</brooklynVersion> + <type>org.apache.brooklyn.core.config.ConfigKeyDeprecationRebindTest$MyLocation</type> + <id>f4kj5hxcvx</id> + <displayName>MyLocation:f4kj</displayName> + <searchPath class="ImmutableList"/> + <locationConfig> + <field1>myval</field1> + <tags> + <set/> + </tags> + </locationConfig> + <locationConfigUnused> + <string>field1</string> + </locationConfigUnused> +</location> http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/02b71ffb/core/src/test/resources/org/apache/brooklyn/core/config/config-deprecated-flagNameOnField-policy-alq7mtwv0m ---------------------------------------------------------------------- diff --git a/core/src/test/resources/org/apache/brooklyn/core/config/config-deprecated-flagNameOnField-policy-alq7mtwv0m b/core/src/test/resources/org/apache/brooklyn/core/config/config-deprecated-flagNameOnField-policy-alq7mtwv0m new file mode 100644 index 0000000..15980df --- /dev/null +++ b/core/src/test/resources/org/apache/brooklyn/core/config/config-deprecated-flagNameOnField-policy-alq7mtwv0m @@ -0,0 +1,35 @@ +<!-- +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. +--> + +<policy> + <brooklynVersion>0.12.0-SNAPSHOT</brooklynVersion> + <type>org.apache.brooklyn.core.config.ConfigKeyDeprecationRebindTest$MyPolicy</type> + <id>alq7mtwv0m</id> + <displayName>org.apache.brooklyn.core.config.ConfigKeyDeprecationRebindTest.MyPolicy</displayName> + <searchPath class="ImmutableList"/> + <config> + <field1>myval</field1> + <uniqueTag> + <null/> + </uniqueTag> + <tags> + <set/> + </tags> + </config> +</policy> http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/02b71ffb/core/src/test/resources/org/apache/brooklyn/core/config/config-deprecated-flagNameOnField-policyOwner-vfncjpljqf ---------------------------------------------------------------------- diff --git a/core/src/test/resources/org/apache/brooklyn/core/config/config-deprecated-flagNameOnField-policyOwner-vfncjpljqf b/core/src/test/resources/org/apache/brooklyn/core/config/config-deprecated-flagNameOnField-policyOwner-vfncjpljqf new file mode 100644 index 0000000..8bb47ad --- /dev/null +++ b/core/src/test/resources/org/apache/brooklyn/core/config/config-deprecated-flagNameOnField-policyOwner-vfncjpljqf @@ -0,0 +1,36 @@ +<!-- +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. +--> + +<entity> + <brooklynVersion>0.12.0-SNAPSHOT</brooklynVersion> + <type>org.apache.brooklyn.core.config.ConfigKeyDeprecationRebindTest$MyAppImpl</type> + <id>vfncjpljqf</id> + <displayName>MyApp:vfnc</displayName> + <searchPath class="ImmutableList"/> + <attributes> + <entity.id>vfncjpljqf</entity.id> + <application.id>vfncjpljqf</application.id> + <catalog.id> + <null/> + </catalog.id> + </attributes> + <policies> + <string>alq7mtwv0m</string> + </policies> +</entity> http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/02b71ffb/core/src/test/resources/org/apache/brooklyn/core/config/config-deprecated-flagNameOnKey-ug77ek2tkd ---------------------------------------------------------------------- diff --git a/core/src/test/resources/org/apache/brooklyn/core/config/config-deprecated-flagNameOnKey-ug77ek2tkd b/core/src/test/resources/org/apache/brooklyn/core/config/config-deprecated-flagNameOnKey-ug77ek2tkd new file mode 100644 index 0000000..561c81e --- /dev/null +++ b/core/src/test/resources/org/apache/brooklyn/core/config/config-deprecated-flagNameOnKey-ug77ek2tkd @@ -0,0 +1,36 @@ +<!-- +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. +--> + +<entity> + <brooklynVersion>0.12.0-SNAPSHOT</brooklynVersion> + <type>org.apache.brooklyn.core.config.ConfigKeyDeprecationRebindTest$MyAppImpl</type> + <id>ug77ek2tkd</id> + <displayName>MyApp:ug77</displayName> + <searchPath class="ImmutableList"/> + <config> + <key2>myval</key2> + </config> + <attributes> + <entity.id>ug77ek2tkd</entity.id> + <application.id>ug77ek2tkd</application.id> + <catalog.id> + <null/> + </catalog.id> + </attributes> +</entity> http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/02b71ffb/core/src/test/resources/org/apache/brooklyn/core/config/config-deprecated-key-dyozzd948m ---------------------------------------------------------------------- diff --git a/core/src/test/resources/org/apache/brooklyn/core/config/config-deprecated-key-dyozzd948m b/core/src/test/resources/org/apache/brooklyn/core/config/config-deprecated-key-dyozzd948m new file mode 100644 index 0000000..992d48e --- /dev/null +++ b/core/src/test/resources/org/apache/brooklyn/core/config/config-deprecated-key-dyozzd948m @@ -0,0 +1,48 @@ +<!-- +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. +--> + +<entity> + <brooklynVersion>0.12.0-SNAPSHOT</brooklynVersion> + <type>org.apache.brooklyn.core.config.ConfigKeyDeprecationRebindTest$MyAppImpl</type> + <id>dyozzd948m</id> + <displayName>MyApp:dyoz</displayName> + <searchPath class="ImmutableList"/> + <config> + <oldKey1>myval</oldKey1> + </config> + <attributes> + <entity.id>dyozzd948m</entity.id> + <application.id>dyozzd948m</application.id> + <catalog.id> + <null/> + </catalog.id> + </attributes> + <configKeys> + <oldKey1> + <configKey> + <name>oldKey1</name> + <deprecatedNames class="ImmutableList" reference="../../../../searchPath"/> + <type>java.lang.Object</type> + <description>oldKey1</description> + <reconfigurable>false</reconfigurable> + <constraint class="com.google.common.base.Predicates$ObjectPredicate">ALWAYS_TRUE</constraint> + </configKey> + </oldKey1> + </configKeys> +</entity> http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/02b71ffb/core/src/test/resources/org/apache/brooklyn/core/config/config-deprecated-key-pps2ttgijb ---------------------------------------------------------------------- diff --git a/core/src/test/resources/org/apache/brooklyn/core/config/config-deprecated-key-pps2ttgijb b/core/src/test/resources/org/apache/brooklyn/core/config/config-deprecated-key-pps2ttgijb new file mode 100644 index 0000000..541e79a --- /dev/null +++ b/core/src/test/resources/org/apache/brooklyn/core/config/config-deprecated-key-pps2ttgijb @@ -0,0 +1,36 @@ +<!-- +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. +--> + +<entity> + <brooklynVersion>0.12.0-SNAPSHOT</brooklynVersion> + <type>org.apache.brooklyn.core.config.ConfigKeyDeprecationRebindTest$MyAppImpl</type> + <id>pps2ttgijb</id> + <displayName>MyApp:pps2</displayName> + <searchPath class="ImmutableList"/> + <config> + <oldKey1>myval</oldKey1> + </config> + <attributes> + <entity.id>pps2ttgijb</entity.id> + <application.id>pps2ttgijb</application.id> + <catalog.id> + <null/> + </catalog.id> + </attributes> +</entity> http://git-wip-us.apache.org/repos/asf/brooklyn-server/blob/02b71ffb/utils/common/src/main/java/org/apache/brooklyn/config/ConfigKey.java ---------------------------------------------------------------------- diff --git a/utils/common/src/main/java/org/apache/brooklyn/config/ConfigKey.java b/utils/common/src/main/java/org/apache/brooklyn/config/ConfigKey.java index a494c0b..d5cc8f4 100644 --- a/utils/common/src/main/java/org/apache/brooklyn/config/ConfigKey.java +++ b/utils/common/src/main/java/org/apache/brooklyn/config/ConfigKey.java @@ -47,8 +47,17 @@ public interface ConfigKey<T> { String getName(); /** + * Returns deprecated names that will could also be used, but that are discouraged and will + * likely not be supported for the given config key in future versions. + */ + Collection<String> getDeprecatedNames(); + + /** * Returns the constituent parts of the configuration parameter name as a {@link Collection}. + * + * @deprecated since 0.12.0; use {@link #getName()} */ + @Deprecated Collection<String> getNameParts(); /**
