Your SlideShare is downloading. ×
Test Driven Development with OSGi - Balázs Zsoldos
Upcoming SlideShare
Loading in...5
×

Thanks for flagging this SlideShare!

Oops! An error has occurred.

×
Saving this for later? Get the SlideShare app to save on your phone or tablet. Read anywhere, anytime – even offline.
Text the download link to your phone
Standard text messaging rates apply

Test Driven Development with OSGi - Balázs Zsoldos

484
views

Published on

OSGi Community Event 2013 (http://www.osgi.org/CommunityEvent2013/Schedule) …

OSGi Community Event 2013 (http://www.osgi.org/CommunityEvent2013/Schedule)

ABSTRACT

Published in: Technology

0 Comments
0 Likes
Statistics
Notes
  • Be the first to comment

  • Be the first to like this

No Downloads
Views
Total Views
484
On Slideshare
0
From Embeds
0
Number of Embeds
0
Actions
Shares
0
Downloads
20
Comments
0
Likes
0
Embeds 0
No embeds

Report content
Flagged as inappropriate Flag as inappropriate
Flag as inappropriate

Select your reason for flagging this presentation as inappropriate.

Cancel
No notes for slide

Transcript

  • 1. Test Driven Development with OSGi Balázs Zsoldos
  • 2. Original motivation Deployment time 2 minutes Internet time 10 minutes
  • 3. Coding time Deployment time Facebook time “What was I doing?” time
  • 4. Reduce deployment time v3
  • 5. “mvn package” + copy file Iteration is faster, but not fast enough (compile + copy)
  • 6. drop JAR OR Drop project process “target/classes”
  • 7. Eclipse + maven-bundle-plugin = up-to-date “target/classes”
  • 8. Richconsole deployment OSGi container StartLevel 10 Bundle A (startLevel=4) Bundle B (startLevel=2) A StartLevel 2 B
  • 9. Deployment time reduced How can we have better quality?
  • 10. The Three Laws of TDD 1.You are not allowed to write any production code until you have 2.You are not allowed to write more of a unit test than is sufficient 3.You are not allowed to write more production code that is suffici The Clean Coder (Chapter 5)
  • 11. External Blockers External Test Engines Framework Startup Blocker Blueprint Blocker JUnit4 TestEngine Test runner
  • 12. Blueprint / DS / creation from Acvtivator / ... Test service service.id=MyTest service.testEngine=junit4 Test runner JUnit4 TestEngine
  • 13. I do not want to re-run all tests during development In development mode only tests with @TestMethodInDevelopmentMode or @TestClassInDevelopmentMode runs.
  • 14. Test Code Deploy / Run tests Production code
  • 15. Test Code Deploy / Run tests Production code What will run the tests on Jenkins?
  • 16. Maven repository Get the dist package eosgi-maven-plugin:dist - Unpack dist package - Parse with velocity - Add the dependencies File system
  • 17. Maven repository Get the dist package eosgi-maven-plugin:integration-test - Unpack dist package - Parse with velocity - Add the dependencies - with testrunner - as symbolic links Start the container Collect test results File system
  • 18. Maven plugin configuration <plugin> <groupId>org.everit.osgi.dev</groupId> <artifactId>eosgi-maven-plugin</artifactId> <version>1.1.3-SNAPSHOT</version> <configuration> <environments> <environment> <id>equinoxtest</id> <framework>equinox</framework> </environment> </environments> </configuration> </plugin> # Default environments in META-INF/eosgi-framework.properties equinox=org.everit.osgi.dist:eosgi-dist-equinox:3.7.2-v201309190021 equinox-3.7.2=org.everit.osgi.dist:eosgi-dist-equinox:3.7.2-v201309190021
  • 19. Maven plugin configuration <plugin> <groupId>org.everit.osgi.dev</groupId> <artifactId>eosgi-maven-plugin</artifactId> <version>1.1.3-SNAPSHOT</version> <configuration> <environments> <environment> <id>equinoxtest</id> <framework>equinox</framework> <vmOptions> <vmOption>-Xdebug</vmOption> <vmOption>-Xrunjdwp:server=y,transport=dt_socket,address=4000,suspend=n</vmOption> </vmOptions> </environment> </environments> </configuration> </plugin> <plugin> <groupId>org.everit.osgi.dev</groupId> <artifactId>eosgi-maven-plugin</artifactId> <version>1.1.3-SNAPSHOT</version> <configuration> <environments> <environment> <id>equinoxtest</id> <framework>equinox</framework> <systemProperties> <myProperty1>myValue1</myProperty1> <myProperty2>myValue2</myProperty2> </systemProperties> </environment> </environments> </configuration> </plugin>
  • 20. Maven plugin configuration <plugin> <groupId>org.everit.osgi.dev</groupId> <artifactId>eosgi-maven-plugin</artifactId> <version>1.1.3-SNAPSHOT</version> <configuration> <environments> <environment> <id>equinoxtest</id> <framework>equinox</framework> <timeout>300000</timeout> <bundleStartLevel>4</bundleStartLevel> <frameworkStartLevel>4</frameworkStartLevel> <bundleSettings> <bundle> <symbolicName>myBundle</symbolicName> <version>1.0.0</version> <startLevel>3</startLevel> </bundle> </bundleSettings> </environment> </environments> </configuration> </plugin>
  • 21. Maven plugin configuration <plugin> <groupId>org.everit.osgi.dev</groupId> <artifactId>eosgi-maven-plugin</artifactId> <version>1.1.3-SNAPSHOT</version> <executions> <execution> <id>integration-test</id> <phase>integration-test</phase> <goals> <goal>integration-test</goal> </goals> <configuration> <jacoco> <includes>org.everit.osgi.servicereference.*</includes> <excludes>org.everit.osgi.servicereference.tests.*</excludes> </jacoco> <environments> <environment> <id>equinoxtest</id> <framework>equinox</framework> <vmOptions> <vmOption>-Xdebug</vmOption> <vmOption>-Xrunjdwp:server=y,transport=dt_socket,address=4000,suspend=n</vmOption> </vmOptions> </environment> </environments> </configuration> </execution> </executions> </plugin>
  • 22. 100% coverage
  • 23. Let's see it in practice
  • 24. Creating your own dist package ● Look at the sample equinox package ● Look at the .eosgi.dist.xml file Look for the XSD in eosgi-maven-plugin sources and read the documentation ● ● Velocity variables – .eosgi.dist.xml ● ● bundleArtifacts: List<DistributableBundleArtifact> environment: EnvironmentConfiguration – Parseable files
  • 25. Thank you balazs.zsoldos@everit.biz E-mail: http://github.com/everit-org Source: Maven repo: http://repository.everit.biz/nexus/content/groups/public

×