jackrabbit-oak-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ang...@apache.org
Subject svn commit: r1582295 - in /jackrabbit/oak/trunk/oak-core/src: main/java/org/apache/jackrabbit/oak/security/ main/java/org/apache/jackrabbit/oak/spi/security/ test/java/org/apache/jackrabbit/oak/security/authentication/token/ test/java/org/apache/jackra...
Date Thu, 27 Mar 2014 13:20:56 GMT
Author: angela
Date: Thu Mar 27 13:20:56 2014
New Revision: 1582295

URL: http://svn.apache.org/r1582295
Log:
OAK-1622 

Duplicate configuration services (regression of OAK-1476) 

Added:
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authentication/token/CompositeTokenConfigurationTest.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/spi/security/AbstractCompositeConfigurationTest.java
Modified:
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/SecurityProviderImpl.java
    jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/CompositeConfiguration.java
    jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authentication/token/TokenConfigurationImplTest.java

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/SecurityProviderImpl.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/SecurityProviderImpl.java?rev=1582295&r1=1582294&r2=1582295&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/SecurityProviderImpl.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/security/SecurityProviderImpl.java
Thu Mar 27 13:20:56 2014
@@ -19,10 +19,10 @@ package org.apache.jackrabbit.oak.securi
 import java.util.HashSet;
 import java.util.Map;
 import java.util.Set;
-
 import javax.annotation.Nonnull;
 import javax.annotation.Nullable;
 
+import com.google.common.collect.ImmutableMap;
 import org.apache.felix.scr.annotations.Activate;
 import org.apache.felix.scr.annotations.Component;
 import org.apache.felix.scr.annotations.Deactivate;
@@ -58,8 +58,6 @@ import org.apache.jackrabbit.oak.spi.whi
 import org.apache.jackrabbit.oak.spi.whiteboard.WhiteboardRestrictionProvider;
 import org.osgi.framework.BundleContext;
 
-import com.google.common.collect.ImmutableMap;
-
 import static com.google.common.base.Preconditions.checkNotNull;
 
 @Component
@@ -83,17 +81,14 @@ public class SecurityProviderImpl implem
             bind = "bindPrincipalConfiguration",
             unbind = "unbindPrincipalConfiguration",
             cardinality = ReferenceCardinality.OPTIONAL_MULTIPLE)
-    private final CompositePrincipalConfiguration compositePrincipalConfiguration = new CompositePrincipalConfiguration(this);
-    private volatile PrincipalConfiguration principalConfiguration;
+    private final CompositePrincipalConfiguration principalConfiguration = new CompositePrincipalConfiguration(this);
 
     @Reference(referenceInterface = TokenConfiguration.class,
             name = "tokenConfiguration",
             bind = "bindTokenConfiguration",
             unbind = "unbindTokenConfiguration",
             cardinality = ReferenceCardinality.OPTIONAL_MULTIPLE)
-    private final CompositeTokenConfiguration compositeTokenConfiguration = new CompositeTokenConfiguration(this);
-    private volatile TokenConfiguration tokenConfiguration;
-
+    private final CompositeTokenConfiguration tokenConfiguration = new CompositeTokenConfiguration(this);
 
     @Reference(referenceInterface = AuthorizableNodeName.class,
             name = "authorizableNodeName",
@@ -117,7 +112,9 @@ public class SecurityProviderImpl implem
     }
 
     /**
-     * Constructor used for non OSGi environments.
+     * Create a new {@code SecurityProvider} instance with the given configuration
+     * parameters.
+     *
      * @param configuration security configuration
      */
     public SecurityProviderImpl(@Nonnull ConfigurationParameters configuration) {
@@ -127,9 +124,10 @@ public class SecurityProviderImpl implem
         authenticationConfiguration = new AuthenticationConfigurationImpl(this);
         authorizationConfiguration = new AuthorizationConfigurationImpl(this);
         userConfiguration = new UserConfigurationImpl(this);
-        principalConfiguration = new PrincipalConfigurationImpl(this);
         privilegeConfiguration = new PrivilegeConfigurationImpl();
-        tokenConfiguration = new TokenConfigurationImpl(this);
+
+        principalConfiguration.setDefaultConfig(new PrincipalConfigurationImpl(this));
+        tokenConfiguration.setDefaultConfig(new TokenConfigurationImpl(this));
     }
 
     @Override
