Search in sources :

Example 1 with EmptyHook

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

the class SecureNodeBuilderTest method before.

@Before
public void before() throws Exception {
    NodeBuilder rootBuilder = store.getRoot().builder();
    rootBuilder.setProperty("prop", "value").setProperty(NAME_NON_ACCESSIBLE, "value");
    rootBuilder.child(NAME_ACCESSIBLE).setProperty("prop", "value").setProperty(NAME_NON_ACCESSIBLE, "value");
    rootBuilder.child(NAME_NON_ACCESSIBLE).setProperty("prop", "value").setProperty(NAME_NON_ACCESSIBLE, "value");
    store.merge(rootBuilder, new EmptyHook(), new CommitInfo("id", null));
    rootBuilder = store.getRoot().builder();
    secureNodeBuilder = new SecureNodeBuilder(rootBuilder, new LazyValue<PermissionProvider>() {

        @Override
        protected PermissionProvider createValue() {
            return permissionProvider;
        }
    });
}
Also used : EmptyHook(org.apache.jackrabbit.oak.spi.commit.EmptyHook) CommitInfo(org.apache.jackrabbit.oak.spi.commit.CommitInfo) NodeBuilder(org.apache.jackrabbit.oak.spi.state.NodeBuilder) Before(org.junit.Before)

Example 2 with EmptyHook

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

the class MutableRootTest method before.

@Before
public void before() {
    SecurityProvider sp = new OpenSecurityProvider() {

        @Nonnull
        @Override
        public <T> T getConfiguration(@Nonnull Class<T> configClass) {
            if (AuthorizationConfiguration.class == configClass) {
                return (T) new OpenAuthorizationConfiguration() {

                    @Nonnull
                    @Override
                    public PermissionProvider getPermissionProvider(@Nonnull Root root, @Nonnull String workspaceName, @Nonnull Set<Principal> principals) {
                        return permissionProvider;
                    }
                };
            } else {
                return super.getConfiguration(configClass);
            }
        }
    };
    ContentSessionImpl cs = Mockito.mock(ContentSessionImpl.class);
    when(cs.toString()).thenReturn("contentSession");
    when(cs.getAuthInfo()).thenReturn(AuthInfoImpl.EMPTY);
    when(cs.getWorkspaceName()).thenReturn("default");
    root = new MutableRoot(store, new EmptyHook(), "default", new Subject(), sp, null, null, cs);
}
Also used : Root(org.apache.jackrabbit.oak.api.Root) Nonnull(javax.annotation.Nonnull) PermissionProvider(org.apache.jackrabbit.oak.spi.security.authorization.permission.PermissionProvider) OpenSecurityProvider(org.apache.jackrabbit.oak.spi.security.OpenSecurityProvider) Subject(javax.security.auth.Subject) OpenAuthorizationConfiguration(org.apache.jackrabbit.oak.spi.security.authorization.OpenAuthorizationConfiguration) SecurityProvider(org.apache.jackrabbit.oak.spi.security.SecurityProvider) OpenSecurityProvider(org.apache.jackrabbit.oak.spi.security.OpenSecurityProvider) EmptyHook(org.apache.jackrabbit.oak.spi.commit.EmptyHook) Principal(java.security.Principal) Before(org.junit.Before)

Aggregations

EmptyHook (org.apache.jackrabbit.oak.spi.commit.EmptyHook)2 Before (org.junit.Before)2 Principal (java.security.Principal)1 Nonnull (javax.annotation.Nonnull)1 Subject (javax.security.auth.Subject)1 Root (org.apache.jackrabbit.oak.api.Root)1 CommitInfo (org.apache.jackrabbit.oak.spi.commit.CommitInfo)1 OpenSecurityProvider (org.apache.jackrabbit.oak.spi.security.OpenSecurityProvider)1 SecurityProvider (org.apache.jackrabbit.oak.spi.security.SecurityProvider)1 OpenAuthorizationConfiguration (org.apache.jackrabbit.oak.spi.security.authorization.OpenAuthorizationConfiguration)1 PermissionProvider (org.apache.jackrabbit.oak.spi.security.authorization.permission.PermissionProvider)1 NodeBuilder (org.apache.jackrabbit.oak.spi.state.NodeBuilder)1