def test_bundle_whitespaces(self): b = OSGiBundle.from_string(" bundle.name() 1 req1.abc,req2(ns) ") self.assertEqual(b.bundle, "bundle.name") self.assertEqual(b.version, "1") self.assertEqual(b.namespace, "") self.assertEqual(b.get_rpm_str(), "osgi(bundle.name) = 1") self.assertEqual(len(b.requires), 2)
def test_bundle_whitespaces(self): b = OSGiBundle.from_string(" bundle.name() 1 req1.abc,req2(ns) ") self.assertEqual(b.bundle, "bundle.name") self.assertEqual(b.version, "1") self.assertEqual(b.namespace, "") self.assertEqual(b.get_rpm_str(), "osgi(bundle.name) = 1") self.assertEqual(len(b.requires), 2)
def test_bundle_from_properties(self): props = {"osgi.id": "bundle.name", "osgi.version": "1"} b = OSGiBundle.from_properties(props) self.assertEqual(b.bundle, "bundle.name") self.assertEqual(b.version, "1") self.assertEqual(b.namespace, "") self.assertEqual(b.get_rpm_str(), "osgi(bundle.name) = 1") self.assertEqual(len(b.requires), 0)
def test_bundle_from_properties(self): props = {"osgi.id": "bundle.name", "osgi.version": "1"} b = OSGiBundle.from_properties(props) self.assertEqual(b.bundle, "bundle.name") self.assertEqual(b.version, "1") self.assertEqual(b.namespace, "") self.assertEqual(b.get_rpm_str(), "osgi(bundle.name) = 1") self.assertEqual(len(b.requires), 0)
def _process_buildroot(self): # "path: OSGiBundle" mapping cache = {} bundle_paths = self._find_paths() for path in bundle_paths: artifact = self._metadata_cache.get_artifact_for_path( path, can_be_dir=True) if artifact and artifact.has_osgi_information(): bundle = artifact.get_osgi_bundle() else: bundle = OSGiBundle.from_manifest(path) if bundle: cache.update({path: bundle}) return cache
def _process_buildroot(self): # "path: OSGiBundle" mapping cache = {} bundle_paths = self._find_paths() for path in bundle_paths: artifact = self._metadata_cache.get_artifact_for_path(path, can_be_dir=True) if artifact and artifact.has_osgi_information(): bundle = artifact.get_osgi_bundle() else: bundle = OSGiBundle.from_manifest(path) if bundle: if not bundle.namespace and self._scl: bundle.namespace = self._scl if bundle: cache.update({path: bundle}) return cache
def test_bundle_from_properties_complex(self): props = {"osgi.id": "bundle.name", "osgi.version": "1", "osgi.requires": "req1.abc,req2(ns2)", "osgi.namespace": "ns1" } b = OSGiBundle.from_properties(props) self.assertEqual(b.bundle, "bundle.name") self.assertEqual(b.version, "1") self.assertEqual(b.namespace, "ns1") self.assertEqual(b.get_rpm_str(), "ns1-osgi(bundle.name) = 1") self.assertEqual(len(b.requires), 2) self.assertEqual(b.requires[0].bundle, "req1.abc") self.assertEqual(b.requires[0].namespace, "") self.assertEqual(b.requires[0].get_rpm_str(), "osgi(req1.abc)") self.assertEqual(b.requires[1].bundle, "req2") self.assertEqual(b.requires[1].namespace, "ns2") self.assertEqual(b.requires[1].get_rpm_str(), "ns2-osgi(req2)")
def test_bundle_from_properties_complex(self): props = { "osgi.id": "bundle.name", "osgi.version": "1", "osgi.requires": "req1.abc,req2(ns2)", "osgi.namespace": "ns1" } b = OSGiBundle.from_properties(props) self.assertEqual(b.bundle, "bundle.name") self.assertEqual(b.version, "1") self.assertEqual(b.namespace, "ns1") self.assertEqual(b.get_rpm_str(), "ns1-osgi(bundle.name) = 1") self.assertEqual(len(b.requires), 2) self.assertEqual(b.requires[0].bundle, "req1.abc") self.assertEqual(b.requires[0].namespace, "") self.assertEqual(b.requires[0].get_rpm_str(), "osgi(req1.abc)") self.assertEqual(b.requires[1].bundle, "req2") self.assertEqual(b.requires[1].namespace, "ns2") self.assertEqual(b.requires[1].get_rpm_str(), "ns2-osgi(req2)")
def get_osgi_bundle(self): if not self.properties: return None return OSGiBundle.from_properties(self.properties)
def test_bundle_simple(self): b = OSGiBundle.from_string("bundle.name 1") self.assertEqual(b.bundle, "bundle.name") self.assertEqual(b.version, "1") self.assertEqual(b.namespace, "") self.assertEqual(b.get_rpm_str(), "osgi(bundle.name) = 1")
def test_bundle_namespace(self): b = OSGiBundle.from_string("bundle.name(ns) 1") self.assertEqual(b.bundle, "bundle.name") self.assertEqual(b.version, "1") self.assertEqual(b.namespace, "ns") self.assertEqual(b.get_rpm_str(), "ns-osgi(bundle.name) = 1")
def get_osgi_bundle(self): if not self.properties: return None return OSGiBundle.from_properties(self.properties)
def test_bundle_simple(self): b = OSGiBundle.from_string("bundle.name 1") self.assertEqual(b.bundle, "bundle.name") self.assertEqual(b.version, "1") self.assertEqual(b.namespace, "") self.assertEqual(b.get_rpm_str(), "osgi(bundle.name) = 1")
def test_bundle_namespace(self): b = OSGiBundle.from_string("bundle.name(ns) 1") self.assertEqual(b.bundle, "bundle.name") self.assertEqual(b.version, "1") self.assertEqual(b.namespace, "ns") self.assertEqual(b.get_rpm_str(), "ns-osgi(bundle.name) = 1")