Browse files

DATAGRAPH-903 - Fixed integration tests creating static references to…

… GraphDatabaseService.
  • Loading branch information...
1 parent c890b3a commit 1a0eb2f8569f6c140ea6ac7d6598d537e45f23ab @mangrish mangrish committed Aug 24, 2016
Showing with 153 additions and 71 deletions.
  1. +10 −1 spring-data-neo4j/src/test/java/org/springframework/data/neo4j/examples/friends/FriendIT.java
  2. +36 −28 ...-data-neo4j/src/test/java/org/springframework/data/neo4j/examples/movies/MoviesIntegrationIT.java
  3. +9 −2 ...eo4j/src/test/java/org/springframework/data/neo4j/integration/conversion/ConversionServiceIT.java
  4. +7 −1 spring-data-neo4j/src/test/java/org/springframework/data/neo4j/queries/DerivedQueryIT.java
  5. +7 −2 ...-neo4j/src/test/java/org/springframework/data/neo4j/queries/DerivedRelationshipEntityQueryIT.java
  6. +7 −1 spring-data-neo4j/src/test/java/org/springframework/data/neo4j/queries/PagedQueryIT.java
  7. +7 −1 spring-data-neo4j/src/test/java/org/springframework/data/neo4j/queries/QueryIntegrationIT.java
  8. +9 −1 ...ata-neo4j/src/test/java/org/springframework/data/neo4j/repositories/ProgrammaticRepositoryIT.java
  9. +7 −1 spring-data-neo4j/src/test/java/org/springframework/data/neo4j/repositories/RepoScanningIT.java
  10. +10 −4 ...-data-neo4j/src/test/java/org/springframework/data/neo4j/repositories/RepositoryDefinitionIT.java
  11. +22 −24 spring-data-neo4j/src/test/java/org/springframework/data/neo4j/repository/cdi/CdiExtensionIT.java
  12. +7 −1 spring-data-neo4j/src/test/java/org/springframework/data/neo4j/template/Neo4jTemplateIT.java
  13. +7 −2 ...ata-neo4j/src/test/java/org/springframework/data/neo4j/transactions/TransactionIntegrationIT.java
  14. +8 −2 spring-data-neo4j/src/test/java/org/springframework/data/neo4j/util/IterableUtilsIT.java
