Search in sources :

Example 6 with DefaultDistributionLog

use of org.apache.sling.distribution.log.impl.DefaultDistributionLog in project sling by apache.

the class TriggerAgentRequestHandlerTest method testHandlePassive.

@Test
public void testHandlePassive() throws Exception {
    DistributionAgent agent = mock(DistributionAgent.class);
    SimpleDistributionAgentAuthenticationInfo authenticationInfo = mock(SimpleDistributionAgentAuthenticationInfo.class);
    DefaultDistributionLog log = mock(DefaultDistributionLog.class);
    TriggerAgentRequestHandler triggerAgentRequestHandler = new TriggerAgentRequestHandler(agent, authenticationInfo, log, false);
    ResourceResolver resourceResolver = mock(ResourceResolver.class);
    DistributionRequest request = mock(DistributionRequest.class);
    triggerAgentRequestHandler.handle(resourceResolver, request);
}
Also used : DistributionAgent(org.apache.sling.distribution.agent.DistributionAgent) DistributionRequest(org.apache.sling.distribution.DistributionRequest) ResourceResolver(org.apache.sling.api.resource.ResourceResolver) DefaultDistributionLog(org.apache.sling.distribution.log.impl.DefaultDistributionLog) Test(org.junit.Test)

Example 7 with DefaultDistributionLog

use of org.apache.sling.distribution.log.impl.DefaultDistributionLog in project sling by apache.

the class ImportingDistributionPackageProcessorTest method testProcess.

@Test
public void testProcess() 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);
    DistributionPackage distributionPackage = mock(DistributionPackage.class);
    Map<String, Object> map = new HashMap<String, Object>();
    map.put(DistributionPackageInfo.PROPERTY_REQUEST_PATHS, "/");
    map.put(DistributionPackageInfo.PROPERTY_REQUEST_TYPE, DistributionRequestType.TEST);
    DistributionPackageInfo info = new DistributionPackageInfo("foo", map);
    when(distributionPackage.getInfo()).thenReturn(info);
    processor.process(distributionPackage);
}
Also used : SlingRepository(org.apache.sling.jcr.api.SlingRepository) DistributionPackage(org.apache.sling.distribution.packaging.DistributionPackage) ResourceResolverFactory(org.apache.sling.api.resource.ResourceResolverFactory) DistributionPackageInfo(org.apache.sling.distribution.packaging.DistributionPackageInfo) HashMap(java.util.HashMap) DistributionPackageImporter(org.apache.sling.distribution.packaging.DistributionPackageImporter) DefaultDistributionLog(org.apache.sling.distribution.log.impl.DefaultDistributionLog) Test(org.junit.Test)

Example 8 with DefaultDistributionLog

use of org.apache.sling.distribution.log.impl.DefaultDistributionLog in project sling by apache.

the class QueueingDistributionPackageProcessorTest method testGetAllResponses.

@Test
public void testGetAllResponses() throws Exception {
    String callingUser = "mr-who-cares";
    String requestId = "id231";
    long startTime = System.currentTimeMillis();
    DistributionEventFactory eventFactory = mock(DistributionEventFactory.class);
    DistributionQueueDispatchingStrategy scheduleQueueStrategy = mock(DistributionQueueDispatchingStrategy.class);
    DistributionQueueProvider queueProvider = mock(DistributionQueueProvider.class);
    DefaultDistributionLog log = mock(DefaultDistributionLog.class);
    String agentName = "dummy";
    QueueingDistributionPackageProcessor exporterProcessor = new QueueingDistributionPackageProcessor(callingUser, requestId, startTime, eventFactory, scheduleQueueStrategy, queueProvider, log, agentName);
    List<DistributionResponse> allResponses = exporterProcessor.getAllResponses();
    assertNotNull(allResponses);
    assertEquals(0, allResponses.size());
}
Also used : DistributionQueueDispatchingStrategy(org.apache.sling.distribution.queue.impl.DistributionQueueDispatchingStrategy) DistributionQueueProvider(org.apache.sling.distribution.queue.DistributionQueueProvider) DefaultDistributionLog(org.apache.sling.distribution.log.impl.DefaultDistributionLog) DistributionEventFactory(org.apache.sling.distribution.event.impl.DistributionEventFactory) DistributionResponse(org.apache.sling.distribution.DistributionResponse) Test(org.junit.Test)

Example 9 with DefaultDistributionLog

use of org.apache.sling.distribution.log.impl.DefaultDistributionLog 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 10 with DefaultDistributionLog

use of org.apache.sling.distribution.log.impl.DefaultDistributionLog 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)

Aggregations

DefaultDistributionLog (org.apache.sling.distribution.log.impl.DefaultDistributionLog)14 Test (org.junit.Test)11 DistributionEventFactory (org.apache.sling.distribution.event.impl.DistributionEventFactory)5 DistributionPackageImporter (org.apache.sling.distribution.packaging.DistributionPackageImporter)5 DistributionQueueProvider (org.apache.sling.distribution.queue.DistributionQueueProvider)5 ResourceResolverFactory (org.apache.sling.api.resource.ResourceResolverFactory)4 DistributionQueueDispatchingStrategy (org.apache.sling.distribution.queue.impl.DistributionQueueDispatchingStrategy)4 SlingRepository (org.apache.sling.jcr.api.SlingRepository)4 Activate (org.apache.felix.scr.annotations.Activate)2 ResourceResolver (org.apache.sling.api.resource.ResourceResolver)2 DistributionRequest (org.apache.sling.distribution.DistributionRequest)2 DistributionAgent (org.apache.sling.distribution.agent.DistributionAgent)2 DistributionPackage (org.apache.sling.distribution.packaging.DistributionPackage)2 DistributionPackageInfo (org.apache.sling.distribution.packaging.DistributionPackageInfo)2 DistributionQueueItemStatus (org.apache.sling.distribution.queue.DistributionQueueItemStatus)2 HttpConfiguration (org.apache.sling.distribution.transport.impl.HttpConfiguration)2 HashMap (java.util.HashMap)1 Hashtable (java.util.Hashtable)1 LinkedList (java.util.LinkedList)1 Map (java.util.Map)1