diff --git a/spring-data-neo4j-roo/.classpath b/spring-data-neo4j-roo/.classpath deleted file mode 100644 index 07e0b939e..000000000 --- a/spring-data-neo4j-roo/.classpath +++ /dev/null @@ -1,9 +0,0 @@ - - - - - - - - - diff --git a/spring-data-neo4j-roo/.project b/spring-data-neo4j-roo/.project deleted file mode 100644 index 4b6128a0b..000000000 --- a/spring-data-neo4j-roo/.project +++ /dev/null @@ -1,24 +0,0 @@ - - - spring-data-neo4j-roo - - - - - - org.eclipse.ajdt.core.ajbuilder - - - - - org.maven.ide.eclipse.maven2Builder - - - - - - org.eclipse.ajdt.ui.ajnature - org.eclipse.jdt.core.javanature - org.maven.ide.eclipse.maven2Nature - - diff --git a/spring-data-neo4j-roo/.settings/org.eclipse.jdt.core.prefs b/spring-data-neo4j-roo/.settings/org.eclipse.jdt.core.prefs deleted file mode 100644 index 98db1447e..000000000 --- a/spring-data-neo4j-roo/.settings/org.eclipse.jdt.core.prefs +++ /dev/null @@ -1,6 +0,0 @@ -#Fri Oct 29 18:37:18 EDT 2010 -eclipse.preferences.version=1 -org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.6 -org.eclipse.jdt.core.compiler.compliance=1.6 -org.eclipse.jdt.core.compiler.problem.forbiddenReference=warning -org.eclipse.jdt.core.compiler.source=1.6 diff --git a/spring-data-neo4j-roo/.settings/org.maven.ide.eclipse.prefs b/spring-data-neo4j-roo/.settings/org.maven.ide.eclipse.prefs deleted file mode 100644 index c588f5799..000000000 --- a/spring-data-neo4j-roo/.settings/org.maven.ide.eclipse.prefs +++ /dev/null @@ -1,9 +0,0 @@ -#Fri Oct 29 18:37:14 EDT 2010 -activeProfiles= -eclipse.preferences.version=1 -fullBuildGoals=process-test-resources -includeModules=false -resolveWorkspaceProjects=true -resourceFilterGoals=process-resources resources\:testResources -skipCompilerPlugin=true -version=1 diff --git a/spring-data-neo4j-roo/pom.xml b/spring-data-neo4j-roo/pom.xml deleted file mode 100644 index 11bb35feb..000000000 --- a/spring-data-neo4j-roo/pom.xml +++ /dev/null @@ -1,203 +0,0 @@ - - 4.0.0 - - org.springframework.data - spring-data-graph-parent - 1.0.0.BUILD-SNAPSHOT - ../spring-data-graph-parent/pom.xml - - spring-data-neo4j-roo - jar - Spring Data Neo4J Roo Support - - 1.6.11.RELEASE - - - - - - org.springframework - spring-beans - - - org.springframework - spring-tx - - - org.springframework - spring-orm - ${org.springframework.version} - - - - - org.springframework.data - spring-data-neo4j - - - org.springframework.data - spring-data-commons-core - - - - - org.slf4j - slf4j-api - - - org.slf4j - jcl-over-slf4j - compile - - - org.slf4j - slf4j-log4j12 - runtime - - - log4j - log4j - - - javax.mail - mail - - - javax.jms - jms - - - com.sun.jdmk - jmxtools - - - com.sun.jmx - jmxri - - - runtime - - - - javax.annotation - jsr250-api - true - - - - org.mockito - mockito-all - test - - - - junit - junit - - - - org.aspectj - aspectjrt - ${aspectj.version} - - - - - org.neo4j - neo4j - - - org.neo4j - neo4j-kernel - tests - test - - - - - org.hibernate.javax.persistence - hibernate-jpa-2.0-api - 1.0.0.Final - - - - - org.hibernate - hibernate-entitymanager - 3.5.5-Final - test - - - hsqldb - hsqldb - 1.8.0.10 - test - - - - - - neo4j-public-repository - Neo4J Public Repository - http://m2.neo4j.org - - - jboss-repository - JBoss Public Repository - http://repository.jboss.org/nexus/content/groups/public-jboss - - - spring-maven-snapshot - - true - - Springframework Maven SNAPSHOT Repository - http://maven.springframework.org/snapshot - - - - - - org.codehaus.mojo - aspectj-maven-plugin - 1.2 - - - org.aspectj - aspectjrt - ${aspectj.version} - - - org.aspectj - aspectjtools - ${aspectj.version} - - - - - - compile - test-compile - - - - - true - - - org.springframework - spring-aspects - - - org.springframework.data - spring-data-neo4j - - - 1.6 - 1.6 - - - - - diff --git a/spring-data-neo4j-roo/src/main/java/org/springframework/data/graph/neo4j/jpa/Neo4JQuery.java b/spring-data-neo4j-roo/src/main/java/org/springframework/data/graph/neo4j/jpa/Neo4JQuery.java deleted file mode 100644 index 61c469bd0..000000000 --- a/spring-data-neo4j-roo/src/main/java/org/springframework/data/graph/neo4j/jpa/Neo4JQuery.java +++ /dev/null @@ -1,309 +0,0 @@ -/** - * 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.graph.neo4j.jpa; - -import org.springframework.data.graph.core.NodeBacked; -import org.springframework.data.graph.neo4j.repository.GraphRepository; -import org.springframework.data.graph.neo4j.repository.DirectGraphRepositoryFactory; -import org.springframework.data.graph.neo4j.repository.NodeGraphRepository; -import org.springframework.data.graph.neo4j.support.Tuple2; - -import javax.persistence.*; -import javax.persistence.spi.PersistenceUnitInfo; -import java.util.*; -import java.util.regex.Matcher; -import java.util.regex.Pattern; - -import static org.springframework.data.graph.neo4j.jpa.Neo4jQueryParameter.param; -import static org.springframework.data.graph.neo4j.support.Tuple2._; -import static org.springframework.util.ObjectUtils.nullSafeEquals; - -/** - * @author Michael Hunger - * @since 29.08.2010 - */ -public class Neo4JQuery implements TypedQuery { - protected final Class resultClass; - protected final String qlString; - private final DirectGraphRepositoryFactory graphRepositoryFactory; - private final PersistenceUnitInfo info; - private final Pattern fromPattern = Pattern.compile("^.*\\bfrom\\s+([A-Z][A-Za-z0-9]+)\\b.*"); - private int startPosition = 0; - private int maxResult = -1; - private QueryExecutor queryExecutor; - private Map, Tuple2> parameters = new HashMap, Tuple2>(); - - public Neo4JQuery(final String qlString, final DirectGraphRepositoryFactory graphRepositoryFactory, final PersistenceUnitInfo info, Class resultClass) { - this.qlString = qlString; - this.graphRepositoryFactory = graphRepositoryFactory; - this.info = info; - this.resultClass = resultClass; - queryExecutor = createExecutor(qlString); - } - - private QueryExecutor createExecutor(final String qlString) { - final GraphRepository graphRepository = getFinderFromQuery(qlString); - if (qlString.contains(" count(")) { - return new QueryExecutor() { - @Override - protected T findObject() { - return (T)Long.valueOf(graphRepository.count()); - } - }; - } - return new QueryExecutor() { - @Override - protected Iterable findList() { - return (Iterable) graphRepository.findAll(); - } - }; - } - - private NodeGraphRepository getFinderFromQuery(String qlString) { - final Matcher matcher = fromPattern.matcher(qlString); - if (!matcher.matches()) throw new IllegalAccessError("Unable to parse query " + qlString); - final String shortName = matcher.group(1); - final Class entityClass = getEntityClass(shortName); - return graphRepositoryFactory.createNodeEntityRepository(entityClass); - } - - abstract static class QueryExecutor { - protected Iterable findList() { - return Collections.singleton(findObject()); - } - - protected T findObject() { - return null; - } - - } - - private Class getEntityClass(final String shortName) { - try { - final String className = getFQN(shortName); - return (Class) Class.forName(className); - } catch (ClassNotFoundException e) { - throw new IllegalStateException("Error resolving class " + shortName, e); - } - } - - private String getFQN(final String shortName) throws ClassNotFoundException { - for (final String className : info.getManagedClassNames()) { - if (className.endsWith(shortName)) return className; - } - throw new ClassNotFoundException("No mapped class found for " + shortName); - } - - @Override - public List getResultList() { - final List result = new ArrayList(); - int count = 0; - for (final T nodeBacked : (Iterable) queryExecutor.findList()) { - if (maxResult >= 0 && count == startPosition + maxResult) break; - if (count >= startPosition) { - result.add(nodeBacked); - } - count++; - } - return result; - } - - @Override - public T getSingleResult() { - final Iterator found = queryExecutor.findList().iterator(); - return found.hasNext() ? (T) found.next() : null; // todo errors when none or too many ? - } - - @Override - public int executeUpdate() { - return 0; - } - - @Override - public TypedQuery setMaxResults(final int maxResult) { - this.maxResult = maxResult; - return this; - } - - @Override - public int getMaxResults() { - return maxResult; - } - - @Override - public TypedQuery setFirstResult(final int startPosition) { - this.startPosition = startPosition; - return this; - } - - @Override - public int getFirstResult() { - return startPosition; - } - - @Override - public TypedQuery setHint(final String hintName, final Object value) { - return this; - } - - @Override - public Map getHints() { - return Collections.emptyMap(); - } - - @Override - public

