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);
}
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);
}
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());
}
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());
}
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());
}
Aggregations