예제 #1
0
파일: test_basic.py 프로젝트: cotyb/ipopo
 def tearDown(self):
     """
     Cleans up the test environment
     """
     # Stop the framework
     FrameworkFactory.delete_framework()
     self.framework = None
    def testWaitForStop(self):
        """
        Tests the wait_for_stop() method
        """
        # Set up a framework
        framework = FrameworkFactory.get_framework()

        # No need to wait for the framework...
        self.assertTrue(framework.wait_for_stop(),
                        "wait_for_stop() must return True "
                        "on stopped framework")

        # Start the framework
        framework.start()

        # Start the framework killer
        threading.Thread(target=_framework_killer,
                         args=(framework, 0.5)).start()

        # Wait for stop
        start = time.time()
        self.assertTrue(framework.wait_for_stop(),
                        "wait_for_stop(None) should return True")
        end = time.time()
        self.assertLess(end - start, 1, "Wait should be less than 1 sec")

        FrameworkFactory.delete_framework(framework)
예제 #3
0
 def tearDown(self):
     """
     Called after each test
     """
     self.framework.stop()
     FrameworkFactory.delete_framework()
     self.framework = None
    def testFrameworkRestart(self):
        """
        Tests call to Framework.update(), that restarts the framework
        """
        framework = FrameworkFactory.get_framework()
        context = framework.get_bundle_context()

        # Register the stop listener
        context.add_framework_stop_listener(self)

        # Calling update while the framework is stopped should do nothing
        framework.update()
        self.assertFalse(self.stopping, "Stop listener called")

        # Start and update the framework
        self.assertTrue(framework.start(), "Framework couldn't be started")
        framework.update()

        # The framework must have been stopped and must be active
        self.assertTrue(self.stopping, "Stop listener not called")
        self.assertEqual(framework.get_state(), Bundle.ACTIVE,
                         "Framework hasn't been restarted")

        framework.stop()
        FrameworkFactory.delete_framework(framework)
예제 #5
0
    def testBundleStart(self):
        """
        Tests if a bundle can be started before the framework itself
        """
        framework = FrameworkFactory.get_framework()
        context = framework.get_bundle_context()
        assert isinstance(context, BundleContext)

        # Install a bundle
        bundle = context.install_bundle(SIMPLE_BUNDLE)

        self.assertEqual(bundle.get_state(), Bundle.RESOLVED, "Bundle should be in RESOLVED state")

        # Starting the bundle now should fail
        self.assertRaises(BundleException, bundle.start)
        self.assertEqual(bundle.get_state(), Bundle.RESOLVED, "Bundle should be in RESOLVED state")

        # Start the framework
        framework.start()

        # Bundle should have been started now
        self.assertEqual(bundle.get_state(), Bundle.ACTIVE, "Bundle should be in ACTIVE state")

        # Stop the framework
        framework.stop()

        self.assertEqual(bundle.get_state(), Bundle.RESOLVED, "Bundle should be in RESOLVED state")

        # Try to start the bundle again (must fail)
        self.assertRaises(BundleException, bundle.start)
        self.assertEqual(bundle.get_state(), Bundle.RESOLVED, "Bundle should be in RESOLVED state")

        FrameworkFactory.delete_framework()
    def testAddedProperty(self):
        """
        Tests the add_property method
        """
        pelix_test_name = "PELIX_TEST"
        pelix_test = "42"
        pelix_test_2 = "123"

        # Test without pre-set properties
        framework = FrameworkFactory.get_framework()

        self.assertIsNone(framework.get_property(pelix_test_name),
                          "Magic property value")

        # Add the property
        self.assertTrue(framework.add_property(pelix_test_name, pelix_test),
                        "add_property shouldn't fail on first call")

        self.assertEqual(framework.get_property(pelix_test_name), pelix_test,
                         "Invalid property value")

        # Update the property (must fail)
        self.assertFalse(framework.add_property(pelix_test_name, pelix_test_2),
                         "add_property must fail on second call")

        self.assertEqual(framework.get_property(pelix_test_name), pelix_test,
                         "Invalid property value")

        FrameworkFactory.delete_framework(framework)
