SlideShare a Scribd company logo
Test Driven Development with OSGi
A Practical Overview
Test Driven Development
1. Write test
2. Write code
3. Make it pass
OSGi Deployment
3. Watch it fail
with error $%^#@
2. Deploy on OSGi
1. Working code
Rod Johnson from Spring Source on
OSGi, Things I wish I knew…
• Over-invested in OSGi for 2 years
• Seduced by a technology in search
of a problem
• Clever technology but didn’t solve
most customers pressing problems
• Spent millions that could have been
spent elsewhere
My take: OSGi is like EJB2.0, a 3.0
incarnation is desperately needed.
OSGi

Recommended for you

Cypress report
Cypress reportCypress report
Cypress report

It is a presentation to help software developers get started with a testing platform Cypress. I have created it personally and given the most basics of explanation regarding the new concepts.

cypresssoftware testingpresentation
CI and CD with Jenkins
CI and CD with JenkinsCI and CD with Jenkins
CI and CD with Jenkins

Continuous integration involves developers committing code changes daily which are then automatically built and tested. Continuous delivery takes this further by automatically deploying code changes that pass testing to production environments. The document outlines how Jenkins can be used to implement continuous integration and continuous delivery through automating builds, testing, and deployments to keep the process fast, repeatable and ensure quality.

jenkinscontinuous integrationcontinuous delivery
Jenkins
JenkinsJenkins
Jenkins

Intro to Jenkins, installation of Jenkins, Integrating the testing and deployment technologies. Execute the build tests.

buildingintegrationjava
Does investing in OSGi pay off?
OSGi is not easy to use and at the end of the day or year
depending on how long it takes to get things working, its value
is hard to see. This is why:
• Your application will not be more modular overall, on the contrary,
It ends up being not isolated from other applications since it is a
share everything instead of share nothing architecture.
• Versioning is pushed further down the stack, you wrestle with
maven transitive dependencies during build only to do that again at
runtime in OSGi.
• Most libraries are designed to work as libraries in the application
classloader not as bundles with their own classloader.
• OSGi is a dynamic service deployment framework (if you need one).
It is good for building platforms and for plugin architectures like
Eclipse where third party developers need to be sandboxed.
How to work successfully with OSGi
• Don’t develop directly against OSGi or have that
in your frequent development cycle, it is mostly a
deployment environment.
• You can deploy on jetty inside a test just like the
one running inside OSGi without the overhead.
• Use spring dynamic modules vs blueprint to keep
bean config separate from osgi config
• Treat configuration as code and use Functional
tests with mocks if necessary
Develop-Deploy-Test Cycle
Develop Develop
Continuous
Integration
Test Test
Test2Test1 Test3
Resolve
failed test
It wasn’t
me!
Source
control
Short circuit deploy by embedding test container.
PlansProgress Blockers
Scrum
update update
checkin1+2
A word about testing
• Don’t write unit tests that instantiate classes
as singletons, write functional tests that
instantiate classes like they are configured.
• TDD helps you develop the API and test its
implementation using the proper contract.
• Reduce the surface area of the API.
• Remember the API is like a wide angle lens the
narrower the focal length the wider the scene
of the implementation.

Recommended for you

.Net OSS Ci & CD with Jenkins - JUC ISRAEL 2013
.Net OSS Ci & CD with Jenkins - JUC ISRAEL 2013 .Net OSS Ci & CD with Jenkins - JUC ISRAEL 2013
.Net OSS Ci & CD with Jenkins - JUC ISRAEL 2013

This document discusses using Jenkins for continuous integration (CI) and continuous delivery (CD) of .NET open source projects. It covers how to achieve CI using Jenkins by automating builds, testing on each commit, and more. It also discusses using NuGet for dependency management and Sonar for code quality analysis. Finally, it provides examples of using Jenkins to deploy builds to platforms like AWS Elastic Beanstalk for CD after builds pass testing.

jenkinscontinuous deployment.net open source
Meetup React Sanca - 29/11/18 - React Testing
Meetup React Sanca - 29/11/18 - React TestingMeetup React Sanca - 29/11/18 - React Testing
Meetup React Sanca - 29/11/18 - React Testing

Talk a respeito de testes automatizados no frontend (E2E, integração, unitários e visual), dando destaque a aplicações React. A talk foca na utilização da biblioteca react-testing-library desenvolvida por Kent C. Dodds em 2018. Nela, explico o porquê de optarmos por ela, em quais casos ela melhor se aplica e dou alguns exemplos de utilização.

software developmentsoftware testingreact
Docker в автоматизации тестирования
Docker в автоматизации тестированияDocker в автоматизации тестирования
Docker в автоматизации тестирования

Docker в последняя время набрал огромную популярность как инструмент разработчиков и DevOps-специалистов, но все ещё не так активно используется для автоматизированного тестирования. Во время воркшопа я поделюсь несколькими сценариями, когда Docker может помочь автоматизировать то что ранее считалось непригодным к автоматизации. Также, мы попробуем создать свой собственный образ и запустить несколько контейнеров используя docker-compose.