View
11 ...ng-data-neo4j/src/test/java/org/springframework/data/neo4j/examples/friends/FriendIT.java
@@ -16,8 +16,10 @@
import static org.junit.Assert.*;
import org.junit.Before;
+import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
+import org.neo4j.graphdb.GraphDatabaseService;
import org.neo4j.ogm.cypher.Filter;
import org.neo4j.ogm.testutil.MultiDriverTestClass;
import org.springframework.beans.factory.annotation.Autowired;
@@ -36,15 +38,22 @@
@RunWith(SpringJUnit4ClassRunner.class)
public class FriendIT extends MultiDriverTestClass {
+ private static GraphDatabaseService graphDatabaseService;
+
@Autowired Neo4jOperations neo4jTemplate;
@Autowired FriendshipRepository friendshipRepository;
@Autowired FriendService friendService;
+ @BeforeClass
+ public static void beforeClass(){
+ graphDatabaseService = getGraphDatabaseService();
+ }
+
@Before
public void cleanUpDatabase() {
neo4jTemplate.clear();
- getGraphDatabaseService().execute("MATCH (n) OPTIONAL MATCH (n)-[r]-() DELETE r, n");
+ graphDatabaseService.execute("MATCH (n) OPTIONAL MATCH (n)-[r]-() DELETE r, n");
}
/**
View
64 ...o4j/src/test/java/org/springframework/data/neo4j/examples/movies/MoviesIntegrationIT.java
@@ -22,9 +22,11 @@
import java.util.concurrent.Executors;
import org.junit.Before;
+import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.runner.RunWith;
+import org.neo4j.graphdb.GraphDatabaseService;
import org.neo4j.graphdb.Transaction;
import org.neo4j.ogm.cypher.Filter;
import org.neo4j.ogm.testutil.MultiDriverTestClass;
@@ -53,6 +55,7 @@
private final Logger logger = LoggerFactory.getLogger(MoviesIntegrationIT.class);
+ private static GraphDatabaseService graphDatabaseService;
@Autowired
private Neo4jOperations neo4jOperations;
@@ -73,26 +76,31 @@
@Autowired
private RatingRepository ratingRepository;
+ @BeforeClass
+ public static void beforeClass(){
+ graphDatabaseService = getGraphDatabaseService();
+ }
+
@Before
public void clear() {
neo4jOperations.clear();
- getGraphDatabaseService().execute("MATCH (n) OPTIONAL MATCH (n)-[r]-() DELETE r, n");
+ graphDatabaseService.execute("MATCH (n) OPTIONAL MATCH (n)-[r]-() DELETE r, n");
}
@Test
public void shouldSaveUser() {
User user = new User("Michal");
userRepository.save(user);
- assertSameGraph(getGraphDatabaseService(), "CREATE (u:User:Person {name:'Michal'})");
+ assertSameGraph(graphDatabaseService, "CREATE (u:User:Person {name:'Michal'})");
}
@Test
public void shouldSaveUserWithoutName() {
User user = new User();
userRepository.save(user);
- assertSameGraph(getGraphDatabaseService(), "CREATE (u:User:Person)");
+ assertSameGraph(graphDatabaseService, "CREATE (u:User:Person)");
}
@Test
@@ -106,7 +114,7 @@ public void shouldSaveReleasedMovie() {
abstractAnnotatedEntityRepository.save(releasedMovie);
- assertSameGraph(getGraphDatabaseService(),
+ assertSameGraph(graphDatabaseService,
"CREATE (m:ReleasedMovie:AbstractAnnotatedEntity {cinemaRelease:'1994-09-10T00:00:00.000Z'," +
"cannesRelease:768700800000,title:'Pulp Fiction'})");
}
@@ -120,7 +128,7 @@ public void shouldSaveReleasedMovie2() {
abstractAnnotatedEntityRepository.save(releasedMovie);
- assertSameGraph(getGraphDatabaseService(),
+ assertSameGraph(graphDatabaseService,
"CREATE (m:ReleasedMovie:AbstractAnnotatedEntity {cannesRelease:768700800000,title:'Pulp Fiction'})");
}
@@ -133,7 +141,7 @@ public void shouldSaveMovie() {
abstractEntityRepository.save(movie);
// byte arrays have to be transferred with a JSON-supported format. Base64 is the default.
- assertSameGraph(getGraphDatabaseService(), "CREATE (m:Movie {name:'Pulp Fiction', tags:['cool','classic'], " +
+ assertSameGraph(graphDatabaseService, "CREATE (m:Movie {name:'Pulp Fiction', tags:['cool','classic'], " +
"image:'AQID'})");
}
@@ -146,7 +154,7 @@ public void shouldSaveUsers() {
userRepository.save(set);
- assertSameGraph(getGraphDatabaseService(), "CREATE (:User:Person {name:'Michal'})," +
+ assertSameGraph(graphDatabaseService, "CREATE (:User:Person {name:'Michal'})," +
"(:User:Person {name:'Vince'})," +
"(:User:Person {name:'Adam'})");
@@ -162,7 +170,7 @@ public void shouldSaveUsers2() {
userRepository.save(list);
- assertSameGraph(getGraphDatabaseService(), "CREATE (:User:Person {name:'Michal'})," +
+ assertSameGraph(graphDatabaseService, "CREATE (:User:Person {name:'Michal'})," +
"(:User:Person {name:'Vince'})," +
"(:User:Person {name:'Adam'})");
@@ -175,7 +183,7 @@ public void shouldUpdateUserUsingRepository() {
user.setName("Adam");
userRepository.save(user);
- assertSameGraph(getGraphDatabaseService(), "CREATE (u:User:Person {name:'Adam'})");
+ assertSameGraph(graphDatabaseService, "CREATE (u:User:Person {name:'Adam'})");
}
@Test
@@ -189,7 +197,7 @@ public void shouldUpdateUserUsingTransactionalService() {
userService.updateUser(user, "Adam"); //notice userRepository.save(..) isn't called,
// not even in the service impl!
- assertSameGraph(getGraphDatabaseService(), "CREATE (u:User {name:'Adam'})");
+ assertSameGraph(graphDatabaseService, "CREATE (u:User {name:'Adam'})");
}
@Test
@@ -240,8 +248,8 @@ public void shouldDeleteUser() {
assertNull(userRepository.findOne(user.getId()));
assertNull(userRepository.findOne(user.getId(), 10));
- try (Transaction tx = getGraphDatabaseService().beginTx()) {
- assertFalse(getGraphDatabaseService().getAllNodes().iterator().hasNext());
+ try (Transaction tx = graphDatabaseService.beginTx()) {
+ assertFalse(graphDatabaseService.getAllNodes().iterator().hasNext());
tx.success();
}
}
@@ -282,7 +290,7 @@ public void shouldSaveUserAndNewGenre() {
userRepository.save(user);
- assertSameGraph(getGraphDatabaseService(), "CREATE (u:User:Person {name:'Michal'})-[:INTERESTED]->(g:Genre {name:'Drama'})");
+ assertSameGraph(graphDatabaseService, "CREATE (u:User:Person {name:'Michal'})-[:INTERESTED]->(g:Genre {name:'Drama'})");
}
@Test
@@ -294,7 +302,7 @@ public void shouldSaveUserAndNewGenres() {
userRepository.save(user);
- assertSameGraph(getGraphDatabaseService(), "CREATE " +
+ assertSameGraph(graphDatabaseService, "CREATE " +
"(u:User:Person {name:'Michal'})," +
"(g1:Genre {name:'Drama'})," +
"(g2:Genre {name:'Historical'})," +
@@ -311,7 +319,7 @@ public void shouldSaveUserAndNewGenre2() {
userRepository.save(user, 1);
- assertSameGraph(getGraphDatabaseService(), "CREATE (u:User:Person {name:'Michal'})-[:INTERESTED]->(g:Genre {name:'Drama'})");
+ assertSameGraph(graphDatabaseService, "CREATE (u:User:Person {name:'Michal'})-[:INTERESTED]->(g:Genre {name:'Drama'})");
}
@Test
@@ -327,7 +335,7 @@ public void shouldSaveUserAndExistingGenre() {
userRepository.save(vince);
- assertSameGraph(getGraphDatabaseService(), "CREATE " +
+ assertSameGraph(graphDatabaseService, "CREATE " +
"(m:User:Person {name:'Michal'})," +
"(v:User:Person {name:'Vince'})," +
"(g:Genre {name:'Drama'})," +
@@ -342,7 +350,7 @@ public void shouldSaveUserButNotGenre() {
userRepository.save(user, 0);
- assertSameGraph(getGraphDatabaseService(), "CREATE (u:User:Person {name:'Michal'})");
+ assertSameGraph(graphDatabaseService, "CREATE (u:User:Person {name:'Michal'})");
}
@Test
@@ -357,7 +365,7 @@ public void shouldUpdateGenreWhenSavedThroughUser() {
userRepository.save(michal);
- assertSameGraph(getGraphDatabaseService(), "CREATE " +
+ assertSameGraph(graphDatabaseService, "CREATE " +
"(m:User:Person {name:'Michal'})," +
"(g:Genre {name:'New Drama'})," +
"(m)-[:INTERESTED]->(g)");
@@ -375,7 +383,7 @@ public void shouldRemoveGenreFromUser() {
userRepository.save(michal);
- assertSameGraph(getGraphDatabaseService(), "CREATE " +
+ assertSameGraph(graphDatabaseService, "CREATE " +
"(m:User:Person {name:'Michal'})," +
"(g:Genre {name:'Drama'})");
}
@@ -390,7 +398,7 @@ public void shouldRemoveGenreFromUserUsingService() {
userService.notInterestedIn(michal.getId(), drama.getId());
- assertSameGraph(getGraphDatabaseService(), "CREATE " +
+ assertSameGraph(graphDatabaseService, "CREATE " +
"(m:User:Person {name:'Michal'})," +
"(g:Genre {name:'Drama'})");
}
@@ -402,7 +410,7 @@ public void shouldAddNewVisitorToCinema() {
cinemaRepository.save(cinema);
- assertSameGraph(getGraphDatabaseService(), "CREATE " +
+ assertSameGraph(graphDatabaseService, "CREATE " +
"(m:User:Person {name:'Michal'})," +
"(c:Theatre {name:'Odeon', capacity:0})," +
"(m)-[:VISITED]->(c)");
@@ -418,7 +426,7 @@ public void shouldAddExistingVisitorToCinema() {
cinemaRepository.save(cinema);
- assertSameGraph(getGraphDatabaseService(), "CREATE " +
+ assertSameGraph(graphDatabaseService, "CREATE " +
"(m:User:Person {name:'Michal'})," +
"(c:Theatre {name:'Odeon', capacity:0})," +
"(m)-[:VISITED]->(c)");
@@ -431,16 +439,16 @@ public void shouldBefriendPeople() {
userRepository.save(michal);
try {
- assertSameGraph(getGraphDatabaseService(), "CREATE (m:User {name:'Michal'})-[:FRIEND_OF]->(a:User:Person {name:'Adam'})");
+ assertSameGraph(graphDatabaseService, "CREATE (m:User {name:'Michal'})-[:FRIEND_OF]->(a:User:Person {name:'Adam'})");
} catch (AssertionError error) {
- assertSameGraph(getGraphDatabaseService(), "CREATE (m:User:Person {name:'Michal'})<-[:FRIEND_OF]-(a:User:Person {name:'Adam'})");
+ assertSameGraph(graphDatabaseService, "CREATE (m:User:Person {name:'Michal'})<-[:FRIEND_OF]-(a:User:Person {name:'Adam'})");
}
}
@Test
public void shouldLoadOutgoingFriendsWhenUndirected() {
- getGraphDatabaseService().execute("CREATE (m:User {name:'Michal'})-[:FRIEND_OF]->(a:User {name:'Adam'})");
+ graphDatabaseService.execute("CREATE (m:User {name:'Michal'})-[:FRIEND_OF]->(a:User {name:'Adam'})");
User michal = ((Iterable<User>) findByProperty(User.class, "name", "Michal")).iterator().next();
assertEquals(1, michal.getFriends().size());
@@ -456,7 +464,7 @@ public void shouldLoadOutgoingFriendsWhenUndirected() {
@Test
public void shouldLoadIncomingFriendsWhenUndirected() {
- getGraphDatabaseService().execute("CREATE (m:User {name:'Michal'})<-[:FRIEND_OF]-(a:User {name:'Adam'})");
+ graphDatabaseService.execute("CREATE (m:User {name:'Michal'})<-[:FRIEND_OF]-(a:User {name:'Adam'})");
User michal = ((Iterable<User>) findByProperty(User.class, "name", "Michal")).iterator().next();
assertEquals(1, michal.getFriends().size());
@@ -478,7 +486,7 @@ public void shouldSaveNewUserAndNewMovieWithRatings() {
User michal = ((Iterable<User>) findByProperty(User.class, "name", "Michal")).iterator().next();
- assertSameGraph(getGraphDatabaseService(), "CREATE (u:User:Person {name:'Michal'})-[:RATED {stars:5, " +
+ assertSameGraph(graphDatabaseService, "CREATE (u:User:Person {name:'Michal'})-[:RATED {stars:5, " +
"comment:'Best movie ever', ratingTimestamp:0}]->(m:Movie {name:'Pulp Fiction'})");
}
@@ -558,7 +566,7 @@ private void waitForNeo4jToStart(long maxTimeToWait) throws Neo4jFailedToStartEx
Transaction transaction;
do {
- transaction = getGraphDatabaseService().beginTx();
+ transaction = graphDatabaseService.beginTx();
} while (transaction == null && System.currentTimeMillis() - startTime <= maxTimeToWait);
if (transaction == null) {
View
11 .../test/java/org/springframework/data/neo4j/integration/conversion/ConversionServiceIT.java
@@ -21,6 +21,7 @@
import java.util.Arrays;
import org.junit.Before;
+import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.neo4j.graphdb.GraphDatabaseService;
@@ -48,7 +49,8 @@
@ContextConfiguration(classes = {ConversionServicePersistenceContext.class})
public class ConversionServiceIT extends MultiDriverTestClass {
- private GraphDatabaseService graphDatabaseService = getGraphDatabaseService();
+ private static GraphDatabaseService graphDatabaseService;
+
@Autowired
private PensionRepository pensionRepository;
@Autowired
@@ -60,9 +62,14 @@
@Autowired Neo4jOperations neo4jOperations;
+ @BeforeClass
+ public static void beforeClass(){
+ graphDatabaseService = getGraphDatabaseService();
+ }
+
@Before
public void cleanUpDatabase() {
- getGraphDatabaseService().execute("MATCH (n) OPTIONAL MATCH (n)-[r]-() DELETE r, n");
+ graphDatabaseService.execute("MATCH (n) OPTIONAL MATCH (n)-[r]-() DELETE r, n");
}
/**
View
8 spring-data-neo4j/src/test/java/org/springframework/data/neo4j/queries/DerivedQueryIT.java
@@ -23,6 +23,7 @@
import java.util.concurrent.Executors;
import org.junit.Before;
+import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.neo4j.graphdb.GraphDatabaseService;
@@ -55,7 +56,7 @@
@DirtiesContext
public class DerivedQueryIT extends MultiDriverTestClass {
- private static GraphDatabaseService graphDatabaseService = getGraphDatabaseService();
+ private static GraphDatabaseService graphDatabaseService;
@Autowired
private Neo4jOperations neo4jOperations;
@@ -72,6 +73,11 @@
@Autowired
private DirectorRepository directorRepository;
+ @BeforeClass
+ public static void beforeClass(){
+ graphDatabaseService = getGraphDatabaseService();
+ }
+
@Before
public void clearDatabase() {
graphDatabaseService.execute("MATCH (n) OPTIONAL MATCH (n)-[r]-() DELETE r, n");
View
9 ...rc/test/java/org/springframework/data/neo4j/queries/DerivedRelationshipEntityQueryIT.java
@@ -19,6 +19,7 @@
import java.util.List;
import org.junit.Before;
+import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.neo4j.graphdb.GraphDatabaseService;
@@ -44,8 +45,7 @@
@DirtiesContext
public class DerivedRelationshipEntityQueryIT extends MultiDriverTestClass {
- private static GraphDatabaseService graphDatabaseService = getGraphDatabaseService();
-
+ private static GraphDatabaseService graphDatabaseService;
@Autowired
private UserRepository userRepository;
@@ -59,6 +59,11 @@
@Autowired
private Neo4jOperations neo4jOperations;
+ @BeforeClass
+ public static void beforeClass(){
+ graphDatabaseService = getGraphDatabaseService();
+ }
+
@Before
public void clearDatabase() {
graphDatabaseService.execute("MATCH (n) OPTIONAL MATCH (n)-[r]-() DELETE r, n");
View
8 spring-data-neo4j/src/test/java/org/springframework/data/neo4j/queries/PagedQueryIT.java
@@ -20,6 +20,7 @@
import org.junit.After;
import org.junit.Before;
+import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.neo4j.graphdb.GraphDatabaseService;
@@ -50,13 +51,18 @@
@DirtiesContext
public class PagedQueryIT extends MultiDriverTestClass {
- private static GraphDatabaseService graphDatabaseService = getGraphDatabaseService();
+ private static GraphDatabaseService graphDatabaseService;
@Autowired
private CinemaRepository cinemaRepository;
@Autowired Neo4jOperations neo4jOperations;
+ @BeforeClass
+ public static void beforeClass(){
+ graphDatabaseService = getGraphDatabaseService();
+ }
+
@Before
public void init() {
clearDatabase();
View
8 ...g-data-neo4j/src/test/java/org/springframework/data/neo4j/queries/QueryIntegrationIT.java
@@ -20,6 +20,7 @@
import java.util.*;
import org.junit.Before;
+import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.neo4j.graphdb.GraphDatabaseService;
@@ -48,7 +49,7 @@
@DirtiesContext
public class QueryIntegrationIT extends MultiDriverTestClass {
- private static GraphDatabaseService graphDatabaseService = getGraphDatabaseService();
+ private static GraphDatabaseService graphDatabaseService;
@Autowired
private UserRepository userRepository;
@@ -64,6 +65,11 @@ public void init() {
clearDatabase();
}
+ @BeforeClass
+ public static void beforeClass(){
+ graphDatabaseService = getGraphDatabaseService();
+ }
+
@Before
public void clearDatabase() {
graphDatabaseService.execute("MATCH (n) OPTIONAL MATCH (n)-[r]-() DELETE r, n");
View
10 ...j/src/test/java/org/springframework/data/neo4j/repositories/ProgrammaticRepositoryIT.java
@@ -14,8 +14,10 @@
package org.springframework.data.neo4j.repositories;
import org.junit.Before;
+import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.experimental.categories.Category;
+import org.neo4j.graphdb.GraphDatabaseService;
import org.neo4j.ogm.session.Session;
import org.neo4j.ogm.session.SessionFactory;
import org.neo4j.ogm.testutil.MultiDriverTestClass;
@@ -38,11 +40,17 @@
*/
public class ProgrammaticRepositoryIT extends MultiDriverTestClass {
+ private static GraphDatabaseService graphDatabaseService;
private MovieRepository movieRepository;
private SessionFactory sessionFactory = new SessionFactory("org.springframework.data.neo4j.repositories.domain");
private Session session;
private Neo4jOperations neo4jOperations;
+ @BeforeClass
+ public static void beforeClass(){
+ graphDatabaseService = getGraphDatabaseService();
+ }
+
@Before
public void init() {
session = sessionFactory.openSession();
@@ -60,7 +68,7 @@ public void canInstantiateRepositoryProgrammatically() {
Movie movie = new Movie("PF");
movieRepository.save(movie);
- assertSameGraph(getGraphDatabaseService(), "CREATE (m:Movie {title:'PF'})");
+ assertSameGraph(graphDatabaseService, "CREATE (m:Movie {title:'PF'})");
assertEquals(1, IterableUtils.count(movieRepository.findAll()));
}
View
8 ...-data-neo4j/src/test/java/org/springframework/data/neo4j/repositories/RepoScanningIT.java
@@ -16,6 +16,7 @@
import static org.neo4j.ogm.testutil.GraphTestUtils.*;
import org.junit.Before;
+import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.neo4j.graphdb.GraphDatabaseService;
@@ -35,13 +36,18 @@
@RunWith(SpringJUnit4ClassRunner.class)
public class RepoScanningIT extends MultiDriverTestClass {
+ private static GraphDatabaseService graphDatabaseService;
+
@Autowired
private UserRepository userRepository;
@Autowired
private Neo4jOperations neo4jOperations;
- private GraphDatabaseService graphDatabaseService = getGraphDatabaseService();
+ @BeforeClass
+ public static void beforeClass(){
+ graphDatabaseService = getGraphDatabaseService();
+ }
@Before
public void clearDatabase() {
View
14 ...o4j/src/test/java/org/springframework/data/neo4j/repositories/RepositoryDefinitionIT.java
@@ -17,6 +17,7 @@
import static org.neo4j.ogm.testutil.GraphTestUtils.*;
import org.junit.Before;
+import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.neo4j.graphdb.GraphDatabaseService;
@@ -37,20 +38,25 @@
@RunWith(SpringJUnit4ClassRunner.class)
public class RepositoryDefinitionIT extends MultiDriverTestClass {
- private GraphDatabaseService graphDatabaseService = getGraphDatabaseService();
+ private static GraphDatabaseService graphDatabaseService;
+
+ @BeforeClass
+ public static void beforeClass(){
+ graphDatabaseService = getGraphDatabaseService();
+ }
@Autowired
private Neo4jOperations neo4jOperations;
+ @Autowired
+ private MovieRepository movieRepository;
+
@Before
public void clearDatabase() {
graphDatabaseService.execute("MATCH (n) OPTIONAL MATCH (n)-[r]-() DELETE r, n");
neo4jOperations.clear();
}
- @Autowired
- private MovieRepository movieRepository;
-
@Test
public void shouldProxyAndAutoImplementRepositoryDefinitionAnnotatedRepo() {
Movie movie = new Movie("PF");
View
46 ...ata-neo4j/src/test/java/org/springframework/data/neo4j/repository/cdi/CdiExtensionIT.java
@@ -20,6 +20,9 @@
import static org.junit.Assert.*;
import org.apache.webbeans.cditest.CdiTestContainer;
+import org.apache.webbeans.cditest.CdiTestContainerLoader;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test;
import org.neo4j.ogm.testutil.MultiDriverTestClass;
@@ -35,32 +38,30 @@
static CdiTestContainer container;
-// @BeforeClass
-// public static void setUp() throws Exception {
-//
-// // Prevent the Jersey extension to interact with the InitialContext
-// System.setProperty("com.sun.jersey.server.impl.cdi.lookupExtensionInBeanManager", "true");
-//
-// setupMultiDriverTestEnvironment();
-//
-// container = CdiTestContainerLoader.getCdiContainer();
-// container.bootContainer();
-// }
-//
-// @AfterClass
-// public static void tearDown() throws Exception {
-//
-// container.shutdownContainer();
-//
-// tearDownMultiDriverTestEnvironment();
-// }
+ @BeforeClass
+ public static void setUp() throws Exception {
+
+ // Prevent the Jersey extension to interact with the InitialContext
+ System.setProperty("com.sun.jersey.server.impl.cdi.lookupExtensionInBeanManager", "true");
+
+ setupMultiDriverTestEnvironment();
+
+ container = CdiTestContainerLoader.getCdiContainer();
+ container.bootContainer();
+ }
+
+ @AfterClass
+ public static void tearDown() throws Exception {
+
+ container.shutdownContainer();
+
+ tearDownMultiDriverTestEnvironment();
+ }
/**
* @see DATAGRAPH-879
*/
@Test
- @Ignore
- @SuppressWarnings("null")
public void regularRepositoryShouldWork() {
RepositoryClient client = container.getInstance(RepositoryClient.class);
@@ -90,7 +91,6 @@ public void regularRepositoryShouldWork() {
*/
@Test
@Ignore
- @SuppressWarnings("null")
public void repositoryWithQualifiersShouldWork() {
RepositoryClient client = container.getInstance(RepositoryClient.class);
@@ -103,8 +103,6 @@ public void repositoryWithQualifiersShouldWork() {
* @see DATAGRAPH-879
*/
@Test
- @Ignore
- @SuppressWarnings("null")
public void repositoryWithCustomImplementationShouldWork() {
RepositoryClient client = container.getInstance(RepositoryClient.class);
View
8 spring-data-neo4j/src/test/java/org/springframework/data/neo4j/template/Neo4jTemplateIT.java
@@ -14,6 +14,7 @@
package org.springframework.data.neo4j.template;
import org.junit.Before;
+import org.junit.BeforeClass;
import org.junit.Ignore;
import org.junit.Test;
import org.junit.experimental.categories.Category;
@@ -52,10 +53,15 @@
@RunWith(SpringJUnit4ClassRunner.class)
public class Neo4jTemplateIT extends MultiDriverTestClass {
- private GraphDatabaseService graphDatabaseService = getGraphDatabaseService();
+ private static GraphDatabaseService graphDatabaseService;
@Autowired private Neo4jOperations template;
+ @BeforeClass
+ public static void beforeClass(){
+ graphDatabaseService = getGraphDatabaseService();
+ }
+
@Before
public void setUpOgmSession() {
clearDatabase();
View
9 ...j/src/test/java/org/springframework/data/neo4j/transactions/TransactionIntegrationIT.java
@@ -14,6 +14,7 @@
package org.springframework.data.neo4j.transactions;
import org.junit.Before;
+import org.junit.BeforeClass;
import org.junit.Test;
import org.junit.runner.RunWith;
import org.neo4j.graphdb.GraphDatabaseService;
@@ -35,15 +36,19 @@
@RunWith(SpringJUnit4ClassRunner.class)
public class TransactionIntegrationIT extends MultiDriverTestClass {
-
- private GraphDatabaseService graphDatabaseService = getGraphDatabaseService();
+ private static GraphDatabaseService graphDatabaseService;
@Autowired
private UserRepository userRepository;
@Autowired
private UserService userService;
+ @BeforeClass
+ public static void beforeClass(){
+ graphDatabaseService = getGraphDatabaseService();
+ }
+
@Before
public void populateDatabase() {
graphDatabaseService.registerTransactionEventHandler(new TransactionEventHandler.Adapter<Object>() {
View
10 spring-data-neo4j/src/test/java/org/springframework/data/neo4j/util/IterableUtilsIT.java
@@ -20,6 +20,7 @@
import java.util.Arrays;
import java.util.Collections;
+import org.junit.BeforeClass;
import org.junit.Test;
import org.neo4j.graphdb.GraphDatabaseService;
import org.neo4j.graphdb.Node;
@@ -32,6 +33,13 @@
*/
public class IterableUtilsIT extends MultiDriverTestClass {
+ private static GraphDatabaseService database;
+
+ @BeforeClass
+ public static void beforeClass(){
+ database = getGraphDatabaseService();
+ }
+
@Test
public void checkContainsCollections() {
assertTrue(contains(asList("a", "b"), "b"));
@@ -41,8 +49,6 @@ public void checkContainsCollections() {
@Test
public void checkContainsRealIterables() {
- GraphDatabaseService database = getGraphDatabaseService();
-
Node node;
Long nodeId;
try (Transaction tx = database.beginTx()) {

0 comments on commit 1a0eb2f

Please sign in to comment.