Search in sources :

Example 6 with DistributionContentSerializer

use of org.apache.sling.distribution.serialization.DistributionContentSerializer in project sling by apache.

the class KryoContentSerializerTest method testBuildAndInstallOnSingleShallowPath.

@Test
public void testBuildAndInstallOnSingleShallowPath() throws Exception {
    String type = "kryo";
    DistributionContentSerializer contentSerializer = new KryoContentSerializer(type);
    String tempFilesFolder = "target";
    String[] nodeFilters = new String[0];
    String[] propertyFilters = new String[0];
    DistributionPackageBuilder packageBuilder = new FileDistributionPackageBuilder(type, contentSerializer, tempFilesFolder, null, nodeFilters, propertyFilters);
    DistributionRequest request = new SimpleDistributionRequest(DistributionRequestType.ADD, "/libs/sub");
    DistributionPackage distributionPackage = packageBuilder.createPackage(resourceResolver, request);
    Resource resource = resourceResolver.getResource("/libs/sub");
    resourceResolver.delete(resource);
    resourceResolver.commit();
    assertTrue(packageBuilder.installPackage(resourceResolver, distributionPackage));
    assertNotNull(resourceResolver.getResource("/libs"));
    assertNotNull(resourceResolver.getResource("/libs/sub"));
    assertNotNull(resourceResolver.getResource("/libs/sameLevel"));
}
Also used : FileDistributionPackageBuilder(org.apache.sling.distribution.packaging.impl.FileDistributionPackageBuilder) SimpleDistributionRequest(org.apache.sling.distribution.SimpleDistributionRequest) DistributionRequest(org.apache.sling.distribution.DistributionRequest) SimpleDistributionRequest(org.apache.sling.distribution.SimpleDistributionRequest) DistributionPackage(org.apache.sling.distribution.packaging.DistributionPackage) FileDistributionPackageBuilder(org.apache.sling.distribution.packaging.impl.FileDistributionPackageBuilder) DistributionPackageBuilder(org.apache.sling.distribution.packaging.DistributionPackageBuilder) Resource(org.apache.sling.api.resource.Resource) DistributionContentSerializer(org.apache.sling.distribution.serialization.DistributionContentSerializer) Test(org.junit.Test)

Example 7 with DistributionContentSerializer

use of org.apache.sling.distribution.serialization.DistributionContentSerializer in project sling by apache.

the class KryoContentSerializerTest method testBuildAndInstallOnMultipleShallowPaths.

@Test
public void testBuildAndInstallOnMultipleShallowPaths() throws Exception {
    String type = "kryo";
    DistributionContentSerializer contentSerializer = new KryoContentSerializer(type);
    String tempFilesFolder = "target";
    String[] nodeFilters = new String[0];
    String[] propertyFilters = new String[0];
    DistributionPackageBuilder packageBuilder = new FileDistributionPackageBuilder(type, contentSerializer, tempFilesFolder, null, nodeFilters, propertyFilters);
    DistributionRequest request = new SimpleDistributionRequest(DistributionRequestType.ADD, "/libs/sub", "/libs/sameLevel");
    DistributionPackage distributionPackage = packageBuilder.createPackage(resourceResolver, request);
    Resource resource = resourceResolver.getResource("/libs/sub");
    resourceResolver.delete(resource);
    resource = resourceResolver.getResource("/libs/sameLevel");
    resourceResolver.delete(resource);
    resourceResolver.commit();
    assertTrue(packageBuilder.installPackage(resourceResolver, distributionPackage));
    assertNotNull(resourceResolver.getResource("/libs"));
    assertNotNull(resourceResolver.getResource("/libs/sub"));
    assertNotNull(resourceResolver.getResource("/libs/sameLevel"));
}
Also used : FileDistributionPackageBuilder(org.apache.sling.distribution.packaging.impl.FileDistributionPackageBuilder) SimpleDistributionRequest(org.apache.sling.distribution.SimpleDistributionRequest) DistributionRequest(org.apache.sling.distribution.DistributionRequest) SimpleDistributionRequest(org.apache.sling.distribution.SimpleDistributionRequest) DistributionPackage(org.apache.sling.distribution.packaging.DistributionPackage) FileDistributionPackageBuilder(org.apache.sling.distribution.packaging.impl.FileDistributionPackageBuilder) DistributionPackageBuilder(org.apache.sling.distribution.packaging.DistributionPackageBuilder) Resource(org.apache.sling.api.resource.Resource) DistributionContentSerializer(org.apache.sling.distribution.serialization.DistributionContentSerializer) Test(org.junit.Test)

Aggregations

DistributionPackageBuilder (org.apache.sling.distribution.packaging.DistributionPackageBuilder)7 FileDistributionPackageBuilder (org.apache.sling.distribution.packaging.impl.FileDistributionPackageBuilder)7 DistributionContentSerializer (org.apache.sling.distribution.serialization.DistributionContentSerializer)7 Resource (org.apache.sling.api.resource.Resource)6 DistributionRequest (org.apache.sling.distribution.DistributionRequest)6 SimpleDistributionRequest (org.apache.sling.distribution.SimpleDistributionRequest)6 DistributionPackage (org.apache.sling.distribution.packaging.DistributionPackage)6 Test (org.junit.Test)6 Hashtable (java.util.Hashtable)1 ImportMode (org.apache.jackrabbit.vault.fs.api.ImportMode)1 AccessControlHandling (org.apache.jackrabbit.vault.fs.io.AccessControlHandling)1 MonitoringDistributionPackageBuilder (org.apache.sling.distribution.monitor.impl.MonitoringDistributionPackageBuilder)1 ResourceDistributionPackageBuilder (org.apache.sling.distribution.packaging.impl.ResourceDistributionPackageBuilder)1 ResourceDistributionPackageCleanup (org.apache.sling.distribution.packaging.impl.ResourceDistributionPackageCleanup)1 MemoryUnit (org.apache.sling.distribution.util.impl.FileBackedMemoryOutputStream.MemoryUnit)1