OSGi Versioning and TestingChris AniszczykEclipseSourcehttp://aniszczyk.orgPaul VanderLeiBand XI International
Sample Application: ToastTelematics-On-A-STickSample from upcoming bookequinoxosgi.orgExample project in EclipseRTwiki.eclipse.org/Toast2OSGi Versioning and Testing | © Copyright 2009 EclipseSource & Band XI International; made available under EPL v1.0
Toast Dependencies3OSGi Versioning and Testing | © Copyright 2009 EclipseSource & Band XI International; made available under EPL v1.0EmergencyMonitorEmergencyServletGPSChannelAirbagLog
get locationEmergencyMonitornotifyEmergencyServletsendHTTPGPSlogChannelLogToast: Emergency Scenario4OSGi Versioning and Testing | © Copyright 2009 EclipseSource & Band XI International; made available under EPL v1.0Airbag
Versioning: OverviewVersioningEvolving APIToolsIssuesSummary5OSGi Versioning and Testing | © Copyright 2009 EclipseSource & Band XI International; made available under EPL v1.0
Define Versioning“Software versioning is the process of assigning either unique version names or unique version numbers to unique states of computer software.”Versioning is relative though…6OSGi Versioning and Testing | © Copyright 2009 EclipseSource & Band XI International; made available under EPL v1.0
Versioning: User Perspective7OSGi Versioning and Testing | © Copyright 2009 EclipseSource & Band XI International; made available under EPL v1.0Versioning is a marketing thing…User’s don’t really care about versions…Users just want to know if the version of the software they are running is current…e.g., UbuntuFeisty Fawn – 7.04Gutsy Gibbon – 7.10Hardy Heron – 8.04
Versioning: Dev Perspective8OSGi Versioning and Testing | © Copyright 2009 EclipseSource & Band XI International; made available under EPL v1.0Version numbers are like dog tags*Primarily used in an event of emergency…*http://www.codinghorror.com/blog/archives/000793.html
OSGi VersionsDependencies are defined on the module and package levelImport-PackageRequire-BundleRanges allow for flexibilityImport-Package: org.easymock;version=[2.4.0,3.0.0)9OSGi Versioning and Testing | © Copyright 2009 EclipseSource & Band XI International; made available under EPL v1.0
OSGi Versioning Schememajor.minor.micro.qualifiermajor – An incompatible update; breaking APIminor – A backward compatible update; API stablemicro – A bug fix; no API changesqualifier – build date; lexigraphicVersions should encode compatibility* at the bundle and package level10OSGi Versioning and Testing | © Copyright 2009 EclipseSource & Band XI International; made available under EPL v1.0*http://wiki.eclipse.org/Version_Numbering
Bundle Versions in Eclipse11OSGi Versioning and Testing | © Copyright 2009 EclipseSource & Band XI International; made available under EPL v1.0Notice how the version numbers don’t necessarily match the 3.6 release?
Evolving API: GPS 1.012OSGi Versioning and Testing | © Copyright 2009 EclipseSource & Band XI International; made available under EPL v1.0Let’s evolve our GPS API…Evolving API: GPS 1.113OSGi Versioning and Testing | © Copyright 2009 EclipseSource & Band XI International; made available under EPL v1.0Toast on a plane… we add height…Evolving API: GPS 1.2?14OSGi Versioning and Testing | © Copyright 2009 EclipseSource & Band XI International; made available under EPL v1.0Management now wants an altimeter!Evolving API: GPS 2.015OSGi Versioning and Testing | © Copyright 2009 EclipseSource & Band XI International; made available under EPL v1.0We broke API, need to fix versions!Managing VersionsManaging versions is important and painfulAt Eclipse, we learned this quickly…Other projects eventually learn this…16OSGi Versioning and Testing | © Copyright 2009 EclipseSource & Band XI International; made available under EPL v1.0
Log4j…17OSGi Versioning and Testing | © Copyright 2009 EclipseSource & Band XI International; made available under EPL v1.0
Commons Collections !@#$18OSGi Versioning and Testing | © Copyright 2009 EclipseSource & Band XI International; made available under EPL v1.0“Commons collections 3.0 is binary compatible with version 2.1 and 2.0 except for certain methods on one class . As the release was a major version, this is permitted, however it was unintentional and an error… the chosen solution is to provide a work around by releasing v2.1.1 and v3.1.”http://commons.apache.org/collections/compatibility.html
Developer Reaction…19OSGi Versioning and Testing | © Copyright 2009 EclipseSource & Band XI International; made available under EPL v1.0
Contracts are ImportantGood fences make for good neighbors!Binary compatibility* is important20OSGi Versioning and Testing | © Copyright 2009 EclipseSource & Band XI International; made available under EPL v1.0
ToolsBinary compatibility is importantMaintaining binary compatibility is complexEclipse puts API on an altar…Since Eclipse 3.4, Eclipse uses tools to manage and evolve API…21OSGi Versioning and Testing | © Copyright 2009 EclipseSource & Band XI International; made available under EPL v1.0*http://java.sun.com/docs/books/jls/second_edition/html/binaryComp.doc.html
PDE API ToolsAssists developers in API maintenance by reporting API defects such as binary incompatibilities, incorrect bundle version numbers and API usage.Let’s see an example…22OSGi Versioning and Testing | © Copyright 2009 EclipseSource & Band XI International; made available under EPL v1.0
GPS Example using API Tools23OSGi Versioning and Testing | © Copyright 2009 EclipseSource & Band XI International; made available under EPL v1.0We need height!
Version Scheme Compliance24OSGi Versioning and Testing | © Copyright 2009 EclipseSource & Band XI International; made available under EPL v1.0Version number problems and quickfixes…Binary Compatibility Compliance25OSGi Versioning and Testing | © Copyright 2009 EclipseSource & Band XI International; made available under EPL v1.0Let’s unknowingly break API…Version Compliance Checking26OSGi Versioning and Testing | © Copyright 2009 EclipseSource & Band XI International; made available under EPL v1.0Never break API again unless you want to!API Comparison27OSGi Versioning and Testing | © Copyright 2009 EclipseSource & Band XI International; made available under EPL v1.0
API Comparison28OSGi Versioning and Testing | © Copyright 2009 EclipseSource & Band XI International; made available under EPL v1.0Understand API changes…API Usage Scan29OSGi Versioning and Testing | © Copyright 2009 EclipseSource & Band XI International; made available under EPL v1.0Understand who uses your API given a set of bundles
API Usage Report30OSGi Versioning and Testing | © Copyright 2009 EclipseSource & Band XI International; made available under EPL v1.022 GPS API References
API Usage Report31OSGi Versioning and Testing | © Copyright 2009 EclipseSource & Band XI International; made available under EPL v1.0API Reference Details
IssuesGetting proper version ranges correct is difficult if there’s no consistent semanticse.g., log4j caseNot all bundles are versioned properly in repositoriesTooling doesn’t cover packages yet…32OSGi Versioning and Testing | © Copyright 2009 EclipseSource & Band XI International; made available under EPL v1.0
SummaryOSGi versions encode compatibility!Don’t treat bundle versions like a marketing numberScope your version ranges properly33OSGi Versioning and Testing | © Copyright 2009 EclipseSource & Band XI International; made available under EPL v1.0
Testing: OverviewGood PracticesSample ApplicationUnit TestingSystem TestingRemaining Issues34OSGi Versioning and Testing | © Copyright 2009 EclipseSource & Band XI International; made available under EPL v1.0
Good Practices: TestabilityWrite your application as POJOs(plain-old-java-objects)No Service Trackers!Whiteboard Pattern is trickyPay attention to dependenciesUnit testing depends on getting this right35OSGi Versioning and Testing | © Copyright 2009 EclipseSource & Band XI International; made available under EPL v1.0
Good Practices: TestingUse JunitUse mock objects (EasyMock, jMock...)Minimize delaysNo human interactionDo TDD36OSGi Versioning and Testing | © Copyright 2009 EclipseSource & Band XI International; made available under EPL v1.0“…I think that developers who can’t cope with any level of TDD shouldn’t be coding at all…”
Unit Testing: OverviewTerminologyUnit under test (UUT)Test harnessTest each POJO on its own (no OSGi)Mock each dependency37OSGi Versioning and Testing | © Copyright 2009 EclipseSource & Band XI International; made available under EPL v1.0
get locationEmergencyMonitornotifyEmergencyServletsendHTTPGPSlogChannelLogToast: Emergency Scenario38OSGi Versioning and Testing | © Copyright 2009 EclipseSource & Band XI International; made available under EPL v1.0Airbag
UUTtest harnessUnit Testing: Example39OSGi Versioning and Testing | © Copyright 2009 EclipseSource & Band XI International; made available under EPL v1.0get locationEmergencyMonitornotifyEmergencyServletsendGPSMockGPSChannelMockChannelAirbagMockAirbagLog
Unit Testing: Test Case ProjectKeep the test case in a separate projectBut POJO is not visibleSolution:40OSGi Versioning and Testing | © Copyright 2009 EclipseSource & Band XI International; made available under EPL v1.0fragment bundle
Unit Testing: Test Case Project41OSGi Versioning and Testing | © Copyright 2009 EclipseSource & Band XI International; made available under EPL v1.0DependenciesJunit & EasyMockdependencyinterfaces
Unit Testing: Test Case Code42OSGi Versioning and Testing | © Copyright 2009 EclipseSource & Band XI International; made available under EPL v1.0createUUTcreatemock GPS
Unit Testing: Test Case Code43OSGi Versioning and Testing | © Copyright 2009 EclipseSource & Band XI International; made available under EPL v1.0createmock airbag
Unit Testing: Test Case Code44OSGi Versioning and Testing | © Copyright 2009 EclipseSource & Band XI International; made available under EPL v1.0createmock channel
Unit Testing: Test Case Code45OSGi Versioning and Testing | © Copyright 2009 EclipseSource & Band XI International; made available under EPL v1.0runthe test
Unit Testing: Running46OSGi Versioning and Testing | © Copyright 2009 EclipseSource & Band XI International; made available under EPL v1.0
System Testing: OverviewTest as much of system as possibleOSGi is presentTest full system flowTest bundles coming and going47OSGi Versioning and Testing | © Copyright 2009 EclipseSource & Band XI International; made available under EPL v1.0
UUTget locationEmergencyMonitornotifyEmergencyServletsendHTTPGPS?logChanneltest harnessLogMockLogSystem Testing: Example48OSGi Versioning and Testing | © Copyright 2009 EclipseSource & Band XI International; made available under EPL v1.0deployAirbagMockAirbagverifyTestCase
System Testing: Test Case Project49OSGi Versioning and Testing | © Copyright 2009 EclipseSource & Band XI International; made available under EPL v1.0Normal Plug-in Projectdeclares 3 components
System Testing: Test Harness50OSGi Versioning and Testing | © Copyright 2009 EclipseSource & Band XI International; made available under EPL v1.0hook for testing
System Testing: Test Harness51OSGi Versioning and Testing | © Copyright 2009 EclipseSource & Band XI International; made available under EPL v1.0hook for testing
System Testing:Competing Programming ModelsPDE Junit test infrastructureuses EquinoxextensionsDeclarative Servicesuses OSGi services52OSGi Versioning and Testing | © Copyright 2009 EclipseSource & Band XI International; made available under EPL v1.0VS
System Testing:PDE Junit Test InfrastructureJunit instantiates the test case as usualsetup()testEmergency()Problem: no way to obtain:bundle contextmock airbagmock log53OSGi Versioning and Testing | © Copyright 2009 EclipseSource & Band XI International; made available under EPL v1.0
System Testing:Declarative ServicesInstantiates the test case as a componentDS dependency injectionsetAirbag(<our mock airbag>)setLog(<our mock log>)startup()Problem:This instance is never used by Junit!54OSGi Versioning and Testing | © Copyright 2009 EclipseSource & Band XI International; made available under EPL v1.0
System Testing: Test Case Code55OSGi Versioning and Testing | © Copyright 2009 EclipseSource & Band XI International; made available under EPL v1.0instances share theseDS invokes theseDS invokes theseDS invokes theseready to run test case
System Testing: Test Case Code56OSGi Versioning and Testing | © Copyright 2009 EclipseSource & Band XI International; made available under EPL v1.0wait until DS has activatednormalteststop GPS bundlestart GPS bundle
System Testing:Launch Configuration57OSGi Versioning and Testing | © Copyright 2009 EclipseSource & Band XI International; made available under EPL v1.0
Remaining IssuesStill very trickyNot well-supported by PDE toolingValidation by logging is fragile58OSGi Versioning and Testing | © Copyright 2009 EclipseSource & Band XI International; made available under EPL v1.0
AvailabilityGet the slides: tinyurl.com/osgiVTGet the code: wiki.eclipse.org/ToastGet the book: equinoxosgi.org59OSGi Versioning and Testing | © Copyright 2009 EclipseSource & Band XI International; made available under EPL v1.0Questions?
Sample Application:Emergency Scenario60OSGi Versioning and Testing | © Copyright 2009 EclipseSource & Band XI International; made available under EPL v1.0EmergencyMonitorEmergencyServletGPSChannelAirbagLog
OSGi Versioning And Testing
OSGi Versioning And Testing
OSGi Versioning And Testing
OSGi Versioning And Testing
OSGi Versioning And Testing
OSGi Versioning And Testing
OSGi Versioning And Testing

