use of org.molgenis.data.meta.SystemEntityType in project molgenis by molgenis.
the class SystemEntityTypeRegistryImplTest method testHasSystemAttributePermittedExists.
@Test
public void testHasSystemAttributePermittedExists() {
String entityTypeId = "entityType";
SystemEntityType systemEntityType = mock(SystemEntityType.class);
when(systemEntityType.getId()).thenReturn(entityTypeId);
Attribute attr = when(mock(Attribute.class).getIdentifier()).thenReturn("attr").getMock();
when(systemEntityType.getAllAttributes()).thenReturn(singletonList(attr));
when(permissionService.hasPermission(new EntityTypeIdentity(entityTypeId), EntityTypePermission.COUNT)).thenReturn(true);
systemEntityTypeRegistry.addSystemEntityType(systemEntityType);
assertTrue(systemEntityTypeRegistry.hasSystemAttribute("attr"));
}
use of org.molgenis.data.meta.SystemEntityType in project molgenis by molgenis.
the class SystemEntityTypeRegistryImplTest method testGetSystemAttributePermittedExists.
@Test
public void testGetSystemAttributePermittedExists() {
String entityTypeId = "entityType";
SystemEntityType systemEntityType = mock(SystemEntityType.class);
when(systemEntityType.getId()).thenReturn(entityTypeId);
Attribute attr = when(mock(Attribute.class).getIdentifier()).thenReturn("attr").getMock();
when(systemEntityType.getAllAttributes()).thenReturn(singletonList(attr));
when(permissionService.hasPermission(new EntityTypeIdentity(entityTypeId), EntityTypePermission.COUNT)).thenReturn(true);
systemEntityTypeRegistry.addSystemEntityType(systemEntityType);
assertEquals(systemEntityTypeRegistry.getSystemAttribute("attr"), attr);
}
use of org.molgenis.data.meta.SystemEntityType in project molgenis by molgenis.
the class SystemEntityTypeRegistryImplTest method testHasSystemAttributeNotPermitted.
@Test
public void testHasSystemAttributeNotPermitted() {
String entityTypeId = "entityType";
SystemEntityType systemEntityType = mock(SystemEntityType.class);
when(systemEntityType.getId()).thenReturn(entityTypeId);
Attribute attr = when(mock(Attribute.class).getIdentifier()).thenReturn("attr").getMock();
when(systemEntityType.getAllAttributes()).thenReturn(singletonList(attr));
when(permissionService.hasPermission(new EntityTypeIdentity(entityTypeId), EntityTypePermission.COUNT)).thenReturn(false);
systemEntityTypeRegistry.addSystemEntityType(systemEntityType);
assertTrue(systemEntityTypeRegistry.hasSystemAttribute("attr"));
}
use of org.molgenis.data.meta.SystemEntityType in project molgenis by molgenis.
the class SystemEntityTypeRegistryImplTest method testGetSystemEntityTypePermitted.
@Test
public void testGetSystemEntityTypePermitted() {
String entityTypeId = "entityType";
SystemEntityType systemEntityType = mock(SystemEntityType.class);
when(systemEntityType.getId()).thenReturn(entityTypeId);
when(permissionService.hasPermission(new EntityTypeIdentity(entityTypeId), EntityTypePermission.COUNT)).thenReturn(true);
systemEntityTypeRegistry.addSystemEntityType(systemEntityType);
assertEquals(systemEntityTypeRegistry.getSystemEntityType(entityTypeId), systemEntityType);
}
use of org.molgenis.data.meta.SystemEntityType in project molgenis by molgenis.
the class SystemEntityTypeRegistryImplTest method testHasSystemEntityTypeExists.
@Test
public void testHasSystemEntityTypeExists() {
String entityTypeId = "entityType";
SystemEntityType systemEntityType = mock(SystemEntityType.class);
when(systemEntityType.getId()).thenReturn(entityTypeId);
systemEntityTypeRegistry.addSystemEntityType(systemEntityType);
assertTrue(systemEntityTypeRegistry.hasSystemEntityType(entityTypeId));
}
Aggregations