@Test void addEntityType() { EntityType entityType = mock(EntityType.class); Attribute attr0 = mock(Attribute.class); Attribute attr1 = mock(Attribute.class); when(entityType.getOwnAllAttributes()).thenReturn(newArrayList(attr0, attr1)); metaDataServiceImpl.addEntityType(entityType); @SuppressWarnings("unchecked") ArgumentCaptor<Stream<Entity>> attrsCaptor = ArgumentCaptor.forClass(Stream.class); verify(dataService).add(eq(ATTRIBUTE_META_DATA), attrsCaptor.capture()); assertEquals(newArrayList(attr0, attr1), attrsCaptor.getValue().collect(toList())); verify(dataService).add(ENTITY_TYPE_META_DATA, entityType); verifyNoMoreInteractions(dataService); }
@Transactional @Override public void addEntityType(EntityType entityType) { dataService.add(ENTITY_TYPE_META_DATA, entityType); Stream<Attribute> attrs = stream(entityType.getOwnAllAttributes()); dataService.add(ATTRIBUTE_META_DATA, attrs); }
MetaDataServiceImpl implements MetaDataService { @Transactional @Override public void addEntityType(EntityType entityType) { dataService.add(ENTITY_TYPE_META_DATA, entityType); Stream<Attribute> attrs = stream(entityType.getOwnAllAttributes()); dataService.add(ATTRIBUTE_META_DATA, attrs); } }
MetaDataServiceImpl implements MetaDataService { @Transactional @Override public void addEntityType(EntityType entityType) { dataService.add(ENTITY_TYPE_META_DATA, entityType); Stream<Attribute> attrs = stream(entityType.getOwnAllAttributes()); dataService.add(ATTRIBUTE_META_DATA, attrs); } MetaDataServiceImpl(
      DataService dataService,
      RepositoryCollectionRegistry repoCollectionRegistry,
      SystemEntityTypeRegistry systemEntityTypeRegistry,
      EntityTypeDependencyResolver entityTypeDependencyResolver,
      PackagePersister packagePersister); }
MetaDataServiceImpl implements MetaDataService { @Transactional @Override public void addEntityType(EntityType entityType) { dataService.add(ENTITY_TYPE_META_DATA, entityType); Stream<Attribute> attrs = stream(entityType.getOwnAllAttributes()); dataService.add(ATTRIBUTE_META_DATA, attrs); } MetaDataServiceImpl(
      DataService dataService,
      RepositoryCollectionRegistry repoCollectionRegistry,
      SystemEntityTypeRegistry systemEntityTypeRegistry,
      EntityTypeDependencyResolver entityTypeDependencyResolver,
      PackagePersister packagePersister); @Override Optional<Repository<Entity>> getRepository(String entityTypeId); @SuppressWarnings("unchecked") @Override Optional<Repository<E>> getRepository(
      String entityTypeId, Class<E> entityClass); @Override Optional<Repository<Entity>> getRepository(EntityType entityType); @SuppressWarnings("unchecked") @Override Optional<Repository<E>> getRepository(
      EntityType entityType, Class<E> entityClass); @Override boolean hasRepository(String entityTypeId); @Transactional @Override Repository<Entity> createRepository(EntityType entityType); @Transactional @Override Repository<E> createRepository(
      EntityType entityType, Class<E> entityClass); @Override RepositoryCollection getDefaultBackend(); @Override RepositoryCollection getBackend(String backendName); @Transactional @Override void deleteEntityType(String entityTypeId); @Transactional @Override void deleteEntityTypes(Collection<String> entityTypeIds); @Transactional @Override void deleteAttributeById(Object id); @Override RepositoryCollection getBackend(EntityType entityType); @Transactional @Override void addEntityType(EntityType entityType); @Transactional @Override void updateEntityType(EntityType entityType); @Transactional @Override void upsertEntityTypes(Collection<EntityType> entityTypes); @Transactional @Override void addAttribute(Attribute attr); @Override boolean hasEntityType(String entityTypeId); @Override Optional<EntityType> getEntityType(String entityTypeId); @Transactional @Override void addPackage(Package aPackage); @Transactional @Override void upsertPackages(Stream<Package> packages); @Override Optional<Package> getPackage(String packageId); @Override List<Package> getPackages(); @Override List<Package> getRootPackages(); @Transactional @Override void upsertTags(Collection<Tag> tags); @Override Stream<EntityType> getEntityTypes(); @Override Stream<Repository<Entity>> getRepositories(); @Override @Nonnull Iterator<RepositoryCollection> iterator(); @Override Map<String, Boolean> determineImportableEntities(
      RepositoryCollection repositoryCollection); @Override boolean isEntityTypeCompatible(EntityType newEntityType); @Override boolean hasBackend(String backendName); @Override Stream<EntityType> getConcreteChildren(EntityType entityType); @Override Stream<Attribute> getReferringAttributes(String entityTypeId); }
