-
Notifications
You must be signed in to change notification settings - Fork 4
/
FacesFunctionsTest.java
53 lines (42 loc) · 1.69 KB
/
FacesFunctionsTest.java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
package com.example.fn;
import com.fnproject.fn.testing.*;
import org.junit.*;
import static org.junit.Assert.*;
public class FacesFunctionsTest {
@Rule
public final FnTestingRule testing = FnTestingRule.createDefault();
String sampleEvent = "{\n" +
" \"eventType\": \"com.oraclecloud.objectstorage.object.create\",\n" +
" \"eventTypeVersion\": \"1.0\",\n" +
" \"cloudEventsVersion\": \"0.1\",\n" +
" \"source\": \"/service/objectstorage/resourceType/object\",\n" +
" \"eventID\": \"dead-beef-abcd-1234\",\n" +
" \"eventTime\": \"2018-04-12T23:20:50.52Z\",\n" +
" \"extensions\": {\n" +
" \"compartmentId\": \"ocidv1.customerfoo.compartment.abcd\"\n" +
" },\n" +
" \"data\": {\n" +
" \"resourceName\": \"resource-name.jpg\",\n" +
" \"additionalDetails\": {\n" +
" \"bucketId\": \"ocid1.bucket.oc1.phx.aaa...jlljq\",\n" +
" \"bucketName\": \"facedetection-incoming\",\n" +
" \"namespace\": \"tenant-name\"\n" +
" }\n" +
" }\n" +
"}\n";
@Ignore
@Test
public void shouldFindFacesInBasicImage() {
testing.addSharedClass(OpenCVInit.class);
testing.addSharedClassPrefix("org.opencv.");
testing.setConfig("OUTPUT_BUCKET", "facedetection-result");
testing.setConfig("OCI_REGION", "us-phoenix-1");
testing.givenEvent()
.withHeader("Content-Type","application/cloudevents+json")
.withBody(sampleEvent)
.enqueue();
testing.thenRun(FacesFunctions.class, "handleRequest");
FnResult result = testing.getOnlyResult();
assertEquals("ok", result.getBodyAsString());
}
}