Fixed rewrite bugs (updated rewriteQuery & KoralNode)
Change-Id: Ic010e0f6210d34a8fe8dfe15a68f1112423f60eb
diff --git a/full/src/test/java/de/ids_mannheim/korap/resource/rewrite/CollectionRewriteTest.java b/full/src/test/java/de/ids_mannheim/korap/resource/rewrite/CollectionRewriteTest.java
index f153baa..28bab56 100644
--- a/full/src/test/java/de/ids_mannheim/korap/resource/rewrite/CollectionRewriteTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/resource/rewrite/CollectionRewriteTest.java
@@ -241,6 +241,7 @@
node.at("/collection/operands/1/operands/0/key").asText());
assertEquals("textClass",
node.at("/collection/operands/1/operands/1/key").asText());
+ System.out.println(node);
assertEquals("koral:rewrite", node.at("/collection/rewrites/0/@type")
.asText());
assertEquals("availability(FREE)", node.at("/collection/rewrites/0/scope")
diff --git a/full/src/test/java/de/ids_mannheim/korap/resource/rewrite/VirtualCorpusRewriteTest.java b/full/src/test/java/de/ids_mannheim/korap/resource/rewrite/VirtualCorpusRewriteTest.java
index e91dde2..7702beb 100644
--- a/full/src/test/java/de/ids_mannheim/korap/resource/rewrite/VirtualCorpusRewriteTest.java
+++ b/full/src/test/java/de/ids_mannheim/korap/resource/rewrite/VirtualCorpusRewriteTest.java
@@ -36,32 +36,31 @@
private VirtualCorpusDao dao;
@Test
- public void testNoRewriteWithCachedVCRef ()
+ public void testCachedVCRef ()
throws KustvaktException, IOException, QueryException {
KrillCollection.cache = CacheManager.newInstance().getCache("named_vc");
vcLoader.loadVCToCache("named-vc1", "/vc/named-vc1.jsonld");
- // ClientResponse response =
- // resource().path(API_VERSION).path("search")
- // .queryParam("q", "[orth=der]").queryParam("ql", "poliqarp")
- // .queryParam("cq", "referTo named-vc1")
- // .get(ClientResponse.class);
- //
- // String ent = response.getEntity(String.class);
- // JsonNode node = JsonUtils.readTree(ent);
- // node = node.at("/collection");
- //
- // assertEquals("koral:docGroup", node.at("/@type").asText());
- // assertTrue(node.at("/operands/1/rewrites").isMissingNode());
+ ClientResponse response = resource().path(API_VERSION).path("search")
+ .queryParam("q", "[orth=der]").queryParam("ql", "poliqarp")
+ .queryParam("cq", "referTo named-vc1")
+ .get(ClientResponse.class);
- testNoRewriteWithUsername();
+ String ent = response.getEntity(String.class);
+ JsonNode node = JsonUtils.readTree(ent);
+ node = node.at("/collection");
+
+ assertEquals("koral:docGroup", node.at("/@type").asText());
+ assertTrue(node.at("/operands/1/rewrites").isMissingNode());
+
+ testCachedVCRefWithUsername();
KrillCollection.cache.removeAll();
VirtualCorpus vc = dao.retrieveVCByName("named-vc1", "system");
dao.deleteVirtualCorpus(vc);
}
- private void testNoRewriteWithUsername ()
+ private void testCachedVCRefWithUsername ()
throws KustvaktException, IOException, QueryException {
ClientResponse response = resource().path(API_VERSION).path("search")
@@ -144,7 +143,6 @@
String ent = response.getEntity(String.class);
JsonNode node = JsonUtils.readTree(ent);
node = node.at("/collection");
- // System.out.println(node);
assertEquals("koral:docGroup", node.at("/@type").asText());
node = node.at("/operands/1/rewrites");
assertEquals(3, node.size());