Package org.apache.sling.replication.packaging

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


        try {
            log.info("getting item from queue {}", queueName);

            ReplicationQueue queue = agent.getQueue(queueName);
            ReplicationQueueItem info = queue.getHead();
            ReplicationPackage replicationPackage;
            if (info != null) {
                replicationPackage = packageBuilder.getPackage(resourceResolver, info.getId());
                queue.remove(info.getId());
                if (replicationPackage != null) {
                    result.add(replicationPackage);
View Full Code Here


    @Nonnull
    public List<ReplicationPackage> exportPackages(@Nonnull ResourceResolver resourceResolver, @Nonnull ReplicationRequest replicationRequest) throws ReplicationPackageBuildingException {
        List<ReplicationPackage> result = new ArrayList<ReplicationPackage>();

        ReplicationPackage createdPackage = packageBuilder.createPackage(resourceResolver, replicationRequest);
        if (createdPackage != null) {
            result.add(createdPackage);
        }
        return result;
    }
View Full Code Here

        ReplicationEventFactory eventFactory = mock(ReplicationEventFactory.class);

        FileVaultReplicationPackageBuilder fileVaultReplicationPackageBuilder = new FileVaultReplicationPackageBuilder(
                packaging, eventFactory);
        ReplicationRequest request = new ReplicationRequest(ReplicationActionType.ADD, new String[]{"/"});
        ReplicationPackage replicationPackage = fileVaultReplicationPackageBuilder.createPackageForAdd(resourceResolver, request);
        assertNotNull(replicationPackage);
    }
View Full Code Here

        FileVaultReplicationPackageBuilder fileVaultReplicationPackageBuilder = new FileVaultReplicationPackageBuilder(
                packaging, eventFactory);

        ResourceResolver resourceResolver = mock(ResourceResolver.class);
        InputStream stream = new ByteArrayInputStream("some binary".getBytes("UTF-8"));
        ReplicationPackage replicationPackage = fileVaultReplicationPackageBuilder.readPackageInternal(resourceResolver, stream);
        assertNull(replicationPackage);
    }
View Full Code Here

        FileVaultReplicationPackageBuilder fileVaultReplicationPackageBuilder = new FileVaultReplicationPackageBuilder(
                packaging, eventFactory);

        ResourceResolver resourceResolver = mock(ResourceResolver.class);
        String id = "some-id";
        ReplicationPackage packageInternal = fileVaultReplicationPackageBuilder.getPackageInternal(resourceResolver, id);
        assertNull(packageInternal);
    }
View Full Code Here

        Workspace workspace = mock(Workspace.class);
        ObservationManager observationManager = mock(ObservationManager.class);
        when(workspace.getObservationManager()).thenReturn(observationManager);
        when(session.getWorkspace()).thenReturn(workspace);
        when(resourceResolver.adaptTo(Session.class)).thenReturn(session);
        ReplicationPackage replicationPackage = mock(ReplicationPackage.class);
        when(replicationPackage.getId()).thenReturn(tempFile.getAbsolutePath());
        when(replicationPackage.getAction()).thenReturn(ReplicationActionType.ADD.name());
        when(replicationPackage.getPaths()).thenReturn(new String[]{"/something"});

        boolean success = fileVaultReplicationPackageBuilder.installPackage(resourceResolver, replicationPackage);
        assertTrue(success);
    }
View Full Code Here

        Workspace workspace = mock(Workspace.class);
        ObservationManager observationManager = mock(ObservationManager.class);
        when(workspace.getObservationManager()).thenReturn(observationManager);
        when(session.getWorkspace()).thenReturn(workspace);
        when(resourceResolver.adaptTo(Session.class)).thenReturn(session);
        ReplicationPackage replicationPackage = mock(ReplicationPackage.class);
        when(replicationPackage.getId()).thenReturn(tempFile.getAbsolutePath());
        when(replicationPackage.getAction()).thenReturn(ReplicationActionType.ADD.name());
        when(replicationPackage.getPaths()).thenReturn(new String[]{"/something"});

        boolean success = fileVaultReplicationPackageBuilder.installPackage(resourceResolver, replicationPackage);
        assertTrue(success);
    }
View Full Code Here

        ResourceResolver agentResourceResolver = null;
        try {

            agentResourceResolver = getAgentResourceResolver();

            ReplicationPackage replicationPackage = replicationPackageExporter.getPackage(agentResourceResolver, queueItem.getId());


            if (replicationPackage != null) {
                replicationPackage.getInfo().fillInfo(queueItem.getPackageInfo());

                replicationPackageImporter.importPackage(agentResourceResolver, replicationPackage);

                Dictionary<Object, Object> properties = new Properties();
                properties.put("replication.package.paths", replicationPackage.getPaths());
                properties.put("replication.agent.name", name);
                replicationEventFactory.generateEvent(ReplicationEventType.PACKAGE_REPLICATED, properties);

                replicationPackage.delete();
                success = true;
            } else {
                log.warn("replication package with id {} does not exist", queueItem.getId());
            }
View Full Code Here

        String[] endpoints = new String[0];
        for (TransportEndpointStrategyType strategy : TransportEndpointStrategyType.values()) {
            RemoteReplicationPackageImporter remoteReplicationPackageImporter = new RemoteReplicationPackageImporter(
                    authenticationProvider, endpoints, strategy.name());
            ResourceResolver resourceResolver = mock(ResourceResolver.class);
            ReplicationPackage replicationPackage = mock(ReplicationPackage.class);
            boolean success = remoteReplicationPackageImporter.importPackage(resourceResolver, replicationPackage);
            assertTrue(success);
        }
    }
View Full Code Here

    public void testDummyImport() throws Exception {
        ReplicationPackageBuilder packageBuilder = mock(ReplicationPackageBuilder.class);
        ReplicationEventFactory eventFactory = mock(ReplicationEventFactory.class);
        LocalReplicationPackageImporter localReplicationPackageImporter = new LocalReplicationPackageImporter(packageBuilder, eventFactory);
        ResourceResolver resourceResolver = mock(ResourceResolver.class);
        ReplicationPackage replicationPackage = mock(ReplicationPackage.class);
        boolean success = localReplicationPackageImporter.importPackage(resourceResolver, replicationPackage);
        assertFalse(success);
    }
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.