/** * Creates a new storage policy. * <p>Requires WRITE permission on storage policy namespace and storage policy filter namespace</p> * * @param request the information needed to create the storage policy * * @return the created storage policy */ @RequestMapping(value = STORAGE_POLICIES_URI_PREFIX, method = RequestMethod.POST, consumes = {"application/xml", "application/json"}) @Secured(SecurityFunctions.FN_STORAGE_POLICIES_POST) public StoragePolicy createStoragePolicy(@RequestBody StoragePolicyCreateRequest request) { return storagePolicyService.createStoragePolicy(request); }
/** * Creates a new storage policy. * <p>Requires WRITE permission on storage policy namespace and storage policy filter namespace</p> * * @param request the information needed to create the storage policy * * @return the created storage policy */ @RequestMapping(value = STORAGE_POLICIES_URI_PREFIX, method = RequestMethod.POST, consumes = {"application/xml", "application/json"}) @Secured(SecurityFunctions.FN_STORAGE_POLICIES_POST) public StoragePolicy createStoragePolicy(@RequestBody StoragePolicyCreateRequest request) { return storagePolicyService.createStoragePolicy(request); }
@Test public void testCreateStoragePolicyUpperCaseParameters() { // Create and persist the relative database entities. storagePolicyServiceTestHelper.createDatabaseEntitiesForStoragePolicyTesting(); // Create a storage policy using upper case input parameters. StoragePolicy resultStoragePolicy = storagePolicyService.createStoragePolicy(storagePolicyServiceTestHelper .createStoragePolicyCreateRequest(new StoragePolicyKey(STORAGE_POLICY_NAMESPACE_CD.toUpperCase(), STORAGE_POLICY_NAME.toUpperCase()), STORAGE_POLICY_RULE_TYPE.toUpperCase(), STORAGE_POLICY_RULE_VALUE, BDEF_NAMESPACE.toUpperCase(), BDEF_NAME.toUpperCase(), FORMAT_USAGE_CODE.toUpperCase(), FORMAT_FILE_TYPE_CODE.toUpperCase(), STORAGE_NAME.toUpperCase(), STORAGE_POLICY_TRANSITION_TYPE.toUpperCase(), StoragePolicyStatusEntity.ENABLED.toUpperCase())); // Validate the returned object. assertEquals(new StoragePolicy(resultStoragePolicy.getId(), new StoragePolicyKey(STORAGE_POLICY_NAMESPACE_CD, STORAGE_POLICY_NAME.toUpperCase()), new StoragePolicyRule(STORAGE_POLICY_RULE_TYPE, STORAGE_POLICY_RULE_VALUE), new StoragePolicyFilter(BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE.toUpperCase(), FORMAT_FILE_TYPE_CODE, STORAGE_NAME), new StoragePolicyTransition(STORAGE_POLICY_TRANSITION_TYPE), StoragePolicyStatusEntity.ENABLED), resultStoragePolicy); }
@Test public void testCreateStoragePolicyLowerCaseParameters() { // Create and persist the relative database entities. storagePolicyServiceTestHelper.createDatabaseEntitiesForStoragePolicyTesting(); // Create a storage policy using lower case input parameters. StoragePolicy resultStoragePolicy = storagePolicyService.createStoragePolicy(storagePolicyServiceTestHelper .createStoragePolicyCreateRequest(new StoragePolicyKey(STORAGE_POLICY_NAMESPACE_CD.toLowerCase(), STORAGE_POLICY_NAME.toLowerCase()), STORAGE_POLICY_RULE_TYPE.toLowerCase(), STORAGE_POLICY_RULE_VALUE, BDEF_NAMESPACE.toLowerCase(), BDEF_NAME.toLowerCase(), FORMAT_USAGE_CODE.toLowerCase(), FORMAT_FILE_TYPE_CODE.toLowerCase(), STORAGE_NAME.toLowerCase(), STORAGE_POLICY_TRANSITION_TYPE.toLowerCase(), StoragePolicyStatusEntity.ENABLED.toLowerCase())); // Validate the returned object. assertEquals(new StoragePolicy(resultStoragePolicy.getId(), new StoragePolicyKey(STORAGE_POLICY_NAMESPACE_CD, STORAGE_POLICY_NAME.toLowerCase()), new StoragePolicyRule(STORAGE_POLICY_RULE_TYPE, STORAGE_POLICY_RULE_VALUE), new StoragePolicyFilter(BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE.toLowerCase(), FORMAT_FILE_TYPE_CODE, STORAGE_NAME), new StoragePolicyTransition(STORAGE_POLICY_TRANSITION_TYPE), StoragePolicyStatusEntity.ENABLED), resultStoragePolicy); }
@Test public void testCreateStoragePolicy() { // Create a storage policy key. StoragePolicyKey storagePolicyKey = new StoragePolicyKey(STORAGE_POLICY_NAMESPACE_CD, STORAGE_POLICY_NAME); StoragePolicy storagePolicy = new StoragePolicy(ID, storagePolicyKey, new StoragePolicyRule(STORAGE_POLICY_RULE_TYPE, STORAGE_POLICY_RULE_VALUE), new StoragePolicyFilter(BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, STORAGE_NAME), new StoragePolicyTransition(STORAGE_POLICY_TRANSITION_TYPE), StoragePolicyStatusEntity.ENABLED); StoragePolicyCreateRequest request = storagePolicyServiceTestHelper .createStoragePolicyCreateRequest(storagePolicyKey, STORAGE_POLICY_RULE_TYPE, STORAGE_POLICY_RULE_VALUE, BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, STORAGE_NAME, STORAGE_POLICY_TRANSITION_TYPE, StoragePolicyStatusEntity.ENABLED); when(storagePolicyService.createStoragePolicy(request)).thenReturn(storagePolicy); // Create a storage policy. StoragePolicy resultStoragePolicy = storagePolicyRestController.createStoragePolicy(request); // Verify the external calls. verify(storagePolicyService).createStoragePolicy(request); verifyNoMoreInteractions(storagePolicyService); // Validate the returned object. assertEquals(storagePolicy, resultStoragePolicy); }
@Test public void testCreateStoragePolicyStoragePolicyFilterStorageFileExistenceValidationNotEnabled() { // Create and persist the relative database entities. storagePolicyServiceTestHelper.createDatabaseEntitiesForStoragePolicyTesting(); // Create an S3 storage with the bucket name configured, the S3 path prefix validation enabled, but without S3 file existence validation enabled. // Enable the S3 path prefix validation for this storage. List<Attribute> attributes = new ArrayList<>(); attributes.add(new Attribute(configurationHelper.getProperty(ConfigurationValue.S3_ATTRIBUTE_NAME_BUCKET_NAME), S3_BUCKET_NAME)); attributes.add(new Attribute(configurationHelper.getProperty(ConfigurationValue.S3_ATTRIBUTE_NAME_VALIDATE_PATH_PREFIX), Boolean.TRUE.toString())); storageDaoTestHelper.createStorageEntity(STORAGE_NAME_3, StoragePlatformEntity.S3, attributes); // Create a storage policy key. StoragePolicyKey storagePolicyKey = new StoragePolicyKey(STORAGE_POLICY_NAMESPACE_CD, STORAGE_POLICY_NAME); // Try to create a storage policy when storage policy filter storage has no S3 file existence validation enabled. StoragePolicyCreateRequest request = storagePolicyServiceTestHelper .createStoragePolicyCreateRequest(storagePolicyKey, STORAGE_POLICY_RULE_TYPE, STORAGE_POLICY_RULE_VALUE, BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, STORAGE_NAME_3, STORAGE_POLICY_TRANSITION_TYPE, StoragePolicyStatusEntity.ENABLED); try { storagePolicyService.createStoragePolicy(request); fail("Should throw an IllegalStateException when storage policy filter storage has no S3 file existence validation enabled."); } catch (IllegalStateException e) { assertEquals(String.format("File existence validation must be enabled on \"%s\" storage.", request.getStoragePolicyFilter().getStorageName()), e.getMessage()); } }
storagePolicyService.createStoragePolicy(storagePolicyServiceTestHelper .createStoragePolicyCreateRequest(new StoragePolicyKey(BLANK_TEXT, STORAGE_POLICY_NAME), STORAGE_POLICY_RULE_TYPE, STORAGE_POLICY_RULE_VALUE, BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, STORAGE_NAME, STORAGE_POLICY_TRANSITION_TYPE, storagePolicyService.createStoragePolicy(storagePolicyServiceTestHelper .createStoragePolicyCreateRequest(new StoragePolicyKey(STORAGE_POLICY_NAMESPACE_CD, BLANK_TEXT), STORAGE_POLICY_RULE_TYPE, STORAGE_POLICY_RULE_VALUE, STORAGE_POLICY_NAMESPACE_CD, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, STORAGE_NAME, storagePolicyService.createStoragePolicy(storagePolicyServiceTestHelper .createStoragePolicyCreateRequest(storagePolicyKey, BLANK_TEXT, STORAGE_POLICY_RULE_VALUE, BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, STORAGE_NAME, STORAGE_POLICY_TRANSITION_TYPE, StoragePolicyStatusEntity.ENABLED)); storagePolicyService.createStoragePolicy(storagePolicyServiceTestHelper .createStoragePolicyCreateRequest(storagePolicyKey, STORAGE_POLICY_RULE_TYPE, null, BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, STORAGE_NAME, STORAGE_POLICY_TRANSITION_TYPE, StoragePolicyStatusEntity.ENABLED)); storagePolicyService.createStoragePolicy(storagePolicyServiceTestHelper .createStoragePolicyCreateRequest(storagePolicyKey, STORAGE_POLICY_RULE_TYPE, STORAGE_POLICY_RULE_VALUE, BLANK_TEXT, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, STORAGE_NAME, STORAGE_POLICY_TRANSITION_TYPE, StoragePolicyStatusEntity.ENABLED)); storagePolicyService.createStoragePolicy(storagePolicyServiceTestHelper .createStoragePolicyCreateRequest(storagePolicyKey, STORAGE_POLICY_RULE_TYPE, STORAGE_POLICY_RULE_VALUE, BDEF_NAMESPACE, BLANK_TEXT, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, STORAGE_NAME, STORAGE_POLICY_TRANSITION_TYPE, StoragePolicyStatusEntity.ENABLED)); storagePolicyService.createStoragePolicy(storagePolicyServiceTestHelper .createStoragePolicyCreateRequest(storagePolicyKey, STORAGE_POLICY_RULE_TYPE, STORAGE_POLICY_RULE_VALUE, BDEF_NAMESPACE, BDEF_NAME, BLANK_TEXT, FORMAT_FILE_TYPE_CODE, STORAGE_NAME, STORAGE_POLICY_TRANSITION_TYPE, StoragePolicyStatusEntity.ENABLED)); storagePolicyService.createStoragePolicy(storagePolicyServiceTestHelper
@Test public void testCreateStoragePolicyStoragePolicyFilterStorageInvalidStoragePlatform() { // Create a storage policy key. StoragePolicyKey storagePolicyKey = new StoragePolicyKey(STORAGE_POLICY_NAMESPACE_CD, STORAGE_POLICY_NAME); // Create and persist the relative database entities. storagePolicyServiceTestHelper.createDatabaseEntitiesForStoragePolicyTesting(); // Create a non-S3 storage. storageDaoTestHelper.createStorageEntity(STORAGE_NAME_3, STORAGE_PLATFORM_CODE); // Try to create a storage policy using storage of a non-S3 storage platform type. StoragePolicyCreateRequest request = storagePolicyServiceTestHelper .createStoragePolicyCreateRequest(storagePolicyKey, STORAGE_POLICY_RULE_TYPE, STORAGE_POLICY_RULE_VALUE, BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, STORAGE_NAME_3, STORAGE_POLICY_TRANSITION_TYPE, StoragePolicyStatusEntity.ENABLED); try { storagePolicyService.createStoragePolicy(request); fail("Should throw an IllegalArgumentException when using non-S3 storage platform for storage policy filter storage."); } catch (IllegalArgumentException e) { assertEquals(String.format("Storage platform for storage with name \"%s\" is not \"%s\".", request.getStoragePolicyFilter().getStorageName(), StoragePlatformEntity.S3), e.getMessage()); } }
@Test public void testCreateStoragePolicyStoragePolicyFilterStoragePathPrefixValidationNotEnabled() { // Create and persist the relative database entities. storagePolicyServiceTestHelper.createDatabaseEntitiesForStoragePolicyTesting(); // Create an S3 storage with the bucket name configured, but without the S3 path prefix validation option configured. storageDaoTestHelper .createStorageEntity(STORAGE_NAME_3, StoragePlatformEntity.S3, configurationHelper.getProperty(ConfigurationValue.S3_ATTRIBUTE_NAME_BUCKET_NAME), S3_BUCKET_NAME); StoragePolicyKey storagePolicyKey = new StoragePolicyKey(STORAGE_POLICY_NAMESPACE_CD, STORAGE_POLICY_NAME); // Try to create a storage policy when storage policy filter storage has no S3 path prefix validation enabled. StoragePolicyCreateRequest request = storagePolicyServiceTestHelper .createStoragePolicyCreateRequest(storagePolicyKey, STORAGE_POLICY_RULE_TYPE, STORAGE_POLICY_RULE_VALUE, BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, STORAGE_NAME_3, STORAGE_POLICY_TRANSITION_TYPE, StoragePolicyStatusEntity.ENABLED); try { storagePolicyService.createStoragePolicy(request); fail("Should throw an IllegalStateException when storage policy filter storage has no S3 path prefix validation enabled."); } catch (IllegalStateException e) { assertEquals(String.format("Path prefix validation must be enabled on \"%s\" storage.", request.getStoragePolicyFilter().getStorageName()), e.getMessage()); } }
@Test public void testCreateStoragePolicyStoragePolicyFilterStorageBucketNameNotConfigured() { // Create and persist the relative database entities. storagePolicyServiceTestHelper.createDatabaseEntitiesForStoragePolicyTesting(); // Create an S3 storage without any attributes. storageDaoTestHelper.createStorageEntity(STORAGE_NAME_3, StoragePlatformEntity.S3); // Create a storage policy key. StoragePolicyKey storagePolicyKey = new StoragePolicyKey(STORAGE_POLICY_NAMESPACE_CD, STORAGE_POLICY_NAME); // Try to create a storage policy when storage policy filter storage has no S3 bucket name attribute configured. StoragePolicyCreateRequest request = storagePolicyServiceTestHelper .createStoragePolicyCreateRequest(storagePolicyKey, STORAGE_POLICY_RULE_TYPE, STORAGE_POLICY_RULE_VALUE, BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, STORAGE_NAME_3, STORAGE_POLICY_TRANSITION_TYPE, StoragePolicyStatusEntity.ENABLED); try { storagePolicyService.createStoragePolicy(request); fail("Should throw an IllegalStateException when storage policy filter storage has no S3 bucket name attribute configured."); } catch (IllegalStateException e) { assertEquals(String.format("Attribute \"%s\" for \"%s\" storage must be configured.", configurationHelper.getProperty(ConfigurationValue.S3_ATTRIBUTE_NAME_BUCKET_NAME), request.getStoragePolicyFilter().getStorageName()), e.getMessage()); } }
@Test public void testCreateStoragePolicyAlreadyExists() { // Create a storage policy key. StoragePolicyKey storagePolicyKey = new StoragePolicyKey(STORAGE_POLICY_NAMESPACE_CD, STORAGE_POLICY_NAME); // Create and persist a storage policy entity. storagePolicyDaoTestHelper .createStoragePolicyEntity(storagePolicyKey, STORAGE_POLICY_RULE_TYPE, STORAGE_POLICY_RULE_VALUE, BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, STORAGE_NAME, STORAGE_POLICY_TRANSITION_TYPE, StoragePolicyStatusEntity.ENABLED, INITIAL_VERSION, LATEST_VERSION_FLAG_SET); // Try to create a storage policy when it already exists. try { storagePolicyService.createStoragePolicy(storagePolicyServiceTestHelper .createStoragePolicyCreateRequest(storagePolicyKey, STORAGE_POLICY_RULE_TYPE, STORAGE_POLICY_RULE_VALUE, BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, STORAGE_NAME, STORAGE_POLICY_TRANSITION_TYPE, StoragePolicyStatusEntity.ENABLED)); fail("Should throw an AlreadyExistsException when storage policy already exists."); } catch (AlreadyExistsException e) { assertEquals(String.format("Unable to create storage policy with name \"%s\" because it already exists for namespace \"%s\".", storagePolicyKey.getStoragePolicyName(), storagePolicyKey.getNamespace()), e.getMessage()); } }
storagePolicyService.createStoragePolicy(request); fail("Should throw an ObjectNotFoundException when using non-existing storage policy namespace."); storagePolicyService.createStoragePolicy(storagePolicyServiceTestHelper .createStoragePolicyCreateRequest(new StoragePolicyKey(addSlash(STORAGE_POLICY_NAMESPACE_CD), STORAGE_POLICY_NAME), STORAGE_POLICY_RULE_TYPE, STORAGE_POLICY_RULE_VALUE, BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, STORAGE_NAME, storagePolicyService.createStoragePolicy(storagePolicyServiceTestHelper .createStoragePolicyCreateRequest(new StoragePolicyKey(STORAGE_POLICY_NAMESPACE_CD, addSlash(STORAGE_POLICY_NAME)), STORAGE_POLICY_RULE_TYPE, STORAGE_POLICY_RULE_VALUE, BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, STORAGE_NAME, storagePolicyService.createStoragePolicy(request); fail("Should throw an ObjectNotFoundException when using non-existing storage policy rule type."); storagePolicyService.createStoragePolicy(request); fail("Should throw an IllegalArgumentException when using a negative storage policy rule value."); storagePolicyService.createStoragePolicy(request); fail("Should throw an ObjectNotFoundException when using non-existing business object definition namespace."); storagePolicyService.createStoragePolicy(request); fail("Should throw an ObjectNotFoundException when using non-existing business object definition name."); storagePolicyService.createStoragePolicy(request); fail("Should throw an ObjectNotFoundException when using non-existing business object format file type."); storagePolicyService.createStoragePolicy(request); fail("Should throw an ObjectNotFoundException when using non-existing storage name.");
@Test public void testCreateStoragePolicyMissingOptionalParametersPassedAsWhitespace() { // Create a storage policy key. StoragePolicyKey storagePolicyKey = new StoragePolicyKey(STORAGE_POLICY_NAMESPACE_CD, STORAGE_POLICY_NAME); // Create and persist the relative database entities. storagePolicyServiceTestHelper.createDatabaseEntitiesForStoragePolicyTesting(); // Create a storage policy without specifying any of the optional parameters (passing them as whitespace characters). StoragePolicy resultStoragePolicy = storagePolicyService.createStoragePolicy(storagePolicyServiceTestHelper .createStoragePolicyCreateRequest(storagePolicyKey, STORAGE_POLICY_RULE_TYPE, STORAGE_POLICY_RULE_VALUE, BLANK_TEXT, BLANK_TEXT, BLANK_TEXT, BLANK_TEXT, STORAGE_NAME, STORAGE_POLICY_TRANSITION_TYPE, StoragePolicyStatusEntity.ENABLED)); // Validate the returned object. assertEquals( new StoragePolicy(resultStoragePolicy.getId(), storagePolicyKey, new StoragePolicyRule(STORAGE_POLICY_RULE_TYPE, STORAGE_POLICY_RULE_VALUE), new StoragePolicyFilter(null, null, null, null, STORAGE_NAME), new StoragePolicyTransition(STORAGE_POLICY_TRANSITION_TYPE), StoragePolicyStatusEntity.ENABLED), resultStoragePolicy); }
@Test public void testCreateStoragePolicy() { // Create a storage policy key. StoragePolicyKey storagePolicyKey = new StoragePolicyKey(STORAGE_POLICY_NAMESPACE_CD, STORAGE_POLICY_NAME); // Create and persist the relative database entities. storagePolicyServiceTestHelper.createDatabaseEntitiesForStoragePolicyTesting(); // Create a storage policy. StoragePolicy resultStoragePolicy = storagePolicyService.createStoragePolicy(storagePolicyServiceTestHelper .createStoragePolicyCreateRequest(storagePolicyKey, STORAGE_POLICY_RULE_TYPE, STORAGE_POLICY_RULE_VALUE, BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, STORAGE_NAME, STORAGE_POLICY_TRANSITION_TYPE, StoragePolicyStatusEntity.ENABLED)); // Validate the returned object. assertEquals( new StoragePolicy(resultStoragePolicy.getId(), storagePolicyKey, new StoragePolicyRule(STORAGE_POLICY_RULE_TYPE, STORAGE_POLICY_RULE_VALUE), new StoragePolicyFilter(BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, STORAGE_NAME), new StoragePolicyTransition(STORAGE_POLICY_TRANSITION_TYPE), StoragePolicyStatusEntity.ENABLED), resultStoragePolicy); }
@Test public void testCreateStoragePolicyMissingOptionalParametersPassedAsNulls() { // Create a storage policy key. StoragePolicyKey storagePolicyKey = new StoragePolicyKey(STORAGE_POLICY_NAMESPACE_CD, STORAGE_POLICY_NAME); // Create and persist the relative database entities. storagePolicyServiceTestHelper.createDatabaseEntitiesForStoragePolicyTesting(); // Create a storage policy without specifying any of the optional parameters (passing them as null values). StoragePolicy resultStoragePolicy = storagePolicyService.createStoragePolicy(storagePolicyServiceTestHelper .createStoragePolicyCreateRequest(storagePolicyKey, STORAGE_POLICY_RULE_TYPE, STORAGE_POLICY_RULE_VALUE, null, null, null, null, STORAGE_NAME, STORAGE_POLICY_TRANSITION_TYPE, StoragePolicyStatusEntity.ENABLED)); // Validate the returned object. assertEquals( new StoragePolicy(resultStoragePolicy.getId(), storagePolicyKey, new StoragePolicyRule(STORAGE_POLICY_RULE_TYPE, STORAGE_POLICY_RULE_VALUE), new StoragePolicyFilter(null, null, null, null, STORAGE_NAME), new StoragePolicyTransition(STORAGE_POLICY_TRANSITION_TYPE), StoragePolicyStatusEntity.ENABLED), resultStoragePolicy); }
@Test public void testCreateStoragePolicyTrimParameters() { // Create and persist the relative database entities. storagePolicyServiceTestHelper.createDatabaseEntitiesForStoragePolicyTesting(); // Create a storage policy using input parameters with leading and trailing empty spaces. StoragePolicy resultStoragePolicy = storagePolicyService.createStoragePolicy(storagePolicyServiceTestHelper .createStoragePolicyCreateRequest(new StoragePolicyKey(addWhitespace(STORAGE_POLICY_NAMESPACE_CD), addWhitespace(STORAGE_POLICY_NAME)), addWhitespace(STORAGE_POLICY_RULE_TYPE), STORAGE_POLICY_RULE_VALUE, addWhitespace(BDEF_NAMESPACE), addWhitespace(BDEF_NAME), addWhitespace(FORMAT_USAGE_CODE), addWhitespace(FORMAT_FILE_TYPE_CODE), addWhitespace(STORAGE_NAME), addWhitespace(STORAGE_POLICY_TRANSITION_TYPE), addWhitespace(StoragePolicyStatusEntity.ENABLED))); // Validate the returned object. assertEquals(new StoragePolicy(resultStoragePolicy.getId(), new StoragePolicyKey(STORAGE_POLICY_NAMESPACE_CD, STORAGE_POLICY_NAME), new StoragePolicyRule(STORAGE_POLICY_RULE_TYPE, STORAGE_POLICY_RULE_VALUE), new StoragePolicyFilter(BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, STORAGE_NAME), new StoragePolicyTransition(STORAGE_POLICY_TRANSITION_TYPE), StoragePolicyStatusEntity.ENABLED), resultStoragePolicy); }