dockerqacomaqa
OSGi Service Pattern
API
Impl
Client
1. Register impl for intf
<osgi:service… />
2. Lookup impl of intf
<osgi:reference filter=… />
Export-Package
Import-Package
Import-Package
OSGi
Service
Registry
When to use mocks
• Use mocks when no alternative. For example,
try not to mock the persistence layer but
replace with in-memory hsql database so that
your ORM and spring configuration are tested.
• OSGi services can easily be mocked using their
service interface.
• Use spring to rewire mocks in.
Client running against OSGi
Manager
Service
OSGi
Auth
Service
Hibernate/
OpenJpa
My
Service
Postgres
Service
Client
Separate
classloaders
Test running against Jetty
Mock
Manager
Service
Jetty
Mock Auth
Service
Hibernate/
OpenJpa
My
Service
Service
Test
One
classloader
InMem
HSQL

Recommended for you

Continuous Development Pipeline
Continuous Development PipelineContinuous Development Pipeline
Continuous Development Pipeline

In the world of fast changing technologies and business requirements there is no way to stay with old-school approaches to develop software. Common, leave manual interaction behind, let machine do what it's best capable for and spend your time to solve real problems. During this talk I'm going to demonstrate how to build a sophisticated continuous development pipeline for Java based project to cover things like build, test, code quality, deploy and delivery using Gradle, Jenkins, SonarQube, Docker and Ansible. As an outcome of this presentation there will be an open source project with source code.

continuous deliverycontinuous integrationgradle
Continuous Integration
Continuous IntegrationContinuous Integration
Continuous Integration

The document discusses continuous integration (CI), including its benefits, when to implement it, who should use it, and how to set it up. CI involves developers integrating code daily and having an automated build test for quick error detection. Benefits include better quality, faster development, and cheaper defect fixing. The document recommends setting up a code repository, automated build script, and CI server to start. It also provides examples of best practices and demo tools like Hudson.

cicontinuous integrationperficient
e2e testing with cypress
e2e testing with cypresse2e testing with cypress
e2e testing with cypress

Cypress is an e2e testing tool that allows for testing web applications directly in the browser. It provides native access to the browser without using Selenium, making tasks like taking screenshots and recording videos possible. Some limitations are that it only supports single-page applications and one browser tab at a time. Cypress prioritizes developer experience through features like fast testing, intuitive debugging, and integration with continuous integration systems and dashboards. Many large companies have adopted Cypress for their e2e testing needs.

e2etestingreact
Code Coverage
• Few functional tests can provide good code
coverage without skewing the results or making it
impossible to refactor and identify dead code.
• The lack of code-coverage over a class is also
valuable information. For example missing
coverage on an exception class means missing
negative test cases.
• You wouldn’t test by throwing exceptions from a
unit test, that would be worst than having no
tests because it masks the need for one.
• Unit tests should follow the same logic.
Alternatives
• Focus more on value add services and less on
the platform. Services like identity and access
management etc
• Micro-services Architecture with a private
PaaS to bring services together and scale from
private to public clouds
• Use platform as a service like Apache Stratos
and deployment container like Docker.io
• And/Or OSGi (not exclusive technologies)
Microservices Architecture
Service1 Service2 Service3 Service4
local store
Analytics
engine
Workflow
Message
Broker
Report
engine
STAGE
PROCESS
GENERATE
API Gateway Service Registry
PaaS
request
request
App1 App2
Docker container Services Engine Shared store
Cache
Workflow
Sample Project
• The Sample project demonstrate a layered project that can be
deployed on an OSGI container like Karaf without
compromising its ability to run on an embedded container like
jetty hosted inside an IDE or as part of a build and test cycle
performed by maven.
• The examples demonstrate the use of functional unit tests
that invoke the services via their restful interfaces over HTTP
achieving a complete assertion of their logic and configuration
via spring and cxf.
• Source: https://github.com/ielian

Recommended for you

Cypress e2e automation testing - day1 intor by: Hassan Hameed
Cypress e2e automation testing -  day1 intor by: Hassan HameedCypress e2e automation testing -  day1 intor by: Hassan Hameed
Cypress e2e automation testing - day1 intor by: Hassan Hameed

Cypress is an open source tool for automating end-to-end tests. It can test anything that runs in a browser. The document discusses installing Cypress via npm, yarn, or direct download. It also covers opening Cypress and using the test runner interface. Finally, it lists various Cypress commands for controlling the browser, selecting page elements, and triggering actions.

cypresscypress.ioend to end
Continuous Integration and PHP
Continuous Integration and PHPContinuous Integration and PHP
Continuous Integration and PHP

Short overview of the main principles of Continuous Integration (CI), describing benefits of CI and showing a smooth path of integrating CI into your development cycle, finishing with a short introduction into Xinc - PHP CI Server and how to utilize it for your projects.

Testing with Jenkins, Selenium and Continuous Deployment
Testing with Jenkins, Selenium and Continuous DeploymentTesting with Jenkins, Selenium and Continuous Deployment
Testing with Jenkins, Selenium and Continuous Deployment

This document discusses using Jenkins, Selenium and continuous deployment for testing web applications. It proposes using Jenkins for continuous integration, running Selenium tests on Amazon AWS instances through a Selenium Grid. A deployment tool is suggested to deploy any version of the code within an isolated environment using tools like Fabric, Gunicorn and Nginx. The solution allows running tests periodically, executing them in parallel on different browsers and providing live URLs of branches for QA testing.

jenkinstestspython
Fini

More Related Content

What's hot

Android + jenkins
Android + jenkinsAndroid + jenkins
Android + jenkins
Fred Lin
 
Hacking Jenkins
Hacking JenkinsHacking Jenkins
Hacking Jenkins
Miro Cupak
 
Dockerizing react app
Dockerizing react appDockerizing react app
Dockerizing react app
Malang QA Community
 
Cypress report
Cypress reportCypress report
Cypress report
Adarsh
 
CI and CD with Jenkins
CI and CD with JenkinsCI and CD with Jenkins
CI and CD with Jenkins
Martin Málek
 
Jenkins
JenkinsJenkins
.Net OSS Ci & CD with Jenkins - JUC ISRAEL 2013
.Net OSS Ci & CD with Jenkins - JUC ISRAEL 2013 .Net OSS Ci & CD with Jenkins - JUC ISRAEL 2013
.Net OSS Ci & CD with Jenkins - JUC ISRAEL 2013
Tikal Knowledge
 
Meetup React Sanca - 29/11/18 - React Testing
Meetup React Sanca - 29/11/18 - React TestingMeetup React Sanca - 29/11/18 - React Testing
Meetup React Sanca - 29/11/18 - React Testing
Augusto Lazaro
 
Docker в автоматизации тестирования
Docker в автоматизации тестированияDocker в автоматизации тестирования
Docker в автоматизации тестирования
COMAQA.BY
 
Continuous Development Pipeline
Continuous Development PipelineContinuous Development Pipeline
Continuous Development Pipeline
Izzet Mustafaiev
 
Continuous Integration
Continuous IntegrationContinuous Integration
Continuous Integration
Joseph Wang
 
e2e testing with cypress
e2e testing with cypresse2e testing with cypress
e2e testing with cypress
Tomasz Bak
 
Cypress e2e automation testing - day1 intor by: Hassan Hameed
Cypress e2e automation testing -  day1 intor by: Hassan HameedCypress e2e automation testing -  day1 intor by: Hassan Hameed
Cypress e2e automation testing - day1 intor by: Hassan Hameed
Hassan Muhammad
 
Continuous Integration and PHP
Continuous Integration and PHPContinuous Integration and PHP
Continuous Integration and PHP
Arno Schneider
 
Testing with Jenkins, Selenium and Continuous Deployment
Testing with Jenkins, Selenium and Continuous DeploymentTesting with Jenkins, Selenium and Continuous Deployment
Testing with Jenkins, Selenium and Continuous Deployment
Max Klymyshyn
 
Why you should switch to Cypress for modern web testing?
Why you should switch to Cypress for modern web testing?Why you should switch to Cypress for modern web testing?
Why you should switch to Cypress for modern web testing?
Shivam Bharadwaj
 
Олексій Павленко. CONTRACT PROTECTION ON THE FRONTEND SIDE: HOW TO ORGANIZE R...
Олексій Павленко. CONTRACT PROTECTION ON THE FRONTEND SIDE: HOW TO ORGANIZE R...Олексій Павленко. CONTRACT PROTECTION ON THE FRONTEND SIDE: HOW TO ORGANIZE R...
Олексій Павленко. CONTRACT PROTECTION ON THE FRONTEND SIDE: HOW TO ORGANIZE R...
OdessaJS Conf
 
Continuous Integration with Bamboo for Salesforce
Continuous Integration with Bamboo for SalesforceContinuous Integration with Bamboo for Salesforce
Continuous Integration with Bamboo for Salesforce
Klea Kolaric
 
Continuous Delivery for Front-End Engineers
Continuous Delivery for Front-End EngineersContinuous Delivery for Front-End Engineers
Continuous Delivery for Front-End Engineers
Sergey Bolshchikov
 
Genymotion with Jenkins
Genymotion with JenkinsGenymotion with Jenkins
Genymotion with Jenkins
Vishal Nayak
 

What's hot (20)

Android + jenkins
Android + jenkinsAndroid + jenkins
Android + jenkins
 
Hacking Jenkins
Hacking JenkinsHacking Jenkins
Hacking Jenkins
 
