Search in sources :

Example 21 with EntityMapping

use of org.molgenis.semanticmapper.mapping.model.EntityMapping in project molgenis by molgenis.

the class MappingServiceImplTest method testMaxProgressMultipleSources.

@Test
public void testMaxProgressMultipleSources() {
    MappingTarget mappingTarget = Mockito.mock(MappingTarget.class);
    EntityMapping mapping1 = getMockEntityMapping("a", MAPPING_BATCH_SIZE);
    EntityMapping mapping2 = getMockEntityMapping("b", MAPPING_BATCH_SIZE + 1);
    List<EntityMapping> mappings = newArrayList(mapping1, mapping2);
    when(mappingTarget.getEntityMappings()).thenReturn(mappings);
    assertEquals(mappingService.calculateMaxProgress(mappingTarget), 3);
}
Also used : EntityMapping(org.molgenis.semanticmapper.mapping.model.EntityMapping) MappingTarget(org.molgenis.semanticmapper.mapping.model.MappingTarget) Test(org.testng.annotations.Test)

Example 22 with EntityMapping

use of org.molgenis.semanticmapper.mapping.model.EntityMapping in project molgenis by molgenis.

the class MappingServiceImplTest method testMaxProgressMultipleSourcesSelfReferencing.

@Test
public void testMaxProgressMultipleSourcesSelfReferencing() {
    MappingTarget mappingTarget = Mockito.mock(MappingTarget.class);
    EntityMapping mapping1 = getMockEntityMapping("a", MAPPING_BATCH_SIZE);
    EntityMapping mapping2 = getMockEntityMapping("b", MAPPING_BATCH_SIZE + 1);
    List<EntityMapping> mappings = newArrayList(mapping1, mapping2);
    when(mappingTarget.hasSelfReferences()).thenReturn(true);
    when(mappingTarget.getEntityMappings()).thenReturn(mappings);
    assertEquals(mappingService.calculateMaxProgress(mappingTarget), 6);
}
Also used : EntityMapping(org.molgenis.semanticmapper.mapping.model.EntityMapping) MappingTarget(org.molgenis.semanticmapper.mapping.model.MappingTarget) Test(org.testng.annotations.Test)

Aggregations

EntityMapping (org.molgenis.semanticmapper.mapping.model.EntityMapping)22 Test (org.testng.annotations.Test)16 MappingTarget (org.molgenis.semanticmapper.mapping.model.MappingTarget)12 AbstractMolgenisSpringTest (org.molgenis.data.AbstractMolgenisSpringTest)8 EntityType (org.molgenis.data.meta.model.EntityType)8 DynamicEntity (org.molgenis.data.support.DynamicEntity)8 AttributeMapping (org.molgenis.semanticmapper.mapping.model.AttributeMapping)8 MappingProject (org.molgenis.semanticmapper.mapping.model.MappingProject)7 Attribute (org.molgenis.data.meta.model.Attribute)6 Entity (org.molgenis.data.Entity)5 User (org.molgenis.data.security.auth.User)4 Menu (org.molgenis.core.ui.menu.Menu)3 ExplainedAttribute (org.molgenis.semanticsearch.explain.bean.ExplainedAttribute)3 Lists.newArrayList (com.google.common.collect.Lists.newArrayList)2 Collections.emptyList (java.util.Collections.emptyList)2 Collections.singletonList (java.util.Collections.singletonList)2 List (java.util.List)2 Consumer (java.util.function.Consumer)2 Relation (org.molgenis.data.semantic.Relation)2 OntologyTerm (org.molgenis.ontology.core.model.OntologyTerm)2