Search in sources :

Example 1 with RequestRuleFlowGroupDataEvent

use of org.kie.workbench.common.stunner.bpmn.forms.dataproviders.RequestRuleFlowGroupDataEvent in project kie-wb-common by kiegroup.

the class RuleFlowGroupFormProvider method populateData.

@PostConstruct
public void populateData() {
    requestRuleFlowGroupDataEvent.fire(new RequestRuleFlowGroupDataEvent());
    requestRuleFlowGroupDataEventEventSingleton = requestRuleFlowGroupDataEvent;
}
Also used : RequestRuleFlowGroupDataEvent(org.kie.workbench.common.stunner.bpmn.forms.dataproviders.RequestRuleFlowGroupDataEvent) PostConstruct(javax.annotation.PostConstruct)

Example 2 with RequestRuleFlowGroupDataEvent

use of org.kie.workbench.common.stunner.bpmn.forms.dataproviders.RequestRuleFlowGroupDataEvent in project kie-wb-common by kiegroup.

the class RuleFlowGroupFormProviderTest method testGroupWithSameProject.

@Test
public void testGroupWithSameProject() {
    RuleFlowGroup group1 = new RuleFlowGroup("g1");
    group1.setPathUri("default://main@MySpace/Project1/src/main/resources/com/myspace/project1/RulesFile.rdrl");
    RuleFlowGroup group2 = new RuleFlowGroup("g1");
    group2.setPathUri("default://main@MySpace/Project1/src/main/resources/com/myspace/RulesFile2.rdrl".replace('/', '\\'));
    RuleFlowGroup group3 = new RuleFlowGroup("g1");
    group3.setPathUri("default://main@MySpace/Project2/src/main/resources/com/myspace/project1/RulesFile.rdrl");
    List<RuleFlowGroup> groups = Arrays.asList(group1, group2, group3);
    when(dataProvider.getRuleFlowGroupNames()).thenReturn(groups);
    FormRenderingContext context = mock(FormRenderingContext.class);
    SelectorData<String> data = tested.getSelectorData(context);
    Map<String, String> values = data.getValues();
    assertNotNull(values);
    assertEquals(1, values.size());
    assertEquals("g1 [Project1, Project2]", values.get(group1.getName()));
    verify(requestRuleFlowGroupDataEvent, times(1)).fire(any(RequestRuleFlowGroupDataEvent.class));
}
Also used : RuleFlowGroup(org.kie.workbench.common.stunner.bpmn.definition.property.task.RuleFlowGroup) FormRenderingContext(org.kie.workbench.common.forms.dynamic.service.shared.FormRenderingContext) RequestRuleFlowGroupDataEvent(org.kie.workbench.common.stunner.bpmn.forms.dataproviders.RequestRuleFlowGroupDataEvent) Test(org.junit.Test)

Example 3 with RequestRuleFlowGroupDataEvent

use of org.kie.workbench.common.stunner.bpmn.forms.dataproviders.RequestRuleFlowGroupDataEvent in project kie-wb-common by kiegroup.

the class RuleFlowGroupFormProviderTest method testGetSelectorData.

@Test
@SuppressWarnings("unchecked")
public void testGetSelectorData() {
    RuleFlowGroup group1 = new RuleFlowGroup("g1");
    group1.setPathUri("default://main@MySpace/Project1/src/main/resources/com/myspace/project1/RulesFile.rdrl");
    RuleFlowGroup group2 = new RuleFlowGroup("g2");
    group2.setPathUri("default://main@MySpace/Project1/src/main/resources/com/myspace/RulesFile2.rdrl".replace('/', '\\'));
    RuleFlowGroup group3 = new RuleFlowGroup("g1");
    group3.setPathUri("default://main@MySpace/Project2/src/main/resources/com/myspace/project1/RulesFile.rdrl");
    List<RuleFlowGroup> groups = Arrays.asList(group1, group2, group3);
    when(dataProvider.getRuleFlowGroupNames()).thenReturn(groups);
    FormRenderingContext context = mock(FormRenderingContext.class);
    SelectorData data = tested.getSelectorData(context);
    Map<String, String> values = data.getValues();
    assertNotNull(values);
    assertEquals(2, values.size());
    assertEquals("g2 [Project1]", values.get(group2.getName()));
    assertEquals("g1 [Project1, Project2]", values.get(group1.getName()));
    verify(requestRuleFlowGroupDataEvent, times(1)).fire(any(RequestRuleFlowGroupDataEvent.class));
}
Also used : RuleFlowGroup(org.kie.workbench.common.stunner.bpmn.definition.property.task.RuleFlowGroup) FormRenderingContext(org.kie.workbench.common.forms.dynamic.service.shared.FormRenderingContext) RequestRuleFlowGroupDataEvent(org.kie.workbench.common.stunner.bpmn.forms.dataproviders.RequestRuleFlowGroupDataEvent) SelectorData(org.kie.workbench.common.forms.dynamic.model.config.SelectorData) Test(org.junit.Test)

Example 4 with RequestRuleFlowGroupDataEvent

use of org.kie.workbench.common.stunner.bpmn.forms.dataproviders.RequestRuleFlowGroupDataEvent in project kie-wb-common by kiegroup.

the class RuleFlowGroupDataServiceTest method testRuleFlowGroupDataService.

@Test
public void testRuleFlowGroupDataService() {
    RuleFlowGroupDataService tested = spy(new RuleFlowGroupDataService(queryService, dataChangedEvent));
    tested.onRequestRuleFlowGroupDataEvent(new RequestRuleFlowGroupDataEvent());
    verify(tested).fireData();
}
Also used : RequestRuleFlowGroupDataEvent(org.kie.workbench.common.stunner.bpmn.forms.dataproviders.RequestRuleFlowGroupDataEvent) Test(org.junit.Test)

Aggregations

RequestRuleFlowGroupDataEvent (org.kie.workbench.common.stunner.bpmn.forms.dataproviders.RequestRuleFlowGroupDataEvent)4 Test (org.junit.Test)3 FormRenderingContext (org.kie.workbench.common.forms.dynamic.service.shared.FormRenderingContext)2 RuleFlowGroup (org.kie.workbench.common.stunner.bpmn.definition.property.task.RuleFlowGroup)2 PostConstruct (javax.annotation.PostConstruct)1 SelectorData (org.kie.workbench.common.forms.dynamic.model.config.SelectorData)1