use of org.kie.workbench.common.stunner.core.client.components.palette.ExpandedPaletteDefinitionBuilder in project kie-wb-common by kiegroup.
the class CaseManagementPaletteDefinitionBuilderTest method setup.
@Before
@SuppressWarnings("unchecked")
public void setup() throws Exception {
paletteDefinitionBuilder = new ExpandedPaletteDefinitionBuilder(definitionUtils, clientFactoryServices, translationService);
tested = new CaseManagementPaletteDefinitionBuilder(paletteDefinitionBuilder, definitionManager);
}
use of org.kie.workbench.common.stunner.core.client.components.palette.ExpandedPaletteDefinitionBuilder in project kie-wb-common by kiegroup.
the class BPMNPaletteDefinitionBuilderTest method setup.
@Before
@SuppressWarnings("unchecked")
public void setup() {
when(definitionUtils.getDefinitionManager()).thenReturn(definitionManager);
when(definitionManager.adapters()).thenReturn(adapterManager);
when(adapterManager.registry()).thenReturn(adapterRegistry);
when(adapterRegistry.getDefinitionAdapter(any(Class.class))).thenReturn(widAdapter);
when(widAdapter.getId(eq(serviceTask))).thenReturn(WID_NAME);
when(widAdapter.getCategory(eq(serviceTask))).thenReturn(WID_CAT);
when(widAdapter.getTitle(eq(serviceTask))).thenReturn(WID_DISPLAY_NAME);
when(widAdapter.getDescription(eq(serviceTask))).thenReturn(WID_DESC);
ExpandedPaletteDefinitionBuilder paletteDefinitionBuilder = spy(new ExpandedPaletteDefinitionBuilder(definitionUtils, clientFactoryServices, translationService));
doAnswer(invocationOnMock -> {
Consumer<DefaultPaletteDefinition> definitionConsumer = (Consumer<DefaultPaletteDefinition>) invocationOnMock.getArguments()[1];
definitionConsumer.accept(PALETTE_DEFINITION);
return null;
}).when(paletteDefinitionBuilder).build(eq(canvasHandler), any(Consumer.class));
Function<WorkItemDefinition, ServiceTask> serviceTaskBuilder = wid -> WID.equals(wid) ? serviceTask : null;
tested = new BPMNPaletteDefinitionBuilder(definitionManager, paletteDefinitionBuilder, translationService, () -> workItemDefinitionRegistry, serviceTaskBuilder);
tested.init();
}
use of org.kie.workbench.common.stunner.core.client.components.palette.ExpandedPaletteDefinitionBuilder in project kie-wb-common by kiegroup.
the class BPMNPaletteDefinitionBuilderTest method testFilteredItems.
@Test
public void testFilteredItems() {
ExpandedPaletteDefinitionBuilder delegate = tested.getPaletteDefinitionBuilder();
assertTrue(delegate.getItemFilter().test(getId(UserTask.class)));
assertTrue(delegate.getItemFilter().test(getId(Lane.class)));
assertTrue(delegate.getItemFilter().test(getId(StartNoneEvent.class)));
assertTrue(delegate.getItemFilter().test(getId(EndSignalEvent.class)));
assertFalse(delegate.getItemFilter().test(getId(BPMNDiagramImpl.class)));
assertFalse(delegate.getItemFilter().test(getId(SequenceFlow.class)));
assertFalse(delegate.getItemFilter().test(getId(NoneTask.class)));
}
Aggregations