Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Christian Grashofer, Stephan Pelikan: Camunda R...

Christian Grashofer, Stephan Pelikan: Camunda Real Life Usage

Christian Grashofer, Director of mpc PLUS GmbH in Vienna, shows us his company’s B2B software. This solution uses Camunda under the hoods and enables local electrical stores to offer end customers and Austrian households a hassle-free change-over to another energy supplier for their power and gas consumption. Stephan Pelikan, Software Developer in Vienna, let us have a look into the coding details of this very same solution developed for mpc PLUS. He also shows us a typical development approach when using Camunda: modeling, coding, wiring stuff in the development project as well as unit testing of processes.

Avatar for Camunda Vienna

Camunda Vienna

November 22, 2016

More Decks by Camunda Vienna

Other Decks in Programming

Transcript

  1. Camunda Real  Life  Usage Christian  Grashofer,  Managing  Director mpc PLUS

    Stephan  Pelikan,  Software  Developer  PHACTUM
  2. Business  process overview Goal  is non-­‐stop to signature Data  missing?

    Sometimes things are slow...... Submit to Energy Supplier Current live  solution focuses on  one stop shop Sometimes things never happen!  J
  3. Business  Process Dev &  Test 3  Community  Extensions Scenario  –

    Assert – Coverage 1)  Execute  Scenario  -­‐ 2)  Assert process state -­‐ 3)  Visualize Coverage • https://github.com/camunda/camunda-­‐bpm-­‐assert-­‐scenario • https://github.com/camunda/camunda-­‐bpm-­‐assert • https://github.com/camunda/camunda-­‐bpm-­‐process-­‐test-­‐coverage
  4. Testing the „happy  Path“  J @Mock public ProcessScenario changeOfEnergySupplier; @Test

    public void testHappyPath()  throws Exception { Scenario.run(changeOfEnergySupplier).startByKey("ChangeOfEnergySupplier").execute(); verify(changeOfEnergySupplier,  times(1)).hasFinished("ProvisionInvoiceable"); verify(changeOfEnergySupplier,  never()).hasFinished("ApplicationCanceled"); verify(changeOfEnergySupplier,  never()).hasFinished("ApplicationTimedOut"); }
  5. Testing the almost „Happy  Path“ Delivery via   Postal Service

    Complete this step differently...     withVariables("viaMail",  false,  "viaPostalService",  true) ...  and verify that the user task to send  by postal service is passed: verify(changeOfEnergySupplier,  times(1)).hasFinished("DeliverViaPostalService");
  6. Testing the almost „Happy  Path“  J @Test public void testHappyPath_viaPostalService()

     throws Exception { Map<String,  Object>  variables  =  withVariables("viaMail",  false,  "viaPostalService",  true); //  ... Scenario.run(changeOfEnergySupplier).startByKey("ChangeOfEnergySupplier").execute(); verify(changeOfEnergySupplier,  times(1)).hasFinished("DeliverViaPostalService"); verify(changeOfEnergySupplier,  never()).hasFinished("DeliverViaMail"); verify(changeOfEnergySupplier,  times(1)).hasFinished("ProvisionInvoiceable"); }
  7. Testing when things go slow... Just  define that this takes

    long ...   task.defer("P20D",  ()  -­‐>  task.receive()) ...  and verify that this is executed twice: verify(changeOfEnergySupplier,  times(2)).hasFinished("ProcedureSpedUp");
  8. Testing when things go slow...  J @Test public void testGatherMissingApplicationData_afterTwentyDays()

     throws Exception { //  ... when(changeOfEnergySupplier.waitsAtReceiveTask("Gather...")).thenReturn((task)  -­‐> task.defer("P20D",  ()  -­‐>  task.receive()) ); Scenario.run(changeOfEnergySupplier).startByKey("ChangeOfEnergySupplier").execute(); verify(changeOfEnergySupplier,  times(1)).hasFinished("SendReminderViaMail"); verify(changeOfEnergySupplier,  times(1)).hasFinished("ContactCustomerViaPhone"); verify(changeOfEnergySupplier,  times(2)).hasFinished("ProcedureSpedUp"); }
  9. THANK  YOU! 3  Community  Extensions Scenario  – Assert – Coverage

    1)  Execute  Scenario  -­‐ 2)  Assert process state -­‐ 3)  Visualise Coverage • https://github.com/camunda/camunda-­‐bpm-­‐assert-­‐scenario • https://github.com/camunda/camunda-­‐bpm-­‐assert • https://github.com/camunda/camunda-­‐bpm-­‐process-­‐test-­‐coverage