use of org.apache.sling.installer.api.tasks.InstallTask in project sling by apache.
the class TaskOrderingTest method testBundleStartOrder.
@org.junit.Test
public void testBundleStartOrder() {
int testIndex = 1;
final InstallTask[] tasksInOrder = { new BundleStartTask(null, 0, null), new BundleStartTask(null, 1, null), new BundleStartTask(null, 5, null), new BundleStartTask(null, 11, null), new BundleStartTask(null, 51, null) };
taskSet.clear();
for (int i = tasksInOrder.length - 1; i >= 0; i--) {
taskSet.add(tasksInOrder[i]);
}
assertOrder(testIndex++, taskSet, tasksInOrder);
taskSet.clear();
for (int i = 0; i < tasksInOrder.length; i++) {
taskSet.add(tasksInOrder[i]);
}
assertOrder(testIndex++, taskSet, tasksInOrder);
}
use of org.apache.sling.installer.api.tasks.InstallTask in project sling by apache.
the class BundleTaskCreatorTest method testSingleBundleNew.
@Test
public void testSingleBundleNew() throws IOException {
final TaskResource[] r = { new MockBundleResource(SN, "1.0") };
final MockBundleTaskCreator c = new MockBundleTaskCreator();
final SortedSet<InstallTask> s = getTasks(r, c);
assertEquals("Expected one task", 1, s.size());
assertTrue("Expected a BundleInstallTask", s.first() instanceof BundleInstallTask);
}
use of org.apache.sling.installer.api.tasks.InstallTask in project sling by apache.
the class BundleTaskCreatorTest method getTasks.
private SortedSet<InstallTask> getTasks(TaskResource[] resources, BundleTaskCreator btc) throws IOException {
final SortedSet<TaskResource> sortedResources = new TreeSet<TaskResource>();
for (final TaskResource rr : resources) {
sortedResources.add(rr);
}
final SortedSet<InstallTask> tasks = new TreeSet<InstallTask>();
for (final TaskResource r : sortedResources) {
final EntityResourceList erl = new EntityResourceList(r.getEntityId(), new MockInstallationListener());
erl.addOrUpdate(((MockBundleResource) r).getRegisteredResourceImpl());
assertNotNull(erl.getActiveResource());
tasks.add(btc.createTask(erl));
}
return tasks;
}
Aggregations