congrats Icon
New! Announcing Tabnine Chat Beta
Learn More
Tabnine Logo
DMNTestUtil
Code IndexAdd Tabnine to your IDE (free)

How to use
DMNTestUtil
in
org.kie.dmn.core.util

Best Java code snippets using org.kie.dmn.core.util.DMNTestUtil (Showing top 9 results out of 315)

origin: org.kie/kie-dmn-core

@Test
public void testImportTransitiveBaseModel() {
  final DMNRuntime runtime = DMNRuntimeUtil.createRuntimeWithAdditionalResources("Sayhello1ID1D.dmn",
                                          this.getClass(),
                                          "ModelB.dmn",
                                          "ModelB2.dmn",
                                          "ModelC.dmn");
  getAndAssertModelNoErrors(runtime, "http://www.trisotech.com/dmn/definitions/_ae5b3c17-1ac3-4e1d-b4f9-2cf861aec6d9", "Say hello 1ID1D");
}
origin: org.kie/kie-dmn-core

  @Test
  public void testImportChain() {
    // DROOLS-3045 DMN model API to display namespace transitive import dependencies
    final DMNRuntime runtime = DMNRuntimeUtil.createRuntimeWithAdditionalResources("Sayhello1ID1D.dmn",
                                            this.getClass(),
                                            "ModelB.dmn",
                                            "ModelB2.dmn",
                                            "ModelC.dmn");

    final DMNModelImpl modelA = (DMNModelImpl) getAndAssertModelNoErrors(runtime, "http://www.trisotech.com/dmn/definitions/_ae5b3c17-1ac3-4e1d-b4f9-2cf861aec6d9", "Say hello 1ID1D");
    assertThat(modelA.getImportChainAliases().entrySet(), hasSize(0));

    final DMNModelImpl modelB = (DMNModelImpl) getAndAssertModelNoErrors(runtime, "http://www.trisotech.com/dmn/definitions/_2a1d771a-a899-4fef-abd6-fc894332337c", "Model B");
    assertThat(modelB.getImportChainAliases().entrySet(), hasSize(1));
    assertThat(modelB.getImportChainAliases(), hasEntry(is("http://www.trisotech.com/dmn/definitions/_ae5b3c17-1ac3-4e1d-b4f9-2cf861aec6d9"),
                              contains(Collections.singletonList("modelA"))));

    final DMNModelImpl modelC = (DMNModelImpl) getAndAssertModelNoErrors(runtime, "http://www.trisotech.com/dmn/definitions/_10435dcd-8774-4575-a338-49dd554a0928", "Model C");
    assertThat(modelC.getImportChainAliases().entrySet(), hasSize(3));
    assertThat(modelC.getImportChainAliases(), hasEntry(is("http://www.trisotech.com/dmn/definitions/_2a1d771a-a899-4fef-abd6-fc894332337c"),
                              contains(Collections.singletonList("Model B"))));
    assertThat(modelC.getImportChainAliases(), hasEntry(is("http://www.trisotech.com/definitions/_9d46ece4-a96c-4cb0-abc0-0ca121ac3768"),
                              contains(Collections.singletonList("Model B2"))));
    assertThat(modelC.getImportChainAliases(), hasEntry(is("http://www.trisotech.com/dmn/definitions/_ae5b3c17-1ac3-4e1d-b4f9-2cf861aec6d9"),
                              containsInAnyOrder(Arrays.asList("Model B2", "modelA"),
                                        Arrays.asList("Model B", "modelA"))));
  }
}
origin: org.kie/kie-dmn-core

@Test
public void testGetEntries() {
  // DROOLS-3308 DMN implement missing functions only described in chapter "10.3.2.6 Context"
  final DMNRuntime runtime = DMNRuntimeUtil.createRuntime("getentriesgetvalue.dmn", this.getClass());
  final DMNModel dmnModel = getAndAssertModelNoErrors(runtime, "http://www.trisotech.com/dmn/definitions/_0fad1a80-0642-4278-ac3d-47668c4f689a", "Drawing 1");
  final DMNContext emptyContext = DMNFactory.newContext();
  final DMNResult dmnResult = runtime.evaluateAll(dmnModel, emptyContext);
  LOG.debug("{}", dmnResult);
  assertThat(DMNRuntimeUtil.formatMessages(dmnResult.getMessages()), dmnResult.hasErrors(), is(false));
  assertThat(dmnResult.getDecisionResultByName("using get entries").getEvaluationStatus(), is(DecisionEvaluationStatus.SUCCEEDED));
  assertThat(dmnResult.getDecisionResultByName("using get entries").getResult(), is(Arrays.asList("value2")));
}
origin: org.kie/kie-dmn-core

  @Test
  public void testGetValue() {
    // DROOLS-3308 DMN implement missing functions only described in chapter "10.3.2.6 Context"
    final DMNRuntime runtime = DMNRuntimeUtil.createRuntime("getentriesgetvalue.dmn", this.getClass());
    final DMNModel dmnModel = getAndAssertModelNoErrors(runtime, "http://www.trisotech.com/dmn/definitions/_0fad1a80-0642-4278-ac3d-47668c4f689a", "Drawing 1");

    final DMNContext emptyContext = DMNFactory.newContext();
    final DMNResult dmnResult = runtime.evaluateAll(dmnModel, emptyContext);
    LOG.debug("{}", dmnResult);
    assertThat(DMNRuntimeUtil.formatMessages(dmnResult.getMessages()), dmnResult.hasErrors(), is(false));
    assertThat(dmnResult.getDecisionResultByName("using get value").getEvaluationStatus(), is(DecisionEvaluationStatus.SUCCEEDED));
    assertThat(dmnResult.getDecisionResultByName("using get value").getResult(), is("value2"));
  }
}
origin: org.kie/kie-dmn-core

