/** * Creates business object format by calling the relative service method and using hard coded test values. * * @return the newly created business object format */ public BusinessObjectFormat createTestBusinessObjectFormat() { return createTestBusinessObjectFormat(AbstractServiceTest.NO_ATTRIBUTES); }
/** * This unit test does not pass optional parameters. */ @Test public void testGetBusinessObjectFormatMissingOptionalParameters() throws Exception { // Create and persist a business object format. BusinessObjectFormat businessObjectFormat = businessObjectFormatServiceTestHelper.createTestBusinessObjectFormat(); List<FieldExtension> fieldExtensionList = new ArrayList<>(); fieldExtensionList.add(buildFieldExtension("namespace", "${namespace}")); fieldExtensionList.add(buildFieldExtension("businessObjectDefinitionName", "${businessObjectDefinitionName}")); fieldExtensionList.add(buildFieldExtension("businessObjectFormatUsage", "${businessObjectFormatUsage}")); fieldExtensionList.add(buildFieldExtension("businessObjectFormatFileType", "${businessObjectFormatFileType}")); List<Parameter> parameters = new ArrayList<>(); parameters.add(buildParameter("namespace", NAMESPACE)); parameters.add(buildParameter("businessObjectDefinitionName", BDEF_NAME)); parameters.add(buildParameter("businessObjectFormatUsage", FORMAT_USAGE_CODE)); parameters.add(buildParameter("businessObjectFormatFileType", FORMAT_FILE_TYPE_CODE)); // Retrieve the business object format without specifying the business object format value. Map<String, Object> variableValuesToValidate = new HashMap<>(); variableValuesToValidate.put(GetBusinessObjectFormat.VARIABLE_JSON_RESPONSE, jsonHelper.objectToJson(businessObjectFormat)); testActivitiServiceTaskSuccess(GetBusinessObjectFormat.class.getCanonicalName(), fieldExtensionList, parameters, variableValuesToValidate); }
@Test public void testCreateBusinessObjectFormatWithGlobalAttributeMissing() { globalAttributeDefinitionDaoTestHelper.createGlobalAttributeDefinitionEntity(GLOBAL_ATTRIBUTE_DEFINITON_LEVEL, GLOBAL_ATTRIBUTE_DEFINITON_NAME); try { // Create an initial version of a business object format. BusinessObjectFormat businessObjectFormat = businessObjectFormatServiceTestHelper.createTestBusinessObjectFormat(businessObjectDefinitionServiceTestHelper.getNewAttributes()); fail("should throw exception before"); } catch (IllegalArgumentException ex) { assertEquals(String.format("The business object format has a required attribute \"%s\" which was not specified or has a value which is blank.", GLOBAL_ATTRIBUTE_DEFINITON_NAME), ex.getMessage()); } }
@Test public void testCreateBusinessObjectFormatWithMissingGlobalAttributesEmptyValue() { GlobalAttributeDefinitionEntity globalAttributeDefinitionEntity = createGlobalAttributeDefinitionEntityWithAllowedAttributeValues(); String invalidAttributeValue = ""; List<Attribute> attributes = businessObjectDefinitionServiceTestHelper.getNewAttributes(); attributes.add(new Attribute(GLOBAL_ATTRIBUTE_DEFINITON_NAME, invalidAttributeValue)); try { // Create an initial version of a business object format. BusinessObjectFormat businessObjectFormat = businessObjectFormatServiceTestHelper.createTestBusinessObjectFormat(attributes); fail("Should throw exception before"); } catch (IllegalArgumentException ex) { assertEquals(String.format("The business object format has a required attribute \"%s\" which was not specified or has a value which is blank.", GLOBAL_ATTRIBUTE_DEFINITON_NAME), ex.getMessage()); } }
@Test public void testCreateBusinessObjectFormatWithGlobalAttributesAndAllowedAttributeValuesNegative() { GlobalAttributeDefinitionEntity globalAttributeDefinitionEntity = createGlobalAttributeDefinitionEntityWithAllowedAttributeValues(); String invalidAttributeValue = "test attribute 1"; List<Attribute> attributes = businessObjectDefinitionServiceTestHelper.getNewAttributes(); attributes.add(new Attribute(GLOBAL_ATTRIBUTE_DEFINITON_NAME, invalidAttributeValue)); try { // Create an initial version of a business object format. BusinessObjectFormat businessObjectFormat = businessObjectFormatServiceTestHelper.createTestBusinessObjectFormat(attributes); fail("Should throw exception before"); } catch (IllegalArgumentException ex) { assertEquals(String .format("The business object format attribute \"%s\" value \"%s\" is not from allowed attribute values.", GLOBAL_ATTRIBUTE_DEFINITON_NAME, invalidAttributeValue), ex.getMessage()); } }
@Test public void testCreateBusinessObjectFormatWithGlobalAttributesAndAllowedAttributeValues() { GlobalAttributeDefinitionEntity globalAttributeDefinitionEntity = createGlobalAttributeDefinitionEntityWithAllowedAttributeValues(); List<Attribute> attributes = businessObjectDefinitionServiceTestHelper.getNewAttributes(); attributes.add(new Attribute(GLOBAL_ATTRIBUTE_DEFINITON_NAME.toLowerCase(), ALLOWED_ATTRIBUTE_VALUE_2)); // Create an initial version of a business object format. BusinessObjectFormat businessObjectFormat = businessObjectFormatServiceTestHelper.createTestBusinessObjectFormat(attributes); // Validate the returned object. businessObjectFormatServiceTestHelper .validateBusinessObjectFormat(null, NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, 0, LATEST_VERSION_FLAG_SET, PARTITION_KEY, FORMAT_DESCRIPTION, FORMAT_DOCUMENT_SCHEMA, attributes, businessObjectFormatServiceTestHelper.getTestAttributeDefinitions(), businessObjectFormatServiceTestHelper.getTestSchema(), businessObjectFormat); }
@Test public void testDeleteBusinessObjectFormat() throws Exception { BusinessObjectFormat businessObjectFormat = new BusinessObjectFormat(ID, NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, INITIAL_FORMAT_VERSION, true, PARTITION_KEY, FORMAT_DESCRIPTION, NO_FORMAT_DOCUMENT_SCHEMA, NO_ATTRIBUTES, businessObjectFormatServiceTestHelper.getTestAttributeDefinitions(), businessObjectFormatServiceTestHelper.getTestSchema(), NO_BUSINESS_OBJECT_FORMAT_PARENTS, NO_BUSINESS_OBJECT_FORMAT_CHILDREN, NO_BUSINESS_OBJECT_FORMAT_EXTERNAL_INTERFACES, NO_RECORD_FLAG_SET, NO_RETENTION_PERIOD_IN_DAYS, NO_RETENTION_TYPE, NO_ALLOW_NON_BACKWARDS_COMPATIBLE_CHANGES_SET); BusinessObjectFormatKey businessObjectFormatKey = new BusinessObjectFormatKey(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, INITIAL_FORMAT_VERSION); when(businessObjectFormatService.deleteBusinessObjectFormat(businessObjectFormatKey)).thenReturn(businessObjectFormat); // Create an initial version of a business object format. businessObjectFormatServiceTestHelper.createTestBusinessObjectFormat(); BusinessObjectFormat deletedBusinessObjectFormat = businessObjectFormatRestController .deleteBusinessObjectFormat(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, INITIAL_FORMAT_VERSION); // Verify the external calls. verify(businessObjectFormatService).deleteBusinessObjectFormat(businessObjectFormatKey); verifyNoMoreInteractions(businessObjectFormatService); // Validate the returned object. assertEquals(businessObjectFormat, deletedBusinessObjectFormat); }
@Test public void testUpdateBusinessObjectFormatAttributeDefinitionsMissingOptionalParameters() { List<Attribute> attributes = businessObjectDefinitionServiceTestHelper.getNewAttributes(); BusinessObjectFormat originalBusinessObjectFormat = businessObjectFormatServiceTestHelper.createTestBusinessObjectFormat(attributes); // Passing null as optional parameter List<AttributeDefinition> attributeDefinitions = new ArrayList<>(); attributeDefinitions.add(new AttributeDefinition(AbstractServiceTest.ATTRIBUTE_NAME_1_MIXED_CASE, null)); // Perform an update by changing the attribute definition with an empty list. BusinessObjectFormatAttributeDefinitionsUpdateRequest request = new BusinessObjectFormatAttributeDefinitionsUpdateRequest(attributeDefinitions); try { businessObjectFormatService.updateBusinessObjectFormatAttributeDefinitions( new BusinessObjectFormatKey(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, INITIAL_FORMAT_VERSION), request); fail("Should throw an IllegalArgumentException."); } catch (NullPointerException ex) { assertEquals(null, ex.getMessage()); } }
@Test public void testUpdateBusinessObjectFormatAttributeDefinitionsNullAsParameters() { List<Attribute> attributes = businessObjectDefinitionServiceTestHelper.getNewAttributes(); BusinessObjectFormat originalBusinessObjectFormat = businessObjectFormatServiceTestHelper.createTestBusinessObjectFormat(attributes); // null check for attribute definitions value // Perform an update by changing the attribute definition to null. BusinessObjectFormatAttributeDefinitionsUpdateRequest request = new BusinessObjectFormatAttributeDefinitionsUpdateRequest(null); try { businessObjectFormatService.updateBusinessObjectFormatAttributeDefinitions( new BusinessObjectFormatKey(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, INITIAL_FORMAT_VERSION), request); fail("Should throw an IllegalArgumentException."); } catch (IllegalArgumentException ex) { assertEquals(String.format("A business object format attribute definitions list is required."), ex.getMessage()); } }
@Test public void testUpdateBusinessObjectFormatAttributeDefinitionsTrim() { List<Attribute> attributes = businessObjectDefinitionServiceTestHelper.getNewAttributes(); BusinessObjectFormat originalBusinessObjectFormat = businessObjectFormatServiceTestHelper.createTestBusinessObjectFormat(attributes); // Trim should work on required parameter List<AttributeDefinition> attributeDefinitions = new ArrayList<>(); List<AttributeDefinition> validateAttributeDefinitions = new ArrayList<>(); validateAttributeDefinitions.add(new AttributeDefinition(AbstractServiceTest.ATTRIBUTE_NAME_1_MIXED_CASE, AbstractServiceTest.PUBLISH_ATTRIBUTE)); attributeDefinitions.add(new AttributeDefinition(" " + AbstractServiceTest.ATTRIBUTE_NAME_1_MIXED_CASE + " ", AbstractServiceTest.PUBLISH_ATTRIBUTE)); // Perform an update by changing the attribute definition to null. BusinessObjectFormatAttributeDefinitionsUpdateRequest request = new BusinessObjectFormatAttributeDefinitionsUpdateRequest(attributeDefinitions); BusinessObjectFormat updatedBusinessObjectFormat = businessObjectFormatService.updateBusinessObjectFormatAttributeDefinitions( new BusinessObjectFormatKey(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, INITIAL_FORMAT_VERSION), request); // Validate the returned object. businessObjectFormatServiceTestHelper .validateBusinessObjectFormat(originalBusinessObjectFormat.getId(), NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, INITIAL_FORMAT_VERSION, LATEST_VERSION_FLAG_SET, PARTITION_KEY, FORMAT_DESCRIPTION, FORMAT_DOCUMENT_SCHEMA, attributes, validateAttributeDefinitions, businessObjectFormatServiceTestHelper.getTestSchema(), updatedBusinessObjectFormat); }
@Test public void testUpdateBusinessObjectFormatAttributeDefinitionsDuplicateAttributeDefinitions() { List<Attribute> attributes = businessObjectDefinitionServiceTestHelper.getNewAttributes(); BusinessObjectFormat originalBusinessObjectFormat = businessObjectFormatServiceTestHelper.createTestBusinessObjectFormat(attributes); List<AttributeDefinition> attributeDefinitions = businessObjectFormatServiceTestHelper.getTestAttributeDefinitions2(); // Check for the duplicate attribute definition. attributeDefinitions.add(new AttributeDefinition(AbstractServiceTest.ATTRIBUTE_NAME_1_MIXED_CASE, AbstractServiceTest.NO_PUBLISH_ATTRIBUTE)); BusinessObjectFormatAttributeDefinitionsUpdateRequest request = new BusinessObjectFormatAttributeDefinitionsUpdateRequest(attributeDefinitions); try { businessObjectFormatService.updateBusinessObjectFormatAttributeDefinitions( new BusinessObjectFormatKey(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, INITIAL_FORMAT_VERSION), request); fail("Should throw an IllegalArgumentException."); } catch (IllegalArgumentException ex) { assertEquals(String.format("Duplicate attribute definition name \"%s\" found.", ATTRIBUTE_NAME_1_MIXED_CASE), ex.getMessage()); } }
@Test public void testCreateBusinessObjectFormat() { // Create an initial version of a business object format. BusinessObjectFormat businessObjectFormat = businessObjectFormatServiceTestHelper.createTestBusinessObjectFormat(businessObjectDefinitionServiceTestHelper.getNewAttributes()); // Validate the returned object. businessObjectFormatServiceTestHelper .validateBusinessObjectFormat(null, NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, 0, LATEST_VERSION_FLAG_SET, PARTITION_KEY, FORMAT_DESCRIPTION, FORMAT_DOCUMENT_SCHEMA, businessObjectDefinitionServiceTestHelper.getNewAttributes(), businessObjectFormatServiceTestHelper.getTestAttributeDefinitions(), businessObjectFormatServiceTestHelper.getTestSchema(), businessObjectFormat); }
@Test public void testCreateBusinessObjectFormatWithGlobalAttributes() { globalAttributeDefinitionDaoTestHelper.createGlobalAttributeDefinitionEntity(GLOBAL_ATTRIBUTE_DEFINITON_LEVEL, GLOBAL_ATTRIBUTE_DEFINITON_NAME); //create one non-format level global attribute globalAttributeDefinitionDaoTestHelper.createGlobalAttributeDefinitionEntity(GLOBAL_ATTRIBUTE_DEFINITON_LEVEL + "_1", GLOBAL_ATTRIBUTE_DEFINITON_NAME); List<Attribute> attributes = businessObjectDefinitionServiceTestHelper.getNewAttributes(); attributes.add(new Attribute(GLOBAL_ATTRIBUTE_DEFINITON_NAME, "test attribute 1")); // Create an initial version of a business object format. BusinessObjectFormat businessObjectFormat = businessObjectFormatServiceTestHelper.createTestBusinessObjectFormat(attributes); // Validate the returned object. businessObjectFormatServiceTestHelper .validateBusinessObjectFormat(null, NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, 0, LATEST_VERSION_FLAG_SET, PARTITION_KEY, FORMAT_DESCRIPTION, FORMAT_DOCUMENT_SCHEMA, attributes, businessObjectFormatServiceTestHelper.getTestAttributeDefinitions(), businessObjectFormatServiceTestHelper.getTestSchema(), businessObjectFormat); }
@Test public void testGetBusinessObjectFormat() { // Create an initial version of a business object format with format description and schema information. BusinessObjectFormat originalBusinessObjectFormat = businessObjectFormatServiceTestHelper.createTestBusinessObjectFormat(businessObjectDefinitionServiceTestHelper.getNewAttributes()); // Call GET Business Object Format. BusinessObjectFormat resultBusinessObjectFormat = businessObjectFormatService .getBusinessObjectFormat(new BusinessObjectFormatKey(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, INITIAL_FORMAT_VERSION)); // Validate the returned object. businessObjectFormatServiceTestHelper .validateBusinessObjectFormat(originalBusinessObjectFormat.getId(), NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, INITIAL_FORMAT_VERSION, LATEST_VERSION_FLAG_SET, PARTITION_KEY, FORMAT_DESCRIPTION, FORMAT_DOCUMENT_SCHEMA, businessObjectDefinitionServiceTestHelper.getNewAttributes(), businessObjectFormatServiceTestHelper.getTestAttributeDefinitions(), businessObjectFormatServiceTestHelper.getTestSchema(), resultBusinessObjectFormat); }
@Test public void testUpdateBusinessObjectFormatAttributeDefinitions() { List<Attribute> attributes = businessObjectDefinitionServiceTestHelper.getNewAttributes(); // Create an initial version of a business object format with format description and schema information. // Attributes are passed rather attribute definations as this method also set attribute definition by default and no need to create another method BusinessObjectFormat originalBusinessObjectFormat = businessObjectFormatServiceTestHelper.createTestBusinessObjectFormat(attributes); List<AttributeDefinition> attributeDefinitions = businessObjectFormatServiceTestHelper.getTestAttributeDefinitions2(); BusinessObjectFormatAttributeDefinitionsUpdateRequest request = new BusinessObjectFormatAttributeDefinitionsUpdateRequest(attributeDefinitions); // Perform an update by changing the description and schema. BusinessObjectFormat updatedBusinessObjectFormat = businessObjectFormatService.updateBusinessObjectFormatAttributeDefinitions( new BusinessObjectFormatKey(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, INITIAL_FORMAT_VERSION), request); // Validate the returned object. businessObjectFormatServiceTestHelper .validateBusinessObjectFormat(originalBusinessObjectFormat.getId(), NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, INITIAL_FORMAT_VERSION, LATEST_VERSION_FLAG_SET, PARTITION_KEY, FORMAT_DESCRIPTION, FORMAT_DOCUMENT_SCHEMA, attributes, attributeDefinitions, businessObjectFormatServiceTestHelper.getTestSchema(), updatedBusinessObjectFormat); }
@Test public void testUpdateBusinessObjectFormatRemoveSchema() { // Create an initial version of a business object format with a description and a schema. BusinessObjectFormat originalBusinessObjectFormat = businessObjectFormatServiceTestHelper.createTestBusinessObjectFormat(); // Perform an update to remove the business object format schema. BusinessObjectFormatUpdateRequest request = businessObjectFormatServiceTestHelper .createBusinessObjectFormatUpdateRequest(FORMAT_DESCRIPTION_2, FORMAT_DOCUMENT_SCHEMA_2, businessObjectDefinitionServiceTestHelper.getNewAttributes2(), NO_SCHEMA); BusinessObjectFormat resultBusinessObjectFormat = businessObjectFormatService .updateBusinessObjectFormat(new BusinessObjectFormatKey(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, INITIAL_FORMAT_VERSION), request); // Validate the returned object. businessObjectFormatServiceTestHelper .validateBusinessObjectFormat(originalBusinessObjectFormat.getId(), NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, INITIAL_FORMAT_VERSION, LATEST_VERSION_FLAG_SET, PARTITION_KEY, FORMAT_DESCRIPTION_2, FORMAT_DOCUMENT_SCHEMA_2, businessObjectDefinitionServiceTestHelper.getNewAttributes2(), businessObjectFormatServiceTestHelper.getTestAttributeDefinitions(), NO_SCHEMA, resultBusinessObjectFormat); }
@Test public void testUpdateBusinessObjectFormatAttributes() { // Create an initial version of a business object format with format description and schema information. BusinessObjectFormat originalBusinessObjectFormat = businessObjectFormatServiceTestHelper.createTestBusinessObjectFormat(businessObjectDefinitionServiceTestHelper.getNewAttributes()); List<Attribute> attributes = businessObjectDefinitionServiceTestHelper.getNewAttributes2(); BusinessObjectFormatAttributesUpdateRequest request = new BusinessObjectFormatAttributesUpdateRequest(attributes); // Perform an update by changing the description and schema. BusinessObjectFormat updatedBusinessObjectFormat = businessObjectFormatService.updateBusinessObjectFormatAttributes( new BusinessObjectFormatKey(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, INITIAL_FORMAT_VERSION), request); // Validate the returned object. businessObjectFormatServiceTestHelper .validateBusinessObjectFormat(originalBusinessObjectFormat.getId(), NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, INITIAL_FORMAT_VERSION, LATEST_VERSION_FLAG_SET, PARTITION_KEY, FORMAT_DESCRIPTION, FORMAT_DOCUMENT_SCHEMA, attributes, businessObjectFormatServiceTestHelper.getTestAttributeDefinitions(), businessObjectFormatServiceTestHelper.getTestSchema(), updatedBusinessObjectFormat); }
@Test public void testUpdateBusinessObjectFormatNoChangesToDescriptionDocumentSchemaAndSchema() { // Create an initial version of a business object format with format description and schema information. BusinessObjectFormat originalBusinessObjectFormat = businessObjectFormatServiceTestHelper.createTestBusinessObjectFormat(); // Perform an update without making any changes to format description and schema information. BusinessObjectFormatUpdateRequest request = businessObjectFormatServiceTestHelper .createBusinessObjectFormatUpdateRequest(FORMAT_DESCRIPTION, FORMAT_DOCUMENT_SCHEMA, businessObjectDefinitionServiceTestHelper.getNewAttributes2(), businessObjectFormatServiceTestHelper.getTestSchema()); BusinessObjectFormat updatedBusinessObjectFormat = businessObjectFormatService .updateBusinessObjectFormat(new BusinessObjectFormatKey(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, INITIAL_FORMAT_VERSION), request); // Validate the returned object. businessObjectFormatServiceTestHelper .validateBusinessObjectFormat(originalBusinessObjectFormat.getId(), NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, INITIAL_FORMAT_VERSION, LATEST_VERSION_FLAG_SET, PARTITION_KEY, FORMAT_DESCRIPTION, FORMAT_DOCUMENT_SCHEMA, businessObjectDefinitionServiceTestHelper.getNewAttributes2(), businessObjectFormatServiceTestHelper.getTestAttributeDefinitions(), businessObjectFormatServiceTestHelper.getTestSchema(), updatedBusinessObjectFormat); }
@Test public void testUpdateBusinessObjectFormat() { // Create an initial version of a business object format with format description and schema information. BusinessObjectFormat originalBusinessObjectFormat = businessObjectFormatServiceTestHelper.createTestBusinessObjectFormat(businessObjectDefinitionServiceTestHelper.getNewAttributes()); // Create a new partition key group for the update request. partitionKeyGroupDaoTestHelper.createPartitionKeyGroupEntity(PARTITION_KEY_GROUP_2); // Perform an update by changing the description and schema. BusinessObjectFormatUpdateRequest request = businessObjectFormatServiceTestHelper .createBusinessObjectFormatUpdateRequest(FORMAT_DESCRIPTION_2, FORMAT_DOCUMENT_SCHEMA_2, businessObjectDefinitionServiceTestHelper.getNewAttributes2(), businessObjectFormatServiceTestHelper.getTestSchema2()); BusinessObjectFormat updatedBusinessObjectFormat = businessObjectFormatService .updateBusinessObjectFormat(new BusinessObjectFormatKey(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, INITIAL_FORMAT_VERSION), request); // Validate the returned object. businessObjectFormatServiceTestHelper .validateBusinessObjectFormat(originalBusinessObjectFormat.getId(), NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, INITIAL_FORMAT_VERSION, LATEST_VERSION_FLAG_SET, PARTITION_KEY, FORMAT_DESCRIPTION_2, FORMAT_DOCUMENT_SCHEMA_2, businessObjectDefinitionServiceTestHelper.getNewAttributes2(), businessObjectFormatServiceTestHelper.getTestAttributeDefinitions(), businessObjectFormatServiceTestHelper.getTestSchema2(), updatedBusinessObjectFormat); }
@Test public void testDeleteBusinessObjectFormat() throws Exception { // Create an initial version of a business object format. businessObjectFormatServiceTestHelper.createTestBusinessObjectFormat(businessObjectDefinitionServiceTestHelper.getNewAttributes()); // Retrieve the business object format entity. BusinessObjectFormatEntity businessObjectFormatEntity = businessObjectFormatDao.getBusinessObjectFormatByAltKey( new BusinessObjectFormatKey(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, INITIAL_FORMAT_VERSION)); // Delete the business object format. BusinessObjectFormat deletedBusinessObjectFormat = businessObjectFormatService .deleteBusinessObjectFormat(new BusinessObjectFormatKey(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, INITIAL_FORMAT_VERSION)); // Validate the returned object. businessObjectFormatServiceTestHelper .validateBusinessObjectFormat(businessObjectFormatEntity.getId(), NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, INITIAL_FORMAT_VERSION, LATEST_VERSION_FLAG_SET, PARTITION_KEY, FORMAT_DESCRIPTION, FORMAT_DOCUMENT_SCHEMA, businessObjectDefinitionServiceTestHelper.getNewAttributes(), businessObjectFormatServiceTestHelper.getTestAttributeDefinitions(), businessObjectFormatServiceTestHelper.getTestSchema(), deletedBusinessObjectFormat); // Ensure that this business object format is no longer there. assertNull(businessObjectFormatDao.getBusinessObjectFormatByAltKey( new BusinessObjectFormatKey(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, INITIAL_FORMAT_VERSION))); }