Wjax integrationsprojekte auf dem weg zur continuous delivery 2011 11-10

Preview:

DESCRIPTION

 

Citation preview

Ralf Sigmund / Christoph OrtmannOPITZ CONSULTING GmbH

Integrationsprojekte auf dem Weg zur Continuous Delivery

Agenda

ErfolgRahmen

Tests

Build

Deployment

Konfiguration

Erfolgsrezept

KANBAN&

PL / SQL

Kurze Time to Market

Projekt

Scan Dienstleister anbinden!

B2BBooks on Demand Digitalisierungs-Anbieter

digitale Publikationsplattform externe Dienste

Order

Order Ready Notification

Delivery

?

Forts.

ORACLE Internet

Zielarchitektur EIPs mit Camel

http://www.enterpriseintegrationpatterns.com/

Big Picture

Start

Dr. Ralf Sigmund
bild

Auftragversand

Die Antwort verarbeiten

Statusinformationen über den Erhalt des Auftrags .

Sowohl der Returncode als auch die vollständige Antwort werden mithilfe des O/R Mappers in der Datenbank gespeichert.

Fertig zum liefern

HTTP ServiceEine zweite Route bildet die Auftragsbestätigung durch das System des Dienstleisters ab. Er sendet diese an BoD, sobald die Bearbeitung des Auftrages abgeschlossen ist.

Camel und PL/SQL passen prima zusammen

Fachlogik

PL/SQL

Integration

Camel

Monitoring und Verfügbarkeit

• Datenbank als zentraler Monitoringpunkt

SelbsttestTest-NachrichtenUm die Verfügbarkeit des Integrationsservers zu kontrollieren, werden die Camel-Routen in äquidistanten Zeitabständen durch spezielle Testaufträge angestoßen.

2

Internet-Verbindung

Test-Nachricht an Google Chart API

Agenda

ErfolgRahmen

Tests

Build

Deployment

Konfiguration

Performance & Load Testing

Security Testing„ility“ Testing NFRs

Welche Tests benötigen wir?

FunctionalExamplesStory TestsSimulations

Unit TestsComponent Tests

Exploratory

manuell

Tools/ Autom.Autom.

Autom.

Supp

ortin

g th

e Te

am Critique Product

Technologie

Geschäftsanforderungen

Q1 Q4

Q3Q2

Unit Tests vermeiden Fehler

• Testgetrieben vorgehen

• Lean Prinzipien• Camel Test Support

Qualität

Camel unterstützt Unit Tests durch Mock Endpunkte

↘Müssen explizit in Routendefinition angelegt werden => Testcode in Produktionscode

statusOK.expectedMessageCount(1);statusOK.expectedMessagesMatches(new ResultMessagePredicate("ok"));<< PRODUCE >>

assertMockEndpointsSatisfied();

Camel bietet Mocks als Stellvertreter

• Verhalten eines Mocks kann durch Hinzufügen eines Processors gesteuert werden

• Rückgabe von Antwortnachrichten• Exceptions für Test des Fehlerhandling

partnerA.whenAnyExchangeReceived(new MockStatusProcessor("ok"));

Interceptoren können im Test bestehende Routen ändern

interceptSendToEndpoint("direct:partnerA").skipSendToOriginalEndpoint().to("mock:partnerA").to("direct:wsResponse");

context.getRouteDefinition("resultDecision").adviceWith(context,createRouteBuilderResultDecision());

BA C

X C

Continuous Integration

• Ganz normal mit Jenkins / Hudson

Functional Tests

• Für die Auftraggeber verständliche Tests

• Build the right thing

Akzeptanz

Features beschreiben ausübbare Anforderungen

Feature: Place order As a Digital Publisher In order to be able to offer a book on my Publishing Plattform I want to order the scanning of the book by a Digitizing Provider

