@Test void testResolveMetadata() { String entityType1Id = "e1"; String entityType2Id = "e2"; String entityType3Id = "e3"; EntityType entityType1 = when(mock(EntityType.class).getId()).thenReturn(entityType1Id).getMock(); EntityType entityType2 = when(mock(EntityType.class).getId()).thenReturn(entityType2Id).getMock(); EntityType entityType3 = when(mock(EntityType.class).getId()).thenReturn(entityType3Id).getMock(); String pack1Id = "p1"; String pack2Id = "p2"; String pack3Id = "p3"; Package pack1 = when(mock(Package.class).getId()).thenReturn(pack1Id).getMock(); Package pack2 = when(mock(Package.class).getId()).thenReturn(pack2Id).getMock(); Package pack3 = when(mock(Package.class).getId()).thenReturn(pack3Id).getMock(); doReturn("test").when(entityType1).getIdValue(); doReturn("test").when(entityType2).getIdValue(); doReturn("test").when(entityType3).getIdValue(); doReturn(newArrayList(pack3)).when(pack1).getChildren(); doReturn(emptyList()).when(pack2).getChildren(); doReturn(emptyList()).when(pack3).getChildren(); doReturn(emptyList()).when(pack1).getEntityTypes(); doReturn(newArrayList(entityType2)).when(pack2).getEntityTypes(); doReturn(newArrayList(entityType1)).when(pack3).getEntityTypes(); Map<String, Package> packages = new HashMap<>(); Map<String, EntityType> entityTypes = new HashMap<>(); service.resolveMetadata( newArrayList(entityType1, entityType3), newArrayList(pack1, pack2), packages, entityTypes); Map<String, Package> expectedPackages = ImmutableMap.of(pack1Id, pack1, pack2Id, pack2, pack3Id, pack3); Map<String, EntityType> expectedEntityTypes = ImmutableMap.of( entityType1Id, entityType1, entityType2Id, entityType2, entityType3Id, entityType3); assertEquals(expectedPackages, packages); assertEquals(expectedEntityTypes, entityTypes); }
void resolveMetadata( List<EntityType> entityTypes, List<Package> packages, Map<String, Package> packageSet, Map<String, EntityType> entityTypeSet) { resolvePackages(packages, packageSet, entityTypeSet); resolveEntityTypes(entityTypes, entityTypeSet); }
EmxExportServiceImpl implements EmxExportService { void resolveMetadata( List<EntityType> entityTypes, List<Package> packages, Map<String, Package> packageSet, Map<String, EntityType> entityTypeSet) { resolvePackages(packages, packageSet, entityTypeSet); resolveEntityTypes(entityTypes, entityTypeSet); } }
EmxExportServiceImpl implements EmxExportService { void resolveMetadata( List<EntityType> entityTypes, List<Package> packages, Map<String, Package> packageSet, Map<String, EntityType> entityTypeSet) { resolvePackages(packages, packageSet, entityTypeSet); resolveEntityTypes(entityTypes, entityTypeSet); } EmxExportServiceImpl(DataService dataService, ContextMessageSource contextMessageSource); }
EmxExportServiceImpl implements EmxExportService { void resolveMetadata( List<EntityType> entityTypes, List<Package> packages, Map<String, Package> packageSet, Map<String, EntityType> entityTypeSet) { resolvePackages(packages, packageSet, entityTypeSet); resolveEntityTypes(entityTypes, entityTypeSet); } EmxExportServiceImpl(DataService dataService, ContextMessageSource contextMessageSource); @Override @Transactional(readOnly = true, isolation = Isolation.SERIALIZABLE) void export(
      List<EntityType> entityTypes,
      List<Package> packages,
      Path downloadFilePath,
      Progress progress); }
EmxExportServiceImpl implements EmxExportService { void resolveMetadata( List<EntityType> entityTypes, List<Package> packages, Map<String, Package> packageSet, Map<String, EntityType> entityTypeSet) { resolvePackages(packages, packageSet, entityTypeSet); resolveEntityTypes(entityTypes, entityTypeSet); } EmxExportServiceImpl(DataService dataService, ContextMessageSource contextMessageSource); @Override @Transactional(readOnly = true, isolation = Isolation.SERIALIZABLE) void export(
      List<EntityType> entityTypes,
      List<Package> packages,
      Path downloadFilePath,
      Progress progress);  }