Search in sources :

Example 1 with MoveTracker

use of org.apache.jackrabbit.oak.spi.commit.MoveTracker in project jackrabbit-oak by apache.

the class PrivilegeConfigurationImplTest method testGetValidators.

@Test
public void testGetValidators() {
    List<? extends ValidatorProvider> l = configuration.getValidators("wspName", ImmutableSet.<Principal>of(), new MoveTracker());
    assertEquals(1, l.size());
    assertTrue(l.get(0) instanceof PrivilegeValidatorProvider);
}
Also used : MoveTracker(org.apache.jackrabbit.oak.spi.commit.MoveTracker) Test(org.junit.Test)

Example 2 with MoveTracker

use of org.apache.jackrabbit.oak.spi.commit.MoveTracker in project jackrabbit-oak by apache.

the class CugConfigurationTest method testGetValidators.

@Test
public void testGetValidators() {
    List<? extends ValidatorProvider> l = new CugConfiguration().getValidators("wspName", ImmutableSet.of(), new MoveTracker());
    assertEquals(1, l.size());
    assertTrue(l.iterator().next() instanceof CugValidatorProvider);
}
Also used : MoveTracker(org.apache.jackrabbit.oak.spi.commit.MoveTracker) Test(org.junit.Test)

Example 3 with MoveTracker

use of org.apache.jackrabbit.oak.spi.commit.MoveTracker in project jackrabbit-oak by apache.

the class UserConfigurationImplTest method testValidators.

@Test
public void testValidators() {
    UserConfigurationImpl configuration = new UserConfigurationImpl(getSecurityProvider());
    configuration.setRootProvider(getRootProvider());
    configuration.setTreeProvider(getTreeProvider());
    List<? extends ValidatorProvider> validators = configuration.getValidators(adminSession.getWorkspaceName(), Collections.<Principal>emptySet(), new MoveTracker());
    assertEquals(2, validators.size());
    List<String> clNames = Lists.newArrayList(UserValidatorProvider.class.getName(), CacheValidatorProvider.class.getName());
    for (ValidatorProvider vp : validators) {
        clNames.remove(vp.getClass().getName());
    }
    assertTrue(clNames.isEmpty());
}
Also used : MoveTracker(org.apache.jackrabbit.oak.spi.commit.MoveTracker) ValidatorProvider(org.apache.jackrabbit.oak.spi.commit.ValidatorProvider) AbstractSecurityTest(org.apache.jackrabbit.oak.AbstractSecurityTest) Test(org.junit.Test)

Example 4 with MoveTracker

use of org.apache.jackrabbit.oak.spi.commit.MoveTracker in project jackrabbit-oak by apache.

the class ExternalPrincipalConfigurationTest method testGetValidatorsOmitIdProtection.

@Test
public void testGetValidatorsOmitIdProtection() throws Exception {
    externalPrincipalConfiguration.setParameters(ConfigurationParameters.of(ExternalIdentityConstants.PARAM_PROTECT_EXTERNAL_IDS, false));
    ContentSession cs = root.getContentSession();
    List<? extends ValidatorProvider> validatorProviders = externalPrincipalConfiguration.getValidators(cs.getWorkspaceName(), cs.getAuthInfo().getPrincipals(), new MoveTracker());
    assertFalse(validatorProviders.isEmpty());
    assertEquals(1, validatorProviders.size());
    assertTrue(validatorProviders.get(0) instanceof ExternalIdentityValidatorProvider);
    enable();
    validatorProviders = externalPrincipalConfiguration.getValidators(cs.getWorkspaceName(), cs.getAuthInfo().getPrincipals(), new MoveTracker());
    assertFalse(validatorProviders.isEmpty());
    assertEquals(1, validatorProviders.size());
    assertTrue(validatorProviders.get(0) instanceof ExternalIdentityValidatorProvider);
}
Also used : ContentSession(org.apache.jackrabbit.oak.api.ContentSession) MoveTracker(org.apache.jackrabbit.oak.spi.commit.MoveTracker) AbstractExternalAuthTest(org.apache.jackrabbit.oak.spi.security.authentication.external.AbstractExternalAuthTest) Test(org.junit.Test)

Example 5 with MoveTracker

use of org.apache.jackrabbit.oak.spi.commit.MoveTracker in project jackrabbit-oak by apache.

the class TokenConfigurationImplTest method testGetValidators.

@Test
public void testGetValidators() {
    List<? extends ValidatorProvider> validators = tc.getValidators(root.getContentSession().getWorkspaceName(), ImmutableSet.<Principal>of(), new MoveTracker());
    assertNotNull(validators);
    assertEquals(1, validators.size());
    assertTrue(validators.get(0) instanceof TokenValidatorProvider);
}
Also used : MoveTracker(org.apache.jackrabbit.oak.spi.commit.MoveTracker) AbstractSecurityTest(org.apache.jackrabbit.oak.AbstractSecurityTest) Test(org.junit.Test)

Aggregations

MoveTracker (org.apache.jackrabbit.oak.spi.commit.MoveTracker)7 Test (org.junit.Test)7 AbstractSecurityTest (org.apache.jackrabbit.oak.AbstractSecurityTest)2 ContentSession (org.apache.jackrabbit.oak.api.ContentSession)2 ValidatorProvider (org.apache.jackrabbit.oak.spi.commit.ValidatorProvider)2 AbstractExternalAuthTest (org.apache.jackrabbit.oak.spi.security.authentication.external.AbstractExternalAuthTest)2 ImmutableSet (com.google.common.collect.ImmutableSet)1 Set (java.util.Set)1 Nonnull (javax.annotation.Nonnull)1