STS 69 Maven OSGI

Maven OSGI test Specification

Author: Jaroslav Pospisil
Version: 1.0
Introduction: This document serves mostly as a test specification for Maven OSGI functionality in Netbeans IDE - it should cover all most important features of OSGI functionality.
Setup: To create and build Maven project,you have either to have external Maven installation installed, or to use embedded Maven,coming with IDE. There's currently many problems with embedder,so use of external Maven installation is strongly suggested. Download latest maven installation from http://maven.apache.org/download.html, unpack it and either set M2_HOME property or set external maven installation path in Tools > Miscelaneous > Maven. Also, for J2EE projects, test in all cases both JavaEE5 and JavaEE6 projects
Second,ensure to pass this test specification twice,to test on both JDK1.5 and JDK1.6.

Contents


Test suite: Maven OSGi Bundle

Purpose: Test to create OSGi Bundle project archetype and appropriate file templates
Setup:

  1. Create OSGi Bundle
    1. Go to main menu File > New Project
    2. In New Project wizard select Maven > Maven OSGi Bundle and push Next
    3. Type TestOSGIBundle to the Project Name field and push Finish
    • EXPECTED RESULT:
      New OSGi Bundle is created with specific icon, the output contains message about "BUILD SUCCESSFUL".
  2. Create Java Class
    1. Right-Click on TestOSGiBundle in Project tab and select New > Java Class
    2. Type OSGiSharedClass to the Class Name field, osgistuff in Package and push Finish.
    3. Add new method returnSharedText, that returns string return "This text comes from method in OSGi Bundle" in the class.
    • EXPECTED RESULT:
      New Java Class with method is created in OSGi bundle.
  3. Create Bundle Activator (if not already created)
    1. Right-Click on TestOSGiBundle in Project tab and select New > Bundle Activator
    2. Select osgistuff for Package and click Finish.
    • EXPECTED RESULT:
      New Bundle Activator is created in OSGi Bundle.
  4. Install Bundle into repository
    1. Right-Click on TestOSGiBundle in Project tab and select Clean and Build
    • EXPECTED RESULT:
      .

Test suite: Test Dependency on OSGi Bundle

Purpose: Test to create dependency on OSGi Bundle in Quickstart project and demonstrate it works.
Setup:

  1. Create Maven Java Project
    1. Go to main menu File > New Project
    2. In New Project wizard select Maven
    3. Select Java application and push Next
    4. Type TestQuickstartPrj to the Project Name field and push Finish
    • EXPECTED RESULT:
      The project is created, the output contains message about "BUILD SUCCESS".
  2. Add dependency on OSGi Bundle
    1. Go to Projects tab,click on TestQuickstartPrj node to open it and right-click on Dependencies node.
    2. Select Add Dependency and switch to Open Projects.
    3. Select TestOSGiBundle and click OK.
    4. Wait until all neccessary libraries are downloaded (watch progress bar).
    • EXPECTED RESULT:
      OSGi Bundle dependency is added into Libraries as project and library.
  3. Call OSGi method from main class
    1. Go to editor, when should be App.java already opened.
    2. Insert into main method line just above System.out command:
      OSGISharedClass oc = new OSGISharedClass();
    3. Change System.out command to:
      System.out.println( oc.returnSharedText() );
    4. Save and run project.
    • EXPECTED RESULT:
      The project is started, the output contains message about "BUILD SUCCESSFUL" and also contains line:
      This text comes from method in OSGI Bundle
      .

Test suite: Maven Netbeans Module with OSGi support

Purpose: Test to create Netbeans Module with OSGi support project archetype and appropriate file templates
Setup:

  1. Create Netbeans Module with OSGi support
    1. Go to main menu File > New Project
    2. In New Project wizard select Maven > Maven Netbeans Module and push Next
    3. Type TestOSGINBM to the Project Name field and push Next
    4. Check Allow OSGi bundles as dependencies and click Finish.
    • EXPECTED RESULT:
      New Netbeans Module with OSGi support is created , the output contains message about "BUILD SUCCESSFUL". Verify that you can ass some OSGI bundle as dependency.)
  2. Build Project
    1. Use added OSGi dependency in code of TestOSGINBM
    2. Right-click on Build Project action in context menu.
    • EXPECTED RESULT:
      . Module can be built


--Jpospisil 13:31, 2 March 2010 (UTC)

Not logged in. Log in, Register

By use of this website, you agree to the NetBeans Policies and Terms of Use. © 2012, Oracle Corporation and/or its affiliates. Sponsored by Oracle logo