Scenario: place an order Given I am a valid API user And I use the payloadID "1079645778@yourdomain.com" And I send and accept XML And I give the order an orderID "XYZ-001" And I add an item with lineNumeber "1" and quantity "1" to the order And I set the Supplier EAN "1234567890123" for line item "1" When I send a POST request to "/orders" with the following: Then the response should be "200" And the XML response should be a cXML with payloadID "1079645778@yourdomain.com" and status code "200"

Feature-Tests werden ausführbar durch Step Definitions

When I send a DELETE request to /incidents/task/5

steps.rb:When /^I send a DELETE request to "([^\"]*)"$/ do |path| delete pathend

Agenda

ErfolgRahmen

Tests

Provisionierung

Deployment

Konfiguration

Fehlerquellen gibt es auch nach den Tests

Fehler

Code

Konfig-uration

Umgebung

Karaf-VersionJDK-Version,.

DB-URLQueue-NameService URL

Eine Deployment Pipeline

Commit stage

Akzeptanz- tests Lasttests Release

Commits

Umsetzung der Deployment Pipeline

Alles unter Versionskontrolle

Provisionierung Konfiguration

Alles automatisieren

Provisionierung Konfiguration

Infrastructure as Code

Mit Chef einen Karaf Server provisionieren

Kochbuch für Linux apt tool..für Java

Infrastructure as Code(in GIT oder SVN)

Ein Rezept für Karaf

Das Rezept

Dateien zur Basiskonfiguration

remote_file "/tmp/k.tar.gz" do action :create_if_missing source "http:///www.apache.org/karaf/2.2.4/apache-karaf-2.2.4.tar.gz" mode "0644" checksum "a09f85142e9bb8290cdf332af8201b31ba6d993a"end

Mit Chef das Karaf Archiv herunterladen

bash "install_karaf" do user "vagrant" cwd "/home/vagrant" code <<-EOH tar -zxf /tmp/#{KARAF}.tar.gz EOHend

.. und auspacken

Entwicklungssysteme einfach mit Vagrant provisionieren

Virtualbox• Basis ISO

Vagrant• Chef Rezept

laufender Karaf

Server

genauer

Vagrant::Config.run do |config| config.vm.box = "base"

config.vm.forward_port("karaf_remote_console", 8101, 48101) config.vm.provision :chef_solo do |chef| chef.cookbooks_path = "cookbooks" chef.add_recipe "apt" chef.add_recipe "java" chef.add_recipe "karaf" chef.json.merge!({ :java => { :install_flavor => "sun" }, :karaf => { :db_host => host_ip(), :db_user => "camel", :db_password => "demo" } }) endend

def host_ip()VirtualBox::Global.global.host.network_interfaces.each do |ifce| if ifce.interface_type == :host_only return ifce.ip_address end endend

Start

vagrant up

Deployment

<bundle>mvn:camel/backendService/${pom.version}</bundle> <config name="com.opitz_consulting.cameldemo"> database.driverClassName = oracle.jdbc.OracleDriver </config>

Bundles• URI-basiert mvn /

http

Konfiguration• OSGi Config Manager• Property Placeholder

feature.xml

Continuous Delivery braucht Konfigurationsmöglichkeiten

• Karaf Shell• Karaf Fabric Run

• Karaf Features DateiDeploy

• Chef RezepteProvision

Reproduzierbarkeit ist machbar

Reproduzierbarkeit

Alles automatisieren

Alles einchecken Binaries nur einmal bauen

Exakt gleicher Deployment

Mechanismus in jeder Umgebung

Nennen wir es Lean

Schnell liefern

Qualität gewährleisten

Optimierung (Deming Cycle)

Waste eliminieren

Decide Late

Empower the team

umsetzenspezifizieren testen testen

Stop the line!

Vielen Dank! Fragen?

ralf.sigmund@opitz-consulting.com

@sistar ralf.sigmund

https://github.com/sistar/camel-examples

christoph.ortmann@opitz-consulting.com

Recommended