Search in sources :

Example 1 with DefinitionsCacheRegistry

use of org.kie.workbench.common.stunner.core.registry.impl.DefinitionsCacheRegistry in project kie-wb-common by kiegroup.

the class DomainLookupsCacheTest method testCleanUp.

@Test
public void testCleanUp() {
    DefinitionsCacheRegistry definitionsRegistry = mock(DefinitionsCacheRegistry.class);
    when(definitionsRegistry.getLabels(eq(DEF_ID1))).thenReturn(Collections.singleton(ROLE1));
    when(definitionsRegistry.getLabels(eq(DEF_ID2))).thenReturn(Collections.singleton(ROLE2));
    DomainLookupsCache tested = new DomainLookupsCache(definitionManager, definitionsRegistry, DEF_SET_ID);
    assertEquals(1, tested.getDefinitions(ROLE1).size());
    assertEquals(1, tested.getDefinitions(ROLE2).size());
    tested.clear();
    assertEquals(Collections.emptySet(), tested.getDefinitions(ROLE1));
    assertEquals(Collections.emptySet(), tested.getDefinitions(ROLE2));
    assertEquals(0, tested.getConnectionRules().size());
}
Also used : DefinitionsCacheRegistry(org.kie.workbench.common.stunner.core.registry.impl.DefinitionsCacheRegistry) Test(org.junit.Test)

Aggregations

Test (org.junit.Test)1 DefinitionsCacheRegistry (org.kie.workbench.common.stunner.core.registry.impl.DefinitionsCacheRegistry)1