@Test public void testInitiateUploadSingle() { // Create database entities required for testing. uploadDownloadServiceTestHelper.createDatabaseEntitiesForUploadDownloadTesting(); // Initiate a file upload. UploadSingleInitiationResponse resultUploadSingleInitiationResponse = uploadDownloadService.initiateUploadSingle(uploadDownloadServiceTestHelper.createUploadSingleInitiationRequest()); // Validate the returned object. uploadDownloadServiceTestHelper .validateUploadSingleInitiationResponse(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, NAMESPACE, BDEF_NAME_2, FORMAT_USAGE_CODE_2, FORMAT_FILE_TYPE_CODE_2, FORMAT_VERSION_2, businessObjectDefinitionServiceTestHelper.getNewAttributes(), FILE_NAME, FILE_SIZE_1_KB, null, resultUploadSingleInitiationResponse); }
@Test public void testInitiateDownloadSingle() { // Create the upload data. UploadSingleInitiationResponse uploadSingleInitiationResponse = uploadDownloadServiceTestHelper.createUploadedFileData(BusinessObjectDataStatusEntity.VALID); // Initiate the download against the uploaded data (i.e. the target business object data). DownloadSingleInitiationResponse downloadSingleInitiationResponse = initiateDownload(uploadSingleInitiationResponse.getTargetBusinessObjectData()); // Validate the download initiation response. uploadDownloadServiceTestHelper.validateDownloadSingleInitiationResponse(uploadSingleInitiationResponse, downloadSingleInitiationResponse); }
@Test public void testInitiateUploadSingleDuplicateAttributes() { // Create database entities required for testing. uploadDownloadServiceTestHelper.createDatabaseEntitiesForUploadDownloadTesting(); // Try to initiate a single file upload when duplicate attributes are specified. UploadSingleInitiationRequest request = uploadDownloadServiceTestHelper.createUploadSingleInitiationRequest(); request.setBusinessObjectDataAttributes(Arrays.asList(new Attribute(ATTRIBUTE_NAME_3_MIXED_CASE.toLowerCase(), ATTRIBUTE_VALUE_3), new Attribute(ATTRIBUTE_NAME_3_MIXED_CASE.toUpperCase(), ATTRIBUTE_VALUE_3))); try { uploadDownloadService.initiateUploadSingle(request); fail("Should throw an IllegalArgumentException when duplicate attributes are specified."); } catch (IllegalArgumentException e) { assertEquals(String.format("Duplicate attribute name found: %s", ATTRIBUTE_NAME_3_MIXED_CASE.toUpperCase()), e.getMessage()); } }
@Test public void testExtendUploadSingleCredentialsBusinessObjectDataStatusNotValid() { // Create the upload data. This internally calls "complete" which sets the source business object data's status to "DELETED". // This is a status where credentials can't be extended (i.e. only UPLOADING statuses). UploadSingleInitiationResponse uploadSingleInitiationResponse = uploadDownloadServiceTestHelper.createUploadedFileData(BusinessObjectDataStatusEntity.VALID); // Try to extend the upload credentials of a source business object data with an invalid status of "DELETED". try { extendUploadSingleCredentials(uploadSingleInitiationResponse.getSourceBusinessObjectData()); fail("Suppose to throw an IllegalArgumentException when business object data is not in VALID status."); } catch (IllegalArgumentException e) { BusinessObjectData businessObjectData = uploadSingleInitiationResponse.getSourceBusinessObjectData(); assertEquals(String.format("Business object data {%s} has a status of \"%s\" and must be \"%s\" to extend credentials.", businessObjectDataServiceTestHelper .getExpectedBusinessObjectDataKeyAsString(businessObjectData.getNamespace(), businessObjectData.getBusinessObjectDefinitionName(), businessObjectData.getBusinessObjectFormatUsage(), businessObjectData.getBusinessObjectFormatFileType(), businessObjectData.getBusinessObjectFormatVersion(), businessObjectData.getPartitionValue(), NO_SUBPARTITION_VALUES, businessObjectData.getVersion()), BusinessObjectDataStatusEntity.DELETED, BusinessObjectDataStatusEntity.UPLOADING), e.getMessage()); } }
/** * Creates a upload single initiation request. * * @return the newly created upload single initiation request */ public UploadSingleInitiationRequest createUploadSingleInitiationRequest() { return createUploadSingleInitiationRequest(AbstractServiceTest.NAMESPACE, AbstractServiceTest.BDEF_NAME, AbstractServiceTest.FORMAT_USAGE_CODE, AbstractServiceTest.FORMAT_FILE_TYPE_CODE, AbstractServiceTest.FORMAT_VERSION, AbstractServiceTest.NAMESPACE, AbstractServiceTest.BDEF_NAME_2, AbstractServiceTest.FORMAT_USAGE_CODE_2, AbstractServiceTest.FORMAT_FILE_TYPE_CODE_2, AbstractServiceTest.FORMAT_VERSION_2, AbstractServiceTest.FILE_NAME); }
/** * Create and persist database entities required for upload download testing. */ public void createDatabaseEntitiesForUploadDownloadTesting() { createDatabaseEntitiesForUploadDownloadTesting(AbstractServiceTest.NAMESPACE, AbstractServiceTest.BDEF_NAME, AbstractServiceTest.FORMAT_USAGE_CODE, AbstractServiceTest.FORMAT_FILE_TYPE_CODE, AbstractServiceTest.FORMAT_VERSION); createDatabaseEntitiesForUploadDownloadTesting(AbstractServiceTest.NAMESPACE, AbstractServiceTest.BDEF_NAME_2, AbstractServiceTest.FORMAT_USAGE_CODE_2, AbstractServiceTest.FORMAT_FILE_TYPE_CODE_2, AbstractServiceTest.FORMAT_VERSION_2); }
/** * Validates a download single initiation response as compared to the upload initiation response. * * @param uploadSingleInitiationResponse the upload single initiation response. * @param downloadSingleInitiationResponse the download single initiation response. */ public void validateDownloadSingleInitiationResponse(UploadSingleInitiationResponse uploadSingleInitiationResponse, DownloadSingleInitiationResponse downloadSingleInitiationResponse) { BusinessObjectData targetBusinessObjectData = uploadSingleInitiationResponse.getTargetBusinessObjectData(); validateDownloadSingleInitiationResponse(targetBusinessObjectData.getNamespace(), targetBusinessObjectData.getBusinessObjectDefinitionName(), targetBusinessObjectData.getBusinessObjectFormatUsage(), targetBusinessObjectData.getBusinessObjectFormatFileType(), targetBusinessObjectData.getBusinessObjectFormatVersion(), targetBusinessObjectData.getAttributes(), targetBusinessObjectData.getStorageUnits().get(0).getStorageFiles().get(0).getFileSizeBytes(), downloadSingleInitiationResponse); }
@Test public void testInitiateUploadSingleRequiredAttributeMissingValue() { // Create database entities required for testing. uploadDownloadServiceTestHelper.createDatabaseEntitiesForUploadDownloadTesting(); // Create and persist a business object data attribute definition entity. businessObjectFormatDaoTestHelper .createBusinessObjectDataAttributeDefinitionEntity(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, ATTRIBUTE_NAME_1_MIXED_CASE); // Try to initiate a single file upload when a required attribute value is not specified. UploadSingleInitiationRequest request = uploadDownloadServiceTestHelper.createUploadSingleInitiationRequest(); request.setBusinessObjectDataAttributes(Lists.newArrayList(new Attribute(ATTRIBUTE_NAME_1_MIXED_CASE, BLANK_TEXT))); try { uploadDownloadService.initiateUploadSingle(request); fail("Should throw an IllegalArgumentException when required attribute value is not specified."); } catch (IllegalArgumentException e) { assertEquals(String.format("The business object format has a required attribute \"%s\" which was not specified or has a value which is blank.", ATTRIBUTE_NAME_1_MIXED_CASE), e.getMessage()); } }
@Test public void testInitiateDownloadSingleMultipleStorageFilesExist() { // Create the upload data. UploadSingleInitiationResponse uploadSingleInitiationResponse = uploadDownloadServiceTestHelper.createUploadedFileData(BusinessObjectDataStatusEntity.VALID); // Get the target business object data entity. BusinessObjectDataEntity targetBusinessObjectDataEntity = businessObjectDataDao .getBusinessObjectDataByAltKey(businessObjectDataHelper.getBusinessObjectDataKey(uploadSingleInitiationResponse.getTargetBusinessObjectData())); // Get the target bushiness object data storage unit. StorageUnitEntity targetStorageUnitEntity = IterableUtils.get(targetBusinessObjectDataEntity.getStorageUnits(), 0); // Add a second storage file to the target business object data storage unit. storageFileDaoTestHelper.createStorageFileEntity(targetStorageUnitEntity, FILE_NAME_2, FILE_SIZE_1_KB, ROW_COUNT_1000); // Try to initiate a single file download when business object data has more than one storage file. try { // Initiate the download against the uploaded data (i.e. the target business object data). initiateDownload(uploadSingleInitiationResponse.getTargetBusinessObjectData()); fail("Suppose to throw an IllegalArgumentException when business object has more than one storage file."); } catch (IllegalArgumentException e) { BusinessObjectData businessObjectData = uploadSingleInitiationResponse.getTargetBusinessObjectData(); assertEquals(String.format("Found 2 registered storage files when expecting one in \"%s\" storage for the business object data {%s}.", targetStorageUnitEntity.getStorage().getName(), businessObjectDataServiceTestHelper .getExpectedBusinessObjectDataKeyAsString(businessObjectDataHelper.getBusinessObjectDataKey(businessObjectData))), e.getMessage()); } }
/** * Creates a upload single initiation request. * * @param sourceNamespaceCode the source namespace code * @param sourceBusinessObjectDefinitionName the source business object definition name * @param sourceBusinessObjectFormatUsage the source business object usage * @param sourceBusinessObjectFormatFileType the source business object format file type * @param sourceBusinessObjectFormatVersion the source business object format version * @param targetNamespaceCode the target namespace code * @param targetBusinessObjectDefinitionName the target business object definition name * @param targetBusinessObjectFormatUsage the target business object usage * @param targetBusinessObjectFormatFileType the target business object format file type * @param targetBusinessObjectFormatVersion the target business object format version * * @return the newly created upload single initiation request */ public UploadSingleInitiationRequest createUploadSingleInitiationRequest(String sourceNamespaceCode, String sourceBusinessObjectDefinitionName, String sourceBusinessObjectFormatUsage, String sourceBusinessObjectFormatFileType, Integer sourceBusinessObjectFormatVersion, String targetNamespaceCode, String targetBusinessObjectDefinitionName, String targetBusinessObjectFormatUsage, String targetBusinessObjectFormatFileType, Integer targetBusinessObjectFormatVersion) { return createUploadSingleInitiationRequest(sourceNamespaceCode, sourceBusinessObjectDefinitionName, sourceBusinessObjectFormatUsage, sourceBusinessObjectFormatFileType, sourceBusinessObjectFormatVersion, targetNamespaceCode, targetBusinessObjectDefinitionName, targetBusinessObjectFormatUsage, targetBusinessObjectFormatFileType, targetBusinessObjectFormatVersion, AbstractServiceTest.FILE_NAME); }
@Test public void testInitiateUploadSingleLowerCaseParameters() { // Create database entities required for testing. uploadDownloadServiceTestHelper.createDatabaseEntitiesForUploadDownloadTesting(); // Initiate a file upload using upper case values. UploadSingleInitiationResponse resultUploadSingleInitiationResponse = uploadDownloadService.initiateUploadSingle(uploadDownloadServiceTestHelper .createUploadSingleInitiationRequest(NAMESPACE.toUpperCase(), BDEF_NAME.toUpperCase(), FORMAT_USAGE_CODE.toUpperCase(), FORMAT_FILE_TYPE_CODE.toUpperCase(), FORMAT_VERSION, NAMESPACE.toUpperCase(), BDEF_NAME_2.toUpperCase(), FORMAT_USAGE_CODE_2.toUpperCase(), FORMAT_FILE_TYPE_CODE_2.toUpperCase(), FORMAT_VERSION_2)); // Validate the returned object. uploadDownloadServiceTestHelper .validateUploadSingleInitiationResponse(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, NAMESPACE, BDEF_NAME_2, FORMAT_USAGE_CODE_2, FORMAT_FILE_TYPE_CODE_2, FORMAT_VERSION_2, businessObjectDefinitionServiceTestHelper.getNewAttributes(), FILE_NAME, FILE_SIZE_1_KB, null, resultUploadSingleInitiationResponse); }
@Test public void testS3Message() throws Exception { setLogLevel(UploadDownloadHelperServiceImpl.class, LogLevel.OFF); uploadDownloadServiceTestHelper.createDatabaseEntitiesForUploadDownloadTesting(); UploadSingleInitiationResponse resultUploadSingleInitiationResponse = uploadDownloadService.initiateUploadSingle(uploadDownloadServiceTestHelper.createUploadSingleInitiationRequest()); String filePath = resultUploadSingleInitiationResponse.getSourceBusinessObjectData().getStorageUnits().get(0).getStorageFiles().get(0).getFilePath(); S3Entity s3Entity = new S3Entity(null, null, new S3ObjectEntity(filePath, 0L, null, null), null); List<S3EventNotificationRecord> records = new ArrayList<>(); records.add(new S3EventNotificationRecord(null, null, null, null, null, null, null, s3Entity, null)); S3EventNotification s3EventNotification = new S3EventNotification(records); setLogLevel(UploadDownloadServiceImpl.class, LogLevel.OFF); setLogLevel(HerdJmsMessageListener.class, LogLevel.DEBUG); herdJmsMessageListener.processMessage(jsonHelper.objectToJson(s3EventNotification), null); }
@Test public void testInitiateDownloadSingleBusinessObjectDataStatusNotValid() { // Create the upload data, but leave the target business object data in a "RE-ENCRYPTING" status. UploadSingleInitiationResponse uploadSingleInitiationResponse = uploadDownloadServiceTestHelper.createUploadedFileData(BusinessObjectDataStatusEntity.RE_ENCRYPTING); // Try to initiate a single file download when the business object data is not set to "VALID" which is invalid. try { // Initiate the download against the uploaded data (i.e. the target business object data). initiateDownload(uploadSingleInitiationResponse.getTargetBusinessObjectData()); fail("Suppose to throw an IllegalArgumentException when business object data is not in VALID status."); } catch (IllegalArgumentException e) { BusinessObjectData businessObjectData = uploadSingleInitiationResponse.getTargetBusinessObjectData(); assertEquals(String.format("Business object data status \"%s\" does not match the expected status \"%s\" for the business object data {%s}.", uploadSingleInitiationResponse.getTargetBusinessObjectData().getStatus(), BusinessObjectDataStatusEntity.VALID, businessObjectDataServiceTestHelper .getExpectedBusinessObjectDataKeyAsString(businessObjectData.getNamespace(), businessObjectData.getBusinessObjectDefinitionName(), businessObjectData.getBusinessObjectFormatUsage(), businessObjectData.getBusinessObjectFormatFileType(), businessObjectData.getBusinessObjectFormatVersion(), businessObjectData.getPartitionValue(), businessObjectData.getSubPartitionValues(), businessObjectData.getVersion())), e.getMessage()); } }
request = uploadDownloadServiceTestHelper.createUploadSingleInitiationRequest(); request.setSourceBusinessObjectFormatKey(null); try request = uploadDownloadServiceTestHelper.createUploadSingleInitiationRequest(); request.getSourceBusinessObjectFormatKey().setNamespace(BLANK_TEXT); request = uploadDownloadServiceTestHelper.createUploadSingleInitiationRequest(); request.getSourceBusinessObjectFormatKey().setBusinessObjectDefinitionName(BLANK_TEXT); request = uploadDownloadServiceTestHelper.createUploadSingleInitiationRequest(); request.getSourceBusinessObjectFormatKey().setBusinessObjectFormatUsage(BLANK_TEXT); request = uploadDownloadServiceTestHelper.createUploadSingleInitiationRequest(); request.getSourceBusinessObjectFormatKey().setBusinessObjectFormatFileType(BLANK_TEXT); request = uploadDownloadServiceTestHelper.createUploadSingleInitiationRequest(); request.getSourceBusinessObjectFormatKey().setBusinessObjectFormatVersion(null); request = uploadDownloadServiceTestHelper.createUploadSingleInitiationRequest(); request.setTargetBusinessObjectFormatKey(null); try request = uploadDownloadServiceTestHelper.createUploadSingleInitiationRequest(); request.getTargetBusinessObjectFormatKey().setNamespace(BLANK_TEXT); request = uploadDownloadServiceTestHelper.createUploadSingleInitiationRequest(); request.getTargetBusinessObjectFormatKey().setBusinessObjectDefinitionName(BLANK_TEXT);
@Test public void testInitiateUploadSingleUpperCaseParameters() { // Create database entities required for testing. uploadDownloadServiceTestHelper.createDatabaseEntitiesForUploadDownloadTesting(); // Initiate a file upload using lower case values. UploadSingleInitiationResponse resultUploadSingleInitiationResponse = uploadDownloadService.initiateUploadSingle(uploadDownloadServiceTestHelper .createUploadSingleInitiationRequest(NAMESPACE.toLowerCase(), BDEF_NAME.toLowerCase(), FORMAT_USAGE_CODE.toLowerCase(), FORMAT_FILE_TYPE_CODE.toLowerCase(), FORMAT_VERSION, NAMESPACE.toLowerCase(), BDEF_NAME_2.toLowerCase(), FORMAT_USAGE_CODE_2.toLowerCase(), FORMAT_FILE_TYPE_CODE_2.toLowerCase(), FORMAT_VERSION_2)); // Validate the returned object. uploadDownloadServiceTestHelper .validateUploadSingleInitiationResponse(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, NAMESPACE, BDEF_NAME_2, FORMAT_USAGE_CODE_2, FORMAT_FILE_TYPE_CODE_2, FORMAT_VERSION_2, businessObjectDefinitionServiceTestHelper.getNewAttributes(), FILE_NAME, FILE_SIZE_1_KB, null, resultUploadSingleInitiationResponse); }
@Test public void testExtendUploadSingleCredentials() throws InterruptedException { // Create source and target business object formats database entities which are required to initiate an upload. uploadDownloadServiceTestHelper.createDatabaseEntitiesForUploadDownloadTesting(); // Initiate a file upload. UploadSingleInitiationResponse uploadSingleInitiationResponse = uploadDownloadService.initiateUploadSingle(uploadDownloadServiceTestHelper.createUploadSingleInitiationRequest()); // Sleep a short amount of time to ensure the extended credentials don't return the same expiration as the initial credentials. Thread.sleep(10); // Initiate the download against the uploaded data (i.e. the target business object data). UploadSingleCredentialExtensionResponse uploadSingleCredentialExtensionResponse = extendUploadSingleCredentials(uploadSingleInitiationResponse.getSourceBusinessObjectData()); // Validate the returned object. assertNotNull(uploadSingleCredentialExtensionResponse.getAwsAccessKey()); assertNotNull(uploadSingleCredentialExtensionResponse.getAwsSecretKey()); assertNotNull(uploadSingleCredentialExtensionResponse.getAwsSessionToken()); assertNotNull(uploadSingleCredentialExtensionResponse.getAwsSessionExpirationTime()); assertNotNull(uploadSingleInitiationResponse.getAwsSessionExpirationTime()); // Ensure the extended credentials are greater than the original set of credentials. // We are displaying the values in case there is a problem because this test was acting flaky. if (uploadSingleCredentialExtensionResponse.getAwsSessionExpirationTime().toGregorianCalendar().getTimeInMillis() <= uploadSingleInitiationResponse.getAwsSessionExpirationTime().toGregorianCalendar().getTimeInMillis()) { fail("Initial expiration time \"" + uploadSingleInitiationResponse.getAwsSessionExpirationTime().toGregorianCalendar().getTimeInMillis() + "\" is not > extended expiration time \"" + uploadSingleCredentialExtensionResponse.getAwsSessionExpirationTime().toGregorianCalendar().getTimeInMillis() + "\"."); } }
@Test public void testExtendUploadSingleCredentialsBusinessObjectDataNoExists() { String INVALID_PARTITION_VALUE = "DOES_NOT_EXIST"; // Create the upload data. UploadSingleInitiationResponse uploadSingleInitiationResponse = uploadDownloadServiceTestHelper.createUploadedFileData(BusinessObjectDataStatusEntity.VALID); // Change the source business object data partition value to something invalid. uploadSingleInitiationResponse.getSourceBusinessObjectData().setPartitionValue(INVALID_PARTITION_VALUE); // Try to initiate a single file download when business object data does not exist (i.e. the partition value doesn't match). try { extendUploadSingleCredentials(uploadSingleInitiationResponse.getSourceBusinessObjectData()); fail("Suppose to throw an ObjectNotFoundException when business object data does not exist."); } catch (ObjectNotFoundException e) { BusinessObjectData businessObjectData = uploadSingleInitiationResponse.getSourceBusinessObjectData(); assertEquals(businessObjectDataServiceTestHelper .getExpectedBusinessObjectDataNotFoundErrorMessage(businessObjectData.getNamespace(), businessObjectData.getBusinessObjectDefinitionName(), businessObjectData.getBusinessObjectFormatUsage(), businessObjectData.getBusinessObjectFormatFileType(), businessObjectData.getBusinessObjectFormatVersion(), INVALID_PARTITION_VALUE, NO_SUBPARTITION_VALUES, businessObjectData.getVersion(), null), e.getMessage()); } }
@Test public void testInitiateUploadSingleRequiredAttribute() { // Create database entities required for testing. uploadDownloadServiceTestHelper.createDatabaseEntitiesForUploadDownloadTesting(); // Create and persist a business object data attribute definition entity. businessObjectFormatDaoTestHelper .createBusinessObjectDataAttributeDefinitionEntity(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, ATTRIBUTE_NAME_1_MIXED_CASE); // Initiate a file upload. UploadSingleInitiationResponse resultUploadSingleInitiationResponse = uploadDownloadService.initiateUploadSingle(uploadDownloadServiceTestHelper.createUploadSingleInitiationRequest()); // Validate the returned object. uploadDownloadServiceTestHelper .validateUploadSingleInitiationResponse(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, NAMESPACE, BDEF_NAME_2, FORMAT_USAGE_CODE_2, FORMAT_FILE_TYPE_CODE_2, FORMAT_VERSION_2, businessObjectDefinitionServiceTestHelper.getNewAttributes(), FILE_NAME, FILE_SIZE_1_KB, null, resultUploadSingleInitiationResponse); }
@Test public void testS3MessageS3FileNoExists() throws Exception { setLogLevel(UploadDownloadHelperServiceImpl.class, LogLevel.OFF); uploadDownloadServiceTestHelper.createDatabaseEntitiesForUploadDownloadTesting(); UploadSingleInitiationResponse resultUploadSingleInitiationResponse = uploadDownloadService.initiateUploadSingle(uploadDownloadServiceTestHelper .createUploadSingleInitiationRequest(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, NAMESPACE, BDEF_NAME_2, FORMAT_USAGE_CODE_2, FORMAT_FILE_TYPE_CODE_2, FORMAT_VERSION_2, TARGET_S3_KEY)); String filePath = resultUploadSingleInitiationResponse.getSourceBusinessObjectData().getStorageUnits().get(0).getStorageFiles().get(0).getFilePath(); S3Entity s3Entity = new S3Entity(null, null, new S3ObjectEntity(filePath, 0L, null, null), null); List<S3EventNotificationRecord> records = new ArrayList<>(); records.add(new S3EventNotificationRecord(null, null, null, null, null, null, null, s3Entity, null)); S3EventNotification s3EventNotification = new S3EventNotification(records); setLogLevel(UploadDownloadServiceImpl.class, LogLevel.OFF); setLogLevel(HerdJmsMessageListener.class, LogLevel.OFF); // Try to process an S3 JMS message, when source S3 file does not exist. herdJmsMessageListener.processMessage(jsonHelper.objectToJson(s3EventNotification), null); }
@Test public void testInitiateDownloadSingleBusinessObjectDataNoExists() { String INVALID_PARTITION_VALUE = "DOES_NOT_EXIST"; // Create the upload data. UploadSingleInitiationResponse uploadSingleInitiationResponse = uploadDownloadServiceTestHelper.createUploadedFileData(BusinessObjectDataStatusEntity.VALID); // Change the target business object data partition value to something invalid. uploadSingleInitiationResponse.getTargetBusinessObjectData().setPartitionValue(INVALID_PARTITION_VALUE); // Try to initiate a single file download when business object data does not exist (i.e. the partition value doesn't match). try { // Initiate the download against the uploaded data (i.e. the target business object data). initiateDownload(uploadSingleInitiationResponse.getTargetBusinessObjectData()); fail("Suppose to throw an ObjectNotFoundException when business object data does not exist."); } catch (ObjectNotFoundException e) { BusinessObjectData businessObjectData = uploadSingleInitiationResponse.getTargetBusinessObjectData(); assertEquals(businessObjectDataServiceTestHelper .getExpectedBusinessObjectDataNotFoundErrorMessage(businessObjectData.getNamespace(), businessObjectData.getBusinessObjectDefinitionName(), businessObjectData.getBusinessObjectFormatUsage(), businessObjectData.getBusinessObjectFormatFileType(), businessObjectData.getBusinessObjectFormatVersion(), INVALID_PARTITION_VALUE, NO_SUBPARTITION_VALUES, businessObjectData.getVersion(), null), e.getMessage()); } }