test_class.file: herd-code/herd-service/src/test/java/org/finra/herd/service/helper/BusinessObjectFormatExternalInterfaceDescriptiveInformationHelperTest.java
test_class.identifier: BusinessObjectFormatExternalInterfaceDescriptiveInformationHelperTest
test_class.superclass: extends AbstractServiceTest
test_case.body: @Test
      public void testCreateBusinessObjectFormatExternalInterfaceDescriptiveInformationFromEntitiesWithNullPartitionKeyGroup()
      {
          // Create a velocity template for the external interface entity.
          String velocityTemplateDescription = "${partitionKeyGroup}";
  
          // Create a business object format entity.
          BusinessObjectFormatEntity businessObjectFormatEntity = businessObjectFormatDaoTestHelper
              .createBusinessObjectFormatEntity(NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, FORMAT_DESCRIPTION,
                  NO_FORMAT_DOCUMENT_SCHEMA, NO_FORMAT_DOCUMENT_SCHEMA_URL, LATEST_VERSION_FLAG_SET, NO_PARTITION_KEY, NO_PARTITION_KEY_GROUP, NO_ATTRIBUTES,
                  SCHEMA_DELIMITER_PIPE, SCHEMA_COLLECTION_ITEMS_DELIMITER_COMMA, SCHEMA_MAP_KEYS_DELIMITER_HASH, SCHEMA_ESCAPE_CHARACTER_BACKSLASH,
                  null, null, SCHEMA_NULL_VALUE_BACKSLASH_N, NO_COLUMNS, NO_PARTITION_COLUMNS);
  
          // Create an external interface entity.
          ExternalInterfaceEntity externalInterfaceEntity = externalInterfaceDaoTestHelper.createExternalInterfaceEntity(EXTERNAL_INTERFACE);
          externalInterfaceEntity.setDescription(velocityTemplateDescription);
  
          // Create a business object format to external interface mapping entity.
          businessObjectFormatExternalInterfaceDaoTestHelper
              .createBusinessObjectFormatExternalInterfaceEntity(businessObjectFormatEntity, externalInterfaceEntity);
  
          // Call the method under test.
          BusinessObjectFormatExternalInterfaceDescriptiveInformation result = businessObjectFormatExternalInterfaceDescriptiveInformationHelper
              .createBusinessObjectFormatExternalInterfaceDescriptiveInformationFromEntities(businessObjectFormatEntity, externalInterfaceEntity);
  
          // Validate no partition key group
          assertEquals("Partition key group not equal to replacement.", result.getExternalInterfaceDescription(), "");
      }
test_case.class_method_signature: BusinessObjectFormatExternalInterfaceDescriptiveInformationHelperTest.testCreateBusinessObjectFormatExternalInterfaceDescriptiveInformationFromEntitiesWithNullPartitionKeyGroup()
test_case.full_signature: @Test public void testCreateBusinessObjectFormatExternalInterfaceDescriptiveInformationFromEntitiesWithNullPartitionKeyGroup()
test_case.identifier: testCreateBusinessObjectFormatExternalInterfaceDescriptiveInformationFromEntitiesWithNullPartitionKeyGroup
test_case.invocations: createBusinessObjectFormatEntity createExternalInterfaceEntity setDescription createBusinessObjectFormatExternalInterfaceEntity createBusinessObjectFormatExternalInterfaceDescriptiveInformationFromEntities assertEquals getExternalInterfaceDescription
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testCreateBusinessObjectFormatExternalInterfaceDescriptiveInformationFromEntitiesWithNullPartitionKeyGroup()
focal_class.declarator: LOGGER = LoggerFactory.getLogger(BusinessObjectFormatExternalInterfaceDescriptiveInformationHelper.class)
focal_class.modifier: private static final
focal_class.original_string: private static final Logger LOGGER = LoggerFactory.getLogger(BusinessObjectFormatExternalInterfaceDescriptiveInformationHelper.class);
focal_class.type: Logger
focal_class.var_name: LOGGER
focal_class.declarator: businessObjectFormatHelper
focal_class.modifier: @Autowired
      private
focal_class.original_string: @Autowired
      private BusinessObjectFormatHelper businessObjectFormatHelper;
focal_class.type: BusinessObjectFormatHelper
focal_class.var_name: businessObjectFormatHelper
focal_class.declarator: velocityHelper
focal_class.modifier: @Autowired
      private
