collection query builder
diff --git a/src/test/java/CollectionQueryBuilderTest.java b/src/test/java/CollectionQueryBuilderTest.java
index 0840e20..38a5ac4 100644
--- a/src/test/java/CollectionQueryBuilderTest.java
+++ b/src/test/java/CollectionQueryBuilderTest.java
@@ -1,11 +1,11 @@
import com.fasterxml.jackson.databind.JsonNode;
import de.ids_mannheim.korap.query.serialize.QuerySerializer;
-import de.ids_mannheim.korap.utils.CollectionQueryBuilder3;
+import de.ids_mannheim.korap.utils.KoralCollectionQueryBuilder;
import de.ids_mannheim.korap.utils.JsonUtils;
-import org.junit.Assert;
import org.junit.Test;
import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNotEquals;
import static org.junit.Assert.assertNotNull;
/**
@@ -16,28 +16,28 @@
@Test
public void testsimpleAdd () {
- CollectionQueryBuilder3 b = new CollectionQueryBuilder3();
- b.addQuery("corpusID=WPD");
+ KoralCollectionQueryBuilder b = new KoralCollectionQueryBuilder();
+ b.with("corpusSigle=WPD");
JsonNode node = JsonUtils.readTree(b.toJSON());
assertNotNull(node);
assertEquals("koral:doc", node.at("/collection/@type").asText());
- assertEquals("corpusID", node.at("/collection/key").asText());
+ assertEquals("corpusSigle", node.at("/collection/key").asText());
}
@Test
public void testSimpleConjunction () {
- CollectionQueryBuilder3 b = new CollectionQueryBuilder3();
- b.addQuery("corpusID=WPD & textClass=freizeit");
+ KoralCollectionQueryBuilder b = new KoralCollectionQueryBuilder();
+ b.with("corpusSigle=WPD & textClass=freizeit");
JsonNode node = JsonUtils.readTree(b.toJSON());
assertNotNull(node);
assertEquals("koral:docGroup", node.at("/collection/@type").asText());
assertEquals("operation:and", node.at("/collection/operation").asText());
- assertEquals("corpusID", node.at("/collection/operands/0/key").asText());
+ assertEquals("corpusSigle", node.at("/collection/operands/0/key").asText());
assertEquals("textClass", node.at("/collection/operands/1/key")
.asText());
}
@@ -45,17 +45,14 @@
@Test
public void testSimpleDisjunction () {
- CollectionQueryBuilder3 b = new CollectionQueryBuilder3();
- b.addQuery("corpusID=WPD | textClass=freizeit");
+ KoralCollectionQueryBuilder b = new KoralCollectionQueryBuilder();
+ b.with("corpusSigle=WPD | textClass=freizeit");
JsonNode node = JsonUtils.readTree(b.toJSON());
- System.out.println("_____________________________________________");
- System.out.println(node);
-
- assert node != null;
+ assertNotNull(node);
assert node.at("/collection/operation").asText().equals("operation:or");
assert node.at("/collection/operands/0/key").asText()
- .equals("corpusID");
+ .equals("corpusSigle");
assert node.at("/collection/operands/1/key").asText()
.equals("textClass");
}
@@ -63,17 +60,14 @@
@Test
public void testComplexSubQuery () {
- CollectionQueryBuilder3 b = new CollectionQueryBuilder3();
- b.addQuery("(corpusID=WPD) | (textClass=freizeit & corpusID=WPD)");
+ KoralCollectionQueryBuilder b = new KoralCollectionQueryBuilder();
+ b.with("(corpusSigle=WPD) | (textClass=freizeit & corpusSigle=BRZ13)");
JsonNode node = JsonUtils.readTree(b.toJSON());
- System.out
- .println("_____________________________________________ COMPLEX");
- System.out.println(node);
- assert node != null;
+ assertNotNull(node);
assert node.at("/collection/operation").asText().equals("operation:or");
assert node.at("/collection/operands/0/key").asText()
- .equals("corpusID");
+ .equals("corpusSigle");
assert node.at("/collection/operands/1/@type").asText()
.equals("koral:docGroup");
@@ -82,60 +76,128 @@
@Test
public void testAddResourceQueryAfter () {
- CollectionQueryBuilder3 b = new CollectionQueryBuilder3();
- b.addQuery("(corpusID=ADF) | (textClass=freizeit & corpusID=WPD)");
+ KoralCollectionQueryBuilder b = new KoralCollectionQueryBuilder();
+ b.with("(textClass=politik & title=\"random title\") | textClass=wissenschaft");
- CollectionQueryBuilder3 c = new CollectionQueryBuilder3();
+ KoralCollectionQueryBuilder c = new KoralCollectionQueryBuilder();
c.setBaseQuery(b.toJSON());
- c.addQuery("textClass=wissenschaft");
+ c.with("corpusSigle=WPD");
JsonNode node = JsonUtils.readTree(c.toJSON());
- assert node != null;
- assert node.at("/collection/operands/2/@type").asText()
- .equals("koral:doc");
- assert node.at("/collection/operands/2/value").asText()
- .equals("wissenschaft");
+ assertNotNull(node);
+ assertEquals("koral:doc", node.at("/collection/operands/0/@type")
+ .asText());
+ assertEquals("WPD", node.at("/collection/operands/0/value").asText());
+ assertEquals(2, node.at("/collection/operands").size());
}
@Test
public void testAddComplexResourceQueryAfter () {
- CollectionQueryBuilder3 b = new CollectionQueryBuilder3();
- b.addQuery("(corpusID=ADF) | (textClass=freizeit & corpusID=WPD)");
+ KoralCollectionQueryBuilder b = new KoralCollectionQueryBuilder();
+ b.with("(title=\"random title\") | (textClass=wissenschaft)");
- CollectionQueryBuilder3 c = new CollectionQueryBuilder3();
+ KoralCollectionQueryBuilder c = new KoralCollectionQueryBuilder();
c.setBaseQuery(b.toJSON());
- c.addQuery("(textClass=politik & corpusID=AZPS)");
+ c.with("(corpusSigle=BRZ13 | corpusSigle=AZPS)");
JsonNode node = JsonUtils.readTree(c.toJSON());
-
- assert node != null;
- assert node.at("/collection/operands/2/@type").asText()
- .equals("koral:docGroup");
- assert node.at("/collection/operands/2/operands/0/value").asText()
- .equals("politik");
- assert node.at("/collection/operands/2/operands/1/value").asText()
- .equals("AZPS");
-
+ assertNotNull(node);
+ assertEquals("koral:docGroup", node.at("/collection/operands/0/@type")
+ .asText());
+ assertEquals("koral:docGroup", node.at("/collection/operands/1/@type")
+ .asText());
+ assertEquals("BRZ13", node
+ .at("/collection/operands/0/operands/0/value").asText());
+ assertEquals("AZPS", node.at("/collection/operands/0/operands/1/value")
+ .asText());
+ assertEquals("random title",
+ node.at("/collection/operands/1/operands/0/value").asText());
+ assertEquals("wissenschaft",
+ node.at("/collection/operands/1/operands/1/value").asText());
}
@Test
- public void buildQuery () {
+ public void testBuildQuery () {
+ String coll = "corpusSigle=WPD";
String query = "[base=Haus]";
- QuerySerializer s = new QuerySerializer();
- s.setQuery(query, "poliqarp");
- CollectionQueryBuilder3 b = new CollectionQueryBuilder3();
- b.addQuery("corpusID=WPD");
- s.setCollection("corpusID=WPD");
+ QuerySerializer check = new QuerySerializer();
+ check.setQuery(query, "poliqarp");
+ check.setCollection(coll);
- System.out.println("QUERY " + s.toJSON());
+ KoralCollectionQueryBuilder b = new KoralCollectionQueryBuilder();
+ b.setBaseQuery(check.toJSON());
+ b.with("textClass=freizeit");
+
+ JsonNode res = (JsonNode) b.rebaseCollection();
+ assertNotNull(res);
+ assertEquals("koral:docGroup", res.at("/collection/@type").asText());
+ assertEquals("operation:and", res.at("/collection/operation").asText());
+ assertEquals("koral:doc", res.at("/collection/operands/0/@type")
+ .asText());
+ assertEquals("freizeit", res.at("/collection/operands/0/value")
+ .asText());
+ assertEquals("textClass", res.at("/collection/operands/0/key").asText());
+
+ assertEquals("koral:doc", res.at("/collection/operands/1/@type")
+ .asText());
+ assertEquals("WPD", res.at("/collection/operands/1/value").asText());
+ assertEquals("corpusSigle", res.at("/collection/operands/1/key").asText());
+
+ // check also that query is still there
+ assertEquals("koral:token", res.at("/query/@type").asText());
+ assertEquals("koral:term", res.at("/query/wrap/@type").asText());
+ assertEquals("Haus", res.at("/query/wrap/key").asText());
+ assertEquals("lemma", res.at("/query/wrap/layer").asText());
}
@Test
public void testBaseQueryBuild () {
+ KoralCollectionQueryBuilder b = new KoralCollectionQueryBuilder();
+ b.with("(corpusSigle=ADF) | (textClass=freizeit & corpusSigle=WPD)");
+
+ KoralCollectionQueryBuilder c = new KoralCollectionQueryBuilder();
+ c.setBaseQuery(b.toJSON());
+
+ c.with("corpusSigle=BRZ13");
+ JsonNode base = (JsonNode) c.rebaseCollection();
+ assertNotNull(base);
+ assertEquals(base.at("/collection/@type").asText(), "koral:docGroup");
+ assertEquals(base.at("/collection/operands/0/@type").asText(),
+ "koral:doc");
+ assertEquals(base.at("/collection/operands/0/value").asText(), "BRZ13");
+ assertEquals(base.at("/collection/operands/1/@type").asText(),
+ "koral:docGroup");
+ assertEquals(base.at("/collection/operands/1/operands").size(), 2);
+ }
+
+ @Test
+ public void testNodeMergeWithBase() {
+ String coll = "corpusSigle=WPD";
+ String query = "[base=Haus]";
+ QuerySerializer check = new QuerySerializer();
+ check.setQuery(query, "poliqarp");
+ check.setCollection(coll);
+
+ KoralCollectionQueryBuilder b = new KoralCollectionQueryBuilder();
+ b.setBaseQuery(check.toJSON());
+
+ KoralCollectionQueryBuilder test = new KoralCollectionQueryBuilder();
+ test.with("textClass=wissenschaft | textClass=politik");
+ JsonNode node = (JsonNode) test.rebaseCollection();
+ node = b.mergeWith(node);
+ assertNotNull(node);
+ assertEquals("koral:docGroup", node.at("/collection/@type").asText());
+ assertEquals("operation:and", node.at("/collection/operation").asText());
+ assertEquals(2, node.at("/collection/operands").size());
+ }
+
+
+ @Test
+ public void testStoredCollectionBaseQueryBuild () {
}
diff --git a/src/test/java/de/ids_mannheim/korap/config/ConfigTest.java b/src/test/java/de/ids_mannheim/korap/config/ConfigTest.java
index fe2201f..c11b7e3 100644
--- a/src/test/java/de/ids_mannheim/korap/config/ConfigTest.java
+++ b/src/test/java/de/ids_mannheim/korap/config/ConfigTest.java
@@ -1,7 +1,6 @@
package de.ids_mannheim.korap.config;
import de.ids_mannheim.korap.exceptions.KustvaktException;
-import de.ids_mannheim.korap.user.Attributes;
import de.ids_mannheim.korap.utils.ServiceInfo;
import de.ids_mannheim.korap.utils.TimeUtils;
import de.ids_mannheim.korap.web.service.BootableBeanInterface;
diff --git a/src/test/java/de/ids_mannheim/korap/config/TestHelper.java b/src/test/java/de/ids_mannheim/korap/config/TestHelper.java
index 0746293..2c36b66 100644
--- a/src/test/java/de/ids_mannheim/korap/config/TestHelper.java
+++ b/src/test/java/de/ids_mannheim/korap/config/TestHelper.java
@@ -12,7 +12,6 @@
import de.ids_mannheim.korap.security.auth.APIAuthentication;
import de.ids_mannheim.korap.security.auth.BasicHttpAuth;
import de.ids_mannheim.korap.security.auth.KustvaktAuthenticationManager;
-import de.ids_mannheim.korap.user.Attributes;
import de.ids_mannheim.korap.user.User;
import de.ids_mannheim.korap.web.service.BootableBeanInterface;
import org.apache.commons.dbcp2.BasicDataSource;
diff --git a/src/test/java/de/ids_mannheim/korap/resource/rewrite/CollectionRewriteTest.java b/src/test/java/de/ids_mannheim/korap/resource/rewrite/CollectionRewriteTest.java
index 0c7035b..4e4aa3f 100644
--- a/src/test/java/de/ids_mannheim/korap/resource/rewrite/CollectionRewriteTest.java
+++ b/src/test/java/de/ids_mannheim/korap/resource/rewrite/CollectionRewriteTest.java
@@ -5,11 +5,15 @@
import de.ids_mannheim.korap.config.KustvaktConfiguration;
import de.ids_mannheim.korap.exceptions.KustvaktException;
import de.ids_mannheim.korap.query.serialize.QuerySerializer;
+import de.ids_mannheim.korap.resources.Corpus;
+import de.ids_mannheim.korap.resources.KustvaktResource;
+import de.ids_mannheim.korap.security.ac.ResourceFinder;
import de.ids_mannheim.korap.user.User;
import de.ids_mannheim.korap.utils.JsonUtils;
import org.junit.Assert;
import org.junit.Test;
+import java.util.Set;
import java.util.regex.Matcher;
import java.util.regex.Pattern;
@@ -29,6 +33,7 @@
@Override
public void initMethod () throws KustvaktException {
+ helper().runBootInterfaces();
config = helper().getContext().getConfiguration();
}
@@ -181,5 +186,45 @@
}
+ @Test
+ public void testPublicCollectionRewriteEmptyAdd () throws KustvaktException {
+ RewriteHandler handler = new RewriteHandler();
+ handler.insertBeans(helper().getContext());
+ handler.add(PublicCollection.class);
+
+ QuerySerializer s = new QuerySerializer();
+ s.setQuery(simple_add_query, "poliqarp");
+ String org = s.toJSON();
+ JsonNode node = JsonUtils.readTree(handler.preProcess(org,
+ User.UserFactory.getUser("test_user")));
+ assertNotNull(node);
+ System.out.println("EMPTY " + node);
+ }
+
+
+ @Test
+ public void testPublicCollectionRewriteNonEmptyAdd ()
+ throws KustvaktException {
+ RewriteHandler handler = new RewriteHandler();
+ handler.insertBeans(helper().getContext());
+ handler.add(PublicCollection.class);
+
+ try {
+ QuerySerializer s = new QuerySerializer();
+ s.setQuery(simple_add_query, "poliqarp");
+ s.setCollection("(docSigle=WPD_AAA & textClass=wissenschaft)");
+ String org = s.toJSON();
+ JsonNode node = JsonUtils.readTree(handler.preProcess(org,
+ User.UserFactory.getUser("test_user")));
+ assertNotNull(node);
+ System.out.println("NON EMPTY " + node);
+ Set<Corpus> resourceSet = ResourceFinder.searchPublic(Corpus.class);
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+
}
diff --git a/src/test/java/de/ids_mannheim/korap/resource/rewrite/FoundryRewriteTest.java b/src/test/java/de/ids_mannheim/korap/resource/rewrite/FoundryRewriteTest.java
index cb7d38d..032b9f7 100644
--- a/src/test/java/de/ids_mannheim/korap/resource/rewrite/FoundryRewriteTest.java
+++ b/src/test/java/de/ids_mannheim/korap/resource/rewrite/FoundryRewriteTest.java
@@ -9,7 +9,7 @@
import de.ids_mannheim.korap.interfaces.db.UserDataDbIface;
import de.ids_mannheim.korap.query.serialize.QuerySerializer;
import de.ids_mannheim.korap.resource.LayerMapper;
-import de.ids_mannheim.korap.user.Attributes;
+import de.ids_mannheim.korap.config.Attributes;
import de.ids_mannheim.korap.user.User;
import de.ids_mannheim.korap.user.UserSettings;
import de.ids_mannheim.korap.utils.JsonUtils;
diff --git a/src/test/java/de/ids_mannheim/korap/resource/rewrite/PostRewriteTest.java b/src/test/java/de/ids_mannheim/korap/resource/rewrite/PostRewriteTest.java
index 91ee4e0..78db747 100644
--- a/src/test/java/de/ids_mannheim/korap/resource/rewrite/PostRewriteTest.java
+++ b/src/test/java/de/ids_mannheim/korap/resource/rewrite/PostRewriteTest.java
@@ -16,7 +16,6 @@
* @author hanl
* @date 12/11/2015
*/
-//fixme: tests only work with singleconnection data sources
// todo: logging!
public class PostRewriteTest extends BeanConfigTest {
diff --git a/src/test/java/de/ids_mannheim/korap/resource/rewrite/RewriteHandlerTest.java b/src/test/java/de/ids_mannheim/korap/resource/rewrite/RewriteHandlerTest.java
index 5eea4e2..070e0bb 100644
--- a/src/test/java/de/ids_mannheim/korap/resource/rewrite/RewriteHandlerTest.java
+++ b/src/test/java/de/ids_mannheim/korap/resource/rewrite/RewriteHandlerTest.java
@@ -6,7 +6,7 @@
import de.ids_mannheim.korap.exceptions.KustvaktException;
import de.ids_mannheim.korap.interfaces.db.UserDataDbIface;
import de.ids_mannheim.korap.query.serialize.QuerySerializer;
-import de.ids_mannheim.korap.user.Attributes;
+import de.ids_mannheim.korap.config.Attributes;
import de.ids_mannheim.korap.user.UserSettings;
import de.ids_mannheim.korap.utils.JsonUtils;
import org.junit.Test;
diff --git a/src/test/java/de/ids_mannheim/korap/security/PolicyDaoTest.java b/src/test/java/de/ids_mannheim/korap/security/PolicyDaoTest.java
index 404b86a..8c2a00d 100644
--- a/src/test/java/de/ids_mannheim/korap/security/PolicyDaoTest.java
+++ b/src/test/java/de/ids_mannheim/korap/security/PolicyDaoTest.java
@@ -8,7 +8,7 @@
import de.ids_mannheim.korap.resources.Permissions;
import de.ids_mannheim.korap.resources.VirtualCollection;
import de.ids_mannheim.korap.security.ac.PolicyBuilder;
-import de.ids_mannheim.korap.user.Attributes;
+import de.ids_mannheim.korap.config.Attributes;
import de.ids_mannheim.korap.user.User;
import edu.emory.mathcs.backport.java.util.Arrays;
import org.junit.Ignore;
diff --git a/src/test/java/de/ids_mannheim/korap/security/auth/KustvaktAuthenticationManagerTest.java b/src/test/java/de/ids_mannheim/korap/security/auth/KustvaktAuthenticationManagerTest.java
index 973087b..2c0d83e 100644
--- a/src/test/java/de/ids_mannheim/korap/security/auth/KustvaktAuthenticationManagerTest.java
+++ b/src/test/java/de/ids_mannheim/korap/security/auth/KustvaktAuthenticationManagerTest.java
@@ -1,5 +1,6 @@
package de.ids_mannheim.korap.security.auth;
+import de.ids_mannheim.korap.config.Attributes;
import de.ids_mannheim.korap.config.BeanConfigTest;
import de.ids_mannheim.korap.config.KustvaktBaseDaoInterface;
import de.ids_mannheim.korap.config.KustvaktConfiguration;
@@ -8,8 +9,6 @@
import de.ids_mannheim.korap.interfaces.db.EntityHandlerIface;
import de.ids_mannheim.korap.user.*;
import org.junit.After;
-import org.junit.AfterClass;
-import org.junit.Assert;
import org.junit.Test;
import static org.junit.Assert.assertNotEquals;
diff --git a/src/test/java/de/ids_mannheim/korap/user/UserdataTest.java b/src/test/java/de/ids_mannheim/korap/user/UserdataTest.java
index 65b93c8..9295cf3 100644
--- a/src/test/java/de/ids_mannheim/korap/user/UserdataTest.java
+++ b/src/test/java/de/ids_mannheim/korap/user/UserdataTest.java
@@ -1,5 +1,6 @@
package de.ids_mannheim.korap.user;
+import de.ids_mannheim.korap.config.Attributes;
import de.ids_mannheim.korap.config.BeanConfigTest;
import de.ids_mannheim.korap.config.BeansFactory;
import de.ids_mannheim.korap.exceptions.KustvaktException;
diff --git a/src/test/java/de/ids_mannheim/korap/web/service/full/FilterTest.java b/src/test/java/de/ids_mannheim/korap/web/service/full/FilterTest.java
index 5392eec..1da69b9 100644
--- a/src/test/java/de/ids_mannheim/korap/web/service/full/FilterTest.java
+++ b/src/test/java/de/ids_mannheim/korap/web/service/full/FilterTest.java
@@ -4,7 +4,7 @@
import de.ids_mannheim.korap.config.TestHelper;
import de.ids_mannheim.korap.exceptions.KustvaktException;
import de.ids_mannheim.korap.security.auth.BasicHttpAuth;
-import de.ids_mannheim.korap.user.Attributes;
+import de.ids_mannheim.korap.config.Attributes;
import de.ids_mannheim.korap.web.service.FastJerseyTest;
import org.eclipse.jetty.server.Response;
import org.junit.BeforeClass;
diff --git a/src/test/java/de/ids_mannheim/korap/web/service/full/OAuth2EndpointTest.java b/src/test/java/de/ids_mannheim/korap/web/service/full/OAuth2EndpointTest.java
index 60b7267..a1a5d5f 100644
--- a/src/test/java/de/ids_mannheim/korap/web/service/full/OAuth2EndpointTest.java
+++ b/src/test/java/de/ids_mannheim/korap/web/service/full/OAuth2EndpointTest.java
@@ -5,7 +5,7 @@
import de.ids_mannheim.korap.config.TestHelper;
import de.ids_mannheim.korap.exceptions.KustvaktException;
import de.ids_mannheim.korap.security.auth.BasicHttpAuth;
-import de.ids_mannheim.korap.user.Attributes;
+import de.ids_mannheim.korap.config.Attributes;
import de.ids_mannheim.korap.utils.JsonUtils;
import de.ids_mannheim.korap.web.service.FastJerseyTest;
import org.junit.BeforeClass;
diff --git a/src/test/java/de/ids_mannheim/korap/web/service/full/ResourceServiceTest.java b/src/test/java/de/ids_mannheim/korap/web/service/full/ResourceServiceTest.java
index d9e761c..6cb7700 100644
--- a/src/test/java/de/ids_mannheim/korap/web/service/full/ResourceServiceTest.java
+++ b/src/test/java/de/ids_mannheim/korap/web/service/full/ResourceServiceTest.java
@@ -4,17 +4,14 @@
import com.sun.jersey.api.client.ClientResponse;
import de.ids_mannheim.korap.exceptions.KustvaktException;
import de.ids_mannheim.korap.security.auth.BasicHttpAuth;
-import de.ids_mannheim.korap.user.Attributes;
+import de.ids_mannheim.korap.config.Attributes;
import de.ids_mannheim.korap.utils.JsonUtils;
import de.ids_mannheim.korap.web.service.FastJerseyTest;
-import org.junit.Assert;
import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test;
-import static org.junit.Assert.assertEquals;
-import static org.junit.Assert.assertNotEquals;
-import static org.junit.Assert.assertNotNull;
+import static org.junit.Assert.*;
/**
* @author hanl
@@ -37,7 +34,6 @@
.path("search")
.queryParam("q", "[orth=das]")
.queryParam("ql", "poliqarp")
- // .queryParam("cq", "corpusID=GOE")
.header(Attributes.AUTHORIZATION,
BasicHttpAuth.encode("kustvakt", "kustvakt2015"))
.get(ClientResponse.class);
@@ -98,7 +94,7 @@
assertNotNull(node);
int docs = node.path("documents").asInt();
assertNotEquals(0, docs);
- Assert.assertTrue(docs < 15);
+ assertTrue(docs < 15);
}
@@ -121,6 +117,8 @@
.path("corpus/WPD/search").queryParam("q", "[base=Haus]")
.queryParam("ql", "poliqarp").queryParam("context", "base/s:s")
.method("TRACE", ClientResponse.class);
+ assertEquals(response.getStatus(),
+ ClientResponse.Status.OK.getStatusCode());
System.out.println("RESPONSE 1 " + response);
String ent = response.getEntity(String.class);
System.out.println("Entity 1 " + ent);
@@ -133,6 +131,8 @@
.path("search").queryParam("q", "[base=Haus]")
.queryParam("ql", "poliqarp").queryParam("context", "sentence")
.method("TRACE", ClientResponse.class);
+ assertEquals(response.getStatus(),
+ ClientResponse.Status.OK.getStatusCode());
String ent = response.getEntity(String.class);
JsonNode node = JsonUtils.readTree(ent);
System.out.println("PUBLIC COLLECTION");
@@ -146,6 +146,8 @@
.path("search").queryParam("q", "[base=Haus]")
.queryParam("ql", "poliqarp").queryParam("context", "sentence")
.get(ClientResponse.class);
+ assertEquals(response.getStatus(),
+ ClientResponse.Status.OK.getStatusCode());
String ent = response.getEntity(String.class);
JsonNode node = JsonUtils.readTree(ent);
assertNotNull(node);
@@ -161,6 +163,8 @@
.path("search").queryParam("context", "sentence")
.queryParam("q", "[pos=ADJA]").queryParam("ql", "poliqarp")
.get(ClientResponse.class);
+ assertEquals(response.getStatus(),
+ ClientResponse.Status.OK.getStatusCode());
}
@@ -169,6 +173,8 @@
public void testSerializationCollection () {
ClientResponse response = resource().path(getAPIVersion()).path("")
.get(ClientResponse.class);
+ assertEquals(response.getStatus(),
+ ClientResponse.Status.OK.getStatusCode());
}
@@ -178,6 +184,19 @@
}
+ @Test
+ public void testGetResources () {
+ ClientResponse response = resource().path(getAPIVersion())
+ .path("corpus").get(ClientResponse.class);
+ assertEquals(response.getStatus(),
+ ClientResponse.Status.OK.getStatusCode());
+ String ent = response.getEntity(String.class);
+ JsonNode node = JsonUtils.readTree(ent);
+ assertNotNull(node);
+ System.out.println("NODE 1 " + node);
+ }
+
+
@Override
public void initMethod () throws KustvaktException {
helper().runBootInterfaces();