Skip to content

Commit 44e7171

Browse files
committed
HHH-10001 Make the testsuite compatible with Infinispan 8
1 parent 60c109c commit 44e7171

13 files changed

+111
-4
lines changed

hibernate-infinispan/src/test/java/org/hibernate/test/cache/infinispan/AbstractNonFunctionalTestCase.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,15 @@
88

99
import java.util.Set;
1010

11+
import org.hibernate.test.cache.infinispan.util.InfinispanTestingSetup;
1112
import org.infinispan.Cache;
1213
import org.jboss.logging.Logger;
1314
import org.junit.After;
1415
import org.junit.Before;
1516

1617
import org.hibernate.cache.spi.RegionFactory;
1718
import org.hibernate.test.cache.infinispan.util.CacheTestSupport;
19+
import org.junit.Rule;
1820

1921
/**
2022
* Base class for all non-functional tests of Infinispan integration.
@@ -25,6 +27,9 @@
2527
public abstract class AbstractNonFunctionalTestCase extends org.hibernate.testing.junit4.BaseUnitTestCase {
2628
private static final Logger log = Logger.getLogger(AbstractNonFunctionalTestCase.class);
2729

30+
@Rule
31+
public InfinispanTestingSetup infinispanTestIdentifier = new InfinispanTestingSetup();
32+
2833
public static final String REGION_PREFIX = "test";
2934

3035
private static final String PREFER_IPV4STACK = "java.net.preferIPv4Stack";

hibernate-infinispan/src/test/java/org/hibernate/test/cache/infinispan/InfinispanRegionFactoryTestCase.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,9 +26,11 @@
2626
import org.hibernate.engine.transaction.jta.platform.internal.JBossStandAloneJtaPlatform;
2727
import org.hibernate.service.ServiceRegistry;
2828

29+
import org.hibernate.test.cache.infinispan.util.InfinispanTestingSetup;
2930
import org.hibernate.testing.ServiceRegistryBuilder;
3031
import org.hibernate.test.cache.infinispan.functional.SingleNodeTestCase;
3132
import org.hibernate.testing.boot.ServiceRegistryTestingImpl;
33+
import org.junit.Rule;
3234
import org.junit.Test;
3335

3436
import org.infinispan.AdvancedCache;
@@ -59,6 +61,9 @@ public class InfinispanRegionFactoryTestCase {
5961
private static final CacheDataDescription MUTABLE_NON_VERSIONED = new CacheDataDescriptionImpl(true, false, null, null);
6062
private static final CacheDataDescription IMMUTABLE_NON_VERSIONED = new CacheDataDescriptionImpl(false, false, null, null);
6163

64+
@Rule
65+
public InfinispanTestingSetup infinispanTestIdentifier = new InfinispanTestingSetup();
66+
6267
@Test
6368
public void testConfigurationProcessing() {
6469
final String person = "com.acme.Person";

hibernate-infinispan/src/test/java/org/hibernate/test/cache/infinispan/access/PutFromLoadValidatorUnitTestCase.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919

2020
import org.hibernate.cache.infinispan.access.PutFromLoadValidator;
2121
import org.hibernate.test.cache.infinispan.functional.cluster.DualNodeJtaTransactionManagerImpl;
22+
import org.hibernate.test.cache.infinispan.util.InfinispanTestingSetup;
2223
import org.infinispan.AdvancedCache;
2324
import org.infinispan.manager.EmbeddedCacheManager;
2425
import org.infinispan.test.CacheManagerCallable;
@@ -27,6 +28,7 @@
2728
import org.infinispan.util.logging.LogFactory;
2829
import org.junit.After;
2930
import org.junit.Before;
31+
import org.junit.Rule;
3032
import org.junit.Test;
3133

3234
import static org.infinispan.test.TestingUtil.withCacheManager;
@@ -48,6 +50,9 @@ public class PutFromLoadValidatorUnitTestCase {
4850
private static final Log log = LogFactory.getLog(
4951
PutFromLoadValidatorUnitTestCase.class);
5052

53+
@Rule
54+
public InfinispanTestingSetup infinispanTestIdentifier = new InfinispanTestingSetup();
55+
5156
private Object KEY1 = "KEY1";
5257

5358
private TransactionManager tm;

hibernate-infinispan/src/test/java/org/hibernate/test/cache/infinispan/collection/AbstractCollectionRegionAccessStrategyTestCase.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -29,13 +29,15 @@
2929
import org.hibernate.test.cache.infinispan.AbstractNonFunctionalTestCase;
3030
import org.hibernate.test.cache.infinispan.NodeEnvironment;
3131
import org.hibernate.test.cache.infinispan.util.CacheTestUtil;
32+
import org.hibernate.test.cache.infinispan.util.InfinispanTestingSetup;
3233
import org.hibernate.test.cache.infinispan.util.TestingKeyFactory;
3334
import org.infinispan.test.CacheManagerCallable;
3435
import org.infinispan.test.fwk.TestCacheManagerFactory;
3536
import org.infinispan.transaction.tm.BatchModeTransactionManager;
3637
import org.jboss.logging.Logger;
3738
import org.junit.After;
3839
import org.junit.Before;
40+
import org.junit.Rule;
3941
import org.junit.Test;
4042

4143
import static org.infinispan.test.TestingUtil.withCacheManager;
@@ -52,6 +54,10 @@
5254
*/
5355
public abstract class AbstractCollectionRegionAccessStrategyTestCase extends AbstractNonFunctionalTestCase {
5456
private static final Logger log = Logger.getLogger( AbstractCollectionRegionAccessStrategyTestCase.class );
57+
58+
@Rule
59+
public InfinispanTestingSetup infinispanTestIdentifier = new InfinispanTestingSetup();
60+
5561
public static final String REGION_NAME = "test/com.foo.test";
5662
public static final String KEY_BASE = "KEY";
5763
public static final String VALUE1 = "VALUE1";

hibernate-infinispan/src/test/java/org/hibernate/test/cache/infinispan/collection/TransactionalExtraAPITestCase.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,11 @@
1717
import org.hibernate.test.cache.infinispan.AbstractNonFunctionalTestCase;
1818
import org.hibernate.test.cache.infinispan.NodeEnvironment;
1919
import org.hibernate.test.cache.infinispan.util.CacheTestUtil;
20+
import org.hibernate.test.cache.infinispan.util.InfinispanTestingSetup;
2021
import org.hibernate.test.cache.infinispan.util.TestingKeyFactory;
2122
import org.junit.After;
2223
import org.junit.Before;
24+
import org.junit.Rule;
2325
import org.junit.Test;
2426

2527
import static org.junit.Assert.assertNull;
@@ -32,6 +34,9 @@
3234
*/
3335
public class TransactionalExtraAPITestCase extends AbstractNonFunctionalTestCase {
3436

37+
@Rule
38+
public InfinispanTestingSetup infinispanTestIdentifier = new InfinispanTestingSetup();
39+
3540
public static final String REGION_NAME = "test/com.foo.test";
3641
public static final Object KEY = TestingKeyFactory.generateCollectionCacheKey( "KEY" );
3742
public static final CacheDataDescription CACHE_DATA_DESCRIPTION

hibernate-infinispan/src/test/java/org/hibernate/test/cache/infinispan/entity/AbstractEntityRegionAccessStrategyTestCase.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,13 +24,15 @@
2424
import org.hibernate.test.cache.infinispan.AbstractNonFunctionalTestCase;
2525
import org.hibernate.test.cache.infinispan.NodeEnvironment;
2626
import org.hibernate.test.cache.infinispan.util.CacheTestUtil;
27+
import org.hibernate.test.cache.infinispan.util.InfinispanTestingSetup;
2728
import org.hibernate.test.cache.infinispan.util.TestingKeyFactory;
2829
import org.infinispan.Cache;
2930
import org.infinispan.test.TestingUtil;
3031
import org.infinispan.transaction.tm.BatchModeTransactionManager;
3132
import org.jboss.logging.Logger;
3233
import org.junit.After;
3334
import org.junit.Before;
35+
import org.junit.Rule;
3436
import org.junit.Test;
3537

3638
import static org.junit.Assert.assertEquals;
@@ -47,6 +49,9 @@ public abstract class AbstractEntityRegionAccessStrategyTestCase extends Abstrac
4749

4850
private static final Logger log = Logger.getLogger(AbstractEntityRegionAccessStrategyTestCase.class);
4951

52+
@Rule
53+
public InfinispanTestingSetup infinispanTestIdentifier = new InfinispanTestingSetup();
54+
5055
public static final String REGION_NAME = "test/com.foo.test";
5156
public static final String KEY_BASE = "KEY";
5257
public static final String VALUE1 = "VALUE1";

hibernate-infinispan/src/test/java/org/hibernate/test/cache/infinispan/entity/TransactionalExtraAPITestCase.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,11 @@
1616
import org.hibernate.test.cache.infinispan.AbstractNonFunctionalTestCase;
1717
import org.hibernate.test.cache.infinispan.NodeEnvironment;
1818
import org.hibernate.test.cache.infinispan.util.CacheTestUtil;
19+
import org.hibernate.test.cache.infinispan.util.InfinispanTestingSetup;
1920
import org.hibernate.test.cache.infinispan.util.TestingKeyFactory;
2021
import org.junit.After;
2122
import org.junit.Before;
23+
import org.junit.Rule;
2224
import org.junit.Test;
2325

2426
import static org.junit.Assert.assertFalse;
@@ -35,6 +37,10 @@
3537
* @since 3.5
3638
*/
3739
public class TransactionalExtraAPITestCase extends AbstractNonFunctionalTestCase {
40+
41+
@Rule
42+
public InfinispanTestingSetup infinispanTestIdentifier = new InfinispanTestingSetup();
43+
3844
public static final String REGION_NAME = "test/com.foo.test";
3945
public static final Object KEY = TestingKeyFactory.generateEntityCacheKey( "KEY" );
4046
public static final String VALUE1 = "VALUE1";

hibernate-infinispan/src/test/java/org/hibernate/test/cache/infinispan/functional/SingleNodeTestCase.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
import org.hibernate.resource.transaction.TransactionCoordinatorBuilder;
2020
import org.hibernate.resource.transaction.backend.jta.internal.JtaTransactionCoordinatorBuilderImpl;
2121

22+
import org.hibernate.test.cache.infinispan.util.InfinispanTestingSetup;
2223
import org.hibernate.testing.junit4.BaseNonConfigCoreFunctionalTestCase;
2324
import org.hibernate.test.cache.infinispan.tm.JtaPlatformImpl;
2425
import org.junit.Before;
@@ -28,6 +29,7 @@
2829
import org.infinispan.test.fwk.TestCacheManagerFactory;
2930
import org.infinispan.util.logging.Log;
3031
import org.infinispan.util.logging.LogFactory;
32+
import org.junit.ClassRule;
3133

3234
/**
3335
* @author Galder Zamarreño
@@ -37,6 +39,9 @@ public abstract class SingleNodeTestCase extends BaseNonConfigCoreFunctionalTest
3739
private static final Log log = LogFactory.getLog( SingleNodeTestCase.class );
3840
protected TransactionManager tm;
3941

42+
@ClassRule
43+
public static final InfinispanTestingSetup infinispanTestIdentifier = new InfinispanTestingSetup();
44+
4045
@Before
4146
public void prepare() {
4247
tm = getTransactionManager();

hibernate-infinispan/src/test/java/org/hibernate/test/cache/infinispan/functional/bulk/BulkOperationsTestCase.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,11 +24,13 @@
2424
import org.hibernate.resource.transaction.backend.jta.internal.JtaTransactionCoordinatorBuilderImpl;
2525
import org.hibernate.stat.SecondLevelCacheStatistics;
2626

27+
import org.hibernate.test.cache.infinispan.util.InfinispanTestingSetup;
2728
import org.hibernate.testing.junit4.BaseNonConfigCoreFunctionalTestCase;
2829
import org.hibernate.test.cache.infinispan.functional.Contact;
2930
import org.hibernate.test.cache.infinispan.functional.Customer;
3031
import org.hibernate.test.cache.infinispan.functional.SingleNodeTestCase;
3132
import org.hibernate.test.cache.infinispan.tm.JtaPlatformImpl;
33+
import org.junit.ClassRule;
3234
import org.junit.Test;
3335

3436
import static org.junit.Assert.assertEquals;
@@ -42,6 +44,10 @@
4244
* @since 3.5
4345
*/
4446
public class BulkOperationsTestCase extends BaseNonConfigCoreFunctionalTestCase {
47+
48+
@ClassRule
49+
public static final InfinispanTestingSetup infinispanTestIdentifier = new InfinispanTestingSetup();
50+
4551
private TransactionManager tm;
4652

4753
@Override

hibernate-infinispan/src/test/java/org/hibernate/test/cache/infinispan/functional/cluster/DualNodeTestCase.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,20 +18,26 @@
1818
import org.hibernate.resource.transaction.TransactionCoordinatorBuilder;
1919
import org.hibernate.resource.transaction.backend.jta.internal.JtaTransactionCoordinatorBuilderImpl;
2020

21+
import org.hibernate.test.cache.infinispan.util.InfinispanTestingSetup;
2122
import org.hibernate.testing.junit4.BaseNonConfigCoreFunctionalTestCase;
2223
import org.junit.After;
2324
import org.junit.Before;
2425

2526
import org.infinispan.util.logging.Log;
2627
import org.infinispan.util.logging.LogFactory;
28+
import org.junit.ClassRule;
2729

2830
/**
2931
* @author Galder Zamarreño
3032
* @since 3.5
3133
*/
3234
public abstract class DualNodeTestCase extends BaseNonConfigCoreFunctionalTestCase {
35+
3336
private static final Log log = LogFactory.getLog( DualNodeTestCase.class );
3437

38+
@ClassRule
39+
public static final InfinispanTestingSetup infinispanTestIdentifier = new InfinispanTestingSetup();
40+
3541
public static final String NODE_ID_PROP = "hibernate.test.cluster.node.id";
3642
public static final String NODE_ID_FIELD = "nodeId";
3743
public static final String LOCAL = "local";
@@ -74,6 +80,8 @@ protected void cleanupTransactionManagement() {
7480

7581
@Before
7682
public void prepare() throws Exception {
83+
// In some cases tests are multi-threaded, so they have to join the group
84+
infinispanTestIdentifier.joinContext();
7785
secondNodeEnvironment = new SecondNodeEnvironment();
7886
}
7987

0 commit comments

Comments
 (0)