@Test public void testDMNContextContainingListAndSublist() { // DROOLS-2713 DMN evaluation response containing list and sublist fail on server DMNContext ctx = new DMNContextImpl(); List<?> list = IntStream.range(1, 11).boxed().collect(Collectors.toList()); List<?> sublist = list.subList(1, 3); ctx.set("list", list); ctx.set("sublist", sublist); DMNResultImpl dmnResults = new DMNResultImpl(null); dmnResults.setContext(ctx); dmnResults.addDecisionResult(new DMNDecisionResultImpl("list", "list", DecisionEvaluationStatus.SUCCEEDED, list, Collections.emptyList())); dmnResults.addDecisionResult(new DMNDecisionResultImpl("sublist", "sublist", DecisionEvaluationStatus.SUCCEEDED, sublist, Collections.emptyList())); DMNResultKS results = new DMNResultKS(dmnResults); Assertions.assertThat(results.getContext().get("list")).isEqualTo(list); Assertions.assertThat(results.getContext().get("sublist")).isEqualTo(sublist); Assertions.assertThat(results.getDecisionResultByName("list").getResult()).isEqualTo(list); Assertions.assertThat(results.getDecisionResultByName("sublist").getResult()).isEqualTo(sublist); }
@Test public void execute() { RegistryContext registryContext = new ContextImpl(); GetDMNDecisionResultsCommand getDMNDecisionResultsCommand = new GetDMNDecisionResultsCommand(); assertThatThrownBy(() -> getDMNDecisionResultsCommand.execute(registryContext)) .isInstanceOf(IllegalStateException.class) .hasMessage("There is no DMNResult available"); DMNResultImpl dmnResult = new DMNResultImpl(null); dmnResult.setContext(new DMNContextImpl()); registryContext.register(DMNResult.class, dmnResult); List<DMNDecisionResult> result = getDMNDecisionResultsCommand.execute(registryContext); assertEquals(0, result.size()); } }
@Test public void execute() { RegistryContext registryContext = new ContextImpl(); GetAllDMNContextCommand getAllDMNContextCommand = new GetAllDMNContextCommand(); assertThatThrownBy(() -> getAllDMNContextCommand.execute(registryContext)) .isInstanceOf(IllegalStateException.class) .hasMessage("There is not DMNResult available"); DMNResultImpl dmnResult = new DMNResultImpl(null); dmnResult.setContext(new DMNContextImpl()); registryContext.register(DMNResult.class, dmnResult); Map<String, Object> result = getAllDMNContextCommand.execute(registryContext); assertEquals(0, result.size()); } }
@Test public void execute() { RegistryContext registryContext = new ContextImpl(); GetDMNMessagesCommand getDMNMessagesCommand = new GetDMNMessagesCommand(); assertThatThrownBy(() -> getDMNMessagesCommand.execute(registryContext)) .isInstanceOf(IllegalStateException.class) .hasMessage("There is no DMNResult available"); DMNResultImpl dmnResult = new DMNResultImpl(null); dmnResult.setContext(new DMNContextImpl()); registryContext.register(DMNResult.class, dmnResult); List<DMNMessage> result = getDMNMessagesCommand.execute(registryContext); assertEquals(0, result.size()); } }