use of org.apache.aries.application.modelling.internal.PackageRequirementMerger in project aries by apache.
the class PackageRequirementMergerTest method testMergeInvalidAdditionalAttributes.
@Test
public void testMergeInvalidAdditionalAttributes() throws Exception {
Collection<ImportedPackage> reqs = new ArrayList<ImportedPackage>();
reqs.add(newImportedPackage("a", "1.0.0", "foo=bar"));
reqs.add(newImportedPackage("a", "2.0.0", "foo=blah"));
reqs.add(newImportedPackage("b", "1.0.0"));
PackageRequirementMerger merger = new PackageRequirementMerger(reqs);
Assert.assertFalse(merger.isMergeSuccessful());
try {
merger.getMergedRequirements();
Assert.fail("getMergedRequirements should throw IllegalStateException.");
} catch (IllegalStateException e) {
}
Set<String> result = merger.getInvalidRequirements();
Set<String> expected = new HashSet<String>();
expected.add("a");
Assert.assertEquals(expected, result);
}
use of org.apache.aries.application.modelling.internal.PackageRequirementMerger in project aries by apache.
the class PackageRequirementMergerTest method testMergeOptionalResolution.
@Test
public void testMergeOptionalResolution() throws Exception {
Collection<ImportedPackage> reqs = new ArrayList<ImportedPackage>();
reqs.add(newImportedPackage("a", "1.0.0", true));
reqs.add(newImportedPackage("a", "2.0.0", true));
PackageRequirementMerger merger = new PackageRequirementMerger(reqs);
Assert.assertTrue(merger.isMergeSuccessful());
Assert.assertTrue(merger.getInvalidRequirements().isEmpty());
Collection<ImportedPackage> result = merger.getMergedRequirements();
Collection<ImportedPackage> expected = new ArrayList<ImportedPackage>();
expected.add(newImportedPackage("a", "2.0.0", true));
Assert.assertTrue(result.toString(), isEqual(result, expected));
}
Aggregations