|
1 | 1 | package com.redislabs.redisgraph; |
2 | 2 |
|
| 3 | + |
3 | 4 | import java.util.Arrays; |
| 5 | +import java.util.List; |
4 | 6 | import java.util.NoSuchElementException; |
5 | 7 |
|
| 8 | +import com.redislabs.redisgraph.impl.Edge; |
| 9 | +import com.redislabs.redisgraph.impl.Node; |
| 10 | +import com.redislabs.redisgraph.impl.Property; |
6 | 11 | import org.junit.Assert; |
7 | 12 | import org.junit.Before; |
8 | 13 | import org.junit.Test; |
9 | 14 |
|
10 | 15 | import com.redislabs.redisgraph.Statistics.Label; |
11 | 16 |
|
| 17 | +import static com.redislabs.redisgraph.Header.ResultSetColumnTypes.*; |
| 18 | + |
12 | 19 | public class RedisGraphAPITest { |
13 | 20 | RedisGraphAPI api; |
14 | 21 |
|
15 | 22 | public RedisGraphAPITest() { |
16 | 23 | api = new RedisGraphAPI("social"); |
17 | | - |
| 24 | + |
18 | 25 | /* Dummy call to generate graph so the first deleteGraph() won't fail */ |
19 | 26 | api.query("CREATE ({name:'roi',age:32})"); |
20 | 27 | } |
21 | 28 |
|
22 | 29 | @Before |
23 | | - public void deleteGraph(){ |
24 | | - api.deleteGraph(); |
| 30 | + public void deleteGraph() { |
| 31 | + api.deleteGraph(); |
25 | 32 | } |
26 | | - |
| 33 | + |
27 | 34 | @Test |
28 | | - public void testCreateNode(){ |
| 35 | + public void testCreateNode() { |
29 | 36 | // Create a node |
30 | | - ResultSet result = api.query("CREATE ({name:'roi',age:32})"); |
31 | | - Assert.assertFalse(result.hasNext()); |
32 | | - |
33 | | - try { |
34 | | - result.next(); |
35 | | - Assert.fail(); |
36 | | - }catch(NoSuchElementException e) {} |
37 | | - |
38 | | - Assert.assertEquals(1, result.getStatistics().nodesCreated()); |
39 | | - Assert.assertNull(result.getStatistics().getStringValue(Label.NODES_DELETED)); |
40 | | - Assert.assertNull(result.getStatistics().getStringValue(Label.RELATIONSHIPS_CREATED)); |
41 | | - Assert.assertNull(result.getStatistics().getStringValue(Label.RELATIONSHIPS_DELETED)); |
42 | | - Assert.assertEquals(2, result.getStatistics().propertiesSet()); |
43 | | - Assert.assertNotNull(result.getStatistics().getStringValue(Label.QUERY_INTERNAL_EXECUTION_TIME)); |
| 37 | + ResultSet resultSet = api.query("CREATE ({name:'roi',age:32})"); |
| 38 | + |
| 39 | + |
| 40 | + Assert.assertEquals(1, resultSet.getStatistics().nodesCreated()); |
| 41 | + Assert.assertNull(resultSet.getStatistics().getStringValue(Label.NODES_DELETED)); |
| 42 | + Assert.assertNull(resultSet.getStatistics().getStringValue(Label.RELATIONSHIPS_CREATED)); |
| 43 | + Assert.assertNull(resultSet.getStatistics().getStringValue(Label.RELATIONSHIPS_DELETED)); |
| 44 | + Assert.assertEquals(2, resultSet.getStatistics().propertiesSet()); |
| 45 | + Assert.assertNotNull(resultSet.getStatistics().getStringValue(Label.QUERY_INTERNAL_EXECUTION_TIME)); |
| 46 | + |
| 47 | + |
| 48 | + Assert.assertFalse(resultSet.hasNext()); |
| 49 | + |
| 50 | + try { |
| 51 | + resultSet.next(); |
| 52 | + Assert.fail(); |
| 53 | + } catch (NoSuchElementException e) { |
| 54 | + } |
44 | 55 | } |
45 | 56 |
|
46 | 57 | @Test |
47 | | - public void testCreateLabeledNode(){ |
| 58 | + public void testCreateLabeledNode() { |
48 | 59 | // Create a node with a label |
49 | | - ResultSet result = api.query("CREATE (:human{name:'danny',age:12})"); |
50 | | - Assert.assertFalse(result.hasNext()); |
51 | | - |
52 | | - Assert.assertEquals("1", result.getStatistics().getStringValue(Label.NODES_CREATED)); |
53 | | - Assert.assertEquals("2", result.getStatistics().getStringValue(Label.PROPERTIES_SET)); |
54 | | - Assert.assertNotNull(result.getStatistics().getStringValue(Label.QUERY_INTERNAL_EXECUTION_TIME)); |
| 60 | + ResultSet resultSet = api.query("CREATE (:human{name:'danny',age:12})"); |
| 61 | + Assert.assertFalse(resultSet.hasNext()); |
| 62 | +// |
| 63 | + Assert.assertEquals("1", resultSet.getStatistics().getStringValue(Label.NODES_CREATED)); |
| 64 | + Assert.assertEquals("2", resultSet.getStatistics().getStringValue(Label.PROPERTIES_SET)); |
| 65 | + Assert.assertNotNull(resultSet.getStatistics().getStringValue(Label.QUERY_INTERNAL_EXECUTION_TIME)); |
55 | 66 | } |
56 | 67 |
|
57 | 68 | @Test |
58 | | - public void testConnectNodes(){ |
| 69 | + public void testConnectNodes() { |
59 | 70 | // Create both source and destination nodes |
60 | 71 | Assert.assertNotNull(api.query("CREATE (:person{name:'roi',age:32})")); |
61 | 72 | Assert.assertNotNull(api.query("CREATE (:person{name:'amit',age:30})")); |
62 | | - |
63 | | - // Connect source and destination nodes. |
64 | | - ResultSet matchResult = api.query("MATCH (a:person), (b:person) WHERE (a.name = 'roi' AND b.name='amit') CREATE (a)-[:knows]->(a)"); |
65 | | - |
66 | | - Assert.assertFalse(matchResult.hasNext()); |
67 | | - Assert.assertNull(matchResult.getStatistics().getStringValue(Label.NODES_CREATED)); |
68 | | - Assert.assertNull(matchResult.getStatistics().getStringValue(Label.PROPERTIES_SET)); |
69 | | - Assert.assertEquals(1, matchResult.getStatistics().relationshipsCreated()); |
70 | | - Assert.assertEquals(0, matchResult.getStatistics().relationshipsDeleted()); |
71 | | - Assert.assertNotNull(matchResult.getStatistics().getStringValue(Label.QUERY_INTERNAL_EXECUTION_TIME)); |
| 73 | + |
| 74 | + // Connect source and destination nodes. |
| 75 | + ResultSet resultSet = api.query("MATCH (a:person), (b:person) WHERE (a.name = 'roi' AND b.name='amit') CREATE (a)-[:knows]->(a)"); |
| 76 | + |
| 77 | + Assert.assertFalse(resultSet.hasNext()); |
| 78 | + Assert.assertNull(resultSet.getStatistics().getStringValue(Label.NODES_CREATED)); |
| 79 | + Assert.assertNull(resultSet.getStatistics().getStringValue(Label.PROPERTIES_SET)); |
| 80 | + Assert.assertEquals(1, resultSet.getStatistics().relationshipsCreated()); |
| 81 | + Assert.assertEquals(0, resultSet.getStatistics().relationshipsDeleted()); |
| 82 | + Assert.assertNotNull(resultSet.getStatistics().getStringValue(Label.QUERY_INTERNAL_EXECUTION_TIME)); |
| 83 | + } |
| 84 | + |
| 85 | + @Test |
| 86 | + public void testDeleteNodes(){ |
| 87 | + Assert.assertNotNull(api.query("CREATE (:person{name:'roi',age:32})")); |
| 88 | + Assert.assertNotNull(api.query("CREATE (:person{name:'amit',age:30})")); |
| 89 | + ResultSet deleteResult = api.query("MATCH (a:person) WHERE (a.name = 'roi') DELETE a"); |
| 90 | + |
| 91 | + Assert.assertFalse(deleteResult.hasNext()); |
| 92 | + Assert.assertNull(deleteResult.getStatistics().getStringValue(Label.NODES_CREATED)); |
| 93 | + Assert.assertNull(deleteResult.getStatistics().getStringValue(Label.PROPERTIES_SET)); |
| 94 | + Assert.assertNull(deleteResult.getStatistics().getStringValue(Label.NODES_CREATED)); |
| 95 | + Assert.assertNull(deleteResult.getStatistics().getStringValue(Label.RELATIONSHIPS_CREATED)); |
| 96 | + Assert.assertNull(deleteResult.getStatistics().getStringValue(Label.RELATIONSHIPS_DELETED)); |
| 97 | + Assert.assertEquals(1, deleteResult.getStatistics().nodesDeleted()); |
| 98 | + Assert.assertNotNull(deleteResult.getStatistics().getStringValue(Label.QUERY_INTERNAL_EXECUTION_TIME)); |
| 99 | + |
| 100 | + Assert.assertNotNull(api.query("CREATE (:person{name:'roi',age:32})")); |
| 101 | + Assert.assertNotNull(api.query("MATCH (a:person), (b:person) WHERE (a.name = 'roi' AND b.name='amit') CREATE (a)-[:knows]->(a)")); |
| 102 | + deleteResult = api.query("MATCH (a:person) WHERE (a.name = 'roi') DELETE a"); |
| 103 | + |
| 104 | + Assert.assertFalse(deleteResult.hasNext()); |
| 105 | + Assert.assertNull(deleteResult.getStatistics().getStringValue(Label.NODES_CREATED)); |
| 106 | + Assert.assertNull(deleteResult.getStatistics().getStringValue(Label.PROPERTIES_SET)); |
| 107 | + Assert.assertNull(deleteResult.getStatistics().getStringValue(Label.NODES_CREATED)); |
| 108 | + Assert.assertNull(deleteResult.getStatistics().getStringValue(Label.RELATIONSHIPS_CREATED)); |
| 109 | + Assert.assertNull(deleteResult.getStatistics().getStringValue(Label.RELATIONSHIPS_DELETED)); |
| 110 | + Assert.assertEquals(1, deleteResult.getStatistics().nodesDeleted()); |
| 111 | + |
| 112 | + Assert.assertNotNull(deleteResult.getStatistics().getStringValue(Label.QUERY_INTERNAL_EXECUTION_TIME)); |
| 113 | + |
| 114 | + |
| 115 | + |
| 116 | + } |
| 117 | + |
| 118 | + @Test |
| 119 | + public void testDeleteRelationship(){ |
| 120 | + |
| 121 | + Assert.assertNotNull(api.query("CREATE (:person{name:'roi',age:32})")); |
| 122 | + Assert.assertNotNull(api.query("CREATE (:person{name:'amit',age:30})")); |
| 123 | + Assert.assertNotNull(api.query("MATCH (a:person), (b:person) WHERE (a.name = 'roi' AND b.name='amit') CREATE (a)-[:knows]->(a)")); |
| 124 | + ResultSet deleteResult = api.query("MATCH (a:person)-[e]->() WHERE (a.name = 'roi') DELETE e"); |
| 125 | + |
| 126 | + Assert.assertFalse(deleteResult.hasNext()); |
| 127 | + Assert.assertNull(deleteResult.getStatistics().getStringValue(Label.NODES_CREATED)); |
| 128 | + Assert.assertNull(deleteResult.getStatistics().getStringValue(Label.PROPERTIES_SET)); |
| 129 | + Assert.assertNull(deleteResult.getStatistics().getStringValue(Label.NODES_CREATED)); |
| 130 | + Assert.assertNull(deleteResult.getStatistics().getStringValue(Label.RELATIONSHIPS_CREATED)); |
| 131 | + Assert.assertNull(deleteResult.getStatistics().getStringValue(Label.NODES_DELETED)); |
| 132 | + Assert.assertEquals(1, deleteResult.getStatistics().relationshipsDeleted()); |
| 133 | + |
| 134 | + Assert.assertNotNull(deleteResult.getStatistics().getStringValue(Label.QUERY_INTERNAL_EXECUTION_TIME)); |
| 135 | + |
72 | 136 | } |
73 | | - |
| 137 | + |
| 138 | + |
74 | 139 | @Test |
75 | | - public void testIndex(){ |
| 140 | + public void testIndex() { |
76 | 141 | // Create both source and destination nodes |
77 | | - Assert.assertNotNull(api.query("CREATE (:person{name:'roi',age:32})")); |
78 | | - |
79 | | - ResultSet createIndexResult = api.query("CREATE INDEX ON :person(age)"); |
80 | | - Assert.assertFalse(createIndexResult.hasNext()); |
81 | | - Assert.assertEquals(1, createIndexResult.getStatistics().indicesAdded()); |
82 | | - |
83 | | - ResultSet failCreateIndexResult = api.query("CREATE INDEX ON :person(age1)"); |
84 | | - Assert.assertFalse(failCreateIndexResult.hasNext()); |
85 | | - Assert.assertNull(failCreateIndexResult.getStatistics().getStringValue(Label.INDICES_ADDED)); |
86 | | - Assert.assertEquals(0, failCreateIndexResult.getStatistics().indicesAdded()); |
| 142 | + Assert.assertNotNull(api.query("CREATE (:person{name:'roi',age:32})")); |
| 143 | + |
| 144 | + ResultSet createIndexResult = api.query("CREATE INDEX ON :person(age)"); |
| 145 | + Assert.assertFalse(createIndexResult.hasNext()); |
| 146 | + Assert.assertEquals(1, createIndexResult.getStatistics().indicesAdded()); |
| 147 | + |
| 148 | + ResultSet failCreateIndexResult = api.query("CREATE INDEX ON :person(age1)"); |
| 149 | + Assert.assertFalse(failCreateIndexResult.hasNext()); |
| 150 | + Assert.assertNull(failCreateIndexResult.getStatistics().getStringValue(Label.INDICES_ADDED)); |
| 151 | + Assert.assertEquals(0, failCreateIndexResult.getStatistics().indicesAdded()); |
87 | 152 | } |
88 | 153 |
|
| 154 | + @Test |
| 155 | + public void testHeader(){ |
| 156 | + |
| 157 | + Assert.assertNotNull(api.query("CREATE (:person{name:'roi',age:32})")); |
| 158 | + Assert.assertNotNull(api.query("CREATE (:person{name:'amit',age:30})")); |
| 159 | + Assert.assertNotNull(api.query("MATCH (a:person), (b:person) WHERE (a.name = 'roi' AND b.name='amit') CREATE (a)-[:knows]->(a)")); |
| 160 | + |
| 161 | + ResultSet queryResult = api.query("MATCH (a:person)-[r:knows]->(b:person) RETURN a,r, a.age"); |
| 162 | + |
| 163 | + Assert.assertNotNull(queryResult.getHeader()); |
| 164 | + Header header = queryResult.getHeader(); |
| 165 | + |
| 166 | + List<String> schemaNames = header.getSchemaNames(); |
| 167 | + List<Header.ResultSetColumnTypes> schemaTypes = header.getSchemaTypes(); |
| 168 | + |
| 169 | + Assert.assertNotNull(schemaNames); |
| 170 | + Assert.assertNotNull(schemaTypes); |
| 171 | + |
| 172 | + Assert.assertEquals(3, schemaNames.size()); |
| 173 | + Assert.assertEquals(3, schemaTypes.size()); |
| 174 | + |
| 175 | + Assert.assertEquals("a", schemaNames.get(0)); |
| 176 | + Assert.assertEquals("r", schemaNames.get(1)); |
| 177 | + Assert.assertEquals("a.age", schemaNames.get(2)); |
| 178 | + |
| 179 | + Assert.assertEquals(COLUMN_NODE, schemaTypes.get(0)); |
| 180 | + Assert.assertEquals(COLUMN_RELATION, schemaTypes.get(1)); |
| 181 | + Assert.assertEquals(COLUMN_SCALAR, schemaTypes.get(2)); |
| 182 | + |
| 183 | + } |
89 | 184 |
|
90 | 185 | @Test |
91 | | - public void testQuery(){ |
92 | | - |
93 | | - // Create both source and destination nodes |
94 | | - Assert.assertNotNull(api.query("CREATE (:qhuman{name:%s,age:%d})","roi", 32)); |
95 | | - Assert.assertNotNull(api.query("CREATE (:qhuman{name:'amit',age:30})")); |
96 | | - |
97 | | - // Connect source and destination nodes. |
98 | | - Assert.assertNotNull(api.query("MATCH (a:qhuman), (b:qhuman) WHERE (a.name = 'roi' AND b.name='amit') CREATE (a)-[:knows]->(b)")); |
99 | | - |
100 | | - // Query |
101 | | - ResultSet resultSet = api.query("MATCH (a:qhuman)-[:knows]->(:qhuman) RETURN a"); |
102 | | - |
103 | | - Assert.assertEquals(Arrays.asList("a.age", "a.name"), resultSet.getHeader()); |
104 | | - Assert.assertEquals("[a.age, a.name]\n[[32, roi]]\n" + resultSet.getStatistics(), resultSet.toString()); |
105 | | - |
106 | | - Assert.assertTrue(resultSet.hasNext()); |
107 | | - Assert.assertEquals(0, resultSet.getStatistics().nodesCreated()); |
108 | | - Assert.assertEquals(0, resultSet.getStatistics().nodesDeleted()); |
109 | | - Assert.assertEquals(0, resultSet.getStatistics().labelsAdded()); |
110 | | - Assert.assertEquals(0, resultSet.getStatistics().propertiesSet()); |
111 | | - Assert.assertEquals(0, resultSet.getStatistics().relationshipsCreated()); |
112 | | - Assert.assertEquals(0, resultSet.getStatistics().relationshipsDeleted()); |
113 | | - Assert.assertNotNull(resultSet.getStatistics().getStringValue(Label.QUERY_INTERNAL_EXECUTION_TIME)); |
114 | | - |
115 | | - Record record = resultSet.next(); |
116 | | - Assert.assertEquals( Arrays.asList("a.age", "a.name"), record.keys()); |
117 | | - Assert.assertEquals( Arrays.asList(32L, "roi"), record.values()); |
118 | | - Assert.assertTrue(record.containsKey("a.name")); |
119 | | - Assert.assertEquals( 2, record.size()); |
120 | | - Assert.assertEquals( "[32, roi]", record.toString()); |
121 | | - |
122 | | - Assert.assertEquals( "roi", record.getString(1)); |
123 | | - Assert.assertEquals( "32", record.getString(0)); |
124 | | - Assert.assertEquals( 32L, ((Long)record.getValue(0)).longValue()); |
125 | | - Assert.assertEquals( 32L, ((Long)record.getValue("a.age")).longValue()); |
| 186 | + public void testRecord(){ |
| 187 | + String name = "roi"; |
| 188 | + int age = 32; |
| 189 | + double doubleValue = 3.14; |
| 190 | + boolean boolValue = true; |
| 191 | + |
| 192 | + String place = "TLV"; |
| 193 | + int since = 2000; |
| 194 | + |
| 195 | + |
| 196 | + |
| 197 | + Property nameProperty = new Property("name", ResultSet.ResultSetScalarTypes.PROPERTY_STRING, name); |
| 198 | + Property ageProperty = new Property("age", ResultSet.ResultSetScalarTypes.PROPERTY_INTEGER, age); |
| 199 | + Property doubleProperty = new Property("doubleValue", ResultSet.ResultSetScalarTypes.PROPERTY_DOUBLE, doubleValue); |
| 200 | + Property trueBooleanProperty = new Property("boolValue", ResultSet.ResultSetScalarTypes.PROPERTY_BOOLEAN, true); |
| 201 | + Property falseBooleanProperty = new Property("boolValue", ResultSet.ResultSetScalarTypes.PROPERTY_BOOLEAN, false); |
| 202 | + Property nullProperty = new Property("nullValue", ResultSet.ResultSetScalarTypes.PROPERTY_NULL, null); |
| 203 | + |
| 204 | + Property placeProperty = new Property("place", ResultSet.ResultSetScalarTypes.PROPERTY_STRING, place); |
| 205 | + Property sinceProperty = new Property("since", ResultSet.ResultSetScalarTypes.PROPERTY_INTEGER, since); |
| 206 | + |
| 207 | + Node expectedNode = new Node(); |
| 208 | + expectedNode.setId(0); |
| 209 | + expectedNode.addLabel("person"); |
| 210 | + expectedNode.addProperty(nameProperty); |
| 211 | + expectedNode.addProperty(ageProperty); |
| 212 | + expectedNode.addProperty(doubleProperty); |
| 213 | + expectedNode.addProperty(trueBooleanProperty); |
| 214 | + expectedNode.addProperty(nullProperty); |
| 215 | + |
| 216 | + Edge expectedEdge = new Edge(); |
| 217 | + expectedEdge.setId(0); |
| 218 | + expectedEdge.setSource(0); |
| 219 | + expectedEdge.setDestination(1); |
| 220 | + expectedEdge.setRelationshipType("knows"); |
| 221 | + expectedEdge.addProperty(placeProperty); |
| 222 | + expectedEdge.addProperty(sinceProperty); |
| 223 | + expectedEdge.addProperty(doubleProperty); |
| 224 | + expectedEdge.addProperty(falseBooleanProperty); |
| 225 | + expectedEdge.addProperty(nullProperty); |
| 226 | + |
| 227 | + |
| 228 | + |
| 229 | + Assert.assertNotNull(api.query("CREATE (:person{name:%s',age:%d, doubleValue:%f, boolValue:%b, nullValue:null})", name, age, doubleValue, boolValue)); |
| 230 | + Assert.assertNotNull(api.query("CREATE (:person{name:'amit',age:30})")); |
| 231 | + Assert.assertNotNull(api.query("MATCH (a:person), (b:person) WHERE (a.name = 'roi' AND b.name='amit') " + |
| 232 | + "CREATE (a)-[:knows{place:'TLV', since:2000,doubleValue:3.14, boolValue:false, nullValue:null}]->(b)")); |
| 233 | + |
| 234 | + ResultSet resultSet = api.query("MATCH (a:person)-[r:knows]->(b:person) RETURN a,r, " + |
| 235 | + "a.name, a.age, a.doubleValue, a.boolValue, a.nullValue, " + |
| 236 | + "r.place, r.since, r.doubleValue, r.boolValue, r.nullValue"); |
| 237 | + Assert.assertNotNull(resultSet); |
| 238 | + |
| 239 | + |
| 240 | + Assert.assertEquals(0, resultSet.getStatistics().nodesCreated()); |
| 241 | + Assert.assertEquals(0, resultSet.getStatistics().nodesDeleted()); |
| 242 | + Assert.assertEquals(0, resultSet.getStatistics().labelsAdded()); |
| 243 | + Assert.assertEquals(0, resultSet.getStatistics().propertiesSet()); |
| 244 | + Assert.assertEquals(0, resultSet.getStatistics().relationshipsCreated()); |
| 245 | + Assert.assertEquals(0, resultSet.getStatistics().relationshipsDeleted()); |
| 246 | + Assert.assertNotNull(resultSet.getStatistics().getStringValue(Label.QUERY_INTERNAL_EXECUTION_TIME)); |
| 247 | + |
| 248 | + |
| 249 | + Assert.assertEquals(1, resultSet.size()); |
| 250 | + Assert.assertTrue(resultSet.hasNext()); |
| 251 | + Record record = resultSet.next(); |
| 252 | + Assert.assertFalse(resultSet.hasNext()); |
| 253 | + |
| 254 | + Node node = record.getValue(0); |
| 255 | + Assert.assertNotNull(node); |
| 256 | + |
| 257 | + Assert.assertEquals(expectedNode, node); |
| 258 | + |
| 259 | + node = record.getValue("a"); |
| 260 | + Assert.assertEquals(expectedNode, node); |
| 261 | + |
| 262 | + Edge edge = record.getValue(1); |
| 263 | + Assert.assertNotNull(edge); |
| 264 | + Assert.assertEquals(expectedEdge, edge); |
| 265 | + |
| 266 | + edge = record.getValue("r"); |
| 267 | + Assert.assertEquals(expectedEdge, edge); |
| 268 | + |
| 269 | + Assert.assertEquals(Arrays.asList("a", "r", "a.name", "a.age", "a.doubleValue", "a.boolValue", "a.nullValue", |
| 270 | + "r.place", "r.since", "r.doubleValue", "r.boolValue", "r.nullValue"), record.keys()); |
| 271 | + |
| 272 | + Assert.assertEquals(Arrays.asList(expectedNode, expectedEdge, |
| 273 | + name, age, doubleValue, true, null, |
| 274 | + place, since, doubleValue, false, null), |
| 275 | + record.values()); |
| 276 | + |
| 277 | + |
| 278 | + Assert.assertEquals( "roi", record.getString(2)); |
| 279 | + Assert.assertEquals( "32", record.getString(3)); |
| 280 | + Assert.assertEquals( 32L, ((Integer)(record.getValue(3))).longValue()); |
| 281 | + Assert.assertEquals( 32L, ((Integer)record.getValue("a.age")).longValue()); |
126 | 282 | Assert.assertEquals( "roi", record.getString("a.name")); |
127 | | - Assert.assertEquals( "32", record.getString("a.age")); |
| 283 | + Assert.assertEquals( "32", record.getString("a.age")); |
| 284 | + |
128 | 285 | } |
129 | | - |
| 286 | + |
| 287 | + |
| 288 | + |
130 | 289 | @Test |
131 | | - public void testEscapedQuery(){ |
132 | | - Assert.assertNotNull(api.query("CREATE (:escaped{s1:%s,s2:%s})","S\"\'", "S\\'\\\"")); |
| 290 | + public void testEscapedQuery() { |
| 291 | + Assert.assertNotNull(api.query("CREATE (:escaped{s1:%s,s2:%s})", "S\"\'", "S\\'\\\"")); |
133 | 292 | Assert.assertNotNull(api.query("MATCH (n) where n.s1=%s and n.s2=%s RETURN n", "S\"\'", "S\\'\\\"")); |
134 | 293 | Assert.assertNotNull(api.query("MATCH (n) where n.s1='S\"\\'' RETURN n")); |
135 | 294 | } |
|
0 commit comments