Merge branch 'aj'
This commit is contained in:
@@ -327,7 +327,8 @@
|
||||
<artifactId>maven-surefire-plugin</artifactId>
|
||||
<version>2.6</version>
|
||||
<configuration>
|
||||
<forkMode>always</forkMode>
|
||||
<!--debugForkedProcess>true</debugForkedProcess-->
|
||||
<forkMode>once</forkMode>
|
||||
<useFile>true</useFile>
|
||||
<includes>
|
||||
<include>**/*Tests.java</include>
|
||||
|
||||
@@ -13,9 +13,14 @@ import org.springframework.data.graph.neo4j.support.node.Neo4jHelper;
|
||||
|
||||
import org.springframework.test.annotation.DirtiesContext;
|
||||
import org.springframework.test.annotation.Rollback;
|
||||
import org.springframework.test.context.CleanContextCacheTestExecutionListener;
|
||||
import org.springframework.test.context.ContextConfiguration;
|
||||
import org.springframework.test.context.TestExecutionListeners;
|
||||
import org.springframework.test.context.junit4.SpringJUnit4ClassRunner;
|
||||
import org.springframework.test.context.support.DependencyInjectionTestExecutionListener;
|
||||
import org.springframework.test.context.support.DirtiesContextTestExecutionListener;
|
||||
import org.springframework.test.context.transaction.BeforeTransaction;
|
||||
import org.springframework.test.context.transaction.TransactionalTestExecutionListener;
|
||||
import org.springframework.transaction.PlatformTransactionManager;
|
||||
import org.springframework.transaction.annotation.Transactional;
|
||||
|
||||
@@ -25,8 +30,7 @@ import javax.sql.DataSource;
|
||||
|
||||
@RunWith(SpringJUnit4ClassRunner.class)
|
||||
@ContextConfiguration(locations = {"classpath:org/springframework/data/graph/neo4j/partial/Neo4jGraphRecommendationTest-context.xml"})
|
||||
//@Ignore("seems to break things in the graph store")
|
||||
@DirtiesContext
|
||||
@TestExecutionListeners({CleanContextCacheTestExecutionListener.class, DependencyInjectionTestExecutionListener.class, TransactionalTestExecutionListener.class})
|
||||
public class RecommendationTest {
|
||||
|
||||
protected final Log log = LogFactory.getLog(getClass());
|
||||
|
||||
@@ -0,0 +1,43 @@
|
||||
package org.springframework.test.context;
|
||||
|
||||
import java.applet.AppletContext;
|
||||
import java.lang.reflect.Field;
|
||||
import java.util.Map;
|
||||
|
||||
public class CleanContextCacheTestExecutionListener implements TestExecutionListener {
|
||||
|
||||
@Override
|
||||
public void afterTestClass(TestContext testContext) throws Exception {
|
||||
Field cacheField = TestContext.class.getDeclaredField("contextCache");
|
||||
cacheField.setAccessible(true);
|
||||
ContextCache cache = (ContextCache) cacheField.get(testContext);
|
||||
Field cacheMapField = ContextCache.class.getDeclaredField("contextKeyToContextMap");
|
||||
cacheMapField.setAccessible(true);
|
||||
Map<String, AppletContext> cacheMap = (Map<String, AppletContext>) cacheMapField.get(cache);
|
||||
String[] keys = new String[cacheMap.size()];
|
||||
cacheMap.keySet().toArray(keys);
|
||||
for (String key : keys) {
|
||||
cache.setDirty(key);
|
||||
}
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beforeTestClass(TestContext testContext) throws Exception {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void prepareTestInstance(TestContext testContext) throws Exception {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void beforeTestMethod(TestContext testContext) throws Exception {
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void afterTestMethod(TestContext testContext) throws Exception {
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user