Details

    • Type: Wish Wish
    • Status: Open
    • Priority: Major Major
    • Resolution: Unresolved
    • Affects Version/s: Java-SCA-1.x
    • Fix Version/s: Java-SCA-1.x
    • Component/s: Java SCA Samples
    • Labels:
      None
    • Environment:
      All
    • Patch Info:
      Patch Available

      Description

      It would help with preserving OSGi support if an OSGi sample were run as a matter of course, rather than only by a small number of developers. This wish is to add the smallest sample possible based on existing Tuscany module dependencies.

      1. calculator-osgi-sample.patch
        150 kB
        Graham Charters
      2. samples-calculator-osgi-runtime-patch.txt
        85 kB
        Rajini Sivaram

        Activity

        Hide
        Rajini Sivaram added a comment -

        Graham,

        I have attached the patch for the OSGi calculator sample as I have it on my machine. It could help in the discussion on whether this should be a sample or an itest.

        • Rajini
        Show
        Rajini Sivaram added a comment - Graham, I have attached the patch for the OSGi calculator sample as I have it on my machine. It could help in the discussion on whether this should be a sample or an itest. Rajini
        Hide
        Graham Charters added a comment -

        Hi Rajini, sorry for taking so long to respond. Please go ahead and check the code in with your update. Changing it to use Felix is fine by me. I tested it with both and there was little discernible difference in performance.

        Thanks, Graham.

        Show
        Graham Charters added a comment - Hi Rajini, sorry for taking so long to respond. Please go ahead and check the code in with your update. Changing it to use Felix is fine by me. I tested it with both and there was little discernible difference in performance. Thanks, Graham.
        Hide
        Rajini Sivaram added a comment -

        Graham,

        I tried out the test (listed below), using your patch, and it seems to work fine. So if you want, I can check in this code, along with the rest of your patch tonight, and you can continue from there.

        If this is going to be a sample, I think it should use Felix rather than Equinox to avoid both Felix and Equinox being added to the Tuscany distribution (depending on the order in which they appear in tuscany-sca-manifest.jar file, they can result in conflicts when running Tuscany outside OSGi).

        The test that I ran looks like:

        public class CalculatorTestCase {

        private BundleContext bundleContext;

        @Before
        public void setUp() throws Exception {

        String[] equinoxArgs = new String[]

        {"-clean", "-console", "-configuration", "target/configuration"}

        ;
        bundleContext = EclipseStarter.startup(equinoxArgs, null);
        }

        @After
        public void tearDown() throws Exception {

        if (bundleContext != null)

        { bundleContext.getBundle().stop(); }

        }

        @Test
        public void runCalculator() throws Exception

        { Bundle tuscanyInstallerBundle = bundleContext.installBundle("file:../tuscany-osgi-installer/target/tuscany-sca-osgi-installer.jar"); tuscanyInstallerBundle.start(); Bundle calculatorBundle = bundleContext.installBundle("file:../calculator/target/sample-calculator-bundle.jar"); calculatorBundle.start(); }

        }

        Show
        Rajini Sivaram added a comment - Graham, I tried out the test (listed below), using your patch, and it seems to work fine. So if you want, I can check in this code, along with the rest of your patch tonight, and you can continue from there. If this is going to be a sample, I think it should use Felix rather than Equinox to avoid both Felix and Equinox being added to the Tuscany distribution (depending on the order in which they appear in tuscany-sca-manifest.jar file, they can result in conflicts when running Tuscany outside OSGi). The test that I ran looks like: public class CalculatorTestCase { private BundleContext bundleContext; @Before public void setUp() throws Exception { String[] equinoxArgs = new String[] {"-clean", "-console", "-configuration", "target/configuration"} ; bundleContext = EclipseStarter.startup(equinoxArgs, null); } @After public void tearDown() throws Exception { if (bundleContext != null) { bundleContext.getBundle().stop(); } } @Test public void runCalculator() throws Exception { Bundle tuscanyInstallerBundle = bundleContext.installBundle("file:../tuscany-osgi-installer/target/tuscany-sca-osgi-installer.jar"); tuscanyInstallerBundle.start(); Bundle calculatorBundle = bundleContext.installBundle("file:../calculator/target/sample-calculator-bundle.jar"); calculatorBundle.start(); } }
        Hide
        Graham Charters added a comment -

        Hi Rajini,

        I think what you're suggesting make sense. I won't be able to look at this until Friday. Thanks for the offer of help, I'll let you know if I need some.

        Regards,

        Graham.

        Show
        Graham Charters added a comment - Hi Rajini, I think what you're suggesting make sense. I won't be able to look at this until Friday. Thanks for the offer of help, I'll let you know if I need some. Regards, Graham.
        Hide
        Rajini Sivaram added a comment -

        Graham,

        For some reason, I was expecting this to be an itest, but I notice you intended it to be a sample. That is good, since we currently dont have a sample which runs Tuscany under OSGi. So this module can be a sample as well as a sniff test for OSGi-based Tuscany.

        However, to enable this to be really used as a sample, it might help if code was simplified. Currently it uses the test harness from itest/osgi-tuscany which builds test bundles on-the-fly from the classes in the samples directories. I feel that is too complicated for use in a sample (yes, that is all my fault).

        It would be really nice to have a sample which simply does:
        1. Create an OSGi runtime
        2. Install and start Tuscany OSGi installer bundle
        3. Install and start calculator bundle

        and away it goes and runs the calculator sample on Tuscany inside an OSGi runtime. Step 2 could be replaced later with whatever mechanism we choose to provide for installing Tuscany into OSGi.

        What do you think? I can help with the code if you like (but it will have to wait till the weekend).

        PS: Sorry, I should have noticed that you were referring to this as 'sample' all along.

        • Rajini
        Show
        Rajini Sivaram added a comment - Graham, For some reason, I was expecting this to be an itest, but I notice you intended it to be a sample. That is good, since we currently dont have a sample which runs Tuscany under OSGi. So this module can be a sample as well as a sniff test for OSGi-based Tuscany. However, to enable this to be really used as a sample, it might help if code was simplified. Currently it uses the test harness from itest/osgi-tuscany which builds test bundles on-the-fly from the classes in the samples directories. I feel that is too complicated for use in a sample (yes, that is all my fault). It would be really nice to have a sample which simply does: 1. Create an OSGi runtime 2. Install and start Tuscany OSGi installer bundle 3. Install and start calculator bundle and away it goes and runs the calculator sample on Tuscany inside an OSGi runtime. Step 2 could be replaced later with whatever mechanism we choose to provide for installing Tuscany into OSGi. What do you think? I can help with the code if you like (but it will have to wait till the weekend). PS: Sorry, I should have noticed that you were referring to this as 'sample' all along. Rajini

          People

          • Assignee:
            Unassigned
            Reporter:
            Graham Charters
          • Votes:
            0 Vote for this issue
            Watchers:
            0 Start watching this issue

            Dates

            • Created:
              Updated:

              Time Tracking

              Estimated:
              Original Estimate - 2h
              2h
              Remaining:
              Remaining Estimate - 2h
              2h
              Logged:
              Time Spent - Not Specified
              Not Specified

                Development