@@ -191,6 +189,7 @@ public class SecurityProviderImpl implem
         }
     }
 
+    //----------------------------------------------------------------< SCR >---
     @Activate
     protected void activate(BundleContext context) throws Exception {
         whiteboard = new OsgiWhiteboard(context);
@@ -206,49 +205,51 @@ public class SecurityProviderImpl implem
         restrictionProvider.stop();
     }
 
-    private void initializeConfigurations() {
-        Map<String, WhiteboardRestrictionProvider> authorizMap = ImmutableMap.of(
-                AccessControlConstants.PARAM_RESTRICTION_PROVIDER, restrictionProvider
-        );
-        // also add authorization config specific default parameters for OSGi environments
-        // todo: the config class should track the 'restrictionProvider' itself.
-        initConfiguration(authorizationConfiguration, ConfigurationParameters.of(authorizMap));
-
-        initConfiguration(authenticationConfiguration, ConfigurationParameters.EMPTY);
-
-        // also initialize user config specific default parameters for OSGi environments
-        // todo: the config class should track the 'providers' itself.
-        Map<String, Object> userMap = ImmutableMap.of(
-                UserConstants.PARAM_AUTHORIZABLE_ACTION_PROVIDER, authorizableActionProvider,
-                UserConstants.PARAM_AUTHORIZABLE_NODE_NAME, nameGenerator);
-        initConfiguration(userConfiguration, ConfigurationParameters.of(userMap));
-
-        initConfiguration(privilegeConfiguration, ConfigurationParameters.EMPTY);
-
-        principalConfiguration = compositePrincipalConfiguration;
-        tokenConfiguration = compositeTokenConfiguration;
-    }
-
     protected void bindPrincipalConfiguration(@Nonnull PrincipalConfiguration reference)
{
-        compositePrincipalConfiguration.addConfiguration(initConfiguration(reference, ConfigurationParameters.EMPTY));
+        principalConfiguration.addConfiguration(initConfiguration(reference));
     }
 
     protected void unbindPrincipalConfiguration(@Nonnull PrincipalConfiguration reference)
{
-        compositePrincipalConfiguration.removeConfiguration(reference);
+        principalConfiguration.removeConfiguration(reference);
     }
 
     protected void bindTokenConfiguration(@Nonnull TokenConfiguration reference) {
-        compositeTokenConfiguration.addConfiguration(initConfiguration(reference, ConfigurationParameters.EMPTY));
+        tokenConfiguration.addConfiguration(initConfiguration(reference));
     }
 
     protected void unbindTokenConfiguration(@Nonnull TokenConfiguration reference) {
-        compositeTokenConfiguration.removeConfiguration(reference);
+        tokenConfiguration.removeConfiguration(reference);
     }
 
     protected void bindAuthorizableNodeName(@Nonnull AuthorizableNodeName reference) {
         nameGenerator.dlg = reference;
     }
 