예제 #7
0
    def testCreateFrameworkAutoStart(self):
        """
        Tests create_framework(), with specified bundles and auto-start
        """
        # Without bundles
        self.framework = pelix.create_framework([], auto_start=True)
        self.assertEqual(self.framework.get_state(), pelix.Bundle.ACTIVE,
                         "Framework hasn't been started")
        self.assertEqual(self.framework.get_bundles(), [],
                         'Framework is not empty')
        # Clean up
        FrameworkFactory.delete_framework()

        # With bundles
        self.framework = pelix.create_framework([self.test_bundle_name],
                                                auto_start=True)
        self.assertEqual(self.framework.get_state(), pelix.Bundle.ACTIVE,
                         "Framework hasn't been started")
        self.assertEqual(len(self.framework.get_bundles()), 1,
                         'Framework should only have 1 bundle')

        bundle = self.framework.get_bundle_by_id(1)
        self.assertEqual(bundle.get_symbolic_name(), self.test_bundle_name,
                         "The test bundle hasn't been installed correctly")
        self.assertEqual(bundle.get_state(), pelix.Bundle.ACTIVE,
                         "Bundle hasn't been started")
예제 #8
0
def test_init_bundle_loader_with_running_framework(delete_framework):
    """
    Tests that creating a Loader instance with an already running Pelix
    framework will work and enforce a correct configuration of the framework.
    """

    framework = pelix.framework.create_framework(())
    assert framework.get_bundle_by_name("pelix.ipopo.core") is None
    assert FrameworkFactory.is_framework_running()

    # Creating a loader instance where existing framework misses
    # pelix.ipopo.core bundle.
    # This bundle is expected to be added to the framework at Loader
    # initialization
    loader = BundleLoader()
    assert framework is loader.framework
    assert loader.framework.get_bundle_by_name("pelix.ipopo.core") is not None
    del loader

    # Same as above, but now, existing framework HAS pelix.ipopo.core bundle
    loader = BundleLoader()
    assert framework is loader.framework
    assert loader.framework.get_bundle_by_name("pelix.ipopo.core") is not None
    del loader

    # Framework outlives the Loader
    assert FrameworkFactory.is_framework_running()
예제 #9
0
 def tearDown(self):
     """
     Called after each test
     """
     if self.framework is not None:
         FrameworkFactory.delete_framework(self.framework)
         self.framework = None
예제 #10
0
    def testAddedProperty(self):
        """
        Tests the add_property method
        """
        pelix_test_name = "PELIX_TEST"
        pelix_test = "42"
        pelix_test_2 = "123"

        # Test without pre-set properties
        framework = FrameworkFactory.get_framework()

        self.assertIsNone(framework.get_property(pelix_test_name),
                          "Magic property value")

        # Add the property
        self.assertTrue(framework.add_property(pelix_test_name, pelix_test),
                        "add_property shouldn't fail on first call")

        self.assertEqual(framework.get_property(pelix_test_name), pelix_test,
                         "Invalid property value")

        # Update the property (must fail)
        self.assertFalse(framework.add_property(pelix_test_name, pelix_test_2),
                         "add_property must fail on second call")

        self.assertEqual(framework.get_property(pelix_test_name), pelix_test,
                         "Invalid property value")

        FrameworkFactory.delete_framework()
예제 #11
0
 def tearDown(self):
     """
     Cleans up the test environment
     """
     # Stop the framework
     FrameworkFactory.delete_framework()
     self.framework = None