focal_class.original_string: @Autowired
      private VelocityNonStrictHelper velocityHelper;
focal_class.type: VelocityNonStrictHelper
focal_class.var_name: velocityHelper
focal_class.file: herd-code/herd-service/src/main/java/org/finra/herd/service/helper/BusinessObjectFormatExternalInterfaceDescriptiveInformationHelper.java
focal_class.identifier: BusinessObjectFormatExternalInterfaceDescriptiveInformationHelper
focal_class.class_method_signature: BusinessObjectFormatExternalInterfaceDescriptiveInformationHelper.createBusinessObjectFormatExternalInterfaceDescriptiveInformationFromEntities(
          BusinessObjectFormatEntity businessObjectFormatEntity, ExternalInterfaceEntity externalInterfaceEntity)
focal_class.full_signature: public BusinessObjectFormatExternalInterfaceDescriptiveInformation createBusinessObjectFormatExternalInterfaceDescriptiveInformationFromEntities(
          BusinessObjectFormatEntity businessObjectFormatEntity, ExternalInterfaceEntity externalInterfaceEntity)
focal_class.identifier: createBusinessObjectFormatExternalInterfaceDescriptiveInformationFromEntities
focal_class.modifiers: public
focal_class.parameters: (
          BusinessObjectFormatEntity businessObjectFormatEntity, ExternalInterfaceEntity externalInterfaceEntity)
focal_class.return: BusinessObjectFormatExternalInterfaceDescriptiveInformation
focal_class.signature: BusinessObjectFormatExternalInterfaceDescriptiveInformation createBusinessObjectFormatExternalInterfaceDescriptiveInformationFromEntities(
          BusinessObjectFormatEntity businessObjectFormatEntity, ExternalInterfaceEntity externalInterfaceEntity)
focal_method.body: public BusinessObjectFormatExternalInterfaceDescriptiveInformation createBusinessObjectFormatExternalInterfaceDescriptiveInformationFromEntities(
          BusinessObjectFormatEntity businessObjectFormatEntity, ExternalInterfaceEntity externalInterfaceEntity)
      {
          // Convert the business object format entity to the business object format model object
          BusinessObjectFormat businessObjectFormat = businessObjectFormatHelper.createBusinessObjectFormatFromEntity(businessObjectFormatEntity);
  
          // Build the BusinessObjectFormatExternalInterfaceKey with information from the business object format entity and the external interface entity
          BusinessObjectFormatExternalInterfaceKey businessObjectFormatExternalInterfaceKey =
              new BusinessObjectFormatExternalInterfaceKey(businessObjectFormat.getNamespace(), businessObjectFormat.getBusinessObjectDefinitionName(),
                  businessObjectFormat.getBusinessObjectFormatUsage(), businessObjectFormat.getBusinessObjectFormatFileType(), externalInterfaceEntity.getCode());
  
          // Velocity Template Resource Names:
          // ${StringUtils}                       The string utilities class
          // ${CollectionUtils}                   The collection utilities class
          // ${Collections}                       The collections class
          // ${namespace}                         The namespace associated with this business object format
          // ${businessObjectDefinitionName}      The name of the business object definition associated with this business object format
          // ${businessObjectFormatUsage}         The usage associated with the business object format
          // ${businessObjectFormatFileType}      The file type associated with the business object format
          // ${businessObjectFormatAttributes}    The business object format attributes map of key value pairs
          // ${partitionColumnNames}              The partition column names associated with the business object format
          // ${partitionKeyGroup}                 The partition key group associated with the business object format
  
          // Build velocity context variable map
          Map<String, Object> velocityContext = Maps.newHashMap();
          velocityContext.put("StringUtils", StringUtils.class);
          velocityContext.put("CollectionUtils", CollectionUtils.class);
          velocityContext.put("Collections", Collections.class);
          velocityContext.put("namespace", businessObjectFormat.getNamespace());
          velocityContext.put("businessObjectDefinitionName", businessObjectFormat.getBusinessObjectDefinitionName());
          velocityContext.put("businessObjectFormatUsage", businessObjectFormat.getBusinessObjectFormatUsage());
          velocityContext.put("businessObjectFormatFileType", businessObjectFormat.getBusinessObjectFormatFileType());
  
          // Build an insertion ordered map of business object format attributes.
          Map<String, String> businessObjectFormatAttributes = Maps.newLinkedHashMap();
          for (Attribute attribute : businessObjectFormat.getAttributes())
          {
              businessObjectFormatAttributes.put(attribute.getName(), attribute.getValue());
          }
  
          velocityContext.put("businessObjectFormatAttributes", businessObjectFormatAttributes);
  
          // Build an insertion ordered list of partition column names.
          List<String> partitionColumnNames = Lists.newLinkedList();
          if (businessObjectFormat.getSchema() != null)
          {
              for (SchemaColumn schemaColumn : businessObjectFormat.getSchema().getPartitions())
              {
                  partitionColumnNames.add(schemaColumn.getName());
              }
          }
  
          velocityContext.put("partitionColumnNames", partitionColumnNames);
  
          if (businessObjectFormatEntity.getPartitionKeyGroup() != null)
          {
              velocityContext.put("partitionKeyGroup", businessObjectFormatEntity.getPartitionKeyGroup().getPartitionKeyGroupName());
          }
          else
          {
              velocityContext.put("partitionKeyGroup", "");
          }
  
          // Create a string to hold the velocity template evaluated external interface description.
          String velocityEvaluatedExternalInterfaceDescription;
  
          // Catch any parse error exceptions, and throw an illegal argument exception instead.
          try
          {
              // Use the velocity helper to evaluate the external interface description velocity template.
              // During the evaluation of the velocity template by the velocity engine a parse error exception may occur.
              velocityEvaluatedExternalInterfaceDescription =
                  velocityHelper.evaluate(externalInterfaceEntity.getDescription(), velocityContext, "External Interface Description", false);
          }
          catch (ParseErrorException parseErrorException)
          {
              // Build an exception message that contains the external interface information as well as the parse error.
              String exceptionMessage = String
                  .format("Failed to evaluate velocity template in the external interface with name \"%s\". Reason: %s", externalInterfaceEntity.getCode(),
                      parseErrorException.getMessage());
  
              // Log the parsing error.
              LOGGER.error(exceptionMessage, parseErrorException);
  
              // Throw a new illegal argument exception with the exception message.
              throw new IllegalArgumentException(exceptionMessage);
          }
  
          return new BusinessObjectFormatExternalInterfaceDescriptiveInformation(businessObjectFormatExternalInterfaceKey,
              externalInterfaceEntity.getDisplayName(), velocityEvaluatedExternalInterfaceDescription);
      }
