formatter plugin
diff --git a/src/test/java/CollectionQueryBuilderTest.java b/src/test/java/CollectionQueryBuilderTest.java
index ab9706a..0840e20 100644
--- a/src/test/java/CollectionQueryBuilderTest.java
+++ b/src/test/java/CollectionQueryBuilderTest.java
@@ -15,33 +15,36 @@
public class CollectionQueryBuilderTest {
@Test
- public void testsimpleAdd() {
+ public void testsimpleAdd () {
CollectionQueryBuilder3 b = new CollectionQueryBuilder3();
b.addQuery("corpusID=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("koral:doc", node.at("/collection/@type").asText());
+ assertEquals("corpusID", node.at("/collection/key").asText());
}
+
@Test
- public void testSimpleConjunction() {
+ public void testSimpleConjunction () {
CollectionQueryBuilder3 b = new CollectionQueryBuilder3();
b.addQuery("corpusID=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("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("textClass",node.at("/collection/operands/1/key").asText());
+ assertEquals("corpusID", node.at("/collection/operands/0/key").asText());
+ assertEquals("textClass", node.at("/collection/operands/1/key")
+ .asText());
}
+
@Test
- public void testSimpleDisjunction() {
+ public void testSimpleDisjunction () {
CollectionQueryBuilder3 b = new CollectionQueryBuilder3();
b.addQuery("corpusID=WPD | textClass=freizeit");
JsonNode node = JsonUtils.readTree(b.toJSON());
@@ -57,15 +60,15 @@
.equals("textClass");
}
+
@Test
- public void testComplexSubQuery() {
+ public void testComplexSubQuery () {
CollectionQueryBuilder3 b = new CollectionQueryBuilder3();
- b.addQuery(
- "(corpusID=WPD) | (textClass=freizeit & corpusID=WPD)");
+ b.addQuery("(corpusID=WPD) | (textClass=freizeit & corpusID=WPD)");
JsonNode node = JsonUtils.readTree(b.toJSON());
- System.out.println(
- "_____________________________________________ COMPLEX");
+ System.out
+ .println("_____________________________________________ COMPLEX");
System.out.println(node);
assert node != null;
assert node.at("/collection/operation").asText().equals("operation:or");
@@ -76,8 +79,9 @@
}
+
@Test
- public void testAddResourceQueryAfter() {
+ public void testAddResourceQueryAfter () {
CollectionQueryBuilder3 b = new CollectionQueryBuilder3();
b.addQuery("(corpusID=ADF) | (textClass=freizeit & corpusID=WPD)");
@@ -94,8 +98,9 @@
.equals("wissenschaft");
}
+
@Test
- public void testAddComplexResourceQueryAfter() {
+ public void testAddComplexResourceQueryAfter () {
CollectionQueryBuilder3 b = new CollectionQueryBuilder3();
b.addQuery("(corpusID=ADF) | (textClass=freizeit & corpusID=WPD)");
@@ -115,8 +120,9 @@
}
+
@Test
- public void buildQuery() {
+ public void buildQuery () {
String query = "[base=Haus]";
QuerySerializer s = new QuerySerializer();
s.setQuery(query, "poliqarp");
@@ -127,8 +133,9 @@
System.out.println("QUERY " + s.toJSON());
}
+
@Test
- public void testBaseQueryBuild() {
+ public void testBaseQueryBuild () {
}
diff --git a/src/test/java/FileAuditingTest.java b/src/test/java/FileAuditingTest.java
index fecc338..9804107 100644
--- a/src/test/java/FileAuditingTest.java
+++ b/src/test/java/FileAuditingTest.java
@@ -15,22 +15,24 @@
public class FileAuditingTest extends BeanConfigTest {
@Override
- public void initMethod() throws KustvaktException {
+ public void initMethod () throws KustvaktException {
}
+
@Test
- public void testAdd() {
+ public void testAdd () {
for (int i = 0; i < 20; i++) {
- AuditRecord record = AuditRecord
- .serviceRecord("MichaelHanl", StatusCodes.ILLEGAL_ARGUMENT,
- String.valueOf(i), "string value");
+ AuditRecord record = AuditRecord.serviceRecord("MichaelHanl",
+ StatusCodes.ILLEGAL_ARGUMENT, String.valueOf(i),
+ "string value");
helper().getContext().getAuditingProvider().audit(record);
}
}
+
@Test(expected = UnsupportedOperationException.class)
- public void testRetrieval() {
+ public void testRetrieval () {
helper().getContext().getAuditingProvider()
.retrieveRecords(new LocalDate(new Date().getTime()), 10);
}
diff --git a/src/test/java/de/ids_mannheim/korap/config/ClassLoaderTest.java b/src/test/java/de/ids_mannheim/korap/config/ClassLoaderTest.java
index b40b8c7..0f95b20 100644
--- a/src/test/java/de/ids_mannheim/korap/config/ClassLoaderTest.java
+++ b/src/test/java/de/ids_mannheim/korap/config/ClassLoaderTest.java
@@ -17,29 +17,31 @@
public class ClassLoaderTest extends BeanConfigTest {
@Test
- public void testDefaultCreationThrowsNoException() {
+ public void testDefaultCreationThrowsNoException () {
DefaultHandler pl = new DefaultHandler();
Object o = pl.getDefault(ContextHolder.KUSTVAKT_AUDITING);
assertNotNull(o);
assertTrue(o instanceof AuditingIface);
}
+
@Test
- public void testDefaultCreation2ThrowsNoException() {
+ public void testDefaultCreation2ThrowsNoException () {
AuthenticationManagerIface iface = helper().getContext()
.getAuthenticationManager();
assertNotNull(iface);
assertTrue(iface instanceof KustvaktAuthenticationManager);
}
+
@Test
- public void testDefaultInterfaceMatchThrowsNoException() {
+ public void testDefaultInterfaceMatchThrowsNoException () {
AuditingIface iface = helper().getContext().getAuditingProvider();
assertNotNull(iface);
assertTrue(iface instanceof JDBCAuditing);
}
+
@Override
- public void initMethod() throws KustvaktException {
- }
+ public void initMethod () throws KustvaktException {}
}
diff --git a/src/test/java/de/ids_mannheim/korap/config/CollectionLoaderTest.java b/src/test/java/de/ids_mannheim/korap/config/CollectionLoaderTest.java
index d3bffd4..6f0ee8b 100644
--- a/src/test/java/de/ids_mannheim/korap/config/CollectionLoaderTest.java
+++ b/src/test/java/de/ids_mannheim/korap/config/CollectionLoaderTest.java
@@ -14,9 +14,9 @@
public class CollectionLoaderTest extends BeanConfigTest {
@Test
- public void testCollectionLoader() {
- ResourceDao dao = new ResourceDao(
- helper().getContext().getPersistenceClient());
+ public void testCollectionLoader () {
+ ResourceDao dao = new ResourceDao(helper().getContext()
+ .getPersistenceClient());
boolean error = false;
UserLoader u = new UserLoader();
@@ -24,15 +24,17 @@
try {
u.load(helper().getContext());
l.load(helper().getContext());
- }catch (KustvaktException e) {
+ }
+ catch (KustvaktException e) {
error = true;
}
Assert.assertFalse(error);
Assert.assertNotEquals("Is not supposed to be zero", 0, dao.size());
}
+
@Override
- public void initMethod() throws KustvaktException {
+ public void initMethod () throws KustvaktException {
}
}
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 d9e28e3..fe2201f 100644
--- a/src/test/java/de/ids_mannheim/korap/config/ConfigTest.java
+++ b/src/test/java/de/ids_mannheim/korap/config/ConfigTest.java
@@ -20,35 +20,40 @@
public class ConfigTest extends BeanConfigTest {
@Test
- public void testServiceInfo() {
+ public void testServiceInfo () {
String version = ServiceInfo.getInfo().getVersion();
String name = ServiceInfo.getInfo().getName();
assertNotEquals("wrong version", "UNKNOWN", version);
assertNotEquals("wrong name", "UNKNOWN", name);
}
+
@Test
- public void testProperties() {
- assertEquals("token layer does not match", "opennlp",
- helper().getContext().getConfiguration().getDefault_token());
+ public void testProperties () {
+ assertEquals("token layer does not match", "opennlp", helper()
+ .getContext().getConfiguration().getDefault_token());
assertEquals("token expiration does not match",
- TimeUtils.convertTimeToSeconds("1D"),
- helper().getContext().getConfiguration().getLongTokenTTL());
+ TimeUtils.convertTimeToSeconds("1D"), helper().getContext()
+ .getConfiguration().getLongTokenTTL());
}
+
@Test(expected = KustvaktException.class)
- public void testBeanOverrideInjection() throws KustvaktException {
- helper().getContext().getConfiguration().setPropertiesAsStream(
- ConfigTest.class.getClassLoader()
- .getResourceAsStream("kustvakt.conf"));
+ public void testBeanOverrideInjection () throws KustvaktException {
+ helper().getContext()
+ .getConfiguration()
+ .setPropertiesAsStream(
+ ConfigTest.class.getClassLoader().getResourceAsStream(
+ "kustvakt.conf"));
String v = "testmail_&234@ids-mannheim.de";
helper().getContext().getEncryption()
.validateEntry(v, Attributes.EMAIL);
}
+
@Test
- public void testBootConfigRun() {
+ public void testBootConfigRun () {
helper().runBootInterfaces();
helper().setupAccount();
assertNotNull(helper().getUser());
@@ -64,14 +69,14 @@
try {
iface = (BootableBeanInterface) cl.newInstance();
list.add(iface);
- }catch (InstantiationException | IllegalAccessException e) {
+ }
+ catch (InstantiationException | IllegalAccessException e) {
// do nothing
}
}
while (!set.isEmpty()) {
- out_loop:
- for (BootableBeanInterface iface : new ArrayList<>(list)) {
+ out_loop: for (BootableBeanInterface iface : new ArrayList<>(list)) {
for (Class cl : iface.getDependencies()) {
if (set.contains(cl))
continue out_loop;
@@ -84,16 +89,16 @@
assertEquals(check, tracker.size());
}
+
@Test
- public void testBootConfigDependencyOrder() {
+ public void testBootConfigDependencyOrder () {
// todo:
}
+
@Override
- public void initMethod() throws KustvaktException {
+ public void initMethod () throws KustvaktException {
}
}
-
-
diff --git a/src/test/java/de/ids_mannheim/korap/config/PolicyLoaderTest.java b/src/test/java/de/ids_mannheim/korap/config/PolicyLoaderTest.java
index a9270d2..3d3f8f7 100644
--- a/src/test/java/de/ids_mannheim/korap/config/PolicyLoaderTest.java
+++ b/src/test/java/de/ids_mannheim/korap/config/PolicyLoaderTest.java
@@ -17,7 +17,7 @@
public class PolicyLoaderTest extends BeanConfigTest {
@Test
- public void testPolicyLoader() {
+ public void testPolicyLoader () {
boolean error = false;
UserLoader u = new UserLoader();
CollectionLoader c = new CollectionLoader();
@@ -26,17 +26,20 @@
u.load(helper().getContext());
c.load(helper().getContext());
l.load(helper().getContext());
- }catch (KustvaktException e) {
+ }
+ catch (KustvaktException e) {
e.printStackTrace();
error = true;
}
assertFalse(error);
- PolicyDao dao = new PolicyDao(helper().getContext().getPersistenceClient());
+ PolicyDao dao = new PolicyDao(helper().getContext()
+ .getPersistenceClient());
assertNotEquals("Is not supposed to be zero", 0, dao.size());
}
+
@Override
- public void initMethod() throws KustvaktException {
+ public void initMethod () throws KustvaktException {
}
}
diff --git a/src/test/java/de/ids_mannheim/korap/config/TestBeans.java b/src/test/java/de/ids_mannheim/korap/config/TestBeans.java
index 6961289..7d33ba2 100644
--- a/src/test/java/de/ids_mannheim/korap/config/TestBeans.java
+++ b/src/test/java/de/ids_mannheim/korap/config/TestBeans.java
@@ -15,24 +15,33 @@
protected PersistenceClient dataSource;
- public abstract PolicyHandlerIface getPolicyDao();
- public abstract KustvaktConfiguration getConfig();
+ public abstract PolicyHandlerIface getPolicyDao ();
- public abstract EntityHandlerIface getUserDao();
- public abstract AuditingIface getAuditingDao();
+ public abstract KustvaktConfiguration getConfig ();
- public abstract List<ResourceOperationIface> getResourceDaos();
- public abstract List<UserDataDbIface> getUserdataDaos();
+ public abstract EntityHandlerIface getUserDao ();
- public abstract EncryptionIface getCrypto();
- public abstract AuthenticationManagerIface getAuthManager();
+ public abstract AuditingIface getAuditingDao ();
+
+
+ public abstract List<ResourceOperationIface> getResourceDaos ();
+
+
+ public abstract List<UserDataDbIface> getUserdataDaos ();
+
+
+ public abstract EncryptionIface getCrypto ();
+
+
+ public abstract AuthenticationManagerIface getAuthManager ();
+
@Bean(name = "kustvakt_db")
- public PersistenceClient getDataSource() {
+ public PersistenceClient getDataSource () {
return this.dataSource;
}
}
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 607cc71..0746293 100644
--- a/src/test/java/de/ids_mannheim/korap/config/TestHelper.java
+++ b/src/test/java/de/ids_mannheim/korap/config/TestHelper.java
@@ -39,7 +39,7 @@
/**
* creates a test user that can be used to access protected functions
- *
+ *
* @author hanl
* @date 16/10/2015
*/
@@ -51,37 +51,41 @@
private ContextHolder beansHolder;
- public static TestHelper newInstance(ApplicationContext ctx)
+
+ public static TestHelper newInstance (ApplicationContext ctx)
throws Exception {
TestHelper b = new TestHelper();
- b.beansHolder = new ContextHolder(ctx) {
- };
+ b.beansHolder = new ContextHolder(ctx) {};
return b;
}
- public <T> T getBean(Class<T> type) {
+
+ public <T> T getBean (Class<T> type) {
return this.beansHolder.getBean(type);
}
- public ContextHolder getContext() {
+
+ public ContextHolder getContext () {
return this.beansHolder;
}
- public <T> T getBean(String name) {
+
+ public <T> T getBean (String name) {
return (T) this.beansHolder.getBean(name);
}
- public TestHelper setupAccount() {
+
+ public TestHelper setupAccount () {
KustvaktBaseDaoInterface dao = getBean(ContextHolder.KUSTVAKT_USERDB);
- KustvaktAuthenticationManager manager = getBean(
- ContextHolder.KUSTVAKT_AUTHENTICATION_MANAGER);
+ KustvaktAuthenticationManager manager = getBean(ContextHolder.KUSTVAKT_AUTHENTICATION_MANAGER);
try {
getUser();
System.out.println("found user, skipping setup ...");
return this;
- }catch (RuntimeException e) {
+ }
+ catch (RuntimeException e) {
// do nothing and continue
}
@@ -101,7 +105,8 @@
try {
manager.createUserAccount(m, false);
- }catch (KustvaktException e) {
+ }
+ catch (KustvaktException e) {
// do nothing
e.printStackTrace();
assertNotNull("Test user could not be set up", null);
@@ -110,7 +115,8 @@
return this;
}
- public TestHelper setupSimpleAccount(String username, String password) {
+
+ public TestHelper setupSimpleAccount (String username, String password) {
KustvaktBaseDaoInterface dao = getBean(ContextHolder.KUSTVAKT_USERDB);
if (dao.size() == 0) {
@@ -118,11 +124,12 @@
m.put(Attributes.USERNAME, username);
try {
- String hash = ((EncryptionIface) getBean(
- ContextHolder.KUSTVAKT_ENCRYPTION))
+ String hash = ((EncryptionIface) getBean(ContextHolder.KUSTVAKT_ENCRYPTION))
.produceSecureHash(password);
m.put(Attributes.PASSWORD, hash);
- }catch (NoSuchAlgorithmException | UnsupportedEncodingException | KustvaktException e) {
+ }
+ catch (NoSuchAlgorithmException | UnsupportedEncodingException
+ | KustvaktException e) {
// do nohting
assertNotNull("Exception thrown", null);
}
@@ -134,7 +141,8 @@
assert BeansFactory.getKustvaktContext().getUserDBHandler()
.getAccount(credentials[0]) != null;
assert i == 1;
- }catch (KustvaktException e) {
+ }
+ catch (KustvaktException e) {
// do nothing
Assert.assertNull("Test user could not be set up", true);
}
@@ -142,20 +150,22 @@
return this;
}
- public User getUser() {
+
+ public User getUser () {
try {
return ((EntityHandlerIface) getBean(ContextHolder.KUSTVAKT_USERDB))
.getAccount(credentials[0]);
- }catch (KustvaktException e) {
+ }
+ catch (KustvaktException e) {
// do nothing
}
throw new RuntimeException("User could not be retrieved!");
}
- public TestHelper dropUser(String... usernames) throws KustvaktException {
+
+ public TestHelper dropUser (String ... usernames) throws KustvaktException {
if (usernames == null || usernames.length == 0) {
- KustvaktBaseDaoInterface dao = getBean(
- ContextHolder.KUSTVAKT_USERDB);
+ KustvaktBaseDaoInterface dao = getBean(ContextHolder.KUSTVAKT_USERDB);
dao.truncate();
}
for (String name : Arrays.asList(usernames)) {
@@ -165,14 +175,16 @@
return this;
}
- private boolean remove(String username) throws KustvaktException {
+
+ private boolean remove (String username) throws KustvaktException {
EntityHandlerIface dao = getBean(ContextHolder.KUSTVAKT_USERDB);
User us = dao.getAccount(username);
dao.deleteAccount(us.getId());
return true;
}
- public TestHelper truncateAll() {
+
+ public TestHelper truncateAll () {
String sql = "SELECT Concat('TRUNCATE TABLE ', TABLE_NAME) FROM INFORMATION_SCHEMA.TABLES";
final Set<String> queries = new HashSet<>();
PersistenceClient cl = getBean(ContextHolder.KUSTVAKT_POLICIES);
@@ -181,7 +193,7 @@
source.query(sql, new RowCallbackHandler() {
@Override
- public void processRow(ResultSet rs) throws SQLException {
+ public void processRow (ResultSet rs) throws SQLException {
queries.add(rs.getString(1));
}
@@ -192,11 +204,13 @@
return this;
}
- public static final String[] getUserCredentials() {
+
+ public static final String[] getUserCredentials () {
return Arrays.copyOf(credentials, 2);
}
- public TestHelper runBootInterfaces() {
+
+ public TestHelper runBootInterfaces () {
Set<Class<? extends BootableBeanInterface>> set = KustvaktClassLoader
.loadSubTypes(BootableBeanInterface.class);
@@ -206,18 +220,17 @@
try {
iface = (BootableBeanInterface) cl.newInstance();
list.add(iface);
- }catch (InstantiationException | IllegalAccessException e) {
+ }
+ catch (InstantiationException | IllegalAccessException e) {
// do nothing
}
}
System.out.println("Found boot loading interfaces: " + list);
while (!set.isEmpty()) {
- out_loop:
- for (BootableBeanInterface iface : new ArrayList<>(list)) {
+ out_loop: for (BootableBeanInterface iface : new ArrayList<>(list)) {
try {
- System.out.println(
- "Running boot instructions from class " + iface
- .getClass().getSimpleName());
+ System.out.println("Running boot instructions from class "
+ + iface.getClass().getSimpleName());
for (Class cl : iface.getDependencies()) {
if (set.contains(cl))
continue out_loop;
@@ -225,11 +238,11 @@
set.remove(iface.getClass());
list.remove(iface);
iface.load(beansHolder);
- }catch (KustvaktException e) {
+ }
+ catch (KustvaktException e) {
// don't do anything!
- System.out.println(
- "An error occurred in class " + iface.getClass()
- .getSimpleName() + "!\n" + e);
+ System.out.println("An error occurred in class "
+ + iface.getClass().getSimpleName() + "!\n" + e);
throw new RuntimeException(
"Boot loading interface failed ...");
}
@@ -238,24 +251,27 @@
return this;
}
- public int setupResource(KustvaktResource resource)
+
+ public int setupResource (KustvaktResource resource)
throws KustvaktException {
ResourceDao dao = new ResourceDao(
(PersistenceClient) getBean(ContextHolder.KUSTVAKT_DB));
return dao.storeResource(resource, getUser());
}
- public KustvaktResource getResource(String name) throws KustvaktException {
+
+ public KustvaktResource getResource (String name) throws KustvaktException {
ResourceDao dao = new ResourceDao(
(PersistenceClient) getBean(ContextHolder.KUSTVAKT_DB));
KustvaktResource res = dao.findbyId(name, getUser());
if (res == null)
- throw new RuntimeException(
- "resource with name " + name + " not found ...");
+ throw new RuntimeException("resource with name " + name
+ + " not found ...");
return res;
}
- public TestHelper dropResource(String... names) throws KustvaktException {
+
+ public TestHelper dropResource (String ... names) throws KustvaktException {
ResourceDao dao = new ResourceDao(
(PersistenceClient) getBean(ContextHolder.KUSTVAKT_DB));
if (names == null || names.length == 0)
@@ -265,15 +281,18 @@
return this;
}
- public void close() {
+
+ public void close () {
BeansFactory.closeApplication();
}
- private TestHelper() {
+
+ private TestHelper () {
}
- private static PersistenceClient mysql_db() throws IOException {
+
+ private static PersistenceClient mysql_db () throws IOException {
BasicDataSource dataSource = new BasicDataSource();
dataSource.setDriverClassName("com.mysql.jdbc.Driver");
dataSource.setUrl("jdbc:mysql://localhost:3306/kustvakt_test");
@@ -290,7 +309,8 @@
return client;
}
- private static PersistenceClient sqlite_db(Class testclass, boolean memory)
+
+ private static PersistenceClient sqlite_db (Class testclass, boolean memory)
throws InterruptedException {
SingleConnectionDataSource dataSource = new SingleConnectionDataSource();
dataSource.setDriverClassName("org.sqlite.JDBC");
@@ -303,8 +323,8 @@
File tmp = new File("tmp");
if (!tmp.exists())
tmp.mkdirs();
- dataSource.setUrl("jdbc:sqlite:tmp/sqlite_" + name +
- t.getMillis() + ".sqlite");
+ dataSource.setUrl("jdbc:sqlite:tmp/sqlite_" + name + t.getMillis()
+ + ".sqlite");
}
dataSource.setSuppressClose(true);
@@ -318,7 +338,8 @@
return client;
}
- public static PersistenceClient sqlite_db_norm(boolean memory) {
+
+ public static PersistenceClient sqlite_db_norm (boolean memory) {
BasicDataSource dataSource = new BasicDataSource();
dataSource.setDriverClassName("org.sqlite.JDBC");
dataSource.setMaxTotal(1);
@@ -345,7 +366,8 @@
return client;
}
- public static PersistenceClient h2_emb() throws SQLException {
+
+ public static PersistenceClient h2_emb () throws SQLException {
BasicDataSource dataSource = new BasicDataSource();
dataSource.setUrl("jdbc:h2:mem:");
dataSource.getConnection().nativeSQL("SET MODE MySQL;");
@@ -365,26 +387,29 @@
public static class AppTestConfig extends TestBeans {
- public AppTestConfig() throws InterruptedException, IOException {
+ public AppTestConfig () throws InterruptedException, IOException {
this.dataSource = TestHelper.sqlite_db(TestHelper.clazz, false);
//this.dataSource = TestHelper.mysql_db();
}
+
@Bean(name = ContextHolder.KUSTVAKT_POLICIES)
@Override
- public PolicyHandlerIface getPolicyDao() {
+ public PolicyHandlerIface getPolicyDao () {
return new PolicyDao(this.dataSource);
}
+
@Bean(name = ContextHolder.KUSTVAKT_USERDB)
@Override
- public EntityHandlerIface getUserDao() {
+ public EntityHandlerIface getUserDao () {
return new EntityDao(this.dataSource);
}
+
@Bean(name = ContextHolder.KUSTVAKT_CONFIG)
@Override
- public KustvaktConfiguration getConfig() {
+ public KustvaktConfiguration getConfig () {
KustvaktConfiguration c = new KustvaktConfiguration();
InputStream s = TestHelper.class.getClassLoader()
.getResourceAsStream("kustvakt.conf");
@@ -397,39 +422,44 @@
return c;
}
+
@Bean(name = ContextHolder.KUSTVAKT_AUDITING)
@Override
- public AuditingIface getAuditingDao() {
+ public AuditingIface getAuditingDao () {
return new JDBCAuditing(this.dataSource);
}
+
@Bean(name = ContextHolder.KUSTVAKT_RESOURCES)
@Override
- public List<ResourceOperationIface> getResourceDaos() {
+ public List<ResourceOperationIface> getResourceDaos () {
List<ResourceOperationIface> res = new ArrayList<>();
res.add(new ResourceDao(getDataSource()));
res.add(new DocumentDao(getDataSource()));
return res;
}
+
@Bean(name = ContextHolder.KUSTVAKT_USERDATA)
@Override
- public List<UserDataDbIface> getUserdataDaos() {
+ public List<UserDataDbIface> getUserdataDaos () {
List<UserDataDbIface> ud = new ArrayList<>();
ud.add(new UserSettingsDao(getDataSource()));
ud.add(new UserDetailsDao(getDataSource()));
return ud;
}
+
@Bean(name = ContextHolder.KUSTVAKT_ENCRYPTION)
@Override
- public EncryptionIface getCrypto() {
+ public EncryptionIface getCrypto () {
return new KustvaktEncryption(getConfig());
}
+
@Bean(name = ContextHolder.KUSTVAKT_AUTHENTICATION_MANAGER)
@Override
- public AuthenticationManagerIface getAuthManager() {
+ public AuthenticationManagerIface getAuthManager () {
AuthenticationManagerIface manager = new KustvaktAuthenticationManager(
getUserDao(), getCrypto(), getConfig(), getAuditingDao(),
getUserdataDaos());
diff --git a/src/test/java/de/ids_mannheim/korap/config/UserLoaderTest.java b/src/test/java/de/ids_mannheim/korap/config/UserLoaderTest.java
index 4e28c4d..91ad661 100644
--- a/src/test/java/de/ids_mannheim/korap/config/UserLoaderTest.java
+++ b/src/test/java/de/ids_mannheim/korap/config/UserLoaderTest.java
@@ -13,14 +13,16 @@
public class UserLoaderTest extends BeanConfigTest {
@Test
- public void testUserLoader() {
- EntityDao dao = new EntityDao(helper().getContext().getPersistenceClient());
+ public void testUserLoader () {
+ EntityDao dao = new EntityDao(helper().getContext()
+ .getPersistenceClient());
boolean error = false;
UserLoader l = new UserLoader();
try {
l.load(helper().getContext());
- }catch (KustvaktException e) {
+ }
+ catch (KustvaktException e) {
e.printStackTrace();
error = true;
}
@@ -28,8 +30,9 @@
Assert.assertNotEquals("Is not supposed to be zero", 0, dao.size());
}
+
@Override
- public void initMethod() throws KustvaktException {
+ public void initMethod () throws KustvaktException {
}
}
diff --git a/src/test/java/de/ids_mannheim/korap/handlers/DocumentDaoTest.java b/src/test/java/de/ids_mannheim/korap/handlers/DocumentDaoTest.java
index 9a13eb4..b3387c6 100644
--- a/src/test/java/de/ids_mannheim/korap/handlers/DocumentDaoTest.java
+++ b/src/test/java/de/ids_mannheim/korap/handlers/DocumentDaoTest.java
@@ -17,33 +17,38 @@
private static DocumentDao dao;
+
@After
- public void clear() {
+ public void clear () {
dao.truncate();
}
+
@Test
- public void testSet() throws KustvaktException {
+ public void testSet () throws KustvaktException {
Document doc = new Document("BRZ13_APR.00001");
doc.setDisabled(true);
dao.storeResource(doc, null);
}
+
@Test
- public void testGet() {
+ public void testGet () {
Document doc = new Document("BRZ13_APR.00002");
doc.setDisabled(true);
try {
dao.storeResource(doc, null);
Document doc1 = dao.findbyId(doc.getPersistentID(), null);
assert doc1 != null && doc.isDisabled();
- }catch (KustvaktException e) {
+ }
+ catch (KustvaktException e) {
e.printStackTrace();
}
}
+
@Test
- public void testRemove() {
+ public void testRemove () {
Document doc = new Document("BRZ13_APR.00003");
doc.setDisabled(true);
try {
@@ -52,18 +57,21 @@
assert dao.deleteResource(doc.getPersistentID(), null) == 1;
doc1 = dao.findbyId(doc.getPersistentID(), null);
assert doc1 == null;
- }catch (KustvaktException e) {
+ }
+ catch (KustvaktException e) {
e.printStackTrace();
}
}
+
@Test
- public void testEmptyFind() {
+ public void testEmptyFind () {
List<String> dc = null;
try {
dc = dao.findbyCorpus("WPD", true);
- }catch (KustvaktException e) {
+ }
+ catch (KustvaktException e) {
e.printStackTrace();
}
@@ -71,15 +79,17 @@
Assert.assertEquals("should be empty", 0, dc.size());
}
+
@Test
- public void testFind() {
+ public void testFind () {
int length = 10;
for (int i = 0; i < length; i++) {
Document doc = new Document("WPD_APR.0000" + i);
doc.setDisabled(true);
try {
dao.storeResource(doc, null);
- }catch (KustvaktException e) {
+ }
+ catch (KustvaktException e) {
e.printStackTrace();
break;
}
@@ -88,7 +98,8 @@
List<String> dc = null;
try {
dc = dao.findbyCorpus("WPD", true);
- }catch (KustvaktException e) {
+ }
+ catch (KustvaktException e) {
e.printStackTrace();
}
@@ -97,8 +108,9 @@
Assert.assertEquals("not all found", length, dc.size());
}
+
@Override
- public void initMethod() throws KustvaktException {
+ public void initMethod () throws KustvaktException {
dao = new DocumentDao(helper().getContext().getPersistenceClient());
}
}
diff --git a/src/test/java/de/ids_mannheim/korap/handlers/ResourceDaoTest.java b/src/test/java/de/ids_mannheim/korap/handlers/ResourceDaoTest.java
index 20825a7..04d3eef 100644
--- a/src/test/java/de/ids_mannheim/korap/handlers/ResourceDaoTest.java
+++ b/src/test/java/de/ids_mannheim/korap/handlers/ResourceDaoTest.java
@@ -25,8 +25,9 @@
private static List<Integer> ids = new ArrayList<>();
+
@Override
- public void initMethod() {
+ public void initMethod () {
helper().setupAccount();
List classes = new ArrayList<>(
@@ -40,41 +41,48 @@
r.setPersistentID(r.getName());
int id = helper().setupResource(r);
ids.add(id);
- assertNotEquals(0,
- new ResourceDao<>(helper().getContext().getPersistenceClient())
- .size());
- }catch (InstantiationException e) {
+ assertNotEquals(0, new ResourceDao<>(helper().getContext()
+ .getPersistenceClient()).size());
+ }
+ catch (InstantiationException e) {
if (i < classes.size())
classes.remove(i);
- }catch (KustvaktException | IllegalAccessException e) {
+ }
+ catch (KustvaktException | IllegalAccessException e) {
e.printStackTrace();
}
}
}
+
@Test
- public void testBatchGetResources() throws KustvaktException {
- ResourceDao dao = new ResourceDao(helper().getContext().getPersistenceClient());
+ public void testBatchGetResources () throws KustvaktException {
+ ResourceDao dao = new ResourceDao(helper().getContext()
+ .getPersistenceClient());
assertNotEquals(0, dao.size());
Collection res = dao.getResources(ids, User.UserFactory.getDemoUser());
assertEquals(ids.size(), res.size());
}
+
@Test
- public void testGetResource() throws KustvaktException {
- ResourceDao dao = new ResourceDao(helper().getContext().getPersistenceClient());
- assertEquals("sqlite",
- helper().getContext().getPersistenceClient().getDatabase());
+ public void testGetResource () throws KustvaktException {
+ ResourceDao dao = new ResourceDao(helper().getContext()
+ .getPersistenceClient());
+ assertEquals("sqlite", helper().getContext().getPersistenceClient()
+ .getDatabase());
assertNotEquals(0, dao.size());
- KustvaktResource res = dao
- .findbyId(ids.get(0), User.UserFactory.getDemoUser());
+ KustvaktResource res = dao.findbyId(ids.get(0),
+ User.UserFactory.getDemoUser());
assertNotNull(res);
}
+
@Test
- public void createCollection() throws KustvaktException {
- ResourceDao dao = new ResourceDao(helper().getContext().getPersistenceClient());
+ public void createCollection () throws KustvaktException {
+ ResourceDao dao = new ResourceDao(helper().getContext()
+ .getPersistenceClient());
VirtualCollection c = new VirtualCollection("testColl1");
c.addField("key_1", "this is a test");
c.addField("key_2", 2);
@@ -85,15 +93,17 @@
int id = dao.storeResource(c, user);
KustvaktResource r = dao.findbyId(id, user);
- assertNotEquals(dao.size(),0);
+ assertNotEquals(dao.size(), 0);
assertNotNull(r);
- assertEquals(r.getField("key_1") instanceof String,true);
- assertEquals(r.getField("key_2") instanceof Integer,true);
+ assertEquals(r.getField("key_1") instanceof String, true);
+ assertEquals(r.getField("key_2") instanceof Integer, true);
}
+
@Test
- public void ResourceDataUpdate() throws KustvaktException {
- ResourceDao dao = new ResourceDao(helper().getContext().getPersistenceClient());
+ public void ResourceDataUpdate () throws KustvaktException {
+ ResourceDao dao = new ResourceDao(helper().getContext()
+ .getPersistenceClient());
VirtualCollection c = new VirtualCollection("testColl2");
c.addField("key_1", "this is a test");
c.addField("key_2", 2);
diff --git a/src/test/java/de/ids_mannheim/korap/handlers/UserDaoTest.java b/src/test/java/de/ids_mannheim/korap/handlers/UserDaoTest.java
index 0c9be7c..d3bdc84 100644
--- a/src/test/java/de/ids_mannheim/korap/handlers/UserDaoTest.java
+++ b/src/test/java/de/ids_mannheim/korap/handlers/UserDaoTest.java
@@ -24,53 +24,58 @@
public class UserDaoTest extends BeanConfigTest {
@Test
- public void userput() throws KustvaktException {
+ public void userput () throws KustvaktException {
User user1 = helper().getContext().getUserDBHandler()
.getAccount(TestHelper.getUserCredentials()[0]);
assertEquals("user creation failed", true, user1.getId() != -1);
}
+
@Test
- public void userputBatch() {
+ public void userputBatch () {
//todo:
}
+
@Test
- public void userget() throws KustvaktException {
+ public void userget () throws KustvaktException {
User user1 = helper().getContext().getUserDBHandler()
.getAccount(TestHelper.getUserCredentials()[0]);
assertEquals("User Retrieval does not work",
TestHelper.getUserCredentials()[0], user1.getUsername());
}
+
// @Test
- public void testUserdetailsGetNonExistent() throws KustvaktException {
+ public void testUserdetailsGetNonExistent () throws KustvaktException {
helper().setupSimpleAccount("userdbtest", "userdbTest");
User user = helper().getContext().getUserDBHandler()
.getAccount("userdbtest");
- UserDataDbIface dao = BeansFactory.getTypeFactory().getTypedBean(helper()
- .getContext().getUserDataDaos(), UserDetails.class);
+ UserDataDbIface dao = BeansFactory.getTypeFactory().getTypedBean(
+ helper().getContext().getUserDataDaos(), UserDetails.class);
Userdata data = dao.get(user);
assertNull(data);
helper().dropUser("userdbtest");
}
+
// @Test
- public void testUserSettingsGetNonExistent() throws KustvaktException {
+ public void testUserSettingsGetNonExistent () throws KustvaktException {
helper().setupSimpleAccount("userdbtest", "userdbTest");
User user = helper().getContext().getUserDBHandler()
.getAccount("userdbtest");
- UserDataDbIface dao = BeansFactory.getTypeFactory().getTypedBean(helper()
- .getContext().getUserDataDaos(), UserSettings.class);
+ UserDataDbIface dao = BeansFactory.getTypeFactory().getTypedBean(
+ helper().getContext().getUserDataDaos(), UserSettings.class);
Userdata data = dao.get(user);
assertNull(data);
helper().dropUser("userdbtest");
}
+
// username cannot currently be changed
// @Test
- public void updateUsername() throws KustvaktException {
+ public void updateUsername () throws KustvaktException {
User user1 = helper().getContext().getUserDBHandler()
.getAccount(TestHelper.getUserCredentials()[0]);
user1.setUsername("new_user");
@@ -80,18 +85,20 @@
assertEquals("not found", user1.getUsername(), u2.getUsername());
}
+
@Test
- public void userupdate() throws KustvaktException {
+ public void userupdate () throws KustvaktException {
EntityHandlerIface dao = helper().getContext().getUserDBHandler();
User user1 = dao.getAccount(TestHelper.getUserCredentials()[0]);
user1.setAccountLocked(true);
dao.updateAccount(user1);
- assertEquals("not valid", true,
- dao.getAccount(user1.getUsername()).isAccountLocked());
+ assertEquals("not valid", true, dao.getAccount(user1.getUsername())
+ .isAccountLocked());
}
+
@Override
- public void initMethod() throws KustvaktException {
+ public void initMethod () throws KustvaktException {
helper().setupAccount();
helper().runBootInterfaces();
}
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 6574d09..0c7035b 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
@@ -26,14 +26,16 @@
private static KustvaktConfiguration config;
+
@Override
- public void initMethod() throws KustvaktException {
+ public void initMethod () throws KustvaktException {
config = helper().getContext().getConfiguration();
}
+
@Deprecated
@Test
- public void test2() {
+ public void test2 () {
Pattern p = Pattern.compile("([\\.\\w]+)\\((.+)\\)");
String cl = de.ids_mannheim.korap.security.ac.SecurityManager.class
.getCanonicalName();
@@ -43,8 +45,9 @@
}
+
@Test
- public void testCollectionNodeRemoveCorpusIdNoErrors() {
+ public void testCollectionNodeRemoveCorpusIdNoErrors () {
RewriteHandler handler = new RewriteHandler();
handler.insertBeans(helper().getContext());
handler.add(CollectionConstraint.class);
@@ -58,8 +61,9 @@
assertEquals(1, node.at("/collection/operands").size());
}
+
@Test
- public void testCollectionNodeRemoveAllCorpusIdNoErrors() {
+ public void testCollectionNodeRemoveAllCorpusIdNoErrors () {
RewriteHandler handler = new RewriteHandler();
handler.insertBeans(helper().getContext());
handler.add(CollectionConstraint.class);
@@ -74,49 +78,54 @@
assertEquals(0, node.at("/collection/operands").size());
}
+
@Test
- public void testCollectionNodeRemoveGroupedCorpusIdNoErrors() {
+ public void testCollectionNodeRemoveGroupedCorpusIdNoErrors () {
RewriteHandler handler = new RewriteHandler();
handler.insertBeans(helper().getContext());
handler.add(CollectionConstraint.class);
QuerySerializer s = new QuerySerializer();
s.setQuery(simple_add_query, "poliqarp");
- s.setCollection(
- "(corpusID=BRZ13 & textClass=Wissenschaft) & corpusID=WPD");
+ s.setCollection("(corpusID=BRZ13 & textClass=Wissenschaft) & corpusID=WPD");
String result = s.toJSON();
JsonNode node = JsonUtils.readTree(handler.preProcess(result,
User.UserFactory.getUser("test_user")));
assertNotNull(node);
- assertEquals("koral:docGroup",node.at("/collection/operands/0/@type").asText());
- assertEquals("textClass",node.at("/collection/operands/0/operands/0/key").asText());
+ assertEquals("koral:docGroup", node.at("/collection/operands/0/@type")
+ .asText());
+ assertEquals("textClass",
+ node.at("/collection/operands/0/operands/0/key").asText());
}
+
//fixme: will probably fail when one doc groups are being refactored
@Test
- public void testCollectionCleanEmptyDocGroupNoErrors() {
+ public void testCollectionCleanEmptyDocGroupNoErrors () {
RewriteHandler handler = new RewriteHandler();
handler.insertBeans(helper().getContext());
handler.add(CollectionConstraint.class);
handler.add(CollectionCleanupFilter.class);
QuerySerializer s = new QuerySerializer();
s.setQuery(simple_add_query, "poliqarp");
- s.setCollection(
- "(corpusID=BRZ13 & corpusID=WPD) & textClass=Wissenschaft & textClass=Sport");
+ s.setCollection("(corpusID=BRZ13 & corpusID=WPD) & textClass=Wissenschaft & textClass=Sport");
String result = s.toJSON();
JsonNode node = JsonUtils.readTree(handler.preProcess(result,
User.UserFactory.getUser("test_user")));
assertNotNull(node);
- assertEquals("koral:docGroup",node.at("/collection/@type").asText());
- assertEquals(2,node.at("/collection/operands").size());
+ assertEquals("koral:docGroup", node.at("/collection/@type").asText());
+ assertEquals(2, node.at("/collection/operands").size());
- assertEquals("textClass",node.at("/collection/operands/0/key").asText());
- assertEquals("textClass",node.at("/collection/operands/1/key").asText());
+ assertEquals("textClass", node.at("/collection/operands/0/key")
+ .asText());
+ assertEquals("textClass", node.at("/collection/operands/1/key")
+ .asText());
}
+
@Test
- public void testCollectionCleanMoveOneDocFromGroupUpNoErrors() {
+ public void testCollectionCleanMoveOneDocFromGroupUpNoErrors () {
RewriteHandler handler = new RewriteHandler();
handler.insertBeans(helper().getContext());
handler.add(CollectionConstraint.class);
@@ -128,46 +137,47 @@
JsonNode node = JsonUtils.readTree(handler.preProcess(result,
User.UserFactory.getUser("test_user")));
assertNotNull(node);
- assertEquals("koral:doc",node.at("/collection/@type").asText());
+ assertEquals("koral:doc", node.at("/collection/@type").asText());
}
+
@Test
- public void testCollectionCleanEmptyGroupAndMoveOneFromGroupUpNoErrors() {
+ public void testCollectionCleanEmptyGroupAndMoveOneFromGroupUpNoErrors () {
RewriteHandler handler = new RewriteHandler();
handler.insertBeans(helper().getContext());
handler.add(CollectionConstraint.class);
handler.add(CollectionCleanupFilter.class);
QuerySerializer s = new QuerySerializer();
s.setQuery(simple_add_query, "poliqarp");
- s.setCollection(
- "(corpusID=BRZ13 & corpusID=WPD) & textClass=Wissenschaft");
+ s.setCollection("(corpusID=BRZ13 & corpusID=WPD) & textClass=Wissenschaft");
String result = s.toJSON();
JsonNode node = JsonUtils.readTree(handler.preProcess(result,
User.UserFactory.getUser("test_user")));
assertNotNull(node);
- assertEquals("koral:doc",node.at("/collection/@type").asText());
- assertEquals("textClass",node.at("/collection/key").asText());
+ assertEquals("koral:doc", node.at("/collection/@type").asText());
+ assertEquals("textClass", node.at("/collection/key").asText());
}
+
@Test
- public void testCollectionRemoveAndMoveOneFromGroupUpNoErrors() {
+ public void testCollectionRemoveAndMoveOneFromGroupUpNoErrors () {
RewriteHandler handler = new RewriteHandler();
handler.insertBeans(helper().getContext());
handler.add(CollectionConstraint.class);
handler.add(CollectionCleanupFilter.class);
QuerySerializer s = new QuerySerializer();
s.setQuery(simple_add_query, "poliqarp");
- s.setCollection(
- "(docID=random & textClass=Wissenschaft) & corpusID=WPD");
+ s.setCollection("(docID=random & textClass=Wissenschaft) & corpusID=WPD");
String org = s.toJSON();
JsonNode node = JsonUtils.readTree(handler.preProcess(org,
User.UserFactory.getUser("test_user")));
assertNotNull(node);
- assertEquals("koral:docGroup",node.at("/collection/@type").asText());
+ assertEquals("koral:docGroup", node.at("/collection/@type").asText());
assertEquals(2, node.at("/collection/operands").size());
- assertEquals("koral:doc",node.at("/collection/operands/0/@type").asText());
+ assertEquals("koral:doc", node.at("/collection/operands/0/@type")
+ .asText());
}
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 0cbd369..cb7d38d 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
@@ -32,14 +32,16 @@
private static KustvaktConfiguration config;
+
@Override
- public void initMethod() throws KustvaktException {
+ public void initMethod () throws KustvaktException {
config = helper().getContext().getConfiguration();
helper().setupAccount();
}
+
@Test
- public void testDefaultLayerMapperThrowsNoException() {
+ public void testDefaultLayerMapperThrowsNoException () {
LayerMapper m = new LayerMapper(config);
assertEquals(config.getDefault_lemma(), m.findFoundry("lemma"));
@@ -49,11 +51,12 @@
assertEquals(config.getDefault_const(), m.findFoundry("c"));
}
- @Test
- public void testDefaultFoundryInjectLemmaThrowsNoError() {
- KustvaktConfiguration c = helper()
- .getBean(ContextHolder.KUSTVAKT_CONFIG);
+ @Test
+ public void testDefaultFoundryInjectLemmaThrowsNoError () {
+
+ KustvaktConfiguration c = helper().getBean(
+ ContextHolder.KUSTVAKT_CONFIG);
RewriteHandler processor = new RewriteHandler();
processor.insertBeans(helper().getContext());
@@ -65,19 +68,20 @@
assertNotNull(node);
assertFalse(node.at("/query/wrap/foundry").isMissingNode());
- assertEquals(c.getDefault_lemma(),
- node.at("/query/wrap/foundry").asText());
+ assertEquals(c.getDefault_lemma(), node.at("/query/wrap/foundry")
+ .asText());
assertEquals("lemma", node.at("/query/wrap/layer").asText());
assertFalse(node.at("/query/wrap/rewrites").isMissingNode());
- assertEquals("koral:rewrite",
- node.at("/query/wrap/rewrites/0/@type").asText());
+ assertEquals("koral:rewrite", node.at("/query/wrap/rewrites/0/@type")
+ .asText());
}
- @Test
- public void testDefaultFoundryInjectPOSNoErrors() {
- KustvaktConfiguration c = helper()
- .getBean(ContextHolder.KUSTVAKT_CONFIG);
+ @Test
+ public void testDefaultFoundryInjectPOSNoErrors () {
+
+ KustvaktConfiguration c = helper().getBean(
+ ContextHolder.KUSTVAKT_CONFIG);
QuerySerializer s = new QuerySerializer();
RewriteHandler handler = new RewriteHandler();
@@ -89,17 +93,18 @@
assertNotNull(node);
assertFalse(node.at("/query/wrap/foundry").isMissingNode());
- assertEquals(c.getDefault_pos(),
- node.at("/query/wrap/foundry").asText());
+ assertEquals(c.getDefault_pos(), node.at("/query/wrap/foundry")
+ .asText());
assertEquals("pos", node.at("/query/wrap/layer").asText());
assertFalse(node.at("/query/wrap/rewrites").isMissingNode());
- assertEquals("koral:rewrite",
- node.at("/query/wrap/rewrites/0/@type").asText());
+ assertEquals("koral:rewrite", node.at("/query/wrap/rewrites/0/@type")
+ .asText());
}
+
@Test
- public void testRewriteFoundryInjectPOSThrowsNoError()
+ public void testRewriteFoundryInjectPOSThrowsNoError ()
throws KustvaktException {
User user = helper().getUser();
@@ -111,9 +116,8 @@
String result = handler.preProcess(s.toJSON(), user);
JsonNode node = JsonUtils.readTree(result);
- UserDataDbIface dao = BeansFactory.getTypeFactory()
- .getTypedBean(helper().getContext().getUserDataDaos(),
- UserSettings.class);
+ UserDataDbIface dao = BeansFactory.getTypeFactory().getTypedBean(
+ helper().getContext().getUserDataDaos(), UserSettings.class);
UserSettings settings = (UserSettings) dao.get(user);
assertTrue(settings.isValid());
String pos = (String) settings.get(Attributes.DEFAULT_POS_FOUNDRY);
@@ -122,15 +126,16 @@
assertEquals("pos", node.at("/query/wrap/layer").asText());
assertEquals(pos, node.at("/query/wrap/foundry").asText());
assertFalse(node.at("/query/wrap/rewrites").isMissingNode());
- assertEquals("koral:rewrite",
- node.at("/query/wrap/rewrites/0/@type").asText());
+ assertEquals("koral:rewrite", node.at("/query/wrap/rewrites/0/@type")
+ .asText());
}
+
@Test
- public void testRewriteFoundryInjectLemmaThrowsNoError()
+ public void testRewriteFoundryInjectLemmaThrowsNoError ()
throws KustvaktException {
- KustvaktConfiguration c = helper()
- .getBean(ContextHolder.KUSTVAKT_CONFIG);
+ KustvaktConfiguration c = helper().getBean(
+ ContextHolder.KUSTVAKT_CONFIG);
User user = helper().getUser();
RewriteHandler handler = new RewriteHandler();
@@ -141,9 +146,8 @@
String result = handler.preProcess(s.toJSON(), user);
JsonNode node = JsonUtils.readTree(result);
- UserDataDbIface dao = BeansFactory.getTypeFactory()
- .getTypedBean(helper().getContext().getUserDataDaos(),
- UserSettings.class);
+ UserDataDbIface dao = BeansFactory.getTypeFactory().getTypedBean(
+ helper().getContext().getUserDataDaos(), UserSettings.class);
UserSettings settings = (UserSettings) dao.get(user);
assertTrue(settings.isValid());
String lemma = (String) settings.get(Attributes.DEFAULT_LEMMA_FOUNDRY);
@@ -152,14 +156,15 @@
assertEquals("lemma", node.at("/query/wrap/layer").asText());
assertEquals(lemma, node.at("/query/wrap/foundry").asText());
assertFalse(node.at("/query/wrap/rewrites").isMissingNode());
- assertEquals("koral:rewrite",
- node.at("/query/wrap/rewrites/0/@type").asText());
+ assertEquals("koral:rewrite", node.at("/query/wrap/rewrites/0/@type")
+ .asText());
}
+
@Test
- public void testFoundryInjectJoinedQueryNoErrors() {
- KustvaktConfiguration c = helper()
- .getBean(ContextHolder.KUSTVAKT_CONFIG);
+ public void testFoundryInjectJoinedQueryNoErrors () {
+ KustvaktConfiguration c = helper().getBean(
+ ContextHolder.KUSTVAKT_CONFIG);
QuerySerializer s = new QuerySerializer();
RewriteHandler handler = new RewriteHandler();
@@ -177,8 +182,9 @@
assertFalse(node.at("/query/wrap/operands/1/rewrites").isMissingNode());
}
+
@Test
- public void testFoundryInjectGroupedQueryNoErrors() {
+ public void testFoundryInjectGroupedQueryNoErrors () {
QuerySerializer s = new QuerySerializer();
RewriteHandler handler = new RewriteHandler();
handler.insertBeans(helper().getContext());
diff --git a/src/test/java/de/ids_mannheim/korap/resource/rewrite/IdRewriteTest.java b/src/test/java/de/ids_mannheim/korap/resource/rewrite/IdRewriteTest.java
index 09be840..2f069f1 100644
--- a/src/test/java/de/ids_mannheim/korap/resource/rewrite/IdRewriteTest.java
+++ b/src/test/java/de/ids_mannheim/korap/resource/rewrite/IdRewriteTest.java
@@ -16,7 +16,7 @@
public class IdRewriteTest extends BeanConfigTest {
@Test
- public void insertTokenId() {
+ public void insertTokenId () {
RewriteHandler handler = new RewriteHandler();
handler.insertBeans(helper().getContext());
assertTrue(handler.add(IdWriter.class));
@@ -32,8 +32,9 @@
assertTrue(result.path("query").has("idn"));
}
+
@Test
- public void testIdWriterTest() {
+ public void testIdWriterTest () {
RewriteHandler handler = new RewriteHandler();
handler.insertBeans(helper().getContext());
assertTrue(handler.add(IdWriter.class));
@@ -47,8 +48,9 @@
assertFalse(node.at("/query/idn").isMissingNode());
}
+
@Override
- public void initMethod() throws KustvaktException {
+ public void initMethod () throws KustvaktException {
}
}
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 a3b19a0..91ee4e0 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
@@ -21,49 +21,54 @@
public class PostRewriteTest extends BeanConfigTest {
@Override
- public void initMethod() throws KustvaktException {
+ public void initMethod () throws KustvaktException {
}
+
// otherwise cache will maintain values not relevant for other tests
@Before
- public void before() {
+ public void before () {
CacheManager.getInstance().getCache("documents").removeAll();
- DocumentDao dao = new DocumentDao(
- helper().getContext().getPersistenceClient());
+ DocumentDao dao = new DocumentDao(helper().getContext()
+ .getPersistenceClient());
dao.truncate();
}
+
@Test
- public void testPostRewriteNothingToDo() throws KustvaktException {
+ public void testPostRewriteNothingToDo () throws KustvaktException {
RewriteHandler ha = new RewriteHandler();
ha.insertBeans(helper().getContext());
assertEquals("Handler could not be added to rewriter instance!", true,
ha.add(DocMatchRewrite.class));
- DocumentDao dao = new DocumentDao(
- helper().getContext().getPersistenceClient());
+ DocumentDao dao = new DocumentDao(helper().getContext()
+ .getPersistenceClient());
try {
Document d = dao.findbyId("BRZ13_APR.00014", null);
assertNull(d);
String v = ha.postProcess(RESULT, null);
assertEquals("results do not match", JsonUtils.readTree(RESULT),
JsonUtils.readTree(v));
- }catch (Exception e) {
+ }
+ catch (Exception e) {
e.printStackTrace();
}
}
+
@Test
- public void testPostRewriteRemoveDoc() {
- DocumentDao dao = new DocumentDao(
- helper().getContext().getPersistenceClient());
+ public void testPostRewriteRemoveDoc () {
+ DocumentDao dao = new DocumentDao(helper().getContext()
+ .getPersistenceClient());
Document doc = new Document("BRZ13_APR.00014");
doc.setDisabled(true);
try {
dao.storeResource(doc, null);
- }catch (KustvaktException e) {
+ }
+ catch (KustvaktException e) {
return;
}
@@ -84,15 +89,17 @@
Document d = dao.findbyId(doc.getPersistentID(), null);
if (d != null)
System.out.println("IS SUPPOSED TO BE NULL! " + d);
- }catch (KustvaktException e) {
+ }
+ catch (KustvaktException e) {
e.printStackTrace();
return;
}
}
+
@Test
- public void testPath() {
+ public void testPath () {
String v = "{\n" + " \"meta\": {\n" + " \"count\": 25,\n"
+ " \"startIndex\": 0,\n"
+ " \"timeout\": 120000,\n" + " \"context\": {\n"
@@ -104,368 +111,409 @@
}
- private static final String RESULT =
- "{\n" + " \"meta\": {\n" + " \"count\": 25,\n"
- + " \"startIndex\": 0,\n"
- + " \"timeout\": 120000,\n"
- + " \"context\": {\n" + " \"left\": [\n"
- + " \"token\",\n" + " 6\n"
- + " ],\n" + " \"right\": [\n"
- + " \"token\",\n" + " 6\n"
- + " ]\n" + " },\n"
- + " \"fields\": [\n" + " \"textSigle\",\n"
- + " \"author\",\n"
- + " \"docSigle\",\n" + " \"title\",\n"
- + " \"pubDate\",\n" + " \"UID\",\n"
- + " \"corpusID\",\n"
- + " \"textClass\",\n"
- + " \"subTitle\",\n"
- + " \"layerInfos\",\n" + " \"ID\",\n"
- + " \"pubPlace\",\n"
- + " \"corpusSigle\"\n" + " ],\n"
- + " \"version\": \"unknown\",\n"
- + " \"benchmark\": \"0.204314141 s\",\n"
- + " \"totalResults\": 1755,\n"
- + " \"serialQuery\": \"tokens:tt/l:Wort\",\n"
- + " \"itemsPerPage\": 25\n" + " },\n"
- + " \"query\": {\n"
- + " \"@type\": \"koral:token\",\n"
- + " \"wrap\": {\n"
- + " \"@type\": \"koral:term\",\n"
- + " \"key\": \"Wort\",\n"
- + " \"layer\": \"lemma\",\n"
- + " \"match\": \"match:eq\",\n"
- + " \"foundry\": \"tt\",\n"
- + " \"rewrites\": [\n" + " {\n"
- + " \"@type\": \"koral:rewrite\",\n"
- + " \"src\": \"Kustvakt\",\n"
- + " \"operation\": \"operation:injection\"\n"
- + " }\n" + " ]\n" + " }\n"
- + " },\n" + " \"matches\": [\n" + " {\n"
- + " \"field\": \"tokens\",\n"
- + " \"textClass\": \"staat-gesellschaft familie-geschlecht\",\n"
- + " \"title\": \"Sexueller Missbrauch –„Das schreiende Kind steckt noch tief in mir“\",\n"
- + " \"author\": \"\",\n"
- + " \"startMore\": true,\n"
- + " \"endMore\": true,\n"
- + " \"corpusID\": \"BRZ13\",\n"
- + " \"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>in ihrer Stimme schwingt bei diesem </span><mark>Wort</mark><span class=\\\"context-right\\\"> Sarkasmus mit. Bis man einen passenden<span class=\\\"more\\\"></span></span>\",\n"
- + " \"matchID\": \"match-BRZ13!BRZ13_APR.00001-p454-455\",\n"
- + " \"docID\": \"BRZ13_APR.00001\",\n"
- + " \"UID\": 0,\n"
- + " \"pubDate\": \"2013-04-02\"\n"
- + " },\n" + " {\n"
- + " \"field\": \"tokens\",\n"
- + " \"textClass\": \"freizeit-unterhaltung reisen\",\n"
- + " \"title\": \"Leben dick und prall\",\n"
- + " \"author\": \"\",\n"
- + " \"startMore\": true,\n"
- + " \"endMore\": true,\n"
- + " \"corpusID\": \"BRZ13\",\n"
- + " \"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>der DLRG, ausgelassene Partys und markige </span><mark>Worte</mark><span class=\\\"context-right\\\"> des Dompredigers: „Ostern ist kein goethischer<span class=\\\"more\\\"></span></span>\",\n"
- + " \"matchID\": \"match-BRZ13!BRZ13_APR.00014-p96-97\",\n"
- + " \"docID\": \"BRZ13_APR.00014\",\n"
- + " \"UID\": 0,\n"
- + " \"pubDate\": \"2013-04-02\"\n"
- + " },\n" + " {\n"
- + " \"field\": \"tokens\",\n"
- + " \"textClass\": \"staat-gesellschaft biographien-interviews kultur musik\",\n"
- + " \"title\": \"So wird es gemacht:\",\n"
- + " \"author\": \"\",\n"
- + " \"startMore\": true,\n"
- + " \"endMore\": true,\n"
- + " \"corpusID\": \"BRZ13\",\n"
- + " \"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>derfehlende Buchstabe.Gelingt es dir,das </span><mark>Wort</mark><span class=\\\"context-right\\\"> vervollständigen? Tipp: Probiere auch mal rückwärts<span class=\\\"more\\\"></span></span>\",\n"
- + " \"matchID\": \"match-BRZ13!BRZ13_APR.00055-p19-20\",\n"
- + " \"docID\": \"BRZ13_APR.00055\",\n"
- + " \"UID\": 0,\n"
- + " \"pubDate\": \"2013-04-02\"\n"
- + " },\n" + " {\n"
- + " \"field\": \"tokens\",\n"
- + " \"textClass\": \"politik ausland\",\n"
- + " \"title\": \"Südkorea droht mit Angriffen – USA rüsten auf\",\n"
- + " \"author\": \"\",\n"
- + " \"startMore\": true,\n"
- + " \"endMore\": true,\n"
- + " \"corpusID\": \"BRZ13\",\n"
- + " \"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>der Stunde. „Aus einem Krieg der </span><mark>Worte</mark><span class=\\\"context-right\\\"> darf kein echter Krieg werden“, sagte<span class=\\\"more\\\"></span></span>\",\n"
- + " \"matchID\": \"match-BRZ13!BRZ13_APR.00076-p238-239\",\n"
- + " \"docID\": \"BRZ13_APR.00076\",\n"
- + " \"UID\": 0,\n"
- + " \"pubDate\": \"2013-04-02\"\n"
- + " },\n" + " {\n"
- + " \"field\": \"tokens\",\n"
- + " \"textClass\": \"politik inland freizeit-unterhaltung reisen\",\n"
- + " \"title\": \"Dauercamper kämpfen für ihren Platz\",\n"
- + " \"author\": \"\",\n"
- + " \"startMore\": true,\n"
- + " \"endMore\": true,\n"
- + " \"corpusID\": \"BRZ13\",\n"
- + " \"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>„Initiative Campingplatz Räbke“. „Als ich das </span><mark>Wort</mark><span class=\\\"context-right\\\"> Schließung gelesen habe, war ich richtig<span class=\\\"more\\\"></span></span>\",\n"
- + " \"matchID\": \"match-BRZ13!BRZ13_APR.00200-p255-256\",\n"
- + " \"docID\": \"BRZ13_APR.00200\",\n"
- + " \"UID\": 0,\n"
- + " \"pubDate\": \"2013-04-02\"\n"
- + " },\n" + " {\n"
- + " \"field\": \"tokens\",\n"
- + " \"textClass\": \"freizeit-unterhaltung reisen\",\n"
- + " \"title\": \"Neue Aktionen lockten Besucher\",\n"
- + " \"author\": \"\",\n"
- + " \"startMore\": true,\n"
- + " \"endMore\": true,\n"
- + " \"corpusID\": \"BRZ13\",\n"
- + " \"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>Jan Waldheim (CWG) unter den aufmunternden </span><mark>Worten</mark><span class=\\\"context-right\\\"> eines augenzwinkernden Axel Schnalke („Ein bisschen<span class=\\\"more\\\"></span></span>\",\n"
- + " \"matchID\": \"match-BRZ13!BRZ13_APR.00210-p142-143\",\n"
- + " \"docID\": \"BRZ13_APR.00210\",\n"
- + " \"UID\": 0,\n"
- + " \"pubDate\": \"2013-04-02\"\n"
- + " },\n" + " {\n"
- + " \"field\": \"tokens\",\n"
- + " \"textClass\": \"kultur musik\",\n"
- + " \"title\": \"Travestie – Helden in Strumpfhosen\",\n"
- + " \"author\": \"\",\n"
- + " \"startMore\": true,\n"
- + " \"endMore\": true,\n"
- + " \"corpusID\": \"BRZ13\",\n"
- + " \"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>trotzdem nicht. Selten wurden so viele </span><mark>Worte</mark><span class=\\\"context-right\\\">, die der Autor hier lieber verschweigt<span class=\\\"more\\\"></span></span>\",\n"
- + " \"matchID\": \"match-BRZ13!BRZ13_APR.00253-p166-167\",\n"
- + " \"docID\": \"BRZ13_APR.00253\",\n"
- + " \"UID\": 0,\n"
- + " \"pubDate\": \"2013-04-02\"\n"
- + " },\n" + " {\n"
- + " \"field\": \"tokens\",\n"
- + " \"textClass\": \"kultur musik\",\n"
- + " \"title\": \"Travestie – Helden in Strumpfhosen\",\n"
- + " \"author\": \"\",\n"
- + " \"startMore\": true,\n"
- + " \"endMore\": true,\n"
- + " \"corpusID\": \"BRZ13\",\n"
- + " \"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>zudem nicht immer nur bei den </span><mark>Worten</mark><span class=\\\"context-right\\\"> geblieben) und dabei gleichzeitig soviel Charme<span class=\\\"more\\\"></span></span>\",\n"
- + " \"matchID\": \"match-BRZ13!BRZ13_APR.00253-p191-192\",\n"
- + " \"docID\": \"BRZ13_APR.00253\",\n"
- + " \"UID\": 0,\n"
- + " \"pubDate\": \"2013-04-02\"\n"
- + " },\n" + " {\n"
- + " \"field\": \"tokens\",\n"
- + " \"textClass\": \"kultur musik\",\n"
- + " \"title\": \"Travestie – Helden in Strumpfhosen\",\n"
- + " \"author\": \"\",\n"
- + " \"startMore\": true,\n"
- + " \"endMore\": true,\n"
- + " \"corpusID\": \"BRZ13\",\n"
- + " \"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>bedeutet Travestie sich zu verkleiden, das </span><mark>Wort</mark><span class=\\\"context-right\\\"> stammt aus dem Französischen. Traditionell belegten<span class=\\\"more\\\"></span></span>\",\n"
- + " \"matchID\": \"match-BRZ13!BRZ13_APR.00253-p371-372\",\n"
- + " \"docID\": \"BRZ13_APR.00253\",\n"
- + " \"UID\": 0,\n"
- + " \"pubDate\": \"2013-04-02\"\n"
- + " },\n" + " {\n"
- + " \"field\": \"tokens\",\n"
- + " \"textClass\": \"sport fussball\",\n"
- + " \"title\": \"VfL kommt nicht vom Fleck\",\n"
- + " \"author\": \"\",\n"
- + " \"startMore\": true,\n"
- + " \"endMore\": true,\n"
- + " \"corpusID\": \"BRZ13\",\n"
- + " \"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>am internationalen Geschäft berechtigt. Mit anderen </span><mark>Worten</mark><span class=\\\"context-right\\\">: Die „Wölfe“ stecken im grauen Mittelmaß<span class=\\\"more\\\"></span></span>\",\n"
- + " \"matchID\": \"match-BRZ13!BRZ13_APR.00260-p93-94\",\n"
- + " \"docID\": \"BRZ13_APR.00260\",\n"
- + " \"UID\": 0,\n"
- + " \"pubDate\": \"2013-04-02\"\n"
- + " },\n" + " {\n"
- + " \"field\": \"tokens\",\n"
- + " \"textClass\": \"sport fussball\",\n"
- + " \"title\": \"Mensch, Mayer! Super Tor\",\n"
- + " \"author\": \"\",\n"
- + " \"startMore\": true,\n"
- + " \"endMore\": true,\n"
- + " \"corpusID\": \"BRZ13\",\n"
- + " \"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>bekommst, ist das unbezahlbar – ein Bonus.“ </span><mark>Worte</mark><span class=\\\"context-right\\\">, die dem Torschützen weiteres Selbstvertrauen geben<span class=\\\"more\\\"></span></span>\",\n"
- + " \"matchID\": \"match-BRZ13!BRZ13_APR.00275-p271-272\",\n"
- + " \"docID\": \"BRZ13_APR.00275\",\n"
- + " \"UID\": 0,\n"
- + " \"pubDate\": \"2013-04-02\"\n"
- + " },\n" + " {\n"
- + " \"field\": \"tokens\",\n"
- + " \"textClass\": \"sport fussball\",\n"
- + " \"title\": \"Nur Gerücht? KHL-Klub will „Dshuni“\",\n"
- + " \"author\": \"\",\n"
- + " \"startMore\": true,\n"
- + " \"endMore\": true,\n"
- + " \"corpusID\": \"BRZ13\",\n"
- + " \"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>und hakt das Thema ab.cb Kein </span><mark>Wort</mark><span class=\\\"context-right\\\"> zum Interesse aus Astana: Daniar Dshunussow.Foto<span class=\\\"more\\\"></span></span>\",\n"
- + " \"matchID\": \"match-BRZ13!BRZ13_APR.00277-p163-164\",\n"
- + " \"docID\": \"BRZ13_APR.00277\",\n"
- + " \"UID\": 0,\n"
- + " \"pubDate\": \"2013-04-02\"\n"
- + " },\n" + " {\n"
- + " \"field\": \"tokens\",\n"
- + " \"textClass\": \"staat-gesellschaft biographien-interviews\",\n"
- + " \"title\": \"Das Leben ist nicht auf diese Erde beschränkt\",\n"
- + " \"author\": \"\",\n"
- + " \"startMore\": true,\n"
- + " \"endMore\": true,\n"
- + " \"corpusID\": \"BRZ13\",\n"
- + " \"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>1. Korinther 1,18 denken: Denn das </span><mark>Wort</mark><span class=\\\"context-right\\\"> vom Kreuz ist eine Torheit denen<span class=\\\"more\\\"></span></span>\",\n"
- + " \"matchID\": \"match-BRZ13!BRZ13_APR.00520-p32-33\",\n"
- + " \"docID\": \"BRZ13_APR.00520\",\n"
- + " \"UID\": 0,\n"
- + " \"pubDate\": \"2013-04-03\"\n"
- + " },\n" + " {\n"
- + " \"field\": \"tokens\",\n"
- + " \"textClass\": \"sport fussball\",\n"
- + " \"title\": \"Allofs und Hecking knöpfensich die VfL-Profis vor\",\n"
- + " \"author\": \"\",\n"
- + " \"startMore\": true,\n"
- + " \"endMore\": true,\n"
- + " \"corpusID\": \"BRZ13\",\n"
- + " \"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>für die Profis am Dienstag klare </span><mark>Worte</mark><span class=\\\"context-right\\\"> vom Führungsduo. Von Thorsten Grunow Wolfsburg<span class=\\\"more\\\"></span></span>\",\n"
- + " \"matchID\": \"match-BRZ13!BRZ13_APR.00557-p17-18\",\n"
- + " \"docID\": \"BRZ13_APR.00557\",\n"
- + " \"UID\": 0,\n"
- + " \"pubDate\": \"2013-04-03\"\n"
- + " },\n" + " {\n"
- + " \"field\": \"tokens\",\n"
- + " \"textClass\": \"sport fussball\",\n"
- + " \"title\": \"Allofs und Hecking knöpfensich die VfL-Profis vor\",\n"
- + " \"author\": \"\",\n"
- + " \"startMore\": true,\n"
- + " \"endMore\": true,\n"
- + " \"corpusID\": \"BRZ13\",\n"
- + " \"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>Minuten setzte es am Dienstagnachmittag klare </span><mark>Worte</mark><span class=\\\"context-right\\\"> für die kickende Belegschaft, die durchaus<span class=\\\"more\\\"></span></span>\",\n"
- + " \"matchID\": \"match-BRZ13!BRZ13_APR.00557-p60-61\",\n"
- + " \"docID\": \"BRZ13_APR.00557\",\n"
- + " \"UID\": 0,\n"
- + " \"pubDate\": \"2013-04-03\"\n"
- + " },\n" + " {\n"
- + " \"field\": \"tokens\",\n"
- + " \"textClass\": \"sport fussball\",\n"
- + " \"title\": \"Allofs und Hecking knöpfensich die VfL-Profis vor\",\n"
- + " \"author\": \"\",\n"
- + " \"startMore\": true,\n"
- + " \"endMore\": true,\n"
- + " \"corpusID\": \"BRZ13\",\n"
- + " \"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>Manager ist überzeugt, dass die klaren </span><mark>Worte</mark><span class=\\\"context-right\\\"> auf fruchtbaren Boden gefallen sind. „Ich<span class=\\\"more\\\"></span></span>\",\n"
- + " \"matchID\": \"match-BRZ13!BRZ13_APR.00557-p235-236\",\n"
- + " \"docID\": \"BRZ13_APR.00557\",\n"
- + " \"UID\": 0,\n"
- + " \"pubDate\": \"2013-04-03\"\n"
- + " },\n" + " {\n"
- + " \"field\": \"tokens\",\n"
- + " \"textClass\": \"politik inland politik ausland\",\n"
- + " \"title\": \"Zeitungsartikelzufällig deponiert?\",\n"
- + " \"author\": \"\",\n"
- + " \"startMore\": true,\n"
- + " \"endMore\": true,\n"
- + " \"corpusID\": \"BRZ13\",\n"
- + " \"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>erspart“, lautete die Schlagzeile – wobei das </span><mark>Wort</mark><span class=\\\"context-right\\\"> „erspart“ abgeschnitten war. Ein plumper Versuch<span class=\\\"more\\\"></span></span>\",\n"
- + " \"matchID\": \"match-BRZ13!BRZ13_JAN.07616-p31-32\",\n"
- + " \"docID\": \"BRZ13_JAN.07616\",\n"
- + " \"UID\": 0,\n"
- + " \"pubDate\": \"2013-01-21\"\n"
- + " },\n" + " {\n"
- + " \"field\": \"tokens\",\n"
- + " \"textClass\": \"politik inland\",\n"
- + " \"title\": \"„Philipp Rösler wackelt nicht“\",\n"
- + " \"author\": \"\",\n"
- + " \"startMore\": true,\n"
- + " \"endMore\": true,\n"
- + " \"corpusID\": \"BRZ13\",\n"
- + " \"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>Vizekanzler bei all dem Jubel zu </span><mark>Wort</mark><span class=\\\"context-right\\\"> kommt. „Ein großartiger Tag“, sagt er<span class=\\\"more\\\"></span></span>\",\n"
- + " \"matchID\": \"match-BRZ13!BRZ13_JAN.07617-p177-178\",\n"
- + " \"docID\": \"BRZ13_JAN.07617\",\n"
- + " \"UID\": 0,\n"
- + " \"pubDate\": \"2013-01-21\"\n"
- + " },\n" + " {\n"
- + " \"field\": \"tokens\",\n"
- + " \"textClass\": \"freizeit-unterhaltung reisen\",\n"
- + " \"title\": \"Lanz gibt den charmanten, zurückhaltenden Gastgeber\",\n"
- + " \"author\": \"\",\n"
- + " \"startMore\": true,\n"
- + " \"endMore\": true,\n"
- + " \"corpusID\": \"BRZ13\",\n"
- + " \"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>er, als seine Assistentin ihm ins </span><mark>Wort</mark><span class=\\\"context-right\\\"> fiel. Dennoch holte das ungleiche Duo<span class=\\\"more\\\"></span></span>\",\n"
- + " \"matchID\": \"match-BRZ13!BRZ13_JAN.07621-p261-262\",\n"
- + " \"docID\": \"BRZ13_JAN.07621\",\n"
- + " \"UID\": 0,\n"
- + " \"pubDate\": \"2013-01-21\"\n"
- + " },\n" + " {\n"
- + " \"field\": \"tokens\",\n"
- + " \"textClass\": \"politik inland\",\n"
- + " \"title\": \"Mundlos denkt über Rücktritt nach\",\n"
- + " \"author\": \"\",\n"
- + " \"startMore\": true,\n"
- + " \"endMore\": true,\n"
- + " \"corpusID\": \"BRZ13\",\n"
- + " \"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>räumte selbst ein, wie sarkastisch diese </span><mark>Worte</mark><span class=\\\"context-right\\\"> nach einer solchen Wahlnacht klingen mussten<span class=\\\"more\\\"></span></span>\",\n"
- + " \"matchID\": \"match-BRZ13!BRZ13_JAN.07694-p192-193\",\n"
- + " \"docID\": \"BRZ13_JAN.07694\",\n"
- + " \"UID\": 0,\n"
- + " \"pubDate\": \"2013-01-21\"\n"
- + " },\n" + " {\n"
- + " \"field\": \"tokens\",\n"
- + " \"textClass\": \"politik inland\",\n"
- + " \"title\": \"BraunschweigGold – Hannover Blech\",\n"
- + " \"author\": \"\",\n"
- + " \"startMore\": true,\n"
- + " \"endMore\": true,\n"
- + " \"corpusID\": \"BRZ13\",\n"
- + " \"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>im Volksfreundhaus hört man kein schlechtes </span><mark>Wort</mark><span class=\\\"context-right\\\"> über den Kanzlerkandidaten Peer Steinbrück – und<span class=\\\"more\\\"></span></span>\",\n"
- + " \"matchID\": \"match-BRZ13!BRZ13_JAN.07695-p169-170\",\n"
- + " \"docID\": \"BRZ13_JAN.07695\",\n"
- + " \"UID\": 0,\n"
- + " \"pubDate\": \"2013-01-21\"\n"
- + " },\n" + " {\n"
- + " \"field\": \"tokens\",\n"
- + " \"textClass\": \"politik inland\",\n"
- + " \"title\": \"BraunschweigGold – Hannover Blech\",\n"
- + " \"author\": \"\",\n"
- + " \"startMore\": true,\n"
- + " \"endMore\": true,\n"
- + " \"corpusID\": \"BRZ13\",\n"
- + " \"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>Volksfreundhaus merklich steigen. Hier hat das </span><mark>Wort</mark><span class=\\\"context-right\\\"> von der Wahlparty bei Bier, Bockwurst<span class=\\\"more\\\"></span></span>\",\n"
- + " \"matchID\": \"match-BRZ13!BRZ13_JAN.07695-p266-267\",\n"
- + " \"docID\": \"BRZ13_JAN.07695\",\n"
- + " \"UID\": 0,\n"
- + " \"pubDate\": \"2013-01-21\"\n"
- + " },\n" + " {\n"
- + " \"field\": \"tokens\",\n"
- + " \"textClass\": \"staat-gesellschaft kirche\",\n"
- + " \"title\": \"Fernsehen überträgt Gottesdienst\",\n"
- + " \"author\": \"\",\n"
- + " \"startMore\": true,\n"
- + " \"endMore\": true,\n"
- + " \"corpusID\": \"BRZ13\",\n"
- + " \"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>schon mal von der Sendung „Das </span><mark>Wort</mark><span class=\\\"context-right\\\"> zum Sonntag“ gehört. Das sind Predigten<span class=\\\"more\\\"></span></span>\",\n"
- + " \"matchID\": \"match-BRZ13!BRZ13_JAN.07840-p37-38\",\n"
- + " \"docID\": \"BRZ13_JAN.07840\",\n"
- + " \"UID\": 0,\n"
- + " \"pubDate\": \"2013-01-21\"\n"
- + " },\n" + " {\n"
- + " \"field\": \"tokens\",\n"
- + " \"textClass\": \"politik inland\",\n"
- + " \"title\": \"Wahlkrimi im Ratssaal\",\n"
- + " \"author\": \"\",\n"
- + " \"startMore\": true,\n"
- + " \"endMore\": true,\n"
- + " \"corpusID\": \"BRZ13\",\n"
- + " \"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>ihre Konkurrentin Glosemeyer hatte sie warme </span><mark>Worte</mark><span class=\\\"context-right\\\"> übrig. „Für den ersten Anlauf eine<span class=\\\"more\\\"></span></span>\",\n"
- + " \"matchID\": \"match-BRZ13!BRZ13_JAN.07848-p147-148\",\n"
- + " \"docID\": \"BRZ13_JAN.07848\",\n"
- + " \"UID\": 0,\n"
- + " \"pubDate\": \"2013-01-21\"\n"
- + " },\n" + " {\n"
- + " \"field\": \"tokens\",\n"
- + " \"textClass\": \"politik inland\",\n"
- + " \"title\": \"Warme Worte nach eiskaltem Wahlkampf\",\n"
- + " \"author\": \"\",\n"
- + " \"startMore\": true,\n"
- + " \"endMore\": true,\n"
- + " \"corpusID\": \"BRZ13\",\n"
- + " \"snippet\": \"<span class=\\\"context-left\\\">Warme </span><mark>Worte</mark><span class=\\\"context-right\\\"> nach eiskaltem Wahlkampf Die SPD feierte<span class=\\\"more\\\"></span></span>\",\n"
- + " \"matchID\": \"match-BRZ13!BRZ13_JAN.07850-p1-2\",\n"
- + " \"docID\": \"BRZ13_JAN.07850\",\n"
- + " \"UID\": 0,\n"
- + " \"pubDate\": \"2013-01-21\"\n"
- + " }\n" + " ]\n" + "}";
+ private static final String RESULT = "{\n"
+ + " \"meta\": {\n"
+ + " \"count\": 25,\n"
+ + " \"startIndex\": 0,\n"
+ + " \"timeout\": 120000,\n"
+ + " \"context\": {\n"
+ + " \"left\": [\n"
+ + " \"token\",\n"
+ + " 6\n"
+ + " ],\n"
+ + " \"right\": [\n"
+ + " \"token\",\n"
+ + " 6\n"
+ + " ]\n"
+ + " },\n"
+ + " \"fields\": [\n"
+ + " \"textSigle\",\n"
+ + " \"author\",\n"
+ + " \"docSigle\",\n"
+ + " \"title\",\n"
+ + " \"pubDate\",\n"
+ + " \"UID\",\n"
+ + " \"corpusID\",\n"
+ + " \"textClass\",\n"
+ + " \"subTitle\",\n"
+ + " \"layerInfos\",\n"
+ + " \"ID\",\n"
+ + " \"pubPlace\",\n"
+ + " \"corpusSigle\"\n"
+ + " ],\n"
+ + " \"version\": \"unknown\",\n"
+ + " \"benchmark\": \"0.204314141 s\",\n"
+ + " \"totalResults\": 1755,\n"
+ + " \"serialQuery\": \"tokens:tt/l:Wort\",\n"
+ + " \"itemsPerPage\": 25\n"
+ + " },\n"
+ + " \"query\": {\n"
+ + " \"@type\": \"koral:token\",\n"
+ + " \"wrap\": {\n"
+ + " \"@type\": \"koral:term\",\n"
+ + " \"key\": \"Wort\",\n"
+ + " \"layer\": \"lemma\",\n"
+ + " \"match\": \"match:eq\",\n"
+ + " \"foundry\": \"tt\",\n"
+ + " \"rewrites\": [\n"
+ + " {\n"
+ + " \"@type\": \"koral:rewrite\",\n"
+ + " \"src\": \"Kustvakt\",\n"
+ + " \"operation\": \"operation:injection\"\n"
+ + " }\n"
+ + " ]\n"
+ + " }\n"
+ + " },\n"
+ + " \"matches\": [\n"
+ + " {\n"
+ + " \"field\": \"tokens\",\n"
+ + " \"textClass\": \"staat-gesellschaft familie-geschlecht\",\n"
+ + " \"title\": \"Sexueller Missbrauch –„Das schreiende Kind steckt noch tief in mir“\",\n"
+ + " \"author\": \"\",\n"
+ + " \"startMore\": true,\n"
+ + " \"endMore\": true,\n"
+ + " \"corpusID\": \"BRZ13\",\n"
+ + " \"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>in ihrer Stimme schwingt bei diesem </span><mark>Wort</mark><span class=\\\"context-right\\\"> Sarkasmus mit. Bis man einen passenden<span class=\\\"more\\\"></span></span>\",\n"
+ + " \"matchID\": \"match-BRZ13!BRZ13_APR.00001-p454-455\",\n"
+ + " \"docID\": \"BRZ13_APR.00001\",\n"
+ + " \"UID\": 0,\n"
+ + " \"pubDate\": \"2013-04-02\"\n"
+ + " },\n"
+ + " {\n"
+ + " \"field\": \"tokens\",\n"
+ + " \"textClass\": \"freizeit-unterhaltung reisen\",\n"
+ + " \"title\": \"Leben dick und prall\",\n"
+ + " \"author\": \"\",\n"
+ + " \"startMore\": true,\n"
+ + " \"endMore\": true,\n"
+ + " \"corpusID\": \"BRZ13\",\n"
+ + " \"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>der DLRG, ausgelassene Partys und markige </span><mark>Worte</mark><span class=\\\"context-right\\\"> des Dompredigers: „Ostern ist kein goethischer<span class=\\\"more\\\"></span></span>\",\n"
+ + " \"matchID\": \"match-BRZ13!BRZ13_APR.00014-p96-97\",\n"
+ + " \"docID\": \"BRZ13_APR.00014\",\n"
+ + " \"UID\": 0,\n"
+ + " \"pubDate\": \"2013-04-02\"\n"
+ + " },\n"
+ + " {\n"
+ + " \"field\": \"tokens\",\n"
+ + " \"textClass\": \"staat-gesellschaft biographien-interviews kultur musik\",\n"
+ + " \"title\": \"So wird es gemacht:\",\n"
+ + " \"author\": \"\",\n"
+ + " \"startMore\": true,\n"
+ + " \"endMore\": true,\n"
+ + " \"corpusID\": \"BRZ13\",\n"
+ + " \"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>derfehlende Buchstabe.Gelingt es dir,das </span><mark>Wort</mark><span class=\\\"context-right\\\"> vervollständigen? Tipp: Probiere auch mal rückwärts<span class=\\\"more\\\"></span></span>\",\n"
+ + " \"matchID\": \"match-BRZ13!BRZ13_APR.00055-p19-20\",\n"
+ + " \"docID\": \"BRZ13_APR.00055\",\n"
+ + " \"UID\": 0,\n"
+ + " \"pubDate\": \"2013-04-02\"\n"
+ + " },\n"
+ + " {\n"
+ + " \"field\": \"tokens\",\n"
+ + " \"textClass\": \"politik ausland\",\n"
+ + " \"title\": \"Südkorea droht mit Angriffen – USA rüsten auf\",\n"
+ + " \"author\": \"\",\n"
+ + " \"startMore\": true,\n"
+ + " \"endMore\": true,\n"
+ + " \"corpusID\": \"BRZ13\",\n"
+ + " \"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>der Stunde. „Aus einem Krieg der </span><mark>Worte</mark><span class=\\\"context-right\\\"> darf kein echter Krieg werden“, sagte<span class=\\\"more\\\"></span></span>\",\n"
+ + " \"matchID\": \"match-BRZ13!BRZ13_APR.00076-p238-239\",\n"
+ + " \"docID\": \"BRZ13_APR.00076\",\n"
+ + " \"UID\": 0,\n"
+ + " \"pubDate\": \"2013-04-02\"\n"
+ + " },\n"
+ + " {\n"
+ + " \"field\": \"tokens\",\n"
+ + " \"textClass\": \"politik inland freizeit-unterhaltung reisen\",\n"
+ + " \"title\": \"Dauercamper kämpfen für ihren Platz\",\n"
+ + " \"author\": \"\",\n"
+ + " \"startMore\": true,\n"
+ + " \"endMore\": true,\n"
+ + " \"corpusID\": \"BRZ13\",\n"
+ + " \"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>„Initiative Campingplatz Räbke“. „Als ich das </span><mark>Wort</mark><span class=\\\"context-right\\\"> Schließung gelesen habe, war ich richtig<span class=\\\"more\\\"></span></span>\",\n"
+ + " \"matchID\": \"match-BRZ13!BRZ13_APR.00200-p255-256\",\n"
+ + " \"docID\": \"BRZ13_APR.00200\",\n"
+ + " \"UID\": 0,\n"
+ + " \"pubDate\": \"2013-04-02\"\n"
+ + " },\n"
+ + " {\n"
+ + " \"field\": \"tokens\",\n"
+ + " \"textClass\": \"freizeit-unterhaltung reisen\",\n"
+ + " \"title\": \"Neue Aktionen lockten Besucher\",\n"
+ + " \"author\": \"\",\n"
+ + " \"startMore\": true,\n"
+ + " \"endMore\": true,\n"
+ + " \"corpusID\": \"BRZ13\",\n"
+ + " \"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>Jan Waldheim (CWG) unter den aufmunternden </span><mark>Worten</mark><span class=\\\"context-right\\\"> eines augenzwinkernden Axel Schnalke („Ein bisschen<span class=\\\"more\\\"></span></span>\",\n"
+ + " \"matchID\": \"match-BRZ13!BRZ13_APR.00210-p142-143\",\n"
+ + " \"docID\": \"BRZ13_APR.00210\",\n"
+ + " \"UID\": 0,\n"
+ + " \"pubDate\": \"2013-04-02\"\n"
+ + " },\n"
+ + " {\n"
+ + " \"field\": \"tokens\",\n"
+ + " \"textClass\": \"kultur musik\",\n"
+ + " \"title\": \"Travestie – Helden in Strumpfhosen\",\n"
+ + " \"author\": \"\",\n"
+ + " \"startMore\": true,\n"
+ + " \"endMore\": true,\n"
+ + " \"corpusID\": \"BRZ13\",\n"
+ + " \"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>trotzdem nicht. Selten wurden so viele </span><mark>Worte</mark><span class=\\\"context-right\\\">, die der Autor hier lieber verschweigt<span class=\\\"more\\\"></span></span>\",\n"
+ + " \"matchID\": \"match-BRZ13!BRZ13_APR.00253-p166-167\",\n"
+ + " \"docID\": \"BRZ13_APR.00253\",\n"
+ + " \"UID\": 0,\n"
+ + " \"pubDate\": \"2013-04-02\"\n"
+ + " },\n"
+ + " {\n"
+ + " \"field\": \"tokens\",\n"
+ + " \"textClass\": \"kultur musik\",\n"
+ + " \"title\": \"Travestie – Helden in Strumpfhosen\",\n"
+ + " \"author\": \"\",\n"
+ + " \"startMore\": true,\n"
+ + " \"endMore\": true,\n"
+ + " \"corpusID\": \"BRZ13\",\n"
+ + " \"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>zudem nicht immer nur bei den </span><mark>Worten</mark><span class=\\\"context-right\\\"> geblieben) und dabei gleichzeitig soviel Charme<span class=\\\"more\\\"></span></span>\",\n"
+ + " \"matchID\": \"match-BRZ13!BRZ13_APR.00253-p191-192\",\n"
+ + " \"docID\": \"BRZ13_APR.00253\",\n"
+ + " \"UID\": 0,\n"
+ + " \"pubDate\": \"2013-04-02\"\n"
+ + " },\n"
+ + " {\n"
+ + " \"field\": \"tokens\",\n"
+ + " \"textClass\": \"kultur musik\",\n"
+ + " \"title\": \"Travestie – Helden in Strumpfhosen\",\n"
+ + " \"author\": \"\",\n"
+ + " \"startMore\": true,\n"
+ + " \"endMore\": true,\n"
+ + " \"corpusID\": \"BRZ13\",\n"
+ + " \"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>bedeutet Travestie sich zu verkleiden, das </span><mark>Wort</mark><span class=\\\"context-right\\\"> stammt aus dem Französischen. Traditionell belegten<span class=\\\"more\\\"></span></span>\",\n"
+ + " \"matchID\": \"match-BRZ13!BRZ13_APR.00253-p371-372\",\n"
+ + " \"docID\": \"BRZ13_APR.00253\",\n"
+ + " \"UID\": 0,\n"
+ + " \"pubDate\": \"2013-04-02\"\n"
+ + " },\n"
+ + " {\n"
+ + " \"field\": \"tokens\",\n"
+ + " \"textClass\": \"sport fussball\",\n"
+ + " \"title\": \"VfL kommt nicht vom Fleck\",\n"
+ + " \"author\": \"\",\n"
+ + " \"startMore\": true,\n"
+ + " \"endMore\": true,\n"
+ + " \"corpusID\": \"BRZ13\",\n"
+ + " \"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>am internationalen Geschäft berechtigt. Mit anderen </span><mark>Worten</mark><span class=\\\"context-right\\\">: Die „Wölfe“ stecken im grauen Mittelmaß<span class=\\\"more\\\"></span></span>\",\n"
+ + " \"matchID\": \"match-BRZ13!BRZ13_APR.00260-p93-94\",\n"
+ + " \"docID\": \"BRZ13_APR.00260\",\n"
+ + " \"UID\": 0,\n"
+ + " \"pubDate\": \"2013-04-02\"\n"
+ + " },\n"
+ + " {\n"
+ + " \"field\": \"tokens\",\n"
+ + " \"textClass\": \"sport fussball\",\n"
+ + " \"title\": \"Mensch, Mayer! Super Tor\",\n"
+ + " \"author\": \"\",\n"
+ + " \"startMore\": true,\n"
+ + " \"endMore\": true,\n"
+ + " \"corpusID\": \"BRZ13\",\n"
+ + " \"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>bekommst, ist das unbezahlbar – ein Bonus.“ </span><mark>Worte</mark><span class=\\\"context-right\\\">, die dem Torschützen weiteres Selbstvertrauen geben<span class=\\\"more\\\"></span></span>\",\n"
+ + " \"matchID\": \"match-BRZ13!BRZ13_APR.00275-p271-272\",\n"
+ + " \"docID\": \"BRZ13_APR.00275\",\n"
+ + " \"UID\": 0,\n"
+ + " \"pubDate\": \"2013-04-02\"\n"
+ + " },\n"
+ + " {\n"
+ + " \"field\": \"tokens\",\n"
+ + " \"textClass\": \"sport fussball\",\n"
+ + " \"title\": \"Nur Gerücht? KHL-Klub will „Dshuni“\",\n"
+ + " \"author\": \"\",\n"
+ + " \"startMore\": true,\n"
+ + " \"endMore\": true,\n"
+ + " \"corpusID\": \"BRZ13\",\n"
+ + " \"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>und hakt das Thema ab.cb Kein </span><mark>Wort</mark><span class=\\\"context-right\\\"> zum Interesse aus Astana: Daniar Dshunussow.Foto<span class=\\\"more\\\"></span></span>\",\n"
+ + " \"matchID\": \"match-BRZ13!BRZ13_APR.00277-p163-164\",\n"
+ + " \"docID\": \"BRZ13_APR.00277\",\n"
+ + " \"UID\": 0,\n"
+ + " \"pubDate\": \"2013-04-02\"\n"
+ + " },\n"
+ + " {\n"
+ + " \"field\": \"tokens\",\n"
+ + " \"textClass\": \"staat-gesellschaft biographien-interviews\",\n"
+ + " \"title\": \"Das Leben ist nicht auf diese Erde beschränkt\",\n"
+ + " \"author\": \"\",\n"
+ + " \"startMore\": true,\n"
+ + " \"endMore\": true,\n"
+ + " \"corpusID\": \"BRZ13\",\n"
+ + " \"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>1. Korinther 1,18 denken: Denn das </span><mark>Wort</mark><span class=\\\"context-right\\\"> vom Kreuz ist eine Torheit denen<span class=\\\"more\\\"></span></span>\",\n"
+ + " \"matchID\": \"match-BRZ13!BRZ13_APR.00520-p32-33\",\n"
+ + " \"docID\": \"BRZ13_APR.00520\",\n"
+ + " \"UID\": 0,\n"
+ + " \"pubDate\": \"2013-04-03\"\n"
+ + " },\n"
+ + " {\n"
+ + " \"field\": \"tokens\",\n"
+ + " \"textClass\": \"sport fussball\",\n"
+ + " \"title\": \"Allofs und Hecking knöpfensich die VfL-Profis vor\",\n"
+ + " \"author\": \"\",\n"
+ + " \"startMore\": true,\n"
+ + " \"endMore\": true,\n"
+ + " \"corpusID\": \"BRZ13\",\n"
+ + " \"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>für die Profis am Dienstag klare </span><mark>Worte</mark><span class=\\\"context-right\\\"> vom Führungsduo. Von Thorsten Grunow Wolfsburg<span class=\\\"more\\\"></span></span>\",\n"
+ + " \"matchID\": \"match-BRZ13!BRZ13_APR.00557-p17-18\",\n"
+ + " \"docID\": \"BRZ13_APR.00557\",\n"
+ + " \"UID\": 0,\n"
+ + " \"pubDate\": \"2013-04-03\"\n"
+ + " },\n"
+ + " {\n"
+ + " \"field\": \"tokens\",\n"
+ + " \"textClass\": \"sport fussball\",\n"
+ + " \"title\": \"Allofs und Hecking knöpfensich die VfL-Profis vor\",\n"
+ + " \"author\": \"\",\n"
+ + " \"startMore\": true,\n"
+ + " \"endMore\": true,\n"
+ + " \"corpusID\": \"BRZ13\",\n"
+ + " \"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>Minuten setzte es am Dienstagnachmittag klare </span><mark>Worte</mark><span class=\\\"context-right\\\"> für die kickende Belegschaft, die durchaus<span class=\\\"more\\\"></span></span>\",\n"
+ + " \"matchID\": \"match-BRZ13!BRZ13_APR.00557-p60-61\",\n"
+ + " \"docID\": \"BRZ13_APR.00557\",\n"
+ + " \"UID\": 0,\n"
+ + " \"pubDate\": \"2013-04-03\"\n"
+ + " },\n"
+ + " {\n"
+ + " \"field\": \"tokens\",\n"
+ + " \"textClass\": \"sport fussball\",\n"
+ + " \"title\": \"Allofs und Hecking knöpfensich die VfL-Profis vor\",\n"
+ + " \"author\": \"\",\n"
+ + " \"startMore\": true,\n"
+ + " \"endMore\": true,\n"
+ + " \"corpusID\": \"BRZ13\",\n"
+ + " \"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>Manager ist überzeugt, dass die klaren </span><mark>Worte</mark><span class=\\\"context-right\\\"> auf fruchtbaren Boden gefallen sind. „Ich<span class=\\\"more\\\"></span></span>\",\n"
+ + " \"matchID\": \"match-BRZ13!BRZ13_APR.00557-p235-236\",\n"
+ + " \"docID\": \"BRZ13_APR.00557\",\n"
+ + " \"UID\": 0,\n"
+ + " \"pubDate\": \"2013-04-03\"\n"
+ + " },\n"
+ + " {\n"
+ + " \"field\": \"tokens\",\n"
+ + " \"textClass\": \"politik inland politik ausland\",\n"
+ + " \"title\": \"Zeitungsartikelzufällig deponiert?\",\n"
+ + " \"author\": \"\",\n"
+ + " \"startMore\": true,\n"
+ + " \"endMore\": true,\n"
+ + " \"corpusID\": \"BRZ13\",\n"
+ + " \"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>erspart“, lautete die Schlagzeile – wobei das </span><mark>Wort</mark><span class=\\\"context-right\\\"> „erspart“ abgeschnitten war. Ein plumper Versuch<span class=\\\"more\\\"></span></span>\",\n"
+ + " \"matchID\": \"match-BRZ13!BRZ13_JAN.07616-p31-32\",\n"
+ + " \"docID\": \"BRZ13_JAN.07616\",\n"
+ + " \"UID\": 0,\n"
+ + " \"pubDate\": \"2013-01-21\"\n"
+ + " },\n"
+ + " {\n"
+ + " \"field\": \"tokens\",\n"
+ + " \"textClass\": \"politik inland\",\n"
+ + " \"title\": \"„Philipp Rösler wackelt nicht“\",\n"
+ + " \"author\": \"\",\n"
+ + " \"startMore\": true,\n"
+ + " \"endMore\": true,\n"
+ + " \"corpusID\": \"BRZ13\",\n"
+ + " \"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>Vizekanzler bei all dem Jubel zu </span><mark>Wort</mark><span class=\\\"context-right\\\"> kommt. „Ein großartiger Tag“, sagt er<span class=\\\"more\\\"></span></span>\",\n"
+ + " \"matchID\": \"match-BRZ13!BRZ13_JAN.07617-p177-178\",\n"
+ + " \"docID\": \"BRZ13_JAN.07617\",\n"
+ + " \"UID\": 0,\n"
+ + " \"pubDate\": \"2013-01-21\"\n"
+ + " },\n"
+ + " {\n"
+ + " \"field\": \"tokens\",\n"
+ + " \"textClass\": \"freizeit-unterhaltung reisen\",\n"
+ + " \"title\": \"Lanz gibt den charmanten, zurückhaltenden Gastgeber\",\n"
+ + " \"author\": \"\",\n"
+ + " \"startMore\": true,\n"
+ + " \"endMore\": true,\n"
+ + " \"corpusID\": \"BRZ13\",\n"
+ + " \"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>er, als seine Assistentin ihm ins </span><mark>Wort</mark><span class=\\\"context-right\\\"> fiel. Dennoch holte das ungleiche Duo<span class=\\\"more\\\"></span></span>\",\n"
+ + " \"matchID\": \"match-BRZ13!BRZ13_JAN.07621-p261-262\",\n"
+ + " \"docID\": \"BRZ13_JAN.07621\",\n"
+ + " \"UID\": 0,\n"
+ + " \"pubDate\": \"2013-01-21\"\n"
+ + " },\n"
+ + " {\n"
+ + " \"field\": \"tokens\",\n"
+ + " \"textClass\": \"politik inland\",\n"
+ + " \"title\": \"Mundlos denkt über Rücktritt nach\",\n"
+ + " \"author\": \"\",\n"
+ + " \"startMore\": true,\n"
+ + " \"endMore\": true,\n"
+ + " \"corpusID\": \"BRZ13\",\n"
+ + " \"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>räumte selbst ein, wie sarkastisch diese </span><mark>Worte</mark><span class=\\\"context-right\\\"> nach einer solchen Wahlnacht klingen mussten<span class=\\\"more\\\"></span></span>\",\n"
+ + " \"matchID\": \"match-BRZ13!BRZ13_JAN.07694-p192-193\",\n"
+ + " \"docID\": \"BRZ13_JAN.07694\",\n"
+ + " \"UID\": 0,\n"
+ + " \"pubDate\": \"2013-01-21\"\n"
+ + " },\n"
+ + " {\n"
+ + " \"field\": \"tokens\",\n"
+ + " \"textClass\": \"politik inland\",\n"
+ + " \"title\": \"BraunschweigGold – Hannover Blech\",\n"
+ + " \"author\": \"\",\n"
+ + " \"startMore\": true,\n"
+ + " \"endMore\": true,\n"
+ + " \"corpusID\": \"BRZ13\",\n"
+ + " \"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>im Volksfreundhaus hört man kein schlechtes </span><mark>Wort</mark><span class=\\\"context-right\\\"> über den Kanzlerkandidaten Peer Steinbrück – und<span class=\\\"more\\\"></span></span>\",\n"
+ + " \"matchID\": \"match-BRZ13!BRZ13_JAN.07695-p169-170\",\n"
+ + " \"docID\": \"BRZ13_JAN.07695\",\n"
+ + " \"UID\": 0,\n"
+ + " \"pubDate\": \"2013-01-21\"\n"
+ + " },\n"
+ + " {\n"
+ + " \"field\": \"tokens\",\n"
+ + " \"textClass\": \"politik inland\",\n"
+ + " \"title\": \"BraunschweigGold – Hannover Blech\",\n"
+ + " \"author\": \"\",\n"
+ + " \"startMore\": true,\n"
+ + " \"endMore\": true,\n"
+ + " \"corpusID\": \"BRZ13\",\n"
+ + " \"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>Volksfreundhaus merklich steigen. Hier hat das </span><mark>Wort</mark><span class=\\\"context-right\\\"> von der Wahlparty bei Bier, Bockwurst<span class=\\\"more\\\"></span></span>\",\n"
+ + " \"matchID\": \"match-BRZ13!BRZ13_JAN.07695-p266-267\",\n"
+ + " \"docID\": \"BRZ13_JAN.07695\",\n"
+ + " \"UID\": 0,\n"
+ + " \"pubDate\": \"2013-01-21\"\n"
+ + " },\n"
+ + " {\n"
+ + " \"field\": \"tokens\",\n"
+ + " \"textClass\": \"staat-gesellschaft kirche\",\n"
+ + " \"title\": \"Fernsehen überträgt Gottesdienst\",\n"
+ + " \"author\": \"\",\n"
+ + " \"startMore\": true,\n"
+ + " \"endMore\": true,\n"
+ + " \"corpusID\": \"BRZ13\",\n"
+ + " \"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>schon mal von der Sendung „Das </span><mark>Wort</mark><span class=\\\"context-right\\\"> zum Sonntag“ gehört. Das sind Predigten<span class=\\\"more\\\"></span></span>\",\n"
+ + " \"matchID\": \"match-BRZ13!BRZ13_JAN.07840-p37-38\",\n"
+ + " \"docID\": \"BRZ13_JAN.07840\",\n"
+ + " \"UID\": 0,\n"
+ + " \"pubDate\": \"2013-01-21\"\n"
+ + " },\n"
+ + " {\n"
+ + " \"field\": \"tokens\",\n"
+ + " \"textClass\": \"politik inland\",\n"
+ + " \"title\": \"Wahlkrimi im Ratssaal\",\n"
+ + " \"author\": \"\",\n"
+ + " \"startMore\": true,\n"
+ + " \"endMore\": true,\n"
+ + " \"corpusID\": \"BRZ13\",\n"
+ + " \"snippet\": \"<span class=\\\"context-left\\\"><span class=\\\"more\\\"></span>ihre Konkurrentin Glosemeyer hatte sie warme </span><mark>Worte</mark><span class=\\\"context-right\\\"> übrig. „Für den ersten Anlauf eine<span class=\\\"more\\\"></span></span>\",\n"
+ + " \"matchID\": \"match-BRZ13!BRZ13_JAN.07848-p147-148\",\n"
+ + " \"docID\": \"BRZ13_JAN.07848\",\n"
+ + " \"UID\": 0,\n"
+ + " \"pubDate\": \"2013-01-21\"\n"
+ + " },\n"
+ + " {\n"
+ + " \"field\": \"tokens\",\n"
+ + " \"textClass\": \"politik inland\",\n"
+ + " \"title\": \"Warme Worte nach eiskaltem Wahlkampf\",\n"
+ + " \"author\": \"\",\n"
+ + " \"startMore\": true,\n"
+ + " \"endMore\": true,\n"
+ + " \"corpusID\": \"BRZ13\",\n"
+ + " \"snippet\": \"<span class=\\\"context-left\\\">Warme </span><mark>Worte</mark><span class=\\\"context-right\\\"> nach eiskaltem Wahlkampf Die SPD feierte<span class=\\\"more\\\"></span></span>\",\n"
+ + " \"matchID\": \"match-BRZ13!BRZ13_JAN.07850-p1-2\",\n"
+ + " \"docID\": \"BRZ13_JAN.07850\",\n"
+ + " \"UID\": 0,\n"
+ + " \"pubDate\": \"2013-01-21\"\n" + " }\n"
+ + " ]\n" + "}";
}
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 d41a3a2..5eea4e2 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
@@ -20,19 +20,21 @@
public class RewriteHandlerTest extends BeanConfigTest {
@Test
- public void initHandler() {
+ public void initHandler () {
try {
RewriteHandler handler = new RewriteHandler();
handler.insertBeans(helper().getContext());
assertTrue(handler.add(FoundryInject.class));
- }catch (Exception e) {
+ }
+ catch (Exception e) {
e.printStackTrace();
}
}
+
@Test
- public void testRewriteTaskAdd() {
+ public void testRewriteTaskAdd () {
RewriteHandler handler = new RewriteHandler();
handler.insertBeans(helper().getContext());
assertTrue(handler.add(FoundryInject.class));
@@ -41,9 +43,10 @@
assertTrue(handler.add(IdWriter.class));
}
+
// throws exception cause of missing configuration
@Test(expected = RuntimeException.class)
- public void testRewriteConfigThrowsException() {
+ public void testRewriteConfigThrowsException () {
RewriteHandler handler = new RewriteHandler();
QuerySerializer s = new QuerySerializer();
s.setQuery("[(base=laufen | base=gehen) & tt/pos=VVFIN]", "poliqarp");
@@ -51,9 +54,11 @@
handler.preProcess(s.toJSON(), null);
}
+
@Test
- public void testRewriteNoBeanInject() {
- RewriteHandler handler = new RewriteHandler(helper().getContext().getConfiguration());
+ public void testRewriteNoBeanInject () {
+ RewriteHandler handler = new RewriteHandler(helper().getContext()
+ .getConfiguration());
QuerySerializer s = new QuerySerializer();
s.setQuery("[(base=laufen | base=gehen) & tt/pos=VVFIN]", "poliqarp");
assertTrue(handler.add(FoundryInject.class));
@@ -61,8 +66,9 @@
assertNotNull(res);
}
+
@Test
- public void testRewriteBeanInject() {
+ public void testRewriteBeanInject () {
RewriteHandler handler = new RewriteHandler();
handler.insertBeans(helper().getContext());
QuerySerializer s = new QuerySerializer();
@@ -72,13 +78,16 @@
JsonNode node = JsonUtils.readTree(res);
assertNotNull(node);
- assertEquals("tt", node.at("/query/wrap/operands/0/operands/0/foundry").asText());
- assertEquals("tt", node.at("/query/wrap/operands/0/operands/1/foundry").asText());
+ assertEquals("tt", node.at("/query/wrap/operands/0/operands/0/foundry")
+ .asText());
+ assertEquals("tt", node.at("/query/wrap/operands/0/operands/1/foundry")
+ .asText());
assertEquals("tt", node.at("/query/wrap/operands/1/foundry").asText());
}
+
@Test
- public void testRewriteUserSpecific() {
+ public void testRewriteUserSpecific () {
RewriteHandler handler = new RewriteHandler();
handler.insertBeans(helper().getContext());
QuerySerializer s = new QuerySerializer();
@@ -87,16 +96,21 @@
String res = handler.preProcess(s.toJSON(), helper().getUser());
JsonNode node = JsonUtils.readTree(res);
assertNotNull(node);
- assertEquals("tt_test", node.at("/query/wrap/operands/0/operands/0/foundry").asText());
- assertEquals("tt_test", node.at("/query/wrap/operands/0/operands/1/foundry").asText());
- assertNotEquals("tt_test", node.at("/query/wrap/operands/1/foundry").asText());
+ assertEquals("tt_test",
+ node.at("/query/wrap/operands/0/operands/0/foundry").asText());
+ assertEquals("tt_test",
+ node.at("/query/wrap/operands/0/operands/1/foundry").asText());
+ assertNotEquals("tt_test", node.at("/query/wrap/operands/1/foundry")
+ .asText());
}
+
@Override
- public void initMethod() throws KustvaktException {
+ public void initMethod () throws KustvaktException {
helper().setupAccount();
UserDataDbIface settingsdao = BeansFactory.getTypeFactory()
- .getTypedBean(helper().getContext().getUserDataDaos(),UserSettings.class);
+ .getTypedBean(helper().getContext().getUserDataDaos(),
+ UserSettings.class);
UserSettings s = (UserSettings) settingsdao.get(helper().getUser());
s.setField(Attributes.DEFAULT_LEMMA_FOUNDRY, "tt_test");
settingsdao.update(s);
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 cc3afda..404b86a 100644
--- a/src/test/java/de/ids_mannheim/korap/security/PolicyDaoTest.java
+++ b/src/test/java/de/ids_mannheim/korap/security/PolicyDaoTest.java
@@ -29,14 +29,15 @@
@Override
- public void initMethod() throws KustvaktException {
+ public void initMethod () throws KustvaktException {
helper().setupAccount();
helper().runBootInterfaces();
helper().setupResource(new Corpus("WPD_1"));
}
+
@Test
- public void testPoliciesGet() throws KustvaktException {
+ public void testPoliciesGet () throws KustvaktException {
User user = helper().getUser();
SecurityPolicy policy = new SecurityPolicy();
policy.addNewCondition(new PolicyCondition("test_1"));
@@ -49,8 +50,9 @@
dao.getPolicies("WPD_1", user, Permissions.Permission.READ.toByte());
}
+
@Test
- public void testPolicyCreate() throws KustvaktException {
+ public void testPolicyCreate () throws KustvaktException {
User user = helper().getUser();
SecurityPolicy policy = new SecurityPolicy();
policy.addNewCondition(new PolicyCondition("test_1"));
@@ -64,13 +66,15 @@
assertTrue(dao.deleteResourcePolicies("WPD_1", user) > 0);
}
+
@Test
- public void testMappingConditions() {
+ public void testMappingConditions () {
}
+
@Test
- public void failAddToConditionEqual() throws KustvaktException {
+ public void failAddToConditionEqual () throws KustvaktException {
User user = helper().getUser();
SecurityPolicy policy = new SecurityPolicy();
policy.addNewCondition(new PolicyCondition("test_1"));
@@ -88,8 +92,9 @@
}
+
@Test
- public void failAddToConditionUnEqual() throws KustvaktException {
+ public void failAddToConditionUnEqual () throws KustvaktException {
User user = helper().getUser();
SecurityPolicy policy = new SecurityPolicy();
policy.addNewCondition(new PolicyCondition("test_1"));
@@ -107,8 +112,9 @@
}
+
@Test
- public void removeUserFromCondition() throws KustvaktException {
+ public void removeUserFromCondition () throws KustvaktException {
User user = helper().getUser();
PolicyHandlerIface dao = helper().getContext().getPolicyDbProvider();
@@ -125,8 +131,9 @@
assertTrue(dao.deleteResourcePolicies("WPD_1", user) > 0);
}
+
@Test
- public void testPolicyHierarchySelfSameType() throws KustvaktException {
+ public void testPolicyHierarchySelfSameType () throws KustvaktException {
String res = "WPD_child";
User user = helper().getUser();
Corpus c = new Corpus(res);
@@ -144,9 +151,10 @@
helper().dropResource(res);
}
+
@Test
@Ignore
- public void testPolicyHierarchySelfDifferentType()
+ public void testPolicyHierarchySelfDifferentType ()
throws KustvaktException {
String res = "WPD_child";
User user = helper().getUser();
@@ -165,43 +173,45 @@
helper().dropResource(res);
}
+
@Test
- public void testPolicyHierarchyPublic() {
+ public void testPolicyHierarchyPublic () {
}
+
@Test
- public void testPoliciesPublic() {
+ public void testPoliciesPublic () {
PolicyHandlerIface dao = helper().getContext().getPolicyDbProvider();
- Collection<SecurityPolicy> policies = dao
- .getPolicies(new PolicyCondition("public"), Corpus.class,
- Permissions.Permission.READ.toByte());
+ Collection<SecurityPolicy> policies = dao.getPolicies(
+ new PolicyCondition("public"), Corpus.class,
+ Permissions.Permission.READ.toByte());
assertNotEquals(0, policies.size());
}
+
@Test
@Ignore
- public void testPoliciesPublicGeneric() {
+ public void testPoliciesPublicGeneric () {
PolicyHandlerIface dao = helper().getContext().getPolicyDbProvider();
- Collection<SecurityPolicy> policies = dao
- .getPolicies(new PolicyCondition("public"),
- KustvaktResource.class,
- Permissions.Permission.READ.toByte());
+ Collection<SecurityPolicy> policies = dao.getPolicies(
+ new PolicyCondition("public"), KustvaktResource.class,
+ Permissions.Permission.READ.toByte());
assertNotEquals(0, policies.size());
}
+
@Test
- public void searchResourcePoliciesPublic() throws KustvaktException {
+ public void searchResourcePoliciesPublic () throws KustvaktException {
User user = helper().getUser();
new PolicyBuilder(user).setConditions(new PolicyCondition("public"))
.setPermissions(Permissions.Permission.READ)
.setResources(new VirtualCollection("new_corpus")).create();
PolicyHandlerIface dao = helper().getContext().getPolicyDbProvider();
- List<SecurityPolicy> list = dao
- .getPolicies(new PolicyCondition(Attributes.PUBLIC_GROUP),
- VirtualCollection.class,
- Permissions.Permission.READ.toByte());
+ List<SecurityPolicy> list = dao.getPolicies(new PolicyCondition(
+ Attributes.PUBLIC_GROUP), VirtualCollection.class,
+ Permissions.Permission.READ.toByte());
assertNotEquals(0, list.size());
Set<String> ids = new HashSet<>();
for (SecurityPolicy p : list)
@@ -209,23 +219,27 @@
assertNotEquals(0, ids.size());
}
+
@Test
- public void testPolicyHierarchyRestricted() {
+ public void testPolicyHierarchyRestricted () {
}
+
@Test
- public void testSelfPolicies() {
+ public void testSelfPolicies () {
}
+
@Test
- public void testPublicPolicies() {
+ public void testPublicPolicies () {
}
+
@Test
- public void testConditions() {
+ public void testConditions () {
}
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 681c197..973087b 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
@@ -22,18 +22,23 @@
public class KustvaktAuthenticationManagerTest extends BeanConfigTest {
@After
- public void after() {
+ public void after () {
try {
- User user = helper().getContext().getAuthenticationManager().getUser(
- (String) KustvaktConfiguration.KUSTVAKT_USER
- .get(Attributes.USERNAME));
- helper().getContext().getAuthenticationManager().deleteAccount(user);
- } catch (KustvaktException e) {
+ User user = helper()
+ .getContext()
+ .getAuthenticationManager()
+ .getUser(
+ (String) KustvaktConfiguration.KUSTVAKT_USER
+ .get(Attributes.USERNAME));
+ helper().getContext().getAuthenticationManager()
+ .deleteAccount(user);
}
+ catch (KustvaktException e) {}
}
+
@Test
- public void testCreateUser() throws KustvaktException {
+ public void testCreateUser () throws KustvaktException {
User user = helper().getContext().getAuthenticationManager()
.createUserAccount(KustvaktConfiguration.KUSTVAKT_USER, false);
@@ -43,45 +48,50 @@
assertNotNull(check);
}
+
@Test
- public void testBatchStore() {
+ public void testBatchStore () {
int i = 6;
AuthenticationManagerIface manager = helper().getContext()
.getAuthenticationManager();
- for (int ix = 0; ix < i; ix++) {
- }
+ for (int ix = 0; ix < i; ix++) {}
}
+
@Test
- public void testUserdetailsGet() throws KustvaktException {
+ public void testUserdetailsGet () throws KustvaktException {
testCreateUser();
AuthenticationManagerIface manager = helper().getContext()
.getAuthenticationManager();
- User user = manager.getUser((String) KustvaktConfiguration.KUSTVAKT_USER
- .get(Attributes.USERNAME));
+ User user = manager
+ .getUser((String) KustvaktConfiguration.KUSTVAKT_USER
+ .get(Attributes.USERNAME));
Userdata data = manager.getUserData(user, UserDetails.class);
assertNotNull(data);
}
+
@Test
- public void testUsersettingsGet() throws KustvaktException {
+ public void testUsersettingsGet () throws KustvaktException {
testCreateUser();
AuthenticationManagerIface manager = helper().getContext()
.getAuthenticationManager();
- User user = manager.getUser((String) KustvaktConfiguration.KUSTVAKT_USER
- .get(Attributes.USERNAME));
+ User user = manager
+ .getUser((String) KustvaktConfiguration.KUSTVAKT_USER
+ .get(Attributes.USERNAME));
Userdata data = manager.getUserData(user, UserSettings.class);
assertNotNull(data);
}
+
@Test(expected = KustvaktException.class)
- public void testUserDetailsGetNonExistent() throws KustvaktException {
+ public void testUserDetailsGetNonExistent () throws KustvaktException {
testCreateUser();
AuthenticationManagerIface manager = helper().getContext()
.getAuthenticationManager();
@@ -92,8 +102,9 @@
assertNotNull(data);
}
+
@Test(expected = KustvaktException.class)
- public void testUserSettingsGetNonExistent() throws KustvaktException {
+ public void testUserSettingsGetNonExistent () throws KustvaktException {
testCreateUser();
AuthenticationManagerIface manager = helper().getContext()
.getAuthenticationManager();
@@ -104,8 +115,9 @@
assertNotNull(data);
}
+
@Override
- public void initMethod() throws KustvaktException {
+ public void initMethod () throws KustvaktException {
helper().setupAccount();
}
}
diff --git a/src/test/java/de/ids_mannheim/korap/suites/DaoTestSuite.java b/src/test/java/de/ids_mannheim/korap/suites/DaoTestSuite.java
index d569aa9..fdd328d 100644
--- a/src/test/java/de/ids_mannheim/korap/suites/DaoTestSuite.java
+++ b/src/test/java/de/ids_mannheim/korap/suites/DaoTestSuite.java
@@ -16,5 +16,4 @@
@RunWith(Suite.class)
@Suite.SuiteClasses({ PolicyDaoTest.class, UserdataTest.class,
UserDaoTest.class, ResourceDaoTest.class })
-public class DaoTestSuite {
-}
+public class DaoTestSuite {}
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 de082af..65b93c8 100644
--- a/src/test/java/de/ids_mannheim/korap/user/UserdataTest.java
+++ b/src/test/java/de/ids_mannheim/korap/user/UserdataTest.java
@@ -19,34 +19,36 @@
public class UserdataTest extends BeanConfigTest {
@Before
- public void clear() {
- UserDetailsDao dao = new UserDetailsDao(
- helper().getContext().getPersistenceClient());
- UserSettingsDao sdao = new UserSettingsDao(
- helper().getContext().getPersistenceClient());
+ public void clear () {
+ UserDetailsDao dao = new UserDetailsDao(helper().getContext()
+ .getPersistenceClient());
+ UserSettingsDao sdao = new UserSettingsDao(helper().getContext()
+ .getPersistenceClient());
assertNotEquals(-1, dao.deleteAll());
assertNotEquals(-1, sdao.deleteAll());
}
+
@Test
- public void testDataStore() {
+ public void testDataStore () {
String val = "value1;value_data";
User user = new KorAPUser();
user.setId(1);
- UserDetailsDao dao = new UserDetailsDao(
- helper().getContext().getPersistenceClient());
+ UserDetailsDao dao = new UserDetailsDao(helper().getContext()
+ .getPersistenceClient());
UserDetails d = new UserDetails(1);
d.setField("key_1", val);
assertNotEquals(-1, dao.store(d));
}
+
@Test
- public void testDataGet() throws dbException {
+ public void testDataGet () throws dbException {
String val = "value1;value_data";
User user = new KorAPUser();
user.setId(1);
- UserDetailsDao dao = new UserDetailsDao(
- helper().getContext().getPersistenceClient());
+ UserDetailsDao dao = new UserDetailsDao(helper().getContext()
+ .getPersistenceClient());
UserDetails d = new UserDetails(1);
d.setField("key_1", val);
assertNotEquals(-1, dao.store(d));
@@ -60,8 +62,9 @@
assertEquals(val, d.get("key_1"));
}
+
@Test
- public void testDataValidation() {
+ public void testDataValidation () {
Userdata data = new UserDetails(1);
data.setField(Attributes.COUNTRY, "Germany");
@@ -72,8 +75,9 @@
assertFalse(data.isValid());
}
+
@Test
- public void testSettingsValidation() {
+ public void testSettingsValidation () {
Userdata data = new UserSettings(1);
data.setField(Attributes.FILE_FORMAT_FOR_EXPORT, "export");
@@ -84,37 +88,40 @@
assertTrue(data.isValid());
}
+
@Test
- public void testUserdatafactory() throws KustvaktException {
- UserDataDbIface dao = BeansFactory.getTypeFactory()
- .getTypedBean(helper().getContext().getUserDataDaos(), UserDetails.class);
+ public void testUserdatafactory () throws KustvaktException {
+ UserDataDbIface dao = BeansFactory.getTypeFactory().getTypedBean(
+ helper().getContext().getUserDataDaos(), UserDetails.class);
assertNotNull(dao);
assertEquals(UserDetailsDao.class, dao.getClass());
- dao = BeansFactory.getTypeFactory()
- .getTypedBean(helper().getContext().getUserDataDaos(), UserSettings.class);
+ dao = BeansFactory.getTypeFactory().getTypedBean(
+ helper().getContext().getUserDataDaos(), UserSettings.class);
assertNotNull(dao);
assertEquals(UserSettingsDao.class, dao.getClass());
}
+
@Test(expected = RuntimeException.class)
- public void testUserdatafactoryError() throws KustvaktException {
- BeansFactory.getTypeFactory()
- .getTypedBean(helper().getContext().getUserDataDaos(), new Userdata(1) {
+ public void testUserdatafactoryError () throws KustvaktException {
+ BeansFactory.getTypeFactory().getTypedBean(
+ helper().getContext().getUserDataDaos(), new Userdata(1) {
@Override
- public String[] requiredFields() {
+ public String[] requiredFields () {
return new String[0];
}
+
@Override
- public String[] defaultFields() {
+ public String[] defaultFields () {
return new String[0];
}
}.getClass());
}
+
@Override
- public void initMethod() throws KustvaktException {
- }
+ public void initMethod () throws KustvaktException {}
}
diff --git a/src/test/java/de/ids_mannheim/korap/web/service/FastJerseyTest.java b/src/test/java/de/ids_mannheim/korap/web/service/FastJerseyTest.java
index 83e1438..db7a860 100644
--- a/src/test/java/de/ids_mannheim/korap/web/service/FastJerseyTest.java
+++ b/src/test/java/de/ids_mannheim/korap/web/service/FastJerseyTest.java
@@ -37,49 +37,57 @@
private static Client client;
private static String[] classPackages = null;
- public static void addClass(Class<?> resourceClass) {
+
+ public static void addClass (Class<?> resourceClass) {
resourceConfig.getClasses().add(resourceClass);
}
- public static void setPackages(String... pack) {
+
+ public static void setPackages (String ... pack) {
classPackages = pack;
}
- public static void addSingleton(Object resourceSingleton) {
+
+ public static void addSingleton (Object resourceSingleton) {
resourceConfig.getSingletons().add(resourceSingleton);
}
- public String getAPIVersion() {
+
+ public String getAPIVersion () {
return API_VERSION;
}
- public static <T> void addProviderForContext(Class<T> contextClass,
+
+ public static <T> void addProviderForContext (Class<T> contextClass,
T contextObject) {
- addSingleton(
- new SingletonTypeInjectableProvider<Context, T>(contextClass,
- contextObject) {
- });
+ addSingleton(new SingletonTypeInjectableProvider<Context, T>(
+ contextClass, contextObject) {});
}
- public static void addRequestFilter(Object filter) {
+
+ public static void addRequestFilter (Object filter) {
resourceConfig.getContainerRequestFilters().add(filter);
}
- public static void addResponseFilter(Object filter) {
+
+ public static void addResponseFilter (Object filter) {
resourceConfig.getContainerResponseFilters().add(filter);
}
- public static void setTestContainerFactory(
+
+ public static void setTestContainerFactory (
TestContainerFactory newTestContainerFactory) {
testContainerFactory = newTestContainerFactory;
}
+
@BeforeClass
- public static void cleanStaticVariables() {
+ public static void cleanStaticVariables () {
resourceConfig = new DefaultResourceConfig();
}
- public static void initServer() {
+
+ public static void initServer () {
AppDescriptor ad;
if (classPackages == null)
ad = new LowLevelAppDescriptor.Builder(resourceConfig).build();
@@ -94,42 +102,47 @@
tcf = new GrizzlyWebTestContainerFactory();
}
- testContainer = tcf
- .create(UriBuilder.fromUri("http://localhost/").port(9998)
- .build(), ad);
+ testContainer = tcf.create(UriBuilder.fromUri("http://localhost/")
+ .port(9998).build(), ad);
client = testContainer.getClient();
if (client == null) {
client = Client.create(ad.getClientConfig());
}
}
- public static void startServer() {
+
+ public static void startServer () {
if (testContainer != null) {
testContainer.start();
}
}
+
@AfterClass
- public static void stopServer() {
+ public static void stopServer () {
testContainer.stop();
testContainer = null;
client = null;
}
- public Client client() {
+
+ public Client client () {
return client;
}
- public URI getBaseUri() {
+
+ public URI getBaseUri () {
return testContainer.getBaseUri();
}
- public WebResource resource() {
+
+ public WebResource resource () {
return client.resource(getBaseUri());
}
+
@Before
- public void startServerBeforeFirstTestRun() {
+ public void startServerBeforeFirstTestRun () {
if (testContainer == null) {
initServer();
startServer();
diff --git a/src/test/java/de/ids_mannheim/korap/web/service/OAuth2HandlerTest.java b/src/test/java/de/ids_mannheim/korap/web/service/OAuth2HandlerTest.java
index ce7851d..0a55637 100644
--- a/src/test/java/de/ids_mannheim/korap/web/service/OAuth2HandlerTest.java
+++ b/src/test/java/de/ids_mannheim/korap/web/service/OAuth2HandlerTest.java
@@ -24,13 +24,14 @@
private static final String SCOPES = "search preferences queries account";
+
@BeforeClass
- public static void setup() throws Exception {
+ public static void setup () throws Exception {
// BeanConfiguration.loadClasspathContext("default-config.xml");
// handler = new OAuth2Handler(
// BeanConfiguration.getKustvaktContext().getPersistenceClient());
// crypto = BeanConfiguration.getKustvaktContext().getEncryption();
-// info = new ClientInfo(crypto.createID(), crypto.createToken());
+ // info = new ClientInfo(crypto.createID(), crypto.createToken());
// info.setConfidential(true);
// //todo: support for subdomains?!
// info.setUrl("http://localhost:8080/api/v0.1");
@@ -44,6 +45,7 @@
// crypto = helper.getBean(ContextHolder.KUSTVAKT_ENCRYPTION);
}
+
// @AfterClass
// public static void drop() throws KustvaktException {
// assert handler != null;
@@ -53,28 +55,29 @@
// }
@Test
- public void testStoreAuthorizationCodeThrowsNoException()
+ public void testStoreAuthorizationCodeThrowsNoException ()
throws KustvaktException {
String auth_code = helper().getContext().getEncryption().createToken();
- AuthCodeInfo codeInfo = new AuthCodeInfo(info.getClient_id(),
- auth_code);
+ AuthCodeInfo codeInfo = new AuthCodeInfo(info.getClient_id(), auth_code);
codeInfo.setScopes(SCOPES);
- OAuth2Handler handler = new OAuth2Handler(helper().getContext().getPersistenceClient());
+ OAuth2Handler handler = new OAuth2Handler(helper().getContext()
+ .getPersistenceClient());
handler.authorize(codeInfo, helper().getUser());
codeInfo = handler.getAuthorization(auth_code);
Assert.assertNotNull("client is null!", codeInfo);
}
+
@Test
- public void testAuthorizationCodeRemoveThrowsNoException()
+ public void testAuthorizationCodeRemoveThrowsNoException ()
throws KustvaktException {
String auth_code = helper().getContext().getEncryption().createToken();
- AuthCodeInfo codeInfo = new AuthCodeInfo(info.getClient_id(),
- auth_code);
+ AuthCodeInfo codeInfo = new AuthCodeInfo(info.getClient_id(), auth_code);
codeInfo.setScopes(SCOPES);
- OAuth2Handler handler = new OAuth2Handler(helper().getContext().getPersistenceClient());
+ OAuth2Handler handler = new OAuth2Handler(helper().getContext()
+ .getPersistenceClient());
handler.authorize(codeInfo, helper().getUser());
String t = helper().getContext().getEncryption().createToken();
String refresh = helper().getContext().getEncryption().createToken();
@@ -87,43 +90,49 @@
Assert.assertNull("clearing authorization failed", c2);
}
+
@Test
- public void testTokenEndpointRedirect() {
+ public void testTokenEndpointRedirect () {
}
+
@Test
- public void testStoreAccessCodeViaAuthCodeThrowsNoException() {
+ public void testStoreAccessCodeViaAuthCodeThrowsNoException () {
String auth_code = helper().getContext().getEncryption().createToken();
- AuthCodeInfo codeInfo = new AuthCodeInfo(info.getClient_id(),
- auth_code);
+ AuthCodeInfo codeInfo = new AuthCodeInfo(info.getClient_id(), auth_code);
codeInfo.setScopes(SCOPES);
}
+
@Test
- public void testDeleteAccessCodesByUserDeleteCascade() {
+ public void testDeleteAccessCodesByUserDeleteCascade () {
}
+
@Test
- public void testAccessTokenbyUserDeleteCascade() {
+ public void testAccessTokenbyUserDeleteCascade () {
}
+
@Test
- public void testRefreshToken() {
+ public void testRefreshToken () {
}
+
// fixme: exception thrown?!
@Test
- public void testAccessTokenExpired() {
+ public void testAccessTokenExpired () {
}
+
@Override
- public void initMethod() throws KustvaktException {
+ public void initMethod () throws KustvaktException {
helper().setupAccount();
EncryptionIface crypto = helper().getContext().getEncryption();
diff --git a/src/test/java/de/ids_mannheim/korap/web/service/full/AuthServiceTest.java b/src/test/java/de/ids_mannheim/korap/web/service/full/AuthServiceTest.java
index 9a3f782..b394d68 100644
--- a/src/test/java/de/ids_mannheim/korap/web/service/full/AuthServiceTest.java
+++ b/src/test/java/de/ids_mannheim/korap/web/service/full/AuthServiceTest.java
@@ -14,7 +14,7 @@
public class AuthServiceTest extends FastJerseyTest {
@BeforeClass
- public static void configure() throws Exception {
+ public static void configure () throws Exception {
FastJerseyTest.setPackages("de.ids_mannheim.korap.web.service",
"de.ids_mannheim.korap.web.filter",
"de.ids_mannheim.korap.web.utils");
@@ -22,28 +22,32 @@
@Override
- public void initMethod() throws KustvaktException {
+ public void initMethod () throws KustvaktException {
helper().setupAccount();
}
+
@Test
- public void testBasicHttp() {
+ public void testBasicHttp () {
User user = helper().getUser();
}
+
@Test
- public void testBasicLogout(){
+ public void testBasicLogout () {
}
+
@Test
- public void testSessionTokenLogin() {
+ public void testSessionTokenLogin () {
}
+
@Test
- public void testSessionTokenLogout() {
+ public void testSessionTokenLogout () {
}
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 ac05e24..5392eec 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
@@ -17,40 +17,49 @@
public class FilterTest extends FastJerseyTest {
@BeforeClass
- public static void setup() throws Exception {
+ public static void setup () throws Exception {
FastJerseyTest.setPackages("de.ids_mannheim.korap.web.service.full",
"de.ids_mannheim.korap.web.filter",
"de.ids_mannheim.korap.web.utils");
}
+
@Test
- public void testTestUserAuth() {
- ClientResponse resp = resource().path(getAPIVersion()).path("user/info")
- .header(Attributes.AUTHORIZATION, BasicHttpAuth
- .encode(TestHelper.getUserCredentials()[0],
+ public void testTestUserAuth () {
+ ClientResponse resp = resource()
+ .path(getAPIVersion())
+ .path("user/info")
+ .header(Attributes.AUTHORIZATION,
+ BasicHttpAuth.encode(
+ TestHelper.getUserCredentials()[0],
TestHelper.getUserCredentials()[1]))
.get(ClientResponse.class);
assert resp.getStatus() == Response.SC_OK;
}
+
@Test
- public void testDemoAuth() {
- ClientResponse resp = resource().path(getAPIVersion()).path("user/info")
- .get(ClientResponse.class);
+ public void testDemoAuth () {
+ ClientResponse resp = resource().path(getAPIVersion())
+ .path("user/info").get(ClientResponse.class);
assert resp.getStatus() == Response.SC_OK;
}
+
@Test
- public void testUnauthorizedAuth() {
- ClientResponse resp = resource().path(getAPIVersion()).path("user/info")
+ public void testUnauthorizedAuth () {
+ ClientResponse resp = resource()
+ .path(getAPIVersion())
+ .path("user/info")
.header(Attributes.AUTHORIZATION,
BasicHttpAuth.encode("kustvakt", "kustvakt2015"))
.get(ClientResponse.class);
assert resp.getStatus() == Response.SC_UNAUTHORIZED;
}
+
@Override
- public void initMethod() throws KustvaktException {
+ public void initMethod () throws KustvaktException {
helper().setupAccount();
}
}
diff --git a/src/test/java/de/ids_mannheim/korap/web/service/full/KustvaktCoreRestTest.java b/src/test/java/de/ids_mannheim/korap/web/service/full/KustvaktCoreRestTest.java
index f227ba3..ec25c17 100644
--- a/src/test/java/de/ids_mannheim/korap/web/service/full/KustvaktCoreRestTest.java
+++ b/src/test/java/de/ids_mannheim/korap/web/service/full/KustvaktCoreRestTest.java
@@ -20,22 +20,24 @@
public class KustvaktCoreRestTest extends FastJerseyTest {
@BeforeClass
- public static void configure() {
+ public static void configure () {
FastJerseyTest.setPackages("de.ids_mannheim.korap.web.service.light",
"de.ids_mannheim.korap.web.filter",
"de.ids_mannheim.korap.web.utils");
}
+
// @Test
- public void testFieldsInSearch() {
+ public void testFieldsInSearch () {
ClientResponse response = resource().path(getAPIVersion())
.path("search").queryParam("q", "[base=Wort]")
.queryParam("ql", "poliqarp").get(ClientResponse.class);
assert ClientResponse.Status.OK.getStatusCode() == response.getStatus();
}
+
@Test
- public void testQuery() {
+ public void testQuery () {
ClientResponse response = resource().path(getAPIVersion())
.path("search").queryParam("q", "[base=Wort]")
.queryParam("ql", "poliqarp").get(ClientResponse.class);
@@ -44,8 +46,9 @@
assert ClientResponse.Status.OK.getStatusCode() == response.getStatus();
}
+
@Test
- public void testQueryRaw() {
+ public void testQueryRaw () {
QuerySerializer s = new QuerySerializer();
s.setQuery("[base=Wort]", "poliqarp");
@@ -56,29 +59,34 @@
assert ClientResponse.Status.OK.getStatusCode() == response.getStatus();
}
+
// in case no index is there, this will throw an error
@Test
@Ignore
- public void testGetMatchInfoThrowsNoException() {
- ClientResponse response = resource().path(getAPIVersion())
- .get(ClientResponse.class);
+ public void testGetMatchInfoThrowsNoException () {
+ ClientResponse response = resource().path(getAPIVersion()).get(
+ ClientResponse.class);
}
+
// @Test
- public void testGetStatsThrowsNoException() {
+ public void testGetStatsThrowsNoException () {
CollectionQueryProcessor pr = new CollectionQueryProcessor();
pr.process("corpusID=WPD & textClass=Sport");
Map map = new LinkedHashMap();
map.put("collection", pr.getRequestMap());
- ClientResponse response = resource().path(getAPIVersion()).path("stats")
+ ClientResponse response = resource().path(getAPIVersion())
+ .path("stats")
.post(ClientResponse.class, JsonUtils.toJSON(map));
assert ClientResponse.Status.OK.getStatusCode() == response.getStatus();
}
+
@Test
@Ignore
- public void testGetStats2ThrowsNoException() {
- ClientResponse response = resource().path(getAPIVersion()).path("stats")
+ public void testGetStats2ThrowsNoException () {
+ ClientResponse response = resource().path(getAPIVersion())
+ .path("stats")
.post(ClientResponse.class, "creationDate in 1787");
String ent = response.getEntity(String.class);
assert ClientResponse.Status.OK.getStatusCode() == response.getStatus();
@@ -87,8 +95,9 @@
// System.out.println("STATS ENTITY " + ent);
}
+
// @Test
- public void testBuildQueryThrowsNoException() {
+ public void testBuildQueryThrowsNoException () {
ClientResponse response = resource().path(getAPIVersion())
.path("search").queryParam("q", "[base=Haus & surface=Hauses]")
.queryParam("ql", "poliqarp").queryParam("cutOff", "true")
@@ -96,8 +105,9 @@
assert ClientResponse.Status.OK.getStatusCode() == response.getStatus();
}
+
// @Test
- public void testQueryByNameThrowsNoException() {
+ public void testQueryByNameThrowsNoException () {
ClientResponse response = resource().path(getAPIVersion())
.path("corpus").path("WPD").path("search")
.queryParam("q", "[base=Haus & surface=Hauses]")
@@ -106,8 +116,9 @@
System.out.println("RESPONSE " + response.getEntity(String.class));
}
+
@Override
- public void initMethod() throws KustvaktException {
+ public void initMethod () throws KustvaktException {
helper().setupAccount();
}
}
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 9870cea..60b7267 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
@@ -20,25 +20,28 @@
public class OAuth2EndpointTest extends FastJerseyTest {
@BeforeClass
- public static void configure() throws Exception {
+ public static void configure () throws Exception {
FastJerseyTest.setPackages("de.ids_mannheim.korap.web.service",
"de.ids_mannheim.korap.web.filter",
"de.ids_mannheim.korap.web.utils");
}
+
@Test
- public void init() {
+ public void init () {
}
+
@Override
- public void initMethod() throws KustvaktException {
+ public void initMethod () throws KustvaktException {
helper().setupAccount();
}
+
@Test
@Ignore
- public void testAuthorizeClient() {
+ public void testAuthorizeClient () {
ClientResponse response = resource().path("v0.1").path("oauth2")
.path("register")
.queryParam("redirect_url", "korap.ids-mannheim.de/redirect")
@@ -47,9 +50,10 @@
assert response.getStatus() == ClientResponse.Status.OK.getStatusCode();
}
+
@Test
@Ignore
- public void testRevokeClient() {
+ public void testRevokeClient () {
ClientResponse response = resource().path("v0.1").path("oauth2")
.path("register")
.queryParam("redirect_url", "korap.ids-mannheim.de/redirect")
@@ -60,9 +64,10 @@
}
+
@Test
@Ignore
- public void authenticate() {
+ public void authenticate () {
String[] cred = TestHelper.getUserCredentials();
String enc = BasicHttpAuth.encode(cred[0], cred[1]);
ClientResponse response = resource().path("v0.1").path("oauth2")
diff --git a/src/test/java/de/ids_mannheim/korap/web/service/full/ResourceRemoteApiTest.java b/src/test/java/de/ids_mannheim/korap/web/service/full/ResourceRemoteApiTest.java
index bcf5f9a..95d7470 100644
--- a/src/test/java/de/ids_mannheim/korap/web/service/full/ResourceRemoteApiTest.java
+++ b/src/test/java/de/ids_mannheim/korap/web/service/full/ResourceRemoteApiTest.java
@@ -11,7 +11,7 @@
@Test
- public void testResourceGetFromDemo() {
+ public void testResourceGetFromDemo () {
}
}
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 f3cf778..d9e761c 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
@@ -23,17 +23,19 @@
public class ResourceServiceTest extends FastJerseyTest {
@BeforeClass
- public static void configure() throws Exception {
+ public static void configure () throws Exception {
FastJerseyTest.setPackages("de.ids_mannheim.korap.web.service.full",
"de.ids_mannheim.korap.web.filter",
"de.ids_mannheim.korap.web.utils");
}
+
@Test
- @Ignore
- public void testSearchSimple() {
- ClientResponse response = resource().path(getAPIVersion())
- .path("search").queryParam("q", "[orth=das]")
+ public void testSearchSimple () {
+ ClientResponse response = resource()
+ .path(getAPIVersion())
+ .path("search")
+ .queryParam("q", "[orth=das]")
.queryParam("ql", "poliqarp")
// .queryParam("cq", "corpusID=GOE")
.header(Attributes.AUTHORIZATION,
@@ -43,15 +45,17 @@
response.getStatus());
JsonNode node = JsonUtils.readTree(response.getEntity(String.class));
- Assert.assertNotNull(node);
+ assertNotNull(node);
assertNotEquals(0, node.path("matches").size());
}
+
@Test
- @Ignore
- public void testCollectionGet() {
- ClientResponse response = resource().path(getAPIVersion())
- .path("collection").header(Attributes.AUTHORIZATION,
+ public void testCollectionGet () {
+ ClientResponse response = resource()
+ .path(getAPIVersion())
+ .path("collection")
+ .header(Attributes.AUTHORIZATION,
BasicHttpAuth.encode("kustvakt", "kustvakt2015"))
.get(ClientResponse.class);
assertEquals(ClientResponse.Status.OK.getStatusCode(),
@@ -61,49 +65,58 @@
assertNotEquals(0, node.size());
}
+
@Test
- @Ignore
- public void testStats() {
- ClientResponse response = resource().path(getAPIVersion())
- .path("collection").header(Attributes.AUTHORIZATION,
+ public void testStats () {
+ ClientResponse response = resource()
+ .path(getAPIVersion())
+ .path("collection")
+ .header(Attributes.AUTHORIZATION,
BasicHttpAuth.encode("kustvakt", "kustvakt2015"))
.get(ClientResponse.class);
assertEquals(ClientResponse.Status.OK.getStatusCode(),
response.getStatus());
JsonNode node = JsonUtils.readTree(response.getEntity(String.class));
- Assert.assertNotNull(node);
+ assertNotNull(node);
+ assertNotEquals(0, node.size());
- System.out.println("-------------------------------");
- System.out.println("NODE COLLECTIONS" + node);
String id = node.path(0).path("id").asText();
- System.out.println("ID IS " + id);
- System.out.println("FROM NODE " + node);
- response = resource().path(getAPIVersion()).path("collection").path(id)
- .path("stats").header(Attributes.AUTHORIZATION,
+ response = resource()
+ .path(getAPIVersion())
+ .path("collection")
+ .path(id)
+ .path("stats")
+ .header(Attributes.AUTHORIZATION,
BasicHttpAuth.encode("kustvakt", "kustvakt2015"))
.get(ClientResponse.class);
assertEquals(ClientResponse.Status.OK.getStatusCode(),
response.getStatus());
node = JsonUtils.readTree(response.getEntity(String.class));
- Assert.assertNotNull(node);
+ assertNotNull(node);
int docs = node.path("documents").asInt();
- System.out.println("-------------------------------");
- System.out.println("NODE " + node);
assertNotEquals(0, docs);
Assert.assertTrue(docs < 15);
}
+
@Test
- public void testResourceStore() {
+ public void testResourceStore () {
}
+
+ @Test
+ public void testResourceDelete () {
+
+ }
+
+
@Test
@Ignore
- public void testSerializationQueryInCollection() {
+ public void testSerializationQueryInCollection () {
ClientResponse response = resource().path(getAPIVersion())
.path("corpus/WPD/search").queryParam("q", "[base=Haus]")
.queryParam("ql", "poliqarp").queryParam("context", "base/s:s")
@@ -113,8 +126,9 @@
System.out.println("Entity 1 " + ent);
}
+
@Test
- public void testSerializationQueryPublic() {
+ public void testSerializationQueryPublic () {
ClientResponse response = resource().path(getAPIVersion())
.path("search").queryParam("q", "[base=Haus]")
.queryParam("ql", "poliqarp").queryParam("context", "sentence")
@@ -125,8 +139,9 @@
System.out.println(node);
}
+
@Test
- public void testQuery() {
+ public void testQuery () {
ClientResponse response = resource().path(getAPIVersion())
.path("search").queryParam("q", "[base=Haus]")
.queryParam("ql", "poliqarp").queryParam("context", "sentence")
@@ -138,24 +153,33 @@
assertNotEquals("${project.version}", "/meta/version");
}
+
@Test
@Ignore
- public void testSerializationMeta() {
+ public void testSerializationMeta () {
ClientResponse response = resource().path(getAPIVersion())
.path("search").queryParam("context", "sentence")
.queryParam("q", "[pos=ADJA]").queryParam("ql", "poliqarp")
.get(ClientResponse.class);
}
+
@Test
@Ignore
- public void testSerializationCollection() {
+ public void testSerializationCollection () {
ClientResponse response = resource().path(getAPIVersion()).path("")
.get(ClientResponse.class);
}
+
+ @Test
+ public void testMatchInfo () {
+
+ }
+
+
@Override
- public void initMethod() throws KustvaktException {
+ public void initMethod () throws KustvaktException {
helper().runBootInterfaces();
}
}