@Test void testMaxProgressOneSourceOneBatch() { MappingTarget mappingTarget = mock(MappingTarget.class); EntityMapping entityMapping = getMockEntityMapping("a", MAPPING_BATCH_SIZE - 1); List<EntityMapping> mappings = singletonList(entityMapping); when(mappingTarget.getEntityMappings()).thenReturn(mappings); assertEquals(1, mappingService.calculateMaxProgress(mappingTarget)); }
int calculateMaxProgress(MappingTarget mappingTarget) { int batches = mappingTarget.getEntityMappings().stream().mapToInt(this::countBatches).sum(); if (mappingTarget.hasSelfReferences()) { batches *= 2; } return batches; }
MappingServiceImpl implements MappingService { int calculateMaxProgress(MappingTarget mappingTarget) { int batches = mappingTarget.getEntityMappings().stream().mapToInt(this::countBatches).sum(); if (mappingTarget.hasSelfReferences()) { batches *= 2; } return batches; } }
MappingServiceImpl implements MappingService { int calculateMaxProgress(MappingTarget mappingTarget) { int batches = mappingTarget.getEntityMappings().stream().mapToInt(this::countBatches).sum(); if (mappingTarget.hasSelfReferences()) { batches *= 2; } return batches; } MappingServiceImpl(
      DataService dataService,
      AlgorithmService algorithmService,
      MappingProjectRepository mappingProjectRepository,
      PermissionSystemService permissionSystemService,
      AttributeFactory attrMetaFactory,
      EntityManager entityManager); }
MappingServiceImpl implements MappingService { int calculateMaxProgress(MappingTarget mappingTarget) { int batches = mappingTarget.getEntityMappings().stream().mapToInt(this::countBatches).sum(); if (mappingTarget.hasSelfReferences()) { batches *= 2; } return batches; } MappingServiceImpl(
      DataService dataService,
      AlgorithmService algorithmService,
      MappingProjectRepository mappingProjectRepository,
      PermissionSystemService permissionSystemService,
      AttributeFactory attrMetaFactory,
      EntityManager entityManager); @Override @Transactional MappingProject addMappingProject(String projectName, String target, int depth); @Override @Transactional void deleteMappingProject(String mappingProjectId); @Override @Transactional MappingProject cloneMappingProject(String mappingProjectId); @Override @Transactional MappingProject cloneMappingProject(
      String mappingProjectId, String clonedMappingProjectName); @Override List<MappingProject> getAllMappingProjects(); @Override @Transactional void updateMappingProject(MappingProject mappingProject); @Override MappingProject getMappingProject(String identifier); @Override @Transactional long applyMappings(
      String mappingProjectId,
      String entityTypeId,
      Boolean addSourceAttribute,
      String packageId,
      String label,
      Progress progress); Stream<EntityType> getCompatibleEntityTypes(EntityType target); }
MappingServiceImpl implements MappingService { int calculateMaxProgress(MappingTarget mappingTarget) { int batches = mappingTarget.getEntityMappings().stream().mapToInt(this::countBatches).sum(); if (mappingTarget.hasSelfReferences()) { batches *= 2; } return batches; } MappingServiceImpl(
      DataService dataService,
      AlgorithmService algorithmService,
      MappingProjectRepository mappingProjectRepository,
      PermissionSystemService permissionSystemService,
      AttributeFactory attrMetaFactory,
      EntityManager entityManager); @Override @Transactional MappingProject addMappingProject(String projectName, String target, int depth); @Override @Transactional void deleteMappingProject(String mappingProjectId); @Override @Transactional MappingProject cloneMappingProject(String mappingProjectId); @Override @Transactional MappingProject cloneMappingProject(
      String mappingProjectId, String clonedMappingProjectName); @Override List<MappingProject> getAllMappingProjects(); @Override @Transactional void updateMappingProject(MappingProject mappingProject); @Override MappingProject getMappingProject(String identifier); @Override @Transactional long applyMappings(
      String mappingProjectId,
      String entityTypeId,
      Boolean addSourceAttribute,
      String packageId,
      String label,
      Progress progress); Stream<EntityType> getCompatibleEntityTypes(EntityType target); static final int MAPPING_BATCH_SIZE; }