Revision 48620
Added by Alessia Bardi almost 7 years ago
MongoCqlTranslatorTest.java | ||
---|---|---|
1 | 1 |
package eu.dnetlib.functionality.cql.mongo; |
2 | 2 |
|
3 | 3 |
import java.io.IOException; |
4 |
import java.util.Date; |
|
5 | 4 |
|
6 | 5 |
import com.google.common.collect.Lists; |
7 | 6 |
import com.mongodb.BasicDBObject; |
8 |
import com.mongodb.DBObject; |
|
9 |
import com.mongodb.util.JSON; |
|
10 | 7 |
import org.apache.commons.logging.Log; |
11 | 8 |
import org.apache.commons.logging.LogFactory; |
12 | 9 |
import org.bson.conversions.Bson; |
13 | 10 |
import org.bson.types.ObjectId; |
14 |
import org.joda.time.format.DateTimeFormat; |
|
15 |
import org.joda.time.format.DateTimeFormatter; |
|
16 |
import org.joda.time.format.ISODateTimeFormat; |
|
17 | 11 |
import org.junit.Ignore; |
18 | 12 |
import org.junit.Test; |
19 | 13 |
import org.z3950.zing.cql.CQLParseException; |
... | ... | |
26 | 20 |
private final MongoCqlTranslator tr = new MongoCqlTranslator(); |
27 | 21 |
|
28 | 22 |
@Test |
23 |
public void testParseExact() throws IOException, CQLParseException { |
|
24 |
Bson expected = new BasicDBObject("set", "CEDIASManuscripts"); |
|
25 |
Bson o = tr.toMongo("set exact \"CEDIASManuscripts\""); |
|
26 |
assertEquals(expected, o); |
|
27 |
} |
|
28 |
|
|
29 |
@Test |
|
29 | 30 |
public void testParseEq() throws IOException, CQLParseException { |
30 | 31 |
Bson expected = new BasicDBObject("set", "CEDIASManuscripts"); |
31 | 32 |
Bson o = tr.toMongo("set = \"CEDIASManuscripts\""); |
32 | 33 |
assertEquals(expected, o); |
34 |
} |
|
33 | 35 |
|
36 |
@Test |
|
37 |
public void testParseEquivalentExact() throws IOException, CQLParseException { |
|
38 |
Bson o = tr.toMongo("set = \"CEDIASManuscripts\""); |
|
39 |
Bson oExact = tr.toMongo("set exact \"CEDIASManuscripts\""); |
|
40 |
assertEquals(oExact, o); |
|
34 | 41 |
} |
35 | 42 |
|
36 | 43 |
@Test |
Also available in: Unified diff
Tests fro exact CQL queries