use of org.apache.sling.distribution.packaging.DistributionPackageInfo in project sling by apache.
the class PriorityQueueDispatchingStrategyTest method testMatchingDispatching.
@Test
public void testMatchingDispatching() throws Exception {
PriorityQueueDispatchingStrategy dispatchingStrategy = new PriorityQueueDispatchingStrategy(selectors, queueNames);
DistributionPackage distributionPackage = mock(SharedDistributionPackage.class);
DistributionQueueProvider queueProvider = mock(DistributionQueueProvider.class);
Map<String, Object> properties = new HashMap<String, Object>();
properties.put(DistributionPackageInfo.PROPERTY_REQUEST_PATHS, new String[] { "/content/news/a" });
when(distributionPackage.getInfo()).thenReturn(new DistributionPackageInfo("vlt", properties));
DistributionQueue news1 = mock(DistributionQueue.class);
when(news1.getName()).thenReturn("news-publish1");
when(queueProvider.getQueue("news-publish1")).thenReturn(news1);
DistributionQueue news2 = mock(DistributionQueue.class);
when(news2.getName()).thenReturn("news-publish2");
when(queueProvider.getQueue("news-publish2")).thenReturn(news2);
dispatchingStrategy.add(distributionPackage, queueProvider);
verify(queueProvider).getQueue("news-publish1");
verify(queueProvider).getQueue("news-publish2");
verifyNoMoreInteractions(queueProvider);
}
use of org.apache.sling.distribution.packaging.DistributionPackageInfo in project sling by apache.
the class ReferencePackageTest method testDelete.
@Test
public void testDelete() throws Exception {
DistributionPackage distributionPackage = mock(DistributionPackage.class);
String type = "dummy";
when(distributionPackage.getType()).thenReturn(type);
DistributionPackageInfo info = new DistributionPackageInfo(type, new HashMap<String, Object>());
when(distributionPackage.getInfo()).thenReturn(info);
ReferencePackage referencePackage = new ReferencePackage(distributionPackage);
assertNotNull(referencePackage);
referencePackage.delete();
}
use of org.apache.sling.distribution.packaging.DistributionPackageInfo in project sling by apache.
the class ReferencePackageTest method testGetType.
@Test
public void testGetType() throws Exception {
DistributionPackage distributionPackage = mock(DistributionPackage.class);
String type = "dummy";
when(distributionPackage.getType()).thenReturn(type);
DistributionPackageInfo info = new DistributionPackageInfo(type, new HashMap<String, Object>());
when(distributionPackage.getInfo()).thenReturn(info);
ReferencePackage referencePackage = new ReferencePackage(distributionPackage);
assertNotNull(referencePackage);
assertEquals(type, referencePackage.getType());
}
use of org.apache.sling.distribution.packaging.DistributionPackageInfo in project sling by apache.
the class ReferencePackageTest method testGetSize.
@Test
public void testGetSize() throws Exception {
DistributionPackage distributionPackage = mock(DistributionPackage.class);
String type = "dummy";
when(distributionPackage.getType()).thenReturn(type);
DistributionPackageInfo info = new DistributionPackageInfo(type, new HashMap<String, Object>());
when(distributionPackage.getInfo()).thenReturn(info);
when(distributionPackage.getSize()).thenReturn(10L);
ReferencePackage referencePackage = new ReferencePackage(distributionPackage);
assertNotNull(referencePackage);
long size = referencePackage.getSize();
// failing assertion with assertEquals shows more details in the message
// TODO don't we already know the expetced size? this assertion is not accurate...
assertEquals(size, referencePackage.getSize());
}
use of org.apache.sling.distribution.packaging.DistributionPackageInfo in project sling by apache.
the class ReferencePackageTest method testRelease.
@Test
public void testRelease() throws Exception {
DistributionPackage distributionPackage = mock(DistributionPackage.class);
String type = "dummy";
when(distributionPackage.getType()).thenReturn(type);
DistributionPackageInfo info = new DistributionPackageInfo(type, new HashMap<String, Object>());
when(distributionPackage.getInfo()).thenReturn(info);
ReferencePackage referencePackage = new ReferencePackage(distributionPackage);
assertNotNull(referencePackage);
referencePackage.release("queue1", "queue2");
}
Aggregations