Step 6: Testing the Vendor Application

In this step the application will be tested using the OSGi console commands.

  1. Click in the Console view and type ss to display as short status report of the installed bundles.
  2. osgi> ss
    
    Framework is launched.
    
    id	State       Bundle
    0	ACTIVE      system.bundle_3.2.2.R32x_v20070118
    1	ACTIVE      org.eclipse.equinox.servlet.api_1.0.0.v20060601
    2	ACTIVE      org.eclipse.osgi.services_3.1.100.v20060601
    3	ACTIVE      org.eclipse.soda.sat.core_1.0.0.qualifier
    4	ACTIVE      org.eclipse.soda.sat.tutorial.customer_1.0.0
    5	RESOLVED    org.eclipse.soda.sat.tutorial.vendor.hotdog_1.0.0
    6	RESOLVED    org.eclipse.soda.sat.tutorial.vendor.popcorn_1.0.0
    7	ACTIVE      org.eclipse.soda.sat.tutorial.vendor.service_1.0.0
    
  3. In the previous step we launched the OSGi framework without starting the bundles org.eclipse.soda.sat.tutorial.vendor.hotdog and org.eclipse.soda.sat.tutorial.vendor.popcorn. As a result, the org.eclipse.soda.sat.tutorial.customer bundle failed to acquire an imported VendorService.
  4. Type start 5 to start the org.eclipse.soda.sat.tutorial.vendor.hotdog bundle. This will cause it to register a VendorService with the OSGi framework.
    osgi> start 5
    [INFO] - The Hotdog Vendor bundle has been activated
    [DEBUG] - SAT Core: The bundle org.eclipse.soda.sat.tutorial.customer failed to acquire the
              service org.eclipse.soda.sat.tutorial.vendor.service.VendorService matching the
              filter "(spiciness<=8)".
    
  5. Notice that the same [DEBUG] message is logged again. This is because the registered VendorService did not possess properties matching those required by the org.eclipse.soda.sat.tutorial.customer bundle.
  6. Type bundle 5 to verify the properties registered with the org.eclipse.soda.sat.tutorial.vendor.hotdog bundle's VendorService.
    osgi> bundle 5
    initial@reference:file:../../../../workspace/org.eclipse.soda.sat.tutorial.vendor.hotdog/ [5]
      Id=5, Status=ACTIVE
      Registered Services
        {org.eclipse.soda.sat.tutorial.vendor.service.VendorService}={bundle.version=1.0.0,
          spiciness=10, service.registration.timestamp=1178074055076, service.id=22}
      No services in use.
      No exported packages
      Imported packages
        org.eclipse.soda.sat.core.framework; version="1.0.0"
        org.eclipse.soda.sat.core.util; version="1.0.0"
        org.eclipse.soda.sat.tutorial.vendor.service; version="0.0.0"
      No fragment bundles
      Named class space
        org.eclipse.soda.sat.tutorial.vendor.hotdog; bundle-version="1.0.0"[provided]
      No required bundles
    
  7. Type start 6 to start the org.eclipse.soda.sat.tutorial.vendor.popcorn bundle. This will cause it to register a VendorService with the OSGi framework.
    osgi> start 6
    [INFO] - The Popcorn Vendor bundle has been activated
    [INFO] - The Customer bundle has been activated
    [INFO] - The Customer bought popcorn from Orville Redenbacher
    
  8. This time the VendorService registered by the org.eclipse.soda.sat.tutorial.vendor.popcorn bundle did possess properties matching those required by the org.eclipse.soda.sat.tutorial.customer bundle.
  9. Type bundle 6 to verify the properties registered with the org.eclipse.soda.sat.tutorial.vendor.popcorn bundle's VendorService.
    osgi> bundle 6
    initial@reference:file:../../../../workspace/org.eclipse.soda.sat.tutorial.vendor.popcorn/ [6]
      Id=6, Status=ACTIVE
      Registered Services
        {org.eclipse.soda.sat.tutorial.vendor.service.VendorService}={bundle.version=1.0.0,
          spiciness=3, service.registration.timestamp=1178075378559, service.id=23}
      No services in use.
      No exported packages
      Imported packages
        org.eclipse.soda.sat.core.framework; version="1.0.0"
        org.eclipse.soda.sat.core.util; version="1.0.0"
        org.eclipse.soda.sat.tutorial.vendor.service; version="0.0.0"
      No fragment bundles
      Named class space
        org.eclipse.soda.sat.tutorial.vendor.popcorn; bundle-version="1.0.0"[provided]
      No required bundles
  10. Finally, type close to terminate the application.
    osgi> close
    [INFO] - The Customer bundle has been deactivated
    [DEBUG] - SAT Core: The bundle 'org.eclipse.soda.sat.tutorial.customer' failed to acquire the
              service 'org.eclipse.soda.sat.tutorial.vendor.service.VendorService' matching the
              filter "(spiciness<=8)".
    [INFO] - The Popcorn Vendor bundle has been deactivated
    [INFO] - The Hotdog Vendor bundle has been deactivated
    [INFO] - The Customer bundle has been stopped
    
    What just happened?