Skip to content

Commit 4d135ed

Browse files
author
Sergey Shelomentsev
committed
chore: back functional tests
1 parent 593424c commit 4d135ed

File tree

3 files changed

+76
-1
lines changed

3 files changed

+76
-1
lines changed

build.gradle

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -134,4 +134,12 @@ tasks.register('removeWrongDocumentationLinks') {
134134
}
135135
}
136136
}
137-
removeWrongDocumentationLinks.dependsOn tasks.copyDocs
137+
removeWrongDocumentationLinks.dependsOn tasks.copyDocs
138+
139+
tasks.register('runFunctionalTests', JavaExec) {
140+
group = "execute"
141+
description = "Run the Functional Tests"
142+
classpath = sourceSets.main.runtimeClasspath
143+
main = 'com.fingerprint.example.FunctionalTests'
144+
}
145+
runFunctionalTests.dependsOn tasks.compileJava
Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
package com.fingerprint.example;
2+
3+
import com.fingerprint.api.FingerprintApi;
4+
import com.fingerprint.sdk.ApiClient;
5+
import com.fingerprint.sdk.ApiException;
6+
import com.fingerprint.sdk.Configuration;
7+
8+
public class FunctionalTests {
9+
public static void main(String... args) {
10+
String FPJS_API_SECRET = System.getenv("FPJS_API_SECRET");
11+
String FPJS_VISITOR_ID = System.getenv("FPJS_VISITOR_ID");
12+
String FPJS_REQUEST_ID = System.getenv("FPJS_REQUEST_ID");
13+
String FPJS_API_REGION = System.getenv("FPJS_API_REGION");
14+
15+
// Create a new instance of the API client
16+
ApiClient client = Configuration.getDefaultApiClient(FPJS_API_SECRET, FPJS_API_REGION != null ? FPJS_API_REGION : "us");
17+
FingerprintApi api = new FingerprintApi(client);
18+
19+
20+
// Get identification event
21+
try {
22+
final Object event = api.getEvent(FPJS_REQUEST_ID);
23+
System.out.println(event);
24+
} catch (ApiException e) {
25+
System.err.println("Exception when calling FingerprintApi.getEvent:" + e.getMessage());
26+
System.exit(1);
27+
}
28+
29+
// Get visitor history
30+
try {
31+
final Object visits = api.getVisits(FPJS_VISITOR_ID, null, null, null, null, null);
32+
System.out.println(visits);
33+
} catch (ApiException e) {
34+
System.err.println("Exception when calling FingerprintApi.getEvent:" + e.getMessage());
35+
System.exit(1);
36+
}
37+
38+
System.out.println("Checks Passed");
39+
System.exit(0);
40+
}
41+
}
Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
package com.fingerprint.example;
2+
3+
import com.fingerprint.Sealed;
4+
import com.fingerprint.model.EventResponse;
5+
6+
import java.util.Base64;
7+
8+
public class SealedResults {
9+
public static void main(String... args) throws Exception {
10+
String SEALED_RESULT = System.getenv("BASE64_SEALED_RESULT");
11+
String SEALED_KEY = System.getenv("BASE64_KEY");
12+
13+
final EventResponse event = Sealed.unsealEventResponse(
14+
Base64.getDecoder().decode(SEALED_RESULT),
15+
new Sealed.DecryptionKey[]{
16+
new Sealed.DecryptionKey(
17+
Base64.getDecoder().decode(SEALED_KEY),
18+
Sealed.DecryptionAlgorithm.AES_256_GCM
19+
)
20+
}
21+
);
22+
23+
System.out.println(event);
24+
System.exit(0);
25+
}
26+
}

0 commit comments

Comments
 (0)