Beispiel #1
0
 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)
Beispiel #2
0
 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)
Beispiel #3
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)
Beispiel #4
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)
Beispiel #5
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
Beispiel #6
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:
                    if not bundle.namespace and self._scl:
                        bundle.namespace = self._scl
            if bundle:
                cache.update({path: bundle})

        return cache
Beispiel #7
0
    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)")
Beispiel #8
0
    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)")
Beispiel #9
0
 def get_osgi_bundle(self):
     if not self.properties:
         return None
     return OSGiBundle.from_properties(self.properties)
Beispiel #10
0
 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")
Beispiel #11
0
 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")
Beispiel #12
0
 def get_osgi_bundle(self):
     if not self.properties:
         return None
     return OSGiBundle.from_properties(self.properties)
Beispiel #13
0
 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")
Beispiel #14
0
 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")