You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ss...@apache.org on 2016/11/18 23:42:02 UTC

svn commit: r1770448 [2/2] - in /sling/trunk/contrib/extensions/contextaware-config: impl/ impl/src/main/java/org/apache/sling/caconfig/impl/ impl/src/main/java/org/apache/sling/caconfig/impl/def/ impl/src/main/java/org/apache/sling/caconfig/management...

Propchange: sling/trunk/contrib/extensions/contextaware-config/impl/src/test/java/org/apache/sling/caconfig/override/impl/ConfigurationOverrideManagerTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sling/trunk/contrib/extensions/contextaware-config/impl/src/test/java/org/apache/sling/caconfig/override/impl/ConfigurationOverrideManagerTest.java
------------------------------------------------------------------------------
--- svn:keywords (added)
+++ svn:keywords Fri Nov 18 23:42:02 2016
@@ -0,0 +1 @@
+LastChangedDate LastChangedRevision LastChangedBy HeadURL Id Author

Propchange: sling/trunk/contrib/extensions/contextaware-config/impl/src/test/java/org/apache/sling/caconfig/override/impl/ConfigurationOverrideManagerTest.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: sling/trunk/contrib/extensions/contextaware-config/impl/src/test/java/org/apache/sling/caconfig/override/impl/DummyConfigurationOverrideProvider.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/contextaware-config/impl/src/test/java/org/apache/sling/caconfig/override/impl/DummyConfigurationOverrideProvider.java?rev=1770448&view=auto
==============================================================================
--- sling/trunk/contrib/extensions/contextaware-config/impl/src/test/java/org/apache/sling/caconfig/override/impl/DummyConfigurationOverrideProvider.java (added)
+++ sling/trunk/contrib/extensions/contextaware-config/impl/src/test/java/org/apache/sling/caconfig/override/impl/DummyConfigurationOverrideProvider.java Fri Nov 18 23:42:02 2016
@@ -0,0 +1,41 @@
+/*
+ * 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.sling.caconfig.override.impl;
+
+import java.util.Collection;
+import java.util.List;
+
+import org.apache.sling.caconfig.spi.ConfigurationOverrideProvider;
+
+import com.google.common.collect.ImmutableList;
+
+public class DummyConfigurationOverrideProvider implements ConfigurationOverrideProvider {
+    
+    private final List<String> overrideStrings;
+    
+    public DummyConfigurationOverrideProvider(String... overrideStrings) {
+        this.overrideStrings = ImmutableList.copyOf(overrideStrings);
+    }
+
+    @Override
+    public Collection<String> getOverrideStrings() {
+        return overrideStrings;
+    }
+
+}

Propchange: sling/trunk/contrib/extensions/contextaware-config/impl/src/test/java/org/apache/sling/caconfig/override/impl/DummyConfigurationOverrideProvider.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sling/trunk/contrib/extensions/contextaware-config/impl/src/test/java/org/apache/sling/caconfig/override/impl/DummyConfigurationOverrideProvider.java
------------------------------------------------------------------------------
--- svn:keywords (added)
+++ svn:keywords Fri Nov 18 23:42:02 2016
@@ -0,0 +1 @@
+LastChangedDate LastChangedRevision LastChangedBy HeadURL Id Author

Propchange: sling/trunk/contrib/extensions/contextaware-config/impl/src/test/java/org/apache/sling/caconfig/override/impl/DummyConfigurationOverrideProvider.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: sling/trunk/contrib/extensions/contextaware-config/impl/src/test/java/org/apache/sling/caconfig/override/impl/OsgiConfigurationOverrideProviderTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/contextaware-config/impl/src/test/java/org/apache/sling/caconfig/override/impl/OsgiConfigurationOverrideProviderTest.java?rev=1770448&view=auto
==============================================================================
--- sling/trunk/contrib/extensions/contextaware-config/impl/src/test/java/org/apache/sling/caconfig/override/impl/OsgiConfigurationOverrideProviderTest.java (added)
+++ sling/trunk/contrib/extensions/contextaware-config/impl/src/test/java/org/apache/sling/caconfig/override/impl/OsgiConfigurationOverrideProviderTest.java Fri Nov 18 23:42:02 2016
@@ -0,0 +1,63 @@
+/*
+ * 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.sling.caconfig.override.impl;
+
+import static org.junit.Assert.assertTrue;
+
+import java.util.Collection;
+
+import org.apache.sling.testing.mock.sling.junit.SlingContext;
+import org.junit.Rule;
+import org.junit.Test;
+
+public class OsgiConfigurationOverrideProviderTest {
+
+    @Rule
+    public SlingContext context = new SlingContext();
+    
+    @Test
+    public void testEnabled() {
+        OsgiConfigurationOverrideProvider provider = context.registerInjectActivateService(
+                new OsgiConfigurationOverrideProvider(),
+                "enabled", true,
+                "overrides", new String[] {
+                        "test/param1=value1",
+                        "[/content]test/param2=value2"
+                });
+
+        Collection<String> overrides = provider.getOverrideStrings();
+        assertTrue(overrides.contains("test/param1=value1"));
+        assertTrue(overrides.contains("[/content]test/param2=value2"));
+    }
+
+    @Test
+    public void testDisabled() {
+        OsgiConfigurationOverrideProvider provider = context.registerInjectActivateService(
+                new OsgiConfigurationOverrideProvider(),
+                "enabled", false,
+                "overrides", new String[] {
+                        "test/param1=value1",
+                        "[/content]test/param2=value2"
+                });
+
+        Collection<String> overrides = provider.getOverrideStrings();
+        assertTrue(overrides.isEmpty());
+    }
+
+}

Propchange: sling/trunk/contrib/extensions/contextaware-config/impl/src/test/java/org/apache/sling/caconfig/override/impl/OsgiConfigurationOverrideProviderTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sling/trunk/contrib/extensions/contextaware-config/impl/src/test/java/org/apache/sling/caconfig/override/impl/OsgiConfigurationOverrideProviderTest.java
------------------------------------------------------------------------------
--- svn:keywords (added)
+++ svn:keywords Fri Nov 18 23:42:02 2016
@@ -0,0 +1 @@
+LastChangedDate LastChangedRevision LastChangedBy HeadURL Id Author

Propchange: sling/trunk/contrib/extensions/contextaware-config/impl/src/test/java/org/apache/sling/caconfig/override/impl/OsgiConfigurationOverrideProviderTest.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: sling/trunk/contrib/extensions/contextaware-config/impl/src/test/java/org/apache/sling/caconfig/override/impl/OverrideItemTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/contextaware-config/impl/src/test/java/org/apache/sling/caconfig/override/impl/OverrideItemTest.java?rev=1770448&view=auto
==============================================================================
--- sling/trunk/contrib/extensions/contextaware-config/impl/src/test/java/org/apache/sling/caconfig/override/impl/OverrideItemTest.java (added)
+++ sling/trunk/contrib/extensions/contextaware-config/impl/src/test/java/org/apache/sling/caconfig/override/impl/OverrideItemTest.java Fri Nov 18 23:42:02 2016
@@ -0,0 +1,59 @@
+/*
+ * 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.sling.caconfig.override.impl;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import java.util.Map;
+
+import org.junit.Before;
+import org.junit.Test;
+
+import com.google.common.collect.ImmutableMap;
+
+public class OverrideItemTest {
+    
+    private Map<String,Object> props;
+    private OverrideItem underTest;
+    
+    @Before
+    public void setUp() {
+        props = ImmutableMap.<String,Object>of("p1", "abc", "p2", 55);
+        underTest = new OverrideItem("/a/b", "c/d", props, true);
+    }
+
+    @Test
+    public void testProperties() {
+        assertEquals("/a/b", underTest.getPath());
+        assertEquals("c/d", underTest.getConfigName());
+        assertEquals(props, underTest.getProperties());
+        assertTrue(underTest.isAllProperties());
+    }
+
+    @Test
+    public void testMatchesPath() {
+        assertTrue(underTest.matchesPath("/a/b"));
+        assertTrue(underTest.matchesPath("/a/b/c/d"));
+        assertFalse(underTest.matchesPath("/a"));
+        assertFalse(underTest.matchesPath("/other"));
+    }
+
+}

Propchange: sling/trunk/contrib/extensions/contextaware-config/impl/src/test/java/org/apache/sling/caconfig/override/impl/OverrideItemTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sling/trunk/contrib/extensions/contextaware-config/impl/src/test/java/org/apache/sling/caconfig/override/impl/OverrideItemTest.java
------------------------------------------------------------------------------
--- svn:keywords (added)
+++ svn:keywords Fri Nov 18 23:42:02 2016
@@ -0,0 +1 @@
+LastChangedDate LastChangedRevision LastChangedBy HeadURL Id Author

Propchange: sling/trunk/contrib/extensions/contextaware-config/impl/src/test/java/org/apache/sling/caconfig/override/impl/OverrideItemTest.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: sling/trunk/contrib/extensions/contextaware-config/impl/src/test/java/org/apache/sling/caconfig/override/impl/OverrideStringParserTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/contextaware-config/impl/src/test/java/org/apache/sling/caconfig/override/impl/OverrideStringParserTest.java?rev=1770448&view=auto
==============================================================================
--- sling/trunk/contrib/extensions/contextaware-config/impl/src/test/java/org/apache/sling/caconfig/override/impl/OverrideStringParserTest.java (added)
+++ sling/trunk/contrib/extensions/contextaware-config/impl/src/test/java/org/apache/sling/caconfig/override/impl/OverrideStringParserTest.java Fri Nov 18 23:42:02 2016
@@ -0,0 +1,225 @@
+/*
+ * 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.sling.caconfig.override.impl;
+
+import static org.junit.Assert.assertArrayEquals;
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import java.util.List;
+import java.util.Map;
+
+import org.junit.Test;
+
+import com.google.common.collect.ImmutableList;
+import com.google.common.collect.ImmutableMap;
+
+public class OverrideStringParserTest {
+
+    private static final Map<String,Object> BASICTYPES_MAP = ImmutableMap.<String,Object>builder()
+            .put("param1", "value1")
+            .put("param2", "value2")
+            .put("param3", 555)
+            .put("param4", 1.23d)
+            .put("param5", true)
+            .build();
+    
+    private static final Map<String,Object> BASICTYPES_ARRAY_MAP = ImmutableMap.<String,Object>builder()
+            .put("param1", new String[] { "v1a", "v1b" })
+            .put("param2", new String[] { "v2a", "v2b" })
+            .put("param3", new Integer[] { 555, 666 })
+            .put("param4", new Double[] { 1.23d, 2.34d })
+            .put("param5", new Boolean[] { true, false })
+            .put("param6", new String[0])
+            .build();
+    
+    @Test
+    public void testEmptyList() {
+        List<OverrideItem> result = parse();
+        assertTrue(result.isEmpty());
+    }
+    
+    @Test
+    public void testBasicTypes() {
+        List<OverrideItem> result = parse(
+                "configName/param1=\"value1\"",
+                "configName/param2='value2'",
+                "configName/param3=555",
+                "configName/param4=1.23",
+                "configName/param5=true");
+        
+        assertEquals(1, result.size());
+        OverrideItem item = result.get(0);
+        assertNull(item.getPath());
+        assertEquals("configName", item.getConfigName());
+        assertEquals(BASICTYPES_MAP, item.getProperties());
+        assertFalse(item.isAllProperties());
+    }
+
+    @Test
+    public void testBasicTypesArray() {
+        List<OverrideItem> result = parse(
+                "configName/param1=[\"v1a\",\"v1b\"]",
+                "configName/param2=['v2a','v2b']",
+                "configName/param3=[555,666]",
+                "configName/param4=[1.23,2.34]",
+                "configName/param5=[true,false]",
+                "configName/param6=[]");
+        
+        assertEquals(1, result.size());
+        OverrideItem item = result.get(0);
+        assertNull(item.getPath());
+        assertEquals("configName", item.getConfigName());
+        for (Map.Entry<String,Object> entry : item.getProperties().entrySet()) {
+            assertArrayEquals("array " + entry.getKey(), (Object[])BASICTYPES_ARRAY_MAP.get(entry.getKey()), (Object[])item.getProperties().get(entry.getKey()));
+        }
+        assertFalse(item.isAllProperties());
+    }
+
+    @Test
+    public void testBasicTypesJson() {
+        List<OverrideItem> result = parse(
+                "configName={\"param1\":\"value1\","
+                + "'param2':'value2',"
+                + "param3:555,"
+                + "param4:1.23,"
+                + "param5:true}");
+
+        assertEquals(1, result.size());
+        OverrideItem item = result.get(0);
+        assertNull(item.getPath());
+        assertEquals("configName", item.getConfigName());
+        assertEquals(BASICTYPES_MAP, item.getProperties());
+        assertTrue(item.isAllProperties());
+    }
+
+    @Test
+    public void testBasicTypesJsonArray() {
+        List<OverrideItem> result = parse(
+                "configName={\"param1\":[\"v1a\",\"v1b\"],"
+                + "'param2':['v2a','v2b'],"
+                + "param3:[555,666],"
+                + "param4:[1.23,2.34],"
+                + "param5:[true,false],"
+                + "param6:[]}");
+
+        assertEquals(1, result.size());
+        OverrideItem item = result.get(0);
+        assertNull(item.getPath());
+        assertEquals("configName", item.getConfigName());
+        for (Map.Entry<String,Object> entry : item.getProperties().entrySet()) {
+            assertArrayEquals("array " + entry.getKey(), (Object[])BASICTYPES_ARRAY_MAP.get(entry.getKey()), (Object[])item.getProperties().get(entry.getKey()));
+        }
+        assertTrue(item.isAllProperties());
+    }
+
+    @Test
+    public void testWithPath() {
+        List<OverrideItem> result = parse(
+                "[/a/b]configName/sub1/param1=\"value1\"",
+                "configName/sub2/param2=\"value2\"");
+        
+        assertEquals(2, result.size());
+        
+        OverrideItem item1 = result.get(0);
+        assertEquals("/a/b", item1.getPath());
+        assertEquals("configName/sub1", item1.getConfigName());
+        assertEquals("value1", item1.getProperties().get("param1"));
+        assertFalse(item1.isAllProperties());
+
+        OverrideItem item2 = result.get(1);
+        assertNull(item2.getPath());
+        assertEquals("configName/sub2", item2.getConfigName());
+        assertEquals("value2", item2.getProperties().get("param2"));
+        assertFalse(item2.isAllProperties());
+    }
+
+    @Test
+    public void testCombined() {
+        List<OverrideItem> result = parse(
+                "[/a/b]configName/param1=\"value1\"",
+                "configName/param2=\"value2\"",
+                "[/a/b]configName={\"param1\":\"value1\","
+                        + "'param2':'value2',"
+                        + "param3:555,"
+                        + "param4:1.23,"
+                        + "param5:true}");
+        
+        assertEquals(3, result.size());
+        
+        OverrideItem item1 = result.get(0);
+        assertEquals("/a/b", item1.getPath());
+        assertEquals("configName", item1.getConfigName());
+        assertEquals("value1", item1.getProperties().get("param1"));
+        assertFalse(item1.isAllProperties());
+
+        OverrideItem item2 = result.get(1);
+        assertNull(item2.getPath());
+        assertEquals("configName", item2.getConfigName());
+        assertEquals("value2", item2.getProperties().get("param2"));
+        assertFalse(item2.isAllProperties());
+
+        OverrideItem item3 = result.get(2);
+        assertEquals("/a/b", item3.getPath());
+        assertEquals("configName", item3.getConfigName());
+        assertEquals(BASICTYPES_MAP, item3.getProperties());
+        assertTrue(item3.isAllProperties());
+    }
+
+    @Test
+    public void testInvalidSyntax() {
+        List<OverrideItem> result = parse(
+                "/configName/param1=\"value1\"",
+                "configName/./param1=\"value1\"",
+                "[/a/b]=\"value1\"",
+                "[/a/b]configName=\"value1\"",
+                "[/a/../b]configName/param1=\"value1\"",
+                "[]configName=\"value1\"",
+                "configName/param2:'value2'",
+                "configName/param3",
+                "configName/param3=",
+                "[[/a/b]]configName/param4=1.23",
+                "[a/b]configName/param5=true",
+                "configName/param1=null");
+        
+        // all ignored
+        assertEquals(0, result.size());
+    }
+
+    @Test
+    public void testInvalidJson() {
+        List<OverrideItem> result = parse(
+                "configName1={param1:\"value1\"",
+                "configName1={\"param1/xyz\":\"value1\"}",
+                "configName1={param1:[\"value1\",123]}",
+                "configName2={param1:{\"subparam1\":\"value1\"}}",
+                "configName1={param1:null}",
+                "configName1={'param1:'value1'}");
+
+        // all ignored
+        assertEquals(0, result.size());
+    }
+
+    private List<OverrideItem> parse(String... values) {
+        return ImmutableList.copyOf(OverrideStringParser.parse(ImmutableList.copyOf(values)));
+    }
+
+}

Propchange: sling/trunk/contrib/extensions/contextaware-config/impl/src/test/java/org/apache/sling/caconfig/override/impl/OverrideStringParserTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sling/trunk/contrib/extensions/contextaware-config/impl/src/test/java/org/apache/sling/caconfig/override/impl/OverrideStringParserTest.java
------------------------------------------------------------------------------
--- svn:keywords (added)
+++ svn:keywords Fri Nov 18 23:42:02 2016
@@ -0,0 +1 @@
+LastChangedDate LastChangedRevision LastChangedBy HeadURL Id Author

Propchange: sling/trunk/contrib/extensions/contextaware-config/impl/src/test/java/org/apache/sling/caconfig/override/impl/OverrideStringParserTest.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Added: sling/trunk/contrib/extensions/contextaware-config/impl/src/test/java/org/apache/sling/caconfig/override/impl/SystemPropertyConfigurationOverrideProviderTest.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/contextaware-config/impl/src/test/java/org/apache/sling/caconfig/override/impl/SystemPropertyConfigurationOverrideProviderTest.java?rev=1770448&view=auto
==============================================================================
--- sling/trunk/contrib/extensions/contextaware-config/impl/src/test/java/org/apache/sling/caconfig/override/impl/SystemPropertyConfigurationOverrideProviderTest.java (added)
+++ sling/trunk/contrib/extensions/contextaware-config/impl/src/test/java/org/apache/sling/caconfig/override/impl/SystemPropertyConfigurationOverrideProviderTest.java Fri Nov 18 23:42:02 2016
@@ -0,0 +1,70 @@
+/*
+ * 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.sling.caconfig.override.impl;
+
+import static org.apache.sling.caconfig.override.impl.SystemPropertyConfigurationOverrideProvider.SYSTEM_PROPERTY_PREFIX;
+import static org.junit.Assert.assertTrue;
+
+import java.util.Collection;
+
+import org.apache.sling.testing.mock.sling.junit.SlingContext;
+import org.junit.After;
+import org.junit.Before;
+import org.junit.Rule;
+import org.junit.Test;
+
+public class SystemPropertyConfigurationOverrideProviderTest {
+
+    @Rule
+    public SlingContext context = new SlingContext();
+    
+    @Before
+    public void setUp() {
+        System.setProperty(SYSTEM_PROPERTY_PREFIX + "test/param1", "value1");
+        System.setProperty(SYSTEM_PROPERTY_PREFIX + "[/content]test/param2", "value2");
+    }
+
+    @After
+    public void tearDown() {
+        System.clearProperty(SYSTEM_PROPERTY_PREFIX + "test/param1");
+        System.clearProperty(SYSTEM_PROPERTY_PREFIX + "[/content]test/param2");
+    }
+
+    @Test
+    public void testEnabled() {
+        SystemPropertyConfigurationOverrideProvider provider = context.registerInjectActivateService(
+                new SystemPropertyConfigurationOverrideProvider(),
+                "enabled", true);
+
+        Collection<String> overrides = provider.getOverrideStrings();
+        assertTrue(overrides.contains("test/param1=value1"));
+        assertTrue(overrides.contains("[/content]test/param2=value2"));
+    }
+
+    @Test
+    public void testDisabled() {
+        SystemPropertyConfigurationOverrideProvider provider = context.registerInjectActivateService(
+                new SystemPropertyConfigurationOverrideProvider(),
+                "enabled", false);
+
+        Collection<String> overrides = provider.getOverrideStrings();
+        assertTrue(overrides.isEmpty());
+    }
+
+}

Propchange: sling/trunk/contrib/extensions/contextaware-config/impl/src/test/java/org/apache/sling/caconfig/override/impl/SystemPropertyConfigurationOverrideProviderTest.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sling/trunk/contrib/extensions/contextaware-config/impl/src/test/java/org/apache/sling/caconfig/override/impl/SystemPropertyConfigurationOverrideProviderTest.java
------------------------------------------------------------------------------
--- svn:keywords (added)
+++ svn:keywords Fri Nov 18 23:42:02 2016
@@ -0,0 +1 @@
+LastChangedDate LastChangedRevision LastChangedBy HeadURL Id Author

Propchange: sling/trunk/contrib/extensions/contextaware-config/impl/src/test/java/org/apache/sling/caconfig/override/impl/SystemPropertyConfigurationOverrideProviderTest.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain

Modified: sling/trunk/contrib/extensions/contextaware-config/spi/pom.xml
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/contextaware-config/spi/pom.xml?rev=1770448&r1=1770447&r2=1770448&view=diff
==============================================================================
--- sling/trunk/contrib/extensions/contextaware-config/spi/pom.xml (original)
+++ sling/trunk/contrib/extensions/contextaware-config/spi/pom.xml Fri Nov 18 23:42:02 2016
@@ -54,7 +54,7 @@
             <groupId>org.apache.sling</groupId>
             <artifactId>org.apache.sling.caconfig.api</artifactId>
             <version>1.0.0</version>
-            <scope>provided</scope>
+            <scope>compile</scope>
         </dependency>
         <dependency>
             <groupId>com.google.code.findbugs</groupId>

Modified: sling/trunk/contrib/extensions/contextaware-config/spi/src/main/java/org/apache/sling/caconfig/spi/ConfigurationMetadataProvider.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/contextaware-config/spi/src/main/java/org/apache/sling/caconfig/spi/ConfigurationMetadataProvider.java?rev=1770448&r1=1770447&r2=1770448&view=diff
==============================================================================
--- sling/trunk/contrib/extensions/contextaware-config/spi/src/main/java/org/apache/sling/caconfig/spi/ConfigurationMetadataProvider.java (original)
+++ sling/trunk/contrib/extensions/contextaware-config/spi/src/main/java/org/apache/sling/caconfig/spi/ConfigurationMetadataProvider.java Fri Nov 18 23:42:02 2016
@@ -26,7 +26,7 @@ import org.apache.sling.caconfig.spi.met
 import org.osgi.annotation.versioning.ConsumerType;
 
 /**
- * Allows application to provide the necessary metadata for configurations.
+ * Allows applications to provide the necessary metadata for configurations.
  */
 @ConsumerType
 public interface ConfigurationMetadataProvider {

Added: sling/trunk/contrib/extensions/contextaware-config/spi/src/main/java/org/apache/sling/caconfig/spi/ConfigurationOverrideProvider.java
URL: http://svn.apache.org/viewvc/sling/trunk/contrib/extensions/contextaware-config/spi/src/main/java/org/apache/sling/caconfig/spi/ConfigurationOverrideProvider.java?rev=1770448&view=auto
==============================================================================
--- sling/trunk/contrib/extensions/contextaware-config/spi/src/main/java/org/apache/sling/caconfig/spi/ConfigurationOverrideProvider.java (added)
+++ sling/trunk/contrib/extensions/contextaware-config/spi/src/main/java/org/apache/sling/caconfig/spi/ConfigurationOverrideProvider.java Fri Nov 18 23:42:02 2016
@@ -0,0 +1,45 @@
+/*
+ * 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.sling.caconfig.spi;
+
+import java.util.Collection;
+
+import javax.annotation.Nonnull;
+
+import org.osgi.annotation.versioning.ConsumerType;
+
+/**
+ * Provide information to override configuration data.
+ */
+@ConsumerType
+public interface ConfigurationOverrideProvider {
+
+    /**
+     * Get override strings. Syntax examples:
+     * <ul>
+     * <li><code>{configName}/{propertyName}={propertyJsonValue}</code></li>
+     * <li><code>{configName}={propertyJsonObject}</code></li>
+     * <li><code>[{contextPath}]{configName}/{propertyName}={propertyJsonValue}</code></li>
+     * <li><code>[{contextPath}]{configName}={propertyJsonObject}</code></li>
+     * </ul>
+     * @return Override strings
+     */
+    @Nonnull Collection<String> getOverrideStrings();
+
+}

Propchange: sling/trunk/contrib/extensions/contextaware-config/spi/src/main/java/org/apache/sling/caconfig/spi/ConfigurationOverrideProvider.java
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: sling/trunk/contrib/extensions/contextaware-config/spi/src/main/java/org/apache/sling/caconfig/spi/ConfigurationOverrideProvider.java
------------------------------------------------------------------------------
--- svn:keywords (added)
+++ svn:keywords Fri Nov 18 23:42:02 2016
@@ -0,0 +1 @@
+LastChangedDate LastChangedRevision LastChangedBy HeadURL Id Author

Propchange: sling/trunk/contrib/extensions/contextaware-config/spi/src/main/java/org/apache/sling/caconfig/spi/ConfigurationOverrideProvider.java
------------------------------------------------------------------------------
    svn:mime-type = text/plain