© OPITZ CONSULTING GmbH 2010 Seite 1SOA Testing
<Bild oder OC-Tätigkeitsfeld-Logo>Tobias BoschTechnical ArchitectMitglied SOA Competence Center
OPITZ CONSULTING München GmbH
SOA Testing
© OPITZ CONSULTING GmbH 2010 Seite 2SOA Testing
Was ist SOA? Business-IT Alignment Flexibilität
© OPITZ CONSULTING GmbH 2010 Seite 3SOA Testing
Warum Testen in einer SOA? Softwaretest: Fehler finden Test-Stufen
Unittests Integrationstests Systemtests
SOA Umgebungen Verteiltes System: Lokalisierung der Fehlerursache Flexibilität: Vermeidung von Nebenwirkungen einer Änderung Hohe Qualitätsanforderungen
© OPITZ CONSULTING GmbH 2010 Seite 4SOA Testing
Unittests in der Oracle SOA Suite (1) Transformationen: XQuery, XSLT JUnit-Test
1 Reader strm = new FileReader(xq); 2 PreparedXQuery xquery = new XQueryContext().
prepareXQuery(strm);
3 xquery.setNode( new QName("var1"), var1Node);
4 XMLSequence seq = xquery.executeQuery(); 5 seq.next(); 6 XMLNode res = seq.getCurrentItem().getNode();
© OPITZ CONSULTING GmbH 2010 Seite 5SOA Testing
Unittests in der Oracle SOA Suite (2) Orchestrierung: BPMN, BPEL, OSB Flows Test Suites for Composite Applications
Invoke
Assert & Reply
Assert
© OPITZ CONSULTING GmbH 2010 Seite 6SOA Testing
Systemtests in der SOA-Suite
Service1 Service2
Service4Service3
Invoke
Assert
End-to-End
© OPITZ CONSULTING GmbH 2010 Seite 7SOA Testing
Integrationstests in der SOA-Suite Testfallabhängige Mock-Services
Service1 Service2
Service4Service3
InvokeMock
Assert
Assert & Reply
© OPITZ CONSULTING GmbH 2010 Seite 8SOA Testing
Zwischenstand Unit-Tests:
XQuery, XSLT: Via API und JUnit Composites: Test Suite for Composite Applications OSB:
Integrationstests: Systemtests / End-to-End Tests:
Dritthersteller
Fehlt
Fehlt
© OPITZ CONSULTING GmbH 2010 Seite 9SOA Testing
Integrationstests mit dem OSB (1) Mock-Services und der OSB
Service1 Service2
Service4Service3
OSB OSB OSB
OSB OSB
© OPITZ CONSULTING GmbH 2010 Seite 10SOA Testing
Aufruf von Services: Dynamic Routing
Integrationstests mit dem OSB (2)
<ctx:route> <ctx:service isProxy="true">
MyProject/Service1 </ctx:service> <ctx:operation>
Operation1 </ctx:operation></ctx:route>
© OPITZ CONSULTING GmbH 2010 Seite 11SOA Testing
Business-Services: Binding und Protokoll
Integrationstests mit dem OSB (3)
<xml-fragment> <ser:coreEntry isProxy="false" isEnabled="true"> <ser:binding type="abstract XML"/> </ser:coreEntry> <ser:endpointConfig> <tran:provider-id>file</tran:provider-id> <tran:inbound>false</tran:inbound> <tran:URI> <env:value>file:///c:/osbtest/</env:value> </tran:URI> </ser:endpointConfig></xml-fragment>
© OPITZ CONSULTING GmbH 2010 Seite 12SOA Testing
Service1 JUnit-Test
Integrationstests mit dem OSB (4)
Reply
Consumer1
Provider1
OSB
Configuration API
Invokerservice
Service1 Provider1 MockHTTP
JMX
HTTP
Any
Any
Invoke
Change BizServices
Assert
© OPITZ CONSULTING GmbH 2010 Seite 13SOA Testing
Integrationstests mit dem OSB (5)
1 @Test2 public void testService1() {3 mockBusinessService("App/Provider1", new Delegate() {4 public String serviceCallReceived(5 String serviceName, String req) throws Exception {6 recvReq = req;7 return "<testresp>hallo</testresp>";8 }9 });10 String recvResp = invokeProxyService(11 "App/Service1",null,12 "<testreq>hallo</testrq>");13 assertEquals("<testreq>hallo</testreq>",recvReq);14 assertEquals("<testresp>hallo</testresp>",recvResp);15 }
© OPITZ CONSULTING GmbH 2010 Seite 14SOA Testing
Take aways Softwaretests sind Pflicht in einer SOA Unit-Tests:
XQuery, XSLT: Via API und JUnit Composites: Test Suite for Composite Applications OSB:
Integrationstests: Systemtests / End-to-End Tests:
Dritthersteller
NEU (OC)
NEU (OC)
NEU (OC)
© OPITZ CONSULTING GmbH 2010 Seite 15SOA Testing
Fragen und Antworten
© OPITZ CONSULTING GmbH 2010 Seite 16SOA Testing
OSB JMX-API
1 SessionManagementMBean sm = …2 ALSBConfigurationMBean cb = …3 sm.createSession("MySession1");4 Ref projRef = Refs.makeProjectRef("proj");5 Ref inputRef = Refs.makeBusinessSvcRef(projRef,
"MyBizService");6 cb.clone(inputRef, saveRef);7 byte[] data = cb.export(inputRefs, false, null); // Change data…8 cb.uploadJarFile(data);9 ALSBImportPlan plan = cb.getImportJarInfo().getDefaultImportPlan();10 plan.setPreserveExistingEnvValues(false);11 cb.importUploaded(plan);12 sm.activateSession("MySession1", "MyComment");
© OPITZ CONSULTING GmbH 2010 Seite 17SOA Testing
Oracle OSB vs. Mediator Mediator: früher Oracle ESB
Virtualisierung zwischen Komponenten eines Composites Komponente in einem SCA-Deployment
OSB: früher BEA Aqualogic Service Bus (ALSB) Kommunikation nach außen und zwischen Applikationen/Composites Load-Balancing Message-Throtteling Split/Join Primärer Servicebus
© OPITZ CONSULTING GmbH 2010 Seite 18SOA Testing
Dynamische Konfiguration auch für Composites
Service1 JUnit-Test
Automatische Tests für Composites
Assert&Reply
Consumer1
Provider1
SOA
Configuration API
Service1 Provider1 MockHTTP
JMX
HTTPAny
Any
Invoke
Prepare
Assert