test_class.file: herd-code/herd-service/src/test/java/org/finra/herd/service/helper/BusinessObjectDataSearchHelperTest.java
test_class.identifier: BusinessObjectDataSearchHelperTest
test_class.superclass: extends AbstractServiceTest
test_case.body: @Test
      public void testValidateBusinessObjectDataSearchKey() throws Exception
      {
          // Create a registration date range filter.
          XMLGregorianCalendar startRegistrationDate = DatatypeFactory.newInstance().newXMLGregorianCalendar("2018-04-01");
          XMLGregorianCalendar endRegistrationDate = DatatypeFactory.newInstance().newXMLGregorianCalendar("2018-04-02");
          RegistrationDateRangeFilter registrationDateRangeFilter = new RegistrationDateRangeFilter(startRegistrationDate, endRegistrationDate);
  
          // Create attribute value filters.
          List<AttributeValueFilter> attributeValueFilters =
              Arrays.asList(new AttributeValueFilter(ATTRIBUTE_NAME, ATTRIBUTE_VALUE), new AttributeValueFilter(ATTRIBUTE_NAME_2, ATTRIBUTE_VALUE_2));
  
          // Create a business object data search key.
          BusinessObjectDataSearchKey businessObjectDataSearchKey =
              new BusinessObjectDataSearchKey(BDEF_NAMESPACE, BDEF_NAME, FORMAT_USAGE_CODE, FORMAT_FILE_TYPE_CODE, FORMAT_VERSION, NO_PARTITION_VALUE_FILTERS,
                  registrationDateRangeFilter, attributeValueFilters, FILTER_ON_LATEST_VALID_VERSION, FILTER_ON_RETENTION_EXPIRATION);
  
          // Clone the original business object data search key to validate the results.
          BusinessObjectDataSearchKey originalBusinessObjectDataSearchKey = (BusinessObjectDataSearchKey) businessObjectDataSearchKey.clone();
  
          // Call the method under test.
          businessObjectDataSearchHelper.validateBusinessObjectDataSearchKey(businessObjectDataSearchKey);
  
          // Validate the results. We expect no changes to the business object data search key.
          assertEquals(originalBusinessObjectDataSearchKey, businessObjectDataSearchKey);
      }
test_case.class_method_signature: BusinessObjectDataSearchHelperTest.testValidateBusinessObjectDataSearchKey()
test_case.full_signature: @Test public void testValidateBusinessObjectDataSearchKey()
test_case.identifier: testValidateBusinessObjectDataSearchKey
test_case.invocations: newXMLGregorianCalendar newInstance newXMLGregorianCalendar newInstance asList clone validateBusinessObjectDataSearchKey assertEquals
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testValidateBusinessObjectDataSearchKey()
focal_class.declarator: alternateKeyHelper
focal_class.modifier: @Autowired
      private
focal_class.original_string: @Autowired
      private AlternateKeyHelper alternateKeyHelper;
focal_class.type: AlternateKeyHelper
focal_class.var_name: alternateKeyHelper
focal_class.declarator: businessObjectDataHelper
focal_class.modifier: @Autowired
      private
focal_class.original_string: @Autowired
      private BusinessObjectDataHelper businessObjectDataHelper;
focal_class.type: BusinessObjectDataHelper
focal_class.var_name: businessObjectDataHelper
focal_class.declarator: configurationHelper
focal_class.modifier: @Autowired
      private
focal_class.original_string: @Autowired
      private ConfigurationHelper configurationHelper;
