Package org.apache.sling.replication.transport

Examples of org.apache.sling.replication.transport.ReplicationTransportHandler


        List<ReplicationPackage> result = new ArrayList<ReplicationPackage>();

        for (int i = 0; i < length; i++) {
            int currentId = (offset + i) % length;

            ReplicationTransportHandler transportHelper = transportHelpers.get(currentId);
            if (replicationPackage != null) {
                transportHelper.deliverPackage(resourceResolver, replicationPackage);
            } else if (replicationRequest != null) {
                result.addAll(transportHelper.retrievePackages(resourceResolver, replicationRequest));
            }

            lastSuccessfulEnpointId = currentId;
            if (endpointStrategyType.equals(TransportEndpointStrategyType.One))
                break;
View Full Code Here


    @Test
    public void testRetrievePackagesWithOneReturningSubHandlerAndAllStrategy() throws Exception {
        ReplicationRequest replicationRequest = mock(ReplicationRequest.class);
        ResourceResolver resourceResolver = mock(ResourceResolver.class);
        List<ReplicationTransportHandler> subHandlers = new ArrayList<ReplicationTransportHandler>();
        ReplicationTransportHandler handler1 = mock(ReplicationTransportHandler.class);
        List<ReplicationPackage> packages1 = new ArrayList<ReplicationPackage>();
        packages1.add(mock(ReplicationPackage.class));
        packages1.add(mock(ReplicationPackage.class));
        when(handler1.retrievePackages(resourceResolver, replicationRequest)).thenReturn(packages1);
        subHandlers.add(handler1);
        subHandlers.add(mock(ReplicationTransportHandler.class));
        MultipleEndpointReplicationTransportHandler multipleEndpointReplicationTransportHandler = new MultipleEndpointReplicationTransportHandler(
                subHandlers, TransportEndpointStrategyType.All);
        List<ReplicationPackage> replicationPackages = multipleEndpointReplicationTransportHandler.retrievePackages(resourceResolver, replicationRequest);
View Full Code Here

    public void testRetrievePackagesWithOneEmptyOneReturningSubHandlerAndOneStrategy() throws Exception {
        ReplicationRequest replicationRequest = mock(ReplicationRequest.class);
        ResourceResolver resourceResolver = mock(ResourceResolver.class);
        List<ReplicationTransportHandler> subHandlers = new ArrayList<ReplicationTransportHandler>();
        subHandlers.add(mock(ReplicationTransportHandler.class));
        ReplicationTransportHandler handler2 = mock(ReplicationTransportHandler.class);
        List<ReplicationPackage> packages2 = new ArrayList<ReplicationPackage>();
        packages2.add(mock(ReplicationPackage.class));
        packages2.add(mock(ReplicationPackage.class));
        when(handler2.retrievePackages(resourceResolver, replicationRequest)).thenReturn(packages2);
        subHandlers.add(handler2);
        MultipleEndpointReplicationTransportHandler multipleEndpointReplicationTransportHandler = new MultipleEndpointReplicationTransportHandler(
                subHandlers, TransportEndpointStrategyType.One);
        List<ReplicationPackage> replicationPackages = multipleEndpointReplicationTransportHandler.retrievePackages(resourceResolver, replicationRequest);
        assertNotNull(replicationPackages);
View Full Code Here

    @Test
    public void testRetrievePackagesWithTwoReturningSubHandlersAndAllStrategy() throws Exception {
        ReplicationRequest replicationRequest = mock(ReplicationRequest.class);
        ResourceResolver resourceResolver = mock(ResourceResolver.class);
        List<ReplicationTransportHandler> subHandlers = new ArrayList<ReplicationTransportHandler>();
        ReplicationTransportHandler handler1 = mock(ReplicationTransportHandler.class);
        List<ReplicationPackage> packages1 = new ArrayList<ReplicationPackage>();
        packages1.add(mock(ReplicationPackage.class));
        packages1.add(mock(ReplicationPackage.class));
        when(handler1.retrievePackages(resourceResolver, replicationRequest)).thenReturn(packages1);
        subHandlers.add(handler1);

        ReplicationTransportHandler handler2 = mock(ReplicationTransportHandler.class);
        List<ReplicationPackage> packages2 = new ArrayList<ReplicationPackage>();
        packages2.add(mock(ReplicationPackage.class));
        packages2.add(mock(ReplicationPackage.class));
        packages2.add(mock(ReplicationPackage.class));
        when(handler2.retrievePackages(resourceResolver, replicationRequest)).thenReturn(packages2);
        subHandlers.add(handler2);

        MultipleEndpointReplicationTransportHandler multipleEndpointReplicationTransportHandler = new MultipleEndpointReplicationTransportHandler(
                subHandlers, TransportEndpointStrategyType.All);
        List<ReplicationPackage> replicationPackages = multipleEndpointReplicationTransportHandler.retrievePackages(resourceResolver, replicationRequest);
View Full Code Here

    @Test
    public void testRetrievePackagesWithTwoReturningSubHandlersAndOneStrategy() throws Exception {
        ReplicationRequest replicationRequest = mock(ReplicationRequest.class);
        ResourceResolver resourceResolver = mock(ResourceResolver.class);
        List<ReplicationTransportHandler> subHandlers = new ArrayList<ReplicationTransportHandler>();
        ReplicationTransportHandler handler1 = mock(ReplicationTransportHandler.class);
        List<ReplicationPackage> packages1 = new ArrayList<ReplicationPackage>();
        packages1.add(mock(ReplicationPackage.class));
        packages1.add(mock(ReplicationPackage.class));
        when(handler1.retrievePackages(resourceResolver, replicationRequest)).thenReturn(packages1);
        subHandlers.add(handler1);

        ReplicationTransportHandler handler2 = mock(ReplicationTransportHandler.class);
        List<ReplicationPackage> packages2 = new ArrayList<ReplicationPackage>();
        packages2.add(mock(ReplicationPackage.class));
        packages2.add(mock(ReplicationPackage.class));
        packages2.add(mock(ReplicationPackage.class));
        when(handler2.retrievePackages(resourceResolver, replicationRequest)).thenReturn(packages2);
        subHandlers.add(handler2);

        MultipleEndpointReplicationTransportHandler multipleEndpointReplicationTransportHandler = new MultipleEndpointReplicationTransportHandler(
                subHandlers, TransportEndpointStrategyType.One);
        List<ReplicationPackage> replicationPackages = multipleEndpointReplicationTransportHandler.retrievePackages(resourceResolver, replicationRequest);
View Full Code Here

TOP

Related Classes of org.apache.sling.replication.transport.ReplicationTransportHandler

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.