Search in sources :

Example 11 with InstallTask

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);
}
Also used : BundleStartTask(org.apache.sling.installer.core.impl.tasks.BundleStartTask) InstallTask(org.apache.sling.installer.api.tasks.InstallTask) BundleInstallTask(org.apache.sling.installer.core.impl.tasks.BundleInstallTask)

Example 12 with InstallTask

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);
}
Also used : TaskResource(org.apache.sling.installer.api.tasks.TaskResource) MockBundleResource(org.apache.sling.installer.core.impl.MockBundleResource) InstallTask(org.apache.sling.installer.api.tasks.InstallTask) Test(org.junit.Test)

Example 13 with InstallTask

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;
}
Also used : TaskResource(org.apache.sling.installer.api.tasks.TaskResource) TreeSet(java.util.TreeSet) InstallTask(org.apache.sling.installer.api.tasks.InstallTask) EntityResourceList(org.apache.sling.installer.core.impl.EntityResourceList)

Aggregations

InstallTask (org.apache.sling.installer.api.tasks.InstallTask)13 TaskResource (org.apache.sling.installer.api.tasks.TaskResource)6 ChangeStateTask (org.apache.sling.installer.api.tasks.ChangeStateTask)4 BundleInstallTask (org.apache.sling.installer.core.impl.tasks.BundleInstallTask)4 BundleStartTask (org.apache.sling.installer.core.impl.tasks.BundleStartTask)4 RefreshBundlesTask (org.apache.sling.installer.core.impl.tasks.RefreshBundlesTask)3 TreeSet (java.util.TreeSet)2 EntityResourceList (org.apache.sling.installer.core.impl.EntityResourceList)2 MockBundleResource (org.apache.sling.installer.core.impl.MockBundleResource)2 BundleRemoveTask (org.apache.sling.installer.core.impl.tasks.BundleRemoveTask)2 BundleUpdateTask (org.apache.sling.installer.core.impl.tasks.BundleUpdateTask)2 Test (org.junit.Test)2 Version (org.osgi.framework.Version)2 Iterator (java.util.Iterator)1 SortedSet (java.util.SortedSet)1 InstallTaskFactory (org.apache.sling.installer.api.tasks.InstallTaskFactory)1 InstallationContext (org.apache.sling.installer.api.tasks.InstallationContext)1 RegisteredResourceImpl (org.apache.sling.installer.core.impl.RegisteredResourceImpl)1 Util (org.apache.sling.installer.core.impl.Util)1 Bundle (org.osgi.framework.Bundle)1