예제 #12
0
    def testCreateFrameworkAutoStart(self):
        """
        Tests create_framework(), with specified bundles and auto-start
        """
        # Without bundles
        self.framework = pelix.create_framework([], auto_start=True)
        self.assertEqual(self.framework.get_state(), pelix.Bundle.ACTIVE,
                         "Framework hasn't been started")
        self.assertEqual(self.framework.get_bundles(), [],
                         'Framework is not empty')
        # Clean up
        FrameworkFactory.delete_framework(self.framework)

        # With bundles
        self.framework = pelix.create_framework([self.test_bundle_name],
                                                auto_start=True)
        self.assertEqual(self.framework.get_state(), pelix.Bundle.ACTIVE,
                         "Framework hasn't been started")
        self.assertEqual(len(self.framework.get_bundles()), 1,
                         'Framework should only have 1 bundle')

        bundle = self.framework.get_bundle_by_id(1)
        self.assertEqual(bundle.get_symbolic_name(), self.test_bundle_name,
                         "The test bundle hasn't been installed correctly")
        self.assertEqual(bundle.get_state(), pelix.Bundle.ACTIVE,
                         "Bundle hasn't been started")
예제 #13
0
    def testWaitForStop(self):
        """
        Tests the wait_for_stop() method
        """
        # Set up a framework
        framework = FrameworkFactory.get_framework()

        # No need to wait for the framework...
        self.assertTrue(
            framework.wait_for_stop(), "wait_for_stop() must return True "
            "on stopped framework")

        # Start the framework
        framework.start()

        # Start the framework killer
        threading.Thread(target=_framework_killer,
                         args=(framework, 0.5)).start()

        # Wait for stop
        start = time.time()
        self.assertTrue(framework.wait_for_stop(),
                        "wait_for_stop(None) should return True")
        end = time.time()
        self.assertLess(end - start, 1, "Wait should be less than 1 sec")

        FrameworkFactory.delete_framework()
예제 #14
0
    def testFrameworkRestart(self):
        """
        Tests call to Framework.update(), that restarts the framework
        """
        framework = FrameworkFactory.get_framework()
        context = framework.get_bundle_context()

        # Register the stop listener
        context.add_framework_stop_listener(self)

        # Calling update while the framework is stopped should do nothing
        framework.update()
        self.assertFalse(self.stopping, "Stop listener called")

        # Start and update the framework
        self.assertTrue(framework.start(), "Framework couldn't be started")
        framework.update()

        # The framework must have been stopped and must be active
        self.assertTrue(self.stopping, "Stop listener not called")
        self.assertEqual(framework.get_state(), Bundle.ACTIVE,
                         "Framework hasn't been restarted")

        framework.stop()
        FrameworkFactory.delete_framework()
예제 #15
0
 def tearDown(self):
     """
     Called after each test
     """
     if self.framework is not None:
         FrameworkFactory.delete_framework()
         self.framework = None
예제 #16
0
    def testWaitForStopTimeout(self):
        """
        Tests the wait_for_stop() method
        """
        # Set up a framework
        framework = FrameworkFactory.get_framework()
        framework.start()

        # Start the framework killer
        threading.Thread(target=_framework_killer, args=(framework, 0.5)).start()

        # Wait for stop (timeout not raised)
        start = time.time()
        self.assertTrue(framework.wait_for_stop(1), "wait_for_stop() should return True")
        end = time.time()
        self.assertLess(end - start, 1, "Wait should be less than 1 sec")

        # Restart framework
        framework.start()

        # Start the framework killer
        threading.Thread(target=_framework_killer, args=(framework, 2)).start()

        # Wait for stop (timeout raised)
        start = time.time()
        self.assertFalse(framework.wait_for_stop(1), "wait_for_stop() should return False")
        end = time.time()
        self.assertLess(end - start, 1.2, "Wait should be less than 1.2 sec")

        # Wait for framework to really stop
        framework.wait_for_stop()

        FrameworkFactory.delete_framework()
예제 #17
0
 def tearDown(self):
     """
     Called after each test
     """
     # Destroy the framework
     FrameworkFactory.delete_framework()
     self.framework = None
     self.waiting = None
예제 #18
0
 def tearDown(self):
     """
     Called after each test
     """
     # Destroy the framework
     FrameworkFactory.delete_framework()
     self.framework = None
     self.waiting = None
