json date format for pubdate (currently default is yyyy-mm-dd)
diff --git a/src/test/java/MetaQuerySerializationTest.java b/src/test/java/MetaQuerySerializationTest.java
index 71ca546..c44d036 100644
--- a/src/test/java/MetaQuerySerializationTest.java
+++ b/src/test/java/MetaQuerySerializationTest.java
@@ -1,11 +1,13 @@
import de.ids_mannheim.korap.query.serialize.MetaCollectionSerializer;
import de.ids_mannheim.korap.query.serialize.MetaQuerySerializer;
+import org.joda.time.DateTime;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.junit.runners.JUnit4;
import java.io.IOException;
import java.util.HashMap;
+import java.util.LinkedHashMap;
import java.util.Map;
/**
@@ -16,19 +18,21 @@
@RunWith(JUnit4.class)
public class MetaQuerySerializationTest {
- private MetaQuerySerializer serializer;
+ private MetaQuerySerializer querySerializer;
+ private MetaCollectionSerializer collSerializer;
public MetaQuerySerializationTest() {
- serializer = new MetaQuerySerializer();
+ querySerializer = new MetaQuerySerializer();
+ collSerializer = new MetaCollectionSerializer();
}
@Test
public void test() throws IOException {
Map<String, String> j = new HashMap();
j.put("author", "Goethe");
- j.put("pubPLace", "Erfurt");
+ j.put("pubPlace", "Erfurt");
j.put("textClass", "wissenschaft");
- String s = serializer.stringify(j);
+ String s = querySerializer.stringify(j, MetaQuerySerializer.TYPE.FILTER);
// System.out.println("value reference " + s);
}
@@ -36,16 +40,23 @@
public void testSingle() throws IOException {
Map<String, String> j = new HashMap();
j.put("textClass", "wissenschaft");
- String s = serializer.stringify(j);
+ String s = querySerializer.stringify(j, MetaQuerySerializer.TYPE.FILTER);
// System.out.println("value reference test single " + s);
}
@Test
public void testResourceMeta() throws IOException {
- MetaCollectionSerializer ser = new MetaCollectionSerializer();
- String s = ser.serialize("25");
- System.out.println(" --- RESULT JSON " + s);
+ String s = collSerializer.serialize("25");
+// System.out.println(" --- RESULT JSON " + s);
+ }
-
+ @Test
+ public void testDates() throws IOException {
+ Map<String, String> queries = new LinkedHashMap<>();
+ queries.put("<pubDate", String.valueOf(new DateTime().getMillis()));
+ queries.put(">pubDate", String.valueOf(new DateTime().getMillis()+2));
+ queries.put("author", "Goethe");
+ String f = querySerializer.stringify(queries, MetaQuerySerializer.TYPE.FILTER);
+ System.out.println("value : "+ f);
}
}