Skip to content

Commit

Permalink
Revert "java/105-useshed-usecache-flags (#259)"
Browse files Browse the repository at this point in the history
This reverts commit 5714526.
  • Loading branch information
Philip Stadermann committed Aug 14, 2023
1 parent b490e52 commit a1dab46
Show file tree
Hide file tree
Showing 6 changed files with 108 additions and 294 deletions.
1 change: 1 addition & 0 deletions java/src/main/java/de/gdata/vaas/SimpleTimer.java
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

import java.time.Duration;
import java.time.Instant;
import java.time.temporal.TemporalUnit;
import java.util.concurrent.TimeUnit;

public class SimpleTimer {
Expand Down
309 changes: 100 additions & 209 deletions java/src/main/java/de/gdata/vaas/Vaas.java

Large diffs are not rendered by default.

24 changes: 0 additions & 24 deletions java/src/main/java/de/gdata/vaas/messages/VaasOptions.java

This file was deleted.

40 changes: 0 additions & 40 deletions java/src/main/java/de/gdata/vaas/messages/VerdictRequest.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import lombok.Getter;
import lombok.NonNull;
import lombok.Setter;
import org.jetbrains.annotations.Nullable;

import java.util.UUID;

Expand All @@ -26,16 +25,6 @@ public class VerdictRequest extends MessageType {
@Setter
@SerializedName("verdict_request_attributes")
VerdictRequestAttributes verdictRequestAttributes;
@Getter
@Setter
@Nullable
@SerializedName("use_hash_lookup")
boolean UseHashLookup;
@Getter
@Setter
@Nullable
@SerializedName("use_cache")
boolean UseCache;

public VerdictRequest(Sha256 sha256, String sessionId) {
super(Kind.VerdictRequest);
Expand All @@ -44,40 +33,11 @@ public VerdictRequest(Sha256 sha256, String sessionId) {
this.sha256 = sha256.getValue();
}

public VerdictRequest(Sha256 sha256, String sessionId, UUID guid) {
super(Kind.VerdictRequest);
this.sessionId = sessionId;
this.guid = guid.toString();
this.sha256 = sha256.getValue();
}

public VerdictRequest(Sha256 sha256, String sessionId, VerdictRequestAttributes verdictRequestAttributes) {
this(sha256, sessionId);
this.verdictRequestAttributes = verdictRequestAttributes;
}

public VerdictRequest(Sha256 sha256, String sessionId, VaasOptions options) {
this(sha256, sessionId);
this.UseCache = options.UseCache;
this.UseHashLookup = options.UseHashLookup;
}

public VerdictRequest(Sha256 sha256, String sessionId, UUID guid, VerdictRequestAttributes verdictRequestAttributes) {
this(sha256, sessionId, guid);
this.verdictRequestAttributes = verdictRequestAttributes;
}

public VerdictRequest(Sha256 sha256, String sessionId, UUID guid, VaasOptions options) {
this(sha256, sessionId, guid);
this.UseCache = options.UseCache;
this.UseHashLookup = options.UseHashLookup;
}

public VerdictRequest(Sha256 sha256, String sessionId, UUID guid, VerdictRequestAttributes verdictRequestAttributes, VaasOptions options) {
this(sha256, sessionId, guid, options);
this.verdictRequestAttributes = verdictRequestAttributes;
}

public String toJson() {
return new GsonBuilder().serializeNulls().create().toJson(this);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
import lombok.Getter;
import lombok.NonNull;
import lombok.Setter;
import org.jetbrains.annotations.Nullable;

import java.net.URL;
import java.util.UUID;
Expand All @@ -27,36 +26,22 @@ public class VerdictRequestForUrl extends MessageType {
@SerializedName("verdict_request_attributes")
VerdictRequestAttributes verdictRequestAttributes;
@Getter
@SerializedName("use_hash_lookup")
transient boolean UseHashLookup;
@Getter
@Setter
@SerializedName("use_cache")
boolean UseCache;
boolean useCache = true;

public VerdictRequestForUrl(URL url, String sessionId, UUID guid) {
public VerdictRequestForUrl(URL url, String sessionId) {
super(Kind.VerdictRequestForUrl);
this.sessionId = sessionId;
this.guid = guid.toString();
this.guid = UUID.randomUUID().toString();
this.url = url.toString();
}

public VerdictRequestForUrl(URL url, String sessionId, UUID guid, VerdictRequestAttributes verdictRequestAttributes) {
this(url, sessionId, guid);
this.verdictRequestAttributes = verdictRequestAttributes;
}

public VerdictRequestForUrl(URL url, String sessionId, UUID guid, VaasOptions options) {
this(url, sessionId, guid);
this.UseCache = options.UseCache;
this.UseHashLookup = options.UseHashLookup;
}

public VerdictRequestForUrl(URL url, String sessionId, UUID guid, VerdictRequestAttributes verdictRequestAttributes, VaasOptions options) {
this(url, sessionId, guid);
public VerdictRequestForUrl(URL url, String sessionId, VerdictRequestAttributes verdictRequestAttributes) {
this(url, sessionId);
this.verdictRequestAttributes = verdictRequestAttributes;
}


public String toJson() {
return new Gson().toJson(this);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,7 @@ public String getToken() throws IOException, InterruptedException {
var dotenv = Dotenv.configure()
.ignoreIfMissing()
.load();
var tokenUrl = dotenv.get("TOKEN_URL");
var vaasUrl = dotenv.get("VAAS_URL");
var config = new VaasConfig(new URI(vaasUrl));
var authenticator = new MockAuthenticator();
Expand Down

0 comments on commit a1dab46

Please sign in to comment.