Package org.apache.sling.replication.serialization

Examples of org.apache.sling.replication.serialization.ReplicationPackageBuilder


            String name = PropertiesUtil.toString(properties.get(COMPONENT_NAME), null);
            return componentProvider.getComponent(ReplicationPackageExporter.class, name);

        } else if (PACKAGE_EXPORTER_LOCAL.equals(factory)) {
            Map<String, Object> builderProperties = extractMap(COMPONENT_PACKAGE_BUILDER, properties);
            ReplicationPackageBuilder packageBuilder = createBuilder(builderProperties);
            return new LocalReplicationPackageExporter(packageBuilder);
        } else if (PACKAGE_EXPORTER_REMOTE.equals(factory)) {
            Map<String, Object> authenticationProviderProperties = extractMap(COMPONENT_TRANSPORT_AUTHENTICATION_PROVIDER, properties);
            TransportAuthenticationProvider authenticationProvider = createTransportAuthenticationProvider(authenticationProviderProperties, componentProvider);

            Map<String, Object> builderProperties = extractMap(COMPONENT_PACKAGE_BUILDER, properties);
            ReplicationPackageBuilder packageBuilder = createBuilder(builderProperties);


            String[] endpoints = PropertiesUtil.toStringArray(properties.get(PACKAGE_EXPORTER_REMOTE_PROPERTY_ENDPOINTS), new String[0]);
            String endpointStrategyName = PropertiesUtil.toString(properties.get(PACKAGE_EXPORTER_REMOTE_PROPERTY_ENDPOINTS_STRATEGY), "One");
            int pollItems = PropertiesUtil.toInteger(properties.get(PACKAGE_EXPORTER_REMOTE_PROPERTY_POLL_ITEMS), Integer.MAX_VALUE);

            return new RemoteReplicationPackageExporter(packageBuilder, authenticationProvider, endpoints, endpointStrategyName, pollItems);
        } else if (PACKAGE_EXPORTER_AGENT.equals(factory)) {
            Map<String, Object> builderProperties = extractMap(COMPONENT_PACKAGE_BUILDER, properties);
            ReplicationPackageBuilder packageBuilder = createBuilder(builderProperties);
            ReplicationAgent agent = componentProvider.getComponent(ReplicationAgent.class, null);

            return new AgentReplicationPackageExporter(properties, agent, packageBuilder);
        }
View Full Code Here


        if (COMPONENT_TYPE_SERVICE.equals(factory)) {
            String name = PropertiesUtil.toString(properties.get(COMPONENT_NAME), null);
            return componentProvider.getComponent(ReplicationPackageImporter.class, name);
        } else if (PACKAGE_IMPORTER_LOCAL.equals(factory)) {
            Map<String, Object> builderProperties = extractMap(COMPONENT_PACKAGE_BUILDER, properties);
            ReplicationPackageBuilder packageBuilder = createBuilder(builderProperties);
            return new LocalReplicationPackageImporter(packageBuilder, replicationEventFactory);
        } else if (PACKAGE_IMPORTER_REMOTE.equals(factory)) {
            Map<String, Object> authenticationProviderProperties = extractMap(COMPONENT_TRANSPORT_AUTHENTICATION_PROVIDER, properties);
            TransportAuthenticationProvider authenticationProvider = createTransportAuthenticationProvider(authenticationProviderProperties, componentProvider);
View Full Code Here

*/
public class LocalReplicationPackageImporterTest {

    @Test
    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);
View Full Code Here

*/
public class LocalReplicationPackageExporterTest {

    @Test
    public void testDummyExport() throws Exception {
        ReplicationPackageBuilder packageBuilder = mock(ReplicationPackageBuilder.class);
        LocalReplicationPackageExporter localReplicationPackageExporter = new LocalReplicationPackageExporter(packageBuilder);
        ResourceResolver resourceResolver = mock(ResourceResolver.class);
        ReplicationRequest replicationRequest = mock(ReplicationRequest.class);
        List<ReplicationPackage> replicationPackages = localReplicationPackageExporter.exportPackages(resourceResolver, replicationRequest);
        assertNotNull(replicationPackages);
View Full Code Here

*/
public class RemoteReplicationPackageExporterTest {

    @Test
    public void testDummyExport() throws Exception {
        ReplicationPackageBuilder packageBuilder = mock(ReplicationPackageBuilder.class);
        TransportAuthenticationProvider authProvider = mock(TransportAuthenticationProvider.class);
        String[] endpoints = new String[0];
        for (TransportEndpointStrategyType strategy : TransportEndpointStrategyType.values()) {
            RemoteReplicationPackageExporter remoteReplicationPackageExporter = new RemoteReplicationPackageExporter(
                    packageBuilder, authProvider, endpoints, strategy.name(), 1);
View Full Code Here

        Executor executor = mock(Executor.class);
        Response response = mock(Response.class);
        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);
        int maxNoOfPackages = Integer.MAX_VALUE;
        SimpleHttpReplicationTransportHandler simpleHttpReplicationTransportHandler = new SimpleHttpReplicationTransportHandler(
                authProvider, endpoint, packageBuilder, maxNoOfPackages);
        ResourceResolver resourceResolver = mock(ResourceResolver.class);
        ReplicationPackage replicationPackage = mock(ReplicationPackage.class);
View Full Code Here

        when(httpResponse.getStatusLine()).thenReturn(statusLine);
        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);
        int maxNoOfPackages = 1;
        SimpleHttpReplicationTransportHandler simpleHttpReplicationTransportHandler = new SimpleHttpReplicationTransportHandler(
                authProvider, endpoint, packageBuilder, maxNoOfPackages);
        ResourceResolver resourceResolver = mock(ResourceResolver.class);
        ReplicationRequest replicationRequest = new ReplicationRequest(ReplicationActionType.ADD, new String[]{"/"});
View Full Code Here

        when(httpResponse.getEntity()).thenReturn(entity);
        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);
        ReplicationRequest replicationRequest = new ReplicationRequest(ReplicationActionType.ADD, new String[]{"/"});
View Full Code Here

TOP

Related Classes of org.apache.sling.replication.serialization.ReplicationPackageBuilder

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.