예제 #19
0
파일: test_core.py 프로젝트: cotyb/ipopo
 def tearDown(self):
     """
     Cleans up the framework
     """
     self.framework.stop()
     FrameworkFactory.delete_framework()
     self.utility = None
     self.context = None
     self.framework = None
예제 #20
0
 def tearDown(self):
     """
     Cleans up the framework
     """
     self.framework.stop()
     FrameworkFactory.delete_framework()
     self.remote = None
     self.shell = None
     self.framework = None
예제 #21
0
 def tearDown(self):
     """
     Cleans up the framework
     """
     self.framework.stop()
     FrameworkFactory.delete_framework()
     self.utility = None
     self.context = None
     self.framework = None
예제 #22
0
    def tearDown(self):
        """
        Called after each test
        """
        self.framework.stop()
        FrameworkFactory.delete_framework()

        # Reset the environment variable
        os.environ['bundle.import.fail'] = "0"
예제 #23
0
    def tearDown(self):
        """
        Called after each test
        """
        self.framework.stop()
        FrameworkFactory.delete_framework()

        # Reset the environment variable
        os.environ['bundle.import.fail'] = "0"
예제 #24
0
    def tearDown(self):
        """
        Called after each test
        """
        self.framework.stop()
        FrameworkFactory.delete_framework(self.framework)

        # Clean up
        self.ipopo = None
        self.framework = None
    def tearDown(self):
        """
        Called after each test
        """
        self.framework.stop()
        FrameworkFactory.delete_framework(self.framework)

        # Clean up
        self.ipopo = None
        self.framework = None
예제 #26
0
 def tearDown(self):
     """
     Cleans up the framework
     """
     self.framework.stop()
     FrameworkFactory.delete_framework()
     self.shell = None
     self.context = None
     self.framework = None
     self._flag = False
예제 #27
0
파일: test_core.py 프로젝트: cotyb/ipopo
 def tearDown(self):
     """
     Cleans up the framework
     """
     self.framework.stop()
     FrameworkFactory.delete_framework()
     self.shell = None
     self.context = None
     self.framework = None
     self._flag = False
예제 #28
0
    def testFrameworkStopper(self):
        """
        Tests FrameworkException stop flag handling
        """
        framework = FrameworkFactory.get_framework()
        context = framework.get_bundle_context()

        # Install the bundle
        bundle = context.install_bundle(SIMPLE_BUNDLE)
        module = bundle.get_module()

        # Set module in raiser stop mode
        module.fw_raiser = True
        module.fw_raiser_stop = True

        log_off()
        self.assertFalse(framework.start(), "Framework should be stopped")
        self.assertEqual(framework.get_state(), Bundle.RESOLVED,
                         "Framework should be stopped")
        self.assertEqual(bundle.get_state(), Bundle.RESOLVED,
                         "Bundle should be stopped")
        log_on()

        # Set module in raiser non-stop mode
        module.fw_raiser_stop = False

        log_off()
        self.assertTrue(framework.start(), "Framework should be stopped")
        self.assertEqual(framework.get_state(), Bundle.ACTIVE,
                         "Framework should be started")
        self.assertEqual(bundle.get_state(), Bundle.RESOLVED,
                         "Bundle should be stopped")
        log_on()

        # Start the module
        module.fw_raiser = False
        bundle.start()
        self.assertEqual(bundle.get_state(), Bundle.ACTIVE,
                         "Bundle should be active")

        # Set module in raiser mode
        module.fw_raiser = True
        module.fw_raiser_stop = True

        # Stop the framework
        log_off()
        self.assertTrue(framework.stop(), "Framework couldn't be stopped")
        self.assertEqual(framework.get_state(), Bundle.RESOLVED,
                         "Framework should be stopped")
        self.assertEqual(bundle.get_state(), Bundle.RESOLVED,
                         "Bundle should be stopped")
        log_on()

        FrameworkFactory.delete_framework(framework)