TypedQuery setParameter(final Parameter

parameter, final P value) { - this.parameters.put(parameter, value(value)); - return this; - } - - private static

Tuple2 value(final P value) { - return _(value, (TemporalType) null); - } - - @Override - public TypedQuery setParameter(final Parameter parameter, final Calendar calendar, final TemporalType temporalType) { - this.parameters.put(parameter, _(calendar, temporalType)); - return this; - } - - @Override - public TypedQuery setParameter(final Parameter parameter, final Date date, final TemporalType temporalType) { - this.parameters.put(parameter, _(date, temporalType)); - return this; - } - - @Override - public TypedQuery setParameter(final String name, final Object value) { - this.parameters.put(param(name), value(value)); - return this; - } - - @Override - public TypedQuery setParameter(final String name, final Date value, final TemporalType temporalType) { - this.parameters.put(param(name), _(value, temporalType)); - return this; - } - - @Override - public TypedQuery setParameter(final String name, final Calendar value, final TemporalType temporalType) { - this.parameters.put(param(name), _(value, temporalType)); - return this; - } - - @Override - public TypedQuery setParameter(final int position, final Object value) { - this.parameters.put(param(position), value(value)); - return this; - } - - @Override - public TypedQuery setParameter(final int position, final Date value, final TemporalType temporalType) { - this.parameters.put(param(position), value(value)); - return this; - } - - @Override - public Set> getParameters() { - return parameters.keySet(); - } - - @Override - public Parameter getParameter(final String name) { - for (final Parameter parameter : parameters.keySet()) { - if (nullSafeEquals(parameter.getName(), name)) return parameter; - } - return null; - } - - @Override - public Parameter getParameter(final String name, final Class type) { - for (final Parameter parameter : parameters.keySet()) { - if (nullSafeEquals(parameter.getName(), name) && nullSafeEquals(type, parameter.getParameterType())) - return (Parameter) parameter; - } - return null; - } - - @Override - public Parameter getParameter(final int index) { - for (final Parameter parameter : parameters.keySet()) { - if (nullSafeEquals(parameter.getPosition(), index)) return parameter; - } - return null; - } - - @Override - public Parameter getParameter(final int index, final Class type) { - for (final Parameter parameter : parameters.keySet()) { - if (nullSafeEquals(parameter.getPosition(), index) && nullSafeEquals(type, parameter.getParameterType())) - return (Parameter) parameter; - } - return null; - } - - @Override - public boolean isBound(final Parameter parameter) { - return parameters.containsKey(parameter); - } - - @Override - public T getParameterValue(final Parameter parameter) { - return (T) parameters.get(parameter)._1; - } - - @Override - public Object getParameterValue(final String name) { - return getParameterValue(getParameter(name)); - } - - @Override - public Object getParameterValue(final int index) { - return getParameterValue(getParameter(index)); - } - - @Override - public TypedQuery setParameter(final int position, final Calendar value, final TemporalType temporalType) { - parameters.put(param(position), _(value, temporalType)); - return this; - } - - @Override - public TypedQuery setFlushMode(final FlushModeType flushMode) { - return this; - } - - @Override - public FlushModeType getFlushMode() { - return null; - } - - @Override - public TypedQuery setLockMode(final LockModeType lockModeType) { - return null; - } - - @Override - public LockModeType getLockMode() { - return null; - } - - @Override - public T unwrap(final Class tClass) { - return null; - } -} diff --git a/spring-data-neo4j-roo/src/main/java/org/springframework/data/graph/neo4j/jpa/Neo4jEntityManager.java b/spring-data-neo4j-roo/src/main/java/org/springframework/data/graph/neo4j/jpa/Neo4jEntityManager.java deleted file mode 100644 index db42a9c0a..000000000 --- a/spring-data-neo4j-roo/src/main/java/org/springframework/data/graph/neo4j/jpa/Neo4jEntityManager.java +++ /dev/null @@ -1,339 +0,0 @@ -/** - * 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.graph.neo4j.jpa; - -import org.neo4j.graphdb.*; -import org.springframework.beans.factory.annotation.Configurable; -import org.springframework.data.graph.core.NodeBacked; -import org.springframework.data.graph.neo4j.repository.DirectGraphRepositoryFactory; -import org.springframework.data.graph.neo4j.support.GraphDatabaseContext; -import org.springframework.transaction.annotation.Transactional; - -import javax.annotation.Resource; -import javax.persistence.*; -import javax.persistence.criteria.CriteriaBuilder; -import javax.persistence.criteria.CriteriaQuery; -import javax.persistence.metamodel.Metamodel; -import javax.persistence.spi.PersistenceUnitInfo; -import javax.transaction.*; -import java.util.Map; - -/** - * @author Michael Hunger - * @since 20.08.2010 - * TODO Relationships - */ -//@Service -@Transactional -@Configurable -public class Neo4jEntityManager implements EntityManager { - private GraphDatabaseContext graphDatabaseContext; - private PersistenceUnitInfo info; - - private Map params; - private volatile boolean closed; - private final DirectGraphRepositoryFactory graphRepositoryFactory; - - @Resource - private EntityManagerFactory entityManagerFactory; - - public Neo4jEntityManager(final GraphDatabaseContext graphDatabaseContext,final PersistenceUnitInfo info, final Map params) { - this.graphDatabaseContext = graphDatabaseContext; - this.info = info; - this.params = params; - graphRepositoryFactory = new DirectGraphRepositoryFactory(graphDatabaseContext); - } - - public Neo4jEntityManager() { - graphRepositoryFactory = new DirectGraphRepositoryFactory(graphDatabaseContext); - } - - private Node nodeFor(final Object entity) { - checkClosed(); - if (!(entity instanceof NodeBacked)) throw new IllegalArgumentException("Not a nodebacked entity " + entity); - final Node node = ((NodeBacked) entity).getPersistentState(); - if (node == null) throw new IllegalArgumentException("Node of entity " + entity + " is null"); - return node; - } - - @Override - public void persist(final Object entity) { - checkClosed(); - //todo nodebacked justwriteback, no check - } - - @Override - public T merge(final T entity) { - checkClosed(); - // todo nodebacked merge - return entity; - } - - @Override - public void remove(final Object entity) { - final Node node = nodeFor(entity); - for (final Relationship r : node.getRelationships()) { - r.delete(); - } - node.delete(); - } - - @SuppressWarnings({"unchecked"}) - @Override - public T find(final Class entityClass, final Object primaryKey) { - checkClosed(); - if (!NodeBacked.class.isAssignableFrom(entityClass)) - throw new IllegalArgumentException("Not a nodebacked entity type " + entityClass); - if (!(primaryKey instanceof Number)) - throw new IllegalArgumentException("Primary Key for entity type " + entityClass + " is not a number " + primaryKey); - final Node node = graphDatabaseContext.getNodeById(((Number) primaryKey).longValue()); - return (T) graphDatabaseContext.createEntityFromState(node, (Class) entityClass); - } - - @Override - public T find(final Class entityClass, final Object primaryKey, final Map params) { - return find(entityClass, primaryKey); - } - - @Override - public T find(final Class entityClass, final Object primaryKey, final LockModeType lockModeType) { - return find(entityClass, primaryKey); - } - - @Override - public T find(final Class entityClass, final Object primaryKey, final LockModeType lockModeType, final Map params) { - return find(entityClass, primaryKey); - } - - @Override - public T getReference(final Class entityClass, final Object primaryKey) { - return find(entityClass, primaryKey); - } - - @Override - public void flush() { - checkClosed(); - } - - @Override - public void setFlushMode(final FlushModeType flushMode) { - checkClosed(); - } - - @Override - public FlushModeType getFlushMode() { - checkClosed(); - return FlushModeType.AUTO; - } - - @Override - public void lock(final Object entity, final LockModeType lockModeType) { - nodeFor(entity); - } - - @Override - public void lock(final Object entity, final LockModeType lockModeType, final Map params) { - lock(entity,lockModeType); - } - - @Override - public void refresh(final Object entity) { - // todo nodebacked.refresh, throw away dirty - nodeFor(entity); - } - - @Override - public void refresh(final Object entity, final Map params) { - refresh(entity); - } - - @Override - public void refresh(final Object entity, final LockModeType lockModeType) { - refresh(entity); - } - - @Override - public void refresh(final Object entity, final LockModeType lockModeType, final Map params) { - refresh(entity); - } - - /** - * Clear the persistence context, causing all managed entities to become detached. - */ - @Override - public void clear() { - checkClosed(); - } - - @Override - public void detach(final Object entity) { - } - - @Override - public boolean contains(final Object entity) { - checkClosed(); - try { - return nodeFor(entity) != null; - } catch (IllegalArgumentException e) { - return false; - } - } - - @Override - public LockModeType getLockMode(final Object entity) { - return LockModeType.NONE; // todo use neo4j locks? - } - - @Override - public void setProperty(final String name, final Object value) { - params.put(name,value); - } - - @Override - public Map getProperties() { - return params; - } - - /* - TODO Gremlin - */ - - @Override - public Query createQuery(final String qlString) { - return createQuery(qlString,null); - } - - @Override - public TypedQuery createQuery(final CriteriaQuery query) { - return null; - } - - @SuppressWarnings({"unchecked"}) - @Override - public TypedQuery createQuery(final String qlString, final Class entityClass) { - checkClosed(); - return (TypedQuery)createNeo4jQuery(qlString,entityClass); - } - - public TypedQuery createNeo4jQuery(final String qlString, final Class entityClass) { - return new Neo4JQuery(qlString, graphRepositoryFactory,info,entityClass); - } - - /* - TODO Gremlin - */ - - @Override - public Query createNamedQuery(final String name) { - checkClosed(); - throw new UnsupportedOperationException(); - } - - @Override - public TypedQuery createNamedQuery(final String s, final Class entityClass) { - return null; - } - - /* - TODO Gremlin - */ - - @Override - public Query createNativeQuery(final String sqlString) { - checkClosed(); - throw new UnsupportedOperationException(); - } - - /* - TODO Gremlin - */ - - @Override - public Query createNativeQuery(final String sqlString, final Class resulentityClass) { - checkClosed(); - throw new UnsupportedOperationException(); - } - - /* - TODO Gremlin - */ - - @Override - public Query createNativeQuery(final String sqlString, final String resultSetMapping) { - checkClosed(); - throw new UnsupportedOperationException(); - } - - /* - TODO Johan - */ - - @Override - public void joinTransaction() { - checkClosed(); - throw new UnsupportedOperationException(); - } - - @Override - public T unwrap(final Class entityClass) { - return null; - } - - @Override - public Object getDelegate() { - checkClosed(); - return graphDatabaseContext; - } - - @Override - public void close() { - checkClosed(); - this.closed = true; - } - - @Override - public boolean isOpen() { - return !closed; - } - - private void checkClosed() { - if (closed) throw new IllegalStateException("EntityManager is closed"); - } - - @Override - public EntityTransaction getTransaction() { - final TransactionManager transactionManager = graphDatabaseContext.getTxManager(); - return new Neo4jEntityTransaction(transactionManager); - } - - @Override - public EntityManagerFactory getEntityManagerFactory() { - return entityManagerFactory; - } - - @Override - public CriteriaBuilder getCriteriaBuilder() { - return null; - } - - @Override - public Metamodel getMetamodel() { - return null; - } - - -} diff --git a/spring-data-neo4j-roo/src/main/java/org/springframework/data/graph/neo4j/jpa/Neo4jEntityManagerFactory.java b/spring-data-neo4j-roo/src/main/java/org/springframework/data/graph/neo4j/jpa/Neo4jEntityManagerFactory.java deleted file mode 100644 index a1fab7298..000000000 --- a/spring-data-neo4j-roo/src/main/java/org/springframework/data/graph/neo4j/jpa/Neo4jEntityManagerFactory.java +++ /dev/null @@ -1,90 +0,0 @@ -/** - * 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.graph.neo4j.jpa; - -import org.springframework.data.graph.neo4j.support.GraphDatabaseContext; - -import javax.persistence.Cache; -import javax.persistence.EntityManager; -import javax.persistence.EntityManagerFactory; -import javax.persistence.PersistenceUnitUtil; -import javax.persistence.criteria.CriteriaBuilder; -import javax.persistence.metamodel.Metamodel; -import javax.persistence.spi.PersistenceUnitInfo; -import java.util.Collections; -import java.util.Map; - -/** - * @author Michael Hunger - * @since 23.08.2010 - */ -public class Neo4jEntityManagerFactory implements EntityManagerFactory { - private PersistenceUnitInfo info; - private Map params; - private final GraphDatabaseContext graphDatabaseContext; - - public Neo4jEntityManagerFactory(GraphDatabaseContext graphDatabaseContext, PersistenceUnitInfo info, Map params) { - this.graphDatabaseContext = graphDatabaseContext; - this.info = info; - this.params = params; - } - - @Override - public EntityManager createEntityManager() { - return new Neo4jEntityManager(graphDatabaseContext,info,params); - } - - /* TODO handle different directories for target datastore */ - @Override - public EntityManager createEntityManager(Map map) { - return new Neo4jEntityManager(graphDatabaseContext,info,params); - } - - @Override - public CriteriaBuilder getCriteriaBuilder() { - return null; - } - - @Override - public Metamodel getMetamodel() { - return null; - } - - @Override - public void close() { - } - - @Override - public Map getProperties() { - return Collections.emptyMap(); - } - - @Override - public Cache getCache() { - return null; - } - - @Override - public PersistenceUnitUtil getPersistenceUnitUtil() { - return null; - } - - @Override - public boolean isOpen() { - return true; - } -} diff --git a/spring-data-neo4j-roo/src/main/java/org/springframework/data/graph/neo4j/jpa/Neo4jEntityTransaction.java b/spring-data-neo4j-roo/src/main/java/org/springframework/data/graph/neo4j/jpa/Neo4jEntityTransaction.java deleted file mode 100644 index 94c4a4f0d..000000000 --- a/spring-data-neo4j-roo/src/main/java/org/springframework/data/graph/neo4j/jpa/Neo4jEntityTransaction.java +++ /dev/null @@ -1,94 +0,0 @@ -/** - * 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.graph.neo4j.jpa; - -import javax.persistence.EntityTransaction; -import javax.transaction.*; - -/** - * @author Michael Hunger - * @since 20.08.2010 - */ -class Neo4jEntityTransaction implements EntityTransaction { - private final TransactionManager transactionManager; - - public Neo4jEntityTransaction(final TransactionManager transactionManager) { - this.transactionManager = transactionManager; - } - - @Override - public void begin() { - try { - transactionManager.begin(); - } catch (SystemException e) { - throw new IllegalStateException(e); - } catch (NotSupportedException e) { - throw new IllegalStateException(e); - } - } - - @Override - public void commit() { - try { - transactionManager.commit(); - } catch (SystemException e) { - throw new IllegalStateException(e); - } catch (HeuristicRollbackException e) { - throw new IllegalStateException(e); - } catch (HeuristicMixedException e) { - throw new IllegalStateException(e); - } catch (RollbackException e) { - throw new IllegalStateException(e); - } - } - - @Override - public void rollback() { - try { - transactionManager.rollback(); - } catch (SystemException e) { - throw new IllegalStateException(e); - } - } - - @Override - public void setRollbackOnly() { - try { - transactionManager.setRollbackOnly(); - } catch (SystemException e) { - throw new IllegalStateException(e); - } - } - - @Override - public boolean getRollbackOnly() { - try { - return transactionManager.getStatus() == Status.STATUS_MARKED_ROLLBACK; - } catch (SystemException e) { - throw new IllegalStateException(e); - } - } - - @Override - public boolean isActive() { - try { - return transactionManager.getStatus() == Status.STATUS_ACTIVE; - } catch (SystemException e) { - throw new IllegalStateException(e); - } - } -} diff --git a/spring-data-neo4j-roo/src/main/java/org/springframework/data/graph/neo4j/jpa/Neo4jJpaDialect.java b/spring-data-neo4j-roo/src/main/java/org/springframework/data/graph/neo4j/jpa/Neo4jJpaDialect.java deleted file mode 100644 index a06e2b37c..000000000 --- a/spring-data-neo4j-roo/src/main/java/org/springframework/data/graph/neo4j/jpa/Neo4jJpaDialect.java +++ /dev/null @@ -1,86 +0,0 @@ -/** - * 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.graph.neo4j.jpa; - -import org.springframework.dao.DataAccessException; -import org.springframework.jdbc.datasource.ConnectionHandle; -import org.springframework.orm.jpa.EntityManagerFactoryPlusOperations; -import org.springframework.orm.jpa.EntityManagerPlusOperations; -import org.springframework.orm.jpa.JpaDialect; -import org.springframework.transaction.TransactionDefinition; -import org.springframework.transaction.TransactionException; - -import javax.persistence.EntityManager; -import javax.persistence.EntityManagerFactory; -import javax.persistence.PersistenceException; -import java.sql.SQLException; - -/** - * @author Michael Hunger - * @since 23.08.2010 - */ -public class Neo4jJpaDialect implements JpaDialect { - @Override - public boolean supportsEntityManagerFactoryPlusOperations() { - return false; - } - - @Override - public boolean supportsEntityManagerPlusOperations() { - return false; - } - - @Override - public EntityManagerFactoryPlusOperations getEntityManagerFactoryPlusOperations(final EntityManagerFactory entityManagerFactory) { - return null; - } - - @Override - public EntityManagerPlusOperations getEntityManagerPlusOperations(final EntityManager entityManager) { - return null; - } - - // todo - @Override - public Object beginTransaction(final EntityManager entityManager, final TransactionDefinition transactionDefinition) throws PersistenceException, SQLException, TransactionException { - return null; - } - - @Override - public Object prepareTransaction(final EntityManager entityManager, final boolean b, final String s) throws PersistenceException { - return null; - } - - @Override - public void cleanupTransaction(final Object o) { - } - - @Override - public ConnectionHandle getJdbcConnection(final EntityManager entityManager, final boolean b) throws PersistenceException, SQLException { - return null; - } - - @Override - public void releaseJdbcConnection(final ConnectionHandle connectionHandle, final EntityManager entityManager) throws PersistenceException, SQLException { - } - - // todo - @Override - public DataAccessException translateExceptionIfPossible(final RuntimeException e) { - return null; - } -} diff --git a/spring-data-neo4j-roo/src/main/java/org/springframework/data/graph/neo4j/jpa/Neo4jPersistenceProvider.java b/spring-data-neo4j-roo/src/main/java/org/springframework/data/graph/neo4j/jpa/Neo4jPersistenceProvider.java deleted file mode 100644 index d6fb1fc31..000000000 --- a/spring-data-neo4j-roo/src/main/java/org/springframework/data/graph/neo4j/jpa/Neo4jPersistenceProvider.java +++ /dev/null @@ -1,78 +0,0 @@ -/** - * 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.graph.neo4j.jpa; - -import org.springframework.beans.factory.annotation.Configurable; -import org.springframework.data.graph.neo4j.support.GraphDatabaseContext; - -import javax.annotation.Resource; -import javax.persistence.EntityManagerFactory; -import javax.persistence.spi.LoadState; -import javax.persistence.spi.PersistenceProvider; -import javax.persistence.spi.PersistenceUnitInfo; -import javax.persistence.spi.ProviderUtil; -import java.util.Map; - -/** - * @author Michael Hunger - * @since 23.08.2010 - */ -// todo handle additinal info + database path -@Configurable -public class Neo4jPersistenceProvider implements PersistenceProvider { - @Resource - private GraphDatabaseContext graphDatabaseContext; - - @Override - public EntityManagerFactory createEntityManagerFactory(String emName, Map params) { - System.out.println("emName = " + emName); - System.out.println("params = " + params); - return new Neo4jEntityManagerFactory(graphDatabaseContext, null,params); - } - - @Override - public EntityManagerFactory createContainerEntityManagerFactory(PersistenceUnitInfo info, Map params) { - System.out.println("info.getPersistenceProviderClassName() = " + info.getPersistenceProviderClassName()); - System.out.println("info.getManagedClassNames() = " + info.getManagedClassNames()); - System.out.println("info.getMappingFileNames() = " + info.getMappingFileNames()); - System.out.println("info.getTransactionType() = " + info.getTransactionType()); - System.out.println("info.getProperties() = " + info.getProperties()); - System.out.println("info.getPersistenceUnitName() = " + info.getPersistenceUnitName()); - System.out.println("params = " + params); - return new Neo4jEntityManagerFactory(graphDatabaseContext,info,params); - } - - @Override - public ProviderUtil getProviderUtil() { - return new ProviderUtil(){ - @Override - public LoadState isLoadedWithoutReference(Object o, String s) { - return LoadState.UNKNOWN; - } - - @Override - public LoadState isLoadedWithReference(Object o, String s) { - return LoadState.UNKNOWN; - } - - @Override - public LoadState isLoaded(Object o) { - return LoadState.UNKNOWN; - } - }; - } -} diff --git a/spring-data-neo4j-roo/src/main/java/org/springframework/data/graph/neo4j/jpa/Neo4jQueryParameter.java b/spring-data-neo4j-roo/src/main/java/org/springframework/data/graph/neo4j/jpa/Neo4jQueryParameter.java deleted file mode 100644 index 97f0b77a1..000000000 --- a/spring-data-neo4j-roo/src/main/java/org/springframework/data/graph/neo4j/jpa/Neo4jQueryParameter.java +++ /dev/null @@ -1,53 +0,0 @@ -/** - * 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.graph.neo4j.jpa; - -import javax.persistence.Parameter; -/** - * @author Michael Hunger - * @since 11.09.2010 - */ -public class Neo4jQueryParameter implements Parameter { - private final Class type; - private final String name; - private final Integer position; - - public Neo4jQueryParameter(Class type, String name, Integer position) { - this.type = type; - this.name = name; - this.position = position; - } - - @Override - public String getName() { - return name; - } - - @Override - public Integer getPosition() { - return position; - } - - @Override - public Class getParameterType() { - return type; - } - - public static Parameter param(String name) { return new Neo4jQueryParameter(null,name,null);} - public static Parameter param(Integer position) { return new Neo4jQueryParameter(null,null,position);} - public static Parameter param(Class type, String name, Integer position) { return new Neo4jQueryParameter(type,name,position);} -} diff --git a/spring-data-neo4j-roo/src/test/java/org/springframework/data/graph/neo4j/Car.java b/spring-data-neo4j-roo/src/test/java/org/springframework/data/graph/neo4j/Car.java deleted file mode 100644 index 56497188a..000000000 --- a/spring-data-neo4j-roo/src/test/java/org/springframework/data/graph/neo4j/Car.java +++ /dev/null @@ -1,30 +0,0 @@ -/** - * 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.graph.neo4j; - -import org.neo4j.graphdb.Node; -import org.springframework.data.graph.annotation.NodeEntity; - -@NodeEntity -public abstract class Car { - public Car() { - } - - public Car(Node n) { - setPersistentState(n); - } -} diff --git a/spring-data-neo4j-roo/src/test/java/org/springframework/data/graph/neo4j/Friendship.java b/spring-data-neo4j-roo/src/test/java/org/springframework/data/graph/neo4j/Friendship.java deleted file mode 100644 index da0bbdb76..000000000 --- a/spring-data-neo4j-roo/src/test/java/org/springframework/data/graph/neo4j/Friendship.java +++ /dev/null @@ -1,97 +0,0 @@ -/** - * 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.graph.neo4j; - - -import org.springframework.data.graph.annotation.EndNode; -import org.springframework.data.graph.annotation.RelationshipEntity; -import org.springframework.data.graph.annotation.StartNode; -import org.springframework.data.graph.neo4j.Person; -import static org.springframework.data.graph.neo4j.Person.persistedPerson; -import static org.springframework.data.graph.neo4j.Person.persistedPerson; - -import java.util.Date; - -@RelationshipEntity(useShortNames = false) -public class Friendship { - - public Friendship() { - } - - public Friendship(Person p1, Person p2) { - this.p1 = p1; - this.p2 = p2; - } - - public Friendship(Person p1, Person p2, int years) { - this.p1 = p1; - this.p2 = p2; - this.years = years; - } - - @StartNode - private Person p1; - - @EndNode - private Person p2; - - private int years; - - private Date firstMeetingDate; - - private transient String latestLocation; - - public void setPerson1(Person p) { - p1 = p; - } - - public Person getPerson1() { - return p1; - } - - public void setPerson2(Person p) { - p2 = p; - } - - public Person getPerson2() { - return p2; - } - - public void setYears(int years) { - this.years = years; - } - - public int getYears() { - return years; - } - - public void setFirstMeetingDate(Date firstMeetingDate) { - this.firstMeetingDate = firstMeetingDate; - } - - public Date getFirstMeetingDate() { - return firstMeetingDate; - } - - public void setLatestLocation(String latestLocation) { - this.latestLocation = latestLocation; - } - - public String getLatestLocation() { - return latestLocation; - } -} diff --git a/spring-data-neo4j-roo/src/test/java/org/springframework/data/graph/neo4j/Person.java b/spring-data-neo4j-roo/src/test/java/org/springframework/data/graph/neo4j/Person.java deleted file mode 100644 index f762905b8..000000000 --- a/spring-data-neo4j-roo/src/test/java/org/springframework/data/graph/neo4j/Person.java +++ /dev/null @@ -1,211 +0,0 @@ -/** - * 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.graph.neo4j; - -import org.springframework.data.annotation.Indexed; -import org.springframework.data.graph.annotation.GraphId; -import org.springframework.data.graph.annotation.NodeEntity; -import org.springframework.data.graph.annotation.RelatedTo; -import org.springframework.data.graph.annotation.RelatedToVia; -import org.springframework.data.graph.core.Direction; - -import java.util.Date; - - -@NodeEntity(useShortNames = false) -public class Person -{ - - public static final String NAME_INDEX = "name_index"; - @GraphId - private Long graphId; - - @Indexed(indexName = NAME_INDEX) - private String name; - - @Indexed - private String nickname; - - private int age; - - private Short height; - - private transient String thought; - - private Personality personality; - - private Date birthdate; - - private Person spouse; - - private Car car; - - @RelatedTo(type = "mother", direction = Direction.OUTGOING) - private Person mother; - - @RelatedTo(type = "boss", direction = Direction.INCOMING) - private Person boss; - - @RelatedToVia(type = "knows", elementClass = Friendship.class) - private Iterable friendships; - - public Person() - { - } - - public Person( String name, int age ) - { - this.name = name; - this.age = age; - } - - public String getName() - { - return name; - } - - public void setName( String name ) - { - this.name = name; - } - - public int getAge() - { - return age; - } - - public void setAge( int age ) - { - this.age = age; - } - - public Short getHeight() - { - return height; - } - - public void setHeight( Short height ) - { - this.height = height; - } - - - public Person getSpouse() - { - return spouse; - } - - public void setSpouse( Person spouse ) - { - this.spouse = spouse; - } - - public Person getMother() - { - return mother; - } - - public void setMother( Person mother ) - { - this.mother = mother; - } - - public Person getBoss() - { - return boss; - } - - public void setBoss( Person boss ) - { - this.boss = boss; - } - - @Override - public String toString() - { - return name; - } - - public Iterable getFriendships() - { - return friendships; - } - - public void setFriendships( Iterable f ) - { - friendships = f; - } - - public Friendship knows( Person p ) - { - return (Friendship) relateTo( p, Friendship.class, "knows" ); - } - - public void setPersonality( Personality personality ) - { - this.personality = personality; - } - - public Personality getPersonality() - { - return personality; - } - - public void setThought( String thought ) - { - this.thought = thought; - } - - public String getThought() - { - return thought; - } - - public Date getBirthdate() - { - return birthdate; - } - - public void setBirthdate( Date birthdate ) - { - this.birthdate = birthdate; - } - - public long getId() - { - return graphId; - } - - public void setCar( Car car ) - { - this.car = car; - } - - public Car getCar() - { - return car; - } - - public void setNickname( String nickname ) - { - this.nickname = nickname; - } - - public static Person persistedPerson(String name, int age) { - return new Person(name,age).persist(); - } -} diff --git a/spring-data-neo4j-roo/src/test/java/org/springframework/data/graph/neo4j/Personality.java b/spring-data-neo4j-roo/src/test/java/org/springframework/data/graph/neo4j/Personality.java deleted file mode 100644 index 7e54658dc..000000000 --- a/spring-data-neo4j-roo/src/test/java/org/springframework/data/graph/neo4j/Personality.java +++ /dev/null @@ -1,21 +0,0 @@ -/** - * 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.graph.neo4j; - -public enum Personality { - EXTROVERT, INTROVERT -} diff --git a/spring-data-neo4j-roo/src/test/java/org/springframework/data/graph/neo4j/jpa/Neo4jEntityManagerTest.java b/spring-data-neo4j-roo/src/test/java/org/springframework/data/graph/neo4j/jpa/Neo4jEntityManagerTest.java deleted file mode 100644 index 9d30bda03..000000000 --- a/spring-data-neo4j-roo/src/test/java/org/springframework/data/graph/neo4j/jpa/Neo4jEntityManagerTest.java +++ /dev/null @@ -1,227 +0,0 @@ -/** - * 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.graph.neo4j.jpa; - -import static java.util.Arrays.asList; -import static org.junit.Assert.assertEquals; -import static org.junit.Assert.assertFalse; -import static org.junit.Assert.assertNull; -import static org.junit.Assert.assertTrue; - -import javax.annotation.Resource; -import javax.persistence.EntityManager; -import javax.persistence.EntityTransaction; -import javax.persistence.PersistenceContext; -import javax.persistence.Query; - -import org.junit.*; -import org.junit.runner.RunWith; -import org.neo4j.graphdb.Node; -import org.springframework.dao.InvalidDataAccessApiUsageException; -import org.springframework.data.graph.neo4j.Person; -import static org.springframework.data.graph.neo4j.Person.persistedPerson; -import static org.springframework.data.graph.neo4j.Person.persistedPerson; -import org.springframework.data.graph.neo4j.support.GraphDatabaseContext; -import org.springframework.data.graph.neo4j.support.node.Neo4jHelper; -import org.springframework.test.context.ContextConfiguration; -import org.springframework.test.context.junit4.SpringJUnit4ClassRunner; -import org.springframework.test.context.transaction.BeforeTransaction; -import org.springframework.transaction.annotation.Transactional; - -import java.util.Collection; -import java.util.Collections; -import java.util.HashSet; - -/** - * @author Michael Hunger - * @since 20.08.2010 - */ -@RunWith(SpringJUnit4ClassRunner.class) -@ContextConfiguration -@Transactional -public class Neo4jEntityManagerTest { - @Resource - GraphDatabaseContext graphDatabaseContext; - @PersistenceContext(unitName="neo4j-persistence") - EntityManager entityManager; - - Person person; - private Node node; - - - @BeforeTransaction - public void cleanDb() { - Neo4jHelper.cleanDb(graphDatabaseContext); - } - - @Before - public void setUp() { - person = persistedPerson("Michael", 35); - node = person.getPersistentState(); - } - - @Test - public void testPersist() throws Exception { - entityManager.persist(person); - } - - @Test - public void testMerge() throws Exception { - Person merged=entityManager.merge(person); - assertEquals(person,merged); - } - @Ignore - @Test - public void testRemove() throws Exception { - long nodeId=node.getId(); - entityManager.remove(person); - final Node foundNode = graphDatabaseContext.getNodeById(nodeId); - assertNull(foundNode); - } - @Test - public void testFind() throws Exception { - final Person found = entityManager.find(Person.class, node.getId()); - assertEquals(person,found); - } - @Test - public void testFindSingle() throws Exception { - final Query query = entityManager.createQuery("select o from Person o"); - final Person found = (Person) query.getSingleResult(); - assertEquals(person,found); - } - @Test - public void testFindAll() throws Exception { - final Query query = entityManager.createQuery("select o from Person o"); - Collection people=query.getResultList(); - Assert.assertEquals(asList(person),people); - } - - @Test - public void testFindAll2() throws Exception { - final Person person2 = persistedPerson("Rod", 39); - final Query query = entityManager.createQuery("select o from Person o"); - Collection people=query.getResultList(); - Assert.assertEquals(new HashSet(asList(person,person2)),new HashSet(people)); - } - @Test - public void testFindAllStart() throws Exception { - final Query query = entityManager.createQuery("select o from Person o").setFirstResult(1); - Collection people=query.getResultList(); - Assert.assertEquals(Collections.emptySet(),new HashSet(people)); - } - @Test - public void testFindAllEnd() throws Exception { - final Query query = entityManager.createQuery("select o from Person o").setMaxResults(0); - Collection people=query.getResultList(); - Assert.assertEquals(Collections.emptySet(),new HashSet(people)); - } - @Test - public void testFindAllStartEnd() throws Exception { - persistedPerson("Rod", 39); - final Query query = entityManager.createQuery("select o from Person o").setMaxResults(1).setFirstResult(1); - Collection people=query.getResultList(); - Assert.assertEquals(1,people.size()); - } - - @Test - public void testGetReference() throws Exception { - final Person found = entityManager.getReference(Person.class, node.getId()); - assertEquals(person,found); - } - - @Test - public void testFlush() throws Exception { - } - - @Test - public void testSetFlushMode() throws Exception { - } - - @Test - public void testGetFlushMode() throws Exception { - } - - @Test - public void testLock() throws Exception { - } - - @Test - public void testRefresh() throws Exception { - entityManager.refresh(person); - assertEquals(node, person.getPersistentState()); - } - @Test - public void testClear() throws Exception { - } - - @Test(expected=InvalidDataAccessApiUsageException.class) - public void removeThrowsErrorForNonNodeBacked() throws Exception { - entityManager.remove(new Object()); - } - - @Test - public void testContains() throws Exception { - final Person p2 = persistedPerson("Rod", 39); - assertTrue(entityManager.contains(person)); - assertTrue(entityManager.contains(p2)); - assertFalse(entityManager.contains(new Object())); - } -/* - @Test - public void testCreateQuery() throws Exception { - } - - @Test - public void testCreateNamedQuery() throws Exception { - } - - @Test - public void testCreateNativeQuery() throws Exception { - } - - @Test - public void testJoinTransaction() throws Exception { - } -*/ - @Test - public void testGetDelegate() throws Exception { - assertTrue(entityManager.getDelegate() instanceof GraphDatabaseContext); - } - - @Ignore("Springs shared EM does not honor the contract of close") - @Test(expected=InvalidDataAccessApiUsageException.class) - public void testClose() throws Exception { - entityManager.close(); - assertFalse(entityManager.isOpen()); - entityManager.refresh(person); - } - - @Test - public void testIsOpen() throws Exception { - assertTrue(entityManager.isOpen()); - } - - @Ignore("Springs shared EM does not allow getTransaction") - @Test - public void testGetTransaction() throws Exception { - final EntityTransaction transaction = entityManager.getTransaction(); - assertFalse(transaction.getRollbackOnly()); - person.setName("Michael"); - entityManager.persist(person); - transaction.setRollbackOnly(); - } -} diff --git a/spring-data-neo4j-roo/src/test/resources/META-INF/persistence-neo4j.xml b/spring-data-neo4j-roo/src/test/resources/META-INF/persistence-neo4j.xml deleted file mode 100644 index 5b4ee42c8..000000000 --- a/spring-data-neo4j-roo/src/test/resources/META-INF/persistence-neo4j.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - - - org.springframework.data.graph.neo4j.jpa.Neo4jPersistenceProvider - org.springframework.data.graph.neo4j.Person - org.springframework.data.graph.neo4j.Group - org.springframework.data.graph.neo4j.Friendship - - - - - diff --git a/spring-data-neo4j-roo/src/test/resources/META-INF/persistence.xml b/spring-data-neo4j-roo/src/test/resources/META-INF/persistence.xml deleted file mode 100644 index 381d7c104..000000000 --- a/spring-data-neo4j-roo/src/test/resources/META-INF/persistence.xml +++ /dev/null @@ -1,15 +0,0 @@ - - - - - org.hibernate.ejb.HibernatePersistence - org.springframework.data.graph.neo4j.partial.User - org.springframework.data.graph.neo4j.partial.Restaurant - - - - - - diff --git a/spring-data-neo4j-roo/src/test/resources/META-INF/spring/database.properties b/spring-data-neo4j-roo/src/test/resources/META-INF/spring/database.properties deleted file mode 100644 index 6dda8e5d5..000000000 --- a/spring-data-neo4j-roo/src/test/resources/META-INF/spring/database.properties +++ /dev/null @@ -1,6 +0,0 @@ -#Updated at Tue Mar 23 14:26:10 PDT 2010 -#Tue Mar 23 14:26:10 PDT 2010 -database.password= -database.url=jdbc\:hsqldb\:mem\:test -database.username=sa -database.driverClassName=org.hsqldb.jdbcDriver diff --git a/spring-data-neo4j-roo/src/test/resources/META-INF/spring/neo4j.properties b/spring-data-neo4j-roo/src/test/resources/META-INF/spring/neo4j.properties deleted file mode 100644 index f2ca3696a..000000000 --- a/spring-data-neo4j-roo/src/test/resources/META-INF/spring/neo4j.properties +++ /dev/null @@ -1 +0,0 @@ -neo4j.databaseDirectory=target/data/test \ No newline at end of file diff --git a/spring-data-neo4j-roo/src/test/resources/log4j.properties b/spring-data-neo4j-roo/src/test/resources/log4j.properties deleted file mode 100644 index 4233f2f0e..000000000 --- a/spring-data-neo4j-roo/src/test/resources/log4j.properties +++ /dev/null @@ -1,23 +0,0 @@ -log4j.rootLogger=WARN, stdout, R - -log4j.appender.stdout=org.apache.log4j.ConsoleAppender -log4j.appender.stdout.layout=org.apache.log4j.PatternLayout - -# Print the date in ISO 8601 format -log4j.appender.stdout.layout.ConversionPattern=%d [%t] %-5p %c - %m%n - -log4j.appender.R=org.apache.log4j.RollingFileAppender -log4j.appender.R.File=target/application.log - -log4j.appender.R.MaxFileSize=100KB -# Keep one backup file -log4j.appender.R.MaxBackupIndex=1 - -log4j.appender.R.layout=org.apache.log4j.PatternLayout -log4j.appender.R.layout.ConversionPattern=%p %t %c - %m%n - -log4j.category.org.springframework=WARN -#log4j.category.org.springframework.data=TRACE -#log4j.category.org.springframework.data.support=TRACE -#log4j.category.org.springframework.persistence=TRACE -#log4j.category.org.springframework.data.graph.neo4j.support=DEBUG diff --git a/spring-data-neo4j-roo/src/test/resources/org/springframework/data/graph/neo4j/jpa/Neo4jEntityManagerTest-context.xml b/spring-data-neo4j-roo/src/test/resources/org/springframework/data/graph/neo4j/jpa/Neo4jEntityManagerTest-context.xml deleted file mode 100644 index 41688e172..000000000 --- a/spring-data-neo4j-roo/src/test/resources/org/springframework/data/graph/neo4j/jpa/Neo4jEntityManagerTest-context.xml +++ /dev/null @@ -1,182 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - -