@Test public void testLoadModelComponents() { final String dmnModelName = "ModelName"; final DRGElement drgElement1 = mock(DRGElement.class); final DRGElement drgElement2 = mock(DRGElement.class); final DecisionComponent decisionComponent1 = mock(DecisionComponent.class); final DecisionComponent decisionComponent2 = mock(DecisionComponent.class); final List<DecisionComponent> decisionComponentsList = new ArrayList<>(); final Definitions definitions = mock(Definitions.class); when(definitions.getName()).thenReturn(new Name(dmnModelName)); when(dmnGraphUtils.getModelDefinitions()).thenReturn(definitions); when(dmnDiagramsSession.getModelDRGElements()).thenReturn(Arrays.asList(drgElement1, drgElement2)); when(drgElement1.getName()).thenReturn(new Name("Decision-1")); when(drgElement2.getName()).thenReturn(new Name("Decision-2")); when(decisionComponent1.getName()).thenReturn("Decision-1"); when(decisionComponent2.getName()).thenReturn("Decision-2"); doReturn(decisionComponent1).when(decisionComponents).makeDecisionComponent(dmnModelName, drgElement1); doReturn(decisionComponent2).when(decisionComponents).makeDecisionComponent(dmnModelName, drgElement2); doReturn(decisionComponentsList).when(decisionComponents).getModelDRGElements(); doNothing().when(decisionComponents).refreshView(); decisionComponents.loadModelComponents(); assertTrue(decisionComponentsList.contains(decisionComponent1)); assertTrue(decisionComponentsList.contains(decisionComponent2)); assertEquals(2, decisionComponentsList.size()); verify(decisionComponents).refreshView(); }
void loadModelComponents() { final String dmnModelName = dmnGraphUtils.getModelDefinitions().getName().getValue(); final List<DRGElement> dmnModelDRGElements = dmnDiagramsSession.getModelDRGElements(); getModelDRGElements().clear(); dmnModelDRGElements.forEach(drgElement -> { getModelDRGElements().add(makeDecisionComponent(dmnModelName, drgElement)); }); refreshView(); }
DecisionComponents { void loadModelComponents() { final String dmnModelName = dmnGraphUtils.getModelDefinitions().getName().getValue(); final List<DRGElement> dmnModelDRGElements = dmnDiagramsSession.getModelDRGElements(); getModelDRGElements().clear(); dmnModelDRGElements.forEach(drgElement -> { getModelDRGElements().add(makeDecisionComponent(dmnModelName, drgElement)); }); refreshView(); } }
DecisionComponents { void loadModelComponents() { final String dmnModelName = dmnGraphUtils.getModelDefinitions().getName().getValue(); final List<DRGElement> dmnModelDRGElements = dmnDiagramsSession.getModelDRGElements(); getModelDRGElements().clear(); dmnModelDRGElements.forEach(drgElement -> { getModelDRGElements().add(makeDecisionComponent(dmnModelName, drgElement)); }); refreshView(); } DecisionComponents(); @Inject  DecisionComponents(final View view,
                              final DMNIncludeModelsClient client,
                              final ManagedInstance<DecisionComponentsItem> itemManagedInstance,
                              final DecisionComponentFilter filter,
                              final DMNDiagramsSession dmnDiagramsSession,
                              final DMNGraphUtils dmnGraphUtils); }
DecisionComponents { void loadModelComponents() { final String dmnModelName = dmnGraphUtils.getModelDefinitions().getName().getValue(); final List<DRGElement> dmnModelDRGElements = dmnDiagramsSession.getModelDRGElements(); getModelDRGElements().clear(); dmnModelDRGElements.forEach(drgElement -> { getModelDRGElements().add(makeDecisionComponent(dmnModelName, drgElement)); }); refreshView(); } DecisionComponents(); @Inject  DecisionComponents(final View view,
                              final DMNIncludeModelsClient client,
                              final ManagedInstance<DecisionComponentsItem> itemManagedInstance,
                              final DecisionComponentFilter filter,
                              final DMNDiagramsSession dmnDiagramsSession,
                              final DMNGraphUtils dmnGraphUtils); @PostConstruct void init(); View getView(); void refresh(); void removeAllItems(); }
DecisionComponents { void loadModelComponents() { final String dmnModelName = dmnGraphUtils.getModelDefinitions().getName().getValue(); final List<DRGElement> dmnModelDRGElements = dmnDiagramsSession.getModelDRGElements(); getModelDRGElements().clear(); dmnModelDRGElements.forEach(drgElement -> { getModelDRGElements().add(makeDecisionComponent(dmnModelName, drgElement)); }); refreshView(); } DecisionComponents(); @Inject  DecisionComponents(final View view,
                              final DMNIncludeModelsClient client,
                              final ManagedInstance<DecisionComponentsItem> itemManagedInstance,
                              final DecisionComponentFilter filter,
                              final DMNDiagramsSession dmnDiagramsSession,
                              final DMNGraphUtils dmnGraphUtils); @PostConstruct void init(); View getView(); void refresh(); void removeAllItems();  }