Package org.apache.sling.replication.packaging

Examples of org.apache.sling.replication.packaging.ReplicationPackage


        VoidReplicationPackageBuilder voidReplicationPackageBuilder = new VoidReplicationPackageBuilder();
        ResourceResolver resourceResolver = mock(ResourceResolver.class);
        for (ReplicationActionType action : ReplicationActionType.values()) {
            ReplicationRequest request = new ReplicationRequest(action, new String[]{"/"});
            InputStream stream = new VoidReplicationPackage(request).createInputStream();
            ReplicationPackage replicationPackage = voidReplicationPackageBuilder.readPackage(resourceResolver, stream);
            assertNotNull(replicationPackage);
        }
    }
View Full Code Here


    @Test
    public void testGetNonExistingPackage() throws Exception {
        VoidReplicationPackageBuilder voidReplicationPackageBuilder = new VoidReplicationPackageBuilder();
        ResourceResolver resourceResolver = mock(ResourceResolver.class);
        ReplicationPackage replicationPackage = voidReplicationPackageBuilder.getPackage(resourceResolver, "missing-id");
        assertNull(replicationPackage);
    }
View Full Code Here

    @Test
    public void testGetMatchingIdPackage() throws Exception {
        VoidReplicationPackageBuilder voidReplicationPackageBuilder = new VoidReplicationPackageBuilder();
        ResourceResolver resourceResolver = mock(ResourceResolver.class);
        String id = new VoidReplicationPackage(new ReplicationRequest(ReplicationActionType.DELETE, new String[]{"/"})).getId();
        ReplicationPackage replicationPackage = voidReplicationPackageBuilder.getPackage(resourceResolver, id);
        assertNotNull(replicationPackage);
    }
View Full Code Here

    @Test
    public void testInstallDummyPackage() throws Exception {
        VoidReplicationPackageBuilder voidReplicationPackageBuilder = new VoidReplicationPackageBuilder();
        ResourceResolver resourceResolver = mock(ResourceResolver.class);
        ReplicationPackage replicationPackage = mock(ReplicationPackage.class);
        boolean success = voidReplicationPackageBuilder.installPackage(resourceResolver, replicationPackage);
        assertTrue(success);
    }
View Full Code Here

                packageExporter, packageExporterStrategy,
                queueProvider, distributionHandler,
                replicationEventFactory, resolverFactory,  null);
        ReplicationRequest request = new ReplicationRequest(System.nanoTime(),
                ReplicationActionType.ADD, "/");
        ReplicationPackage replicationPackage = mock(ReplicationPackage.class);
        ResourceResolver resourceResolver = mock(ResourceResolver.class);

        when(replicationPackage.getPaths()).thenReturn(new String[]{"/"});
        when(packageExporter.exportPackages(any(ResourceResolver.class), any(ReplicationRequest.class)))
                .thenReturn(Arrays.asList(replicationPackage));
        when(queueProvider.getDefaultQueue(name)).thenReturn(
                new SimpleReplicationQueue(name, "name"));
        ReplicationResponse response = agent.execute(resourceResolver, request);
View Full Code Here

        ComponentContext context = mock(ComponentContext.class);
        Dictionary properties = mock(Dictionary.class);
        when(properties.get("priority.paths")).thenReturn(new String[]{"/content", "/apps"});
        when(context.getProperties()).thenReturn(properties);
        priorityPathDistributionStrategy.activate(context);
        ReplicationPackage replicationPackage = mock(ReplicationPackage.class);
        when(replicationPackage.getPaths()).thenReturn(new String[]{"/etc"});
        ReplicationQueueProvider queueProvider = mock(ReplicationQueueProvider.class);
        ReplicationQueue queue = mock(ReplicationQueue.class);
        when(queueProvider.getDefaultQueue("agentName")).thenReturn(queue);
        when(queue.add(any(ReplicationQueueItem.class))).thenReturn(true);
View Full Code Here

                packageExporter, packageExporterStrategy,
                queueProvider,
                distributionHandler, replicationEventFactory, resolverFactory, null);
        ReplicationRequest request = new ReplicationRequest(System.nanoTime(),
                ReplicationActionType.ADD, "/");
        ReplicationPackage replicationPackage = mock(ReplicationPackage.class);
        ResourceResolver resourceResolver = mock(ResourceResolver.class);

        when(replicationPackage.getPaths()).thenReturn(new String[]{"/"});
        when(distributionHandler.add(any(String.class), any(ReplicationPackage.class), eq(queueProvider))).thenReturn(true);
        when(packageExporter.exportPackages(any(ResourceResolver.class), any(ReplicationRequest.class)))
                .thenReturn(Arrays.asList(replicationPackage));
        when(queueProvider.getDefaultQueue(name)).thenReturn(
                new SimpleReplicationQueue(name, "name"));
View Full Code Here

        ComponentContext context = mock(ComponentContext.class);
        Dictionary properties = mock(Dictionary.class);
        when(properties.get("priority.paths")).thenReturn(new String[]{"/content", "/apps"});
        when(context.getProperties()).thenReturn(properties);
        priorityPathDistributionStrategy.activate(context);
        ReplicationPackage replicationPackage = mock(ReplicationPackage.class);
        when(replicationPackage.getPaths()).thenReturn(new String[]{"/content/sample1"});
        ReplicationQueueProvider queueProvider = mock(ReplicationQueueProvider.class);
        ReplicationQueue queue = mock(ReplicationQueue.class);
        when(queueProvider.getQueue("agentName", "/content")).thenReturn(queue);
        when(queue.add(any(ReplicationQueueItem.class))).thenReturn(true);
View Full Code Here

public class SingleQueueDistributionStrategyTest {

    @Test
    public void testPackageAdditionWithSucceedingItemDelivery() throws Exception {
        SingleQueueDistributionStrategy singleQueueDistributionStrategy = new SingleQueueDistributionStrategy();
        ReplicationPackage replicationPackage = mock(ReplicationPackage.class);
        ReplicationQueueProvider queueProvider = mock(ReplicationQueueProvider.class);
        ReplicationQueue queue = mock(ReplicationQueue.class);
        when(queueProvider.getDefaultQueue("agentName")).thenReturn(queue);
        when(queue.add(any(ReplicationQueueItem.class))).thenReturn(true);
View Full Code Here

    }

    @Test
    public void testPackageAdditionWithFailingItemDelivery() throws Exception {
        SingleQueueDistributionStrategy singleQueueDistributionStrategy = new SingleQueueDistributionStrategy();
        ReplicationPackage replicationPackage = mock(ReplicationPackage.class);
        ReplicationQueueProvider queueProvider = mock(ReplicationQueueProvider.class);
        ReplicationQueue queue = mock(ReplicationQueue.class);
        ReplicationQueueItem queueItem = mock(ReplicationQueueItem.class);
        when(queueProvider.getDefaultQueue("agentName")).thenReturn(queue);
        when(queue.add(queueItem)).thenReturn(true);
View Full Code Here

TOP

Related Classes of org.apache.sling.replication.packaging.ReplicationPackage

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.