From a355e54dfa02b514e8031bf3fa1ff206d2619a1e Mon Sep 17 00:00:00 2001 From: Tomaz Cerar Date: Wed, 20 Feb 2013 18:52:21 +0100 Subject: [PATCH] AS7-6570 fixes for buiding on JDK7 * upgrade javassist to support jdk7 * upgrade & mockito & powermock to support jdk7 * upgrade junit to 4.11 to gain test ordering support * fix test ordering --- README.md | 9 +- .../DistributedCacheManagerTest.java | 6 +- pom.xml | 8 +- .../management/cli/RolloutPlanTestCase.java | 11 +- .../method/EjbMethodInterceptorTestCase.java | 4 + .../entity/BMPEntityBeanTimerTestCase.java | 3 + .../simple/SimpleTimerServiceTestCase.java | 4 + .../jaxrs/jsapi/JaxrsJSApiTestCase.java | 3 + .../DataSourceDefinitionJPATestCase.java | 8 + .../EPCPropagationNewTransactionTestCase.java | 3 + ...mplementValidityAuditStrategyTestCase.java | 3 + .../jpa/secondlevelcache/JPA2LCTestCase.java | 253 +++++++++--------- .../jpa/transaction/TransactionTestCase.java | 9 +- ...essionSubstitutionInContainerTestCase.java | 7 + ...EJBClientStatefulBeanFailoverTestCase.java | 3 + 15 files changed, 195 insertions(+), 139 deletions(-) diff --git a/README.md b/README.md index 4f53966a4cb1..a891904d6a57 100644 --- a/README.md +++ b/README.md @@ -12,6 +12,7 @@ And of course Java EE! Building ------------------- + If you already have Maven 3.0.3 or newer installed > mvn install @@ -46,18 +47,18 @@ More information on the wiki: http://community.jboss.org/wiki/JBossAS7UserGuide Contributing ------------------ -http://community.jboss.org/wiki/HackingonAS7 +https://community.jboss.org/wiki/HackingOnAS8 Running the Testsuite -------------------- The testsuite module contains several submodules including the following: * "smoke" -- core tests that should be run as part of every build of the AS. Failures here will fail the build. -* "api" -- tests of features that involve end user use of the public JBoss AS 7 API. Should be run with no failures before any major commits. +* "api" -- tests of features that involve end user use of the public JBoss AS 8 API. Should be run with no failures before any major commits. * "cluster" -- tests of the AS 7 HA clustering features. Should be run with no failures before any major commits. * "domain" -- tests of the domain management features. Should be run with no failures before any major commits. * "integration" -- tests of an AS 7 standalone server's internals. Should be run with no failures before any major commits. -* "spec" -- tests of features that only involve end user use of the Java EE 6 spec APIs. Should be run with no failures before any major commits. +* "spec" -- tests of features that only involve end user use of the Java EE 7 spec APIs. Should be run with no failures before any major commits. * "benchmark" -- tests used to compare performance against other releases or previous builds * "stress" -- tests of the server's ability to perform properly while under stress @@ -76,7 +77,7 @@ To run all the tests Using Eclipse ------------- 1. Install the latest version of eclipse -2. Make sure Xmx in eclipse.ini is at least 512M, and it's using java 6 +2. Make sure Xmx in eclipse.ini is at least 512M, and it's using java 7 3. Launch eclispe and install the m2eclipse plugin, make sure it uses your repo configs (get it from: http://m2eclipse.sonatype.org/sites/m2e) 4. In eclipse preferences Java->Compiler->Errors/Warnings->Deprecated and restricted diff --git a/clustering/web-infinispan/src/test/java/org/jboss/as/clustering/web/infinispan/DistributedCacheManagerTest.java b/clustering/web-infinispan/src/test/java/org/jboss/as/clustering/web/infinispan/DistributedCacheManagerTest.java index e4e0d8cc95f0..f9b10ce005d8 100644 --- a/clustering/web-infinispan/src/test/java/org/jboss/as/clustering/web/infinispan/DistributedCacheManagerTest.java +++ b/clustering/web-infinispan/src/test/java/org/jboss/as/clustering/web/infinispan/DistributedCacheManagerTest.java @@ -68,7 +68,9 @@ import org.jboss.as.clustering.web.SessionOwnershipSupport; import org.junit.After; import org.junit.Before; +import org.junit.FixMethodOrder; import org.junit.Test; +import org.junit.runners.MethodSorters; import org.mockito.ArgumentCaptor; import org.mockito.Mockito; @@ -76,6 +78,7 @@ * @author Paul Ferraro * */ +@FixMethodOrder(MethodSorters.NAME_ASCENDING) public class DistributedCacheManagerTest { private LocalDistributableSessionManager sessionManager = mock(LocalDistributableSessionManager.class); @SuppressWarnings("unchecked") @@ -167,6 +170,7 @@ public void sessionCreated() { @SuppressWarnings("unchecked") @Test + public void storeSessionData() throws IOException { OutgoingDistributableSessionData data = mock(OutgoingDistributableSessionData.class); Map map = mock(Map.class); @@ -612,7 +616,7 @@ public void isLocal() { } @Test - public void locate() { + public void testLocate() { //test keeps it in order EmbeddedCacheManager container = mock(EmbeddedCacheManager.class); DistributionManager distManager = mock(DistributionManager.class); Address localAddress = mock(Address.class); diff --git a/pom.xml b/pom.xml index 32d42e5f776c..b4c113223e69 100644 --- a/pom.xml +++ b/pom.xml @@ -106,7 +106,7 @@ 0.33 1.9 1.6.2 - 4.10 + 4.11 1.6.1 1.2.16 1.0 @@ -147,7 +147,7 @@ 2.3.0.CR1 5.2.1.Final 2.3.2.jbossorg-4 - 3.15.0-GA + 3.17.1-GA 1.1.2 1.0.0.Final 1.0.3.Final @@ -243,14 +243,14 @@ ${version.org.jboss.xnio} 3.2.7.Final 201103.jboss-1 - 1.8.5 + 1.9.5 2.5.1-1 1.4.2-1 1.3.2-1 4.0.15.Final 1.0.0.final 2.1.6.Final - 1.4.11 + 1.5 0.1.26 1.0.2 1.7.2 diff --git a/testsuite/domain/src/test/java/org/jboss/as/test/integration/domain/management/cli/RolloutPlanTestCase.java b/testsuite/domain/src/test/java/org/jboss/as/test/integration/domain/management/cli/RolloutPlanTestCase.java index 4bd5643586a2..a252749d3051 100644 --- a/testsuite/domain/src/test/java/org/jboss/as/test/integration/domain/management/cli/RolloutPlanTestCase.java +++ b/testsuite/domain/src/test/java/org/jboss/as/test/integration/domain/management/cli/RolloutPlanTestCase.java @@ -42,12 +42,15 @@ import org.junit.AfterClass; import org.junit.Assert; import org.junit.BeforeClass; +import org.junit.FixMethodOrder; import org.junit.Test; +import org.junit.runners.MethodSorters; /** * * @author Dominik Pospisil */ +@FixMethodOrder(MethodSorters.NAME_ASCENDING) public class RolloutPlanTestCase extends AbstractCliTestBase { private static WebArchive war; @@ -107,7 +110,7 @@ public static void after() throws Exception { } @Test - public void testInSeriesRolloutPlan() throws Exception { + public void test1InSeriesRolloutPlan() throws Exception { // create rollout plans @@ -188,7 +191,7 @@ public void testInSeriesRolloutPlan() throws Exception { * Tests rollout plan with non-zero maxFailedServers attribute. */ @Test - public void testMaxFailServersRolloutPlan() throws Exception { + public void test2MaxFailServersRolloutPlan() throws Exception { // deploy helper servlets cli.sendLine("deploy " + warFile.getAbsolutePath() + " --all-server-groups"); @@ -254,7 +257,7 @@ public void testMaxFailServersRolloutPlan() throws Exception { * Tests rollout plan with non-zero maxFailurePercentage attribute. */ @Test - public void testMaxFailServersPercentageRolloutPlan() throws Exception { + public void test3MaxFailServersPercentageRolloutPlan() throws Exception { // deploy helper servlets cli.sendLine("deploy " + warFile.getAbsolutePath() + " --all-server-groups"); @@ -312,7 +315,7 @@ public void testMaxFailServersPercentageRolloutPlan() throws Exception { * Tests rollout plan with RollbackAcrossGroups set to true. */ @Test - public void testRollbackAcrossGroupsRolloutPlan() throws Exception { + public void test4RollbackAcrossGroupsRolloutPlan() throws Exception { // deploy helper servlets cli.sendLine("deploy " + warFile.getAbsolutePath() + " --all-server-groups"); diff --git a/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/ejb/interceptor/method/EjbMethodInterceptorTestCase.java b/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/ejb/interceptor/method/EjbMethodInterceptorTestCase.java index f9c3b60c3325..371eb4651e81 100644 --- a/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/ejb/interceptor/method/EjbMethodInterceptorTestCase.java +++ b/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/ejb/interceptor/method/EjbMethodInterceptorTestCase.java @@ -26,6 +26,7 @@ import org.jboss.arquillian.container.test.api.Deployment; import org.jboss.arquillian.junit.Arquillian; +import org.jboss.arquillian.junit.InSequence; import org.jboss.shrinkwrap.api.Archive; import org.jboss.shrinkwrap.api.ShrinkWrap; import org.jboss.shrinkwrap.api.spec.WebArchive; @@ -48,6 +49,7 @@ public static Archive deploy() { } @Test + @InSequence(1) public void testMethodLevelInterceptors() throws NamingException { final InitialContext ctx = new InitialContext(); final ClassifiedBean bean = (ClassifiedBean) ctx.lookup("java:module/" + ClassifiedBean.class.getSimpleName()); @@ -67,6 +69,7 @@ public void testMethodLevelInterceptors() throws NamingException { } @Test + @InSequence(2) public void testMethodOverloaded() throws NamingException { final InitialContext ctx = new InitialContext(); final ClassifiedBean bean = (ClassifiedBean) ctx.lookup("java:module/" + ClassifiedBean.class.getSimpleName()); @@ -87,6 +90,7 @@ public void testMethodOverloaded() throws NamingException { } @Test + @InSequence(3) public void testAroundInvokeOverridedByXmlDescriptor() throws NamingException { InitialContext ctx = new InitialContext(); AroundInvokeBean bean = (AroundInvokeBean) ctx.lookup("java:module/" + AroundInvokeBean.class.getSimpleName()); diff --git a/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/ejb/timerservice/entity/BMPEntityBeanTimerTestCase.java b/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/ejb/timerservice/entity/BMPEntityBeanTimerTestCase.java index fc915c53ee4e..df6a260036a4 100644 --- a/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/ejb/timerservice/entity/BMPEntityBeanTimerTestCase.java +++ b/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/ejb/timerservice/entity/BMPEntityBeanTimerTestCase.java @@ -30,6 +30,7 @@ import org.jboss.arquillian.container.test.api.Deployment; import org.jboss.arquillian.junit.Arquillian; +import org.jboss.arquillian.junit.InSequence; import org.jboss.arquillian.test.api.ArquillianResource; import org.jboss.shrinkwrap.api.Archive; import org.jboss.shrinkwrap.api.ShrinkWrap; @@ -63,6 +64,7 @@ public static Archive deploy() { } @Test + @InSequence(1) public void testEntityBeanTimerService() throws Exception { DataStore.DATA.clear(); DataStore.DATA.put(20, "Existing"); @@ -89,6 +91,7 @@ public void testEntityBeanTimerService() throws Exception { * Aimed to test EJB3.1 18.4.5. */ @Test + @InSequence(2) public void testExistenceAfterDelete() throws Exception { DataStore.DATA.clear(); diff --git a/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/ejb/timerservice/simple/SimpleTimerServiceTestCase.java b/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/ejb/timerservice/simple/SimpleTimerServiceTestCase.java index 0d45e58973cf..7efb1e040152 100644 --- a/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/ejb/timerservice/simple/SimpleTimerServiceTestCase.java +++ b/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/ejb/timerservice/simple/SimpleTimerServiceTestCase.java @@ -25,6 +25,7 @@ import org.jboss.arquillian.container.test.api.Deployment; import org.jboss.arquillian.junit.Arquillian; +import org.jboss.arquillian.junit.InSequence; import org.jboss.shrinkwrap.api.Archive; import org.jboss.shrinkwrap.api.ShrinkWrap; import org.jboss.shrinkwrap.api.spec.WebArchive; @@ -58,6 +59,7 @@ public static Archive deploy() { } @Test + @InSequence(1) public void testAnnotationTimeoutMethod() throws NamingException { InitialContext ctx = new InitialContext(); AnnotationTimerServiceBean bean = (AnnotationTimerServiceBean) ctx.lookup("java:module/" + AnnotationTimerServiceBean.class.getSimpleName()); @@ -76,6 +78,7 @@ public void testAnnotationTimeoutMethod() throws NamingException { } @Test + @InSequence(2) public void testTimedObjectTimeoutMethod() throws NamingException { InitialContext ctx = new InitialContext(); TimedObjectTimerServiceBean bean = (TimedObjectTimerServiceBean) ctx.lookup("java:module/" + TimedObjectTimerServiceBean.class.getSimpleName()); @@ -96,6 +99,7 @@ public void testTimedObjectTimeoutMethod() throws NamingException { } @Test + @InSequence(3) public void testIntervalTimer() throws NamingException { InitialContext ctx = new InitialContext(); TimerConfig timerConfig = new TimerConfig(); diff --git a/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jaxrs/jsapi/JaxrsJSApiTestCase.java b/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jaxrs/jsapi/JaxrsJSApiTestCase.java index a24443f503ce..c0698621fb1b 100644 --- a/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jaxrs/jsapi/JaxrsJSApiTestCase.java +++ b/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jaxrs/jsapi/JaxrsJSApiTestCase.java @@ -28,6 +28,7 @@ import org.jboss.arquillian.container.test.api.OperateOnDeployment; import org.jboss.arquillian.container.test.api.RunAsClient; import org.jboss.arquillian.junit.Arquillian; +import org.jboss.arquillian.junit.InSequence; import org.jboss.arquillian.test.api.ArquillianResource; import org.jboss.as.test.integration.common.HttpRequest; import org.jboss.as.test.integration.jaxrs.packaging.war.WebXml; @@ -81,12 +82,14 @@ private static String performCall(String urlPattern) throws Exception { } @Test + @InSequence(1) public void testJaxRsWithNoApplication() throws Exception { String result = performCall("myjaxrs/jsapi"); Assert.assertEquals("JohnCitizen", result); } @Test + @InSequence(2) public void testJaxRsJSApis() throws Exception { String result = performCall("/rest-JS"); Assert.assertTrue(result.contains("var CustomerResource")); diff --git a/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jpa/datasourcedefinition/DataSourceDefinitionJPATestCase.java b/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jpa/datasourcedefinition/DataSourceDefinitionJPATestCase.java index dd18aa75376b..98ad3a9a6015 100644 --- a/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jpa/datasourcedefinition/DataSourceDefinitionJPATestCase.java +++ b/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jpa/datasourcedefinition/DataSourceDefinitionJPATestCase.java @@ -28,6 +28,7 @@ import org.jboss.arquillian.container.test.api.Deployment; import org.jboss.arquillian.junit.Arquillian; +import org.jboss.arquillian.junit.InSequence; import org.jboss.arquillian.test.api.ArquillianResource; import org.jboss.shrinkwrap.api.Archive; import org.jboss.shrinkwrap.api.ShrinkWrap; @@ -74,6 +75,7 @@ protected T rawLookup(String name, Class interfaceType) throws NamingExce } @Test + @InSequence(1) public void testMultipleNonTXTransactionalEntityManagerInvocations() throws Exception { SFSB1 sfsb1 = lookup("SFSB1", SFSB1.class); sfsb1.getEmployeeNoTX(1); // For each call in, we will use a transactional entity manager @@ -84,6 +86,7 @@ public void testMultipleNonTXTransactionalEntityManagerInvocations() throws Exce } @Test + @InSequence(2) public void testQueryNonTXTransactionalEntityManagerInvocations() throws Exception { SFSB1 sfsb1 = lookup("SFSB1", SFSB1.class); String name = sfsb1.queryEmployeeNameNoTX(1); @@ -94,6 +97,7 @@ public void testQueryNonTXTransactionalEntityManagerInvocations() throws Excepti // For a transaction scoped persistence context non jta-tx invocation, entities returned from Query // must be detached. @Test + @InSequence(3) public void testQueryNonTXTransactionalDetach() throws Exception { SFSB1 sfsb1 = lookup("SFSB1", SFSB1.class); sfsb1.createEmployee("Jill", "54 Country Lane", 2); @@ -110,6 +114,7 @@ public void testQueryNonTXTransactionalDetach() throws Exception { * @throws Exception */ @Test + @InSequence(4) public void testTransactionRequiredException() throws Exception { Throwable error = null; try { @@ -138,6 +143,7 @@ public void testTransactionRequiredException() throws Exception { * 3) The transaction fails after the DAO calls and the JTA transaction is rolled back and no database changes should occur. */ @Test + @InSequence(5) public void testFailInDAOCalls() throws Exception { SLSB1 slsb1 = lookup("SLSB1", SLSB1.class); slsb1.addEmployee(); @@ -153,6 +159,7 @@ public void testFailInDAOCalls() throws Exception { } @Test + @InSequence(6) public void testUserTxRollbackDiscardsChanges() throws Exception { SFSBXPC sfsbxpc = lookup("SFSBXPC", SFSBXPC.class); sfsbxpc.createEmployeeNoTx("Amory Lorch", "Lannister House", 10); // create the employee but leave in xpc @@ -168,6 +175,7 @@ public void testUserTxRollbackDiscardsChanges() throws Exception { } @Test + @InSequence(7) public void testEnlistXPCInUserTx() throws Exception { SFSBXPC sfsbxpc = lookup("SFSBXPC", SFSBXPC.class); sfsbxpc.createEmployeeNoTx("Amory Lorch", "Lannister House", 20); // create the employee but leave in xpc diff --git a/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jpa/epcpropagation/requiresnew/EPCPropagationNewTransactionTestCase.java b/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jpa/epcpropagation/requiresnew/EPCPropagationNewTransactionTestCase.java index e43ea03f68bd..44b32775e6e6 100644 --- a/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jpa/epcpropagation/requiresnew/EPCPropagationNewTransactionTestCase.java +++ b/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jpa/epcpropagation/requiresnew/EPCPropagationNewTransactionTestCase.java @@ -26,6 +26,7 @@ import org.jboss.arquillian.container.test.api.Deployment; import org.jboss.arquillian.junit.Arquillian; +import org.jboss.arquillian.junit.InSequence; import org.jboss.arquillian.test.api.ArquillianResource; import org.jboss.shrinkwrap.api.Archive; import org.jboss.shrinkwrap.api.ShrinkWrap; @@ -63,12 +64,14 @@ protected T lookup(String beanName, Class interfaceType) throws NamingExc } @Test + @InSequence(1) public void testRequiresNewXPCPropagation() throws Exception { BikeManagerBean stateful = lookup(BikeManagerBean.class.getSimpleName(), BikeManagerBean.class); stateful.runTest(); } @Test + @InSequence(2) public void testXPCIsAssociatedWithTX() throws Exception { BikeManagerBean stateful = lookup(BikeManagerBean.class.getSimpleName(), BikeManagerBean.class); stateful.runTest2(); diff --git a/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jpa/hibernate/envers/implementvalidityauditstrategytest/ImplementValidityAuditStrategyTestCase.java b/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jpa/hibernate/envers/implementvalidityauditstrategytest/ImplementValidityAuditStrategyTestCase.java index 8cdcb25155c6..35a6de7957d4 100644 --- a/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jpa/hibernate/envers/implementvalidityauditstrategytest/ImplementValidityAuditStrategyTestCase.java +++ b/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jpa/hibernate/envers/implementvalidityauditstrategytest/ImplementValidityAuditStrategyTestCase.java @@ -31,6 +31,7 @@ import org.hibernate.envers.DefaultRevisionEntity; import org.jboss.arquillian.container.test.api.Deployment; import org.jboss.arquillian.junit.Arquillian; +import org.jboss.arquillian.junit.InSequence; import org.jboss.arquillian.test.api.ArquillianResource; import org.jboss.as.test.integration.jpa.hibernate.envers.Organization; import org.jboss.as.test.integration.jpa.hibernate.envers.SLSBValidityStrategyOrg; @@ -74,6 +75,7 @@ protected static T lookup(String beanName, Class interfaceType) throws Na } @Test + @InSequence(1) public void testEnversforValidityStrategy() throws Exception { SLSBValidityStrategyOrg slsbvalidityOrg = lookup("SLSBValidityStrategyOrg", SLSBValidityStrategyOrg.class); @@ -95,6 +97,7 @@ public void testEnversforValidityStrategy() throws Exception { } @Test + @InSequence(2) public void testValidityStrategyActivationforEnvers() throws Exception { SLSBValidityStrategyOrg slsbvalidityOrg = lookup("SLSBValidityStrategyOrg", SLSBValidityStrategyOrg.class); diff --git a/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jpa/secondlevelcache/JPA2LCTestCase.java b/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jpa/secondlevelcache/JPA2LCTestCase.java index cc47044d20e8..e4c53f0f5d47 100644 --- a/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jpa/secondlevelcache/JPA2LCTestCase.java +++ b/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jpa/secondlevelcache/JPA2LCTestCase.java @@ -27,30 +27,33 @@ import static org.junit.Assert.fail; import java.sql.Connection; - import javax.naming.InitialContext; import javax.naming.NamingException; import javax.sql.DataSource; import org.jboss.arquillian.container.test.api.Deployment; import org.jboss.arquillian.junit.Arquillian; +import org.jboss.arquillian.junit.InSequence; import org.jboss.arquillian.test.api.ArquillianResource; import org.jboss.shrinkwrap.api.Archive; import org.jboss.shrinkwrap.api.ShrinkWrap; import org.jboss.shrinkwrap.api.spec.JavaArchive; +import org.junit.FixMethodOrder; import org.junit.Test; import org.junit.runner.RunWith; +import org.junit.runners.MethodSorters; /** * JPA Second level cache tests - * + * * @author Scott Marlow and Zbynek Roubalik */ @RunWith(Arquillian.class) +@FixMethodOrder(MethodSorters.NAME_ASCENDING) public class JPA2LCTestCase { private static final String ARCHIVE_NAME = "jpa_SecondLevelCacheTestCase"; - + // cache region name prefix, use getCacheRegionName() method to get the value! private static String CACHE_REGION_NAME = null; @@ -59,12 +62,12 @@ public static Archive deploy() { JavaArchive jar = ShrinkWrap.create(JavaArchive.class, ARCHIVE_NAME + ".jar"); jar.addClasses(JPA2LCTestCase.class, - Employee.class, - SFSB1.class, - SFSB2LC.class + Employee.class, + SFSB1.class, + SFSB2LC.class ); - jar.addAsManifestResource(JPA2LCTestCase.class.getPackage(), "persistence.xml","persistence.xml"); + jar.addAsManifestResource(JPA2LCTestCase.class.getPackage(), "persistence.xml", "persistence.xml"); return jar; } @@ -79,26 +82,27 @@ protected T lookup(String beanName, Class interfaceType) throws NamingExc protected T rawLookup(String name, Class interfaceType) throws NamingException { return interfaceType.cast(iniCtx.lookup(name)); } - + // Cache region name depends on the internal entity cache naming convention: // "fully application scoped persistence unit name" + "the entity class full name" // first part could be rewritten by property "hibernate.cache.region_prefix" // This method returns prefix + package name, the entity name needs to be appended - public String getCacheRegionName() throws Exception{ - - if (CACHE_REGION_NAME == null){ - SFSB2LC sfsb = lookup("SFSB2LC", SFSB2LC.class); - String prefix = sfsb.getCacheRegionName(); - - assertNotNull("'hibernate.cache.region_prefix' is null.", prefix); - CACHE_REGION_NAME = prefix + '.' + this.getClass().getPackage().getName() + '.'; - } - - return CACHE_REGION_NAME; + public String getCacheRegionName() throws Exception { + + if (CACHE_REGION_NAME == null) { + SFSB2LC sfsb = lookup("SFSB2LC", SFSB2LC.class); + String prefix = sfsb.getCacheRegionName(); + + assertNotNull("'hibernate.cache.region_prefix' is null.", prefix); + CACHE_REGION_NAME = prefix + '.' + this.getClass().getPackage().getName() + '.'; + } + + return CACHE_REGION_NAME; } - + @Test + @InSequence(1) public void testMultipleNonTXTransactionalEntityManagerInvocations() throws Exception { SFSB1 sfsb1 = lookup("SFSB1", SFSB1.class); sfsb1.createEmployee("Kelly Smith", "Watford, England", 1000); @@ -124,130 +128,129 @@ public void testMultipleNonTXTransactionalEntityManagerInvocations() throws Exce } // When caching is disabled, no extra action is done or exception happens - // even if the code marks an entity and/or a query as cacheable - @Test - public void testDisabledCache() throws Exception { - - SFSB2LC sfsb = lookup("SFSB2LC", SFSB2LC.class); - String message = sfsb.disabled2LCCheck(); - - if (!message.equals("OK")){ - fail(message); - } - } - - // When entity caching is enabled, loading all entities at once - // will put all entities in the cache. During the SAME session, - // when looking up for the ID of an entity which was returned by - // the original query, no SQL queries should be executed. - @Test - public void testEntityCacheSameSession() throws Exception { - - SFSB2LC sfsb = lookup("SFSB2LC", SFSB2LC.class); - String message = sfsb.sameSessionCheck(getCacheRegionName()); - - if (!message.equals("OK")){ - fail(message); - } - } - - // When entity caching is enabled, loading all entities at once - // will put all entities in the cache. During the SECOND session, - // when looking up for the ID of an entity which was returned by - // the original query, no SQL queries should be executed. - @Test - public void testEntityCacheSecondSession() throws Exception { - - SFSB2LC sfsb = lookup("SFSB2LC", SFSB2LC.class); - String message = sfsb.secondSessionCheck(getCacheRegionName()); - - if (!message.equals("OK")){ - fail(message); - } - - } - - // Check if evicting entity second level cache is working as expected - @Test - public void testEvictEntityCache() throws Exception { - - SFSB2LC sfsb = lookup("SFSB2LC", SFSB2LC.class); - String message = sfsb.addEntitiesAndEvictAll(getCacheRegionName()); - - if (!message.equals("OK")){ - fail(message); - } - - message = sfsb.evictedEntityCacheCheck(getCacheRegionName()); - - if (!message.equals("OK")){ - fail(message); - } - } - - // When query caching is enabled, running the same query twice - // without any operations between them will perform SQL queries only once. - @Test - public void testSameQueryTwice() throws Exception { - - SFSB2LC sfsb = lookup("SFSB2LC", SFSB2LC.class); - String id = "1"; - - String message = sfsb.queryCacheCheck(id); - - if (!message.equals("OK")){ - fail(message); - } - } - + // even if the code marks an entity and/or a query as cacheable + @Test + @InSequence(2) + public void testDisabledCache() throws Exception { + + SFSB2LC sfsb = lookup("SFSB2LC", SFSB2LC.class); + String message = sfsb.disabled2LCCheck(); + + if (!message.equals("OK")) { + fail(message); + } + } + + // When entity caching is enabled, loading all entities at once + // will put all entities in the cache. During the SAME session, + // when looking up for the ID of an entity which was returned by + // the original query, no SQL queries should be executed. + @Test + @InSequence(3) + public void testEntityCacheSameSession() throws Exception { + SFSB2LC sfsb = lookup("SFSB2LC", SFSB2LC.class); + String message = sfsb.sameSessionCheck(getCacheRegionName()); + if (!message.equals("OK")) { + fail(message); + } + } + + // When entity caching is enabled, loading all entities at once + // will put all entities in the cache. During the SECOND session, + // when looking up for the ID of an entity which was returned by + // the original query, no SQL queries should be executed. + @Test + @InSequence(4) + public void testEntityCacheSecondSession() throws Exception { + + SFSB2LC sfsb = lookup("SFSB2LC", SFSB2LC.class); + String message = sfsb.secondSessionCheck(getCacheRegionName()); + + if (!message.equals("OK")) { + fail(message); + } + + } + + // Check if evicting entity second level cache is working as expected + @Test + @InSequence(5) + public void testEvictEntityCache() throws Exception { + SFSB2LC sfsb = lookup("SFSB2LC", SFSB2LC.class); + String message = sfsb.addEntitiesAndEvictAll(getCacheRegionName()); + + if (!message.equals("OK")) { + fail(message); + } + + message = sfsb.evictedEntityCacheCheck(getCacheRegionName()); + + if (!message.equals("OK")) { + fail(message); + } + } + + // When query caching is enabled, running the same query twice + // without any operations between them will perform SQL queries only once. + @Test + @InSequence(6) + public void testSameQueryTwice() throws Exception { + + SFSB2LC sfsb = lookup("SFSB2LC", SFSB2LC.class); + String id = "1"; + + String message = sfsb.queryCacheCheck(id); + + if (!message.equals("OK")) { + fail(message); + } + } + //When query caching is enabled, running a query to return all entities of a class // and then adding one entity of such class would invalidate the cache @Test + @InSequence(7) public void testInvalidateQuery() throws Exception { SFSB2LC sfsb = lookup("SFSB2LC", SFSB2LC.class); String id = "2"; String message = sfsb.queryCacheCheck(id); - - if (!message.equals("OK")){ + + if (!message.equals("OK")) { fail(message); } - + // invalidate the cache sfsb.createEmployee("Newman", "Paul", 400); - + message = sfsb.queryCacheCheck(id); - if (!message.equals("OK")){ + if (!message.equals("OK")) { + fail(message); + } + + } + + // Check if evicting query cache is working as expected + @Test + @InSequence(8) + public void testEvictQueryCache() throws Exception { + SFSB2LC sfsb = lookup("SFSB2LC", SFSB2LC.class); + String id = "3"; + String message = sfsb.queryCacheCheck(id); + if (!message.equals("OK")) { + fail(message); + } + // evict query cache + sfsb.evictQueryCache(); + message = sfsb.queryCacheCheckIfEmpty(id); + + if (!message.equals("OK")) { fail(message); } } - - // Check if evicting query cache is working as expected - @Test - public void testEvictQueryCache() throws Exception { - - SFSB2LC sfsb = lookup("SFSB2LC", SFSB2LC.class); - String id = "3"; - - String message = sfsb.queryCacheCheck(id); - - if (!message.equals("OK")){ - fail(message); - } - - // evict query cache - sfsb.evictQueryCache(); - - message = sfsb.queryCacheCheckIfEmpty(id); - - if (!message.equals("OK")){ - fail(message); - } - - } } diff --git a/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jpa/transaction/TransactionTestCase.java b/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jpa/transaction/TransactionTestCase.java index ace89a040d68..0ee4cdc94733 100644 --- a/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jpa/transaction/TransactionTestCase.java +++ b/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/jpa/transaction/TransactionTestCase.java @@ -33,10 +33,10 @@ import org.jboss.arquillian.container.test.api.Deployment; import org.jboss.arquillian.junit.Arquillian; +import org.jboss.arquillian.junit.InSequence; import org.jboss.arquillian.test.api.ArquillianResource; import org.jboss.shrinkwrap.api.Archive; import org.jboss.shrinkwrap.api.ShrinkWrap; -import org.jboss.shrinkwrap.api.asset.StringAsset; import org.jboss.shrinkwrap.api.spec.JavaArchive; import org.junit.Test; import org.junit.runner.RunWith; @@ -79,6 +79,7 @@ protected T rawLookup(String name, Class interfaceType) throws NamingExce } @Test + @InSequence(1) public void testMultipleNonTXTransactionalEntityManagerInvocations() throws Exception { SFSB1 sfsb1 = lookup("SFSB1", SFSB1.class); sfsb1.getEmployeeNoTX(1); // For each call in, we will use a transactional entity manager @@ -89,6 +90,7 @@ public void testMultipleNonTXTransactionalEntityManagerInvocations() throws Exce } @Test + @InSequence(2) public void testQueryNonTXTransactionalEntityManagerInvocations() throws Exception { SFSB1 sfsb1 = lookup("SFSB1", SFSB1.class); String name = sfsb1.queryEmployeeNameNoTX(1); @@ -99,6 +101,7 @@ public void testQueryNonTXTransactionalEntityManagerInvocations() throws Excepti // For a transaction scoped persistence context non jta-tx invocation, entities returned from Query // must be detached. @Test + @InSequence(3) public void testQueryNonTXTransactionalDetach() throws Exception { SFSB1 sfsb1 = lookup("SFSB1", SFSB1.class); sfsb1.createEmployee("Jill", "54 Country Lane", 2); @@ -115,6 +118,7 @@ public void testQueryNonTXTransactionalDetach() throws Exception { * @throws Exception */ @Test + @InSequence(4) public void testTransactionRequiredException() throws Exception { Throwable error = null; try { @@ -143,6 +147,7 @@ public void testTransactionRequiredException() throws Exception { * 3) The transaction fails after the DAO calls and the JTA transaction is rolled back and no database changes should occur. */ @Test + @InSequence(5) public void testFailInDAOCalls() throws Exception { SLSB1 slsb1 = lookup("SLSB1", SLSB1.class); slsb1.addEmployee(); @@ -158,6 +163,7 @@ public void testFailInDAOCalls() throws Exception { } @Test + @InSequence(6) public void testUserTxRollbackDiscardsChanges() throws Exception { SFSBXPC sfsbxpc = lookup("SFSBXPC", SFSBXPC.class); sfsbxpc.createEmployeeNoTx("Amory Lorch", "Lannister House", 10); // create the employee but leave in xpc @@ -173,6 +179,7 @@ public void testUserTxRollbackDiscardsChanges() throws Exception { } @Test + @InSequence(7) public void testEnlistXPCInUserTx() throws Exception { SFSBXPC sfsbxpc = lookup("SFSBXPC", SFSBXPC.class); sfsbxpc.createEmployeeNoTx("Amory Lorch", "Lannister House", 20); // create the employee but leave in xpc diff --git a/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/management/api/expression/ExpressionSubstitutionInContainerTestCase.java b/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/management/api/expression/ExpressionSubstitutionInContainerTestCase.java index f9e6c7a012a8..37f1f4b20206 100644 --- a/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/management/api/expression/ExpressionSubstitutionInContainerTestCase.java +++ b/testsuite/integration/basic/src/test/java/org/jboss/as/test/integration/management/api/expression/ExpressionSubstitutionInContainerTestCase.java @@ -28,6 +28,7 @@ import org.jboss.arquillian.container.test.api.Deployment; import org.jboss.arquillian.junit.Arquillian; +import org.jboss.arquillian.junit.InSequence; import org.jboss.arquillian.test.api.ArquillianResource; import org.jboss.as.arquillian.container.ManagementClient; import org.jboss.as.test.integration.management.util.ModelUtil; @@ -96,6 +97,7 @@ public static Archive deploy() { * */ @Test + @InSequence(1) public void testPropertyDefinedFirst() { Utils.setProperty(EXPRESSION_PROP_NAME, EXPRESSION_PROP_VALUE, managementClient.getControllerClient()); Utils.setProperty(PROP_NAME, "${" + EXPRESSION_PROP_NAME + ":" + PROP_DEFAULT_VALUE + "}", managementClient.getControllerClient()); @@ -116,6 +118,7 @@ public void testPropertyDefinedFirst() { */ @Ignore("AS7-6431") @Test + @InSequence(2) public void testExpressionDefinedFirst() { Utils.setProperty(PROP_NAME, "${" + EXPRESSION_PROP_NAME + ":" + PROP_DEFAULT_VALUE + "}", managementClient.getControllerClient()); Utils.setProperty(EXPRESSION_PROP_NAME, EXPRESSION_PROP_VALUE, managementClient.getControllerClient()); @@ -134,6 +137,7 @@ public void testExpressionDefinedFirst() { * */ @Test + @InSequence(3) public void testSystemPropertyEvaluation() { // the system property has to be defined in the same VM as the container resides bean.addSystemProperty(EXPRESSION_PROP_NAME, EXPRESSION_PROP_VALUE); @@ -154,6 +158,7 @@ public void testSystemPropertyEvaluation() { * */ @Test + @InSequence(4) public void testSystemPropertyEvaluationSetAfterExpression() { Utils.setProperty(PROP_NAME, "${" + EXPRESSION_PROP_NAME + ":" + PROP_DEFAULT_VALUE + "}", managementClient.getControllerClient()); // the system property has to be defined in the same VM as the container resides @@ -191,6 +196,7 @@ private void systemPropertyEvaluation() { * */ @Test + @InSequence(5) public void testMultipleLevelExpression() { Utils.setProperty(EXPRESSION_PROP_NAME, EXPRESSION_PROP_VALUE, managementClient.getControllerClient()); Utils.setProperty(INNER_PROP_NAME, "${" + EXPRESSION_PROP_NAME + ":" + INNER_PROP_DEFAULT_VALUE + "}", managementClient.getControllerClient()); @@ -227,6 +233,7 @@ public void testMultipleLevelExpression() { */ @Ignore("AS7-6431") // for this test works there will be :reload after redefinition @Test + @InSequence(6) public void testRedefinitionExpressionValue() { Utils.setProperty(EXPRESSION_PROP_NAME, "firstly.defined.value.", managementClient.getControllerClient()); Utils.setProperty(PROP_NAME, "${" + EXPRESSION_PROP_NAME + ":" + PROP_DEFAULT_VALUE + "}", managementClient.getControllerClient()); diff --git a/testsuite/integration/clust/src/test/java/org/jboss/as/test/clustering/cluster/ejb3/stateful/remote/failover/RemoteEJBClientStatefulBeanFailoverTestCase.java b/testsuite/integration/clust/src/test/java/org/jboss/as/test/clustering/cluster/ejb3/stateful/remote/failover/RemoteEJBClientStatefulBeanFailoverTestCase.java index e666e96164df..1c067adffd2d 100644 --- a/testsuite/integration/clust/src/test/java/org/jboss/as/test/clustering/cluster/ejb3/stateful/remote/failover/RemoteEJBClientStatefulBeanFailoverTestCase.java +++ b/testsuite/integration/clust/src/test/java/org/jboss/as/test/clustering/cluster/ejb3/stateful/remote/failover/RemoteEJBClientStatefulBeanFailoverTestCase.java @@ -37,6 +37,7 @@ import org.jboss.arquillian.container.test.api.RunAsClient; import org.jboss.arquillian.container.test.api.TargetsContainer; import org.jboss.arquillian.junit.Arquillian; +import org.jboss.arquillian.junit.InSequence; import org.jboss.arquillian.test.api.ArquillianResource; import org.jboss.as.test.clustering.EJBClientContextSelector; import org.jboss.as.test.clustering.EJBDirectory; @@ -125,6 +126,7 @@ public static void destroy() throws NamingException { * @throws Exception */ @Test + @InSequence(1) public void testFailoverFromRemoteClientWhenOneNodeGoesDown() throws Exception { this.failoverFromRemoteClient(false); } @@ -135,6 +137,7 @@ public void testFailoverFromRemoteClientWhenOneNodeGoesDown() throws Exception { * @throws Exception */ @Test + @InSequence(2) public void testFailoverFromRemoteClientWhenOneNodeUndeploys() throws Exception { this.failoverFromRemoteClient(true);