Merge branch 'master' of github.com:SpringSource/spring-data-neo4j
This commit is contained in:
@@ -6,9 +6,9 @@
|
||||
<exclude module="jmxtools"/>
|
||||
<exclude module="jmxri"/>
|
||||
</dependency>
|
||||
<dependency org="org.aspectj" name="aspectjrt" rev="1.6.11.RELEASE"/>
|
||||
<dependency org="org.aspectj" name="aspectjtools" rev="1.6.11.RELEASE"/>
|
||||
<dependency org="org.neo4j" name="neo4j-community" rev="1.5"/>
|
||||
<dependency org="org.aspectj" name="aspectjrt" rev="1.6.12"/>
|
||||
<dependency org="org.aspectj" name="aspectjtools" rev="1.6.12"/>
|
||||
<dependency org="org.neo4j" name="neo4j-community" rev="1.6.M02"/>
|
||||
<dependency org="junit" name="junit" rev="4.8.1"/>
|
||||
</dependencies>
|
||||
</ivy-module>
|
||||
|
||||
@@ -124,8 +124,8 @@
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.tinkerpop</groupId>
|
||||
<artifactId>gremlin</artifactId>
|
||||
<groupId>com.tinkerpop.gremlin</groupId>
|
||||
<artifactId>gremlin-groovy</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
|
||||
@@ -66,7 +66,7 @@ public class GremlinQueryEngineTest extends EntityTestBase {
|
||||
@Test
|
||||
@Transactional
|
||||
public void testQueryList() throws Exception {
|
||||
final String queryString = "t = new Table(); [g.v(michael),g.v(david)].each{ n -> n.as('person.name').as('person.age').table(t,['person.name','person.age']){ it.age }{ it.name } >> -1}; t;" ;
|
||||
final String queryString = "t = new Table(); [g.v(michael),g.v(david)].each{ n -> n.as('person.name').as('person.age').table(t,['person.name','person.age']){ it.age }{ it.name }.iterate()}; t;" ;
|
||||
final Collection<Object> result = IteratorUtil.asCollection(queryEngine.query(queryString, MapUtil.map("michael", getNodeId(michael), "david", getNodeId(testTeam.david))));
|
||||
|
||||
assertEquals(asList(testTeam.simpleRowFor(michael, "person"), testTeam.simpleRowFor(testTeam.david, "person")), result);
|
||||
|
||||
@@ -127,8 +127,8 @@
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.tinkerpop</groupId>
|
||||
<artifactId>gremlin</artifactId>
|
||||
<groupId>com.tinkerpop.gremlin</groupId>
|
||||
<artifactId>gremlin-groovy</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
|
||||
@@ -52,7 +52,7 @@ public class DataGraphNamespaceHandlerCrossStoreTest {
|
||||
Neo4jTemplate template = config.template;
|
||||
Assert.assertNotNull("template", template);
|
||||
EmbeddedGraphDatabase graphDatabaseService = (EmbeddedGraphDatabase) template.getGraphDatabaseService();
|
||||
Assert.assertEquals("store-dir", "target/config-test", graphDatabaseService.getStoreDir());
|
||||
Assert.assertTrue("store-dir", graphDatabaseService.getStoreDir().endsWith("target/config-test"));
|
||||
Assert.assertNotNull("graphDatabaseService", config.graphDatabaseService);
|
||||
Assert.assertNotNull("transactionManager", config.transactionManager);
|
||||
config.graphDatabaseService.shutdown();
|
||||
|
||||
@@ -55,7 +55,6 @@
|
||||
|
||||
<bean id="graphDatabaseService" class="org.neo4j.test.ImpermanentGraphDatabase"
|
||||
destroy-method="shutdown" scope="singleton">
|
||||
<constructor-arg index="0" value="target/data/recommendation" />
|
||||
</bean>
|
||||
|
||||
<bean id="graphDatabase" class="org.springframework.data.neo4j.support.DelegatingGraphDatabase">
|
||||
|
||||
@@ -11,10 +11,10 @@
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<spring.version>3.0.6.RELEASE</spring.version>
|
||||
<spring.version>3.0.7.RELEASE</spring.version>
|
||||
<slf4j.version>1.6.1</slf4j.version>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<neo4j.version>1.5</neo4j.version>
|
||||
<neo4j.version>1.6.M02</neo4j.version>
|
||||
<spring-data-graph.version>2.0.0.BUILD-SNAPSHOT</spring-data-graph.version>
|
||||
<aspectj.version>1.6.12</aspectj.version>
|
||||
<org.slf4j-version>1.6.1</org.slf4j-version>
|
||||
|
||||
@@ -11,10 +11,10 @@
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<spring.version>3.0.6.RELEASE</spring.version>
|
||||
<spring.version>3.0.7.RELEASE</spring.version>
|
||||
<slf4j.version>1.6.1</slf4j.version>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<neo4j.version>1.5</neo4j.version>
|
||||
<neo4j.version>1.6.M02</neo4j.version>
|
||||
<spring-data-graph.version>2.0.0.BUILD-SNAPSHOT</spring-data-graph.version>
|
||||
<aspectj.version>1.6.12</aspectj.version>
|
||||
<org.slf4j-version>1.6.1</org.slf4j-version>
|
||||
|
||||
@@ -11,13 +11,13 @@
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<spring.version>3.0.6.RELEASE</spring.version>
|
||||
<spring.version>3.0.7.RELEASE</spring.version>
|
||||
<slf4j.version>1.6.1</slf4j.version>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<neo4j.version>1.5</neo4j.version>
|
||||
<spring-data-graph.version>2.0.0.BUILD-SNAPSHOT</spring-data-graph.version>
|
||||
<org.slf4j-version>1.6.1</org.slf4j-version>
|
||||
<aspectj.version>1.6.12</aspectj.version>
|
||||
<neo4j.version>1.6.M02</neo4j.version>
|
||||
</properties>
|
||||
|
||||
<repositories>
|
||||
@@ -295,14 +295,11 @@
|
||||
<junitArtifactName>junit:junit</junitArtifactName>
|
||||
</configuration>
|
||||
</plugin>
|
||||
<!-- the eclipse plugin interacts with the aspectj-maven-plugin
|
||||
BUT ONLY if the ajdtVersion config value is set (remove it and it won't) -->
|
||||
<plugin>
|
||||
<groupId>org.apache.maven.plugins</groupId>
|
||||
<artifactId>maven-eclipse-plugin</artifactId>
|
||||
<version>2.8</version>
|
||||
<configuration>
|
||||
<!-- The ajdtVersion configuration parameter is optional. The valid values are none, 1.4, and 1.5. none indicates that AJDT should not be enabled even though Aspectj is enabled in maven. 1.4 generates the org.eclipse.ajdt.ui.prefs file in the .settings directory. 1.5 (or later) includes the configuration into the .classpath file and is the default value. -->
|
||||
<ajdtVersion>1.5</ajdtVersion>
|
||||
<additionalProjectnatures>
|
||||
<projectnature>org.eclipse.jdt.core.javanature</projectnature>
|
||||
@@ -310,47 +307,6 @@
|
||||
</additionalProjectnatures>
|
||||
</configuration>
|
||||
</plugin>
|
||||
|
||||
<!--plugin>
|
||||
<groupId>org.codehaus.mojo</groupId>
|
||||
<artifactId>aspectj-maven-plugin</artifactId>
|
||||
<version>1.2</version>
|
||||
<dependencies>
|
||||
<dependency>
|
||||
<groupId>org.aspectj</groupId>
|
||||
<artifactId>aspectjrt</artifactId>
|
||||
<version>${aspectj.version}</version>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>org.aspectj</groupId>
|
||||
<artifactId>aspectjtools</artifactId>
|
||||
<version>${aspectj.version}</version>
|
||||
</dependency>
|
||||
</dependencies>
|
||||
<executions>
|
||||
<execution>
|
||||
<goals>
|
||||
<goal>compile</goal>
|
||||
<goal>test-compile</goal>
|
||||
</goals>
|
||||
</execution>
|
||||
</executions>
|
||||
<configuration>
|
||||
<outxml>true</outxml>
|
||||
<aspectLibraries>
|
||||
<aspectLibrary>
|
||||
<groupId>org.springframework</groupId>
|
||||
<artifactId>spring-aspects</artifactId>
|
||||
</aspectLibrary>
|
||||
<aspectLibrary>
|
||||
<groupId>org.springframework.data</groupId>
|
||||
<artifactId>spring-data-neo4j-aspects</artifactId>
|
||||
</aspectLibrary>
|
||||
</aspectLibraries>
|
||||
<source>1.6</source>
|
||||
<target>1.6</target>
|
||||
</configuration>
|
||||
</plugin-->
|
||||
</plugins>
|
||||
</build>
|
||||
|
||||
|
||||
@@ -5,9 +5,9 @@ apply plugin: 'idea'
|
||||
apply plugin: 'eclipse'
|
||||
|
||||
|
||||
springVersion = "3.0.5.RELEASE"
|
||||
springDataNeo4jVersion = "1.1.0.RELEASE"
|
||||
aspectjVersion = "1.6.11.RELEASE"
|
||||
springVersion = "3.0.7.RELEASE"
|
||||
springDataNeo4jVersion = "2.0.0.RELEASE"
|
||||
aspectjVersion = "1.6.12"
|
||||
|
||||
apply from:'https://github.com/SpringSource/spring-data-neo4j/raw/master/build/gradle/springdataneo4j.gradle'
|
||||
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<spring.version>3.0.6.RELEASE</spring.version>
|
||||
<spring.version>3.0.7.RELEASE</spring.version>
|
||||
<aspectj.version>1.6.12</aspectj.version>
|
||||
<slf4j.version>1.6.1</slf4j.version>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
|
||||
@@ -1,14 +1,14 @@
|
||||
<ivy-module version="2.0" xmlns:m="http://ant.apache.org/ivy/maven">
|
||||
<info organisation="org.springframework.data.neo4j.examples" module="hello-worlds"/>
|
||||
<dependencies>
|
||||
<dependency org="org.springframework.data" name="spring-data-neo4j" rev="1.0.0.RELEASE">
|
||||
<dependency org="org.springframework.data" name="spring-data-neo4j" rev="2.0.0.RELEASE">
|
||||
<exclude module="jms"/>
|
||||
<exclude module="jmxtools"/>
|
||||
<exclude module="jmxri"/>
|
||||
</dependency>
|
||||
<dependency org="org.aspectj" name="aspectjrt" rev="1.6.11.RELEASE"/>
|
||||
<dependency org="org.aspectj" name="aspectjtools" rev="1.6.11.RELEASE"/>
|
||||
<dependency org="org.neo4j" name="neo4j-community" rev="1.3"/>
|
||||
<dependency org="org.aspectj" name="aspectjrt" rev="1.6.12"/>
|
||||
<dependency org="org.aspectj" name="aspectjtools" rev="1.6.12"/>
|
||||
<dependency org="org.neo4j" name="neo4j-community" rev="1.6.M02"/>
|
||||
<dependency org="junit" name="junit" rev="4.8.1"/>
|
||||
</dependencies>
|
||||
</ivy-module>
|
||||
|
||||
@@ -5,11 +5,8 @@ apply plugin: 'idea'
|
||||
apply plugin: 'eclipse'
|
||||
|
||||
|
||||
springVersion = "3.0.5.RELEASE"
|
||||
springDataNeo4jVersion = "1.1.0.RELEASE"
|
||||
aspectjVersion = "1.6.11.RELEASE"
|
||||
|
||||
apply from:'https://github.com/SpringSource/spring-data-neo4j/raw/master/build/gradle/springdataneo4j.gradle'
|
||||
springVersion = "3.0.7.RELEASE"
|
||||
springDataNeo4jVersion = "2.0.0.RELEASE"
|
||||
|
||||
configurations {
|
||||
runtime
|
||||
|
||||
@@ -7,8 +7,6 @@
|
||||
<import file="${settings.dir}/install-ivy.xml" />
|
||||
<import file="${settings.dir}/path.xml" />
|
||||
|
||||
<taskdef resource="org/aspectj/tools/ant/taskdefs/aspectjTaskdefs.properties" classpath="${lib.dir}/aspectjtools.jar"/>
|
||||
|
||||
<target name="lib.retrieve" depends="install-ivy">
|
||||
<mkdir dir="${lib.dir}" />
|
||||
<ivy:settings file="${settings.dir}/ivysettings.xml" />
|
||||
@@ -29,14 +27,8 @@
|
||||
<target name="compile" description="Compile production classes" depends="lib.retrieve">
|
||||
<mkdir dir="${main.target}" />
|
||||
|
||||
<iajc sourceroots="${main.src}" destDir="${main.target}" classpathref="path.libs" source="1.6">
|
||||
<aspectpath>
|
||||
<pathelement location="${lib.dir}/spring-aspects.jar"/>
|
||||
</aspectpath>
|
||||
<aspectpath>
|
||||
<pathelement location="${lib.dir}/spring-data-neo4j.jar"/>
|
||||
</aspectpath>
|
||||
</iajc>
|
||||
<javac sourcepath="${main.src}" destDir="${main.target}" classpathref="path.libs" source="1.6">
|
||||
</javac>
|
||||
</target>
|
||||
|
||||
<target name="compile-tests" description="Compile unit test classes" depends="compile">
|
||||
@@ -44,14 +36,8 @@
|
||||
<copy todir="${main.target}" failonerror="false">
|
||||
<fileset dir="${main.resources}"/>
|
||||
</copy>
|
||||
<iajc sourceroots="${test.src}" destDir="${test.target}" classpathref="path.testing" source="1.6">
|
||||
<aspectpath>
|
||||
<pathelement location="${lib.dir}/spring-aspects.jar"/>
|
||||
</aspectpath>
|
||||
<aspectpath>
|
||||
<pathelement location="${lib.dir}/spring-data-neo4j.jar"/>
|
||||
</aspectpath>
|
||||
</iajc>
|
||||
<javac sourcepath="${test.src}" destDir="${test.target}" classpathref="path.testing" source="1.6">
|
||||
</javac>
|
||||
</target>
|
||||
|
||||
<target name="test" depends="clean, compile, compile-tests">
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
|
||||
<properties>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<spring.version>3.0.6.RELEASE</spring.version>
|
||||
<spring.version>3.0.7.RELEASE</spring.version>
|
||||
<aspectj.version>1.6.12</aspectj.version>
|
||||
<slf4j.version>1.6.1</slf4j.version>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
|
||||
@@ -1,14 +1,12 @@
|
||||
<ivy-module version="2.0" xmlns:m="http://ant.apache.org/ivy/maven">
|
||||
<info organisation="org.springframework.data.neo4j.examples" module="hello-worlds"/>
|
||||
<dependencies>
|
||||
<dependency org="org.springframework.data" name="spring-data-neo4j" rev="1.0.0.RELEASE">
|
||||
<dependency org="org.springframework.data" name="spring-data-neo4j" rev="2.0.0.RELEASE">
|
||||
<exclude module="jms"/>
|
||||
<exclude module="jmxtools"/>
|
||||
<exclude module="jmxri"/>
|
||||
</dependency>
|
||||
<dependency org="org.aspectj" name="aspectjrt" rev="1.6.11.RELEASE"/>
|
||||
<dependency org="org.aspectj" name="aspectjtools" rev="1.6.11.RELEASE"/>
|
||||
<dependency org="org.neo4j" name="neo4j-community" rev="1.3"/>
|
||||
<dependency org="org.neo4j" name="neo4j-community" rev="1.6.M02"/>
|
||||
<dependency org="junit" name="junit" rev="4.8.1"/>
|
||||
</dependencies>
|
||||
</ivy-module>
|
||||
|
||||
@@ -7,7 +7,7 @@
|
||||
<version>2.0.0-BUILD-SNAPSHOT</version>
|
||||
<name>imdb</name>
|
||||
<properties>
|
||||
<spring.version>3.0.6.RELEASE</spring.version>
|
||||
<spring.version>3.0.7.RELEASE</spring.version>
|
||||
<aspectj.version>1.6.12</aspectj.version>
|
||||
<slf4j.version>1.6.1</slf4j.version>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
|
||||
@@ -7,11 +7,11 @@
|
||||
<version>2.0.0.BUILD-SNAPSHOT</version>
|
||||
<name>myrestaurants-social</name>
|
||||
<properties>
|
||||
<spring.version>3.0.6.RELEASE</spring.version>
|
||||
<spring.version>3.0.7.RELEASE</spring.version>
|
||||
<spring-data-graph.version>2.0.0.BUILD-SNAPSHOT</spring-data-graph.version>
|
||||
<aspectj.version>1.6.12</aspectj.version>
|
||||
<slf4j.version>1.6.1</slf4j.version>
|
||||
<neo4j.version>1.5</neo4j.version>
|
||||
<neo4j.version>1.6.M02</neo4j.version>
|
||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||
<spring-security.version>3.0.6.RELEASE</spring-security.version>
|
||||
</properties>
|
||||
|
||||
@@ -124,12 +124,13 @@
|
||||
<org.mockito.version>1.8.4</org.mockito.version>
|
||||
<org.slf4j.version>1.6.1</org.slf4j.version>
|
||||
<org.springframework.version>3.0.6.RELEASE</org.springframework.version>
|
||||
<data.commons.version>1.2.0.M2</data.commons.version>
|
||||
<neo4j.version>1.5</neo4j.version>
|
||||
<data.commons.version>1.2.0.RC1</data.commons.version>
|
||||
<neo4j.version>1.6.M02</neo4j.version>
|
||||
<neo4j.spatial.version>0.7-SNAPSHOT</neo4j.spatial.version>
|
||||
<aspectj.version>1.6.12</aspectj.version>
|
||||
<blueprints.version>1.0</blueprints.version>
|
||||
<gremlin.version>1.3</gremlin.version>
|
||||
<blueprints.version>1.1</blueprints.version>
|
||||
<gremlin.version>1.4</gremlin.version>
|
||||
<pipes.version>1.4</pipes.version>
|
||||
</properties>
|
||||
<profiles>
|
||||
<profile>
|
||||
@@ -334,6 +335,61 @@
|
||||
</dependency>
|
||||
|
||||
|
||||
<dependency>
|
||||
<groupId>com.tinkerpop.gremlin</groupId>
|
||||
<artifactId>gremlin-groovy</artifactId>
|
||||
<version>${gremlin.version}</version>
|
||||
<type>jar</type>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.neo4j</groupId>
|
||||
<artifactId>neo4j</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.neo4j</groupId>
|
||||
<artifactId>neo4j-ha</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.neo4j</groupId>
|
||||
<artifactId>neo4j-management</artifactId>
|
||||
</exclusion>
|
||||
<!-- Sail support not needed -->
|
||||
<exclusion>
|
||||
<groupId>com.tinkerpop.blueprints</groupId>
|
||||
<artifactId>blueprints-sail-graph</artifactId>
|
||||
</exclusion>
|
||||
<!-- Maven support in groovy not needed -->
|
||||
<exclusion>
|
||||
<groupId>org.codehaus.groovy.maven</groupId>
|
||||
<artifactId>gmaven-plugin</artifactId>
|
||||
</exclusion>
|
||||
<!-- "readline" not needed - we only expose gremlin through webadmin -->
|
||||
<exclusion>
|
||||
<groupId>jline</groupId>
|
||||
<artifactId>jline</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>com.tinkerpop.blueprints</groupId>
|
||||
<artifactId>blueprints-neo4j-graph</artifactId>
|
||||
<version>${blueprints.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.neo4j</groupId>
|
||||
<artifactId>neo4j</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.neo4j</groupId>
|
||||
<artifactId>neo4j-ha</artifactId>
|
||||
</exclusion>
|
||||
<exclusion>
|
||||
<groupId>org.neo4j</groupId>
|
||||
<artifactId>neo4j-management</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.tinkerpop.blueprints</groupId>
|
||||
<artifactId>blueprints-core</artifactId>
|
||||
@@ -348,8 +404,8 @@
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.tinkerpop</groupId>
|
||||
<artifactId>gremlin</artifactId>
|
||||
<groupId>com.tinkerpop.gremlin</groupId>
|
||||
<artifactId>gremlin-groovy</artifactId>
|
||||
<version>${gremlin.version}</version>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
@@ -410,7 +466,7 @@
|
||||
<dependency>
|
||||
<groupId>org.neo4j</groupId>
|
||||
<artifactId>neo4j-cypher-dsl</artifactId>
|
||||
<version>${neo4j.version}</version>
|
||||
<version>1.5</version>
|
||||
<!--optional>true</optional-->
|
||||
</dependency>
|
||||
<!--dependency>
|
||||
@@ -435,6 +491,12 @@
|
||||
<groupId>org.neo4j</groupId>
|
||||
<artifactId>neo4j-spatial</artifactId>
|
||||
<version>${neo4j.spatial.version}</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.neo4j</groupId>
|
||||
<artifactId>neo4j</artifactId>
|
||||
</exclusion>
|
||||
</exclusions>
|
||||
</dependency>
|
||||
<dependency>
|
||||
<groupId>commons-configuration</groupId>
|
||||
|
||||
@@ -76,7 +76,7 @@
|
||||
<dependency>
|
||||
<groupId>org.neo4j</groupId>
|
||||
<artifactId>neo4j-rest-graphdb</artifactId>
|
||||
<version>1.5</version>
|
||||
<version>1.6-SNAPSHOT</version>
|
||||
<exclusions>
|
||||
<exclusion>
|
||||
<groupId>org.neo4j</groupId>
|
||||
@@ -178,8 +178,8 @@
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.tinkerpop</groupId>
|
||||
<artifactId>gremlin</artifactId>
|
||||
<groupId>com.tinkerpop.gremlin</groupId>
|
||||
<artifactId>gremlin-groovy</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
|
||||
@@ -23,7 +23,6 @@ import org.mortbay.jetty.Server;
|
||||
import org.mortbay.jetty.handler.RequestLogHandler;
|
||||
import org.neo4j.graphdb.GraphDatabaseService;
|
||||
import org.neo4j.kernel.AbstractGraphDatabase;
|
||||
import org.neo4j.server.AddressResolver;
|
||||
import org.neo4j.server.Bootstrapper;
|
||||
import org.neo4j.server.NeoServerWithEmbeddedWebServer;
|
||||
import org.neo4j.server.configuration.PropertyFileConfigurator;
|
||||
@@ -38,7 +37,6 @@ import org.neo4j.server.web.Jetty6WebServer;
|
||||
import org.neo4j.test.ImpermanentGraphDatabase;
|
||||
|
||||
import java.io.File;
|
||||
import java.io.IOException;
|
||||
import java.net.URI;
|
||||
import java.net.URL;
|
||||
import java.util.Arrays;
|
||||
@@ -78,11 +76,7 @@ public class LocalTestServer {
|
||||
return new GraphDatabaseFactory() {
|
||||
@Override
|
||||
public AbstractGraphDatabase createDatabase(String databaseStoreDirectory, Map<String, String> databaseProperties) {
|
||||
try {
|
||||
return new ImpermanentGraphDatabase();
|
||||
} catch (IOException e) {
|
||||
throw new RuntimeException(e);
|
||||
}
|
||||
return new ImpermanentGraphDatabase();
|
||||
}
|
||||
};
|
||||
}
|
||||
@@ -97,12 +91,6 @@ public class LocalTestServer {
|
||||
return serverModules;
|
||||
}
|
||||
};
|
||||
final AddressResolver addressResolver = new AddressResolver() {
|
||||
@Override
|
||||
public String getHostname() {
|
||||
return hostname;
|
||||
}
|
||||
};
|
||||
final JettyStartupListener startupListener = new JettyStartupListener();
|
||||
final Jetty6WebServer jettyWebServer = new Jetty6WebServer() {
|
||||
@Override
|
||||
@@ -123,8 +111,7 @@ public class LocalTestServer {
|
||||
super.stop();
|
||||
}
|
||||
};
|
||||
neoServer = new NeoServerWithEmbeddedWebServer(bootstrapper
|
||||
, addressResolver, new StartupHealthCheck(), new PropertyFileConfigurator(new File(url.getPath())), jettyWebServer, serverModules) {
|
||||
neoServer = new NeoServerWithEmbeddedWebServer(bootstrapper, new StartupHealthCheck(), new PropertyFileConfigurator(new File(url.getPath())), jettyWebServer, serverModules) {
|
||||
@Override
|
||||
protected int getWebServerPort() {
|
||||
return port;
|
||||
|
||||
@@ -177,8 +177,8 @@
|
||||
</dependency>
|
||||
|
||||
<dependency>
|
||||
<groupId>com.tinkerpop</groupId>
|
||||
<artifactId>gremlin</artifactId>
|
||||
<groupId>com.tinkerpop.gremlin</groupId>
|
||||
<artifactId>gremlin-groovy</artifactId>
|
||||
<optional>true</optional>
|
||||
</dependency>
|
||||
|
||||
|
||||
@@ -43,6 +43,11 @@ public class NodeGraphRepositoryImpl<T> extends AbstractGraphRepository<Node, T>
|
||||
return template.createRelationshipBetween(start,end,relationshipEntityClass,relationshipType,false);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R> R createDuplicateRelationshipBetween(T start, Object end, Class<R> relationshipEntityClass, String relationshipType) {
|
||||
return template.createRelationshipBetween(start,end,relationshipEntityClass,relationshipType,true);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <R> R getRelationshipBetween(T start, Object end, Class<R> relationshipEntityClass, String relationshipType) {
|
||||
return template.getRelationshipBetween(start,end,relationshipEntityClass,relationshipType);
|
||||
|
||||
@@ -21,6 +21,7 @@ package org.springframework.data.neo4j.repository;
|
||||
*/
|
||||
public interface RelationshipOperationsRepository<T> {
|
||||
<R> R createRelationshipBetween(T start, Object end, Class<R> relationshipEntityClass, String relationshipType);
|
||||
<R> R createDuplicateRelationshipBetween(T start, Object end, Class<R> relationshipEntityClass, String relationshipType);
|
||||
<R> R getRelationshipBetween(T start, Object end, Class<R> relationshipEntityClass, String relationshipType);
|
||||
void deleteRelationshipBetween(T start, Object end, String type);
|
||||
}
|
||||
|
||||
@@ -34,6 +34,7 @@ import java.lang.reflect.Field;
|
||||
import java.lang.reflect.Modifier;
|
||||
import java.util.Collection;
|
||||
import java.util.IdentityHashMap;
|
||||
import java.util.Iterator;
|
||||
import java.util.Map;
|
||||
|
||||
/**
|
||||
@@ -260,14 +261,15 @@ class Neo4jPersistentPropertyImpl extends AbstractPersistentProperty<Neo4jPersis
|
||||
}
|
||||
@Override
|
||||
public boolean isEntity() {
|
||||
return super.isEntity() && (hasRelationshipEntityType() || hasNodeEntityType());
|
||||
return super.isEntity() && (isRelationshipEntity(getType()) || isNodeEntity(getType()));
|
||||
}
|
||||
|
||||
private boolean hasRelationshipEntityType() {
|
||||
return getType().isAnnotationPresent(RelationshipEntity.class);
|
||||
private boolean isRelationshipEntity(final Class<?> type) {
|
||||
return type.isAnnotationPresent(RelationshipEntity.class);
|
||||
}
|
||||
private boolean hasNodeEntityType() {
|
||||
return getType().isAnnotationPresent(NodeEntity.class);
|
||||
|
||||
private boolean isNodeEntity(Class<?> type) {
|
||||
return type.isAnnotationPresent(NodeEntity.class);
|
||||
}
|
||||
|
||||
public String getIndexKey() {
|
||||
@@ -300,4 +302,17 @@ class Neo4jPersistentPropertyImpl extends AbstractPersistentProperty<Neo4jPersis
|
||||
public boolean isTransient() {
|
||||
return false;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Iterable<? extends TypeInformation<?>> getPersistentEntityType() {
|
||||
final Iterable<? extends TypeInformation<?>> result = super.getPersistentEntityType();
|
||||
for (Iterator<? extends TypeInformation<?>> it = result.iterator(); it.hasNext(); ) {
|
||||
final TypeInformation<?> typeInformation = it.next();
|
||||
final Class type = typeInformation.getType();
|
||||
if (isNodeEntity(type) || isRelationshipEntity(type)) continue;
|
||||
System.out.println("removing "+getName()+" "+type+" "+typeInformation.getActualType().getType());
|
||||
it.remove();
|
||||
}
|
||||
return result;
|
||||
}
|
||||
}
|
||||
|
||||
@@ -59,7 +59,12 @@ public class Neo4jPersistentEntityImpl<T> extends BasicPersistentEntity<T, Neo4j
|
||||
@Override
|
||||
public void verify() {
|
||||
super.verify();
|
||||
if (!isManaged() && getIdProperty()==null) throw new MappingException("No id property in "+this);
|
||||
if (isManaged()) {
|
||||
return;
|
||||
}
|
||||
final Neo4jPersistentProperty idProperty = getIdProperty();
|
||||
if (idProperty == null) throw new MappingException("No id property in " + this);
|
||||
if (idProperty.getType().isPrimitive()) throw new MappingException("The type of the id-property in " + idProperty+" must not be a primitive type but an object type like java.lang.Long");
|
||||
}
|
||||
|
||||
public boolean useShortNames() {
|
||||
|
||||
@@ -83,13 +83,7 @@ public class SourceStateTransmitter<S extends PropertyContainer> {
|
||||
}
|
||||
|
||||
private <T> T getProperty(BeanWrapper<Neo4jPersistentEntity<Object>, Object> wrapper, Neo4jPersistentProperty property, Class<T> type, boolean fieldAccessOnly) {
|
||||
try {
|
||||
return wrapper.getProperty(property, type, fieldAccessOnly);
|
||||
} catch (IllegalAccessException e) {
|
||||
throw new MappingException("Error retrieving property " + property.getName() + " from " + wrapper.getBean(), e);
|
||||
} catch (InvocationTargetException e) {
|
||||
throw new MappingException("Error retrieving property " + property.getName() + " from " + wrapper.getBean(), e.getTargetException());
|
||||
}
|
||||
return wrapper.getProperty(property, type, fieldAccessOnly);
|
||||
}
|
||||
|
||||
private <R> Object getProperty(BeanWrapper<Neo4jPersistentEntity<R>, R> wrapper, Neo4jPersistentProperty property) {
|
||||
|
||||
@@ -38,7 +38,7 @@ public class GremlinExecutor {
|
||||
private volatile ScriptEngine engine;
|
||||
|
||||
private ScriptEngine createScriptEngine() {
|
||||
return new ScriptEngineManager().getEngineByName("gremlin");
|
||||
return new ScriptEngineManager().getEngineByName("gremlin-groovy");
|
||||
}
|
||||
|
||||
private static final AtomicInteger executionCount = new AtomicInteger();
|
||||
@@ -62,7 +62,7 @@ public class GremlinExecutor {
|
||||
|
||||
private Bindings createBindings(Map<String, Object> params) {
|
||||
final Bindings bindings = new SimpleBindings();
|
||||
bindings.put(GRAPH_VARIABLE, new Neo4jGraph(graphDatabaseService));
|
||||
bindings.put(GRAPH_VARIABLE, new Neo4jGraph(graphDatabaseService,false));
|
||||
if (params==null) return bindings;
|
||||
for (Map.Entry<String, Object> entry : params.entrySet()) {
|
||||
bindings.put(entry.getKey(),entry.getValue());
|
||||
|
||||
@@ -0,0 +1,115 @@
|
||||
/**
|
||||
* Copyright 2011 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.data.neo4j.support.typerepresentation;
|
||||
|
||||
import java.lang.annotation.Annotation;
|
||||
|
||||
import org.neo4j.graphdb.PropertyContainer;
|
||||
import org.neo4j.graphdb.index.Index;
|
||||
import org.neo4j.graphdb.index.IndexHits;
|
||||
import org.neo4j.helpers.collection.ClosableIterable;
|
||||
import org.springframework.data.neo4j.core.GraphDatabase;
|
||||
import org.springframework.data.neo4j.core.TypeRepresentationStrategy;
|
||||
import org.springframework.data.neo4j.support.index.ClosableIndexHits;
|
||||
import org.springframework.data.neo4j.support.index.IndexProvider;
|
||||
import org.springframework.data.neo4j.support.index.IndexType;
|
||||
|
||||
public abstract class AbstractIndexingTypeRepresentationStrategy<S extends PropertyContainer> implements
|
||||
TypeRepresentationStrategy<S> {
|
||||
|
||||
public static final String TYPE_PROPERTY_NAME = "__type__";
|
||||
public static final String INDEX_KEY = "className";
|
||||
protected String INDEX_NAME;
|
||||
protected final GraphDatabase graphDb;
|
||||
protected final EntityTypeCache typeCache;
|
||||
protected final IndexProvider indexProvider;
|
||||
private final Class<? extends PropertyContainer> clazz;
|
||||
private final Class<? extends Annotation> typeEntityClass;
|
||||
|
||||
public AbstractIndexingTypeRepresentationStrategy(GraphDatabase graphDb, IndexProvider indexProvider,
|
||||
final String indexName, final Class<? extends PropertyContainer> clazz,
|
||||
final Class<? extends Annotation> typeEntityClass) {
|
||||
this.graphDb = graphDb;
|
||||
this.indexProvider = indexProvider;
|
||||
typeCache = new EntityTypeCache();
|
||||
INDEX_NAME = indexName;
|
||||
this.clazz = clazz;
|
||||
this.typeEntityClass = typeEntityClass;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
public Index<S> getTypesIndex() {
|
||||
return (Index<S>) graphDb.createIndex(clazz, INDEX_NAME, IndexType.SIMPLE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postEntityCreation(S state, Class<?> type) {
|
||||
addToTypesIndex(state, type);
|
||||
state.setProperty(TYPE_PROPERTY_NAME, type.getName());
|
||||
}
|
||||
|
||||
@Override
|
||||
public long count(Class<?> entityClass) {
|
||||
long count = 0;
|
||||
final IndexHits<S> hits = getTypesIndex().get(INDEX_KEY, entityClass.getName());
|
||||
while (hits.hasNext()) {
|
||||
hits.next();
|
||||
count++;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void preEntityRemoval(S state) {
|
||||
getTypesIndex().remove(state);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <U> ClosableIterable<S> findAll(Class<U> clazz) {
|
||||
return findAllRelBacked(clazz);
|
||||
}
|
||||
|
||||
@Override
|
||||
public <U> Class<U> getJavaType(S propertyContainer) {
|
||||
if (propertyContainer == null)
|
||||
throw new IllegalArgumentException("Relationship or Node is null");
|
||||
String className = (String) propertyContainer.getProperty(TYPE_PROPERTY_NAME);
|
||||
return typeCache.getClassForName(className);
|
||||
}
|
||||
|
||||
protected void addToTypesIndex(S relationshipOrNode, Class<?> entityClass) {
|
||||
Class<?> type = entityClass;
|
||||
while (type.getAnnotation(typeEntityClass) != null) {
|
||||
String value = entityClass.getName();
|
||||
if (indexProvider != null)
|
||||
value = indexProvider.createIndexValueForType(entityClass);
|
||||
|
||||
getTypesIndex().add(relationshipOrNode, INDEX_KEY, value);
|
||||
type = type.getSuperclass();
|
||||
}
|
||||
}
|
||||
|
||||
@SuppressWarnings("hiding")
|
||||
private <Object> ClosableIterable<S> findAllRelBacked(Class<Object> clazz) {
|
||||
String value = clazz.getName();
|
||||
if (indexProvider != null)
|
||||
value = indexProvider.createIndexValueForType(clazz);
|
||||
|
||||
final IndexHits<S> allEntitiesOfType = getTypesIndex().get(INDEX_KEY, value);
|
||||
return new ClosableIndexHits<S>(allEntitiesOfType);
|
||||
}
|
||||
|
||||
}
|
||||
@@ -17,89 +17,31 @@
|
||||
package org.springframework.data.neo4j.support.typerepresentation;
|
||||
|
||||
import org.neo4j.graphdb.Node;
|
||||
import org.neo4j.graphdb.index.Index;
|
||||
import org.neo4j.graphdb.index.IndexHits;
|
||||
import org.neo4j.helpers.collection.ClosableIterable;
|
||||
import org.springframework.data.neo4j.annotation.NodeEntity;
|
||||
import org.springframework.data.neo4j.core.GraphDatabase;
|
||||
import org.springframework.data.neo4j.core.NodeTypeRepresentationStrategy;
|
||||
import org.springframework.data.neo4j.support.index.ClosableIndexHits;
|
||||
import org.springframework.data.neo4j.support.index.IndexProvider;
|
||||
import org.springframework.data.neo4j.support.index.IndexType;
|
||||
|
||||
public class IndexingNodeTypeRepresentationStrategy implements NodeTypeRepresentationStrategy {
|
||||
public class IndexingNodeTypeRepresentationStrategy extends AbstractIndexingTypeRepresentationStrategy<Node> implements
|
||||
NodeTypeRepresentationStrategy {
|
||||
|
||||
public static final String INDEX_NAME = "__types__";
|
||||
public static final String TYPE_PROPERTY_NAME = "__type__";
|
||||
public static final String INDEX_KEY = "className";
|
||||
private final GraphDatabase graphDb;
|
||||
private final EntityTypeCache typeCache;
|
||||
|
||||
private final IndexProvider indexProvider;
|
||||
|
||||
public IndexingNodeTypeRepresentationStrategy(GraphDatabase graphDb, IndexProvider indexProvider) {
|
||||
this.graphDb = graphDb;
|
||||
this.indexProvider = indexProvider;
|
||||
typeCache = new EntityTypeCache();
|
||||
}
|
||||
|
||||
private Index<Node> getNodeTypesIndex() {
|
||||
return graphDb.createIndex(Node.class, INDEX_NAME, IndexType.SIMPLE);
|
||||
super(graphDb, indexProvider, INDEX_NAME, Node.class, NodeEntity.class);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postEntityCreation(Node state, Class<?> type) {
|
||||
addToNodeTypesIndex(state, type);
|
||||
state.setProperty(TYPE_PROPERTY_NAME, type.getName());
|
||||
}
|
||||
|
||||
private void addToNodeTypesIndex(Node node, Class<?> entityClass) {
|
||||
protected void addToTypesIndex(Node node, Class<?> entityClass) {
|
||||
Class<?> klass = entityClass;
|
||||
|
||||
while (klass.getAnnotation(NodeEntity.class) != null) {
|
||||
String value = klass.getName();
|
||||
if (indexProvider != null)
|
||||
value = indexProvider.createIndexValueForType(klass);
|
||||
|
||||
getNodeTypesIndex().add(node, INDEX_KEY, value);
|
||||
getTypesIndex().add(node, INDEX_KEY, value);
|
||||
klass = klass.getSuperclass();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public <U> ClosableIterable<Node> findAll(Class<U> clazz) {
|
||||
return findAllNodeBacked(clazz);
|
||||
}
|
||||
|
||||
private <Object> ClosableIterable<Node> findAllNodeBacked(Class<Object> clazz) {
|
||||
String value = clazz.getName();
|
||||
if (indexProvider != null)
|
||||
value = indexProvider.createIndexValueForType(clazz);
|
||||
|
||||
final IndexHits<Node> allEntitiesOfType = getNodeTypesIndex().get(INDEX_KEY, value);
|
||||
return new ClosableIndexHits<Node>(allEntitiesOfType);
|
||||
}
|
||||
|
||||
@Override
|
||||
public long count(Class<?> entityClass) {
|
||||
long count = 0;
|
||||
for (Object o : getNodeTypesIndex().get(INDEX_KEY, entityClass.getName())) {
|
||||
count += 1;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public Class<?> getJavaType(Node node) {
|
||||
if (node == null) throw new IllegalArgumentException("Node is null");
|
||||
String className = (String) node.getProperty(TYPE_PROPERTY_NAME);
|
||||
return typeCache.getClassForName(className);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void preEntityRemoval(Node state) {
|
||||
getNodeTypesIndex().remove(state);
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
@@ -17,92 +17,18 @@
|
||||
package org.springframework.data.neo4j.support.typerepresentation;
|
||||
|
||||
import org.neo4j.graphdb.Relationship;
|
||||
import org.neo4j.graphdb.index.Index;
|
||||
import org.neo4j.graphdb.index.IndexHits;
|
||||
import org.neo4j.helpers.collection.ClosableIterable;
|
||||
import org.springframework.data.neo4j.annotation.RelationshipEntity;
|
||||
import org.springframework.data.neo4j.core.GraphDatabase;
|
||||
import org.springframework.data.neo4j.core.RelationshipTypeRepresentationStrategy;
|
||||
import org.springframework.data.neo4j.support.index.ClosableIndexHits;
|
||||
import org.springframework.data.neo4j.support.index.IndexProvider;
|
||||
import org.springframework.data.neo4j.support.index.IndexType;
|
||||
|
||||
public class IndexingRelationshipTypeRepresentationStrategy implements RelationshipTypeRepresentationStrategy {
|
||||
public class IndexingRelationshipTypeRepresentationStrategy extends
|
||||
AbstractIndexingTypeRepresentationStrategy<Relationship> implements RelationshipTypeRepresentationStrategy {
|
||||
|
||||
public static final String INDEX_NAME = "__rel_types__";
|
||||
public static final String TYPE_PROPERTY_NAME = "__type__";
|
||||
public static final String INDEX_KEY = "className";
|
||||
private final GraphDatabase graphDb;
|
||||
private final EntityTypeCache typeCache;
|
||||
|
||||
private final IndexProvider indexProvider;
|
||||
|
||||
public IndexingRelationshipTypeRepresentationStrategy(GraphDatabase graphDb, IndexProvider indexProvider) {
|
||||
this.graphDb = graphDb;
|
||||
this.indexProvider = indexProvider;
|
||||
typeCache = new EntityTypeCache();
|
||||
}
|
||||
|
||||
private Index<Relationship> getRelTypesIndex() {
|
||||
return graphDb.createIndex(Relationship.class,INDEX_NAME, IndexType.SIMPLE);
|
||||
}
|
||||
|
||||
@Override
|
||||
public void postEntityCreation(Relationship state, Class<?> type) {
|
||||
addToTypesIndex(state, type);
|
||||
state.setProperty(TYPE_PROPERTY_NAME, type.getName());
|
||||
}
|
||||
|
||||
private void addToTypesIndex(Relationship node, Class<?> entityClass) {
|
||||
Class<?> type = entityClass;
|
||||
while (type.getAnnotation(RelationshipEntity.class) != null) {
|
||||
String value = entityClass.getName();
|
||||
if (indexProvider != null)
|
||||
value = indexProvider.createIndexValueForType(entityClass);
|
||||
|
||||
getRelTypesIndex().add(node, INDEX_KEY, value);
|
||||
type = type.getSuperclass();
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public <U> ClosableIterable<Relationship> findAll(Class<U> clazz) {
|
||||
return findAllRelBacked(clazz);
|
||||
}
|
||||
|
||||
private <Object> ClosableIterable<Relationship> findAllRelBacked(Class<Object> clazz) {
|
||||
String value = clazz.getName();
|
||||
if (indexProvider != null)
|
||||
value = indexProvider.createIndexValueForType(clazz);
|
||||
|
||||
final IndexHits<Relationship> allEntitiesOfType = getRelTypesIndex().get(INDEX_KEY, value);
|
||||
return new ClosableIndexHits<Relationship>(allEntitiesOfType);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public long count(Class<?> entityClass) {
|
||||
long count = 0;
|
||||
final IndexHits<Relationship> hits = getRelTypesIndex().get(INDEX_KEY, entityClass.getName());
|
||||
while (hits.hasNext()) {
|
||||
hits.next();
|
||||
count++;
|
||||
}
|
||||
return count;
|
||||
}
|
||||
|
||||
@Override
|
||||
@SuppressWarnings("unchecked")
|
||||
public Class<?> getJavaType(Relationship relationship) {
|
||||
if (relationship == null) throw new IllegalArgumentException("Relationship is null");
|
||||
String className = (String) relationship.getProperty(TYPE_PROPERTY_NAME);
|
||||
return typeCache.getClassForName(className);
|
||||
}
|
||||
|
||||
|
||||
@Override
|
||||
public void preEntityRemoval(Relationship state) {
|
||||
getRelTypesIndex().remove(state);
|
||||
super(graphDb, indexProvider, INDEX_NAME, Relationship.class, RelationshipEntity.class);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -18,9 +18,11 @@ package org.springframework.data.neo4j.transaction;
|
||||
|
||||
import org.neo4j.helpers.Service;
|
||||
import org.neo4j.kernel.impl.core.KernelPanicEventGenerator;
|
||||
import org.neo4j.kernel.impl.nioneo.store.FileSystemAbstraction;
|
||||
import org.neo4j.kernel.impl.transaction.AbstractTransactionManager;
|
||||
import org.neo4j.kernel.impl.transaction.TransactionManagerProvider;
|
||||
import org.neo4j.kernel.impl.transaction.TxHook;
|
||||
import org.neo4j.kernel.impl.util.StringLogger;
|
||||
import org.springframework.beans.factory.annotation.Configurable;
|
||||
|
||||
@Configurable
|
||||
@@ -33,7 +35,7 @@ public class SpringProvider extends TransactionManagerProvider
|
||||
}
|
||||
|
||||
@Override
|
||||
protected AbstractTransactionManager loadTransactionManager(String s, KernelPanicEventGenerator kernelPanicEventGenerator, TxHook txHook) {
|
||||
protected AbstractTransactionManager loadTransactionManager(String s, KernelPanicEventGenerator kernelPanicEventGenerator, TxHook txHook, StringLogger stringLogger, FileSystemAbstraction fileSystemAbstraction) {
|
||||
return new SpringServiceImpl();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -108,7 +108,7 @@ public class DataGraphNamespaceHandlerTest {
|
||||
Neo4jTemplate template = config.neo4jTemplate;
|
||||
Assert.assertNotNull("template", template);
|
||||
AbstractGraphDatabase graphDatabaseService = (AbstractGraphDatabase) template.getGraphDatabaseService();
|
||||
Assert.assertEquals("store-dir", "target/config-test", graphDatabaseService.getStoreDir());
|
||||
Assert.assertTrue("store-dir", graphDatabaseService.getStoreDir().endsWith("target/config-test"));
|
||||
Assert.assertNotNull("graphDatabaseService",config.graphDatabaseService);
|
||||
Assert.assertNotNull("transactionManager",config.transactionManager);
|
||||
config.graphDatabaseService.shutdown();
|
||||
|
||||
@@ -17,7 +17,9 @@ package org.springframework.data.neo4j.mapping;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.springframework.data.mapping.model.MappingException;
|
||||
import org.springframework.data.neo4j.model.Person;
|
||||
import org.springframework.data.neo4j.model.PrimitiveIdEntity;
|
||||
import org.springframework.data.neo4j.support.index.IndexType;
|
||||
import org.springframework.data.neo4j.support.mapping.Neo4jMappingContext;
|
||||
import org.springframework.data.neo4j.support.mapping.Neo4jPersistentEntityImpl;
|
||||
@@ -54,4 +56,9 @@ public class Neo4jMappingContextTest {
|
||||
assertEquals(IndexType.SIMPLE,nameProperty.getIndexInfo().getIndexType());
|
||||
assertEquals(false,nameProperty.isRelationship());
|
||||
}
|
||||
|
||||
@Test(expected = MappingException.class)
|
||||
public void testPrimitiveGraphIdFails() {
|
||||
mappingContext.getPersistentEntity(PrimitiveIdEntity.class);
|
||||
}
|
||||
}
|
||||
|
||||
@@ -23,7 +23,7 @@ import org.springframework.data.neo4j.annotation.NodeEntity;
|
||||
@NodeEntity
|
||||
public abstract class Car {
|
||||
@GraphId
|
||||
long id;
|
||||
Long id;
|
||||
public Car() {
|
||||
}
|
||||
|
||||
|
||||
@@ -16,8 +16,7 @@
|
||||
|
||||
package org.springframework.data.neo4j.model;
|
||||
|
||||
import org.neo4j.graphdb.Direction;
|
||||
import org.neo4j.graphdb.Node;
|
||||
import org.neo4j.graphdb.*;
|
||||
import org.springframework.data.neo4j.annotation.*;
|
||||
import org.springframework.data.neo4j.fieldaccess.DynamicProperties;
|
||||
import org.springframework.data.neo4j.support.index.IndexType;
|
||||
@@ -33,6 +32,7 @@ import java.util.Map;
|
||||
public class Person {
|
||||
|
||||
public static final String NAME_INDEX = "name_index";
|
||||
public static final org.neo4j.graphdb.RelationshipType KNOWS = DynamicRelationshipType.withName("knows");
|
||||
@GraphId
|
||||
private Long graphId;
|
||||
|
||||
@@ -86,7 +86,7 @@ public class Person {
|
||||
@Query("start person=node({self}) match (person)<-[:persons]-(team)-[:persons]->(member) return member")
|
||||
private Iterable<Person> otherTeamMembers;
|
||||
|
||||
@Query("start person=node({self}) match (person)<-[:persons]-(team)-[:persons]->(member) return member.name, member.age")
|
||||
@Query("start person=node({self}) match (person)<-[:persons]-(team)-[:persons]->(member) return member.name?, member.age?")
|
||||
private Iterable<Map<String,Object>> otherTeamMemberData;
|
||||
|
||||
public Person(Node n) {
|
||||
|
||||
@@ -0,0 +1,28 @@
|
||||
/**
|
||||
* Copyright 2011 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.data.neo4j.model;
|
||||
|
||||
import org.springframework.data.neo4j.annotation.GraphId;
|
||||
import org.springframework.data.neo4j.annotation.NodeEntity;
|
||||
|
||||
/**
|
||||
* @author mh
|
||||
* @since 14.12.11
|
||||
*/
|
||||
@NodeEntity
|
||||
public class PrimitiveIdEntity {
|
||||
@GraphId long id;
|
||||
}
|
||||
@@ -22,6 +22,7 @@ import org.junit.Before;
|
||||
import org.junit.Ignore;
|
||||
import org.junit.Test;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.neo4j.graphdb.Node;
|
||||
import org.neo4j.helpers.collection.IteratorUtil;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
import org.springframework.data.domain.Page;
|
||||
@@ -46,14 +47,13 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.transaction.support.TransactionCallbackWithoutResult;
|
||||
import org.springframework.transaction.support.TransactionTemplate;
|
||||
|
||||
import java.util.Collection;
|
||||
import java.util.HashSet;
|
||||
import java.util.Map;
|
||||
|
||||
import static java.util.Arrays.asList;
|
||||
import static org.hamcrest.CoreMatchers.is;
|
||||
import static org.junit.Assert.assertEquals;
|
||||
import static org.junit.Assert.assertNotNull;
|
||||
import static org.junit.Assert.assertThat;
|
||||
import static org.junit.Assert.*;
|
||||
import static org.junit.internal.matchers.IsCollectionContaining.hasItem;
|
||||
import static org.junit.internal.matchers.IsCollectionContaining.hasItems;
|
||||
import static org.neo4j.helpers.collection.IteratorUtil.addToCollection;
|
||||
@@ -145,7 +145,7 @@ public class GraphRepositoryTest {
|
||||
assertThat( asCollection( teamMembers ), hasItems( testTeam.michael, testTeam.david, testTeam.emil ) );
|
||||
}
|
||||
|
||||
@Test @Transactional
|
||||
@Test @Transactional
|
||||
public void testFindIterableOfPersonWithQueryAnnotationSpatial() {
|
||||
Iterable<Person> teamMembers = personRepository.findWithinBoundingBox("personLayer", 55, 15, 57, 17);
|
||||
assertThat(asCollection(teamMembers), hasItems(testTeam.michael, testTeam.david));
|
||||
@@ -224,7 +224,7 @@ public class GraphRepositoryTest {
|
||||
|
||||
@Test @Transactional
|
||||
public void testFindSortedNull() {
|
||||
Iterable<Person> teamMembers = personRepository.findAllTeamMembersSorted(testTeam.sdg, null);
|
||||
Collection<Person> teamMembers = IteratorUtil.asCollection(personRepository.findAllTeamMembersSorted(testTeam.sdg, null));
|
||||
assertThat(teamMembers, hasItems(testTeam.michael, testTeam.emil, testTeam.david));
|
||||
}
|
||||
|
||||
@@ -266,4 +266,11 @@ public class GraphRepositoryTest {
|
||||
assertEquals(2, IteratorUtil.count(loaded.getFriendships()));
|
||||
assertThat(loaded.getFriendships(),hasItem(friendship));
|
||||
}
|
||||
|
||||
@Test @Transactional
|
||||
public void testCreateDuplicateRelationship() {
|
||||
assertEquals(1, IteratorUtil.count(neo4jTemplate.<Node>getPersistentState(testTeam.michael).getRelationships(Person.KNOWS)));
|
||||
personRepository.createDuplicateRelationshipBetween(testTeam.michael, testTeam.david, Friendship.class, "knows");
|
||||
assertEquals(2, IteratorUtil.count(neo4jTemplate.<Node>getPersistentState(testTeam.michael).getRelationships(Person.KNOWS)));
|
||||
}
|
||||
}
|
||||
|
||||
@@ -34,7 +34,7 @@ import java.util.Map;
|
||||
* @author Oliver Gierke
|
||||
* @since 29.03.11
|
||||
*/
|
||||
public interface PersonRepository extends GraphRepository<Person>, NamedIndexRepository<Person>, SpatialRepository<Person>, PersonRepositoryFriendship, CypherDslRepository<Person> {
|
||||
public interface PersonRepository extends GraphRepository<Person>, NamedIndexRepository<Person>, SpatialRepository<Person>, PersonRepositoryFriendship, CypherDslRepository<Person>, RelationshipOperationsRepository<Person> {
|
||||
|
||||
@Query("start team=node({p_team}) match (team)-[:persons]->(member) return member")
|
||||
Iterable<Person> findAllTeamMembers(@Param("p_team") Group team);
|
||||
|
||||
@@ -17,11 +17,13 @@ package org.springframework.data.neo4j.support;
|
||||
|
||||
import org.junit.Before;
|
||||
import org.junit.Test;
|
||||
import org.junit.internal.matchers.IsCollectionContaining;
|
||||
import org.junit.runner.RunWith;
|
||||
import org.mockito.Mockito;
|
||||
import org.neo4j.graphdb.*;
|
||||
import org.neo4j.graphdb.index.Index;
|
||||
import org.neo4j.graphdb.traversal.TraversalDescription;
|
||||
import org.neo4j.helpers.collection.IteratorUtil;
|
||||
import org.neo4j.helpers.collection.MapUtil;
|
||||
import org.neo4j.kernel.Traversal;
|
||||
import org.springframework.beans.factory.annotation.Autowired;
|
||||
@@ -45,9 +47,7 @@ import org.springframework.transaction.annotation.Transactional;
|
||||
import org.springframework.transaction.support.TransactionCallbackWithoutResult;
|
||||
import org.springframework.transaction.support.TransactionTemplate;
|
||||
|
||||
import java.util.Arrays;
|
||||
import java.util.Collection;
|
||||
import java.util.Map;
|
||||
import java.util.*;
|
||||
|
||||
import static org.junit.Assert.*;
|
||||
import static org.neo4j.graphdb.Direction.OUTGOING;
|
||||
@@ -306,7 +306,11 @@ public class EntityNeo4jTemplateTest extends EntityTestBase {
|
||||
public void testCreateRelationshipBetweenNodes() throws Exception {
|
||||
final Friendship friendship = neo4jOperations.createRelationshipBetween(testTeam.david, testTeam.emil, Friendship.class, "knows", false);
|
||||
assertEquals(friendship.getId(),(Long)getNodeState(testTeam.david).getSingleRelationship(KNOWS, OUTGOING).getId());
|
||||
final List<Friendship> friendships = IteratorUtil.addToCollection(friendshipRepository.findAll(), new ArrayList<Friendship>());
|
||||
assertEquals(2,friendships.size());
|
||||
assertThat(friendships, IsCollectionContaining.hasItems(testTeam.friendShip, friendship));
|
||||
}
|
||||
|
||||
@Test @Transactional
|
||||
public void testCreateDuplicateRelationshipBetweenNodes() throws Exception {
|
||||
neo4jOperations.createRelationshipBetween(testTeam.michael, testTeam.david, Friendship.class, "knows", true);
|
||||
|
||||
|
Before Width: | Height: | Size: 121 KiB After Width: | Height: | Size: 121 KiB |
@@ -193,7 +193,7 @@
|
||||
name can be split into its semantic parts and converted into a cypher query.
|
||||
<code>@Indexed</code> fields will be converted into index-lookups of the <code>start</code> clause,
|
||||
navigation along relationships will be reflected in the <code>match</code> clause properties with operators will end up as expressions in the
|
||||
<code>where</code> clause. Order and limiting of the query will by handled by provided <code>Pageable</code> or <Sort></Sort> parameters.
|
||||
<code>where</code> clause. Order and limiting of the query will by handled by provided <code>Pageable</code> or <code>Sort</code> parameters.
|
||||
The other parameters will be used in the order they appear in the method signature so that should align with the expressions stated in the method name.
|
||||
</para>
|
||||
<para>
|
||||
|
||||
@@ -40,7 +40,7 @@
|
||||
<programlisting language="xml" ><![CDATA[<dependency>
|
||||
<groupId>org.neo4j</groupId>
|
||||
<artifactId>neo4j</artifactId>
|
||||
<version>1.5</version>
|
||||
<version>1.6.M02</version>
|
||||
</dependency>
|
||||
]]></programlisting>
|
||||
</example>
|
||||
|
||||
@@ -32,7 +32,7 @@
|
||||
<example>
|
||||
<title>Project pom.xml</title>
|
||||
<programlisting language="xml"><![CDATA[<properties>
|
||||
<spring.version>3.0.6.RELEASE</spring.version>
|
||||
<spring.version>3.0.7.RELEASE</spring.version>
|
||||
</properties>
|
||||
|
||||
<dependencies>
|
||||
|
||||
Reference in New Issue
Block a user