+    //------------------------------------------------------------< private >---
+    private void initializeConfigurations() {
+        Map<String, WhiteboardRestrictionProvider> authorizMap = ImmutableMap.of(
+                AccessControlConstants.PARAM_RESTRICTION_PROVIDER, restrictionProvider
+        );
+        initConfiguration(authorizationConfiguration, ConfigurationParameters.of(authorizMap));
+
+        Map<String, Object> userMap = ImmutableMap.of(
+                UserConstants.PARAM_AUTHORIZABLE_ACTION_PROVIDER, authorizableActionProvider,
+                UserConstants.PARAM_AUTHORIZABLE_NODE_NAME, nameGenerator);
+        initConfiguration(userConfiguration, ConfigurationParameters.of(userMap));
+
+        initConfiguration(authenticationConfiguration);
+        initConfiguration(privilegeConfiguration);
+    }
+
+    private <T extends SecurityConfiguration> T initConfiguration(@Nonnull T config)
{
+        if (config instanceof ConfigurationBase) {
+            ConfigurationBase cfg = (ConfigurationBase) config;
+            cfg.setSecurityProvider(this);
+            cfg.setParameters(ConfigurationParameters.of(ConfigurationParameters.EMPTY, cfg.getParameters()));
+        }
+        return config;
+    }
+
     private <T extends SecurityConfiguration> T initConfiguration(@Nonnull T config,
@Nonnull ConfigurationParameters params) {
         if (config instanceof ConfigurationBase) {
             ConfigurationBase cfg = (ConfigurationBase) config;

Modified: jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/CompositeConfiguration.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/CompositeConfiguration.java?rev=1582295&r1=1582294&r2=1582295&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/CompositeConfiguration.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/main/java/org/apache/jackrabbit/oak/spi/security/CompositeConfiguration.java
Thu Mar 27 13:20:56 2014
@@ -53,11 +53,17 @@ public abstract class CompositeConfigura
     private final String name;
     private final SecurityProvider securityProvider;
 
+    private T defaultConfig;
+
     public CompositeConfiguration(@Nonnull String name, @Nonnull SecurityProvider securityProvider)
{
         this.name = name;
         this.securityProvider = securityProvider;
     }
 
+    public void setDefaultConfig(@Nonnull T defaultConfig) {
+        this.defaultConfig = defaultConfig;
+    }
+
     public void addConfiguration(@Nonnull T configuration) {
         configurations.add(configuration);
     }
@@ -67,7 +73,11 @@ public abstract class CompositeConfigura
     }
 
     protected List<T> getConfigurations() {
-        return ImmutableList.copyOf(configurations);
+        if (configurations.isEmpty() && defaultConfig != null) {
+            return ImmutableList.of(defaultConfig);
+        } else {
+            return ImmutableList.copyOf(configurations);
+        }
     }
 
     protected SecurityProvider getSecurityProvider() {
@@ -84,9 +94,10 @@ public abstract class CompositeConfigura
     @Nonnull
     @Override
     public ConfigurationParameters getParameters() {
-        ConfigurationParameters[] params = new ConfigurationParameters[configurations.size()];
-        for (int i = 0; i < configurations.size(); i++) {
-            params[i] = configurations.get(i).getParameters();
+        List<T> configs = getConfigurations();
+        ConfigurationParameters[] params = new ConfigurationParameters[configs.size()];
+        for (int i = 0; i < configs.size(); i++) {
+            params[i] = configs.get(i).getParameters();
         }
         return ConfigurationParameters.of(params);
     }
@@ -94,7 +105,7 @@ public abstract class CompositeConfigura
     @Nonnull
     @Override
     public WorkspaceInitializer getWorkspaceInitializer() {
-        return new CompositeWorkspaceInitializer(Lists.transform(configurations, new Function<T,
WorkspaceInitializer>() {
+        return new CompositeWorkspaceInitializer(Lists.transform(getConfigurations(), new
Function<T, WorkspaceInitializer>() {
             @Override
             public WorkspaceInitializer apply(T securityConfiguration) {
                 return securityConfiguration.getWorkspaceInitializer();
@@ -105,7 +116,7 @@ public abstract class CompositeConfigura
     @Nonnull
     @Override
     public RepositoryInitializer getRepositoryInitializer() {
-        return new CompositeInitializer(Lists.transform(configurations, new Function<T,
RepositoryInitializer>() {
+        return new CompositeInitializer(Lists.transform(getConfigurations(), new Function<T,
RepositoryInitializer>() {
             @Override
             public RepositoryInitializer apply(T securityConfiguration) {
                 return securityConfiguration.getRepositoryInitializer();
@@ -116,7 +127,7 @@ public abstract class CompositeConfigura
     @Nonnull
     @Override
     public List<? extends CommitHook> getCommitHooks(final String workspaceName) {
-        return ImmutableList.copyOf(Iterables.concat(Lists.transform(configurations, new
Function<T, List<? extends CommitHook>>() {
+        return ImmutableList.copyOf(Iterables.concat(Lists.transform(getConfigurations(),
new Function<T, List<? extends CommitHook>>() {
             @Override
             public List<? extends CommitHook> apply(T securityConfiguration) {
                 return securityConfiguration.getCommitHooks(workspaceName);
@@ -127,7 +138,7 @@ public abstract class CompositeConfigura
     @Nonnull
     @Override
     public List<? extends ValidatorProvider> getValidators(final String workspaceName,
final Set<Principal> principals, final MoveTracker moveTracker) {
-        return ImmutableList.copyOf(Iterables.concat(Lists.transform(configurations, new
Function<T, List<? extends ValidatorProvider>>() {
+        return ImmutableList.copyOf(Iterables.concat(Lists.transform(getConfigurations(),
new Function<T, List<? extends ValidatorProvider>>() {
             @Override
             public List<? extends ValidatorProvider> apply(T securityConfiguration)
{
                 return securityConfiguration.getValidators(workspaceName, principals, moveTracker);
@@ -138,7 +149,7 @@ public abstract class CompositeConfigura
     @Nonnull
     @Override
     public List<ProtectedItemImporter> getProtectedItemImporters() {
-        return ImmutableList.copyOf(Iterables.concat(Lists.transform(configurations, new
Function<T, List<? extends ProtectedItemImporter>>() {
+        return ImmutableList.copyOf(Iterables.concat(Lists.transform(getConfigurations(),
new Function<T, List<? extends ProtectedItemImporter>>() {
             @Override
             public List<? extends ProtectedItemImporter> apply(T securityConfiguration)
{
                 return securityConfiguration.getProtectedItemImporters();
@@ -148,11 +159,12 @@ public abstract class CompositeConfigura
 
     @Override
     public Context getContext() {
+        final List<T> configs = getConfigurations();
         return new Context() {
 
             @Override
             public boolean definesProperty(@Nonnull Tree parent, @Nonnull PropertyState property)
{
-                for (SecurityConfiguration sc : configurations) {
+                for (SecurityConfiguration sc : configs) {
                     if (sc.getContext().definesProperty(parent, property)) {
                         return true;
                     }
@@ -162,7 +174,7 @@ public abstract class CompositeConfigura
 
             @Override
             public boolean definesContextRoot(@Nonnull Tree tree) {
-                for (SecurityConfiguration sc : configurations) {
+                for (SecurityConfiguration sc : configs) {
                     if (sc.getContext().definesContextRoot(tree)) {
                         return true;
                     }
@@ -172,7 +184,7 @@ public abstract class CompositeConfigura
 
             @Override
             public boolean definesTree(@Nonnull Tree tree) {
-                for (SecurityConfiguration sc : configurations) {
+                for (SecurityConfiguration sc : configs) {
                     if (sc.getContext().definesTree(tree)) {
                         return true;
                     }
@@ -182,7 +194,7 @@ public abstract class CompositeConfigura
 
             @Override
             public boolean definesLocation(@Nonnull TreeLocation location) {
-                for (SecurityConfiguration sc : configurations) {
+                for (SecurityConfiguration sc : configs) {
                     if (sc.getContext().definesLocation(location)) {
                         return true;
                     }

Added: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authentication/token/CompositeTokenConfigurationTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authentication/token/CompositeTokenConfigurationTest.java?rev=1582295&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authentication/token/CompositeTokenConfigurationTest.java
(added)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authentication/token/CompositeTokenConfigurationTest.java
Thu Mar 27 13:20:56 2014
@@ -0,0 +1,129 @@
+/*
+ * 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.jackrabbit.oak.security.authentication.token;
+
+import java.util.List;
+
+import org.apache.jackrabbit.oak.spi.security.AbstractCompositeConfigurationTest;
+import org.apache.jackrabbit.oak.spi.security.authentication.token.CompositeTokenConfiguration;
+import org.apache.jackrabbit.oak.spi.security.authentication.token.CompositeTokenProvider;
+import org.apache.jackrabbit.oak.spi.security.authentication.token.TokenConfiguration;
+import org.apache.jackrabbit.oak.spi.security.authentication.token.TokenProvider;
+import org.junit.Test;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.assertTrue;
+
+public class CompositeTokenConfigurationTest extends AbstractCompositeConfigurationTest<TokenConfiguration>
{
+
+    @Override
+    public void before() throws Exception {
+        super.before();
+        setCompositeConfiguration(new CompositeTokenConfiguration(getSecurityProvider()));
+    }
+
+    @Test
+    public void testEmpty() {
+        List<TokenConfiguration> configs = getConfigurations();
+        assertNotNull(configs);
+        assertTrue(configs.isEmpty());
+    }
+
+    @Test
+    public void testSetDefault() {
+        TokenConfigurationImpl tc = new TokenConfigurationImpl(getSecurityProvider());
+        setDefault(tc);
+
+        List<TokenConfiguration> configs = getConfigurations();
+        assertNotNull(configs);
+        assertEquals(1, configs.size());
+
+        addConfiguration(tc);
+        configs = getConfigurations();
+        assertNotNull(configs);
+        assertEquals(1, configs.size());
+
+        addConfiguration(new TokenConfigurationImpl(getSecurityProvider()));
+        configs = getConfigurations();
+        assertNotNull(configs);
+        assertEquals(2, configs.size());
+    }
+
+    @Test
+    public void testAddConfiguration() {
+        TokenConfigurationImpl tc = new TokenConfigurationImpl(getSecurityProvider());
+        addConfiguration(tc);
+
+        List<TokenConfiguration> configs = getConfigurations();
+        assertNotNull(configs);
+        assertEquals(1, configs.size());
+
+        addConfiguration(tc);
+        configs = getConfigurations();
+        assertNotNull(configs);
+        assertEquals(2, configs.size());
+
+        addConfiguration(new TokenConfigurationImpl(getSecurityProvider()));
+        configs = getConfigurations();
+        assertNotNull(configs);
+        assertEquals(3, configs.size());
+    }
+
+    @Test
+    public void testRemoveConfiguration() {
+        TokenConfiguration tc = new TokenConfigurationImpl(getSecurityProvider());
+        addConfiguration(tc);
+
+        List<TokenConfiguration> configs = getConfigurations();
+        assertNotNull(configs);
+        assertEquals(1, configs.size());
+
+        removeConfiguration(tc);
+        configs = getConfigurations();
+        assertNotNull(configs);
+        assertEquals(0, configs.size());
+    }
+
+    @Test
+    public void testGetTokenProvider() {
+        CompositeTokenConfiguration ctc = (CompositeTokenConfiguration) getCompositeConfiguration();
+
+        TokenProvider tp = ctc.getTokenProvider(root);
+        assertNotNull(tp);
+        assertFalse(tp instanceof CompositeTokenProvider);
+
+        TokenConfiguration tc = new TokenConfigurationImpl(getSecurityProvider());
+        setDefault(tc);
+        tp = ctc.getTokenProvider(root);
+        assertNotNull(tp);
+        assertFalse(tp instanceof CompositeTokenProvider);
+        assertTrue(tp instanceof TokenProviderImpl);
+
+        addConfiguration(tc);
+        tp = ctc.getTokenProvider(root);
+        assertNotNull(tp);
+        assertFalse(tp instanceof CompositeTokenProvider);
+        assertTrue(tp instanceof TokenProviderImpl);
+
+        addConfiguration(new TokenConfigurationImpl(getSecurityProvider()));
+        tp = ctc.getTokenProvider(root);
+        assertNotNull(tp);
+        assertTrue(tp instanceof CompositeTokenProvider);
+    }
+}
\ No newline at end of file

Modified: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authentication/token/TokenConfigurationImplTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authentication/token/TokenConfigurationImplTest.java?rev=1582295&r1=1582294&r2=1582295&view=diff
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authentication/token/TokenConfigurationImplTest.java
(original)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/security/authentication/token/TokenConfigurationImplTest.java
Thu Mar 27 13:20:56 2014
@@ -29,6 +29,8 @@ import static org.junit.Assert.assertEqu
 
 public class TokenConfigurationImplTest extends AbstractSecurityTest {
 
+    private static final int DEFAULT_EXPIRATION = 2 * 3600 * 1000;
+
     private TokenConfigurationImpl tc;
 
     @Override
@@ -46,7 +48,13 @@ public class TokenConfigurationImplTest 
 
     @Test
     public void testConfigOptions() {
-        int exp = tc.getParameters().getConfigValue(TokenProvider.PARAM_TOKEN_EXPIRATION,
2 * 3600 * 1000);
+        int exp = tc.getParameters().getConfigValue(TokenProvider.PARAM_TOKEN_EXPIRATION,
DEFAULT_EXPIRATION);
+        assertEquals(60, exp);
+    }
+
+    @Test
+    public void testConfigOptions2() {
+        int exp = getConfig(TokenConfiguration.class).getParameters().getConfigValue(TokenProvider.PARAM_TOKEN_EXPIRATION,
DEFAULT_EXPIRATION);
         assertEquals(60, exp);
     }
 }
\ No newline at end of file

Added: jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/spi/security/AbstractCompositeConfigurationTest.java
URL: http://svn.apache.org/viewvc/jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/spi/security/AbstractCompositeConfigurationTest.java?rev=1582295&view=auto
==============================================================================
--- jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/spi/security/AbstractCompositeConfigurationTest.java
(added)
+++ jackrabbit/oak/trunk/oak-core/src/test/java/org/apache/jackrabbit/oak/spi/security/AbstractCompositeConfigurationTest.java
Thu Mar 27 13:20:56 2014
@@ -0,0 +1,53 @@
+/*
+ * 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.jackrabbit.oak.spi.security;
+
+import java.util.List;
+
+import org.apache.jackrabbit.oak.AbstractSecurityTest;
+
+/**
+ * AbstractCompositeConfigurationTest... TODO
+ */
+public abstract class AbstractCompositeConfigurationTest<T extends SecurityConfiguration>
extends AbstractSecurityTest {
+
+    private CompositeConfiguration<T> compositeConfiguration;
+
+    public void setCompositeConfiguration(CompositeConfiguration<T> compositeConfiguration)
{
+        this.compositeConfiguration = compositeConfiguration;
+    }
+
+    public CompositeConfiguration getCompositeConfiguration() {
+        return compositeConfiguration;
+    }
+
+    public List<T> getConfigurations() {
+        return compositeConfiguration.getConfigurations();
+    }
+
+    public void addConfiguration(T configuration) {
+        compositeConfiguration.addConfiguration(configuration);
+    }
+
+    public void removeConfiguration(T configuration) {
+        compositeConfiguration.removeConfiguration(configuration);
+    }
+
+    public void setDefault(T configuration) {
+        compositeConfiguration.setDefaultConfig(configuration);
+    }
+}
\ No newline at end of file



Mime
View raw message