Package org.apache.sling.replication.packaging

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


    }

    @Test
    public void testPackageAdditionWithNullItemStateFromTheQueue() 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);
        boolean returnedState = singleQueueDistributionStrategy.add("agentName", replicationPackage, queueProvider);
View Full Code Here


    }

    @Test
    public void testPackageAdditionWithNotNullItemStateFromTheQueue() 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

                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(resourceResolver, request)).thenReturn(Arrays.asList(replicationPackage));
        when(queueProvider.getDefaultQueue(name)).thenReturn(
                new SimpleReplicationQueue(name, "name"));

        agent.execute(resourceResolver, request);
View Full Code Here

        ReplicationPackageBuilder packageBuilder = mock(ReplicationPackageBuilder.class);
        int maxNoOfPackages = Integer.MAX_VALUE;
        SimpleHttpReplicationTransportHandler simpleHttpReplicationTransportHandler = new SimpleHttpReplicationTransportHandler(
                authProvider, endpoint, packageBuilder, maxNoOfPackages);
        ResourceResolver resourceResolver = mock(ResourceResolver.class);
        ReplicationPackage replicationPackage = mock(ReplicationPackage.class);
        when(replicationPackage.getInfo()).thenReturn(mock(ReplicationPackageInfo.class));
        InputStream stream = mock(InputStream.class);
        when(replicationPackage.createInputStream()).thenReturn(stream);
        simpleHttpReplicationTransportHandler.deliverPackage(resourceResolver, replicationPackage);
    }
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

        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/sample2"});
        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

        when(response.returnResponse()).thenReturn(httpResponse);
        when(executor.execute(any(Request.class))).thenReturn(response);
        when(authProvider.authenticate(any(Executor.class), any(TransportAuthenticationContext.class))).thenReturn(executor);
        ReplicationEndpoint endpoint = new ReplicationEndpoint("http://127.0.0.1:8080/some/resource");
        ReplicationPackageBuilder packageBuilder = mock(ReplicationPackageBuilder.class);
        ReplicationPackage replicationPackage = mock(ReplicationPackage.class);
        when(replicationPackage.getInfo()).thenReturn(mock(ReplicationPackageInfo.class));
        when(packageBuilder.readPackage(any(ResourceResolver.class), any(InputStream.class))).thenReturn(replicationPackage);
        int maxNoOfPackages = 1;
        SimpleHttpReplicationTransportHandler simpleHttpReplicationTransportHandler = new SimpleHttpReplicationTransportHandler(
                authProvider, endpoint, packageBuilder, maxNoOfPackages);
        ResourceResolver resourceResolver = mock(ResourceResolver.class);
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

        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[]{"/apps/some/stuff"});
        ReplicationQueueProvider queueProvider = mock(ReplicationQueueProvider.class);
        ReplicationQueue queue = mock(ReplicationQueue.class);

        when(queueProvider.getQueue("agentName", "/apps")).thenReturn(queue);
        when(queue.add(any(ReplicationQueueItem.class))).thenReturn(true);
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);
        boolean returnedState = priorityPathDistributionStrategy.add("agentName", replicationPackage, queueProvider);
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.