/** * Returns a string representation of the alternate key values for the business object format. * * @param businessObjectFormatEntity the business object format entity * * @return the string representation of the alternate key values for the business object format entity */ public String businessObjectFormatEntityAltKeyToString(BusinessObjectFormatEntity businessObjectFormatEntity) { return String.format("namespace: \"%s\", businessObjectDefinitionName: \"%s\", businessObjectFormatUsage: \"%s\", " + "businessObjectFormatFileType: \"%s\", businessObjectFormatVersion: %d", businessObjectFormatEntity.getBusinessObjectDefinition().getNamespace().getCode(), businessObjectFormatEntity.getBusinessObjectDefinition().getName(), businessObjectFormatEntity.getUsage(), businessObjectFormatEntity.getFileType().getCode(), businessObjectFormatEntity.getBusinessObjectFormatVersion()); }
businessObjectFormat.setId(businessObjectFormatEntity.getId()); businessObjectFormat.setNamespace(businessObjectFormatEntity.getBusinessObjectDefinition().getNamespace().getCode()); businessObjectFormat.setBusinessObjectDefinitionName(businessObjectFormatEntity.getBusinessObjectDefinition().getName()); businessObjectFormat.setBusinessObjectFormatUsage(businessObjectFormatEntity.getUsage()); businessObjectFormat.setBusinessObjectFormatFileType(businessObjectFormatEntity.getFileType().getCode()); businessObjectFormat.setBusinessObjectFormatVersion(businessObjectFormatEntity.getBusinessObjectFormatVersion()); businessObjectFormat.setLatestVersion(businessObjectFormatEntity.getLatestVersion()); businessObjectFormat.setPartitionKey(businessObjectFormatEntity.getPartitionKey()); businessObjectFormat.setDescription(businessObjectFormatEntity.getDescription()); businessObjectFormat.setDocumentSchema(businessObjectFormatEntity.getDocumentSchema()); for (BusinessObjectFormatAttributeEntity attributeEntity : businessObjectFormatEntity.getAttributes()) for (BusinessObjectDataAttributeDefinitionEntity attributeDefinitionEntity : businessObjectFormatEntity.getAttributeDefinitions()) if (!businessObjectFormatEntity.getSchemaColumns().isEmpty()) schema.setNullValue(businessObjectFormatEntity.getNullValue()); schema.setDelimiter(businessObjectFormatEntity.getDelimiter()); schema.setEscapeCharacter(businessObjectFormatEntity.getEscapeCharacter()); schema.setPartitionKeyGroup( businessObjectFormatEntity.getPartitionKeyGroup() != null ? businessObjectFormatEntity.getPartitionKeyGroup().getPartitionKeyGroupName() : null); for (SchemaColumnEntity schemaColumnEntity : businessObjectFormatEntity.getSchemaColumns()) for (BusinessObjectFormatEntity businessObjectFormatEntityParent : latestVersionBusinessObjectFormatEntity.getBusinessObjectFormatParents()) for (BusinessObjectFormatEntity businessObjectFormatEntityChild : latestVersionBusinessObjectFormatEntity.getBusinessObjectFormatChildren())
List<BusinessObjectFormatEntity> businessObjectFormatEntityParents) BusinessObjectFormatEntity businessObjectFormatEntity = new BusinessObjectFormatEntity(); businessObjectFormatEntity.setBusinessObjectDefinition(businessObjectDefinitionEntity); businessObjectFormatEntity.setUsage(request.getBusinessObjectFormatUsage()); businessObjectFormatEntity.setFileType(fileTypeEntity); businessObjectFormatEntity.setBusinessObjectFormatVersion(businessObjectFormatVersion); businessObjectFormatEntity.setLatestVersion(Boolean.TRUE); businessObjectFormatEntity.setPartitionKey(request.getPartitionKey()); businessObjectFormatEntity.setDescription(request.getDescription()); businessObjectFormatEntity.setDocumentSchema(getTrimmedDocumentSchema(request.getDocumentSchema())); businessObjectFormatEntity.setAttributes(attributeEntities); for (Attribute attribute : request.getAttributes()) businessObjectFormatEntity.setAttributeDefinitions(createAttributeDefinitionEntities(request.getAttributeDefinitions(), businessObjectFormatEntity)); businessObjectFormatEntity.setBusinessObjectFormatParents(businessObjectFormatEntityParents);
@Override public BusinessObjectFormatExternalInterfaceEntity getBusinessObjectFormatExternalInterfaceByBusinessObjectFormatAndExternalInterface( BusinessObjectFormatEntity businessObjectFormatEntity, ExternalInterfaceEntity externalInterfaceEntity) { // Create the criteria builder and the criteria. CriteriaBuilder builder = entityManager.getCriteriaBuilder(); CriteriaQuery<BusinessObjectFormatExternalInterfaceEntity> criteria = builder.createQuery(BusinessObjectFormatExternalInterfaceEntity.class); // The criteria root is the business object format to external interface mapping. Root<BusinessObjectFormatExternalInterfaceEntity> businessObjectFormatExternalInterfaceEntityRoot = criteria.from(BusinessObjectFormatExternalInterfaceEntity.class); // Create the standard restrictions (i.e. the standard where clauses). List<Predicate> predicates = new ArrayList<>(); predicates.add(builder.equal(businessObjectFormatExternalInterfaceEntityRoot.get(BusinessObjectFormatExternalInterfaceEntity_.businessObjectFormatId), businessObjectFormatEntity.getId())); predicates.add(builder.equal(businessObjectFormatExternalInterfaceEntityRoot.get(BusinessObjectFormatExternalInterfaceEntity_.externalInterfaceName), externalInterfaceEntity.getCode())); // Add all clauses to the query. criteria.select(businessObjectFormatExternalInterfaceEntityRoot).where(builder.and(predicates.toArray(new Predicate[predicates.size()]))); // Execute the query and return the result. return executeSingleResultQuery(criteria, String.format("Found more than one business object format to external interface mapping with parameters " + "{namespace=\"%s\", businessObjectDefinitionName=\"%s\", businessObjectFormatUsage=\"%s\", businessObjectFormatFileType=\"%s\", " + "externalInterfaceName=\"%s\"}.", businessObjectFormatEntity.getBusinessObjectDefinition().getNamespace().getCode(), businessObjectFormatEntity.getBusinessObjectDefinition().getName(), businessObjectFormatEntity.getUsage(), businessObjectFormatEntity.getFileType().getCode(), externalInterfaceEntity.getCode())); } }
@Test public void testGetBusinessObjectFormatByAltKeyAllParamsLowerCase() { // Create relative database entities. businessObjectDefinitionDaoTestHelper .createBusinessObjectDefinitionEntity(NAMESPACE.toUpperCase(), BDEF_NAME.toUpperCase(), DATA_PROVIDER_NAME.toUpperCase(), BDEF_DESCRIPTION); fileTypeDaoTestHelper.createFileTypeEntity(FORMAT_FILE_TYPE_CODE.toUpperCase(), "Description of " + FORMAT_FILE_TYPE_CODE); businessObjectFormatDaoTestHelper .createBusinessObjectFormatEntity(NAMESPACE, BDEF_NAME.toUpperCase(), FORMAT_USAGE_CODE.toUpperCase(), FORMAT_FILE_TYPE_CODE.toUpperCase(), INITIAL_FORMAT_VERSION, "Test format 0", "Document Schema 0", Boolean.TRUE, PARTITION_KEY); // Retrieve business object format entity by specifying values for all text alternate key fields in lower case. BusinessObjectFormatEntity businessObjectFormatEntity = businessObjectFormatDao.getBusinessObjectFormatByAltKey( new BusinessObjectFormatKey(NAMESPACE, BDEF_NAME.toLowerCase(), FORMAT_USAGE_CODE.toLowerCase(), FORMAT_FILE_TYPE_CODE.toLowerCase(), INITIAL_FORMAT_VERSION)); // Validate the results. assertNotNull(businessObjectFormatEntity); assertTrue(businessObjectFormatEntity.getBusinessObjectDefinition().getName().equals(BDEF_NAME.toUpperCase())); assertTrue(businessObjectFormatEntity.getUsage().equals(FORMAT_USAGE_CODE.toUpperCase())); assertTrue(businessObjectFormatEntity.getFileType().getCode().equals(FORMAT_FILE_TYPE_CODE.toUpperCase())); assertTrue(businessObjectFormatEntity.getBusinessObjectFormatVersion().equals(INITIAL_FORMAT_VERSION)); assertTrue(businessObjectFormatEntity.getLatestVersion()); assertTrue(businessObjectFormatEntity.getPartitionKey().equals(PARTITION_KEY)); assertTrue(businessObjectFormatEntity.getDescription().equals("Test format 0")); assertTrue(businessObjectFormatEntity.getDocumentSchema().equals("Document Schema 0")); }
latestVersionBusinessObjectFormatEntity.setLatestVersion(false); businessObjectFormatDao.saveAndRefresh(latestVersionBusinessObjectFormatEntity); latestVersionBusinessObjectFormatEntity == null ? 0 : latestVersionBusinessObjectFormatEntity.getBusinessObjectFormatVersion() + 1; BusinessObjectFormatEntity newBusinessObjectFormatEntity = createBusinessObjectFormatEntity(request, businessObjectDefinitionEntity, fileTypeEntity, businessObjectFormatVersion, null); for (BusinessObjectFormatEntity childFormatEntity : latestVersionBusinessObjectFormatEntity.getBusinessObjectFormatChildren()) childFormatEntity.getBusinessObjectFormatParents().remove(latestVersionBusinessObjectFormatEntity); childFormatEntity.getBusinessObjectFormatParents().add(newBusinessObjectFormatEntity); newBusinessObjectFormatEntity.getBusinessObjectFormatChildren().add(childFormatEntity); businessObjectFormatDao.saveAndRefresh(childFormatEntity); for (BusinessObjectFormatEntity parentFormatEntity : latestVersionBusinessObjectFormatEntity.getBusinessObjectFormatParents()) parentFormatEntity.getBusinessObjectFormatChildren().remove(latestVersionBusinessObjectFormatEntity); parentFormatEntity.getBusinessObjectFormatChildren().add(newBusinessObjectFormatEntity); newBusinessObjectFormatEntity.getBusinessObjectFormatParents().add(parentFormatEntity); businessObjectFormatDao.saveAndRefresh(parentFormatEntity); latestVersionBusinessObjectFormatEntity.setBusinessObjectFormatParents(null); latestVersionBusinessObjectFormatEntity.setBusinessObjectFormatChildren(null); newBusinessObjectFormatEntity.setRetentionPeriodInDays(latestVersionBusinessObjectFormatEntity.getRetentionPeriodInDays()); newBusinessObjectFormatEntity.setRecordFlag(latestVersionBusinessObjectFormatEntity.isRecordFlag()); newBusinessObjectFormatEntity.setRetentionType(latestVersionBusinessObjectFormatEntity.getRetentionType()); newBusinessObjectFormatEntity.setAllowNonBackwardsCompatibleChanges(latestVersionBusinessObjectFormatEntity.isAllowNonBackwardsCompatibleChanges());
BusinessObjectDefinitionEntity businessObjectDefinitionEntity = businessObjectFormatEntity.getBusinessObjectDefinition(); if (!businessObjectFormatEntity.getBusinessObjectFormatChildren().isEmpty()) if (businessObjectFormatEntity.equals(businessObjectFormatEntity.getBusinessObjectDefinition().getDescriptiveBusinessObjectFormat())) businessObjectFormatEntity.getBusinessObjectDefinition().setDescriptiveBusinessObjectFormat(null); businessObjectDefinitionDao.saveAndRefresh(businessObjectFormatEntity.getBusinessObjectDefinition()); .getBusinessObjectFormatExternalInterfaces()) if (businessObjectFormatEntity.getLatestVersion()) previousVersionBusinessObjectFormatEntity.setLatestVersion(true); previousVersionBusinessObjectFormatEntity.setRecordFlag(businessObjectFormatEntity.isRecordFlag()); previousVersionBusinessObjectFormatEntity.setRetentionPeriodInDays(businessObjectFormatEntity.getRetentionPeriodInDays()); previousVersionBusinessObjectFormatEntity.setRetentionType(businessObjectFormatEntity.getRetentionType()); .setAllowNonBackwardsCompatibleChanges(businessObjectFormatEntity.isAllowNonBackwardsCompatibleChanges()); previousVersionBusinessObjectFormatEntity.getBusinessObjectFormatExternalInterfaces().add(businessObjectFormatExternalInterfaceEntity); businessObjectFormatExternalInterfaceEntity.setBusinessObjectFormat(previousVersionBusinessObjectFormatEntity); businessObjectFormatExternalInterfaceEntity.setExternalInterface(externalInterfaceEntity);
/** * Creates and persists a new business object format entity. * * @return the newly created business object format entity. */ public BusinessObjectFormatEntity createBusinessObjectFormatEntity(boolean includeAttributeDefinition) { BusinessObjectFormatEntity businessObjectFormatEntity = new BusinessObjectFormatEntity(); businessObjectFormatEntity.setBusinessObjectDefinition(businessObjectDefinitionDaoTestHelper.createBusinessObjectDefinition()); businessObjectFormatEntity.setDescription("test"); businessObjectFormatEntity.setFileType(fileTypeDaoTestHelper.createFileTypeEntity()); businessObjectFormatEntity.setBusinessObjectFormatVersion(0); businessObjectFormatEntity.setLatestVersion(true); businessObjectFormatEntity.setUsage("PRC"); businessObjectFormatEntity.setPartitionKey("testPartitionKey"); if (includeAttributeDefinition) { List<BusinessObjectDataAttributeDefinitionEntity> attributeDefinitionEntities = new ArrayList<>(); businessObjectFormatEntity.setAttributeDefinitions(attributeDefinitionEntities); BusinessObjectDataAttributeDefinitionEntity attributeDefinitionEntity = new BusinessObjectDataAttributeDefinitionEntity(); attributeDefinitionEntities.add(attributeDefinitionEntity); attributeDefinitionEntity.setBusinessObjectFormat(businessObjectFormatEntity); attributeDefinitionEntity.setName(AbstractDaoTest.ATTRIBUTE_NAME_1_MIXED_CASE); } return businessObjectFormatDao.saveAndRefresh(businessObjectFormatEntity); }
businessObjectFormatEntity.setDescription(request.getDescription()); businessObjectFormatEntity.setDocumentSchema(getTrimmedDocumentSchema(request.getDocumentSchema())); validateBusinessObjectFormatSchema(request.getSchema(), businessObjectFormatEntity.getPartitionKey()); " businessObjectDefinitionId=\"{}\", searchIndexUpdateType=\"{}\"", businessObjectFormatEntity.getBusinessObjectDefinition().getId(), SEARCH_INDEX_UPDATE_TYPE_UPDATE); searchIndexUpdateHelper .modifyBusinessObjectDefinitionInSearchIndex(businessObjectFormatEntity.getBusinessObjectDefinition(), SEARCH_INDEX_UPDATE_TYPE_UPDATE); businessObjectFormatEntity.getBusinessObjectFormatVersion().toString());
if (businessObjectFormatEntity.getRetentionType() != null) if (StringUtils.equals(businessObjectFormatEntity.getRetentionType().getCode(), RetentionTypeEntity.BDATA_RETENTION_DATE)) builder.lessThan(businessObjectDataEntityRoot.get(BusinessObjectDataEntity_.retentionExpiration), currentTimestamp); else if (StringUtils.equals(businessObjectFormatEntity.getRetentionType().getCode(), RetentionTypeEntity.PARTITION_VALUE) && businessObjectFormatEntity.getRetentionPeriodInDays() != null) .format(DateUtils.addDays(new Date(), -1 * businessObjectFormatEntity.getRetentionPeriodInDays()), DEFAULT_SINGLE_DAY_DATE_MASK); businessObjectFormatEntity.getUsage().toUpperCase())); businessObjectFormatRetentionExpirationPredicate = builder.and(businessObjectFormatRetentionExpirationPredicate, builder.equal(businessObjectFormatEntityJoin.get(BusinessObjectFormatEntity_.fileType), businessObjectFormatEntity.getFileType()));
BusinessObjectFormatEntity businessObjectFormatEntity = new BusinessObjectFormatEntity(); assertEquals(businessObjectFormatEntity.isRecordFlag(), RECORD_FLAG_SET); assertEquals(businessObjectFormatEntity.getRetentionPeriodInDays(), NO_RETENTION_PERIOD_IN_DAYS); assertNull(businessObjectFormatEntity.getRetentionType());
/** * Creates a business object format to external interface mapping key from the specified entity. * * @param businessObjectFormatExternalInterfaceEntity the business object format to external interface entity * * @return the business object format to external interface mapping key */ public BusinessObjectFormatExternalInterfaceKey createBusinessObjectFormatExternalInterfaceKeyFromEntity( BusinessObjectFormatExternalInterfaceEntity businessObjectFormatExternalInterfaceEntity) { return new BusinessObjectFormatExternalInterfaceKey( businessObjectFormatExternalInterfaceEntity.getBusinessObjectFormat().getBusinessObjectDefinition().getNamespace().getCode(), businessObjectFormatExternalInterfaceEntity.getBusinessObjectFormat().getBusinessObjectDefinition().getName(), businessObjectFormatExternalInterfaceEntity.getBusinessObjectFormat().getUsage(), businessObjectFormatExternalInterfaceEntity.getBusinessObjectFormat().getFileType().getCode(), businessObjectFormatExternalInterfaceEntity.getExternalInterface().getCode()); }
BusinessObjectFormatEntity businessObjectFormatEntity = new BusinessObjectFormatEntity(); businessObjectFormatEntity.setBusinessObjectDefinition(businessObjectDefinitionEntity); businessObjectFormatEntity.setUsage(FORMAT_USAGE_CODE); businessObjectFormatEntity.setFileType(fileTypeEntity);
@Test public void testGetBusinessObjectFormatLowerCaseParameters() { // Create and persist a valid business object format. BusinessObjectFormatEntity businessObjectFormatEntity = businessObjectFormatDaoTestHelper .createBusinessObjectFormatEntity(NAMESPACE.toUpperCase(), BDEF_NAME.toUpperCase(), FORMAT_USAGE_CODE.toUpperCase(), FORMAT_FILE_TYPE_CODE.toUpperCase(), INITIAL_FORMAT_VERSION, FORMAT_DESCRIPTION.toUpperCase(), FORMAT_DOCUMENT_SCHEMA.toUpperCase(), LATEST_VERSION_FLAG_SET, PARTITION_KEY.toUpperCase()); // Call GET Business Object Format. BusinessObjectFormat resultBusinessObjectFormat = businessObjectFormatService.getBusinessObjectFormat( new BusinessObjectFormatKey(NAMESPACE.toLowerCase(), BDEF_NAME.toLowerCase(), FORMAT_USAGE_CODE.toLowerCase(), FORMAT_FILE_TYPE_CODE.toLowerCase(), INITIAL_FORMAT_VERSION)); // Validate the returned object. businessObjectFormatServiceTestHelper .validateBusinessObjectFormat(businessObjectFormatEntity.getId(), NAMESPACE.toUpperCase(), BDEF_NAME.toUpperCase(), FORMAT_USAGE_CODE.toUpperCase(), FORMAT_FILE_TYPE_CODE.toUpperCase(), INITIAL_FORMAT_VERSION, LATEST_VERSION_FLAG_SET, PARTITION_KEY.toUpperCase(), FORMAT_DESCRIPTION.toUpperCase(), FORMAT_DOCUMENT_SCHEMA.toUpperCase(), NO_ATTRIBUTES, NO_ATTRIBUTE_DEFINITIONS, NO_SCHEMA, resultBusinessObjectFormat); }
BusinessObjectFormatEntity businessObjectFormatEntity = new BusinessObjectFormatEntity(); businessObjectFormatEntity.setLatestVersion(true); businessObjectFormatEntity.setRetentionType(retentionTypeEntity); businessObjectFormatEntity.setRetentionPeriodInDays(RETENTION_PERIOD_DAYS);
businessObjectFormatEntity.getPartitionKey();
BusinessObjectFormatEntity latestVersionBusinessObjectFormatEntity = businessObjectFormatEntity.getLatestVersion() ? businessObjectFormatEntity : businessObjectFormatDao.getBusinessObjectFormatByAltKey(businessObjectFormatKey); latestVersionBusinessObjectFormatEntity.getRetentionType() != null ? latestVersionBusinessObjectFormatEntity.getRetentionType().getCode() : null; Integer retentionPeriodInDays = latestVersionBusinessObjectFormatEntity.getRetentionPeriodInDays();
@Test public void testCreateBusinessObjectFormatCreateSecondVersion() { // Create an initial version of a business object format. businessObjectFormatServiceTestHelper.createTestBusinessObjectFormat(); // Create a second version of the business object format. BusinessObjectFormatCreateRequest request = businessObjectFormatServiceTestHelper .createBusinessObjectFormatCreateRequest(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, PARTITION_KEY, FORMAT_DESCRIPTION, FORMAT_DOCUMENT_SCHEMA, businessObjectDefinitionServiceTestHelper.getNewAttributes(), businessObjectFormatServiceTestHelper.getTestAttributeDefinitions(), businessObjectFormatServiceTestHelper.getTestSchema()); BusinessObjectFormat resultBusinessObjectFormat = businessObjectFormatService.createBusinessObjectFormat(request); // Validate the returned object. businessObjectFormatServiceTestHelper .validateBusinessObjectFormat(null, NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, SECOND_FORMAT_VERSION, LATEST_VERSION_FLAG_SET, PARTITION_KEY, FORMAT_DESCRIPTION, FORMAT_DOCUMENT_SCHEMA, businessObjectDefinitionServiceTestHelper.getNewAttributes(), businessObjectFormatServiceTestHelper.getTestAttributeDefinitions(), businessObjectFormatServiceTestHelper.getTestSchema(), resultBusinessObjectFormat); // Check if we now have only one latest format version - our first version is not marked as latest anymore. // Please note that we do not have to validate if the first format version is not marked as "latest" now, since having more that one // format versions with the latestVersion flag set to Yes produces exception in herdDao.getBusinessObjectFormatByAltKey() method. BusinessObjectFormatEntity businessObjectFormatEntity = businessObjectFormatDao .getBusinessObjectFormatByAltKey(new BusinessObjectFormatKey(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, null)); assertEquals(SECOND_FORMAT_VERSION, businessObjectFormatEntity.getBusinessObjectFormatVersion()); assertEquals(true, businessObjectFormatEntity.getLatestVersion()); }
@Test public void testDeleteBusinessObjectFormatUsedAsDescriptiveFormat() throws Exception { // Create a version of a business object format. BusinessObjectFormatEntity businessObjectFormatEntity = businessObjectFormatDaoTestHelper .createBusinessObjectFormatEntity(BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, FORMAT_DESCRIPTION, FORMAT_DOCUMENT_SCHEMA, LATEST_VERSION_FLAG_SET, PARTITION_KEY, NO_PARTITION_KEY_GROUP); // Set this format version as descriptive format on the business object definition. businessObjectFormatEntity.getBusinessObjectDefinition().setDescriptiveBusinessObjectFormat(businessObjectFormatEntity); businessObjectDefinitionDao.saveAndRefresh(businessObjectFormatEntity.getBusinessObjectDefinition()); // Validate the existence of the business object format entity. assertNotNull(businessObjectFormatDao .getBusinessObjectFormatByAltKey(new BusinessObjectFormatKey(BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION))); // Delete the business object format. BusinessObjectFormat deletedBusinessObjectFormat = businessObjectFormatService .deleteBusinessObjectFormat(new BusinessObjectFormatKey(BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION)); // Validate the returned object. businessObjectFormatServiceTestHelper .validateBusinessObjectFormat(businessObjectFormatEntity.getId(), BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, LATEST_VERSION_FLAG_SET, PARTITION_KEY, FORMAT_DESCRIPTION, FORMAT_DOCUMENT_SCHEMA, NO_ATTRIBUTES, NO_ATTRIBUTE_DEFINITIONS, NO_SCHEMA, deletedBusinessObjectFormat); // Ensure that this business object format is no longer there. assertNull(businessObjectFormatDao .getBusinessObjectFormatByAltKey(new BusinessObjectFormatKey(BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION))); }
@Test public void testExecuteFunctionForBusinessObjectDefinitionEntities() { // Create a list of business object definition entities. final List<BusinessObjectDefinitionEntity> businessObjectDefinitionEntities = Collections.unmodifiableList(Arrays.asList( businessObjectDefinitionDaoTestHelper.createBusinessObjectDefinitionEntity(BDEF_NAMESPACE, BDEF_NAME, DATA_PROVIDER_NAME, BDEF_DESCRIPTION, businessObjectDefinitionServiceTestHelper.getNewAttributes()), businessObjectDefinitionDaoTestHelper .createBusinessObjectDefinitionEntity(BDEF_NAMESPACE_2, BDEF_NAME_2, DATA_PROVIDER_NAME_2, BDEF_DESCRIPTION_2, businessObjectDefinitionServiceTestHelper.getNewAttributes2()))); businessObjectDefinitionEntities.forEach(entity -> { entity.setDescriptiveBusinessObjectFormat(new BusinessObjectFormatEntity()); entity.getDescriptiveBusinessObjectFormat().setSchemaColumns(new ArrayList<>()); entity.setSubjectMatterExperts(new ArrayList<>()); }); // Mock the external calls. when(jsonHelper.objectToJson(any())).thenReturn(JSON_STRING); // Execute a function for all business object definition entities. businessObjectDefinitionHelper .executeFunctionForBusinessObjectDefinitionEntities(SEARCH_INDEX_NAME, SEARCH_INDEX_DOCUMENT_TYPE, businessObjectDefinitionEntities, (indexName, documentType, id, json) -> { }); // Verify the external calls. verify(jsonHelper, times(businessObjectDefinitionEntities.size())).objectToJson(any()); verifyNoMoreInteractions(alternateKeyHelper, jsonHelper); }