UploaderWebClient extends DataBridgeWebClient { public BusinessObjectDataUploadCredential getBusinessObjectDataUploadCredential(DataBridgeBaseManifestDto manifest, String storageName, Integer businessObjectDataVersion, Boolean createNewVersion) throws URISyntaxException, IOException, JAXBException, NoSuchAlgorithmException, KeyStoreException, KeyManagementException { URIBuilder uriBuilder = new URIBuilder().setScheme(getUriScheme()).setHost(regServerAccessParamsDto.getRegServerHost()).setPort(regServerAccessParamsDto.getRegServerPort()) .setPath(String.join("/", HERD_APP_REST_URI_PREFIX, "businessObjectData", "upload", "credential", "namespaces", manifest.getNamespace(), "businessObjectDefinitionNames", manifest.getBusinessObjectDefinitionName(), "businessObjectFormatUsages", manifest.getBusinessObjectFormatUsage(), "businessObjectFormatFileTypes", manifest.getBusinessObjectFormatFileType(), "businessObjectFormatVersions", manifest.getBusinessObjectFormatVersion(), "partitionValues", manifest.getPartitionValue())) .setParameter("storageName", storageName); if (manifest.getSubPartitionValues() != null) { uriBuilder.setParameter("subPartitionValues", herdStringHelper.join(manifest.getSubPartitionValues(), "|", "\\")); } if (businessObjectDataVersion != null) { uriBuilder.setParameter("businessObjectDataVersion", businessObjectDataVersion.toString()); } if (createNewVersion != null) { uriBuilder.setParameter("createNewVersion", createNewVersion.toString()); } HttpGet httpGet = new HttpGet(uriBuilder.build()); httpGet.addHeader("Accepts", DEFAULT_ACCEPT); if (regServerAccessParamsDto.isUseSsl()) { httpGet.addHeader(getAuthorizationHeader()); } try (CloseableHttpClient httpClient = httpClientHelper .createHttpClient(regServerAccessParamsDto.isTrustSelfSignedCertificate(), regServerAccessParamsDto.isDisableHostnameVerification())) { LOGGER.info("Retrieving upload credentials from registration server..."); return getBusinessObjectDataUploadCredential(httpClientOperations.execute(httpClient, httpGet)); } }  BusinessObjectDataUploadCredential getBusinessObjectDataUploadCredential(DataBridgeBaseManifestDto manifest, String storageName,
        Integer businessObjectDataVersion, Boolean createNewVersion); BusinessObjectDataVersions getBusinessObjectDataVersions(BusinessObjectDataKey businessObjectDataKey); void updateBusinessObjectDataStatusIgnoreException(BusinessObjectDataKey businessObjectDataKey, String businessObjectDataStatus);  }
@Test public void testGetBusinessObjectDataUploadCredential1() throws Exception { DataBridgeBaseManifestDto manifest = new DataBridgeBaseManifestDto(); manifest.setNamespace("test1"); manifest.setBusinessObjectDefinitionName("test2"); manifest.setBusinessObjectFormatUsage("test3"); manifest.setBusinessObjectFormatFileType("test4"); manifest.setBusinessObjectFormatVersion("test5"); manifest.setPartitionValue("test6"); manifest.setSubPartitionValues(Arrays.asList("test7", "test8")); String storageName = "test8"; Integer businessObjectDataVersion = 1234; Boolean createNewVersion = false; uploaderWebClient.getRegServerAccessParamsDto().setUseSsl(false); BusinessObjectDataUploadCredential businessObjectDataUploadCredential = uploaderWebClient.getBusinessObjectDataUploadCredential(manifest, storageName, businessObjectDataVersion, createNewVersion); Assert.assertNotNull(businessObjectDataUploadCredential); AwsCredential awsCredential = businessObjectDataUploadCredential.getAwsCredential(); Assert.assertNotNull(awsCredential); Assert.assertEquals("http: "/businessObjectDefinitionNames/test2/businessObjectFormatUsages/test3/businessObjectFormatFileTypes/test4/businessObjectFormatVersions/test5" + "/partitionValues/test6?storageName=test8&subPartitionValues=test7%7Ctest8&businessObjectDataVersion=1234&createNewVersion=false", awsCredential.getAwsAccessKey()); }
@Test public void testGetBusinessObjectDataUploadCredential2() throws Exception { DataBridgeBaseManifestDto manifest = new DataBridgeBaseManifestDto(); manifest.setNamespace("test1"); manifest.setBusinessObjectDefinitionName("test2"); manifest.setBusinessObjectFormatUsage("test3"); manifest.setBusinessObjectFormatFileType("test4"); manifest.setBusinessObjectFormatVersion("test5"); manifest.setPartitionValue("test6"); String storageName = "test8"; Integer businessObjectDataVersion = 1234; Boolean createNewVersion = null; uploaderWebClient.getRegServerAccessParamsDto().setUseSsl(true); BusinessObjectDataUploadCredential businessObjectDataUploadCredential = uploaderWebClient.getBusinessObjectDataUploadCredential(manifest, storageName, businessObjectDataVersion, createNewVersion); Assert.assertNotNull(businessObjectDataUploadCredential); AwsCredential awsCredential = businessObjectDataUploadCredential.getAwsCredential(); Assert.assertNotNull(awsCredential); Assert.assertEquals("https: "/businessObjectDefinitionNames/test2/businessObjectFormatUsages/test3/businessObjectFormatFileTypes/test4/businessObjectFormatVersions/test5" + "/partitionValues/test6?storageName=test8&businessObjectDataVersion=1234", awsCredential.getAwsAccessKey()); }
@Test public void testGetBusinessObjectDataUploadCredential3() throws Exception { DataBridgeBaseManifestDto manifest = new DataBridgeBaseManifestDto(); manifest.setNamespace("test1"); manifest.setBusinessObjectDefinitionName("test2"); manifest.setBusinessObjectFormatUsage("test3"); manifest.setBusinessObjectFormatFileType("test4"); manifest.setBusinessObjectFormatVersion("test5"); manifest.setPartitionValue("test6"); manifest.setSubPartitionValues(Arrays.asList("test7", "test8")); String storageName = "test8"; Integer businessObjectDataVersion = null; Boolean createNewVersion = true; uploaderWebClient.getRegServerAccessParamsDto().setUseSsl(true); BusinessObjectDataUploadCredential businessObjectDataUploadCredential = uploaderWebClient.getBusinessObjectDataUploadCredential(manifest, storageName, businessObjectDataVersion, createNewVersion); Assert.assertNotNull(businessObjectDataUploadCredential); AwsCredential awsCredential = businessObjectDataUploadCredential.getAwsCredential(); Assert.assertNotNull(awsCredential); Assert.assertEquals("https: "/businessObjectDefinitionNames/test2/businessObjectFormatUsages/test3/businessObjectFormatFileTypes/test4/businessObjectFormatVersions/test5" + "/partitionValues/test6?storageName=test8&subPartitionValues=test7%7Ctest8&createNewVersion=true", awsCredential.getAwsAccessKey()); }