예제 #29
0
    def testFrameworkStopper(self):
        """
        Tests FrameworkException stop flag handling
        """
        framework = FrameworkFactory.get_framework()
        context = framework.get_bundle_context()

        # Install the bundle
        bundle = context.install_bundle(SIMPLE_BUNDLE)
        module_ = bundle.get_module()

        # Set module in raiser stop mode
        module_.fw_raiser = True
        module_.fw_raiser_stop = True

        log_off()
        self.assertFalse(framework.start(), "Framework should be stopped")
        self.assertEqual(framework.get_state(), Bundle.RESOLVED,
                         "Framework should be stopped")
        self.assertEqual(bundle.get_state(), Bundle.RESOLVED,
                         "Bundle should be stopped")
        log_on()

        # Set module in raiser non-stop mode
        module_.fw_raiser_stop = False

        log_off()
        self.assertTrue(framework.start(), "Framework should be stopped")
        self.assertEqual(framework.get_state(), Bundle.ACTIVE,
                         "Framework should be started")
        self.assertEqual(bundle.get_state(), Bundle.RESOLVED,
                         "Bundle should be stopped")
        log_on()

        # Start the module
        module_.fw_raiser = False
        bundle.start()
        self.assertEqual(bundle.get_state(), Bundle.ACTIVE,
                         "Bundle should be active")

        # Set module in raiser mode
        module_.fw_raiser = True
        module_.fw_raiser_stop = True

        # Stop the framework
        log_off()
        self.assertTrue(framework.stop(), "Framework couldn't be stopped")
        self.assertEqual(framework.get_state(), Bundle.RESOLVED,
                         "Framework should be stopped")
        self.assertEqual(bundle.get_state(), Bundle.RESOLVED,
                         "Bundle should be stopped")
        log_on()

        FrameworkFactory.delete_framework()
예제 #30
0
    def testFrameworkStartRaiser(self):
        """
        Tests framework start and stop with a bundle raising exception
        """
        framework = FrameworkFactory.get_framework()
        context = framework.get_bundle_context()

        # Register the stop listener
        context.add_framework_stop_listener(self)

        # Install the bundle
        bundle = context.install_bundle(SIMPLE_BUNDLE)
        module = bundle.get_module()

        # Set module in raiser mode
        module.raiser = True

        # Framework can start...
        log_off()
        self.assertTrue(framework.start(), "Framework should be started")
        log_on()

        self.assertEqual(framework.get_state(), Bundle.ACTIVE,
                         "Framework should be in ACTIVE state")

        self.assertEqual(bundle.get_state(), Bundle.RESOLVED,
                         "Bundle should be in RESOLVED state")

        # Stop the framework
        self.assertTrue(framework.stop(), "Framework should be stopped")

        # Remove raiser mode
        module.raiser = False

        # Framework can start
        self.assertTrue(framework.start(), "Framework couldn't be started")
        self.assertEqual(framework.get_state(), Bundle.ACTIVE,
                         "Framework should be in ACTIVE state")
        self.assertEqual(bundle.get_state(), Bundle.ACTIVE,
                         "Bundle should be in ACTIVE state")

        # Set module in raiser mode
        module.raiser = True

        # Stop the framework
        log_off()
        self.assertTrue(framework.stop(), "Framework couldn't be stopped")
        log_on()

        self.assertTrue(self.stopping, "Stop listener not called")

        FrameworkFactory.delete_framework(framework)
