|
40 | 40 | * @since 3.5
|
41 | 41 | */
|
42 | 42 | public abstract class AbstractNonFunctionalTestCase extends org.hibernate.testing.junit4.BaseUnitTestCase {
|
43 |
| - private static final Logger log = Logger.getLogger(AbstractNonFunctionalTestCase.class); |
44 |
| - |
45 |
| - public static final String REGION_PREFIX = "test"; |
46 |
| - |
47 |
| - private static final String PREFER_IPV4STACK = "java.net.preferIPv4Stack"; |
48 |
| - private String preferIPv4Stack; |
49 |
| - private static final String JGROUPS_CFG_FILE = "hibernate.cache.infinispan.jgroups_cfg"; |
50 |
| - private String jgroupsCfgFile; |
51 |
| - |
52 |
| - private CacheTestSupport testSupport = new CacheTestSupport(); |
53 |
| - |
54 |
| - @Before |
55 |
| - public void prepareCacheSupport() throws Exception { |
56 |
| - preferIPv4Stack = System.getProperty(PREFER_IPV4STACK); |
57 |
| - System.setProperty(PREFER_IPV4STACK, "true"); |
58 |
| - jgroupsCfgFile = System.getProperty(JGROUPS_CFG_FILE); |
59 |
| - System.setProperty(JGROUPS_CFG_FILE, "2lc-test-tcp.xml"); |
60 |
| - |
61 |
| - testSupport.setUp(); |
62 |
| - } |
63 |
| - |
64 |
| - @After |
65 |
| - public void releaseCachSupport() throws Exception { |
66 |
| - testSupport.tearDown(); |
67 |
| - |
68 |
| - if (preferIPv4Stack == null) { |
69 |
| - System.clearProperty(PREFER_IPV4STACK); |
70 |
| - } else { |
71 |
| - System.setProperty(PREFER_IPV4STACK, preferIPv4Stack); |
72 |
| - } |
73 |
| - |
74 |
| - if (jgroupsCfgFile == null) |
75 |
| - System.clearProperty(JGROUPS_CFG_FILE); |
76 |
| - else |
77 |
| - System.setProperty(JGROUPS_CFG_FILE, jgroupsCfgFile); |
78 |
| - } |
79 |
| - |
80 |
| - |
81 |
| - protected CacheTestSupport getCacheTestSupport() { |
82 |
| - return testSupport; |
83 |
| - } |
84 |
| - |
85 |
| - protected void sleep(long ms) { |
86 |
| - try { |
87 |
| - Thread.sleep(ms); |
88 |
| - } catch (InterruptedException e) { |
89 |
| - log.warn("Interrupted during sleep", e); |
90 |
| - } |
91 |
| - } |
92 |
| - |
93 |
| - protected void avoidConcurrentFlush() { |
94 |
| - testSupport.avoidConcurrentFlush(); |
95 |
| - } |
96 |
| - |
97 |
| - protected int getValidKeyCount(Set keys) { |
98 |
| - return keys.size(); |
99 |
| - } |
| 43 | + private static final Logger log = Logger.getLogger( AbstractNonFunctionalTestCase.class ); |
| 44 | + |
| 45 | + public static final String REGION_PREFIX = "test"; |
| 46 | + |
| 47 | + private static final String PREFER_IPV4STACK = "java.net.preferIPv4Stack"; |
| 48 | + private String preferIPv4Stack; |
| 49 | + private static final String JGROUPS_CFG_FILE = "hibernate.cache.infinispan.jgroups_cfg"; |
| 50 | + private String jgroupsCfgFile; |
| 51 | + |
| 52 | + private CacheTestSupport testSupport = new CacheTestSupport(); |
| 53 | + |
| 54 | + @Before |
| 55 | + public void prepareCacheSupport() throws Exception { |
| 56 | + preferIPv4Stack = System.getProperty( PREFER_IPV4STACK ); |
| 57 | + System.setProperty( PREFER_IPV4STACK, "true" ); |
| 58 | + jgroupsCfgFile = System.getProperty( JGROUPS_CFG_FILE ); |
| 59 | + System.setProperty( JGROUPS_CFG_FILE, "2lc-test-tcp.xml" ); |
| 60 | + |
| 61 | + testSupport.setUp(); |
| 62 | + } |
| 63 | + |
| 64 | + @After |
| 65 | + public void releaseCachSupport() throws Exception { |
| 66 | + testSupport.tearDown(); |
| 67 | + |
| 68 | + if ( preferIPv4Stack == null ) { |
| 69 | + System.clearProperty( PREFER_IPV4STACK ); |
| 70 | + } |
| 71 | + else { |
| 72 | + System.setProperty( PREFER_IPV4STACK, preferIPv4Stack ); |
| 73 | + } |
| 74 | + |
| 75 | + if ( jgroupsCfgFile == null ) { |
| 76 | + System.clearProperty( JGROUPS_CFG_FILE ); |
| 77 | + } |
| 78 | + else { |
| 79 | + System.setProperty( JGROUPS_CFG_FILE, jgroupsCfgFile ); |
| 80 | + } |
| 81 | + } |
| 82 | + |
| 83 | + |
| 84 | + protected CacheTestSupport getCacheTestSupport() { |
| 85 | + return testSupport; |
| 86 | + } |
| 87 | + |
| 88 | + protected void sleep(long ms) { |
| 89 | + try { |
| 90 | + Thread.sleep( ms ); |
| 91 | + } |
| 92 | + catch ( InterruptedException e ) { |
| 93 | + log.warn( "Interrupted during sleep", e ); |
| 94 | + } |
| 95 | + } |
| 96 | + |
| 97 | + protected void avoidConcurrentFlush() { |
| 98 | + testSupport.avoidConcurrentFlush(); |
| 99 | + } |
| 100 | + |
| 101 | + protected int getValidKeyCount(Set keys) { |
| 102 | + return keys.size(); |
| 103 | + } |
100 | 104 |
|
101 | 105 | }
|
0 commit comments