Java Code Examples for org.camunda.commons.utils.IoUtil#fileAsStream()
The following examples show how to use
org.camunda.commons.utils.IoUtil#fileAsStream() .
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: DmnTransformTest.java From camunda-engine-dmn with Apache License 2.0 | 6 votes |
@Test public void shouldParseDecisionWithRequiredDecisions() { InputStream inputStream = IoUtil.fileAsStream(REQUIRED_DECISIONS_DMN); DmnModelInstance modelInstance = Dmn.readModelFromStream(inputStream); DmnDecision buyProductDecision = dmnEngine.parseDecision("buyProduct", modelInstance); assertDecision(buyProductDecision, "buyProduct"); Collection<DmnDecision> buyProductrequiredDecisions = buyProductDecision.getRequiredDecisions(); assertThat(buyProductrequiredDecisions.size()).isEqualTo(1); DmnDecision buyComputerDecision = getDecision(buyProductrequiredDecisions, "buyComputer"); assertThat(buyComputerDecision).isNotNull(); Collection<DmnDecision> buyComputerRequiredDecision = buyComputerDecision.getRequiredDecisions(); assertThat(buyComputerRequiredDecision.size()).isEqualTo(1); DmnDecision buyElectronicDecision = getDecision(buyComputerRequiredDecision, "buyElectronic"); assertThat(buyElectronicDecision).isNotNull(); assertThat(buyElectronicDecision.getRequiredDecisions().size()).isEqualTo(0); }
Example 2
Source File: DmnTransformTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Test public void shouldTransformDecisionRequirementsGraph() { InputStream inputStream = IoUtil.fileAsStream(REQUIRED_DECISIONS_DMN); DmnDecisionRequirementsGraph drg = dmnEngine.parseDecisionRequirementsGraph(inputStream); assertThat(drg).isNotNull(); assertThat(drg.getKey()).isEqualTo("buy-decision"); assertThat(drg.getName()).isEqualTo("Buy Decision"); assertThat(drg.getDecisionKeys()) .hasSize(3) .contains("buyProduct", "buyComputer", "buyElectronic"); Collection<DmnDecision> decisions = drg.getDecisions(); assertThat(decisions) .hasSize(3) .extracting("key") .contains("buyProduct", "buyComputer", "buyElectronic"); }
Example 3
Source File: DmnTransformListenerTest.java From camunda-bpm-platform with Apache License 2.0 | 6 votes |
@Test public void shouldVerifyTransformedDmnDecision() { InputStream inputStream = IoUtil.fileAsStream(DECISION_TRANSFORM_DMN); DmnModelInstance modelInstance = Dmn.readModelFromStream(inputStream); dmnEngine.parseDecisionRequirementsGraph(modelInstance); DmnDecision dmnDecision = listener.getDmnDecision(); Decision decision = listener.getDecision(); assertThat(dmnDecision.getKey()) .isEqualTo(decision.getId()) .isEqualTo("decision1"); assertThat(dmnDecision.getName()) .isEqualTo(decision.getName()) .isEqualTo("camunda"); }
Example 4
Source File: ParseDecisionTest.java From camunda-engine-dmn with Apache License 2.0 | 6 votes |
@Test public void shouldFailIfDecisionDrgIdIsMissing() { try { InputStream inputStream = IoUtil.fileAsStream(MISSING_DECISION_REQUIREMENT_DIAGRAM_ID_DMN); dmnEngine.parseDecisionRequirementsGraph(inputStream); failBecauseExceptionWasNotThrown(DmnTransformException.class); } catch (DmnTransformException e) { assertThat(e) .hasCauseExactlyInstanceOf(DmnTransformException.class) .hasMessageStartingWith("DMN-02016") .hasMessageContaining("DMN-02017") .hasMessageContaining("DRD with Missing Id"); } }
Example 5
Source File: DmnTransformTest.java From camunda-engine-dmn with Apache License 2.0 | 6 votes |
@Test public void shouldTransformDecisionRequirementsGraph() { InputStream inputStream = IoUtil.fileAsStream(REQUIRED_DECISIONS_DMN); DmnDecisionRequirementsGraph drg = dmnEngine.parseDecisionRequirementsGraph(inputStream); assertThat(drg).isNotNull(); assertThat(drg.getKey()).isEqualTo("buy-decision"); assertThat(drg.getName()).isEqualTo("Buy Decision"); assertThat(drg.getDecisionKeys()) .hasSize(3) .contains("buyProduct", "buyComputer", "buyElectronic"); Collection<DmnDecision> decisions = drg.getDecisions(); assertThat(decisions) .hasSize(3) .extracting("key") .contains("buyProduct", "buyComputer", "buyElectronic"); }
Example 6
Source File: DmnTransformListenerTest.java From camunda-engine-dmn with Apache License 2.0 | 6 votes |
@Test public void shouldVerifyTransformedDmnDecision() { InputStream inputStream = IoUtil.fileAsStream(DECISION_TRANSFORM_DMN); DmnModelInstance modelInstance = Dmn.readModelFromStream(inputStream); dmnEngine.parseDecisionRequirementsGraph(modelInstance); DmnDecision dmnDecision = listener.getDmnDecision(); Decision decision = listener.getDecision(); assertThat(dmnDecision.getKey()) .isEqualTo(decision.getId()) .isEqualTo("decision1"); assertThat(dmnDecision.getName()) .isEqualTo(decision.getName()) .isEqualTo("camunda"); }
Example 7
Source File: ParseDecisionTest.java From camunda-engine-dmn with Apache License 2.0 | 5 votes |
@Test public void shouldParseDecisionFromModelInstance() { InputStream inputStream = IoUtil.fileAsStream(NO_INPUT_DMN); DmnModelInstance modelInstance = Dmn.readModelFromStream(inputStream); decision = dmnEngine.parseDecision("decision", modelInstance); assertDecision(decision, "decision"); }
Example 8
Source File: DmnTransformTest.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
@Test public void shouldDetectLoopInParseDecisionWithRequiredDecision() { InputStream inputStream = IoUtil.fileAsStream(LOOP_REQUIRED_DECISIONS_DMN); DmnModelInstance modelInstance = Dmn.readModelFromStream(inputStream); try { decision = dmnEngine.parseDecision("buyProduct", modelInstance); failBecauseExceptionWasNotThrown(DmnTransformException.class); } catch(DmnTransformException e) { Assertions.assertThat(e) .hasMessageStartingWith("DMN-02004") .hasMessageContaining("DMN-02015") .hasMessageContaining("has a loop"); } }
Example 9
Source File: ParseDecisionTest.java From camunda-engine-dmn with Apache License 2.0 | 5 votes |
@Test public void shouldParseDrgFromModelInstance() { InputStream inputStream = IoUtil.fileAsStream(NO_INPUT_DMN); DmnModelInstance modelInstance = Dmn.readModelFromStream(inputStream); DmnDecisionRequirementsGraph drg = dmnEngine.parseDecisionRequirementsGraph(modelInstance); assertDecisionRequirementsGraph(drg, "definitions"); }
Example 10
Source File: DmnTransformTest.java From camunda-bpm-platform with Apache License 2.0 | 5 votes |
@Test public void shouldNotDetectLoopInMultiLevelDecisionWithMultipleRequiredDecision() { InputStream inputStream = IoUtil.fileAsStream(MULTI_LEVEL_MULTIPLE_REQUIRED_DECISIONS_DMN); DmnModelInstance modelInstance = Dmn.readModelFromStream(inputStream); List<DmnDecision> decisions = dmnEngine.parseDecisions(modelInstance); assertThat(decisions.size()).isEqualTo(8); }
Example 11
Source File: DmnTransformTest.java From camunda-engine-dmn with Apache License 2.0 | 5 votes |
@Test public void shouldDetectLoopInParseDecisionWithRequiredDecisionOfDifferentOrder() { InputStream inputStream = IoUtil.fileAsStream(LOOP_REQUIRED_DECISIONS_DIFFERENT_ORDER_DMN); DmnModelInstance modelInstance = Dmn.readModelFromStream(inputStream); try { dmnEngine.parseDecisions(modelInstance); failBecauseExceptionWasNotThrown(DmnTransformException.class); } catch(DmnTransformException e) { Assertions.assertThat(e) .hasMessageStartingWith("DMN-02004") .hasMessageContaining("DMN-02015") .hasMessageContaining("has a loop"); } }
Example 12
Source File: DmnTransformTest.java From camunda-engine-dmn with Apache License 2.0 | 5 votes |
@Test public void shouldDetectLoopInParseDecisionWithRequiredDecision() { InputStream inputStream = IoUtil.fileAsStream(LOOP_REQUIRED_DECISIONS_DMN); DmnModelInstance modelInstance = Dmn.readModelFromStream(inputStream); try { decision = dmnEngine.parseDecision("buyProduct", modelInstance); failBecauseExceptionWasNotThrown(DmnTransformException.class); } catch(DmnTransformException e) { Assertions.assertThat(e) .hasMessageStartingWith("DMN-02004") .hasMessageContaining("DMN-02015") .hasMessageContaining("has a loop"); } }
Example 13
Source File: DmnTransformTest.java From camunda-engine-dmn with Apache License 2.0 | 5 votes |
@Test public void shouldParseDecisionWithMultipleRequiredDecisions() { InputStream inputStream = IoUtil.fileAsStream(MULTIPLE_REQUIRED_DECISIONS_DMN); DmnModelInstance modelInstance = Dmn.readModelFromStream(inputStream); DmnDecision decision = dmnEngine.parseDecision("car",modelInstance); Collection<DmnDecision> requiredDecisions = decision.getRequiredDecisions(); assertThat(requiredDecisions.size()).isEqualTo(2); DmnDecision carPriceDecision = getDecision(requiredDecisions, "carPrice"); assertThat(carPriceDecision).isNotNull(); DmnDecision carSpeedDecision = getDecision(requiredDecisions, "carSpeed"); assertThat(carSpeedDecision).isNotNull(); }
Example 14
Source File: ParseDecisionTest.java From camunda-engine-dmn with Apache License 2.0 | 4 votes |
@Test public void shouldParseDecisionFromInputStream() { InputStream inputStream = IoUtil.fileAsStream(NO_INPUT_DMN); decision = dmnEngine.parseDecision("decision", inputStream); assertDecision(decision, "decision"); }
Example 15
Source File: ParseDecisionTest.java From camunda-bpm-platform with Apache License 2.0 | 4 votes |
@Test public void shouldParseDecisionFromInputStream() { InputStream inputStream = IoUtil.fileAsStream(NO_INPUT_DMN); decision = dmnEngine.parseDecision("decision", inputStream); assertDecision(decision, "decision"); }
Example 16
Source File: ParseDecisionTest.java From camunda-bpm-platform with Apache License 2.0 | 4 votes |
@Test public void shouldParseDecisionFromInputStream_Dmn12() { InputStream inputStream = IoUtil.fileAsStream(DMN12_NO_INPUT_DMN); decision = dmnEngine.parseDecision("decision", inputStream); assertDecision(decision, "decision"); }
Example 17
Source File: ParseDecisionTest.java From camunda-bpm-platform with Apache License 2.0 | 4 votes |
@Test public void shouldParseDecisionFromInputStream_Dmn13() { InputStream inputStream = IoUtil.fileAsStream(DMN13_NO_INPUT_DMN); decision = dmnEngine.parseDecision("decision", inputStream); assertDecision(decision, "decision"); }
Example 18
Source File: DmnExampleVerifier.java From camunda-bpm-platform with Apache License 2.0 | 4 votes |
public static void assertExample(DmnEngine engine) { InputStream inputStream = IoUtil.fileAsStream(EXAMPLE_DMN); DmnDecision decision = engine.parseDecision("decision", inputStream); assertExample(engine, decision); }
Example 19
Source File: DmnEngineTest.java From camunda-bpm-platform with Apache License 2.0 | 4 votes |
public DmnDecision parseDecisionFromFile(String decisionKey, String filename) { InputStream inputStream = IoUtil.fileAsStream(filename); return dmnEngine.parseDecision(decisionKey, inputStream); }
Example 20
Source File: DmnEngineTest.java From camunda-engine-dmn with Apache License 2.0 | 4 votes |
public DmnDecision parseDecisionFromFile(String decisionKey, String filename) { InputStream inputStream = IoUtil.fileAsStream(filename); return dmnEngine.parseDecision(decisionKey, inputStream); }