Dockerizing react app
Dockerizing react appDockerizing react app
Dockerizing react app
 
Cypress report
Cypress reportCypress report
Cypress report
 
CI and CD with Jenkins
CI and CD with JenkinsCI and CD with Jenkins
CI and CD with Jenkins
 
Jenkins
JenkinsJenkins
Jenkins
 
.Net OSS Ci & CD with Jenkins - JUC ISRAEL 2013
.Net OSS Ci & CD with Jenkins - JUC ISRAEL 2013 .Net OSS Ci & CD with Jenkins - JUC ISRAEL 2013
.Net OSS Ci & CD with Jenkins - JUC ISRAEL 2013
 
Meetup React Sanca - 29/11/18 - React Testing
Meetup React Sanca - 29/11/18 - React TestingMeetup React Sanca - 29/11/18 - React Testing
Meetup React Sanca - 29/11/18 - React Testing
 
Docker в автоматизации тестирования
Docker в автоматизации тестированияDocker в автоматизации тестирования
Docker в автоматизации тестирования
 
Continuous Development Pipeline
Continuous Development PipelineContinuous Development Pipeline
Continuous Development Pipeline
 
Continuous Integration
Continuous IntegrationContinuous Integration
Continuous Integration
 
e2e testing with cypress
e2e testing with cypresse2e testing with cypress
e2e testing with cypress
 
Cypress e2e automation testing - day1 intor by: Hassan Hameed
Cypress e2e automation testing -  day1 intor by: Hassan HameedCypress e2e automation testing -  day1 intor by: Hassan Hameed
Cypress e2e automation testing - day1 intor by: Hassan Hameed
 
Continuous Integration and PHP
Continuous Integration and PHPContinuous Integration and PHP
Continuous Integration and PHP
 
Testing with Jenkins, Selenium and Continuous Deployment
Testing with Jenkins, Selenium and Continuous DeploymentTesting with Jenkins, Selenium and Continuous Deployment
Testing with Jenkins, Selenium and Continuous Deployment
 
Why you should switch to Cypress for modern web testing?
Why you should switch to Cypress for modern web testing?Why you should switch to Cypress for modern web testing?
Why you should switch to Cypress for modern web testing?
 
Олексій Павленко. CONTRACT PROTECTION ON THE FRONTEND SIDE: HOW TO ORGANIZE R...
Олексій Павленко. CONTRACT PROTECTION ON THE FRONTEND SIDE: HOW TO ORGANIZE R...Олексій Павленко. CONTRACT PROTECTION ON THE FRONTEND SIDE: HOW TO ORGANIZE R...
Олексій Павленко. CONTRACT PROTECTION ON THE FRONTEND SIDE: HOW TO ORGANIZE R...
 
Continuous Integration with Bamboo for Salesforce
Continuous Integration with Bamboo for SalesforceContinuous Integration with Bamboo for Salesforce
Continuous Integration with Bamboo for Salesforce
 
Continuous Delivery for Front-End Engineers
Continuous Delivery for Front-End EngineersContinuous Delivery for Front-End Engineers
Continuous Delivery for Front-End Engineers
 
Genymotion with Jenkins
Genymotion with JenkinsGenymotion with Jenkins
Genymotion with Jenkins
 

Similar to TDD on OSGi, in practice.

Unit Testing in JavaScript
Unit Testing in JavaScriptUnit Testing in JavaScript
Unit Testing in JavaScript
Rob Scaduto
 
Tests immutable when refactoring - SegFault Unconference Cracow 2019
Tests immutable when refactoring - SegFault Unconference Cracow 2019Tests immutable when refactoring - SegFault Unconference Cracow 2019
Tests immutable when refactoring - SegFault Unconference Cracow 2019
Grzegorz Miejski
 
Test driven development
Test driven developmentTest driven development
Test driven development
Luis Goldster
 
Test driven development
Test driven developmentTest driven development
Test driven development
Tony Nguyen
 
Test driven development
Test driven developmentTest driven development
Test driven development
Fraboni Ec
 
Test driven development
Test driven developmentTest driven development
Test driven development
James Wong
 
Test driven development
Test driven developmentTest driven development
Test driven development
Young Alista
 
Test driven development
Test driven developmentTest driven development
Test driven development
Harry Potter
 
Topic production code
Topic production codeTopic production code
Topic production code
Kavi Kumar
 
Unit Testing Full@
Unit Testing Full@Unit Testing Full@
Unit Testing Full@
Alex Borsuk
 
10 clues showing that you are doing OSGi in the wrong manner - Jerome Moliere
10 clues showing that you are doing OSGi in the wrong manner - Jerome Moliere10 clues showing that you are doing OSGi in the wrong manner - Jerome Moliere
10 clues showing that you are doing OSGi in the wrong manner - Jerome Moliere
mfrancis
 
