Search in sources :

Example 31 with SlingRepository

use of org.apache.sling.jcr.api.SlingRepository in project sling by apache.

the class ImportingDistributionPackageProcessorTest method testGetAllResponses.

@Test
public void testGetAllResponses() throws Exception {
    DistributionPackageImporter importer = mock(DistributionPackageImporter.class);
    SlingRepository repository = mock(SlingRepository.class);
    String agentService = "agentService";
    ResourceResolverFactory resourceResolverFactory = mock(ResourceResolverFactory.class);
    String subServiceName = "ssn";
    SimpleDistributionAgentAuthenticationInfo authInfo = new SimpleDistributionAgentAuthenticationInfo(repository, agentService, resourceResolverFactory, subServiceName);
    String callingUser = "foo";
    String requestId = "123";
    DefaultDistributionLog log = mock(DefaultDistributionLog.class);
    ImportingDistributionPackageProcessor processor = new ImportingDistributionPackageProcessor(importer, authInfo, callingUser, requestId, log);
    assertNotNull(processor.getAllResponses());
    assertTrue(processor.getAllResponses().isEmpty());
}
Also used : SlingRepository(org.apache.sling.jcr.api.SlingRepository) ResourceResolverFactory(org.apache.sling.api.resource.ResourceResolverFactory) DistributionPackageImporter(org.apache.sling.distribution.packaging.DistributionPackageImporter) DefaultDistributionLog(org.apache.sling.distribution.log.impl.DefaultDistributionLog) Test(org.junit.Test)

Example 32 with SlingRepository

use of org.apache.sling.jcr.api.SlingRepository in project sling by apache.

the class ImportingDistributionPackageProcessorTest method testGetPackagesCount.

@Test
public void testGetPackagesCount() throws Exception {
    DistributionPackageImporter importer = mock(DistributionPackageImporter.class);
    SlingRepository repository = mock(SlingRepository.class);
    String agentService = "agentService";
    ResourceResolverFactory resourceResolverFactory = mock(ResourceResolverFactory.class);
    String subServiceName = "ssn";
    SimpleDistributionAgentAuthenticationInfo authInfo = new SimpleDistributionAgentAuthenticationInfo(repository, agentService, resourceResolverFactory, subServiceName);
    String callingUser = "foo";
    String requestId = "123";
    DefaultDistributionLog log = mock(DefaultDistributionLog.class);
    ImportingDistributionPackageProcessor processor = new ImportingDistributionPackageProcessor(importer, authInfo, callingUser, requestId, log);
    assertEquals(0, processor.getPackagesCount());
}
Also used : SlingRepository(org.apache.sling.jcr.api.SlingRepository) ResourceResolverFactory(org.apache.sling.api.resource.ResourceResolverFactory) DistributionPackageImporter(org.apache.sling.distribution.packaging.DistributionPackageImporter) DefaultDistributionLog(org.apache.sling.distribution.log.impl.DefaultDistributionLog) Test(org.junit.Test)

Example 33 with SlingRepository

use of org.apache.sling.jcr.api.SlingRepository in project sling by apache.

the class ImportingDistributionPackageProcessorTest method testGetPackagesSize.

@Test
public void testGetPackagesSize() throws Exception {
    DistributionPackageImporter importer = mock(DistributionPackageImporter.class);
    SlingRepository repository = mock(SlingRepository.class);
    String agentService = "agentService";
    ResourceResolverFactory resourceResolverFactory = mock(ResourceResolverFactory.class);
    String subServiceName = "ssn";
    SimpleDistributionAgentAuthenticationInfo authInfo = new SimpleDistributionAgentAuthenticationInfo(repository, agentService, resourceResolverFactory, subServiceName);
    String callingUser = "foo";
    String requestId = "123";
    DefaultDistributionLog log = mock(DefaultDistributionLog.class);
    ImportingDistributionPackageProcessor processor = new ImportingDistributionPackageProcessor(importer, authInfo, callingUser, requestId, log);
    assertEquals(0, processor.getPackagesSize());
}
Also used : SlingRepository(org.apache.sling.jcr.api.SlingRepository) ResourceResolverFactory(org.apache.sling.api.resource.ResourceResolverFactory) DistributionPackageImporter(org.apache.sling.distribution.packaging.DistributionPackageImporter) DefaultDistributionLog(org.apache.sling.distribution.log.impl.DefaultDistributionLog) Test(org.junit.Test)

Aggregations

SlingRepository (org.apache.sling.jcr.api.SlingRepository)33 Test (org.junit.Test)18 ResourceResolverFactory (org.apache.sling.api.resource.ResourceResolverFactory)14 Session (javax.jcr.Session)12 Event (javax.jcr.observation.Event)10 Scheduler (org.apache.sling.commons.scheduler.Scheduler)9 DistributionRequest (org.apache.sling.distribution.DistributionRequest)9 Credentials (javax.jcr.Credentials)4 Node (javax.jcr.Node)4 DefaultDistributionLog (org.apache.sling.distribution.log.impl.DefaultDistributionLog)4 DistributionPackage (org.apache.sling.distribution.packaging.DistributionPackage)4 DistributionPackageImporter (org.apache.sling.distribution.packaging.DistributionPackageImporter)4 Before (org.junit.Before)4 SimpleCredentials (javax.jcr.SimpleCredentials)3 Workspace (javax.jcr.Workspace)3 ObservationManager (javax.jcr.observation.ObservationManager)3 ResourceResolver (org.apache.sling.api.resource.ResourceResolver)3 Repository (javax.jcr.Repository)2 RepositoryException (javax.jcr.RepositoryException)2 AccessControlManager (javax.jcr.security.AccessControlManager)2