SimpleCatalogManager implements CatalogManager { @Override public Set<Distribution> getUnversionedDistributions(Resource catalogId, Resource unversionedRecordId) { try (RepositoryConnection conn = configProvider.getRepository().getConnection()) { UnversionedRecord record = utils.getRecord(catalogId, unversionedRecordId, unversionedRecordFactory, conn); return record.getUnversionedDistribution_resource().stream() .map(resource -> utils.getExpectedObject(resource, distributionFactory, conn)) .collect(Collectors.toSet()); } } SimpleCatalogManager(); @Override Catalog getDistributedCatalog(); @Override Catalog getLocalCatalog(); @Override PaginatedSearchResults<Record> findRecord(Resource catalogId, PaginatedSearchParams searchParams); @Override Set<Resource> getRecordIds(Resource catalogId); @Override T createRecord(User user, RecordOperationConfig config, Class<T> recordClass); @Override T createRecord(RecordConfig config, OrmFactory<T> factory); @Override void addRecord(Resource catalogId, T record); @Override void updateRecord(Resource catalogId, T newRecord); @Override T removeRecord(Resource catalogId, Resource recordId, OrmFactory<T> factory); @Override T deleteRecord(User user, Resource recordId, Class<T> recordClass); @Override Optional<T> getRecord(Resource catalogId, Resource recordId, OrmFactory<T> factory); @Override Set<Distribution> getUnversionedDistributions(Resource catalogId, Resource unversionedRecordId); @Override Distribution createDistribution(DistributionConfig config); @Override void addUnversionedDistribution(Resource catalogId, Resource unversionedRecordId,
                                           Distribution distribution); @Override void updateUnversionedDistribution(Resource catalogId, Resource unversionedRecordId,
                                              Distribution newDistribution); @Override void removeUnversionedDistribution(Resource catalogId, Resource unversionedRecordId,
                                              Resource distributionId); @Override Optional<Distribution> getUnversionedDistribution(Resource catalogId, Resource unversionedRecordId,
                                                             Resource distributionId); @Override Set<Version> getVersions(Resource catalogId, Resource versionedRecordId); @Override T createVersion(@Nonnull String title, String description, OrmFactory<T> factory); @Override void addVersion(Resource catalogId, Resource versionedRecordId, T version); @Override void updateVersion(Resource catalogId, Resource versionedRecordId, T newVersion); @Override void removeVersion(Resource catalogId, Resource versionedRecordId, Resource versionId); @Override Optional<T> getVersion(Resource catalogId, Resource versionedRecordId,
                                                      Resource versionId, OrmFactory<T> factory); @Override Optional<T> getLatestVersion(Resource catalogId, Resource versionedRecordId,
                                                            OrmFactory<T> factory); @Override Commit getTaggedCommit(Resource catalogId, Resource versionedRecordId, Resource versionId); @Override Set<Distribution> getVersionedDistributions(Resource catalogId, Resource versionedRecordId,
                                                       Resource versionId); @Override void addVersionedDistribution(Resource catalogId, Resource versionedRecordId, Resource versionId,
                                         Distribution distribution); @Override void updateVersionedDistribution(Resource catalogId, Resource versionedRecordId, Resource versionId,
                                            Distribution newDistribution); @Override void removeVersionedDistribution(Resource catalogId, Resource versionedRecordId, Resource versionId,
                                            Resource distributionId); @Override Optional<Distribution> getVersionedDistribution(Resource catalogId, Resource recordId, Resource versionId,
                                                           Resource distributionId); @Override Set<Branch> getBranches(Resource catalogId, Resource versionedRDFRecordId); @Override T createBranch(@Nonnull String title, String description, OrmFactory<T> factory); @Override void addBranch(Resource catalogId, Resource versionedRDFRecordId, T branch); @Override void addMasterBranch(Resource catalogId, Resource versionedRDFRecordId); @Override void updateBranch(Resource catalogId, Resource versionedRDFRecordId, T newBranch); @Override void updateHead(Resource catalogId, Resource versionedRDFRecordId, Resource branchId, Resource commitId); @Override List<Resource> removeBranch(Resource catalogId, Resource versionedRDFRecordId, Resource branchId); @Override Optional<T> getBranch(Resource catalogId, Resource versionedRDFRecordId,
                                                    Resource branchId, OrmFactory<T> factory); @Override Branch getMasterBranch(Resource catalogId, Resource versionedRDFRecordId); @Override Commit createCommit(@Nonnull InProgressCommit inProgressCommit, @Nonnull String message, Commit baseCommit,
                               Commit auxCommit); @Override InProgressCommit createInProgressCommit(User user); @Override void updateInProgressCommit(Resource catalogId, Resource versionedRDFRecordId, Resource commitId,
                                       @Nullable Model additions, @Nullable Model deletions); @Override void updateInProgressCommit(Resource catalogId, Resource versionedRDFRecordId, User user,
                                       @Nullable Model additions, @Nullable Model deletions); @Override void addInProgressCommit(Resource catalogId, Resource versionedRDFRecordId,
                                    InProgressCommit inProgressCommit); @Override Optional<Commit> getCommit(Resource commitId); @Override Optional<Commit> getCommit(Resource catalogId, Resource versionedRDFRecordId, Resource branchId,
                                      Resource commitId); @Override Commit getHeadCommit(Resource catalogId, Resource versionedRDFRecordId, Resource branchId); @Override Optional<InProgressCommit> getInProgressCommit(Resource catalogId, Resource versionedRDFRecordId,
                                                          User user); @Override Optional<InProgressCommit> getInProgressCommit(Resource catalogId, Resource versionedRDFRecordId,
                                                          Resource inProgressCommitId); @Override Revision getRevision(Resource commitId); @Override Difference getRevisionChanges(Resource commitId); @Override Difference getCommitDifference(Resource commitId); @Override void removeInProgressCommit(Resource catalogId, Resource versionedRDFRecordId,
                                       Resource inProgressCommitId); @Override void removeInProgressCommit(Resource catalogId, Resource versionedRDFRecordId, User user); @Override Model applyInProgressCommit(Resource inProgressCommitId, Model entity); @Override List<Commit> getCommitChain(Resource commitId); @Override List<Commit> getCommitChain(Resource commitId, Resource targetId); @Override List<Commit> getCommitChain(Resource catalogId, Resource versionedRDFRecordId, Resource branchId); @Override List<Commit> getCommitChain(Resource catalogId, Resource versionedRDFRecordId, Resource branchId,
                                       final Resource targetBranchId); @Override List<Commit> getCommitEntityChain(Resource commitId, Resource entityId); @Override List<Commit> getCommitEntityChain(Resource commitId, Resource targetId, Resource entityId); @Override Model getCompiledResource(Resource commitId); @Override Model getCompiledResource(List<Commit> commitList); @Override Model getCompiledResource(Resource versionedRDFRecordId, Resource branchId, Resource commitId); @Override Difference getDifference(Resource sourceCommitId, Resource targetCommitId); @Override Set<Conflict> getConflicts(Resource leftId, Resource rightId); @Override Difference getDiff(Model original, Model changed); @Override void export(Resource recordIRI, RecordOperationConfig config); @Override void export(List<Resource> recordIRIs, RecordOperationConfig config);  }
@Test public void testGetUnversionedDistributions() throws Exception { UnversionedRecord record = unversionedRecordFactory.createNew(UNVERSIONED_RECORD_IRI); Distribution dist = distributionFactory.createNew(DISTRIBUTION_IRI); record.setUnversionedDistribution(Collections.singleton(dist)); doReturn(record).when(utilsService).getRecord(eq(distributedCatalogId), eq(UNVERSIONED_RECORD_IRI), eq(unversionedRecordFactory), any(RepositoryConnection.class)); Set<Distribution> distributions = manager.getUnversionedDistributions(distributedCatalogId, record.getResource()); verify(utilsService).getRecord(eq(distributedCatalogId), eq(UNVERSIONED_RECORD_IRI), eq(unversionedRecordFactory), any(RepositoryConnection.class)); record.getUnversionedDistribution_resource().forEach(resource -> verify(utilsService).getExpectedObject(eq(resource), eq(distributionFactory), any(RepositoryConnection.class))); assertEquals(1, distributions.size()); }