Upgraded minimum requirement for Neo4j
This commit upgrades the minimum requiremnt for Neo4J to be in alignment with the rest of the Spring IO platform. Because of this, the Neo4J4 module has been removed since the main line is now at the current level.
This commit is contained in:
49
build.gradle
49
build.gradle
@@ -39,6 +39,7 @@ allprojects {
|
||||
maven { url 'https://repo.spring.io/plugins-release' }
|
||||
maven { url "https://repo.spring.io/libs-snapshot" }
|
||||
|
||||
maven { url 'https://m2.neo4j.org/content/repositories/snapshots' }
|
||||
maven { url 'https://m2.neo4j.org/content/repositories/releases'}
|
||||
mavenCentral()
|
||||
}
|
||||
@@ -55,8 +56,7 @@ allprojects {
|
||||
springDataGemfireVersion = '2.0.0.BUILD-SNAPSHOT'
|
||||
springDataJpaVersion = '2.0.0.BUILD-SNAPSHOT'
|
||||
springDataMongodbVersion = '2.0.0.BUILD-SNAPSHOT'
|
||||
springDataNeo4jVersion = '3.4.5.RELEASE'
|
||||
springDataNeo4j4Version = '5.0.0.BUILD-SNAPSHOT' //?
|
||||
springDataNeo4jVersion = '5.0.0.BUILD-SNAPSHOT'
|
||||
springIntegrationVersion = '5.0.0.BUILD-SNAPSHOT'
|
||||
springLdapVersion = '2.0.4.RELEASE'
|
||||
|
||||
@@ -84,7 +84,7 @@ allprojects {
|
||||
javaxTransactionVersion = '1.2'
|
||||
jbatchTckSpi = '1.0'
|
||||
jettisonVersion = '1.2'
|
||||
jmsVersion = '1.1-rev-1'
|
||||
jmsVersion = '2.0.1'
|
||||
jtdsVersion = '1.3.1' //?
|
||||
junitVersion = '4.12'
|
||||
log4jVersion = '1.2.17'
|
||||
@@ -333,7 +333,7 @@ project('spring-batch-infrastructure') {
|
||||
|
||||
testRuntime "org.beanshell:bsh:$beanshellVersion"
|
||||
|
||||
optional "javax.jms:jms-api:$jmsVersion"
|
||||
optional "javax.jms:javax.jms-api:$jmsVersion"
|
||||
optional "org.slf4j:slf4j-log4j12:$slf4jVersion"
|
||||
optional "org.codehaus.jackson:jackson-mapper-asl:$jacksonVersion"
|
||||
compile("org.hibernate:hibernate-core:$hibernateVersion") { dep ->
|
||||
@@ -392,43 +392,6 @@ project('spring-batch-infrastructure') {
|
||||
}
|
||||
}
|
||||
|
||||
project('spring-batch-infrastructure-neo4j4') {
|
||||
|
||||
merge.into = project(':spring-batch-infrastructure')
|
||||
|
||||
dependencies {
|
||||
optional ("org.springframework.data:spring-data-neo4j:$springDataNeo4j4Version") {
|
||||
exclude group: 'org.springframework', module: 'spring-core'
|
||||
exclude group: 'org.springframework', module: 'spring-aspects'
|
||||
exclude group: 'org.springframework', module: 'spring-web'
|
||||
exclude group: 'org.springframework', module: 'spring-context'
|
||||
exclude group: 'org.springframework', module: 'spring-tx'
|
||||
exclude group: 'org.springframework', module: 'spring-beans'
|
||||
exclude group: 'org.springframework', module: 'spring-aop'
|
||||
exclude group: 'org.springframework', module: 'spring-expression'
|
||||
}
|
||||
optional "org.springframework:spring-core:$springVersion"
|
||||
optional "org.springframework:spring-context:$springVersion"
|
||||
optional "org.springframework:spring-aspects:$springVersion"
|
||||
optional "org.springframework:spring-web:$springVersion"
|
||||
optional "org.springframework:spring-tx:$springVersion"
|
||||
optional "org.springframework:spring-beans:$springVersion"
|
||||
optional "org.springframework:spring-aop:$springVersion"
|
||||
optional "org.springframework:spring-expression:$springVersion"
|
||||
testCompile "org.mockito:mockito-core:$mockitoVersion"
|
||||
testCompile "junit:junit:${junitVersion}"
|
||||
}
|
||||
|
||||
if (project.hasProperty('platformVersion')) {
|
||||
def dataNeo4jVersion = dependencyManagement.springIoTestRuntime.managedVersions['org.springframework.data:spring-data-neo4j']
|
||||
if (dataNeo4jVersion?.startsWith('3.')) {
|
||||
tasks.withType(Test).matching { it.name =~ "springIoJdk.Test" }.all {
|
||||
enabled false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
project('spring-batch-core-tests') {
|
||||
description = 'Spring Batch Core Tests'
|
||||
project.tasks.findByPath("artifactoryPublish")?.enabled = false
|
||||
@@ -470,7 +433,7 @@ project('spring-batch-infrastructure-tests') {
|
||||
project.tasks.findByPath("artifactoryPublish")?.enabled = false
|
||||
dependencies {
|
||||
compile project(":spring-batch-infrastructure")
|
||||
compile "javax.jms:jms-api:1.1-rev-1"
|
||||
compile "javax.jms:javax.jms-api:$jmsVersion"
|
||||
compile "commons-dbcp:commons-dbcp:$commonsDdbcpVersion"
|
||||
compile "org.springframework:spring-tx:$springVersion"
|
||||
compile "org.springframework:spring-aop:$springVersion"
|
||||
@@ -580,7 +543,7 @@ project('spring-batch-integration') {
|
||||
}
|
||||
testCompile "org.springframework.integration:spring-integration-jdbc:$springIntegrationVersion"
|
||||
|
||||
optional "javax.jms:jms-api:$jmsVersion"
|
||||
optional "javax.jms:javax.jms-api:$jmsVersion"
|
||||
optional "org.slf4j:slf4j-log4j12:$slf4jVersion"
|
||||
optional "log4j:log4j:$log4jVersion"
|
||||
optional "org.springframework.integration:spring-integration-jms:$springIntegrationVersion"
|
||||
|
||||
@@ -3,7 +3,6 @@ rootProject.name = 'spring-batch'
|
||||
include 'spring-batch-core'
|
||||
include 'spring-batch-core-tests'
|
||||
include 'spring-batch-infrastructure'
|
||||
include 'spring-batch-infrastructure-neo4j4'
|
||||
include 'spring-batch-infrastructure-tests'
|
||||
include 'spring-batch-test'
|
||||
include 'spring-batch-integration'
|
||||
|
||||
@@ -1,47 +0,0 @@
|
||||
/*
|
||||
* Copyright 2016 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
|
||||
package org.springframework.batch.item.data;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Extensions of the {@link AbstractNeo4jItemReader} intended for use with versions of
|
||||
* Spring Data Neo4J > 4. Conversions of the results are done using logic based on the
|
||||
* target type.
|
||||
* </p>
|
||||
*
|
||||
* @author Michael Minella
|
||||
* @author Vince Bickers
|
||||
* @since 3.0.7
|
||||
*/
|
||||
public class Neo4j4ItemReader<T> extends AbstractNeo4jItemReader {
|
||||
|
||||
@Override
|
||||
protected Iterator<T> doPageRead() {
|
||||
Iterable queryResults = getTemplate().queryForObjects(
|
||||
getTargetType(), generateLimitCypherQuery(), getParameterValues());
|
||||
|
||||
if(queryResults != null) {
|
||||
return queryResults.iterator();
|
||||
}
|
||||
else {
|
||||
return new ArrayList<T>().iterator();
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -1,175 +0,0 @@
|
||||
/*
|
||||
* Copyright 2013-2014 the original author or authors.
|
||||
*
|
||||
* Licensed under the Apache License, Version 2.0 (the "License");
|
||||
* you may not use this file except in compliance with the License.
|
||||
* You may obtain a copy of the License at
|
||||
*
|
||||
* http://www.apache.org/licenses/LICENSE-2.0
|
||||
*
|
||||
* Unless required by applicable law or agreed to in writing, software
|
||||
* distributed under the License is distributed on an "AS IS" BASIS,
|
||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
* See the License for the specific language governing permissions and
|
||||
* limitations under the License.
|
||||
*/
|
||||
package org.springframework.batch.item.data;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.mockito.ArgumentCaptor;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.MockitoAnnotations;
|
||||
|
||||
import org.springframework.data.neo4j.template.Neo4jOperations;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.fail;
|
||||
import static org.mockito.Matchers.eq;
|
||||
import static org.mockito.Matchers.isNull;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
public class Neo4j4ItemReaderTests {
|
||||
|
||||
private Neo4j4ItemReader<String> reader;
|
||||
@Mock
|
||||
private Neo4jOperations template;
|
||||
@Mock
|
||||
private Iterable<String> result;
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
reader = new Neo4j4ItemReader<String>();
|
||||
|
||||
MockitoAnnotations.initMocks(this);
|
||||
|
||||
reader.setTemplate(template);
|
||||
reader.setTargetType(String.class);
|
||||
reader.setStartStatement("n=node(*)");
|
||||
reader.setReturnStatement("*");
|
||||
reader.setOrderByStatement("n.age");
|
||||
reader.setPageSize(50);
|
||||
reader.afterPropertiesSet();
|
||||
}
|
||||
|
||||
@Test
|
||||
public void testAfterPropertiesSet() throws Exception {
|
||||
reader = new Neo4j4ItemReader<String>();
|
||||
|
||||
try {
|
||||
reader.afterPropertiesSet();
|
||||
fail("Template was not set but exception was not thrown.");
|
||||
} catch (IllegalStateException iae) {
|
||||
assertEquals("A Neo4JOperations implementation is required", iae.getMessage());
|
||||
} catch (Throwable t) {
|
||||
fail("Wrong exception was thrown:" + t);
|
||||
}
|
||||
|
||||
reader.setTemplate(template);
|
||||
|
||||
try {
|
||||
reader.afterPropertiesSet();
|
||||
fail("type was not set but exception was not thrown.");
|
||||
} catch (IllegalStateException iae) {
|
||||
assertEquals("The type to be returned is required", iae.getMessage());
|
||||
} catch (Throwable t) {
|
||||
fail("Wrong exception was thrown:" + t);
|
||||
}
|
||||
|
||||
reader.setTargetType(String.class);
|
||||
|
||||
try {
|
||||
reader.afterPropertiesSet();
|
||||
fail("START was not set but exception was not thrown.");
|
||||
} catch (IllegalStateException iae) {
|
||||
assertEquals("A START statement is required", iae.getMessage());
|
||||
} catch (Throwable t) {
|
||||
fail("Wrong exception was thrown:" + t);
|
||||
}
|
||||
|
||||
reader.setStartStatement("n=node(*)");
|
||||
|
||||
try {
|
||||
reader.afterPropertiesSet();
|
||||
fail("RETURN was not set but exception was not thrown.");
|
||||
} catch (IllegalStateException iae) {
|
||||
assertEquals("A RETURN statement is required", iae.getMessage());
|
||||
} catch (Throwable t) {
|
||||
fail("Wrong exception was thrown:" + t);
|
||||
}
|
||||
|
||||
reader.setReturnStatement("n.name, n.phone");
|
||||
|
||||
try {
|
||||
reader.afterPropertiesSet();
|
||||
fail("ORDER BY was not set but exception was not thrown.");
|
||||
} catch (IllegalStateException iae) {
|
||||
assertEquals("A ORDER BY statement is required", iae.getMessage());
|
||||
} catch (Throwable t) {
|
||||
fail("Wrong exception was thrown:" + t);
|
||||
}
|
||||
|
||||
reader.setOrderByStatement("n.age");
|
||||
|
||||
reader.afterPropertiesSet();
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Test
|
||||
public void testNullResults() {
|
||||
ArgumentCaptor<String> query = ArgumentCaptor.forClass(String.class);
|
||||
|
||||
when(template.queryForObjects(eq(String.class), query.capture(), (Map<String, Object>) isNull())).thenReturn(null);
|
||||
|
||||
assertFalse(reader.doPageRead().hasNext());
|
||||
assertEquals("START n=node(*) RETURN * ORDER BY n.age SKIP 0 LIMIT 50", query.getValue());
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Test
|
||||
public void testNoResults() {
|
||||
ArgumentCaptor<String> query = ArgumentCaptor.forClass(String.class);
|
||||
|
||||
when(template.queryForObjects(eq(String.class), query.capture(), (Map<String, Object>) isNull())).thenReturn(result);
|
||||
when(result.iterator()).thenReturn(Collections.<String>emptyIterator());
|
||||
|
||||
assertFalse(reader.doPageRead().hasNext());
|
||||
assertEquals("START n=node(*) RETURN * ORDER BY n.age SKIP 0 LIMIT 50", query.getValue());
|
||||
}
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
@Test
|
||||
public void testResultsWithMatchAndWhere() throws Exception {
|
||||
reader.setMatchStatement("n -- m");
|
||||
reader.setWhereStatement("has(n.name)");
|
||||
reader.setReturnStatement("m");
|
||||
reader.afterPropertiesSet();
|
||||
when(template.queryForObjects(String.class, "START n=node(*) MATCH n -- m WHERE has(n.name) RETURN m ORDER BY n.age SKIP 0 LIMIT 50", null)).thenReturn(result);
|
||||
when(result.iterator()).thenReturn(Arrays.asList("foo", "bar", "baz").iterator());
|
||||
|
||||
assertTrue(reader.doPageRead().hasNext());
|
||||
}
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
@Test
|
||||
public void testResultsWithMatchAndWhereWithParameters() throws Exception {
|
||||
Map<String, Object> params = new HashMap<String, Object>();
|
||||
params.put("foo", "bar");
|
||||
reader.setParameterValues(params);
|
||||
reader.setMatchStatement("n -- m");
|
||||
reader.setWhereStatement("has(n.name)");
|
||||
reader.setReturnStatement("m");
|
||||
reader.afterPropertiesSet();
|
||||
when(template.queryForObjects(String.class, "START n=node(*) MATCH n -- m WHERE has(n.name) RETURN m ORDER BY n.age SKIP 0 LIMIT 50", params)).thenReturn(result);
|
||||
when(result.iterator()).thenReturn(Arrays.asList("foo", "bar", "baz").iterator());
|
||||
|
||||
assertTrue(reader.doPageRead().hasNext());
|
||||
}
|
||||
}
|
||||
@@ -18,58 +18,25 @@ package org.springframework.batch.item.data;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
|
||||
import org.apache.commons.logging.Log;
|
||||
import org.apache.commons.logging.LogFactory;
|
||||
|
||||
import org.springframework.data.neo4j.conversion.DefaultConverter;
|
||||
import org.springframework.data.neo4j.conversion.Result;
|
||||
import org.springframework.data.neo4j.conversion.ResultConverter;
|
||||
import org.springframework.util.ClassUtils;
|
||||
//
|
||||
//import org.springframework.data.neo4j.conversion.ResultConverter;
|
||||
|
||||
/**
|
||||
* <p>
|
||||
* Extensions of the {@link AbstractNeo4jItemReader} intended for use with versions of
|
||||
* Spring Data Neo4J < 4. Conversions of the results are done using an external
|
||||
* {@link ResultConverter}.
|
||||
* Extensions of the {@link AbstractNeo4jItemReader}.
|
||||
* </p>
|
||||
*
|
||||
* @author Michael Minella
|
||||
* @see org.springframework.batch.item.data.Neo4j4ItemReader
|
||||
*/
|
||||
public class Neo4jItemReader<T> extends AbstractNeo4jItemReader {
|
||||
|
||||
protected Log logger = LogFactory.getLog(getClass());
|
||||
|
||||
private ResultConverter<Map<String, Object>, T> resultConverter;
|
||||
|
||||
public Neo4jItemReader() {
|
||||
setName(ClassUtils.getShortName(Neo4jItemReader.class));
|
||||
}
|
||||
|
||||
/**
|
||||
* Set the converter used to convert node to the targetType. By
|
||||
* default, {@link DefaultConverter} is used.
|
||||
*
|
||||
* @param resultConverter the converter to use.
|
||||
*/
|
||||
public void setResultConverter(ResultConverter<Map<String, Object>, T> resultConverter) {
|
||||
this.resultConverter = resultConverter;
|
||||
}
|
||||
|
||||
@Override
|
||||
protected Iterator<T> doPageRead() {
|
||||
Result<Map<String, Object>> queryResults = getTemplate().query(
|
||||
generateLimitCypherQuery(), getParameterValues());
|
||||
Iterable queryResults = getTemplate().queryForObjects(
|
||||
getTargetType(), generateLimitCypherQuery(), getParameterValues());
|
||||
|
||||
if(queryResults != null) {
|
||||
if (resultConverter != null) {
|
||||
return queryResults.to(getTargetType(), resultConverter).iterator();
|
||||
}
|
||||
else {
|
||||
return queryResults.to(getTargetType()).iterator();
|
||||
}
|
||||
return queryResults.iterator();
|
||||
}
|
||||
else {
|
||||
return new ArrayList<T>().iterator();
|
||||
|
||||
@@ -15,14 +15,8 @@
|
||||
*/
|
||||
package org.springframework.batch.item.data;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.fail;
|
||||
import static org.mockito.Matchers.isNull;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Arrays;
|
||||
import java.util.Collections;
|
||||
import java.util.HashMap;
|
||||
import java.util.Map;
|
||||
|
||||
@@ -32,20 +26,23 @@ import org.mockito.ArgumentCaptor;
|
||||
import org.mockito.Mock;
|
||||
import org.mockito.MockitoAnnotations;
|
||||
|
||||
import org.springframework.data.neo4j.conversion.DefaultConverter;
|
||||
import org.springframework.data.neo4j.conversion.Result;
|
||||
import org.springframework.data.neo4j.conversion.ResultConverter;
|
||||
import org.springframework.data.neo4j.template.Neo4jOperations;
|
||||
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertFalse;
|
||||
import static org.junit.Assert.assertTrue;
|
||||
import static org.junit.Assert.fail;
|
||||
import static org.mockito.Matchers.eq;
|
||||
import static org.mockito.Matchers.isNull;
|
||||
import static org.mockito.Mockito.when;
|
||||
|
||||
public class Neo4jItemReaderTests {
|
||||
|
||||
private Neo4jItemReader<String> reader;
|
||||
@Mock
|
||||
private Neo4jOperations template;
|
||||
@Mock
|
||||
private Result<Map<String, Object>> result;
|
||||
@Mock
|
||||
private Result<String> endResult;
|
||||
private Iterable<String> result;
|
||||
|
||||
@Before
|
||||
public void setUp() throws Exception {
|
||||
@@ -64,7 +61,7 @@ public class Neo4jItemReaderTests {
|
||||
|
||||
@Test
|
||||
public void testAfterPropertiesSet() throws Exception {
|
||||
reader = new Neo4jItemReader<String>();
|
||||
reader = new Neo4jItemReader<>();
|
||||
|
||||
try {
|
||||
reader.afterPropertiesSet();
|
||||
@@ -129,7 +126,7 @@ public class Neo4jItemReaderTests {
|
||||
public void testNullResults() {
|
||||
ArgumentCaptor<String> query = ArgumentCaptor.forClass(String.class);
|
||||
|
||||
when(template.query(query.capture(), (Map<String, Object>) isNull())).thenReturn(null);
|
||||
when(template.queryForObjects(eq(String.class), query.capture(), (Map<String, Object>) isNull())).thenReturn(null);
|
||||
|
||||
assertFalse(reader.doPageRead().hasNext());
|
||||
assertEquals("START n=node(*) RETURN * ORDER BY n.age SKIP 0 LIMIT 50", query.getValue());
|
||||
@@ -140,32 +137,13 @@ public class Neo4jItemReaderTests {
|
||||
public void testNoResults() {
|
||||
ArgumentCaptor<String> query = ArgumentCaptor.forClass(String.class);
|
||||
|
||||
when(template.query(query.capture(), (Map<String, Object>) isNull())).thenReturn(result);
|
||||
when(result.to(String.class)).thenReturn(endResult);
|
||||
when(endResult.iterator()).thenReturn(new ArrayList<String>().iterator());
|
||||
when(template.queryForObjects(eq(String.class), query.capture(), (Map<String, Object>) isNull())).thenReturn(result);
|
||||
when(result.iterator()).thenReturn(Collections.<String>emptyIterator());
|
||||
|
||||
assertFalse(reader.doPageRead().hasNext());
|
||||
assertEquals("START n=node(*) RETURN * ORDER BY n.age SKIP 0 LIMIT 50", query.getValue());
|
||||
}
|
||||
|
||||
@SuppressWarnings({ "unchecked", "serial" })
|
||||
@Test
|
||||
public void testResultsWithConverter() {
|
||||
ResultConverter<Map<String, Object>, String> converter = new DefaultConverter<Map<String, Object>, String>();
|
||||
|
||||
reader.setResultConverter(converter);
|
||||
ArgumentCaptor<String> query = ArgumentCaptor.forClass(String.class);
|
||||
|
||||
when(template.query(query.capture(), (Map<String, Object>) isNull())).thenReturn(result);
|
||||
when(result.to(String.class, converter)).thenReturn(endResult);
|
||||
when(endResult.iterator()).thenReturn(new ArrayList<String>(){{
|
||||
add(new String());
|
||||
}}.iterator());
|
||||
|
||||
assertTrue(reader.doPageRead().hasNext());
|
||||
assertEquals("START n=node(*) RETURN * ORDER BY n.age SKIP 0 LIMIT 50", query.getValue());
|
||||
}
|
||||
|
||||
@SuppressWarnings("serial")
|
||||
@Test
|
||||
public void testResultsWithMatchAndWhere() throws Exception {
|
||||
@@ -173,11 +151,8 @@ public class Neo4jItemReaderTests {
|
||||
reader.setWhereStatement("has(n.name)");
|
||||
reader.setReturnStatement("m");
|
||||
reader.afterPropertiesSet();
|
||||
when(template.query("START n=node(*) MATCH n -- m WHERE has(n.name) RETURN m ORDER BY n.age SKIP 0 LIMIT 50", null)).thenReturn(result);
|
||||
when(result.to(String.class)).thenReturn(endResult);
|
||||
when(endResult.iterator()).thenReturn(new ArrayList<String>() {{
|
||||
add(new String());
|
||||
}}.iterator());
|
||||
when(template.queryForObjects(String.class, "START n=node(*) MATCH n -- m WHERE has(n.name) RETURN m ORDER BY n.age SKIP 0 LIMIT 50", null)).thenReturn(result);
|
||||
when(result.iterator()).thenReturn(Arrays.asList("foo", "bar", "baz").iterator());
|
||||
|
||||
assertTrue(reader.doPageRead().hasNext());
|
||||
}
|
||||
@@ -192,11 +167,8 @@ public class Neo4jItemReaderTests {
|
||||
reader.setWhereStatement("has(n.name)");
|
||||
reader.setReturnStatement("m");
|
||||
reader.afterPropertiesSet();
|
||||
when(template.query("START n=node(*) MATCH n -- m WHERE has(n.name) RETURN m ORDER BY n.age SKIP 0 LIMIT 50", params)).thenReturn(result);
|
||||
when(result.to(String.class)).thenReturn(endResult);
|
||||
when(endResult.iterator()).thenReturn(new ArrayList<String>(){{
|
||||
add(new String());
|
||||
}}.iterator());
|
||||
when(template.queryForObjects(String.class, "START n=node(*) MATCH n -- m WHERE has(n.name) RETURN m ORDER BY n.age SKIP 0 LIMIT 50", params)).thenReturn(result);
|
||||
when(result.iterator()).thenReturn(Arrays.asList("foo", "bar", "baz").iterator());
|
||||
|
||||
assertTrue(reader.doPageRead().hasNext());
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user