focal_method.class_method_signature: BusinessObjectFormatExternalInterfaceDescriptiveInformationHelper.createBusinessObjectFormatExternalInterfaceDescriptiveInformationFromEntities(
          BusinessObjectFormatEntity businessObjectFormatEntity, ExternalInterfaceEntity externalInterfaceEntity)
focal_method.full_signature: public BusinessObjectFormatExternalInterfaceDescriptiveInformation createBusinessObjectFormatExternalInterfaceDescriptiveInformationFromEntities(
          BusinessObjectFormatEntity businessObjectFormatEntity, ExternalInterfaceEntity externalInterfaceEntity)
focal_method.identifier: createBusinessObjectFormatExternalInterfaceDescriptiveInformationFromEntities
focal_method.invocations: createBusinessObjectFormatFromEntity getNamespace getBusinessObjectDefinitionName getBusinessObjectFormatUsage getBusinessObjectFormatFileType getCode newHashMap put put put put getNamespace put getBusinessObjectDefinitionName put getBusinessObjectFormatUsage put getBusinessObjectFormatFileType newLinkedHashMap getAttributes put getName getValue put newLinkedList getSchema getPartitions getSchema add getName put getPartitionKeyGroup put getPartitionKeyGroupName getPartitionKeyGroup put evaluate getDescription format getCode getMessage error getDisplayName
focal_method.modifiers: public
focal_method.parameters: (
          BusinessObjectFormatEntity businessObjectFormatEntity, ExternalInterfaceEntity externalInterfaceEntity)
focal_method.return: BusinessObjectFormatExternalInterfaceDescriptiveInformation
focal_method.signature: BusinessObjectFormatExternalInterfaceDescriptiveInformation createBusinessObjectFormatExternalInterfaceDescriptiveInformationFromEntities(
          BusinessObjectFormatEntity businessObjectFormatEntity, ExternalInterfaceEntity externalInterfaceEntity)