@Test
public void testAllowDMNAPItoEvaluateDirectDependencyImportedDecisions() {
  // DROOLS-3012 Allow DMN API to evaluate direct-dependency imported Decisions
  final DMNRuntime runtime = DMNRuntimeUtil.createRuntimeWithAdditionalResources("Sayhello1ID1D.dmn",
                                          this.getClass(),
                                          "ModelB.dmn");
  final DMNModel dmnModel = getAndAssertModelNoErrors(runtime, "http://www.trisotech.com/dmn/definitions/_2a1d771a-a899-4fef-abd6-fc894332337c", "Model B");
  
  testAllowDMNAPItoEvaluateDirectDependencyImportedDecisions_evaluateResultsAndCheck(runtime,
                                            context -> runtime.evaluateByName(dmnModel,
                                                             context,
                                                             "modelA.Greet the Person",
                                                             "Evaluating Say Hello"));
  testAllowDMNAPItoEvaluateDirectDependencyImportedDecisions_evaluateResultsAndCheck(runtime,
                                            context -> runtime.evaluateById(dmnModel,
                                                            context,
                                                            "http://www.trisotech.com/dmn/definitions/_ae5b3c17-1ac3-4e1d-b4f9-2cf861aec6d9#_f7fdaec4-d669-4797-b3b4-12b860de2eb5",
                                                            "_96df766e-23e1-4aa6-9d5d-545fbe2f1e23"));
}
origin: org.kie/kie-dmn-core

@Test
public void testImportingID() {
  // DROOLS-2944 DMN decision logic referencing DMN<import> InputData
  final DMNRuntime runtime = DMNRuntimeUtil.createRuntimeWithAdditionalResources("Sayhello1ID1D.dmn",
                                          this.getClass(),
                                          "Importing_ID.dmn");
  final DMNModel dmnModel = getAndAssertModelNoErrors(runtime, "http://www.trisotech.com/dmn/definitions/_24bac498-2a5a-403d-8b44-d407628784c4", "Importing ID");
  final DMNContext context = runtime.newContext();
  context.set("my import hello", mapOf(entry("Person name", "DROOLS-2944")));
  final DMNResult evaluateAll = runtime.evaluateAll(dmnModel, context);
  LOG.debug("{}", evaluateAll);
  assertThat(DMNRuntimeUtil.formatMessages(evaluateAll.getMessages()), evaluateAll.hasErrors(), is(false));
  assertThat(evaluateAll.getDecisionResultByName("Hello decision using imported InputData").getResult(), is("Hello, DROOLS-2944"));
}
origin: org.kie/kie-dmn-core

@Test
public void testImportTransitiveEvaluate2Layers() {
  final DMNRuntime runtime = DMNRuntimeUtil.createRuntimeWithAdditionalResources("Sayhello1ID1D.dmn",
                                          this.getClass(),
                                          "ModelB.dmn",
                                          "ModelB2.dmn",
                                          "ModelC.dmn");
  final DMNModel dmnModel = getAndAssertModelNoErrors(runtime, "http://www.trisotech.com/dmn/definitions/_2a1d771a-a899-4fef-abd6-fc894332337c", "Model B");
  final DMNContext context = runtime.newContext();
  context.set("modelA", mapOf(entry("Person name", "John")));
  final DMNResult evaluateAll = runtime.evaluateAll(dmnModel, context);
  LOG.debug("{}", evaluateAll);
  assertThat(DMNRuntimeUtil.formatMessages(evaluateAll.getMessages()), evaluateAll.hasErrors(), is(false));
  assertThat(evaluateAll.getDecisionResultByName("Evaluating Say Hello").getResult(), is("Evaluating Say Hello to: Hello, John"));
}
origin: org.kie/kie-dmn-core