예제 #31
0
    def testFrameworkStartRaiser(self):
        """
        Tests framework start and stop with a bundle raising exception
        """
        framework = FrameworkFactory.get_framework()
        context = framework.get_bundle_context()

        # Register the stop listener
        context.add_framework_stop_listener(self)

        # Install the bundle
        bundle = context.install_bundle(SIMPLE_BUNDLE)
        module_ = bundle.get_module()

        # Set module in raiser mode
        module_.raiser = True

        # Framework can start...
        log_off()
        self.assertTrue(framework.start(), "Framework should be started")
        log_on()

        self.assertEqual(framework.get_state(), Bundle.ACTIVE,
                         "Framework should be in ACTIVE state")

        self.assertEqual(bundle.get_state(), Bundle.RESOLVED,
                         "Bundle should be in RESOLVED state")

        # Stop the framework
        self.assertTrue(framework.stop(), "Framework should be stopped")

        # Remove raiser mode
        module_.raiser = False

        # Framework can start
        self.assertTrue(framework.start(), "Framework couldn't be started")
        self.assertEqual(framework.get_state(), Bundle.ACTIVE,
                         "Framework should be in ACTIVE state")
        self.assertEqual(bundle.get_state(), Bundle.ACTIVE,
                         "Bundle should be in ACTIVE state")

        # Set module in raiser mode
        module_.raiser = True

        # Stop the framework
        log_off()
        self.assertTrue(framework.stop(), "Framework couldn't be stopped")
        log_on()

        self.assertTrue(self.stopping, "Stop listener not called")

        FrameworkFactory.delete_framework()
예제 #32
0
    def testBundleZero(self):
        """
        Tests if bundle 0 is the framework
        """
        framework = FrameworkFactory.get_framework()

        self.assertIsNone(framework.get_bundle_by_name(None), "None name is not bundle 0")

        self.assertIs(framework, framework.get_bundle_by_id(0), "Invalid bundle 0")

        pelix_name = framework.get_symbolic_name()
        self.assertIs(framework, framework.get_bundle_by_name(pelix_name), "Invalid system bundle name")

        FrameworkFactory.delete_framework()
예제 #33
0
    def testUninstall(self):
        """
        Tests if the framework raises an exception if uninstall() is called
        """
        # Set up a framework
        framework = FrameworkFactory.get_framework()
        self.assertRaises(BundleException, framework.uninstall)

        # Even once started...
        framework.start()
        self.assertRaises(BundleException, framework.uninstall)
        framework.stop()

        FrameworkFactory.delete_framework()
예제 #34
0
    def testUninstall(self):
        """
        Tests if the framework raises an exception if uninstall() is called
        """
        # Set up a framework
        framework = FrameworkFactory.get_framework()
        self.assertRaises(BundleException, framework.uninstall)

        # Even once started...
        framework.start()
        self.assertRaises(BundleException, framework.uninstall)
        framework.stop()

        FrameworkFactory.delete_framework(framework)
예제 #35
0
    def tearDown(self):
        """
        Cleans up the framework
        """
        self.framework.stop()
        FrameworkFactory.delete_framework()

        # Remove the output file
        if os.path.exists(self.out_file):
            os.remove(self.out_file)

        self.report = None
        self.shell = None
        self.context = None
        self.framework = None
예제 #36
0
 def framework(self) -> Framework:
     """
     The currently running Pelix framework instance, or a new one if none is running (anyway,
     the framework instance will continue after deletion of this BundleLoader instance)
     """
     if FrameworkFactory.is_framework_running():
         self._framework = FrameworkFactory.get_framework()
         # Do not use self.context, because it will call back this.
         context = self._framework.get_bundle_context()
         if not context.get_service_reference(SERVICE_IPOPO):
             self._framework.install_bundle(SERVICE_IPOPO)
     else:
         self._framework = pelix.framework.create_framework(())
         self._framework.install_bundle(SERVICE_IPOPO)
         self._framework.start()
     return self._framework
    def testDuplicatedFactory(self):
        """
        Tests the behavior of iPOPO if two bundles provide the same factory.
        """
        # Start the framework
        self.framework = FrameworkFactory.get_framework()
        self.framework.start()
        ipopo = install_ipopo(self.framework)

        # Install bundles: both provide a "basic-component-factory" factory
        # and instantiate a component (both with different names)
        module_A = install_bundle(self.framework, "tests.ipopo.ipopo_bundle")
        module_B = install_bundle(self.framework,
                                  "tests.ipopo.ipopo_bundle_copy")

        # Ensure that the module providing the factory is the correct one
        self.assertIs(module_A,
                      ipopo.get_factory_bundle(
                          module_A.BASIC_FACTORY).get_module(),
                      "Duplicated factory is not provided by the first module")
        self.assertIs(module_A,
                      ipopo.get_factory_bundle(
                          module_B.BASIC_FACTORY).get_module(),
                      "Duplicated factory is not provided by the first module")

        # Component of module A must be there
        self.assertIsNotNone(
            ipopo.get_instance_details(module_A.BASIC_INSTANCE),
            "Component from module A not started")

        # Component of module B must be absent
        self.assertRaises(ValueError,
                          ipopo.get_instance_details, module_B.BASIC_INSTANCE)
