RetentionExpirationDestroyerController { protected BusinessObjectDataKey getBusinessObjectDataKey(String[] line, int lineNumber, File inputCsvFile) { if (line.length != CSV_FILE_HEADER_COLUMNS.length) { throw new IllegalArgumentException( String.format("Line number %d of input file \"%s\" does not match the expected format.", lineNumber, inputCsvFile.toString())); } Integer businessObjectFormatVersion; Integer businessObjectDataVersion; try { businessObjectFormatVersion = Integer.valueOf(line[4]); } catch (NumberFormatException e) { throw new IllegalArgumentException(String .format("Line number %d of input file \"%s\" does not match the expected format. Business object format version must be an integer.", lineNumber, inputCsvFile.toString()), e); } try { businessObjectDataVersion = Integer.valueOf(line[10]); } catch (NumberFormatException e) { throw new IllegalArgumentException(String .format("Line number %d of input file \"%s\" does not match the expected format. Business object data version must be an integer.", lineNumber, inputCsvFile.toString()), e); } List<String> subPartitionValues = new ArrayList<>(); for (String subPartitionValue : Arrays.asList(line[6], line[7], line[8], line[9])) { if (StringUtils.isNotBlank(subPartitionValue)) { subPartitionValues.add(subPartitionValue); } else { break; } } return new BusinessObjectDataKey(line[0], line[1], line[2], line[3], businessObjectFormatVersion, line[5], subPartitionValues, businessObjectDataVersion); }  void performRetentionExpirationDestruction(File localInputFile, RegServerAccessParamsDto regServerAccessParamsDto);  }
@Test public void testGetBusinessObjectDataKeyInvalidBusinessObjectDataVersion() { try { String[] line = {NAMESPACE, BUSINESS_OBJECT_DEFINITION_NAME, BUSINESS_OBJECT_FORMAT_USAGE, BUSINESS_OBJECT_FORMAT_FILE_TYPE, BUSINESS_OBJECT_FORMAT_VERSION.toString(), PRIMARY_PARTITION_VALUE, SUB_PARTITION_VALUES.get(0), SUB_PARTITION_VALUES.get(1), SUB_PARTITION_VALUES.get(2), SUB_PARTITION_VALUES.get(3), INVALID_INTEGER_VALUE, BUSINESS_OBJECT_DEFINITION_DISPLAY_NAME, BUSINESS_OBJECT_DEFINITION_URI}; retentionExpirationDestroyerController.getBusinessObjectDataKey(line, LINE_NUMBER, new File(LOCAL_FILE)); fail(); } catch (IllegalArgumentException e) { assertEquals(String .format("Line number %d of input file \"%s\" does not match the expected format. Business object data version must be an integer.", LINE_NUMBER, LOCAL_FILE), e.getMessage()); } }
@Test public void testGetBusinessObjectDataKeyInvalidBusinessObjectFormatVersion() { try { String[] line = {NAMESPACE, BUSINESS_OBJECT_DEFINITION_NAME, BUSINESS_OBJECT_FORMAT_USAGE, BUSINESS_OBJECT_FORMAT_FILE_TYPE, INVALID_INTEGER_VALUE, PRIMARY_PARTITION_VALUE, SUB_PARTITION_VALUES.get(0), SUB_PARTITION_VALUES.get(1), SUB_PARTITION_VALUES.get(2), SUB_PARTITION_VALUES.get(3), BUSINESS_OBJECT_DATA_VERSION.toString(), BUSINESS_OBJECT_DEFINITION_DISPLAY_NAME, BUSINESS_OBJECT_DEFINITION_URI}; retentionExpirationDestroyerController.getBusinessObjectDataKey(line, LINE_NUMBER, new File(LOCAL_FILE)); fail(); } catch (IllegalArgumentException e) { assertEquals(String .format("Line number %d of input file \"%s\" does not match the expected format. Business object format version must be an integer.", LINE_NUMBER, LOCAL_FILE), e.getMessage()); } }
@Test public void testGetBusinessObjectDataKeyInvalidCsvLineFormat() { try { String[] line = {}; retentionExpirationDestroyerController.getBusinessObjectDataKey(line, LINE_NUMBER, new File(LOCAL_FILE)); fail(); } catch (IllegalArgumentException e) { assertEquals(String.format("Line number %d of input file \"%s\" does not match the expected format.", LINE_NUMBER, LOCAL_FILE), e.getMessage()); } }