| Nils Diewald | 14b3aa4 | 2015-02-26 22:26:20 +0000 | [diff] [blame] | 1 | package de.ids_mannheim.korap.server; |
| Nils Diewald | ff6f766 | 2014-09-21 15:08:52 +0000 | [diff] [blame] | 2 | |
| Nils Diewald | ff6f766 | 2014-09-21 15:08:52 +0000 | [diff] [blame] | 3 | import java.io.*; |
| Nils Diewald | d723d81 | 2014-09-23 18:50:52 +0000 | [diff] [blame] | 4 | import java.util.ArrayList; |
| 5 | import java.util.List; |
| 6 | |
| Nils Diewald | ff6f766 | 2014-09-21 15:08:52 +0000 | [diff] [blame] | 7 | import javax.ws.rs.client.Client; |
| 8 | import javax.ws.rs.client.ClientBuilder; |
| 9 | import javax.ws.rs.client.WebTarget; |
| 10 | import javax.ws.rs.client.Entity; |
| 11 | |
| Akron | 67d2ff0 | 2018-06-19 10:51:16 +0200 | [diff] [blame] | 12 | import static de.ids_mannheim.korap.TestSimple.*; |
| 13 | |
| Nils Diewald | ff6f766 | 2014-09-21 15:08:52 +0000 | [diff] [blame] | 14 | import org.glassfish.grizzly.http.server.HttpServer; |
| 15 | |
| Nils Diewald | d723d81 | 2014-09-23 18:50:52 +0000 | [diff] [blame] | 16 | import static org.junit.Assert.*; |
| Nils Diewald | ff6f766 | 2014-09-21 15:08:52 +0000 | [diff] [blame] | 17 | import org.junit.After; |
| 18 | import org.junit.Before; |
| 19 | import org.junit.Test; |
| Nils Diewald | ff6f766 | 2014-09-21 15:08:52 +0000 | [diff] [blame] | 20 | |
| 21 | import java.io.FileInputStream; |
| 22 | |
| Nils Diewald | 14b3aa4 | 2015-02-26 22:26:20 +0000 | [diff] [blame] | 23 | import de.ids_mannheim.korap.server.Node; |
| Nils Diewald | 884dbcf | 2015-02-27 17:02:28 +0000 | [diff] [blame] | 24 | import de.ids_mannheim.korap.response.Result; |
| Nils Diewald | 0881e24 | 2015-02-27 17:31:01 +0000 | [diff] [blame] | 25 | import de.ids_mannheim.korap.response.Response; |
| Nils Diewald | c383ed0 | 2015-02-26 21:35:22 +0000 | [diff] [blame] | 26 | import static de.ids_mannheim.korap.util.KrillString.*; |
| Nils Diewald | ff6f766 | 2014-09-21 15:08:52 +0000 | [diff] [blame] | 27 | |
| Marc Kupietz | a61d2ba | 2015-03-20 16:30:26 +0100 | [diff] [blame] | 28 | import com.fasterxml.jackson.core.JsonProcessingException; |
| 29 | import com.fasterxml.jackson.databind.JsonNode; |
| 30 | import com.fasterxml.jackson.databind.ObjectMapper; |
| Nils Diewald | b9dd413 | 2015-02-16 16:32:41 +0000 | [diff] [blame] | 31 | |
| 32 | /** |
| 33 | * @author diewald |
| 34 | */ |
| 35 | // http://harryjoy.com/2012/09/08/simple-rest-client-in-java/ |
| Nils Diewald | d723d81 | 2014-09-23 18:50:52 +0000 | [diff] [blame] | 36 | public class TestResource { |
| Nils Diewald | ff6f766 | 2014-09-21 15:08:52 +0000 | [diff] [blame] | 37 | private HttpServer server; |
| 38 | private WebTarget target; |
| 39 | |
| Akron | 98b7854 | 2015-08-06 21:43:08 +0200 | [diff] [blame] | 40 | final ObjectMapper mapper = new ObjectMapper(); |
| 41 | long t1 = 0, t2 = 0, t3 = 0, t4 = 0; |
| Nils Diewald | bb33da2 | 2015-03-04 16:24:25 +0000 | [diff] [blame] | 42 | |
| margaretha | b097bac | 2015-04-15 11:37:02 +0200 | [diff] [blame] | 43 | |
| Nils Diewald | ff6f766 | 2014-09-21 15:08:52 +0000 | [diff] [blame] | 44 | @Before |
| Nils Diewald | b9dd413 | 2015-02-16 16:32:41 +0000 | [diff] [blame] | 45 | public void setUp () throws Exception { |
| Nils Diewald | ff6f766 | 2014-09-21 15:08:52 +0000 | [diff] [blame] | 46 | // start the server |
| Akron | 98b7854 | 2015-08-06 21:43:08 +0200 | [diff] [blame] | 47 | t1 = System.nanoTime(); |
| Akron | a2e9b87 | 2015-08-14 19:22:46 +0200 | [diff] [blame] | 48 | server = Node.startServer(new String[] { "--name", "milena", "--dir", |
| 49 | ":memory:", "--port", "9157" }); |
| Nils Diewald | ff6f766 | 2014-09-21 15:08:52 +0000 | [diff] [blame] | 50 | // create the client |
| 51 | Client c = ClientBuilder.newClient(); |
| 52 | |
| Akron | 98b7854 | 2015-08-06 21:43:08 +0200 | [diff] [blame] | 53 | t2 = System.nanoTime(); |
| 54 | |
| Nils Diewald | ff6f766 | 2014-09-21 15:08:52 +0000 | [diff] [blame] | 55 | // uncomment the following line if you want to enable |
| 56 | // support for JSON in the client (you also have to uncomment |
| 57 | // dependency on jersey-media-json module in pom.xml and Main.startServer()) |
| 58 | // -- |
| Nils Diewald | ff6f766 | 2014-09-21 15:08:52 +0000 | [diff] [blame] | 59 | |
| Nils Diewald | bbd39a5 | 2015-02-23 19:56:57 +0000 | [diff] [blame] | 60 | // c.configuration().enable(com.sun.jersey.api.json.POJOMappingFeature()); |
| 61 | // c.configuration().enable(new org.glassfish.jersey.media.json.JsonJaxbFeature()); |
| Marc Kupietz | a61d2ba | 2015-03-20 16:30:26 +0100 | [diff] [blame] | 62 | // c.register(JacksonFeatures.class); |
| Nils Diewald | bbd39a5 | 2015-02-23 19:56:57 +0000 | [diff] [blame] | 63 | // c.register(com.fasterxml.jackson.jaxrs.annotation.JacksonFeatures.class); |
| 64 | |
| 65 | /* |
| 66 | ClientConfig clientConfig = new DefaultClientConfig(); |
| 67 | clientConfig.getFeatures().put(JSONConfiguration.FEATURE_POJO_MAPPING, Boolean.TRUE); |
| 68 | Client c = Client.create(clientConfig); |
| Nils Diewald | bb33da2 | 2015-03-04 16:24:25 +0000 | [diff] [blame] | 69 | */ |
| Akron | a2e9b87 | 2015-08-14 19:22:46 +0200 | [diff] [blame] | 70 | target = c.target(Node.getBaseURI()); |
| Nils Diewald | ff6f766 | 2014-09-21 15:08:52 +0000 | [diff] [blame] | 71 | }; |
| 72 | |
| Nils Diewald | bb33da2 | 2015-03-04 16:24:25 +0000 | [diff] [blame] | 73 | |
| Nils Diewald | ff6f766 | 2014-09-21 15:08:52 +0000 | [diff] [blame] | 74 | @After |
| Nils Diewald | bb33da2 | 2015-03-04 16:24:25 +0000 | [diff] [blame] | 75 | public void tearDown () throws Exception { |
| Akron | 98b7854 | 2015-08-06 21:43:08 +0200 | [diff] [blame] | 76 | t3 = System.nanoTime(); |
| Nils Diewald | ff6f766 | 2014-09-21 15:08:52 +0000 | [diff] [blame] | 77 | server.stop(); |
| Marc Kupietz | a61d2ba | 2015-03-20 16:30:26 +0100 | [diff] [blame] | 78 | Node.closeDBPool(); |
| Akron | 98b7854 | 2015-08-06 21:43:08 +0200 | [diff] [blame] | 79 | t4 = System.nanoTime(); |
| 80 | |
| Akron | 08f4ceb | 2016-08-03 23:53:32 +0200 | [diff] [blame] | 81 | double startup = (double) (t2 - t1) / 1000000000.0; |
| 82 | double action = (double) (t3 - t2) / 1000000000.0; |
| Akron | 98b7854 | 2015-08-06 21:43:08 +0200 | [diff] [blame] | 83 | double shutdown = (double) (t4 - t3) / 1000000000.0; |
| Nils Diewald | ff6f766 | 2014-09-21 15:08:52 +0000 | [diff] [blame] | 84 | }; |
| 85 | |
| Nils Diewald | bb33da2 | 2015-03-04 16:24:25 +0000 | [diff] [blame] | 86 | |
| Nils Diewald | ff6f766 | 2014-09-21 15:08:52 +0000 | [diff] [blame] | 87 | /** |
| Nils Diewald | bb33da2 | 2015-03-04 16:24:25 +0000 | [diff] [blame] | 88 | * Test to see that the message "Gimme 5 minutes, please!" is sent |
| 89 | * in the response. |
| Nils Diewald | ff6f766 | 2014-09-21 15:08:52 +0000 | [diff] [blame] | 90 | */ |
| 91 | @Test |
| Nils Diewald | b9dd413 | 2015-02-16 16:32:41 +0000 | [diff] [blame] | 92 | public void testPing () { |
| Nils Diewald | ff6f766 | 2014-09-21 15:08:52 +0000 | [diff] [blame] | 93 | String responseMsg = target.path("ping").request().get(String.class); |
| 94 | assertEquals("Gimme 5 minutes, please!", responseMsg); |
| 95 | }; |
| 96 | |
| margaretha | b097bac | 2015-04-15 11:37:02 +0200 | [diff] [blame] | 97 | |
| Akron | 74992bc | 2015-08-05 22:30:57 +0200 | [diff] [blame] | 98 | // This tests the node info |
| Marc Kupietz | a61d2ba | 2015-03-20 16:30:26 +0100 | [diff] [blame] | 99 | @Test |
| 100 | public void testInfo () throws IOException { |
| 101 | String responseMsg = target.path("/").request().get(String.class); |
| 102 | JsonNode res = mapper.readTree(responseMsg); |
| Akron | d504f21 | 2015-06-20 00:27:54 +0200 | [diff] [blame] | 103 | assertEquals("milena", res.at("/meta/node").asText()); |
| Marc Kupietz | a61d2ba | 2015-03-20 16:30:26 +0100 | [diff] [blame] | 104 | assertEquals(680, res.at("/messages/0/0").asInt()); |
| 105 | }; |
| Nils Diewald | bb33da2 | 2015-03-04 16:24:25 +0000 | [diff] [blame] | 106 | |
| Akron | 09ae373 | 2015-08-13 20:56:20 +0200 | [diff] [blame] | 107 | |
| Marc Kupietz | a61d2ba | 2015-03-20 16:30:26 +0100 | [diff] [blame] | 108 | @Test |
| Akron | 98b7854 | 2015-08-06 21:43:08 +0200 | [diff] [blame] | 109 | public void testIndexing () throws IOException { |
| Marc Kupietz | a61d2ba | 2015-03-20 16:30:26 +0100 | [diff] [blame] | 110 | String resp; |
| 111 | JsonNode res; |
| Nils Diewald | c471b18 | 2014-11-19 22:51:15 +0000 | [diff] [blame] | 112 | |
| Akron | 09ae373 | 2015-08-13 20:56:20 +0200 | [diff] [blame] | 113 | for (String i : new String[] { "00001", "00002", "00003", "00004", |
| Akron | 91c6011 | 2015-09-24 22:05:40 +0200 | [diff] [blame] | 114 | "00005", "00006" }) { |
| Nils Diewald | ff6f766 | 2014-09-21 15:08:52 +0000 | [diff] [blame] | 115 | |
| Akron | 08f4ceb | 2016-08-03 23:53:32 +0200 | [diff] [blame] | 116 | |
| Akron | 8798be8 | 2016-06-23 23:10:25 +0200 | [diff] [blame] | 117 | |
| Eliza Margaretha | 6f98920 | 2016-10-14 21:48:29 +0200 | [diff] [blame] | 118 | String json = StringfromFile( |
| 119 | getClass().getResource("/wiki/" + i + ".json").getFile()); |
| Nils Diewald | b9dd413 | 2015-02-16 16:32:41 +0000 | [diff] [blame] | 120 | |
| Nils Diewald | bbd39a5 | 2015-02-23 19:56:57 +0000 | [diff] [blame] | 121 | Entity jsonE = Entity.json(json); |
| 122 | |
| Nils Diewald | 14b3aa4 | 2015-02-26 22:26:20 +0000 | [diff] [blame] | 123 | try { |
| Marc Kupietz | a61d2ba | 2015-03-20 16:30:26 +0100 | [diff] [blame] | 124 | // Put new documents to the index |
| 125 | resp = target.path("/index/" + i).request("application/json") |
| margaretha | b097bac | 2015-04-15 11:37:02 +0200 | [diff] [blame] | 126 | .put(jsonE, String.class); |
| Nils Diewald | ff6f766 | 2014-09-21 15:08:52 +0000 | [diff] [blame] | 127 | |
| Marc Kupietz | a61d2ba | 2015-03-20 16:30:26 +0100 | [diff] [blame] | 128 | res = mapper.readTree(resp); |
| Akron | d504f21 | 2015-06-20 00:27:54 +0200 | [diff] [blame] | 129 | assertEquals("milena", res.at("/meta/node").asText()); |
| Akron | 75ee2b8 | 2016-06-20 21:20:34 +0200 | [diff] [blame] | 130 | assertEquals(681, res.at("/messages/0/0").asInt()); |
| Nils Diewald | 14b3aa4 | 2015-02-26 22:26:20 +0000 | [diff] [blame] | 131 | } |
| 132 | catch (Exception e) { |
| Nils Diewald | bb33da2 | 2015-03-04 16:24:25 +0000 | [diff] [blame] | 133 | fail("Server response failed " + e.getMessage() |
| 134 | + " (Known issue)"); |
| Nils Diewald | 14b3aa4 | 2015-02-26 22:26:20 +0000 | [diff] [blame] | 135 | } |
| Nils Diewald | 94870ae | 2014-12-09 14:35:29 +0000 | [diff] [blame] | 136 | }; |
| Nils Diewald | ff6f766 | 2014-09-21 15:08:52 +0000 | [diff] [blame] | 137 | |
| Eliza Margaretha | 6f98920 | 2016-10-14 21:48:29 +0200 | [diff] [blame] | 138 | String json = StringfromFile( |
| 139 | getClass().getResource("/wiki/02439.json").getFile()); |
| Akron | 91c6011 | 2015-09-24 22:05:40 +0200 | [diff] [blame] | 140 | Entity jsonE = Entity.json(json); |
| 141 | |
| 142 | try { |
| 143 | // Put new documents to the index |
| 144 | resp = target.path("/index/02439").request("application/json") |
| Akron | 4299355 | 2016-02-04 13:24:24 +0100 | [diff] [blame] | 145 | .put(jsonE, String.class); |
| Akron | 91c6011 | 2015-09-24 22:05:40 +0200 | [diff] [blame] | 146 | |
| 147 | res = mapper.readTree(resp); |
| 148 | |
| 149 | // Check mirroring |
| 150 | assertEquals(2439, res.at("/text/UID").asInt()); |
| 151 | assertEquals("milena", res.at("/meta/node").asText()); |
| Akron | 75ee2b8 | 2016-06-20 21:20:34 +0200 | [diff] [blame] | 152 | assertEquals(681, res.at("/messages/0/0").asInt()); |
| Akron | 91c6011 | 2015-09-24 22:05:40 +0200 | [diff] [blame] | 153 | } |
| 154 | catch (Exception e) { |
| Akron | 4299355 | 2016-02-04 13:24:24 +0100 | [diff] [blame] | 155 | fail("Server response failed " + e.getMessage() + " (Known issue)"); |
| Akron | 91c6011 | 2015-09-24 22:05:40 +0200 | [diff] [blame] | 156 | }; |
| 157 | |
| Akron | 98b7854 | 2015-08-06 21:43:08 +0200 | [diff] [blame] | 158 | // Commit! |
| Marc Kupietz | a61d2ba | 2015-03-20 16:30:26 +0100 | [diff] [blame] | 159 | resp = target.path("/index").request("application/json") |
| 160 | .post(Entity.text(""), String.class); |
| 161 | res = mapper.readTree(resp); |
| Akron | d504f21 | 2015-06-20 00:27:54 +0200 | [diff] [blame] | 162 | assertEquals("milena", res.at("/meta/node").asText()); |
| Akron | 75ee2b8 | 2016-06-20 21:20:34 +0200 | [diff] [blame] | 163 | |
| 164 | // Staged data committed |
| Marc Kupietz | a61d2ba | 2015-03-20 16:30:26 +0100 | [diff] [blame] | 165 | assertEquals(683, res.at("/messages/0/0").asInt()); |
| Akron | 8798be8 | 2016-06-23 23:10:25 +0200 | [diff] [blame] | 166 | |
| 167 | |
| 168 | // Get document by UID |
| 169 | resp = target.path("/index/00005").request().get(String.class); |
| 170 | res = mapper.readTree(resp); |
| 171 | |
| Akron | 08f4ceb | 2016-08-03 23:53:32 +0200 | [diff] [blame] | 172 | assertEquals("freizeit-unterhaltung reisen schrott tabellen", |
| 173 | res.at("/textClass").asText()); |
| Akron | 8798be8 | 2016-06-23 23:10:25 +0200 | [diff] [blame] | 174 | assertEquals("Å (Orte in Norwegen)", res.at("/title").asText()); |
| 175 | assertEquals("WPD", res.at("/corpusID").asText()); |
| 176 | assertEquals(5, res.at("/UID").asInt()); |
| 177 | assertEquals("WPD_AAA.00005", res.at("/ID").asText()); |
| 178 | |
| 179 | |
| 180 | // Get document by UID |
| 181 | resp = target.path("/index/5").request().get(String.class); |
| 182 | res = mapper.readTree(resp); |
| 183 | |
| Akron | 08f4ceb | 2016-08-03 23:53:32 +0200 | [diff] [blame] | 184 | assertEquals("freizeit-unterhaltung reisen schrott tabellen", |
| 185 | res.at("/textClass").asText()); |
| Akron | 8798be8 | 2016-06-23 23:10:25 +0200 | [diff] [blame] | 186 | assertEquals("Å (Orte in Norwegen)", res.at("/title").asText()); |
| 187 | assertEquals("WPD", res.at("/corpusID").asText()); |
| 188 | assertEquals(5, res.at("/UID").asInt()); |
| 189 | assertEquals("WPD_AAA.00005", res.at("/ID").asText()); |
| Akron | d7d7b1f | 2016-06-25 00:31:16 +0200 | [diff] [blame] | 190 | |
| 191 | // Get document by UID |
| 192 | resp = target.path("/index/17").request().get(String.class); |
| 193 | res = mapper.readTree(resp); |
| 194 | |
| 195 | assertEquals(630, res.at("/errors/0/0").asInt()); |
| 196 | assertTrue(res.at("/UID").isMissingNode()); |
| 197 | |
| 198 | // Get corpus statistics |
| 199 | resp = target.path("/corpus").request().get(String.class); |
| 200 | res = mapper.readTree(resp); |
| 201 | |
| 202 | assertEquals(281, res.at("/stats/sentences").asInt()); |
| 203 | assertEquals(174, res.at("/stats/paragraphs").asInt()); |
| 204 | assertEquals(2661, res.at("/stats/tokens").asInt()); |
| 205 | |
| 206 | assertEquals(7, res.at("/stats/base~1texts").asInt()); |
| Nils Diewald | ff6f766 | 2014-09-21 15:08:52 +0000 | [diff] [blame] | 207 | }; |
| Nils Diewald | d723d81 | 2014-09-23 18:50:52 +0000 | [diff] [blame] | 208 | |
| Akron | 8798be8 | 2016-06-23 23:10:25 +0200 | [diff] [blame] | 209 | |
| Akron | 75ee2b8 | 2016-06-20 21:20:34 +0200 | [diff] [blame] | 210 | /* |
| 211 | @Test |
| 212 | public void testRemoving () throws IOException { |
| Akron | d7d7b1f | 2016-06-25 00:31:16 +0200 | [diff] [blame] | 213 | String resp; |
| 214 | JsonNode res; |
| Eliza Margaretha | 6f98920 | 2016-10-14 21:48:29 +0200 | [diff] [blame] | 215 | |
| Akron | d7d7b1f | 2016-06-25 00:31:16 +0200 | [diff] [blame] | 216 | String json = StringfromFile(getClass().getResource("/wiki/02439.json") |
| 217 | .getFile()); |
| 218 | Entity jsonE = Entity.json(json); |
| Eliza Margaretha | 6f98920 | 2016-10-14 21:48:29 +0200 | [diff] [blame] | 219 | |
| Akron | d7d7b1f | 2016-06-25 00:31:16 +0200 | [diff] [blame] | 220 | try { |
| 221 | // Put new documents to the index |
| 222 | resp = target.path("/index/02439").request("application/json") |
| 223 | .put(jsonE, String.class); |
| Eliza Margaretha | 6f98920 | 2016-10-14 21:48:29 +0200 | [diff] [blame] | 224 | |
| Akron | d7d7b1f | 2016-06-25 00:31:16 +0200 | [diff] [blame] | 225 | res = mapper.readTree(resp); |
| Eliza Margaretha | 6f98920 | 2016-10-14 21:48:29 +0200 | [diff] [blame] | 226 | |
| Akron | d7d7b1f | 2016-06-25 00:31:16 +0200 | [diff] [blame] | 227 | // Check mirroring |
| 228 | assertEquals(2439, res.at("/text/UID").asInt()); |
| 229 | assertEquals("milena", res.at("/meta/node").asText()); |
| 230 | assertEquals(681, res.at("/messages/0/0").asInt()); |
| 231 | } |
| 232 | catch (Exception e) { |
| 233 | fail("Server response failed " + e.getMessage() + " (Known issue)"); |
| 234 | }; |
| Eliza Margaretha | 6f98920 | 2016-10-14 21:48:29 +0200 | [diff] [blame] | 235 | |
| Akron | d7d7b1f | 2016-06-25 00:31:16 +0200 | [diff] [blame] | 236 | // Commit! |
| 237 | resp = target.path("/index").request("application/json") |
| 238 | .post(Entity.text(""), String.class); |
| 239 | res = mapper.readTree(resp); |
| 240 | assertEquals("milena", res.at("/meta/node").asText()); |
| Eliza Margaretha | 6f98920 | 2016-10-14 21:48:29 +0200 | [diff] [blame] | 241 | |
| Akron | d7d7b1f | 2016-06-25 00:31:16 +0200 | [diff] [blame] | 242 | // Staged data committed |
| 243 | assertEquals(683, res.at("/messages/0/0").asInt()); |
| Akron | 75ee2b8 | 2016-06-20 21:20:34 +0200 | [diff] [blame] | 244 | }; |
| 245 | */ |
| Akron | 4299355 | 2016-02-04 13:24:24 +0100 | [diff] [blame] | 246 | |
| Akron | d7d7b1f | 2016-06-25 00:31:16 +0200 | [diff] [blame] | 247 | |
| Marc Kupietz | a61d2ba | 2015-03-20 16:30:26 +0100 | [diff] [blame] | 248 | @Test |
| Nils Diewald | bb33da2 | 2015-03-04 16:24:25 +0000 | [diff] [blame] | 249 | public void testCollection () throws IOException { |
| Nils Diewald | d723d81 | 2014-09-23 18:50:52 +0000 | [diff] [blame] | 250 | |
| Akron | 98b7854 | 2015-08-06 21:43:08 +0200 | [diff] [blame] | 251 | // mate/l:sein |
| Akron | 67d2ff0 | 2018-06-19 10:51:16 +0200 | [diff] [blame] | 252 | String json = getJsonString(getClass() |
| Eliza Margaretha | 6f98920 | 2016-10-14 21:48:29 +0200 | [diff] [blame] | 253 | .getResource("/queries/bsp-uid-example.jsonld").getFile()); |
| Nils Diewald | d723d81 | 2014-09-23 18:50:52 +0000 | [diff] [blame] | 254 | |
| Nils Diewald | 14b3aa4 | 2015-02-26 22:26:20 +0000 | [diff] [blame] | 255 | try { |
| Marc Kupietz | a61d2ba | 2015-03-20 16:30:26 +0100 | [diff] [blame] | 256 | String resp = target.path("/").queryParam("uid", "1") |
| margaretha | b097bac | 2015-04-15 11:37:02 +0200 | [diff] [blame] | 257 | .queryParam("uid", "4").request("application/json") |
| 258 | .post(Entity.json(json), String.class); |
| Marc Kupietz | a61d2ba | 2015-03-20 16:30:26 +0100 | [diff] [blame] | 259 | JsonNode res = mapper.readTree(resp); |
| Akron | d504f21 | 2015-06-20 00:27:54 +0200 | [diff] [blame] | 260 | assertEquals(2, res.at("/meta/totalResults").asInt()); |
| Nils Diewald | 14b3aa4 | 2015-02-26 22:26:20 +0000 | [diff] [blame] | 261 | } |
| 262 | catch (Exception e) { |
| Eliza Margaretha | 6f98920 | 2016-10-14 21:48:29 +0200 | [diff] [blame] | 263 | fail("Server response failed: " + e.getMessage() |
| 264 | + " (Known issue)"); |
| Nils Diewald | 14b3aa4 | 2015-02-26 22:26:20 +0000 | [diff] [blame] | 265 | }; |
| 266 | |
| Nils Diewald | d723d81 | 2014-09-23 18:50:52 +0000 | [diff] [blame] | 267 | }; |
| Nils Diewald | ff6f766 | 2014-09-21 15:08:52 +0000 | [diff] [blame] | 268 | }; |