Skip to content

Commit

Permalink
Merge pull request #437 from GDATASoftwareAG/single-deteciton
Browse files Browse the repository at this point in the history
java: Single detection; Flatten libmagic object
  • Loading branch information
lennartdohmann committed Apr 29, 2024
2 parents 63c2caa + b980663 commit de85f49
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 28 deletions.
17 changes: 0 additions & 17 deletions java/src/main/java/de/gdata/vaas/messages/LibMagic.java

This file was deleted.

11 changes: 7 additions & 4 deletions java/src/main/java/de/gdata/vaas/messages/VaasVerdict.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,14 +13,17 @@ public class VaasVerdict {
@NonNull
Verdict verdict;
@Getter
ArrayList<Detection> detections;
String detection;
@Getter
LibMagic libMagic;
String fileType;
@Getter
String mimeType;

public VaasVerdict(VerdictResponse verdictResponse) {
this.sha256 = verdictResponse.sha256;
this.verdict = verdictResponse.verdict;
this.detections = verdictResponse.detections;
this.libMagic = verdictResponse.libMagic;
this.detection = verdictResponse.detection;
this.fileType = verdictResponse.fileType;
this.mimeType = verdictResponse.mimeType;
}
}
11 changes: 7 additions & 4 deletions java/src/main/java/de/gdata/vaas/messages/VerdictResponse.java
Original file line number Diff line number Diff line change
Expand Up @@ -27,11 +27,14 @@ public class VerdictResponse extends MessageType {
@SerializedName("upload_token")
String uploadToken;
@Getter
@SerializedName("detections")
ArrayList<Detection> detections;
@SerializedName("detection")
String detection;
@Getter
@SerializedName("lib_magic")
LibMagic libMagic;
@SerializedName("file_type")
String fileType;
@Getter
@SerializedName("mime_type")
String mimeType;

private VerdictResponse() {
super(Kind.VerdictResponse);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -524,9 +524,9 @@ public void forStream_WithEicarFile_ReturnsMaliciousVerdictWithDetections() thro
var vaas = this.getVaasWithCredentials();
var verdict = vaas.forStream(inputStream, contentLength);

assertNotNull(verdict.getDetections());
assertNotNull(verdict.getDetection());
assertEquals(Verdict.MALICIOUS, verdict.getVerdict());
assertEquals("EICAR virus test files", verdict.getLibMagic().getFileType());
assertEquals("text/plain", verdict.getLibMagic().getMimeType());
assertEquals("EICAR virus test files", verdict.getFileType());
assertEquals("text/plain", verdict.getMimeType());
}
}

0 comments on commit de85f49

Please sign in to comment.