/** * Delegates implementation to {@link org.finra.herd.service.helper.BusinessObjectDataInvalidateUnregisteredHelper}. Keeps current transaction context. * * @param businessObjectDataInvalidateUnregisteredRequest {@link org.finra.herd.model.api.xml.BusinessObjectDataInvalidateUnregisteredRequest} * * @return {@link BusinessObjectDataInvalidateUnregisteredResponse} */ BusinessObjectDataInvalidateUnregisteredResponse invalidateUnregisteredBusinessObjectDataImpl( BusinessObjectDataInvalidateUnregisteredRequest businessObjectDataInvalidateUnregisteredRequest) { return businessObjectDataInvalidateUnregisteredHelper.invalidateUnregisteredBusinessObjectData(businessObjectDataInvalidateUnregisteredRequest); }
/** * Delegates implementation to {@link org.finra.herd.service.helper.BusinessObjectDataInvalidateUnregisteredHelper}. Keeps current transaction context. * * @param businessObjectDataInvalidateUnregisteredRequest {@link org.finra.herd.model.api.xml.BusinessObjectDataInvalidateUnregisteredRequest} * * @return {@link BusinessObjectDataInvalidateUnregisteredResponse} */ BusinessObjectDataInvalidateUnregisteredResponse invalidateUnregisteredBusinessObjectDataImpl( BusinessObjectDataInvalidateUnregisteredRequest businessObjectDataInvalidateUnregisteredRequest) { return businessObjectDataInvalidateUnregisteredHelper.invalidateUnregisteredBusinessObjectData(businessObjectDataInvalidateUnregisteredRequest); }
/** * Asserts that business object definition name requiredness validation is working. */ @Test public void testInvalidateUnregisteredBusinessObjectDataValidationBusinessObjectDefinitionNameRequired() { BusinessObjectDataInvalidateUnregisteredRequest request = new BusinessObjectDataInvalidateUnregisteredRequest(NAMESPACE, BLANK_TEXT, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, NO_SUBPARTITION_VALUES, StorageEntity.MANAGED_STORAGE); // Given a business object format try { businessObjectFormatServiceTestHelper.createBusinessObjectFormat(request); } catch (Exception e) { throw new IllegalArgumentException("Test failed during setup. Most likely setup or developer error.", e); } // Call the API try { businessObjectDataInvalidateUnregisteredHelper.invalidateUnregisteredBusinessObjectData(request); Assert.fail("expected a IllegalArgumentException, but no exception was thrown"); } catch (Exception e) { Assert.assertEquals("thrown exception type", IllegalArgumentException.class, e.getClass()); Assert.assertEquals("thrown exception message", "The business object definition name is required", e.getMessage()); } }
/** * If sub-partition values are given, they must not be blank. */ @Test public void testInvalidateUnregisteredBusinessObjectDataValidationSubPartitionValueNotBlank() { BusinessObjectDataInvalidateUnregisteredRequest request = new BusinessObjectDataInvalidateUnregisteredRequest(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, Arrays.asList(BLANK_TEXT), StorageEntity.MANAGED_STORAGE); // Given a business object format try { businessObjectFormatServiceTestHelper.createBusinessObjectFormat(request); } catch (Exception e) { throw new IllegalArgumentException("Test failed during setup. Most likely setup or developer error.", e); } // Call the API try { businessObjectDataInvalidateUnregisteredHelper.invalidateUnregisteredBusinessObjectData(request); Assert.fail("expected a IllegalArgumentException, but no exception was thrown"); } catch (Exception e) { Assert.assertEquals("thrown exception type", IllegalArgumentException.class, e.getClass()); Assert.assertEquals("thrown exception message", "The sub-partition value [0] must not be blank", e.getMessage()); } }
/** * Asserts that business object format file type requiredness validation is working. */ @Test public void testInvalidateUnregisteredBusinessObjectDataValidationBusinessObjectFormatFileTypeRequired() { BusinessObjectDataInvalidateUnregisteredRequest request = new BusinessObjectDataInvalidateUnregisteredRequest(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, BLANK_TEXT, FORMAT_VERSION, PARTITION_VALUE, NO_SUBPARTITION_VALUES, StorageEntity.MANAGED_STORAGE); // Given a business object format try { businessObjectFormatServiceTestHelper.createBusinessObjectFormat(request); } catch (Exception e) { throw new IllegalArgumentException("Test failed during setup. Most likely setup or developer error.", e); } // Call the API try { businessObjectDataInvalidateUnregisteredHelper.invalidateUnregisteredBusinessObjectData(request); Assert.fail("expected a IllegalArgumentException, but no exception was thrown"); } catch (Exception e) { Assert.assertEquals("thrown exception type", IllegalArgumentException.class, e.getClass()); Assert.assertEquals("thrown exception message", "The business object format file type is required", e.getMessage()); } }
/** * Asserts that storage name requiredness validation is working. */ @Test public void testInvalidateUnregisteredBusinessObjectDataValidationStorageNameRequired() { BusinessObjectDataInvalidateUnregisteredRequest request = new BusinessObjectDataInvalidateUnregisteredRequest(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, NO_SUBPARTITION_VALUES, BLANK_TEXT); // Given a business object format try { businessObjectFormatServiceTestHelper.createBusinessObjectFormat(request); } catch (Exception e) { throw new IllegalArgumentException("Test failed during setup. Most likely setup or developer error.", e); } // Call the API try { businessObjectDataInvalidateUnregisteredHelper.invalidateUnregisteredBusinessObjectData(request); Assert.fail("expected a IllegalArgumentException, but no exception was thrown"); } catch (Exception e) { Assert.assertEquals("thrown exception type", IllegalArgumentException.class, e.getClass()); Assert.assertEquals("thrown exception message", "The storage name is required", e.getMessage()); } }
/** * Asserts that business object format usage requiredness validation is working. */ @Test public void testInvalidateUnregisteredBusinessObjectDataValidationBusinessObjectFormatUsageRequired() { BusinessObjectDataInvalidateUnregisteredRequest request = new BusinessObjectDataInvalidateUnregisteredRequest(NAMESPACE, BDEF_NAME, BLANK_TEXT, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, NO_SUBPARTITION_VALUES, StorageEntity.MANAGED_STORAGE); // Given a business object format try { businessObjectFormatServiceTestHelper.createBusinessObjectFormat(request); } catch (Exception e) { throw new IllegalArgumentException("Test failed during setup. Most likely setup or developer error.", e); } // Call the API try { businessObjectDataInvalidateUnregisteredHelper.invalidateUnregisteredBusinessObjectData(request); Assert.fail("expected a IllegalArgumentException, but no exception was thrown"); } catch (Exception e) { Assert.assertEquals("thrown exception type", IllegalArgumentException.class, e.getClass()); Assert.assertEquals("thrown exception message", "The business object format usage is required", e.getMessage()); } }
/** * Asserts that business object format version positive validation is working. */ @Test public void testInvalidateUnregisteredBusinessObjectDataValidationBusinessObjectFormatVersionNegative() { BusinessObjectDataInvalidateUnregisteredRequest request = new BusinessObjectDataInvalidateUnregisteredRequest(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, -1, PARTITION_VALUE, NO_SUBPARTITION_VALUES, StorageEntity.MANAGED_STORAGE); // Given a business object format try { businessObjectFormatServiceTestHelper.createBusinessObjectFormat(request); } catch (Exception e) { throw new IllegalArgumentException("Test failed during setup. Most likely setup or developer error.", e); } // Call the API try { businessObjectDataInvalidateUnregisteredHelper.invalidateUnregisteredBusinessObjectData(request); Assert.fail("expected a IllegalArgumentException, but no exception was thrown"); } catch (Exception e) { Assert.assertEquals("thrown exception type", IllegalArgumentException.class, e.getClass()); Assert.assertEquals("thrown exception message", "The business object format version must be greater than or equal to 0", e.getMessage()); } }
/** * Asserts that partition value requiredness validation is working. */ @Test public void testInvalidateUnregisteredBusinessObjectDataValidationPartitionValueRequired() { BusinessObjectDataInvalidateUnregisteredRequest request = new BusinessObjectDataInvalidateUnregisteredRequest(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, BLANK_TEXT, NO_SUBPARTITION_VALUES, StorageEntity.MANAGED_STORAGE); // Given a business object format try { businessObjectFormatServiceTestHelper.createBusinessObjectFormat(request); } catch (Exception e) { throw new IllegalArgumentException("Test failed during setup. Most likely setup or developer error.", e); } // Call the API try { businessObjectDataInvalidateUnregisteredHelper.invalidateUnregisteredBusinessObjectData(request); Assert.fail("expected a IllegalArgumentException, but no exception was thrown"); } catch (Exception e) { Assert.assertEquals("thrown exception type", IllegalArgumentException.class, e.getClass()); Assert.assertEquals("thrown exception message", "The partition value is required", e.getMessage()); } }
/** * Storage must exist for this API to work. */ @Test public void testInvalidateUnregisteredBusinessObjectDataValidationStorageMustExist() { BusinessObjectDataInvalidateUnregisteredRequest request = new BusinessObjectDataInvalidateUnregisteredRequest(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, NO_SUBPARTITION_VALUES, "DOES_NOT_EXIST"); // Given a business object format try { businessObjectFormatServiceTestHelper.createBusinessObjectFormat(request); } catch (Exception e) { throw new IllegalArgumentException("Test failed during setup. Most likely setup or developer error.", e); } // Call the API try { businessObjectDataInvalidateUnregisteredHelper.invalidateUnregisteredBusinessObjectData(request); Assert.fail("expected a ObjectNotFoundException, but no exception was thrown"); } catch (Exception e) { Assert.assertEquals("thrown exception type", ObjectNotFoundException.class, e.getClass()); Assert.assertEquals("thrown exception message", "Storage with name \"" + request.getStorageName() + "\" doesn't exist.", e.getMessage()); } }
businessObjectDataInvalidateUnregisteredHelper.invalidateUnregisteredBusinessObjectData(request); Assert.fail("expected a IllegalArgumentException, but no exception was thrown");
businessObjectDataInvalidateUnregisteredHelper.invalidateUnregisteredBusinessObjectData(request); Assert.fail("expected a IllegalArgumentException, but no exception was thrown");
businessObjectDataInvalidateUnregisteredHelper.invalidateUnregisteredBusinessObjectData(request); Assert.fail("expected a IllegalArgumentException, but no exception was thrown");
/** * Test case where S3 has 1 object, and herd has no object registered. The S3 object is registered under version 1 so there is a gap for version 0 of * registration. Expects no new registrations since the API does not consider the S3 objects after a gap. */ @Test public void testInvalidateUnregisteredBusinessObjectDataS31Herd0WithGap() { BusinessObjectDataInvalidateUnregisteredRequest request = new BusinessObjectDataInvalidateUnregisteredRequest(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, SUBPARTITION_VALUES, StorageEntity.MANAGED_STORAGE); // Given a business object format // Given an object in S3 BusinessObjectFormatEntity businessObjectFormatEntity; try { businessObjectFormatEntity = businessObjectFormatServiceTestHelper.createBusinessObjectFormat(request); businessObjectDataServiceTestHelper.createS3Object(businessObjectFormatEntity, request, 1); } catch (Exception e) { throw new IllegalArgumentException("Test failed during setup. Most likely setup or developer error.", e); } // Call API BusinessObjectDataInvalidateUnregisteredResponse actualResponse = businessObjectDataInvalidateUnregisteredHelper.invalidateUnregisteredBusinessObjectData(request); // Make assertions Assert.assertNotNull("response business object datas is null", actualResponse.getRegisteredBusinessObjectDataList()); Assert.assertEquals("response business object datas size", 0, actualResponse.getRegisteredBusinessObjectDataList().size()); }
/** * Test case where herd and S3 are in sync because both have 1 object registered. Expects no new data registration. */ @Test public void testInvalidateUnregisteredBusinessObjectDataS31Herd1() throws Exception { BusinessObjectDataInvalidateUnregisteredRequest request = new BusinessObjectDataInvalidateUnregisteredRequest(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, PARTITION_VALUE, NO_SUBPARTITION_VALUES, StorageEntity.MANAGED_STORAGE); // Given a business object format try { BusinessObjectFormatEntity businessObjectFormatEntity = businessObjectFormatServiceTestHelper.createBusinessObjectFormat(request); businessObjectDataServiceTestHelper.createS3Object(businessObjectFormatEntity, request, 0); createBusinessObjectDataEntityFromBusinessObjectDataInvalidateUnregisteredRequest(businessObjectFormatEntity, request, 0, true); } catch (Exception e) { throw new IllegalArgumentException("Test failed during setup. Most likely setup or developer error.", e); } // Call the API BusinessObjectDataInvalidateUnregisteredResponse actualResponse = businessObjectDataInvalidateUnregisteredHelper.invalidateUnregisteredBusinessObjectData(request); // Make assertions Assert.assertNotNull("response business object datas is null", actualResponse.getRegisteredBusinessObjectDataList()); Assert.assertEquals("response business object datas size", 0, actualResponse.getRegisteredBusinessObjectDataList().size()); }
businessObjectDataInvalidateUnregisteredHelper.invalidateUnregisteredBusinessObjectData(request);
businessObjectDataInvalidateUnregisteredHelper.invalidateUnregisteredBusinessObjectData(request); Assert.fail("expected a ObjectNotFoundException, but no exception was thrown");
businessObjectDataInvalidateUnregisteredHelper.invalidateUnregisteredBusinessObjectData(request);
businessObjectDataInvalidateUnregisteredHelper.invalidateUnregisteredBusinessObjectData(request);
businessObjectDataInvalidateUnregisteredHelper.invalidateUnregisteredBusinessObjectData(request);