OSGi Versioning And Testing

  • 1.
    OSGi Versioning andTestingChris AniszczykEclipseSourcehttp://aniszczyk.orgPaul VanderLeiBand XI International
  • 2.
    Sample Application: ToastTelematics-On-A-STickSamplefrom upcoming bookequinoxosgi.orgExample project in EclipseRTwiki.eclipse.org/Toast2OSGi Versioning and Testing | © Copyright 2009 EclipseSource & Band XI International; made available under EPL v1.0
  • 3.
    Toast Dependencies3OSGi Versioningand Testing | © Copyright 2009 EclipseSource & Band XI International; made available under EPL v1.0EmergencyMonitorEmergencyServletGPSChannelAirbagLog
  • 4.
    get locationEmergencyMonitornotifyEmergencyServletsendHTTPGPSlogChannelLogToast: EmergencyScenario4OSGi Versioning and Testing | © Copyright 2009 EclipseSource & Band XI International; made available under EPL v1.0Airbag
  • 5.
    Versioning: OverviewVersioningEvolving APIToolsIssuesSummary5OSGiVersioning and Testing | © Copyright 2009 EclipseSource & Band XI International; made available under EPL v1.0
  • 6.
    Define Versioning“Software versioningis the process of assigning either unique version names or unique version numbers to unique states of computer software.”Versioning is relative though…6OSGi Versioning and Testing | © Copyright 2009 EclipseSource & Band XI International; made available under EPL v1.0
  • 7.
    Versioning: User Perspective7OSGiVersioning and Testing | © Copyright 2009 EclipseSource & Band XI International; made available under EPL v1.0Versioning is a marketing thing…User’s don’t really care about versions…Users just want to know if the version of the software they are running is current…e.g., UbuntuFeisty Fawn – 7.04Gutsy Gibbon – 7.10Hardy Heron – 8.04
  • 8.
    Versioning: Dev Perspective8OSGiVersioning and Testing | © Copyright 2009 EclipseSource & Band XI International; made available under EPL v1.0Version numbers are like dog tags*Primarily used in an event of emergency…*http://www.codinghorror.com/blog/archives/000793.html
  • 9.
    OSGi VersionsDependencies aredefined on the module and package levelImport-PackageRequire-BundleRanges allow for flexibilityImport-Package: org.easymock;version=[2.4.0,3.0.0)9OSGi Versioning and Testing | © Copyright 2009 EclipseSource & Band XI International; made available under EPL v1.0
  • 10.
    OSGi Versioning Schememajor.minor.micro.qualifiermajor– An incompatible update; breaking APIminor – A backward compatible update; API stablemicro – A bug fix; no API changesqualifier – build date; lexigraphicVersions should encode compatibility* at the bundle and package level10OSGi Versioning and Testing | © Copyright 2009 EclipseSource & Band XI International; made available under EPL v1.0*http://wiki.eclipse.org/Version_Numbering
  • 11.
    Bundle Versions inEclipse11OSGi Versioning and Testing | © Copyright 2009 EclipseSource & Band XI International; made available under EPL v1.0Notice how the version numbers don’t necessarily match the 3.6 release?
  • 12.
    Evolving API: GPS1.012OSGi Versioning and Testing | © Copyright 2009 EclipseSource & Band XI International; made available under EPL v1.0Let’s evolve our GPS API…Evolving API: GPS 1.113OSGi Versioning and Testing | © Copyright 2009 EclipseSource & Band XI International; made available under EPL v1.0Toast on a plane… we add height…Evolving API: GPS 1.2?14OSGi Versioning and Testing | © Copyright 2009 EclipseSource & Band XI International; made available under EPL v1.0Management now wants an altimeter!Evolving API: GPS 2.015OSGi Versioning and Testing | © Copyright 2009 EclipseSource & Band XI International; made available under EPL v1.0We broke API, need to fix versions!Managing VersionsManaging versions is important and painfulAt Eclipse, we learned this quickly…Other projects eventually learn this…16OSGi Versioning and Testing | © Copyright 2009 EclipseSource & Band XI International; made available under EPL v1.0
  • 13.
    Log4j…17OSGi Versioning andTesting | © Copyright 2009 EclipseSource & Band XI International; made available under EPL v1.0
  • 14.
    Commons Collections !@#$18OSGiVersioning and Testing | © Copyright 2009 EclipseSource & Band XI International; made available under EPL v1.0“Commons collections 3.0 is binary compatible with version 2.1 and 2.0 except for certain methods on one class . As the release was a major version, this is permitted, however it was unintentional and an error… the chosen solution is to provide a work around by releasing v2.1.1 and v3.1.”http://commons.apache.org/collections/compatibility.html
  • 15.
    Developer Reaction…19OSGi Versioningand Testing | © Copyright 2009 EclipseSource & Band XI International; made available under EPL v1.0
  • 16.
    Contracts are ImportantGoodfences make for good neighbors!Binary compatibility* is important20OSGi Versioning and Testing | © Copyright 2009 EclipseSource & Band XI International; made available under EPL v1.0
  • 17.
    ToolsBinary compatibility isimportantMaintaining binary compatibility is complexEclipse puts API on an altar…Since Eclipse 3.4, Eclipse uses tools to manage and evolve API…21OSGi Versioning and Testing | © Copyright 2009 EclipseSource & Band XI International; made available under EPL v1.0*http://java.sun.com/docs/books/jls/second_edition/html/binaryComp.doc.html
  • 18.
    PDE API ToolsAssistsdevelopers in API maintenance by reporting API defects such as binary incompatibilities, incorrect bundle version numbers and API usage.Let’s see an example…22OSGi Versioning and Testing | © Copyright 2009 EclipseSource & Band XI International; made available under EPL v1.0
  • 19.
    GPS Example usingAPI Tools23OSGi Versioning and Testing | © Copyright 2009 EclipseSource & Band XI International; made available under EPL v1.0We need height!
  • 20.
    Version Scheme Compliance24OSGiVersioning and Testing | © Copyright 2009 EclipseSource & Band XI International; made available under EPL v1.0Version number problems and quickfixes…Binary Compatibility Compliance25OSGi Versioning and Testing | © Copyright 2009 EclipseSource & Band XI International; made available under EPL v1.0Let’s unknowingly break API…Version Compliance Checking26OSGi Versioning and Testing | © Copyright 2009 EclipseSource & Band XI International; made available under EPL v1.0Never break API again unless you want to!API Comparison27OSGi Versioning and Testing | © Copyright 2009 EclipseSource & Band XI International; made available under EPL v1.0
  • 21.
    API Comparison28OSGi Versioningand Testing | © Copyright 2009 EclipseSource & Band XI International; made available under EPL v1.0Understand API changes…API Usage Scan29OSGi Versioning and Testing | © Copyright 2009 EclipseSource & Band XI International; made available under EPL v1.0Understand who uses your API given a set of bundles
  • 22.
    API Usage Report30OSGiVersioning and Testing | © Copyright 2009 EclipseSource & Band XI International; made available under EPL v1.022 GPS API References
  • 23.
    API Usage Report31OSGiVersioning and Testing | © Copyright 2009 EclipseSource & Band XI International; made available under EPL v1.0API Reference Details
  • 24.
    IssuesGetting proper versionranges correct is difficult if there’s no consistent semanticse.g., log4j caseNot all bundles are versioned properly in repositoriesTooling doesn’t cover packages yet…32OSGi Versioning and Testing | © Copyright 2009 EclipseSource & Band XI International; made available under EPL v1.0
  • 25.
    SummaryOSGi versions encodecompatibility!Don’t treat bundle versions like a marketing numberScope your version ranges properly33OSGi Versioning and Testing | © Copyright 2009 EclipseSource & Band XI International; made available under EPL v1.0
  • 26.
    Testing: OverviewGood PracticesSampleApplicationUnit TestingSystem TestingRemaining Issues34OSGi Versioning and Testing | © Copyright 2009 EclipseSource & Band XI International; made available under EPL v1.0
  • 27.
    Good Practices: TestabilityWriteyour application as POJOs(plain-old-java-objects)No Service Trackers!Whiteboard Pattern is trickyPay attention to dependenciesUnit testing depends on getting this right35OSGi Versioning and Testing | © Copyright 2009 EclipseSource & Band XI International; made available under EPL v1.0
  • 28.
    Good Practices: TestingUseJunitUse mock objects (EasyMock, jMock...)Minimize delaysNo human interactionDo TDD36OSGi Versioning and Testing | © Copyright 2009 EclipseSource & Band XI International; made available under EPL v1.0“…I think that developers who can’t cope with any level of TDD shouldn’t be coding at all…”
  • 29.
    Unit Testing: OverviewTerminologyUnitunder test (UUT)Test harnessTest each POJO on its own (no OSGi)Mock each dependency37OSGi Versioning and Testing | © Copyright 2009 EclipseSource & Band XI International; made available under EPL v1.0
  • 30.
    get locationEmergencyMonitornotifyEmergencyServletsendHTTPGPSlogChannelLogToast: EmergencyScenario38OSGi Versioning and Testing | © Copyright 2009 EclipseSource & Band XI International; made available under EPL v1.0Airbag
  • 31.
    UUTtest harnessUnit Testing:Example39OSGi Versioning and Testing | © Copyright 2009 EclipseSource & Band XI International; made available under EPL v1.0get locationEmergencyMonitornotifyEmergencyServletsendGPSMockGPSChannelMockChannelAirbagMockAirbagLog
  • 32.
    Unit Testing: TestCase ProjectKeep the test case in a separate projectBut POJO is not visibleSolution:40OSGi Versioning and Testing | © Copyright 2009 EclipseSource & Band XI International; made available under EPL v1.0fragment bundle
  • 33.
    Unit Testing: TestCase Project41OSGi Versioning and Testing | © Copyright 2009 EclipseSource & Band XI International; made available under EPL v1.0DependenciesJunit & EasyMockdependencyinterfaces
  • 34.
    Unit Testing: TestCase Code42OSGi Versioning and Testing | © Copyright 2009 EclipseSource & Band XI International; made available under EPL v1.0createUUTcreatemock GPS
  • 35.
    Unit Testing: TestCase Code43OSGi Versioning and Testing | © Copyright 2009 EclipseSource & Band XI International; made available under EPL v1.0createmock airbag
  • 36.
    Unit Testing: TestCase Code44OSGi Versioning and Testing | © Copyright 2009 EclipseSource & Band XI International; made available under EPL v1.0createmock channel
  • 37.
    Unit Testing: TestCase Code45OSGi Versioning and Testing | © Copyright 2009 EclipseSource & Band XI International; made available under EPL v1.0runthe test
  • 38.
    Unit Testing: Running46OSGiVersioning and Testing | © Copyright 2009 EclipseSource & Band XI International; made available under EPL v1.0
  • 39.
    System Testing: OverviewTestas much of system as possibleOSGi is presentTest full system flowTest bundles coming and going47OSGi Versioning and Testing | © Copyright 2009 EclipseSource & Band XI International; made available under EPL v1.0
  • 40.
    UUTget locationEmergencyMonitornotifyEmergencyServletsendHTTPGPS?logChanneltest harnessLogMockLogSystemTesting: Example48OSGi Versioning and Testing | © Copyright 2009 EclipseSource & Band XI International; made available under EPL v1.0deployAirbagMockAirbagverifyTestCase
  • 41.
    System Testing: TestCase Project49OSGi Versioning and Testing | © Copyright 2009 EclipseSource & Band XI International; made available under EPL v1.0Normal Plug-in Projectdeclares 3 components
  • 42.
    System Testing: TestHarness50OSGi Versioning and Testing | © Copyright 2009 EclipseSource & Band XI International; made available under EPL v1.0hook for testing
  • 43.
    System Testing: TestHarness51OSGi Versioning and Testing | © Copyright 2009 EclipseSource & Band XI International; made available under EPL v1.0hook for testing
  • 44.
    System Testing:Competing ProgrammingModelsPDE Junit test infrastructureuses EquinoxextensionsDeclarative Servicesuses OSGi services52OSGi Versioning and Testing | © Copyright 2009 EclipseSource & Band XI International; made available under EPL v1.0VS
  • 45.
    System Testing:PDE JunitTest InfrastructureJunit instantiates the test case as usualsetup()testEmergency()Problem: no way to obtain:bundle contextmock airbagmock log53OSGi Versioning and Testing | © Copyright 2009 EclipseSource & Band XI International; made available under EPL v1.0
  • 46.
    System Testing:Declarative ServicesInstantiatesthe test case as a componentDS dependency injectionsetAirbag(<our mock airbag>)setLog(<our mock log>)startup()Problem:This instance is never used by Junit!54OSGi Versioning and Testing | © Copyright 2009 EclipseSource & Band XI International; made available under EPL v1.0
  • 47.
    System Testing: TestCase Code55OSGi Versioning and Testing | © Copyright 2009 EclipseSource & Band XI International; made available under EPL v1.0instances share theseDS invokes theseDS invokes theseDS invokes theseready to run test case
  • 48.
    System Testing: TestCase Code56OSGi Versioning and Testing | © Copyright 2009 EclipseSource & Band XI International; made available under EPL v1.0wait until DS has activatednormalteststop GPS bundlestart GPS bundle
  • 49.
    System Testing:Launch Configuration57OSGiVersioning and Testing | © Copyright 2009 EclipseSource & Band XI International; made available under EPL v1.0
  • 50.
    Remaining IssuesStill verytrickyNot well-supported by PDE toolingValidation by logging is fragile58OSGi Versioning and Testing | © Copyright 2009 EclipseSource & Band XI International; made available under EPL v1.0
  • 51.
    AvailabilityGet the slides:tinyurl.com/osgiVTGet the code: wiki.eclipse.org/ToastGet the book: equinoxosgi.org59OSGi Versioning and Testing | © Copyright 2009 EclipseSource & Band XI International; made available under EPL v1.0Questions?
  • 52.
    Sample Application:Emergency Scenario60OSGiVersioning and Testing | © Copyright 2009 EclipseSource & Band XI International; made available under EPL v1.0EmergencyMonitorEmergencyServletGPSChannelAirbagLog