@Test public void testReadJsonManifestNoPartitionValue() throws Exception { DataBridgeBaseManifestDto dataBridgeBaseManifestDto = getDataBridgeBaseManifestDto(); dataBridgeBaseManifestDto.setPartitionValue(null); testReadJsonManifest(dataBridgeBaseManifestDto, "Manifest business object data partition value must be specified."); }
private DataBridgeBaseManifestDto getDataBridgeBaseManifestDto() { DataBridgeBaseManifestDto dataBridgeBaseManifestDto = new DataBridgeBaseManifestDto(); dataBridgeBaseManifestDto.setNamespace("testNamespace"); dataBridgeBaseManifestDto.setBusinessObjectDefinitionName("testBusinessObjectDefinitionName"); dataBridgeBaseManifestDto.setBusinessObjectFormatUsage("testBusinessObjectFormatUsage"); dataBridgeBaseManifestDto.setBusinessObjectFormatFileType("testBusinessObjectFormatFileType"); dataBridgeBaseManifestDto.setBusinessObjectFormatVersion("testBusinessObjectFormatVersion"); dataBridgeBaseManifestDto.setPartitionKey("testPartitionKey"); dataBridgeBaseManifestDto.setPartitionValue("testPartitionValue"); dataBridgeBaseManifestDto.setSubPartitionValues(Arrays.asList("testSubPartitionValue1", "testSubPartitionValue2")); return dataBridgeBaseManifestDto; }
/** * Retrieves S3 key prefix from the herd registration server. * * @param businessObjectData the business object data * * @return the S3 key prefix * @throws JAXBException if a JAXB error was encountered * @throws IOException if an I/O error was encountered * @throws URISyntaxException if a URI syntax error was encountered * @throws KeyStoreException if a key store exception occurs * @throws NoSuchAlgorithmException if a no such algorithm exception occurs * @throws KeyManagementException if key management exception */ public S3KeyPrefixInformation getS3KeyPrefix(BusinessObjectData businessObjectData) throws IOException, JAXBException, URISyntaxException, NoSuchAlgorithmException, KeyStoreException, KeyManagementException { DataBridgeBaseManifestDto dataBridgeBaseManifestDto = new DataBridgeBaseManifestDto(); dataBridgeBaseManifestDto.setNamespace(businessObjectData.getNamespace()); dataBridgeBaseManifestDto.setBusinessObjectDefinitionName(businessObjectData.getBusinessObjectDefinitionName()); dataBridgeBaseManifestDto.setBusinessObjectFormatUsage(businessObjectData.getBusinessObjectFormatUsage()); dataBridgeBaseManifestDto.setBusinessObjectFormatFileType(businessObjectData.getBusinessObjectFormatFileType()); dataBridgeBaseManifestDto.setBusinessObjectFormatVersion(String.valueOf(businessObjectData.getBusinessObjectFormatVersion())); dataBridgeBaseManifestDto.setPartitionKey(businessObjectData.getPartitionKey()); dataBridgeBaseManifestDto.setPartitionValue(businessObjectData.getPartitionValue()); dataBridgeBaseManifestDto.setSubPartitionValues(businessObjectData.getSubPartitionValues()); dataBridgeBaseManifestDto.setStorageName(businessObjectData.getStorageUnits().get(0).getStorage().getName()); return super.getS3KeyPrefix(dataBridgeBaseManifestDto, businessObjectData.getVersion(), Boolean.FALSE); }
@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://testWebServiceHostname:1234/herd-app/rest/businessObjectData/upload/credential/namespaces/test1" + "/businessObjectDefinitionNames/test2/businessObjectFormatUsages/test3/businessObjectFormatFileTypes/test4/businessObjectFormatVersions/test5" + "/partitionValues/test6?storageName=test8&subPartitionValues=test7%7Ctest8&businessObjectDataVersion=1234&createNewVersion=false", 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://testWebServiceHostname:1234/herd-app/rest/businessObjectData/upload/credential/namespaces/test1" + "/businessObjectDefinitionNames/test2/businessObjectFormatUsages/test3/businessObjectFormatFileTypes/test4/businessObjectFormatVersions/test5" + "/partitionValues/test6?storageName=test8&subPartitionValues=test7%7Ctest8&createNewVersion=true", 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://testWebServiceHostname:1234/herd-app/rest/businessObjectData/upload/credential/namespaces/test1" + "/businessObjectDefinitionNames/test2/businessObjectFormatUsages/test3/businessObjectFormatFileTypes/test4/businessObjectFormatVersions/test5" + "/partitionValues/test6?storageName=test8&businessObjectDataVersion=1234", awsCredential.getAwsAccessKey()); }