Package org.apache.sling.replication.trigger

Examples of org.apache.sling.replication.trigger.ReplicationRequestHandler


//        response.setHeader("Access-Control-Allow-Origin", request.getHeader("Origin")); // allowed origins should be explicitly configured
//        response.setHeader("Access-Control-Allow-Credentials", "true");

        final PrintWriter writer = response.getWriter();

        ReplicationRequestHandler replicationRequestHandler = new ReplicationRequestHandler() {
            public void handle(@Nonnull ReplicationRequest request) {
                writeEvent(writer, request);
            }
        };
        try {
View Full Code Here


        when(repository.loginService(serviceName, null)).thenReturn(session);

        String path = "/some/path";
        PersistingJcrEventReplicationTrigger persistingJcrEventReplicationTrigger = new PersistingJcrEventReplicationTrigger(
                repository, path, serviceName, nuggetsPath);
        ReplicationRequestHandler handler = mock(ReplicationRequestHandler.class);
        persistingJcrEventReplicationTrigger.register(handler);

        Node nuggetsNode = mock(Node.class);
        Node eventNode = mock(Node.class);
        when(nuggetsNode.addNode(any(String.class))).thenReturn(eventNode);
View Full Code Here

    @Test
    public void testRegister() throws Exception {
        String pathPrefix = "/prefix";
        BundleContext bundleContext = mock(BundleContext.class);
        ChainReplicateReplicationTrigger chainReplicateReplicationTrigger = new ChainReplicateReplicationTrigger(pathPrefix, bundleContext);
        ReplicationRequestHandler handler = mock(ReplicationRequestHandler.class);
        chainReplicateReplicationTrigger.register(handler);
    }
View Full Code Here

    @Test
    public void testUnregister() throws Exception {
        String pathPrefix = "/prefix";
        BundleContext bundleContext = mock(BundleContext.class);
        ChainReplicateReplicationTrigger chainReplicateReplicationTrigger = new ChainReplicateReplicationTrigger(pathPrefix, bundleContext);
        ReplicationRequestHandler handler = mock(ReplicationRequestHandler.class);
        chainReplicateReplicationTrigger.unregister(handler);
    }
View Full Code Here

    @Test
    public void testRegister() throws Exception {
        for (ReplicationActionType action : ReplicationActionType.values()) {
            String path = "/path/to/somewhere";
            int interval = 10;
            ReplicationRequestHandler handler = mock(ReplicationRequestHandler.class);
            Scheduler scheduler = mock(Scheduler.class);
            ScheduleOptions options = mock(ScheduleOptions.class);
            when(scheduler.NOW(-1, interval)).thenReturn(options);
            when(options.name(handler.toString())).thenReturn(options);
            ScheduledReplicationTrigger scheduledReplicationTrigger = new ScheduledReplicationTrigger(action.name(), path, interval, scheduler);
            scheduledReplicationTrigger.register(handler);
        }
    }
View Full Code Here

        for (ReplicationActionType action : ReplicationActionType.values()) {
            String path = "/path/to/somewhere";
            int interval = 10;
            Scheduler scheduler = mock(Scheduler.class);
            ScheduledReplicationTrigger scheduledReplicationTrigger = new ScheduledReplicationTrigger(action.name(), path, interval, scheduler);
            ReplicationRequestHandler handlerId = mock(ReplicationRequestHandler.class);
            scheduledReplicationTrigger.unregister(handlerId);
        }
    }
View Full Code Here

*/
public class RemoteEventReplicationTriggerTest {

    @Test
    public void testRegister() throws Exception {
        ReplicationRequestHandler handler = mock(ReplicationRequestHandler.class);
        String endpoint = "";
        TransportAuthenticationProvider<CredentialsProvider, CredentialsProvider> authProvider = mock(TransportAuthenticationProvider.class);
        when(authProvider.canAuthenticate(CredentialsProvider.class)).thenReturn(true);
        Scheduler scheduler = mock(Scheduler.class);
        ScheduleOptions options = mock(ScheduleOptions.class);
        when(options.name(handler.toString())).thenReturn(options);
        when(scheduler.NOW()).thenReturn(options);
        RemoteEventReplicationTrigger remoteEventReplicationTrigger = new RemoteEventReplicationTrigger(
                endpoint, authProvider, scheduler);
        remoteEventReplicationTrigger.register(handler);
    }
View Full Code Here

        TransportAuthenticationProvider<CredentialsProvider, CredentialsProvider> authProvider = mock(TransportAuthenticationProvider.class);
        when(authProvider.canAuthenticate(CredentialsProvider.class)).thenReturn(true);
        Scheduler scheduler = mock(Scheduler.class);
        RemoteEventReplicationTrigger remoteEventReplicationTrigger = new RemoteEventReplicationTrigger(
                endpoint, authProvider, scheduler);
        ReplicationRequestHandler handler = mock(ReplicationRequestHandler.class);
        remoteEventReplicationTrigger.unregister(handler);
    }
View Full Code Here

        String path = "/some/path";
        BundleContext bundleContext = mock(BundleContext.class);
        ServiceRegistration registration = mock(ServiceRegistration.class);
        when(bundleContext.registerService(any(String.class), any(Object.class), any(Dictionary.class))).thenReturn(registration);
        ResourceEventReplicationTrigger resourceEventReplicationTrigger = new ResourceEventReplicationTrigger(path, bundleContext);
        ReplicationRequestHandler handler = mock(ReplicationRequestHandler.class);
        resourceEventReplicationTrigger.register(handler);
    }
View Full Code Here

    @Test
    public void testUnregister() throws Exception {
        String path = "/some/path";
        BundleContext bundleContext = mock(BundleContext.class);
        ResourceEventReplicationTrigger resourceEventReplicationTrigger = new ResourceEventReplicationTrigger(path, bundleContext);
        ReplicationRequestHandler handler = mock(ReplicationRequestHandler.class);
        resourceEventReplicationTrigger.unregister(handler);
    }
View Full Code Here

TOP

Related Classes of org.apache.sling.replication.trigger.ReplicationRequestHandler

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.