@Test
public void testRetrieveDecisionByIDName() {
  // DROOLS-3026
  final DMNRuntime runtime = DMNRuntimeUtil.createRuntimeWithAdditionalResources("Sayhello1ID1D.dmn",
                                          this.getClass(),
                                          "ModelB.dmn");
  final DMNModel dmnModel = getAndAssertModelNoErrors(runtime, "http://www.trisotech.com/dmn/definitions/_2a1d771a-a899-4fef-abd6-fc894332337c", "Model B");
  assertThat(dmnModel.getDecisionById("_96df766e-23e1-4aa6-9d5d-545fbe2f1e23").getName(), is("Evaluating Say Hello"));
  assertThat(dmnModel.getDecisionById("http://www.trisotech.com/dmn/definitions/_ae5b3c17-1ac3-4e1d-b4f9-2cf861aec6d9#_f7fdaec4-d669-4797-b3b4-12b860de2eb5").getName(), is("Greet the Person")); // this is an imported Decision
  assertThat(dmnModel.getDecisionById("_f7fdaec4-d669-4797-b3b4-12b860de2eb5"), nullValue()); // this is an imported Decision
  assertThat(dmnModel.getDecisionByName("Evaluating Say Hello").getId(), is("_96df766e-23e1-4aa6-9d5d-545fbe2f1e23"));
  assertThat(dmnModel.getDecisionByName("Greet the Person"), nullValue()); // this is an imported Decision
  assertThat(dmnModel.getDecisionByName("modelA.Greet the Person").getId(), is("_f7fdaec4-d669-4797-b3b4-12b860de2eb5")); // this is an imported Decision
  assertThat(dmnModel.getInputById("http://www.trisotech.com/dmn/definitions/_ae5b3c17-1ac3-4e1d-b4f9-2cf861aec6d9#_4f6c136c-8512-4d71-8bbf-7c9eb6e74063").getName(), is("Person name")); // this is an imported InputData node.
  assertThat(dmnModel.getInputById("_4f6c136c-8512-4d71-8bbf-7c9eb6e74063"), nullValue()); // this is an imported InputData node.
  assertThat(dmnModel.getInputByName("Person name"), nullValue()); // this is an imported InputData node.
  assertThat(dmnModel.getInputByName("modelA.Person name").getId(), is("_4f6c136c-8512-4d71-8bbf-7c9eb6e74063")); // this is an imported InputData node.
}
origin: org.kie/kie-dmn-core

@Test
public void testImportTransitiveEvaluate3Layers() {
  final DMNRuntime runtime = DMNRuntimeUtil.createRuntimeWithAdditionalResources("Sayhello1ID1D.dmn",
                                          this.getClass(),
                                          "ModelB.dmn",
                                          "ModelB2.dmn",
                                          "ModelC.dmn");
  final DMNModel dmnModel = getAndAssertModelNoErrors(runtime, "http://www.trisotech.com/dmn/definitions/_10435dcd-8774-4575-a338-49dd554a0928", "Model C");
  final DMNContext context = runtime.newContext();
  context.set("Model B", mapOf(entry("modelA", mapOf(entry("Person name", "B.A.John")))));
  context.set("Model B2", mapOf(entry("modelA", mapOf(entry("Person name", "B2.A.John2")))));
  final DMNResult evaluateAll = runtime.evaluateAll(dmnModel, context);
  LOG.debug("{}", evaluateAll);
  assertThat(DMNRuntimeUtil.formatMessages(evaluateAll.getMessages()), evaluateAll.hasErrors(), is(false));
  assertThat(evaluateAll.getDecisionResultByName("Model C Decision based on Bs").getResult(), is("B: Evaluating Say Hello to: Hello, B.A.John; B2:Evaluating Say Hello to: Hello, B2.A.John2"));
}
org.kie.dmn.core.utilDMNTestUtil

Most used methods

  • getAndAssertModelNoErrors

Popular in Java

  • Making http post requests using okhttp
  • startActivity (Activity)
  • onCreateOptionsMenu (Activity)
  • scheduleAtFixedRate (ScheduledExecutorService)
  • URLConnection (java.net)
    A connection to a URL for reading or writing. For HTTP connections, see HttpURLConnection for docume
  • TreeSet (java.util)
    TreeSet is an implementation of SortedSet. All optional operations (adding and removing) are support
  • Vector (java.util)
    Vector is an implementation of List, backed by an array and synchronized. All optional operations in
  • Response (javax.ws.rs.core)
    Defines the contract between a returned instance and the runtime when an application needs to provid
  • BasicDataSource (org.apache.commons.dbcp)
    Basic implementation of javax.sql.DataSource that is configured via JavaBeans properties. This is no
  • Logger (org.apache.log4j)
    This is the central class in the log4j package. Most logging operations, except configuration, are d
  • CodeWhisperer alternatives
Tabnine Logo
  • Products

    Search for Java codeSearch for JavaScript code
  • IDE Plugins

    IntelliJ IDEAWebStormVisual StudioAndroid StudioEclipseVisual Studio CodePyCharmSublime TextPhpStormVimGoLandRubyMineEmacsJupyter NotebookJupyter LabRiderDataGripAppCode
  • Company

    About UsContact UsCareers
  • Resources

    FAQBlogTabnine AcademyTerms of usePrivacy policyJava Code IndexJavascript Code Index
Get Tabnine for your IDE now