SOLID Design Principles for Test Automaion
SOLID Design Principles for Test AutomaionSOLID Design Principles for Test Automaion
SOLID Design Principles for Test Automaion
Knoldus Inc.
 
Benefits of OSGi in Practise
Benefits of OSGi in PractiseBenefits of OSGi in Practise
Benefits of OSGi in Practise
David Bosschaert
 
Create first android app with MVVM Architecture
Create first android app with MVVM ArchitectureCreate first android app with MVVM Architecture
Create first android app with MVVM Architecture
khushbu thakker
 
A la découverte des google/test (aka gtest)
A la découverte des google/test (aka gtest)A la découverte des google/test (aka gtest)
A la découverte des google/test (aka gtest)
Thierry Gayet
 
GlassFish OSGi - Java2days 2010
GlassFish OSGi - Java2days 2010GlassFish OSGi - Java2days 2010
GlassFish OSGi - Java2days 2010
Alexis Moussine-Pouchkine
 
Software Development Standard Operating Procedure
Software Development Standard Operating Procedure Software Development Standard Operating Procedure
Software Development Standard Operating Procedure
rupeshchanchal
 
OSGi
OSGiOSGi
Static Analysis of Your OSS Project with Coverity
Static Analysis of Your OSS Project with CoverityStatic Analysis of Your OSS Project with Coverity
Static Analysis of Your OSS Project with Coverity
Samsung Open Source Group
 
Dtacs
DtacsDtacs

Similar to TDD on OSGi, in practice. (20)

Unit Testing in JavaScript
Unit Testing in JavaScriptUnit Testing in JavaScript
Unit Testing in JavaScript
 
Tests immutable when refactoring - SegFault Unconference Cracow 2019
Tests immutable when refactoring - SegFault Unconference Cracow 2019Tests immutable when refactoring - SegFault Unconference Cracow 2019
Tests immutable when refactoring - SegFault Unconference Cracow 2019
 
Test driven development
Test driven developmentTest driven development
Test driven development
 
Test driven development
Test driven developmentTest driven development
Test driven development
 
Test driven development
Test driven developmentTest driven development
Test driven development
 
Test driven development
Test driven developmentTest driven development
Test driven development
 
Test driven development
Test driven developmentTest driven development
Test driven development
 
Test driven development
Test driven developmentTest driven development
Test driven development
 
Topic production code
Topic production codeTopic production code
Topic production code
 
Unit Testing Full@
Unit Testing Full@Unit Testing Full@
Unit Testing Full@
 
10 clues showing that you are doing OSGi in the wrong manner - Jerome Moliere
10 clues showing that you are doing OSGi in the wrong manner - Jerome Moliere10 clues showing that you are doing OSGi in the wrong manner - Jerome Moliere
10 clues showing that you are doing OSGi in the wrong manner - Jerome Moliere
 
SOLID Design Principles for Test Automaion
SOLID Design Principles for Test AutomaionSOLID Design Principles for Test Automaion
SOLID Design Principles for Test Automaion
 
Benefits of OSGi in Practise
Benefits of OSGi in PractiseBenefits of OSGi in Practise
Benefits of OSGi in Practise
 
Create first android app with MVVM Architecture
Create first android app with MVVM ArchitectureCreate first android app with MVVM Architecture
Create first android app with MVVM Architecture
 
A la découverte des google/test (aka gtest)
A la découverte des google/test (aka gtest)A la découverte des google/test (aka gtest)
A la découverte des google/test (aka gtest)
 
GlassFish OSGi - Java2days 2010
GlassFish OSGi - Java2days 2010GlassFish OSGi - Java2days 2010
GlassFish OSGi - Java2days 2010
 
Software Development Standard Operating Procedure
Software Development Standard Operating Procedure Software Development Standard Operating Procedure
Software Development Standard Operating Procedure
 
OSGi
OSGiOSGi
OSGi
 
Static Analysis of Your OSS Project with Coverity
Static Analysis of Your OSS Project with CoverityStatic Analysis of Your OSS Project with Coverity
Static Analysis of Your OSS Project with Coverity
 
Dtacs
DtacsDtacs
Dtacs
 

Recently uploaded

How RPA Help in the Transportation and Logistics Industry.pptx
How RPA Help in the Transportation and Logistics Industry.pptxHow RPA Help in the Transportation and Logistics Industry.pptx
How RPA Help in the Transportation and Logistics Industry.pptx
SynapseIndia
 
RPA In Healthcare Benefits, Use Case, Trend And Challenges 2024.pptx
RPA In Healthcare Benefits, Use Case, Trend And Challenges 2024.pptxRPA In Healthcare Benefits, Use Case, Trend And Challenges 2024.pptx
RPA In Healthcare Benefits, Use Case, Trend And Challenges 2024.pptx
SynapseIndia
 
