Skip to content

Commit

Permalink
remove deprecated droppoffutil methods (#562)
Browse files Browse the repository at this point in the history
  • Loading branch information
dev-mlb authored Oct 2, 2023
1 parent f81ef95 commit cf923e4
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 125 deletions.
74 changes: 0 additions & 74 deletions src/main/java/emissary/output/DropOffUtil.java
Original file line number Diff line number Diff line change
Expand Up @@ -151,16 +151,6 @@ protected void configure(final Configurator configG) {
}
}

/**
* This method is deprecated, the casename is ignored. Use the no-arg version
*
* @param casename ignored value
*/
@Deprecated
public String generateBuildFileName(final String casename) {
return generateBuildFileName();
}

/**
* Generate a new random build file name using the configured prefix and stragety
*/
Expand Down Expand Up @@ -654,70 +644,6 @@ public String makeDotFile(final String fullName) {
return fullName.substring(0, pos + 1) + "." + fullName.substring(pos + 1);
}

/**
* Get the file type from the metadata or the form string passed in
*
* @param metaData map of payload metadata
* @return the file type (also added to metaData if not present)
*/
@Deprecated
public String getFileType(final Map<String, String> metaData) {
return getFileType(metaData, null);
}

/**
* Get the file type from the metadata or the form string passed in
*
* @param metaData map of payload metadata
* @param formsArg space separated string of current forms
* @return the file type (also added to metaData if not present)
*/
@Deprecated
public String getFileType(final Map<String, String> metaData, final String formsArg) {
String forms = formsArg;
if (forms == null) {
forms = metaData.get(FileTypeCheckParameter.POPPED_FORMS.getFieldName());
if (forms == null) {
forms = "";
}
}

String fileType;
if (metaData.containsKey(FileTypeCheckParameter.FILETYPE.getFieldName())) {
fileType = metaData.get(FileTypeCheckParameter.FILETYPE.getFieldName());
} else if (metaData.containsKey(FileTypeCheckParameter.FINAL_ID.getFieldName())) {
fileType = metaData.get(FileTypeCheckParameter.FINAL_ID.getFieldName());
logger.debug("FINAL_ID FileType is ({})", fileType);
metaData.put(FileTypeCheckParameter.FILETYPE.getFieldName(), fileType);
} else {
if (forms.contains(" ")) {
fileType = forms.substring(0, forms.indexOf(" ")).trim();
metaData.put(FileTypeCheckParameter.COMPLETE_FILETYPE.getFieldName(), forms);
} else {
fileType = forms;
}
if (StringUtils.isEmpty(fileType)) {
if (metaData.containsKey(FileTypeCheckParameter.FONT_ENCODING.getFieldName())) {
fileType = TEXT;
} else {
fileType = UNKNOWN;
}
}

metaData.put(FileTypeCheckParameter.FILETYPE.getFieldName(), fileType);
}

if (UNKNOWN.equals(fileType) && forms.contains("MSWORD")) {
fileType = "MSWORD_FRAGMENT";
}

if ("QUOTED-PRINTABLE".equals(fileType) || fileType.startsWith(PREFIXES_LANG) || fileType.startsWith("ENCODING(")) {
fileType = TEXT;
}

return fileType;
}

/**
* Get the file type from the metadata or the form string passed in
*
Expand Down
51 changes: 0 additions & 51 deletions src/test/java/emissary/output/DropOffUtilTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@
import java.util.Set;

import static emissary.core.Form.TEXT;
import static emissary.core.Form.UNKNOWN;
import static emissary.core.constants.Parameters.EVENT_DATE;
import static emissary.core.constants.Parameters.FILE_DATE;
import static emissary.core.constants.Parameters.ORIGINAL_FILENAME;
Expand Down Expand Up @@ -477,56 +476,6 @@ void testGetEventDate() {
assertNull(this.util.getEventDate(d, tld));
}

@Deprecated
@Test
void testDeprecatedGetFileType() {
Map<String, String> metadata = new HashMap<>();
testDeprecatedFileType(metadata, UNKNOWN, null);

String poppedForms = "myPoppedForms";
setupDeprecatedMetadata(metadata, poppedForms, DropOffUtil.FileTypeCheckParameter.POPPED_FORMS);
testDeprecatedFileType(metadata, poppedForms, null);

String formsArg = "myFile";
setupDeprecatedMetadata(metadata, formsArg, DropOffUtil.FileTypeCheckParameter.FILETYPE);
testDeprecatedFileType(metadata, formsArg, formsArg);

String finalId = "myFinalId";
setupDeprecatedMetadata(metadata, finalId, DropOffUtil.FileTypeCheckParameter.FINAL_ID);
formsArg = "differentFileType";
testDeprecatedFileType(metadata, finalId, formsArg);

formsArg = "myFile ";
metadata.clear();
testDeprecatedFileType(metadata, "myFile", formsArg);
assertEquals(formsArg,
metadata.get(DropOffUtil.FileTypeCheckParameter.COMPLETE_FILETYPE.getFieldName()));

formsArg = "";
String fontEncoding = "fontEncoding";
setupDeprecatedMetadata(metadata, fontEncoding, DropOffUtil.FileTypeCheckParameter.FONT_ENCODING);
testDeprecatedFileType(metadata, TEXT, formsArg);

metadata.clear();
formsArg = " MSWORD";
testDeprecatedFileType(metadata, "MSWORD_FRAGMENT", formsArg);

metadata.clear();
formsArg = "QUOTED-PRINTABLE";
testDeprecatedFileType(metadata, TEXT, formsArg);
}

private void setupDeprecatedMetadata(Map<String, String> metadata, String fieldValue, DropOffUtil.FileTypeCheckParameter fileTypeCheckParameter) {
metadata.clear();
metadata.put(fileTypeCheckParameter.getFieldName(), fieldValue);
}

private void testDeprecatedFileType(Map<String, String> metadata, String expectedResults, String formsArg) {
String fileType;
fileType = util.getFileType(metadata, formsArg);
assertEquals(expectedResults, fileType);
}

@Test
void testGetFileType() {
final IBaseDataObject bdo = new BaseDataObject();
Expand Down

0 comments on commit cf923e4

Please sign in to comment.