ConfigurationAlgorithm { public static void configure(final Definitions definitions) { final Set<Gateway> reconfiguredGatewaySet = findConfiguredGateways(definitions); prune(definitions, (Set) findAbsentSequenceFlows(reconfiguredGatewaySet)); for (Gateway gateway : reconfiguredGatewaySet) { replaceConfiguredGateway(definitions, gateway); } removeTrivialGateways(definitions); prune(definitions, (Set) findOrphans(definitions)); }  static void configure(final Definitions definitions); static Map<BaseElement, DiagramElement> findBpmndiMap(final Definitions definitions); static Set<Gateway> findConfiguredGateways(final Definitions definitions); static Set<SequenceFlow> findAbsentSequenceFlows(final Set<Gateway> reconfiguredGatewaySet); static void main(final String[] arg);  }
@Test public final void testConfigure1() throws IOException, JAXBException, SAXException { Unmarshaller unmarshaller = context.createUnmarshaller(); unmarshaller.setProperty(IDResolver.class.getName(), new DefinitionsIDResolver()); Definitions definitions = (Definitions) unmarshaller.unmarshal(test1File); ConfigurationAlgorithm.configure(definitions); assertValidBPMN(definitions, "test-configure1.bpmn.xml"); }
@Test public final void testConfigure2() throws IOException, JAXBException, SAXException { Unmarshaller unmarshaller = context.createUnmarshaller(); unmarshaller.setProperty(IDResolver.class.getName(), new DefinitionsIDResolver()); Definitions definitions = (Definitions) unmarshaller.unmarshal(trivialGatewayFile); ConfigurationAlgorithm.configure(definitions); assertValidBPMN(definitions, "test-configure2.bpmn.xml"); }