focal_class.type: ConfigurationHelper
focal_class.var_name: configurationHelper
focal_class.file: herd-code/herd-service/src/main/java/org/finra/herd/service/helper/BusinessObjectDataSearchHelper.java
focal_class.identifier: BusinessObjectDataSearchHelper
focal_class.class_method_signature: BusinessObjectDataSearchHelper.validateBusinessObjectDataSearchRequest(BusinessObjectDataSearchRequest businessObjectDataSearchRequest)
focal_class.full_signature: public void validateBusinessObjectDataSearchRequest(BusinessObjectDataSearchRequest businessObjectDataSearchRequest)
focal_class.identifier: validateBusinessObjectDataSearchRequest
focal_class.modifiers: public
focal_class.parameters: (BusinessObjectDataSearchRequest businessObjectDataSearchRequest)
focal_class.return: void
focal_class.signature: void validateBusinessObjectDataSearchRequest(BusinessObjectDataSearchRequest businessObjectDataSearchRequest)
focal_class.class_method_signature: BusinessObjectDataSearchHelper.validatePagingParameter(String parameterName, Integer parameterValue, Integer defaultParameterValue, Integer maxParameterValue)
focal_class.full_signature: public Integer validatePagingParameter(String parameterName, Integer parameterValue, Integer defaultParameterValue, Integer maxParameterValue)
focal_class.identifier: validatePagingParameter
focal_class.modifiers: public
focal_class.parameters: (String parameterName, Integer parameterValue, Integer defaultParameterValue, Integer maxParameterValue)
focal_class.return: Integer
focal_class.signature: Integer validatePagingParameter(String parameterName, Integer parameterValue, Integer defaultParameterValue, Integer maxParameterValue)
focal_class.class_method_signature: BusinessObjectDataSearchHelper.validateBusinessObjectDataSearchKey(BusinessObjectDataSearchKey businessObjectDataSearchKey)
focal_class.full_signature:  void validateBusinessObjectDataSearchKey(BusinessObjectDataSearchKey businessObjectDataSearchKey)
focal_class.identifier: validateBusinessObjectDataSearchKey
focal_class.parameters: (BusinessObjectDataSearchKey businessObjectDataSearchKey)
focal_class.return: void
focal_class.signature: void validateBusinessObjectDataSearchKey(BusinessObjectDataSearchKey businessObjectDataSearchKey)
focal_method.body: void validateBusinessObjectDataSearchKey(BusinessObjectDataSearchKey businessObjectDataSearchKey)
      {
          Assert.notNull(businessObjectDataSearchKey, "A business object data search key must be specified.");
  
          businessObjectDataSearchKey.setNamespace(alternateKeyHelper.validateStringParameter("namespace", businessObjectDataSearchKey.getNamespace()));
          businessObjectDataSearchKey.setBusinessObjectDefinitionName(
              alternateKeyHelper.validateStringParameter("business object definition name", businessObjectDataSearchKey.getBusinessObjectDefinitionName()));
  
          if (businessObjectDataSearchKey.getBusinessObjectFormatUsage() != null)
          {
              businessObjectDataSearchKey.setBusinessObjectFormatUsage(businessObjectDataSearchKey.getBusinessObjectFormatUsage().trim());
          }
  
          if (businessObjectDataSearchKey.getBusinessObjectFormatFileType() != null)
          {
              businessObjectDataSearchKey.setBusinessObjectFormatFileType(businessObjectDataSearchKey.getBusinessObjectFormatFileType().trim());
          }
  
          // Validate partition value filters, if specified.
          if (CollectionUtils.isNotEmpty(businessObjectDataSearchKey.getPartitionValueFilters()))
          {
              businessObjectDataHelper.validatePartitionValueFilters(businessObjectDataSearchKey.getPartitionValueFilters(), null, false);
  
              // TODO: For now, we only support partition values or partition range in the filter.
              for (PartitionValueFilter partitionValueFilter : businessObjectDataSearchKey.getPartitionValueFilters())
              {
                  List<String> partitionValues = partitionValueFilter.getPartitionValues();
                  PartitionValueRange partitionValueRange = partitionValueFilter.getPartitionValueRange();
  
                  // The partition values array should not be empty and partition vale range start and end value should not be empty
                  // as it is done above at businessObjectDataHelper.validatePartitionValueFilters().
                  if (CollectionUtils.isEmpty(partitionValues) && partitionValueRange == null)
                  {
                      throw new IllegalArgumentException("Only partition values or partition range are supported in partition value filter.");
                  }
              }
          }
  
          // Validate registration date range filter, if specified.
          if (businessObjectDataSearchKey.getRegistrationDateRangeFilter() != null)
          {
              businessObjectDataHelper.validateRegistrationDateRangeFilter(businessObjectDataSearchKey.getRegistrationDateRangeFilter());
          }
  
          // Validate attribute value filters, if specified.
          if (CollectionUtils.isNotEmpty(businessObjectDataSearchKey.getAttributeValueFilters()))
          {
              for (AttributeValueFilter attributeValueFilter : businessObjectDataSearchKey.getAttributeValueFilters())
              {
                  if (attributeValueFilter.getAttributeName() != null)
                  {
                      attributeValueFilter.setAttributeName(attributeValueFilter.getAttributeName().trim());
                  }
                  if (StringUtils.isBlank(attributeValueFilter.getAttributeName()) && StringUtils.isEmpty(attributeValueFilter.getAttributeValue()))
                  {
                      throw new IllegalArgumentException("Either attribute name or attribute value filter must be specified.");
                  }
              }
          }
      }
focal_method.class_method_signature: BusinessObjectDataSearchHelper.validateBusinessObjectDataSearchKey(BusinessObjectDataSearchKey businessObjectDataSearchKey)
focal_method.full_signature:  void validateBusinessObjectDataSearchKey(BusinessObjectDataSearchKey businessObjectDataSearchKey)
focal_method.identifier: validateBusinessObjectDataSearchKey
focal_method.invocations: notNull setNamespace validateStringParameter getNamespace setBusinessObjectDefinitionName validateStringParameter getBusinessObjectDefinitionName getBusinessObjectFormatUsage setBusinessObjectFormatUsage trim getBusinessObjectFormatUsage getBusinessObjectFormatFileType setBusinessObjectFormatFileType trim getBusinessObjectFormatFileType isNotEmpty getPartitionValueFilters validatePartitionValueFilters getPartitionValueFilters getPartitionValueFilters getPartitionValues getPartitionValueRange isEmpty getRegistrationDateRangeFilter validateRegistrationDateRangeFilter getRegistrationDateRangeFilter isNotEmpty getAttributeValueFilters getAttributeValueFilters getAttributeName setAttributeName trim getAttributeName isBlank getAttributeName isEmpty getAttributeValue
focal_method.parameters: (BusinessObjectDataSearchKey businessObjectDataSearchKey)
focal_method.return: void
focal_method.signature: void validateBusinessObjectDataSearchKey(BusinessObjectDataSearchKey businessObjectDataSearchKey)