TrustArc Webinar - 2024 Data Privacy Trends: A Mid-Year Check-In
TrustArc Webinar - 2024 Data Privacy Trends: A Mid-Year Check-InTrustArc Webinar - 2024 Data Privacy Trends: A Mid-Year Check-In
TrustArc Webinar - 2024 Data Privacy Trends: A Mid-Year Check-In
TrustArc
 
Advanced Techniques for Cyber Security Analysis and Anomaly Detection
Advanced Techniques for Cyber Security Analysis and Anomaly DetectionAdvanced Techniques for Cyber Security Analysis and Anomaly Detection
Advanced Techniques for Cyber Security Analysis and Anomaly Detection
Bert Blevins
 
Cookies program to display the information though cookie creation
Cookies program to display the information though cookie creationCookies program to display the information though cookie creation
Cookies program to display the information though cookie creation
shanthidl1
 
WhatsApp Image 2024-03-27 at 08.19.52_bfd93109.pdf
WhatsApp Image 2024-03-27 at 08.19.52_bfd93109.pdfWhatsApp Image 2024-03-27 at 08.19.52_bfd93109.pdf
WhatsApp Image 2024-03-27 at 08.19.52_bfd93109.pdf
ArgaBisma
 
WPRiders Company Presentation Slide Deck
WPRiders Company Presentation Slide DeckWPRiders Company Presentation Slide Deck
WPRiders Company Presentation Slide Deck
Lidia A.
 
Calgary MuleSoft Meetup APM and IDP .pptx
Calgary MuleSoft Meetup APM and IDP .pptxCalgary MuleSoft Meetup APM and IDP .pptx
Calgary MuleSoft Meetup APM and IDP .pptx
ishalveerrandhawa1
 
Password Rotation in 2024 is still Relevant
Password Rotation in 2024 is still RelevantPassword Rotation in 2024 is still Relevant
Password Rotation in 2024 is still Relevant
Bert Blevins
 
20240702 Présentation Plateforme GenAI.pdf
20240702 Présentation Plateforme GenAI.pdf20240702 Présentation Plateforme GenAI.pdf
20240702 Présentation Plateforme GenAI.pdf
Sally Laouacheria
 
20240702 QFM021 Machine Intelligence Reading List June 2024
20240702 QFM021 Machine Intelligence Reading List June 202420240702 QFM021 Machine Intelligence Reading List June 2024
20240702 QFM021 Machine Intelligence Reading List June 2024
Matthew Sinclair
 
The Increasing Use of the National Research Platform by the CSU Campuses
The Increasing Use of the National Research Platform by the CSU CampusesThe Increasing Use of the National Research Platform by the CSU Campuses
The Increasing Use of the National Research Platform by the CSU Campuses
Larry Smarr
 
Pigging Solutions Sustainability brochure.pdf
Pigging Solutions Sustainability brochure.pdfPigging Solutions Sustainability brochure.pdf
Pigging Solutions Sustainability brochure.pdf
Pigging Solutions
 
Details of description part II: Describing images in practice - Tech Forum 2024
Details of description part II: Describing images in practice - Tech Forum 2024Details of description part II: Describing images in practice - Tech Forum 2024
Details of description part II: Describing images in practice - Tech Forum 2024
BookNet Canada
 
How Social Media Hackers Help You to See Your Wife's Message.pdf
How Social Media Hackers Help You to See Your Wife's Message.pdfHow Social Media Hackers Help You to See Your Wife's Message.pdf
How Social Media Hackers Help You to See Your Wife's Message.pdf
HackersList
 
[Talk] Moving Beyond Spaghetti Infrastructure [AOTB] 2024-07-04.pdf
[Talk] Moving Beyond Spaghetti Infrastructure [AOTB] 2024-07-04.pdf[Talk] Moving Beyond Spaghetti Infrastructure [AOTB] 2024-07-04.pdf
[Talk] Moving Beyond Spaghetti Infrastructure [AOTB] 2024-07-04.pdf
Kief Morris
 
Recent Advancements in the NIST-JARVIS Infrastructure
Recent Advancements in the NIST-JARVIS InfrastructureRecent Advancements in the NIST-JARVIS Infrastructure
Recent Advancements in the NIST-JARVIS Infrastructure
KAMAL CHOUDHARY
 
Mitigating the Impact of State Management in Cloud Stream Processing Systems
Mitigating the Impact of State Management in Cloud Stream Processing SystemsMitigating the Impact of State Management in Cloud Stream Processing Systems
Mitigating the Impact of State Management in Cloud Stream Processing Systems
ScyllaDB
 
Implementations of Fused Deposition Modeling in real world
Implementations of Fused Deposition Modeling  in real worldImplementations of Fused Deposition Modeling  in real world
Implementations of Fused Deposition Modeling in real world
Emerging Tech
 
20240704 QFM023 Engineering Leadership Reading List June 2024
20240704 QFM023 Engineering Leadership Reading List June 202420240704 QFM023 Engineering Leadership Reading List June 2024
20240704 QFM023 Engineering Leadership Reading List June 2024
Matthew Sinclair
 

