Search in sources :

Example 1 with WorkItemDefinitionCacheRegistry

use of org.kie.workbench.common.stunner.bpmn.workitem.WorkItemDefinitionCacheRegistry in project kie-wb-common by kiegroup.

the class WorkItemDefinitionBackendRegistryTest method init.

@Before
public void init() {
    WorkItemDefinitionCacheRegistry registry = new WorkItemDefinitionCacheRegistry();
    WorkItemDefinitionMetadataRegistry metadataRegistry = new WorkItemDefinitionMetadataRegistry();
    when(metadata.getRoot()).thenReturn(root);
    when(service.search(eq(root))).thenReturn(Arrays.asList(DEF1, DEF2));
    this.tested = new WorkItemDefinitionBackendRegistry(registry, service, metadataRegistry);
    tested.init();
}
Also used : WorkItemDefinitionMetadataRegistry(org.kie.workbench.common.stunner.bpmn.workitem.WorkItemDefinitionMetadataRegistry) WorkItemDefinitionCacheRegistry(org.kie.workbench.common.stunner.bpmn.workitem.WorkItemDefinitionCacheRegistry) Before(org.junit.Before)

Example 2 with WorkItemDefinitionCacheRegistry

use of org.kie.workbench.common.stunner.bpmn.workitem.WorkItemDefinitionCacheRegistry in project kie-wb-common by kiegroup.

the class WorkItemDefinitionClientRegistry method obtainRegistry.

private WorkItemDefinitionCacheRegistry obtainRegistry(final String sessionUUID) {
    WorkItemDefinitionCacheRegistry registry = sessionRegistries.get(sessionUUID);
    if (null == registry) {
        registry = registryInstanceSupplier.get();
        sessionRegistries.put(sessionUUID, registry);
    }
    return registry;
}
Also used : WorkItemDefinitionCacheRegistry(org.kie.workbench.common.stunner.bpmn.workitem.WorkItemDefinitionCacheRegistry)

Example 3 with WorkItemDefinitionCacheRegistry

use of org.kie.workbench.common.stunner.bpmn.workitem.WorkItemDefinitionCacheRegistry in project kie-wb-common by kiegroup.

the class WorkItemDefinitionProjectClientRegistryTest method testGetCurrentSessionRegistry.

@Test
@SuppressWarnings("unchecked")
public void testGetCurrentSessionRegistry() {
    ClientSession session = mock(ClientSession.class);
    CanvasHandler canvasHandler = mock(CanvasHandler.class);
    Diagram diagram = mock(Diagram.class);
    when(session.getCanvasHandler()).thenReturn(canvasHandler);
    when(canvasHandler.getDiagram()).thenReturn(diagram);
    when(diagram.getMetadata()).thenReturn(metadata);
    when(sessionManager.getCurrentSession()).thenReturn(session);
    tested.call(metadata);
    verify(index, times(1)).put(eq(metadata), eq(registry));
    verify(registry, times(1)).register(eq(WID));
    WorkItemDefinitionCacheRegistry currentSessionRegistry = tested.getCurrentSessionRegistry();
    assertEquals(registry, currentSessionRegistry);
}
Also used : CanvasHandler(org.kie.workbench.common.stunner.core.client.canvas.CanvasHandler) WorkItemDefinitionCacheRegistry(org.kie.workbench.common.stunner.bpmn.workitem.WorkItemDefinitionCacheRegistry) ClientSession(org.kie.workbench.common.stunner.core.client.session.ClientSession) Diagram(org.kie.workbench.common.stunner.core.diagram.Diagram) Test(org.junit.Test)

Example 4 with WorkItemDefinitionCacheRegistry

use of org.kie.workbench.common.stunner.bpmn.workitem.WorkItemDefinitionCacheRegistry in project kie-wb-common by kiegroup.

the class WorkItemDefinitionProjectServiceTest method init.

@Before
public void init() {
    when(vfsService.search(eq(metadata))).thenReturn(Arrays.asList(wid1, wid2));
    registry = new WorkItemDefinitionCacheRegistry();
    tested = new WorkItemDefinitionProjectService(registry, vfsService, deployServices, deployPredicate);
}
Also used : WorkItemDefinitionCacheRegistry(org.kie.workbench.common.stunner.bpmn.workitem.WorkItemDefinitionCacheRegistry) Before(org.junit.Before)

Example 5 with WorkItemDefinitionCacheRegistry

use of org.kie.workbench.common.stunner.bpmn.workitem.WorkItemDefinitionCacheRegistry in project kie-wb-common by kiegroup.

the class WorkItemDefinitionClientRegistry method removeRegistry.

private void removeRegistry(final String sessionUUID) {
    final WorkItemDefinitionCacheRegistry registry = sessionRegistries.remove(sessionUUID);
    if (null != registry) {
        registry.clear();
        registryInstanceDestroyer.accept(registry);
    }
}
Also used : WorkItemDefinitionCacheRegistry(org.kie.workbench.common.stunner.bpmn.workitem.WorkItemDefinitionCacheRegistry)

Aggregations

WorkItemDefinitionCacheRegistry (org.kie.workbench.common.stunner.bpmn.workitem.WorkItemDefinitionCacheRegistry)5 Before (org.junit.Before)2 Test (org.junit.Test)1 WorkItemDefinitionMetadataRegistry (org.kie.workbench.common.stunner.bpmn.workitem.WorkItemDefinitionMetadataRegistry)1 CanvasHandler (org.kie.workbench.common.stunner.core.client.canvas.CanvasHandler)1 ClientSession (org.kie.workbench.common.stunner.core.client.session.ClientSession)1 Diagram (org.kie.workbench.common.stunner.core.diagram.Diagram)1