예제 #38
0
 def setUp(self):
     """
     Called before each test. Initiates a framework.
     """
     self.framework = FrameworkFactory.get_framework()
     self.framework.start()
     self.ipopo_bundle = install_bundle(self.framework, "pelix.ipopo.core")
    def testDuplicatedFactory(self):
        """
        Tests the behavior of iPOPO if two bundles provide the same factory.
        """
        # Start the framework
        self.framework = FrameworkFactory.get_framework()
        self.framework.start()
        ipopo = install_ipopo(self.framework)

        # Install bundles: both provide a "basic-component-factory" factory
        # and instantiate a component (both with different names)
        module_A = install_bundle(self.framework, "tests.ipopo.ipopo_bundle")
        module_B = install_bundle(self.framework,
                                  "tests.ipopo.ipopo_bundle_copy")

        # Ensure that the module providing the factory is the correct one
        self.assertIs(
            module_A,
            ipopo.get_factory_bundle(module_A.BASIC_FACTORY).get_module(),
            "Duplicated factory is not provided by the first module")
        self.assertIs(
            module_A,
            ipopo.get_factory_bundle(module_B.BASIC_FACTORY).get_module(),
            "Duplicated factory is not provided by the first module")

        # Component of module A must be there
        self.assertIsNotNone(
            ipopo.get_instance_details(module_A.BASIC_INSTANCE),
            "Component from module A not started")

        # Component of module B must be absent
        self.assertRaises(ValueError, ipopo.get_instance_details,
                          module_B.BASIC_INSTANCE)
예제 #40
0
 def setUp(self):
     """
     Called before each test. Initiates a framework.
     """
     self.framework = FrameworkFactory.get_framework()
     self.framework.start()
     self.context = self.framework.get_bundle_context()
예제 #41
0
 def setUp(self):
     """
     Called before each test. Initiates a framework.
     """
     self.framework = FrameworkFactory.get_framework()
     self.framework.start()
     self.context = self.framework.get_bundle_context()
예제 #42
0
 def setUp(self):
     """
     Called before each test. Initiates a framework.
     """
     self.framework = FrameworkFactory.get_framework()
     self.framework.start()
     self.ipopo = install_ipopo(self.framework)
예제 #43
0
 def setUp(self):
     """
     Called before each test. Initiates a framework.
     """
     self.framework = FrameworkFactory.get_framework()
     self.framework.start()
     self.ipopo_bundle = install_bundle(self.framework, "pelix.ipopo.core")
예제 #44
0
 def setUp(self):
     """
     Called before each test. Initiates a framework.
     """
     self.framework = FrameworkFactory.get_framework()
     self.framework.start()
     self.ipopo = install_ipopo(self.framework)
예제 #45
0
    def testBundleZero(self):
        """
        Tests if bundle 0 is the framework
        """
        framework = FrameworkFactory.get_framework()

        self.assertIsNone(framework.get_bundle_by_name(None),
                          "None name is not bundle 0")

        self.assertIs(framework, framework.get_bundle_by_id(0),
                      "Invalid bundle 0")

        pelix_name = framework.get_symbolic_name()
        self.assertIs(framework, framework.get_bundle_by_name(pelix_name),
                      "Invalid system bundle name")

        FrameworkFactory.delete_framework()