Recently uploaded (20)

How RPA Help in the Transportation and Logistics Industry.pptx
How RPA Help in the Transportation and Logistics Industry.pptxHow RPA Help in the Transportation and Logistics Industry.pptx
How RPA Help in the Transportation and Logistics Industry.pptx
 
RPA In Healthcare Benefits, Use Case, Trend And Challenges 2024.pptx
RPA In Healthcare Benefits, Use Case, Trend And Challenges 2024.pptxRPA In Healthcare Benefits, Use Case, Trend And Challenges 2024.pptx
RPA In Healthcare Benefits, Use Case, Trend And Challenges 2024.pptx
 
TrustArc Webinar - 2024 Data Privacy Trends: A Mid-Year Check-In
TrustArc Webinar - 2024 Data Privacy Trends: A Mid-Year Check-InTrustArc Webinar - 2024 Data Privacy Trends: A Mid-Year Check-In
TrustArc Webinar - 2024 Data Privacy Trends: A Mid-Year Check-In
 
Advanced Techniques for Cyber Security Analysis and Anomaly Detection
Advanced Techniques for Cyber Security Analysis and Anomaly DetectionAdvanced Techniques for Cyber Security Analysis and Anomaly Detection
Advanced Techniques for Cyber Security Analysis and Anomaly Detection
 
Cookies program to display the information though cookie creation
Cookies program to display the information though cookie creationCookies program to display the information though cookie creation
Cookies program to display the information though cookie creation
 
WhatsApp Image 2024-03-27 at 08.19.52_bfd93109.pdf
WhatsApp Image 2024-03-27 at 08.19.52_bfd93109.pdfWhatsApp Image 2024-03-27 at 08.19.52_bfd93109.pdf
WhatsApp Image 2024-03-27 at 08.19.52_bfd93109.pdf
 
WPRiders Company Presentation Slide Deck
WPRiders Company Presentation Slide DeckWPRiders Company Presentation Slide Deck
WPRiders Company Presentation Slide Deck
 
Calgary MuleSoft Meetup APM and IDP .pptx
Calgary MuleSoft Meetup APM and IDP .pptxCalgary MuleSoft Meetup APM and IDP .pptx
Calgary MuleSoft Meetup APM and IDP .pptx
 
Password Rotation in 2024 is still Relevant
Password Rotation in 2024 is still RelevantPassword Rotation in 2024 is still Relevant
Password Rotation in 2024 is still Relevant
 
20240702 Présentation Plateforme GenAI.pdf
20240702 Présentation Plateforme GenAI.pdf20240702 Présentation Plateforme GenAI.pdf
20240702 Présentation Plateforme GenAI.pdf
 
20240702 QFM021 Machine Intelligence Reading List June 2024
20240702 QFM021 Machine Intelligence Reading List June 202420240702 QFM021 Machine Intelligence Reading List June 2024
20240702 QFM021 Machine Intelligence Reading List June 2024
 
The Increasing Use of the National Research Platform by the CSU Campuses
The Increasing Use of the National Research Platform by the CSU CampusesThe Increasing Use of the National Research Platform by the CSU Campuses
The Increasing Use of the National Research Platform by the CSU Campuses
 
Pigging Solutions Sustainability brochure.pdf
Pigging Solutions Sustainability brochure.pdfPigging Solutions Sustainability brochure.pdf
Pigging Solutions Sustainability brochure.pdf
 
Details of description part II: Describing images in practice - Tech Forum 2024
Details of description part II: Describing images in practice - Tech Forum 2024Details of description part II: Describing images in practice - Tech Forum 2024
Details of description part II: Describing images in practice - Tech Forum 2024
 
How Social Media Hackers Help You to See Your Wife's Message.pdf
How Social Media Hackers Help You to See Your Wife's Message.pdfHow Social Media Hackers Help You to See Your Wife's Message.pdf
How Social Media Hackers Help You to See Your Wife's Message.pdf
 
[Talk] Moving Beyond Spaghetti Infrastructure [AOTB] 2024-07-04.pdf
[Talk] Moving Beyond Spaghetti Infrastructure [AOTB] 2024-07-04.pdf[Talk] Moving Beyond Spaghetti Infrastructure [AOTB] 2024-07-04.pdf
[Talk] Moving Beyond Spaghetti Infrastructure [AOTB] 2024-07-04.pdf
 
Recent Advancements in the NIST-JARVIS Infrastructure
Recent Advancements in the NIST-JARVIS InfrastructureRecent Advancements in the NIST-JARVIS Infrastructure
Recent Advancements in the NIST-JARVIS Infrastructure
 
Mitigating the Impact of State Management in Cloud Stream Processing Systems
Mitigating the Impact of State Management in Cloud Stream Processing SystemsMitigating the Impact of State Management in Cloud Stream Processing Systems
Mitigating the Impact of State Management in Cloud Stream Processing Systems
 
