You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@sling.apache.org by ro...@apache.org on 2017/11/07 09:18:50 UTC
[sling-org-apache-sling-caconfig-api] 04/24: SLING-5886 : Remove
SPI for now
This is an automated email from the ASF dual-hosted git repository.
rombert pushed a commit to annotated tag org.apache.sling.caconfig.api-1.0.0
in repository https://gitbox.apache.org/repos/asf/sling-org-apache-sling-caconfig-api.git
commit c6694269fb7fb100ee3abd34e650dd2f468cf25e
Author: Carsten Ziegeler <cz...@apache.org>
AuthorDate: Fri Jul 29 13:14:49 2016 +0000
SLING-5886 : Remove SPI for now
git-svn-id: https://svn.apache.org/repos/asf/sling/trunk/contrib/extensions/context-aware-config/api@1754517 13f79535-47bb-0310-9956-ffa450edef68
---
.../config/spi/ConfigurationMetadataProvider.java | 39 ----------
.../config/spi/ConfigurationOverrideProvider.java | 68 -----------------
.../spi/ConfigurationPersistenceProvider.java | 60 ---------------
.../config/spi/ContextPathStrategy.java | 44 -----------
.../spi/metadata/AbstractConfigurationPart.java | 65 ----------------
.../config/spi/metadata/ConfigurationMetadata.java | 73 ------------------
.../config/spi/metadata/ConfigurationPart.java | 44 -----------
.../config/spi/metadata/PropertyMetadata.java | 86 ----------------------
.../config/spi/metadata/package-info.java | 23 ------
.../contextaware/config/spi/package-info.java | 23 ------
.../spi/metadata/ConfigurationMetadataTest.java | 62 ----------------
.../config/spi/metadata/PropertyMetadataTest.java | 53 -------------
12 files changed, 640 deletions(-)
diff --git a/src/main/java/org/apache/sling/contextaware/config/spi/ConfigurationMetadataProvider.java b/src/main/java/org/apache/sling/contextaware/config/spi/ConfigurationMetadataProvider.java
deleted file mode 100644
index a260aca..0000000
--- a/src/main/java/org/apache/sling/contextaware/config/spi/ConfigurationMetadataProvider.java
+++ /dev/null
@@ -1,39 +0,0 @@
-/*
- * 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.contextaware.config.spi;
-
-import java.util.Collection;
-
-import javax.annotation.Nonnull;
-
-import org.apache.sling.contextaware.config.spi.metadata.ConfigurationMetadata;
-import org.osgi.annotation.versioning.ConsumerType;
-
-/**
- * Allows application to provide the necessary metadata for configurations.
- */
-@ConsumerType
-public interface ConfigurationMetadataProvider {
-
- /**
- * @return Configuration metadata that the application defines
- */
- @Nonnull Collection<ConfigurationMetadata> getConfigSets();
-
-}
diff --git a/src/main/java/org/apache/sling/contextaware/config/spi/ConfigurationOverrideProvider.java b/src/main/java/org/apache/sling/contextaware/config/spi/ConfigurationOverrideProvider.java
deleted file mode 100644
index acd4d66..0000000
--- a/src/main/java/org/apache/sling/contextaware/config/spi/ConfigurationOverrideProvider.java
+++ /dev/null
@@ -1,68 +0,0 @@
-/*
- * 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.contextaware.config.spi;
-
-import java.util.Map;
-
-import javax.annotation.Nonnull;
-
-import org.osgi.annotation.versioning.ConsumerType;
-
-/**
- * Provides configuration override values (default or forced).
- */
-@ConsumerType
-public interface ConfigurationOverrideProvider {
-
- /**
- * Returns a map with key value pairs for configuration parameter override.
- * <p>
- * Key:
- * </p>
- * <ul>
- * <li>Syntax: <code>[{scope}[:locked]]{configName}/{propertyName}</code></li>
- * <li><code>{scope}</code>: if "default", the system default parameter is overridden. Otherwise <code>{scope}</code>
- * may define a context path, in this case the configuration set's property value is overwritten by force for this
- * context path. If the [{scope}] part is missing or [locked], the parameter is overridden for all context paths.</li>
- * <li><code>locked</code>: If the scope value is suffixed with the string ":locked" this configuration
- * parameter cannot be overridden in nested configuration scopes.</li>
- * <li><code>{configName}</code>: Configuration name</li>
- * <li><code>{propertyName}</code>: Configuration property name</li>
- * </ul>
- * <p>
- * Examples:
- * </p>
- * <ul>
- * <li><code>[default]set1/param1</code> - Override default value for property "param1" from set "set1"</li>
- * <li><code>set1/param1</code> - Override value for property "param1" from set "set1" for all context paths</li>
- * <li><code>[/content/region1/site1]set1/param1</code> - Override value for property "param1" from set "set1" for the context path
- * <code>/content/region1/site1</code>. This has higher precedence than the other variants.</li>
- * </ul>
- * <p>
- * Value:
- * </p>
- * <ul>
- * <li>Override value</li>
- * <li>Has to be convertible to the property's type</li>
- * </ul>
- * @return Map
- */
- @Nonnull Map<String, String> getOverrideMap();
-
-}
diff --git a/src/main/java/org/apache/sling/contextaware/config/spi/ConfigurationPersistenceProvider.java b/src/main/java/org/apache/sling/contextaware/config/spi/ConfigurationPersistenceProvider.java
deleted file mode 100644
index e62b520..0000000
--- a/src/main/java/org/apache/sling/contextaware/config/spi/ConfigurationPersistenceProvider.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- * 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.contextaware.config.spi;
-
-import java.util.Map;
-
-import javax.annotation.Nonnull;
-
-import org.apache.sling.api.resource.PersistenceException;
-import org.apache.sling.api.resource.ResourceResolver;
-import org.osgi.annotation.versioning.ConsumerType;
-
-/**
- * Provides configuration persistence implementations.
- */
-@ConsumerType
-public interface ConfigurationPersistenceProvider {
-
- /**
- * Get all configuration values stored for a context path.
- * @param resolver Resource resolver
- * @param contextPath Context path
- * @param configNames If a set of config names is given only configuration for these names is returned.
- * Otherwise all are returned.
- * @return Configuration names with value map containing the configuration set properties.
- * Returns null if no parameters stored for this context paths, allowing other
- * persistence providers to step in.
- */
- Map<String, Map<String, Object>> get(@Nonnull ResourceResolver resolver, @Nonnull String contextPath, String... configNames);
-
- /**
- * Writes configuration values for a context paths. For each configuration name contained in the values map all existing
- * parameter values are erased before writing the new ones.
- * @param resolver Resource resolver
- * @param contextPath Context path
- * @param values Configuration names with value map containing the configuration set properties.
- * @return true if configurations are accepted. false if this provider does not accept storing
- * the configurations and the next provider should be asked to store them.
- * @throws PersistenceException Persistence exception is thrown when storing configurations failed.
- */
- boolean store(@Nonnull ResourceResolver resolver, @Nonnull String contextPath, @Nonnull String configName,
- @Nonnull Map<String, Map<String, Object>> values) throws PersistenceException;
-
-}
diff --git a/src/main/java/org/apache/sling/contextaware/config/spi/ContextPathStrategy.java b/src/main/java/org/apache/sling/contextaware/config/spi/ContextPathStrategy.java
deleted file mode 100644
index 6935013..0000000
--- a/src/main/java/org/apache/sling/contextaware/config/spi/ContextPathStrategy.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * 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.contextaware.config.spi;
-
-import java.util.Collection;
-
-import javax.annotation.Nonnull;
-
-import org.apache.sling.api.resource.Resource;
-import org.osgi.annotation.versioning.ConsumerType;
-
-/**
- * Allows application to define a strategy to find context paths for content paths.
- * Each context path may have it's own context-specific configuration.
- */
-@ConsumerType
-public interface ContextPathStrategy {
-
- /**
- * Finds context paths for the given context resource.
- * @param resource Context resource
- * @return Context paths that where detected in the given path
- * (in order of closest matching first).
- * If none are found an empty list is returned.
- */
- @Nonnull Collection<String> findContextPaths(@Nonnull Resource resource);
-
-}
diff --git a/src/main/java/org/apache/sling/contextaware/config/spi/metadata/AbstractConfigurationPart.java b/src/main/java/org/apache/sling/contextaware/config/spi/metadata/AbstractConfigurationPart.java
deleted file mode 100644
index 2b7fa39..0000000
--- a/src/main/java/org/apache/sling/contextaware/config/spi/metadata/AbstractConfigurationPart.java
+++ /dev/null
@@ -1,65 +0,0 @@
-/*
- * 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.contextaware.config.spi.metadata;
-
-import java.util.HashMap;
-
-import javax.annotation.Nonnull;
-
-import org.apache.sling.api.resource.ValueMap;
-import org.apache.sling.api.wrappers.ValueMapDecorator;
-import org.osgi.annotation.versioning.ProviderType;
-
-/**
- * Defines a configuration set.
- */
-@ProviderType
-abstract class AbstractConfigurationPart implements ConfigurationPart {
-
- private final String name;
- private final ValueMap properties = new ValueMapDecorator(new HashMap<String, Object>());
-
- public AbstractConfigurationPart(@Nonnull String name) {
- if (name == null || !ConfigurationPart.NAME_PATTERN.matcher(name).matches()) {
- throw new IllegalArgumentException("Invalid name: " + name);
- }
- this.name = name;
- }
-
- /**
- * @return Parameter name
- */
- public @Nonnull String getName() {
- return this.name;
- }
-
- /**
- * @return Further properties for documentation and configuration of
- * behavior in configuration editor.
- */
- public @Nonnull ValueMap getProperties() {
- return this.properties;
- }
-
- @Override
- public String toString() {
- return this.name;
- }
-
-}
diff --git a/src/main/java/org/apache/sling/contextaware/config/spi/metadata/ConfigurationMetadata.java b/src/main/java/org/apache/sling/contextaware/config/spi/metadata/ConfigurationMetadata.java
deleted file mode 100644
index 91a7480..0000000
--- a/src/main/java/org/apache/sling/contextaware/config/spi/metadata/ConfigurationMetadata.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- * 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.contextaware.config.spi.metadata;
-
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-
-import javax.annotation.Nonnull;
-
-import org.osgi.annotation.versioning.ProviderType;
-
-/**
- * Defines a configuration set.
- */
-@ProviderType
-public final class ConfigurationMetadata extends AbstractConfigurationPart {
-
- private boolean isList;
- private final List<ConfigurationPart> parts = new ArrayList<>();
-
- /**
- * @param name Configuration name
- */
- public ConfigurationMetadata(@Nonnull String name) {
- super(name);
- }
-
- /**
- * @return true if configuration is singleton
- */
- public boolean isSingleton() {
- return !isList;
- }
-
- /**
- * @return true if configuration is list
- */
- public boolean isList() {
- return isList;
- }
-
- /**
- * @param isList true if configuration is list
- */
- public void setList(boolean isList) {
- this.isList = isList;
- }
-
- /**
- * @return Configuration set parts
- */
- public @Nonnull Collection<ConfigurationPart> getParts() {
- return this.parts;
- }
-
-}
diff --git a/src/main/java/org/apache/sling/contextaware/config/spi/metadata/ConfigurationPart.java b/src/main/java/org/apache/sling/contextaware/config/spi/metadata/ConfigurationPart.java
deleted file mode 100644
index 23be0c5..0000000
--- a/src/main/java/org/apache/sling/contextaware/config/spi/metadata/ConfigurationPart.java
+++ /dev/null
@@ -1,44 +0,0 @@
-/*
- * 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.contextaware.config.spi.metadata;
-
-import java.util.regex.Pattern;
-
-import javax.annotation.Nonnull;
-
-import org.osgi.annotation.versioning.ProviderType;
-
-/**
- * Part of configuration set.
- */
-@ProviderType
-public interface ConfigurationPart {
-
- /**
- * Pattern for allowed configuration part names.
- */
- Pattern NAME_PATTERN = Pattern.compile("^[a-zA-Z0-9\\-\\_\\.]+(/[a-zA-Z0-9\\-\\_\\.]+)*$");
-
- /**
- * Configuration part name
- * @return
- */
- @Nonnull String getName();
-
-}
diff --git a/src/main/java/org/apache/sling/contextaware/config/spi/metadata/PropertyMetadata.java b/src/main/java/org/apache/sling/contextaware/config/spi/metadata/PropertyMetadata.java
deleted file mode 100644
index e6ed34d..0000000
--- a/src/main/java/org/apache/sling/contextaware/config/spi/metadata/PropertyMetadata.java
+++ /dev/null
@@ -1,86 +0,0 @@
-/*
- * 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.contextaware.config.spi.metadata;
-
-import javax.annotation.Nonnull;
-
-import org.osgi.annotation.versioning.ProviderType;
-
-/**
- * Defines a configuration property.
- * @param <T> Property value type
- */
-@ProviderType
-public final class PropertyMetadata<T> extends AbstractConfigurationPart {
-
- private static final Class<?>[] SUPPORTED_TYPES = {
- String.class, String[].class,
- Integer.class, Integer[].class,
- Long.class, Long[].class,
- Double.class, Double[].class,
- Boolean.class, Boolean[].class
- };
-
- private final Class<T> type;
- private T defaultValue;
-
- public PropertyMetadata(@Nonnull String name, @Nonnull Class<T> type) {
- super(name);
- if (type == null || !isSupportedType(type)) {
- throw new IllegalArgumentException("Invalid parameter type: " + type);
- }
- this.type = type;
- }
-
- private boolean isSupportedType(Class<T> paramType) {
- for (Class<?> type : SUPPORTED_TYPES) {
- if (type.equals(paramType)) {
- return true;
- }
- }
- return false;
- }
-
- /**
- * @return Parameter type
- */
- public @Nonnull Class<T> getType() {
- return this.type;
- }
-
- /**
- * @return Default value if parameter is not set for configuration
- */
- public T getDefaultValue() {
- return this.defaultValue;
- }
-
- /**
- * @param value Default value if parameter is not set for configuration
- */
- public void setDefaultValue(T value) {
- this.defaultValue = value;
- }
-
- @Override
- public String toString() {
- return getName() + "[" + this.type.getSimpleName() + "]";
- }
-
-}
diff --git a/src/main/java/org/apache/sling/contextaware/config/spi/metadata/package-info.java b/src/main/java/org/apache/sling/contextaware/config/spi/metadata/package-info.java
deleted file mode 100644
index 0372745..0000000
--- a/src/main/java/org/apache/sling/contextaware/config/spi/metadata/package-info.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * 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.
- */
-/**
- * Defining configuration and parameter metadata for the SPI.
- */
-@org.osgi.annotation.versioning.Version("1.0.0")
-package org.apache.sling.contextaware.config.spi.metadata;
diff --git a/src/main/java/org/apache/sling/contextaware/config/spi/package-info.java b/src/main/java/org/apache/sling/contextaware/config/spi/package-info.java
deleted file mode 100644
index 76033c3..0000000
--- a/src/main/java/org/apache/sling/contextaware/config/spi/package-info.java
+++ /dev/null
@@ -1,23 +0,0 @@
-/*
- * 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.
- */
-/**
- * SPI for applications hooking into the configuration infrastructure for parameterizing and customizing.
- */
-@org.osgi.annotation.versioning.Version("1.0.0")
-package org.apache.sling.contextaware.config.spi;
diff --git a/src/test/java/org/apache/sling/contextaware/config/spi/metadata/ConfigurationMetadataTest.java b/src/test/java/org/apache/sling/contextaware/config/spi/metadata/ConfigurationMetadataTest.java
deleted file mode 100644
index 556337a..0000000
--- a/src/test/java/org/apache/sling/contextaware/config/spi/metadata/ConfigurationMetadataTest.java
+++ /dev/null
@@ -1,62 +0,0 @@
-/*
- * 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.contextaware.config.spi.metadata;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertFalse;
-import static org.junit.Assert.assertTrue;
-
-import org.apache.sling.contextaware.config.spi.metadata.ConfigurationMetadata;
-import org.apache.sling.contextaware.config.spi.metadata.PropertyMetadata;
-import org.junit.Test;
-
-public class ConfigurationMetadataTest {
-
- @Test
- public void testSimple() {
- ConfigurationMetadata underTest = new ConfigurationMetadata("hier1/set1");
- assertEquals("hier1/set1", underTest.getName());
- assertTrue(underTest.isSingleton());
- assertFalse(underTest.isList());
-
- underTest.getProperties().put("p1", "v1");
- assertEquals("v1", underTest.getProperties().get("p1", String.class));
-
- underTest.getParts().add(new PropertyMetadata<String>("param1", String.class));
- underTest.getParts().add(new PropertyMetadata<Integer>("param2", Integer.class));
- underTest.getParts().add(new ConfigurationMetadata("set1"));
-
- assertEquals(3, underTest.getParts().size());
- }
-
- @Test
- public void testList() {
- ConfigurationMetadata underTest = new ConfigurationMetadata("hier1/set1");
- underTest.setList(true);
- assertEquals("hier1/set1", underTest.getName());
- assertFalse(underTest.isSingleton());
- assertTrue(underTest.isList());
- }
-
- @Test(expected = IllegalArgumentException.class)
- public void testInvalidName() {
- new ConfigurationMetadata("$illegal name");
- }
-
-}
diff --git a/src/test/java/org/apache/sling/contextaware/config/spi/metadata/PropertyMetadataTest.java b/src/test/java/org/apache/sling/contextaware/config/spi/metadata/PropertyMetadataTest.java
deleted file mode 100644
index 66ae8b3..0000000
--- a/src/test/java/org/apache/sling/contextaware/config/spi/metadata/PropertyMetadataTest.java
+++ /dev/null
@@ -1,53 +0,0 @@
-/*
- * 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.contextaware.config.spi.metadata;
-
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNull;
-
-import org.apache.sling.contextaware.config.spi.metadata.PropertyMetadata;
-import org.junit.Test;
-
-public class PropertyMetadataTest {
-
- @Test
- public void testValid() {
- PropertyMetadata<String> underTest = new PropertyMetadata<String>("testParam", String.class);
- assertEquals("testParam", underTest.getName());
- assertEquals(String.class, underTest.getType());
- assertNull(underTest.getDefaultValue());
-
- underTest.getProperties().put("p1", "v1");
- assertEquals("v1", underTest.getProperties().get("p1", String.class));
-
- underTest.setDefaultValue("defValue");
- assertEquals("defValue", underTest.getDefaultValue());
- }
-
- @Test(expected = IllegalArgumentException.class)
- public void testInvalidName() {
- new PropertyMetadata<String>("$illegal name", String.class);
- }
-
- @Test(expected = IllegalArgumentException.class)
- public void testInvalidType() {
- new PropertyMetadata<Object>("testParam", Object.class);
- }
-
-}
--
To stop receiving notification emails like this one, please contact
"commits@sling.apache.org" <co...@sling.apache.org>.