Package org.apache.sling.replication.packaging

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


            Map<String, Object> exporterProperties = extractMap(COMPONENT_PACKAGE_EXPORTER, properties);
            ReplicationPackageExporter packageExporter = createExporter(exporterProperties, componentProvider);

            Map<String, Object> importerProperties = extractMap(COMPONENT_PACKAGE_IMPORTER, properties);
            ReplicationPackageImporter packageImporter = createImporter(importerProperties, componentProvider);

            Map<String, Object> authorizationStrategyProperties = extractMap(COMPONENT_REQUEST_AUTHORIZATION_STRATEGY, properties);
            ReplicationRequestAuthorizationStrategy packageExporterStrategy = createAuthorizationStrategy(authorizationStrategyProperties, componentProvider);

            Map<String, Object> queueDistributionStrategyProperties = extractMap(COMPONENT_QUEUE_DISTRIBUTION_STRATEGY, properties);
View Full Code Here


    @Override
    protected void doPost(SlingHttpServletRequest request, SlingHttpServletResponse response)
            throws ServletException, IOException {

        ReplicationPackageImporter replicationPackageImporter = request
                .getResource()
                .adaptTo(ReplicationPackageImporter.class);

        boolean success = false;
        final long start = System.currentTimeMillis();
        response.setContentType("text/plain");
        response.setCharacterEncoding("utf-8");

        InputStream stream = request.getInputStream();
        ResourceResolver resourceResolver = request.getResourceResolver();
        try {
            ReplicationPackage replicationPackage = replicationPackageImporter.importStream(resourceResolver, stream);
            if (replicationPackage != null) {
                replicationPackage.delete();
            } else {
                log.warn("cannot import replication package from request {}", request);
                response.setStatus(400);
View Full Code Here

        DefaultReplicationComponentFactory defaultReplicationComponentFactory = new DefaultReplicationComponentFactory();
        String name = "sample-importer";
        Map<String, Object> properties = new HashMap<String, Object>();
        properties.put("name", name);
        ReplicationComponentProvider provider = mock(ReplicationComponentProvider.class);
        ReplicationPackageImporter importer = mock(ReplicationPackageImporter.class);
        when(provider.getComponent(ReplicationPackageImporter.class, name)).thenReturn(importer);
        ReplicationPackageImporter component = defaultReplicationComponentFactory.createComponent(ReplicationPackageImporter.class, properties, provider);
        assertNotNull(component);
    }
View Full Code Here

public class SimpleReplicationAgentTest {

    @Test
    public void testReplicationWithFailingDistributionStrategy() throws Exception {
        String name = "sample-agent";
        ReplicationPackageImporter packageImporter = mock(ReplicationPackageImporter.class);
        ReplicationPackageExporter packageExporter = mock(ReplicationPackageExporter.class);
        ReplicationRequestAuthorizationStrategy packageExporterStrategy = mock(ReplicationRequestAuthorizationStrategy.class);
        ReplicationQueueProvider queueProvider = mock(ReplicationQueueProvider.class);
        ReplicationQueueDistributionStrategy distributionHandler = mock(ReplicationQueueDistributionStrategy.class);
        when(distributionHandler.add(any(String.class), any(ReplicationPackage.class), any(ReplicationQueueProvider.class))).thenReturn(false);
View Full Code Here

    }

    @Test
    public void testReplicationWithWorkingDistributionStrategy() throws Exception {
        String name = "sample-agent";
        ReplicationPackageImporter packageImporter = mock(ReplicationPackageImporter.class);
        ReplicationPackageExporter packageExporter = mock(ReplicationPackageExporter.class);
        ReplicationRequestAuthorizationStrategy packageExporterStrategy = mock(ReplicationRequestAuthorizationStrategy.class);
        ReplicationQueueProvider queueProvider = mock(ReplicationQueueProvider.class);
        ReplicationQueueDistributionStrategy distributionHandler = mock(ReplicationQueueDistributionStrategy.class);
        ReplicationEventFactory replicationEventFactory = mock(ReplicationEventFactory.class);
View Full Code Here

    }

    @Test
    public void testReplication() throws Exception {
        String name = "sample-agent";
        ReplicationPackageImporter packageImporter = mock(ReplicationPackageImporter.class);
        ReplicationPackageExporter packageExporter = mock(ReplicationPackageExporter.class);
        ReplicationRequestAuthorizationStrategy packageExporterStrategy = mock(ReplicationRequestAuthorizationStrategy.class);
        ReplicationQueueProvider queueProvider = mock(ReplicationQueueProvider.class);
        ReplicationQueueDistributionStrategy distributionHandler = mock(ReplicationQueueDistributionStrategy.class);
        ReplicationEventFactory replicationEventFactory = mock(ReplicationEventFactory.class);
View Full Code Here

    }

    @Test
    public void testGetDefaultQueue() throws Exception {
        String name = "sample-agent";
        ReplicationPackageImporter packageImporter = mock(ReplicationPackageImporter.class);
        ReplicationPackageExporter packageExporter = mock(ReplicationPackageExporter.class);
        ReplicationRequestAuthorizationStrategy packageExporterStrategy = mock(ReplicationRequestAuthorizationStrategy.class);

        ReplicationQueueProvider queueProvider = mock(ReplicationQueueProvider.class);
        ReplicationQueueDistributionStrategy distributionHandler = mock(ReplicationQueueDistributionStrategy.class);
View Full Code Here

    }

    @Test
    public void testGetExistingNamedQueue() throws Exception {
        String name = "sample-agent";
        ReplicationPackageImporter packageImporter = mock(ReplicationPackageImporter.class);
        ReplicationPackageExporter packageExporter = mock(ReplicationPackageExporter.class);
        ReplicationRequestAuthorizationStrategy packageExporterStrategy = mock(ReplicationRequestAuthorizationStrategy.class);

        ReplicationQueueProvider queueProvider = mock(ReplicationQueueProvider.class);
        ReplicationQueueDistributionStrategy distributionHandler = mock(ReplicationQueueDistributionStrategy.class);
View Full Code Here

    }

    @Test
    public void testGetNonExistingNamedQueue() throws Exception {
        String name = "sample-agent";
        ReplicationPackageImporter packageImporter = mock(ReplicationPackageImporter.class);
        ReplicationPackageExporter packageExporter = mock(ReplicationPackageExporter.class);
        ReplicationRequestAuthorizationStrategy packageExporterStrategy = mock(ReplicationRequestAuthorizationStrategy.class);

        ReplicationQueueProvider queueProvider = mock(ReplicationQueueProvider.class);
        ReplicationQueueDistributionStrategy distributionHandler = mock(ReplicationQueueDistributionStrategy.class);
View Full Code Here

TOP

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

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.