Search in sources :

Example 21 with MappingTarget

use of org.molgenis.semanticmapper.mapping.model.MappingTarget 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 MappingTarget

use of org.molgenis.semanticmapper.mapping.model.MappingTarget 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

MappingTarget (org.molgenis.semanticmapper.mapping.model.MappingTarget)22 Test (org.testng.annotations.Test)16 EntityMapping (org.molgenis.semanticmapper.mapping.model.EntityMapping)12 MappingProject (org.molgenis.semanticmapper.mapping.model.MappingProject)12 DynamicEntity (org.molgenis.data.support.DynamicEntity)7 AttributeMapping (org.molgenis.semanticmapper.mapping.model.AttributeMapping)5 Menu (org.molgenis.core.ui.menu.Menu)4 AbstractMolgenisSpringTest (org.molgenis.data.AbstractMolgenisSpringTest)4 Entity (org.molgenis.data.Entity)3 EntityType (org.molgenis.data.meta.model.EntityType)3 User (org.molgenis.data.security.auth.User)2 BeforeMethod (org.testng.annotations.BeforeMethod)2 DefaultPackage (org.molgenis.data.meta.DefaultPackage)1 Attribute (org.molgenis.data.meta.model.Attribute)1 Package (org.molgenis.data.meta.model.Package)1 StringHttpMessageConverter (org.springframework.http.converter.StringHttpMessageConverter)1 TestingAuthenticationToken (org.springframework.security.authentication.TestingAuthenticationToken)1 MvcResult (org.springframework.test.web.servlet.MvcResult)1 Transactional (org.springframework.transaction.annotation.Transactional)1