forked from sqlancer/sqlancer
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathTestFelderaClient.java
More file actions
52 lines (41 loc) · 1.45 KB
/
TestFelderaClient.java
File metadata and controls
52 lines (41 loc) · 1.45 KB
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
package sqlancer.feldera.client;
import com.fasterxml.jackson.databind.ObjectMapper;
import com.fasterxml.jackson.databind.node.ObjectNode;
import org.junit.Test;
import java.util.Map;
public class TestFelderaClient {
private static final ObjectMapper mapper = new ObjectMapper();
private static final FelderaClient client = new FelderaClient("http://localhost:8080");
@Test
public void testCreatePipeline() throws Exception {
String name = "testpipeline0";
ObjectNode node = mapper.createObjectNode();
node.put("name", name);
node.put("description", "sqlancerTest");
node.put("program_code", "");
node.putObject("runtime_config");
node.putObject("program_config");
client.createPipeline(name, node.toString());
}
@Test
public void testGetPipeline() throws Exception {
String name = "testpipeline0";
FelderaPipeline p = client.getPipeline(name);
assert p.getName().equals(name);
}
@Test
public void testStateChanges() throws Exception {
String name = "testpipeline0";
client.start(name);
client.pause(name);
client.shutdown(name);
}
@Test
public void testSelect() throws Exception {
String name = "testpipeline0";
client.start(name);
Map<String, Object> resp = client.exec(name, "select 1 as c");
client.shutdown(name);
assert (Integer) resp.get("c") == 1;
}
}