Search in sources :

Example 1 with EditorEntityTypeIdentifier

use of org.molgenis.metadata.manager.model.EditorEntityTypeIdentifier in project molgenis by molgenis.

the class EntityTypeReferenceMapperTest method testToEditorEntityTypeIdentifiers.

@Test
public void testToEditorEntityTypeIdentifiers() {
    String id = "id";
    String label = "label";
    EntityType entityType = mock(EntityType.class);
    when(entityType.getId()).thenReturn(id);
    when(entityType.getLabel()).thenReturn(label);
    List<EditorEntityTypeIdentifier> editorEntityTypeIdentifiers = entityTypeReferenceMapper.toEditorEntityTypeIdentifiers(of(entityType));
    assertEquals(editorEntityTypeIdentifiers, of(EditorEntityTypeIdentifier.create(id, label)));
}
Also used : EntityType(org.molgenis.data.meta.model.EntityType) EditorEntityTypeIdentifier(org.molgenis.metadata.manager.model.EditorEntityTypeIdentifier) Test(org.testng.annotations.Test)

Example 2 with EditorEntityTypeIdentifier

use of org.molgenis.metadata.manager.model.EditorEntityTypeIdentifier in project molgenis by molgenis.

the class AttributeReferenceMapperTest method testToEditorAttributeIdentifier.

@Test
public void testToEditorAttributeIdentifier() {
    String id = "id";
    String label = "label";
    String entityTypeId = "id";
    String entityTypeLabel = "label";
    Attribute attribute = mock(Attribute.class);
    EntityType entityType = mock(EntityType.class);
    when(attribute.getIdentifier()).thenReturn(id);
    when(attribute.getLabel()).thenReturn(label);
    when(attribute.getEntity()).thenReturn(entityType);
    when(entityType.getId()).thenReturn(entityTypeId);
    when(entityType.getLabel()).thenReturn(entityTypeLabel);
    EditorAttributeIdentifier editorAttributeIdentifier = attributeReferenceMapper.toEditorAttributeIdentifier(attribute);
    EditorEntityTypeIdentifier editorEntityTypeIdentifier = EditorEntityTypeIdentifier.create(entityTypeId, entityTypeLabel);
    assertEquals(editorAttributeIdentifier, EditorAttributeIdentifier.create(id, label, editorEntityTypeIdentifier));
}
Also used : EntityType(org.molgenis.data.meta.model.EntityType) EditorEntityTypeIdentifier(org.molgenis.metadata.manager.model.EditorEntityTypeIdentifier) EditorAttributeIdentifier(org.molgenis.metadata.manager.model.EditorAttributeIdentifier) Attribute(org.molgenis.data.meta.model.Attribute) Test(org.testng.annotations.Test)

Example 3 with EditorEntityTypeIdentifier

use of org.molgenis.metadata.manager.model.EditorEntityTypeIdentifier in project molgenis by molgenis.

the class AttributeReferenceMapperTest method testToEditorAttributeIdentifiers.

@Test
public void testToEditorAttributeIdentifiers() {
    String id = "id";
    String label = "label";
    String entityTypeId = "id";
    String entityTypeLabel = "label";
    Attribute attribute = mock(Attribute.class);
    EntityType entityType = mock(EntityType.class);
    when(attribute.getIdentifier()).thenReturn(id);
    when(attribute.getLabel()).thenReturn(label);
    when(attribute.getEntity()).thenReturn(entityType);
    when(entityType.getId()).thenReturn(entityTypeId);
    when(entityType.getLabel()).thenReturn(entityTypeLabel);
    ImmutableList<EditorAttributeIdentifier> editorAttributeIdentifier = attributeReferenceMapper.toEditorAttributeIdentifiers(of(attribute));
    EditorEntityTypeIdentifier editorEntityTypeIdentifier = EditorEntityTypeIdentifier.create(entityTypeId, entityTypeLabel);
    assertEquals(editorAttributeIdentifier, of(EditorAttributeIdentifier.create(id, label, editorEntityTypeIdentifier)));
}
Also used : EntityType(org.molgenis.data.meta.model.EntityType) EditorEntityTypeIdentifier(org.molgenis.metadata.manager.model.EditorEntityTypeIdentifier) EditorAttributeIdentifier(org.molgenis.metadata.manager.model.EditorAttributeIdentifier) Attribute(org.molgenis.data.meta.model.Attribute) Test(org.testng.annotations.Test)

Example 4 with EditorEntityTypeIdentifier

use of org.molgenis.metadata.manager.model.EditorEntityTypeIdentifier in project molgenis by molgenis.

the class EntityTypeReferenceMapperTest method testToEditorEntityTypeIdentifier.

@Test
public void testToEditorEntityTypeIdentifier() {
    String id = "id";
    String label = "label";
    EntityType entityType = mock(EntityType.class);
    when(entityType.getId()).thenReturn(id);
    when(entityType.getLabel()).thenReturn(label);
    EditorEntityTypeIdentifier editorEntityTypeIdentifier = entityTypeReferenceMapper.toEditorEntityTypeIdentifier(entityType);
    assertEquals(editorEntityTypeIdentifier, EditorEntityTypeIdentifier.create(id, label));
}
Also used : EntityType(org.molgenis.data.meta.model.EntityType) EditorEntityTypeIdentifier(org.molgenis.metadata.manager.model.EditorEntityTypeIdentifier) Test(org.testng.annotations.Test)

Aggregations

EntityType (org.molgenis.data.meta.model.EntityType)4 EditorEntityTypeIdentifier (org.molgenis.metadata.manager.model.EditorEntityTypeIdentifier)4 Test (org.testng.annotations.Test)4 Attribute (org.molgenis.data.meta.model.Attribute)2 EditorAttributeIdentifier (org.molgenis.metadata.manager.model.EditorAttributeIdentifier)2