Search in sources :

Example 1 with PackagingImpl

use of org.apache.jackrabbit.vault.packaging.impl.PackagingImpl in project sling by apache.

the class LocalDistributionPackageImporterTest method importPackageWithLargeHeader.

@Test
public void importPackageWithLargeHeader() throws Exception {
    DistributionPackageBuilder packageBuilder = mock(DistributionPackageBuilder.class);
    DistributionEventFactory distributionEventFactory = mock(DistributionEventFactory.class);
    LocalDistributionPackageImporter localdistributionPackageImporter = new LocalDistributionPackageImporter("mockImporter", distributionEventFactory, packageBuilder);
    FileVaultContentSerializer vaultSerializer = new FileVaultContentSerializer("importPackageWithLargeHeader", new PackagingImpl(), ImportMode.UPDATE, AccessControlHandling.IGNORE, new String[0], new String[0], new String[0], false, -1);
    DistributionPackageBuilder builder = new FileDistributionPackageBuilder(DistributionRequestType.ADD.name(), vaultSerializer, null, null, null, null);
    ResourceResolver resourceResolver = slingContext.resourceResolver();
    String[] paths = createPaths(resourceResolver, 1000, "/content/company/de/press-releases/2016/11/04/message");
    DistributionPackage pkg = builder.createPackage(resourceResolver, new SimpleDistributionRequest(DistributionRequestType.ADD, paths));
    InputStream streamWithHeader = DistributionPackageUtils.createStreamWithHeader(pkg);
    localdistributionPackageImporter.importStream(resourceResolver, streamWithHeader);
}
Also used : FileDistributionPackageBuilder(org.apache.sling.distribution.packaging.impl.FileDistributionPackageBuilder) SimpleDistributionRequest(org.apache.sling.distribution.SimpleDistributionRequest) DistributionPackage(org.apache.sling.distribution.packaging.DistributionPackage) InputStream(java.io.InputStream) FileDistributionPackageBuilder(org.apache.sling.distribution.packaging.impl.FileDistributionPackageBuilder) DistributionPackageBuilder(org.apache.sling.distribution.packaging.DistributionPackageBuilder) ResourceResolver(org.apache.sling.api.resource.ResourceResolver) DistributionEventFactory(org.apache.sling.distribution.event.impl.DistributionEventFactory) PackagingImpl(org.apache.jackrabbit.vault.packaging.impl.PackagingImpl) FileVaultContentSerializer(org.apache.sling.distribution.serialization.impl.vlt.FileVaultContentSerializer) Test(org.junit.Test)

Aggregations

InputStream (java.io.InputStream)1 PackagingImpl (org.apache.jackrabbit.vault.packaging.impl.PackagingImpl)1 ResourceResolver (org.apache.sling.api.resource.ResourceResolver)1 SimpleDistributionRequest (org.apache.sling.distribution.SimpleDistributionRequest)1 DistributionEventFactory (org.apache.sling.distribution.event.impl.DistributionEventFactory)1 DistributionPackage (org.apache.sling.distribution.packaging.DistributionPackage)1 DistributionPackageBuilder (org.apache.sling.distribution.packaging.DistributionPackageBuilder)1 FileDistributionPackageBuilder (org.apache.sling.distribution.packaging.impl.FileDistributionPackageBuilder)1 FileVaultContentSerializer (org.apache.sling.distribution.serialization.impl.vlt.FileVaultContentSerializer)1 Test (org.junit.Test)1