use of com.opentext.ia.sdk.dto.ProductInfo.BuildProperties in project infoarchive-sip-sdk by Enterprise-Content-Management.
the class WhenUsingInfoArchive method init.
@BeforeEach
public void init() throws IOException {
prepareConfiguration();
connection = new PropertiesBasedArchiveConnection(configuration);
connection.setRestClient(restClient);
Services resource = new Services();
Link link = mock(Link.class);
Tenant tenant = new Tenant();
application = new Application();
applications = mock(Applications.class);
federations = mock(XdbFederations.class);
Spaces spaces = mock(Spaces.class);
XdbDatabases databases = mock(XdbDatabases.class);
FileSystemRoots fileSystemRoots = mock(FileSystemRoots.class);
FileSystemRoot fileSystemRoot = new FileSystemRoot();
when(fileSystemRoots.first()).thenReturn(fileSystemRoot);
Holdings holdings = mock(Holdings.class);
ReceiverNodes receiverNodes = mock(ReceiverNodes.class);
SpaceRootXdbLibraries spaceRootLibraries = mock(SpaceRootXdbLibraries.class);
SpaceRootFolders rootFolders = mock(SpaceRootFolders.class);
FileSystemFolders systemFolders = mock(FileSystemFolders.class);
Stores stores = mock(Stores.class);
IngestNodes ingestionNodes = mock(IngestNodes.class);
RetentionPolicies retentionPolicies = mock(RetentionPolicies.class);
Pdis pdis = mock(Pdis.class);
PdiSchemas pdiSchemas = mock(PdiSchemas.class);
Ingests ingests = mock(Ingests.class);
XdbLibraries libraries = mock(XdbLibraries.class);
Contents contents = new Contents();
Aics aics = mock(Aics.class);
LinkContainer aips = new LinkContainer();
Queries queries = mock(Queries.class);
QueryQuotas quotas = mock(QueryQuotas.class);
ResultConfigurationHelpers helpers = mock(ResultConfigurationHelpers.class);
ExportConfigurations exportConfigurations = mock(ExportConfigurations.class);
ExportPipelines exportPipelines = mock(ExportPipelines.class);
ExportTransformations exportTransformations = mock(ExportTransformations.class);
Searches searches = mock(Searches.class);
SearchCompositions compositions = mock(SearchCompositions.class);
XForms xForms = mock(XForms.class);
XForm xForm = mock(XForm.class);
CryptoObjects cryptoObjects = mock(CryptoObjects.class);
PdiCryptoes pdiCryptos = mock(PdiCryptoes.class);
HoldingCryptoes holdingCryptos = mock(HoldingCryptoes.class);
StorageEndPoints storageEndPoints = mock(StorageEndPoints.class);
CustomStorages customStorages = mock(CustomStorages.class);
ContentAddressedStorages contentAddressedStorages = mock(ContentAddressedStorages.class);
Aic aic = new Aic();
links.put(InfoArchiveLinkRelations.LINK_TENANT, link);
links.put(InfoArchiveLinkRelations.LINK_APPLICATIONS, link);
links.put(InfoArchiveLinkRelations.LINK_AIPS, link);
links.put(InfoArchiveLinkRelations.LINK_INGEST, link);
resource.setLinks(links);
tenant.setLinks(links);
application.setLinks(links);
contents.getLinks().put(LINK_DOWNLOAD, new Link());
when(restClient.follow(any(LinkContainer.class), eq(LINK_CONTENTS), eq(Contents.class))).thenReturn(contents);
when(restClient.get(BILLBOARD_URI, Services.class)).thenReturn(resource);
when(restClient.follow(resource, LINK_TENANT, Tenant.class)).thenReturn(tenant);
ProductInfo productInfo = new ProductInfo();
BuildProperties buildProperties = new BuildProperties();
buildProperties.setServerVersion("16.3");
productInfo.setBuildProperties(buildProperties);
when(restClient.follow(resource, LINK_PRODUCT_INFO, ProductInfo.class)).thenReturn(productInfo);
when(link.getHref()).thenReturn(BILLBOARD_URI);
when(restClient.follow(application, InfoArchiveLinkRelations.LINK_AIPS, LinkContainer.class)).thenReturn(aips);
aips.setLinks(links);
mockCollection(Applications.class, applications);
mockCollection(XdbFederations.class, federations);
mockCollection(Spaces.class, spaces);
mockCollection(XdbDatabases.class, databases);
mockCollection(FileSystemRoots.class, fileSystemRoots);
mockCollection(Holdings.class, holdings);
mockCollection(ReceiverNodes.class, receiverNodes);
mockCollection(SpaceRootXdbLibraries.class, spaceRootLibraries);
mockCollection(SpaceRootFolders.class, rootFolders);
mockCollection(FileSystemFolders.class, systemFolders);
mockCollection(Stores.class, stores);
mockCollection(IngestNodes.class, ingestionNodes);
mockCollection(RetentionPolicies.class, retentionPolicies);
mockCollection(Pdis.class, pdis);
mockCollection(PdiSchemas.class, pdiSchemas);
mockCollection(Ingests.class, ingests);
mockCollection(XdbLibraries.class, libraries);
mockCollection(Aics.class, aics);
mockCollection(QueryQuotas.class, quotas);
mockCollection(Queries.class, queries);
mockCollection(ResultConfigurationHelpers.class, helpers);
mockCollection(ExportConfigurations.class, exportConfigurations);
mockCollection(ExportPipelines.class, exportPipelines);
mockCollection(ExportTransformations.class, exportTransformations);
mockCollection(Searches.class, searches);
mockCollection(SearchCompositions.class, compositions);
mockCollection(XForms.class, xForms);
mockCollection(CryptoObjects.class, cryptoObjects);
mockCollection(PdiCryptoes.class, pdiCryptos);
mockCollection(HoldingCryptoes.class, holdingCryptos);
mockCollection(StorageEndPoints.class, storageEndPoints);
mockCollection(CustomStorages.class, customStorages);
mockCollection(ContentAddressedStorages.class, contentAddressedStorages);
when(restClient.createCollectionItem(any(LinkContainer.class), any(XForm.class), eq(LINK_SELF))).thenReturn(xForm);
mockByName(federations, new XdbFederation());
mockByName(databases, new XdbDatabase());
mockByName(applications, application);
mockByName(spaces, new Space());
mockByName(spaceRootLibraries, new SpaceRootXdbLibrary());
mockByName(rootFolders, new SpaceRootFolder());
mockByName(fileSystemRoots, new FileSystemRoot());
mockByName(systemFolders, new FileSystemFolder());
mockByName(stores, new Store());
mockByName(receiverNodes, new ReceiverNode());
mockByName(ingestionNodes, new IngestNode());
mockByName(retentionPolicies, new RetentionPolicy());
mockByName(pdis, new Pdi());
mockByName(pdiSchemas, new PdiSchema());
mockByName(ingests, new Ingest());
mockByName(libraries, new XdbLibrary());
mockByName(holdings, new Holding());
mockByName(aics, aic);
mockByName(quotas, new QueryQuota());
mockByName(queries, new Query());
mockByName(helpers, new ResultConfigurationHelper());
mockByName(exportConfigurations, new ExportConfiguration());
mockByName(exportPipelines, new ExportPipeline());
mockByName(exportTransformations, new ExportTransformation());
mockByName(searches, new Search());
mockByName(compositions, new SearchComposition());
mockByName(xForms, new XForm());
mockByName(cryptoObjects, new CryptoObject());
mockByName(pdiCryptos, new PdiCrypto());
mockByName(holdingCryptos, new HoldingCrypto());
mockByName(storageEndPoints, new StorageEndPoint());
mockByName(customStorages, new CustomStorage());
mockByName(contentAddressedStorages, new ContentAddressedStorage());
when(restClient.put(any(), eq(SearchComposition.class), any(AllSearchComponents.class))).thenReturn(new SearchComposition());
when(aics.getItems()).thenReturn(Stream.of(aic));
}
Aggregations