use of org.kie.workbench.common.stunner.bpmn.workitem.WorkItemDefinitionRegistry in project kie-wb-common by kiegroup.
the class WorkItemDefinitionClientRegistryTest method testRegistryProducer.
@Test
public void testRegistryProducer() {
WorkItemDefinitionRegistry registry = tested.getRegistry();
assertEquals(this.registry, registry);
}
use of org.kie.workbench.common.stunner.bpmn.workitem.WorkItemDefinitionRegistry 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(customTask))).thenReturn(DefinitionId.build(WID_NAME));
when(widAdapter.getCategory(eq(customTask))).thenReturn(WID_CAT);
when(widAdapter.getTitle(eq(customTask))).thenReturn(WID_DISPLAY_NAME);
when(widAdapter.getDescription(eq(customTask))).thenReturn(WID_DESC);
ExpandedPaletteDefinitionBuilder paletteDefinitionBuilder = spy(new ExpandedPaletteDefinitionBuilder(definitionUtils, profileManager, definitionsRegistry, 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, CustomTask> serviceTaskBuilder = wid -> WID.equals(wid) ? customTask : null;
tested = new BPMNPaletteDefinitionBuilder(definitionManager, paletteDefinitionBuilder, translationService, () -> workItemDefinitionRegistry, serviceTaskBuilder, definitionUtils, new BPMNCategoryDefinitionProvider());
tested.init();
}
use of org.kie.workbench.common.stunner.bpmn.workitem.WorkItemDefinitionRegistry in project kie-wb-common by kiegroup.
the class NoWIDCustomTaskResolutionTest method setup.
@Before
@SuppressWarnings("unchecked")
public void setup() throws Exception {
// Setup context.
widRegistry = new WorkItemDefinitionRegistry() {
@Override
public Collection<WorkItemDefinition> items() {
return Collections.EMPTY_LIST;
}
@Override
public WorkItemDefinition get(String name) {
return null;
}
};
widService = mock(WorkItemDefinitionLookupService.class);
when(widService.execute(any(Metadata.class))).thenReturn(widRegistry.items());
stunnerAPI = StunnerTestingGraphBackendAPI.build(BPMNDefinitionSet.class, new BPMNTestDefinitionFactory(widRegistry));
xmlEncoder = new XMLEncoderDiagramMetadataMarshaller();
// Setup tested instance.
tested = new BPMNDirectDiagramMarshaller(xmlEncoder, stunnerAPI.getDefinitionManager(), stunnerAPI.getRuleManager(), widService, stunnerAPI.getFactoryManager(), stunnerAPI.commandFactory, stunnerAPI.commandManager, dataTypeCacheServer);
diagram = Unmarshalling.unmarshall(tested, BPMN_CUSTOM_TASK);
}
Aggregations