use of java.util.SortedSet in project sling by apache.
the class BundleTaskCreatorTest method testBundleUpgradeSnapshot.
@Test
public void testBundleUpgradeSnapshot() throws IOException {
// Need to use OSGi-compliant version number, in bundles
// bnd and other tools generate correct numbers.
final String v = "2.0.7.SNAPSHOT";
final TaskResource[] r = { new MockBundleResource(SN, v) };
{
final MockBundleTaskCreator c = new MockBundleTaskCreator();
c.addBundleInfo(SN, v, Bundle.ACTIVE);
final SortedSet<InstallTask> s = getTasks(r, c);
assertEquals("Expected one task", 1, s.size());
assertTrue("Expected a BundleUpdateTask", s.first() instanceof BundleUpdateTask);
}
}
use of java.util.SortedSet in project sling by apache.
the class BundleTaskCreatorTest method testDowngradeOfRemovedResource.
@Test
public void testDowngradeOfRemovedResource() throws IOException {
final MockBundleResource[] r = { new MockBundleResource(SN, "1.0.0"), new MockBundleResource(SN, "1.1.0") };
// Simulate V1.1 installed but resource is gone -> downgrade to 1.0
r[1].setState(ResourceState.UNINSTALL);
{
final MockBundleTaskCreator c = new MockBundleTaskCreator();
c.addBundleInfo(SN, "1.1.0", Bundle.ACTIVE);
final SortedSet<InstallTask> s = getTasks(r, c);
assertEquals("Expected two tasks", 2, s.size());
final Iterator<InstallTask> i = s.iterator();
final InstallTask first = i.next();
assertTrue("Expected a ChangeStateTask:" + first, first instanceof ChangeStateTask);
final InstallTask second = i.next();
assertTrue("Expected a BundleRemoveTask", second instanceof BundleRemoveTask);
final BundleRemoveTask t = (BundleRemoveTask) second;
assertEquals("Remove should be to V1.1", r[1].getEntityId(), t.getResource().getEntityId());
}
}
use of java.util.SortedSet in project processdash by dtuma.
the class EVTaskDependencyResolver method getTaskListsContaining.
public List getTaskListsContaining(String taskID) {
if (taskID == null)
return null;
Matcher m = TASK_ID_PATTERN.matcher(taskID);
if (!m.matches())
return null;
else
// At the moment, this will ignore the extra path info on the
// task ID, and resolve only based on the initial task ID portion.
// this should not cause problems, because all dependencies with
// extra path information should have been created with an
// explicit task list target, and this routine might never get
// called. If it does, we'll return all task lists which contain
// the base taskID, regardless of whether they actually contain a
// task descendant named by the extra path.
taskID = m.group(PAT_GROUP_TASK_ID);
maybeRefreshCache();
SortedSet infoList = (SortedSet) taskCache.get(taskID);
if (infoList == null || infoList.isEmpty())
return null;
else {
List result = new LinkedList();
for (Iterator i = infoList.iterator(); i.hasNext(); ) {
TaskListInfo info = (TaskListInfo) i.next();
result.add(info.getTaskListName());
}
return result;
}
}
use of java.util.SortedSet in project processdash by dtuma.
the class EVTaskDependencyResolver method getCanonicalTaskName.
public String getCanonicalTaskName(String taskID) {
maybeRefreshNameCache();
SortedSet infoList = (SortedSet) nameCache.get(taskID);
if (infoList == null || infoList.isEmpty())
return null;
else {
TaskNameInfo info = (TaskNameInfo) infoList.first();
return info.getTaskName();
}
}
use of java.util.SortedSet in project winery by eclipse.
the class Util method convertQNameListToNamespaceToLocalNameList.
public static SortedMap<String, SortedSet<String>> convertQNameListToNamespaceToLocalNameList(List<QName> list) {
SortedMap<String, SortedSet<String>> res = new TreeMap<>();
for (QName qname : list) {
SortedSet<String> localNameSet = res.computeIfAbsent(qname.getNamespaceURI(), k -> new TreeSet<>());
localNameSet.add(qname.getLocalPart());
}
return res;
}
Aggregations