MetaDataServiceImpl implements MetaDataService { @Transactional @Override public void addEntityType(EntityType entityType) { dataService.add(ENTITY_TYPE_META_DATA, entityType); Stream<Attribute> attrs = stream(entityType.getOwnAllAttributes()); dataService.add(ATTRIBUTE_META_DATA, attrs); } MetaDataServiceImpl(
      DataService dataService,
      RepositoryCollectionRegistry repoCollectionRegistry,
      SystemEntityTypeRegistry systemEntityTypeRegistry,
      EntityTypeDependencyResolver entityTypeDependencyResolver,
      PackagePersister packagePersister); @Override Optional<Repository<Entity>> getRepository(String entityTypeId); @SuppressWarnings("unchecked") @Override Optional<Repository<E>> getRepository(
      String entityTypeId, Class<E> entityClass); @Override Optional<Repository<Entity>> getRepository(EntityType entityType); @SuppressWarnings("unchecked") @Override Optional<Repository<E>> getRepository(
      EntityType entityType, Class<E> entityClass); @Override boolean hasRepository(String entityTypeId); @Transactional @Override Repository<Entity> createRepository(EntityType entityType); @Transactional @Override Repository<E> createRepository(
      EntityType entityType, Class<E> entityClass); @Override RepositoryCollection getDefaultBackend(); @Override RepositoryCollection getBackend(String backendName); @Transactional @Override void deleteEntityType(String entityTypeId); @Transactional @Override void deleteEntityTypes(Collection<String> entityTypeIds); @Transactional @Override void deleteAttributeById(Object id); @Override RepositoryCollection getBackend(EntityType entityType); @Transactional @Override void addEntityType(EntityType entityType); @Transactional @Override void updateEntityType(EntityType entityType); @Transactional @Override void upsertEntityTypes(Collection<EntityType> entityTypes); @Transactional @Override void addAttribute(Attribute attr); @Override boolean hasEntityType(String entityTypeId); @Override Optional<EntityType> getEntityType(String entityTypeId); @Transactional @Override void addPackage(Package aPackage); @Transactional @Override void upsertPackages(Stream<Package> packages); @Override Optional<Package> getPackage(String packageId); @Override List<Package> getPackages(); @Override List<Package> getRootPackages(); @Transactional @Override void upsertTags(Collection<Tag> tags); @Override Stream<EntityType> getEntityTypes(); @Override Stream<Repository<Entity>> getRepositories(); @Override @Nonnull Iterator<RepositoryCollection> iterator(); @Override Map<String, Boolean> determineImportableEntities(
      RepositoryCollection repositoryCollection); @Override boolean isEntityTypeCompatible(EntityType newEntityType); @Override boolean hasBackend(String backendName); @Override Stream<EntityType> getConcreteChildren(EntityType entityType); @Override Stream<Attribute> getReferringAttributes(String entityTypeId);  }