use of org.osgi.framework.Version in project aries by apache.
the class FragmentHostHeaderTest method testSymbolicName.
@Test
public void testSymbolicName() {
String headerStr = "org.foo";
FragmentHostHeader header = new FragmentHostHeader(headerStr);
assertClauses(header, 1);
assertSymbolicName(header.getClauses().iterator().next(), headerStr);
assertBundleVersionAttribute(header.getClauses().iterator().next(), new VersionRange(VersionRange.LEFT_CLOSED, new Version("0"), null, VersionRange.RIGHT_OPEN));
}
use of org.osgi.framework.Version in project aries by apache.
the class ManifestHeaderProcessorTest method testIP2LocationCapability.
private void testIP2LocationCapability(GenericMetadata cap) {
assertEquals(0, cap.getDirectives().size());
assertEquals(4, cap.getAttributes().size());
assertEquals(new Version(1, 3, 0), cap.getAttributes().get("version"));
assertEquals(Arrays.asList("nl", "be", "fr", "uk"), cap.getAttributes().get("country"));
assertEquals(Long.MAX_VALUE, cap.getAttributes().get("long"));
assertEquals(0, new Double("3.141592653589793").compareTo((Double) cap.getAttributes().get("d")));
}
use of org.osgi.framework.Version in project aries by apache.
the class ManifestHeaderProcessorTest method testDictionaryCapability1.
private void testDictionaryCapability1(GenericMetadata cap) {
assertEquals(2, cap.getDirectives().size());
assertEquals("resolve", cap.getDirectives().get("effective"));
assertEquals("test", cap.getDirectives().get("somedir"));
assertEquals(3, cap.getAttributes().size());
assertEquals("nl", cap.getAttributes().get("from"));
assertEquals("de", cap.getAttributes().get("to"));
assertEquals(new Version(3, 4, 0, "test"), cap.getAttributes().get("version"));
}
use of org.osgi.framework.Version in project aries by apache.
the class BundleCompatibility method isVersionCorrect.
static boolean isVersionCorrect(VERSION_CHANGE_TYPE status, String oldVersionStr, String newVersionStr) {
boolean versionCorrect = false;
Version oldVersion = Version.parseVersion(oldVersionStr);
Version newVersion = Version.parseVersion(newVersionStr);
if (status == VERSION_CHANGE_TYPE.MAJOR_CHANGE) {
if (newVersion.getMajor() > oldVersion.getMajor()) {
versionCorrect = true;
}
} else if (status == VERSION_CHANGE_TYPE.MINOR_CHANGE) {
if ((newVersion.getMajor() > oldVersion.getMajor()) || (newVersion.getMinor() > oldVersion.getMinor())) {
versionCorrect = true;
}
} else {
if ((newVersion.getMajor() >= oldVersion.getMajor()) && (newVersion.getMinor() >= oldVersion.getMinor())) {
versionCorrect = true;
}
}
return versionCorrect;
}
use of org.osgi.framework.Version in project aries by apache.
the class BundleManifest method getVersion.
public Version getVersion() {
String specifiedVersion = manifest.getMainAttributes().getValue(Constants.BUNDLE_VERSION);
Version result = (specifiedVersion == null) ? Version.emptyVersion : new Version(specifiedVersion);
return result;
}
Aggregations