예제 #46
0
    def testPropertiesWithoutPreset(self):
        """
        Test framework properties
        """
        pelix_test_name = "PELIX_TEST"
        pelix_test = "42"

        # Test without pre-set properties
        framework = FrameworkFactory.get_framework()

        self.assertIsNone(framework.get_property(pelix_test_name), "Magic property value")

        os.environ[pelix_test_name] = pelix_test
        self.assertEqual(framework.get_property(pelix_test_name), pelix_test, "Invalid property value")
        del os.environ[pelix_test_name]

        FrameworkFactory.delete_framework()
예제 #47
0
    def setUp(self):
        """
        Called before each test. Initiates a framework and loads the current
        module as the first bundle
        """
        self.test_bundle_name = "tests.framework.service_bundle"

        self.framework = FrameworkFactory.get_framework()
        self.framework.start()
 def setUp(self):
     """
     Called before each test. Initiates a framework.
     """
     self.framework = FrameworkFactory.get_framework()
     self.framework.start()
     self.ipopo = install_ipopo(self.framework)
     self.module = install_bundle(self.framework,
                                  "tests.ipopo.ipopo_fields_bundle")
예제 #49
0
 def setUp(self):
     """
     Called before each test. Initiates a framework.
     """
     self.framework = FrameworkFactory.get_framework()
     self.framework.start()
     self.ipopo = install_ipopo(self.framework)
     self.module = install_bundle(self.framework,
                                  "tests.ipopo.ipopo_fields_bundle")
예제 #50
0
    def setUp(self):
        """
        Called before each test. Initiates a framework and loads the current
        module as the first bundle
        """
        self.test_bundle_name = "tests.framework.service_bundle"

        self.framework = FrameworkFactory.get_framework()
        self.framework.start()
예제 #51
0
    def setUp(self):
        """
        Called before each test. Initiates a framework.
        """
        self.framework = FrameworkFactory.get_framework()
        self.framework.start()
        self.ipopo = install_ipopo(self.framework)

        # Install the test bundle
        self.module = install_bundle(self.framework)
예제 #52
0
    def setUp(self):
        """
        Called before each test. Initiates a framework.
        """
        self.framework = FrameworkFactory.get_framework()
        self.framework.start()

        # Compatibility issue
        if sys.version_info[0] < 3:
            self.assertCountEqual = self.assertItemsEqual
예제 #53
0
    def testPropertiesWithoutPreset(self):
        """
        Test framework properties
        """
        pelix_test_name = "PELIX_TEST"
        pelix_test = "42"

        # Test without pre-set properties
        framework = FrameworkFactory.get_framework()

        self.assertIsNone(framework.get_property(pelix_test_name),
                          "Magic property value")

        os.environ[pelix_test_name] = pelix_test
        self.assertEqual(framework.get_property(pelix_test_name), pelix_test,
                         "Invalid property value")
        del os.environ[pelix_test_name]

        FrameworkFactory.delete_framework()
예제 #54
0
    def setUp(self):
        """
        Called before each test. Initiates a framework.
        """
        self.framework = FrameworkFactory.get_framework()
        self.framework.start()
        self.ipopo = install_ipopo(self.framework)

        # Install the test bundle
        self.module = install_bundle(self.framework)
예제 #55
0
    def setUp(self):
        """
        Called before each test. Initiates a framework.
        """
        self.framework = FrameworkFactory.get_framework()
        self.framework.start()

        self.test_bundle_name = SIMPLE_BUNDLE

        self.bundle = None
        self.received = []
예제 #56
0
    def setUp(self):
        """
        Called before each test. Initiates a framework.
        """
        self.framework = FrameworkFactory.get_framework()
        self.framework.start()
        self.context = self.framework.get_bundle_context()

        # Get the path to the current test package
        self.test_root = os.path.join(
            os.path.abspath(os.path.dirname(__file__)), "vault")