Implementations of Fused Deposition Modeling in real world
Implementations of Fused Deposition Modeling  in real worldImplementations of Fused Deposition Modeling  in real world
Implementations of Fused Deposition Modeling in real world
 
20240704 QFM023 Engineering Leadership Reading List June 2024
20240704 QFM023 Engineering Leadership Reading List June 202420240704 QFM023 Engineering Leadership Reading List June 2024
20240704 QFM023 Engineering Leadership Reading List June 2024
 

TDD on OSGi, in practice.

  • 1. Test Driven Development with OSGi A Practical Overview
  • 2. Test Driven Development 1. Write test 2. Write code 3. Make it pass
  • 3. OSGi Deployment 3. Watch it fail with error $%^#@ 2. Deploy on OSGi 1. Working code
  • 4. Rod Johnson from Spring Source on OSGi, Things I wish I knew… • Over-invested in OSGi for 2 years • Seduced by a technology in search of a problem • Clever technology but didn’t solve most customers pressing problems • Spent millions that could have been spent elsewhere My take: OSGi is like EJB2.0, a 3.0 incarnation is desperately needed. OSGi
  • 5. Does investing in OSGi pay off? OSGi is not easy to use and at the end of the day or year depending on how long it takes to get things working, its value is hard to see. This is why: • Your application will not be more modular overall, on the contrary, It ends up being not isolated from other applications since it is a share everything instead of share nothing architecture. • Versioning is pushed further down the stack, you wrestle with maven transitive dependencies during build only to do that again at runtime in OSGi. • Most libraries are designed to work as libraries in the application classloader not as bundles with their own classloader. • OSGi is a dynamic service deployment framework (if you need one). It is good for building platforms and for plugin architectures like Eclipse where third party developers need to be sandboxed.
  • 6. How to work successfully with OSGi • Don’t develop directly against OSGi or have that in your frequent development cycle, it is mostly a deployment environment. • You can deploy on jetty inside a test just like the one running inside OSGi without the overhead. • Use spring dynamic modules vs blueprint to keep bean config separate from osgi config • Treat configuration as code and use Functional tests with mocks if necessary
  • 7. Develop-Deploy-Test Cycle Develop Develop Continuous Integration Test Test Test2Test1 Test3 Resolve failed test It wasn’t me! Source control Short circuit deploy by embedding test container. PlansProgress Blockers Scrum update update checkin1+2
  • 8. A word about testing • Don’t write unit tests that instantiate classes as singletons, write functional tests that instantiate classes like they are configured. • TDD helps you develop the API and test its implementation using the proper contract. • Reduce the surface area of the API. • Remember the API is like a wide angle lens the narrower the focal length the wider the scene of the implementation.
  • 9. OSGi Service Pattern API Impl Client 1. Register impl for intf <osgi:service… /> 2. Lookup impl of intf <osgi:reference filter=… /> Export-Package Import-Package Import-Package OSGi Service Registry
  • 10. When to use mocks • Use mocks when no alternative. For example, try not to mock the persistence layer but replace with in-memory hsql database so that your ORM and spring configuration are tested. • OSGi services can easily be mocked using their service interface. • Use spring to rewire mocks in.
  • 11. Client running against OSGi Manager Service OSGi Auth Service Hibernate/ OpenJpa My Service Postgres Service Client Separate classloaders
  • 12. Test running against Jetty Mock Manager Service Jetty Mock Auth Service Hibernate/ OpenJpa My Service Service Test One classloader InMem HSQL
  • 13. Code Coverage • Few functional tests can provide good code coverage without skewing the results or making it impossible to refactor and identify dead code. • The lack of code-coverage over a class is also valuable information. For example missing coverage on an exception class means missing negative test cases. • You wouldn’t test by throwing exceptions from a unit test, that would be worst than having no tests because it masks the need for one. • Unit tests should follow the same logic.
  • 14. Alternatives • Focus more on value add services and less on the platform. Services like identity and access management etc • Micro-services Architecture with a private PaaS to bring services together and scale from private to public clouds • Use platform as a service like Apache Stratos and deployment container like Docker.io • And/Or OSGi (not exclusive technologies)
  • 15. Microservices Architecture Service1 Service2 Service3 Service4 local store Analytics engine Workflow Message Broker Report engine STAGE PROCESS GENERATE API Gateway Service Registry PaaS request request App1 App2 Docker container Services Engine Shared store Cache Workflow
  • 16. Sample Project • The Sample project demonstrate a layered project that can be deployed on an OSGI container like Karaf without compromising its ability to run on an embedded container like jetty hosted inside an IDE or as part of a build and test cycle performed by maven. • The examples demonstrate the use of functional unit tests that invoke the services via their restful interfaces over HTTP achieving a complete assertion of their logic and configuration via spring and cxf. • Source: https://github.com/ielian
  • 17. Fini