From fbd36ac20d26cdd4cf9eb54b53f8422d269f2345 Mon Sep 17 00:00:00 2001 From: jbliznak Date: Tue, 4 Sep 2018 09:23:47 +0200 Subject: [PATCH] [RESTEASY-2003] Isolate container standalone dir in tests * [RESTEASY-2003] Make sure distribution is downloaded before any config changes * [RESTEASY-2003] Use isolated standalone dirs for containers running simultaneously --- .../org/jboss/resteasy/utils/LogCounter.java | 17 +++++- .../org/jboss/resteasy/utils/TestUtil.java | 55 +++++++++++++++++-- .../deployment/pom.xml | 6 +- .../integration-tests-spring/inmodule/pom.xml | 6 +- testsuite/integration-tests/pom.xml | 45 ++++++++++++++- .../resteasy/test/ContainerConstants.java | 16 ++++++ .../test/cdi/basic/CDIResourceTest.java | 4 +- .../test/client/ClientBuilderTest.java | 14 +++-- .../core/basic/DuplicateDeploymentTest.java | 4 +- .../test/core/logging/DebugLoggingTest.java | 25 +++++---- .../spi/ResourceClassProcessorErrorTest.java | 3 +- .../AllowGzipOnServerAbstractTestBase.java | 22 ++++---- .../DuplicateProviderRegistrationTest.java | 7 ++- .../providers/custom/MissingProducerTest.java | 8 ++- .../JsonBindingAnnotationsJacksonTest.java | 3 +- .../request/NotFoundErrorMessageTest.java | 4 +- .../test/response/DuplicitePathTest.java | 3 +- .../test/warning/SubResourceWarningTest.java | 6 +- .../src/test/resources/arquillian.xml | 14 +++-- testsuite/pom.xml | 2 +- 20 files changed, 196 insertions(+), 68 deletions(-) create mode 100755 testsuite/integration-tests/src/test/java/org/jboss/resteasy/test/ContainerConstants.java diff --git a/testsuite/arquillian-utils/src/main/java/org/jboss/resteasy/utils/LogCounter.java b/testsuite/arquillian-utils/src/main/java/org/jboss/resteasy/utils/LogCounter.java index d66a3e440f3..f8e8e18c97c 100644 --- a/testsuite/arquillian-utils/src/main/java/org/jboss/resteasy/utils/LogCounter.java +++ b/testsuite/arquillian-utils/src/main/java/org/jboss/resteasy/utils/LogCounter.java @@ -20,16 +20,27 @@ public class LogCounter { private boolean onServer; - public LogCounter(String message, boolean onServer) { + /** + * Container qualifier when arquillian starts multiple instance, null otherwise. + */ + private String containerQualifier; + + + public LogCounter(String message, boolean onServer, String containerQualifier) { this.message = message; this.onServer = onServer; - initCount = TestUtil.getWarningCount(message, onServer); + this.containerQualifier = containerQualifier; + this.initCount = TestUtil.getWarningCount(message, onServer, containerQualifier); + } + + public LogCounter(String message, boolean onServer) { + this(message, onServer, null); } /** * Get count of examined log message, logged after creation of this LogCounter */ public int count() { - return TestUtil.getWarningCount(message, onServer) - initCount; + return TestUtil.getWarningCount(message, onServer, containerQualifier) - initCount; } } \ No newline at end of file diff --git a/testsuite/arquillian-utils/src/main/java/org/jboss/resteasy/utils/TestUtil.java b/testsuite/arquillian-utils/src/main/java/org/jboss/resteasy/utils/TestUtil.java index 9c358e8e7f4..e719060436e 100644 --- a/testsuite/arquillian-utils/src/main/java/org/jboss/resteasy/utils/TestUtil.java +++ b/testsuite/arquillian-utils/src/main/java/org/jboss/resteasy/utils/TestUtil.java @@ -245,6 +245,40 @@ public static String getJbossHome(boolean onServer) { return System.getProperty("jboss.home.dir", ""); } + /** + * Get the path to the containers base dir for standalone mode (configuration, logs, etc..). + * When arquillian.xml contains more containers that could be started simultaneously the parameter containerQualifier + * is used to determine which base dir to get. + * @param containerQualifier container qualifier or null if the arquillian.xml contains max 1 container available + * to be running at time + * @return absolute path to base dir + */ + public static String getStandaloneDir(String containerQualifier) { + return getStandaloneDir(false, containerQualifier); + } + + /** + * Get the path to the containers base dir for standalone mode (configuration, logs, etc..). + * When arquillian.xml contains more containers that could be started simultaneously the parameter containerQualifier + * is used to determine which base dir to get. + * @param onServer whether the check is made from client side (the path is constructed) or from deployment (the path + * is read from actual runtime value) + * @param containerQualifier container qualifier or null if the arquillian.xml contains max 1 container available + * to be running at time; this has no effect when onServer is true + * @return absolute path to base dir + */ + public static String getStandaloneDir(boolean onServer, String containerQualifier) { + if (onServer == false) { + if (containerQualifier == null) { + return new File(getJbossHome(), "standalone").getAbsolutePath(); + } else { + return new File("target", containerQualifier).getAbsolutePath(); + } + } else { + return System.getProperty("jboss.server.base.dir", ""); + } + } + public static boolean isOpenJDK() { return System.getProperty("java.runtime.name").toLowerCase().contains("openjdk"); } @@ -286,10 +320,14 @@ public static List readServerLogLines() { } public static List readServerLogLines(boolean onServer) { - String jbossHome = TestUtil.getJbossHome(onServer); - String logPath = String.format("%s%sstandalone%slog%sserver.log", jbossHome, - (jbossHome.endsWith(File.separator) || jbossHome.endsWith("/")) ? "" : File.separator, - File.separator, File.separator); + return readServerLogLines(onServer, null); + } + + public static List readServerLogLines(boolean onServer, String containerQualifier) { + String standaloneDir = TestUtil.getStandaloneDir(onServer, containerQualifier); + String logPath = String.format("%s%slog%sserver.log", standaloneDir, + (standaloneDir.endsWith(File.separator) || standaloneDir.endsWith("/")) ? "" : File.separator, + File.separator); logPath = logPath.replace('/', File.separatorChar); try { return Files.readAllLines(Paths.get(logPath)); // UTF8 is used by default @@ -310,8 +348,15 @@ public static List readServerLogLines(boolean onServer) { * Get count of lines with specific string in log */ public static int getWarningCount(String findedString, boolean onServer) { + return getWarningCount(findedString, onServer, null); + } + + /** + * Get count of lines with specific string in log + */ + public static int getWarningCount(String findedString, boolean onServer, String containerQualifier) { int count = 0; - List lines = TestUtil.readServerLogLines(onServer); + List lines = TestUtil.readServerLogLines(onServer, containerQualifier); for (String line : lines) { if (line.contains(findedString)) { count++; diff --git a/testsuite/integration-tests-spring/deployment/pom.xml b/testsuite/integration-tests-spring/deployment/pom.xml index 8e552900763..38a60094d2c 100644 --- a/testsuite/integration-tests-spring/deployment/pom.xml +++ b/testsuite/integration-tests-spring/deployment/pom.xml @@ -33,7 +33,7 @@ unpack - process-test-classes + generate-test-resources unpack @@ -57,8 +57,8 @@ maven-antrun-plugin - unpack resteasy - process-test-classes + unpack-resteasy + generate-test-resources + 10990 + jbossas-managed + jbossas-manual-gzip resteasy-integration-tests @@ -37,7 +45,7 @@ unpack - process-test-classes + generate-test-resources unpack @@ -61,8 +69,8 @@ maven-antrun-plugin - unpack resteasy - process-test-classes + unpack-resteasy + generate-test-resources + + + + + + + + + + + + + + run + + + + maven-surefire-plugin diff --git a/testsuite/integration-tests/src/test/java/org/jboss/resteasy/test/ContainerConstants.java b/testsuite/integration-tests/src/test/java/org/jboss/resteasy/test/ContainerConstants.java new file mode 100755 index 00000000000..f764ffaf5d3 --- /dev/null +++ b/testsuite/integration-tests/src/test/java/org/jboss/resteasy/test/ContainerConstants.java @@ -0,0 +1,16 @@ +package org.jboss.resteasy.test; + +import java.io.File; + +/** + * Various contants for containers defined in arquillian.xml. Keep this file in sync with the values there. + */ +public class ContainerConstants { + + public static final String DEFAULT_CONTAINER_QUALIFIER = "jbossas-managed"; + + public static final String GZIP_CONTAINER_QUALIFIER = "jbossas-manual-gzip"; + + public static final int GZIP_CONTAINER_PORT_OFFSET = 1000; + +} diff --git a/testsuite/integration-tests/src/test/java/org/jboss/resteasy/test/cdi/basic/CDIResourceTest.java b/testsuite/integration-tests/src/test/java/org/jboss/resteasy/test/cdi/basic/CDIResourceTest.java index 396c21453bb..13e73162957 100644 --- a/testsuite/integration-tests/src/test/java/org/jboss/resteasy/test/cdi/basic/CDIResourceTest.java +++ b/testsuite/integration-tests/src/test/java/org/jboss/resteasy/test/cdi/basic/CDIResourceTest.java @@ -8,6 +8,7 @@ import org.apache.logging.log4j.Logger; import org.jboss.arquillian.container.test.api.RunAsClient; import org.jboss.arquillian.junit.Arquillian; +import org.jboss.resteasy.test.ContainerConstants; import org.jboss.resteasy.util.HttpResponseCodes; import org.jboss.resteasy.utils.PermissionUtil; import org.jboss.resteasy.utils.PortProviderUtil; @@ -58,8 +59,7 @@ public class CDIResourceTest { static { toStr = new StringBuilder() - .append(TestUtil.getJbossHome()).append(File.separator) - .append("standalone").append(File.separator) + .append(TestUtil.getStandaloneDir(ContainerConstants.DEFAULT_CONTAINER_QUALIFIER)).append(File.separator) .append("deployments").append(File.separator) .append(WAR_NAME).toString(); exportFile = new File(FileSystems.getDefault().getPath("target").toFile(), WAR_NAME); diff --git a/testsuite/integration-tests/src/test/java/org/jboss/resteasy/test/client/ClientBuilderTest.java b/testsuite/integration-tests/src/test/java/org/jboss/resteasy/test/client/ClientBuilderTest.java index 25fdcbb7bc0..44f41bc9d41 100644 --- a/testsuite/integration-tests/src/test/java/org/jboss/resteasy/test/client/ClientBuilderTest.java +++ b/testsuite/integration-tests/src/test/java/org/jboss/resteasy/test/client/ClientBuilderTest.java @@ -22,6 +22,8 @@ import java.util.PropertyPermission; import java.util.logging.LoggingPermission; +import static org.jboss.resteasy.test.ContainerConstants.DEFAULT_CONTAINER_QUALIFIER; + /** * @tpSubChapter Resteasy-client * @tpChapter Unit tests @@ -38,7 +40,7 @@ public static Archive deploy() { war.addClass(NotForForwardCompatibility.class); // Arquillian in the deployment and use of TestUtil war.addAsManifestResource(PermissionUtil.createPermissionsXmlAsset(new ReflectPermission("suppressAccessChecks"), - new FilePermission(TestUtil.getJbossHome() + File.separator + "standalone" + File.separator + "log" + + new FilePermission(TestUtil.getStandaloneDir(DEFAULT_CONTAINER_QUALIFIER) + File.separator + "log" + File.separator + "server.log", "read"), new LoggingPermission("control", ""), new PropertyPermission("arquillian.*", "read"), @@ -58,7 +60,7 @@ public boolean configure(FeatureContext context) { } private int getWarningCount() { - return TestUtil.getWarningCount("RESTEASY002155", true); + return TestUtil.getWarningCount("RESTEASY002155", true, DEFAULT_CONTAINER_QUALIFIER); } /** @@ -86,16 +88,16 @@ public void testDoubleClassRegistration() { @Test @Category({NotForForwardCompatibility.class}) public void testDoubleRegistration() { - int countRESTEASY002160 = TestUtil.getWarningCount("RESTEASY002160", true); - int countRESTEASY002155 = TestUtil.getWarningCount("RESTEASY002155", true); + int countRESTEASY002160 = TestUtil.getWarningCount("RESTEASY002160", true, DEFAULT_CONTAINER_QUALIFIER); + int countRESTEASY002155 = TestUtil.getWarningCount("RESTEASY002155", true, DEFAULT_CONTAINER_QUALIFIER); Client client = ClientBuilder.newClient(); int count = client.getConfiguration().getInstances().size(); Object reg = new FeatureReturningFalse(); client.register(reg).register(reg); client.register(FeatureReturningFalse.class).register(FeatureReturningFalse.class); - Assert.assertEquals("Expect 1 warnining messages of Provider instance is already registered", 1, TestUtil.getWarningCount("RESTEASY002160", true) - countRESTEASY002160); - Assert.assertEquals("Expect 1 warnining messages of Provider class is already registered", 2, TestUtil.getWarningCount("RESTEASY002155", true) - countRESTEASY002155); + Assert.assertEquals("Expect 1 warnining messages of Provider instance is already registered", 1, TestUtil.getWarningCount("RESTEASY002160", true, DEFAULT_CONTAINER_QUALIFIER) - countRESTEASY002160); + Assert.assertEquals("Expect 1 warnining messages of Provider class is already registered", 2, TestUtil.getWarningCount("RESTEASY002155", true, DEFAULT_CONTAINER_QUALIFIER) - countRESTEASY002155); Assert.assertEquals(count + 1, client.getConfiguration().getInstances().size()); client.close(); diff --git a/testsuite/integration-tests/src/test/java/org/jboss/resteasy/test/core/basic/DuplicateDeploymentTest.java b/testsuite/integration-tests/src/test/java/org/jboss/resteasy/test/core/basic/DuplicateDeploymentTest.java index f9c50407e4a..b71dc161722 100644 --- a/testsuite/integration-tests/src/test/java/org/jboss/resteasy/test/core/basic/DuplicateDeploymentTest.java +++ b/testsuite/integration-tests/src/test/java/org/jboss/resteasy/test/core/basic/DuplicateDeploymentTest.java @@ -19,6 +19,8 @@ import org.junit.experimental.categories.Category; import org.junit.runner.RunWith; +import static org.jboss.resteasy.test.ContainerConstants.DEFAULT_CONTAINER_QUALIFIER; + /** * @tpSubChapter Response * @tpChapter Integration tests @@ -31,7 +33,7 @@ public class DuplicateDeploymentTest { private static int initWarningCount = 0; private static int getWarningCount() { - return TestUtil.getWarningCount("RESTEASY002172", false); + return TestUtil.getWarningCount("RESTEASY002172", false, DEFAULT_CONTAINER_QUALIFIER); } @Deployment diff --git a/testsuite/integration-tests/src/test/java/org/jboss/resteasy/test/core/logging/DebugLoggingTest.java b/testsuite/integration-tests/src/test/java/org/jboss/resteasy/test/core/logging/DebugLoggingTest.java index 6f6efcc6f39..ce703065ef5 100644 --- a/testsuite/integration-tests/src/test/java/org/jboss/resteasy/test/core/logging/DebugLoggingTest.java +++ b/testsuite/integration-tests/src/test/java/org/jboss/resteasy/test/core/logging/DebugLoggingTest.java @@ -34,6 +34,7 @@ import static org.hamcrest.Matchers.greaterThan; import static org.hamcrest.core.Is.is; +import static org.jboss.resteasy.test.ContainerConstants.DEFAULT_CONTAINER_QUALIFIER; /** * @tpSubChapter Interceptors @@ -109,10 +110,10 @@ public void after() throws Exception { @Test public void testBuildIn() throws Exception { // count log messages before request - LogCounter bodyReaderStringLog = new LogCounter("MessageBodyReader: org.jboss.resteasy.plugins.providers.StringTextStar", false); - LogCounter bodyWriterStringLog = new LogCounter("MessageBodyWriter: org.jboss.resteasy.plugins.providers.StringTextStar", false); - LogCounter readerInterceptorLog = new LogCounter("ReaderInterceptor: org.jboss.resteasy.security.doseta.DigitalVerificationInterceptor", false); - LogCounter writerInterceptorLog = new LogCounter("WriterInterceptor: org.jboss.resteasy.security.doseta.DigitalSigningInterceptor", false); + LogCounter bodyReaderStringLog = new LogCounter("MessageBodyReader: org.jboss.resteasy.plugins.providers.StringTextStar", false, DEFAULT_CONTAINER_QUALIFIER); + LogCounter bodyWriterStringLog = new LogCounter("MessageBodyWriter: org.jboss.resteasy.plugins.providers.StringTextStar", false, DEFAULT_CONTAINER_QUALIFIER); + LogCounter readerInterceptorLog = new LogCounter("ReaderInterceptor: org.jboss.resteasy.security.doseta.DigitalVerificationInterceptor", false, DEFAULT_CONTAINER_QUALIFIER); + LogCounter writerInterceptorLog = new LogCounter("WriterInterceptor: org.jboss.resteasy.security.doseta.DigitalSigningInterceptor", false, DEFAULT_CONTAINER_QUALIFIER); // perform request WebTarget base = client.target(PortProviderUtil.generateURL("/build/in", BUILD_IN)); @@ -135,16 +136,16 @@ public void testBuildIn() throws Exception { @Test public void testCustom() throws Exception { // count log messages before request - LogCounter bodyReaderStringLog = new LogCounter("MessageBodyReader: org.jboss.resteasy.plugins.providers.StringTextStar", false); - LogCounter bodyWriterStringLog = new LogCounter("MessageBodyWriter: org.jboss.resteasy.plugins.providers.StringTextStar", false); - LogCounter readerInterceptorLog = new LogCounter("ReaderInterceptor: org.jboss.resteasy.test.core.logging.resource.DebugLoggingReaderInterceptorCustom", false); - LogCounter writerInterceptorLog = new LogCounter("WriterInterceptor: org.jboss.resteasy.test.core.logging.resource.DebugLoggingWriterInterceptorCustom", false); - LogCounter bodyReaderCustomLog = new LogCounter("MessageBodyReader: org.jboss.resteasy.test.core.logging.resource.DebugLoggingCustomReaderAndWriter", false); - LogCounter bodyWriterCustomLog = new LogCounter("MessageBodyWriter: org.jboss.resteasy.test.core.logging.resource.DebugLoggingCustomReaderAndWriter", false); + LogCounter bodyReaderStringLog = new LogCounter("MessageBodyReader: org.jboss.resteasy.plugins.providers.StringTextStar", false, DEFAULT_CONTAINER_QUALIFIER); + LogCounter bodyWriterStringLog = new LogCounter("MessageBodyWriter: org.jboss.resteasy.plugins.providers.StringTextStar", false, DEFAULT_CONTAINER_QUALIFIER); + LogCounter readerInterceptorLog = new LogCounter("ReaderInterceptor: org.jboss.resteasy.test.core.logging.resource.DebugLoggingReaderInterceptorCustom", false, DEFAULT_CONTAINER_QUALIFIER); + LogCounter writerInterceptorLog = new LogCounter("WriterInterceptor: org.jboss.resteasy.test.core.logging.resource.DebugLoggingWriterInterceptorCustom", false, DEFAULT_CONTAINER_QUALIFIER); + LogCounter bodyReaderCustomLog = new LogCounter("MessageBodyReader: org.jboss.resteasy.test.core.logging.resource.DebugLoggingCustomReaderAndWriter", false, DEFAULT_CONTAINER_QUALIFIER); + LogCounter bodyWriterCustomLog = new LogCounter("MessageBodyWriter: org.jboss.resteasy.test.core.logging.resource.DebugLoggingCustomReaderAndWriter", false, DEFAULT_CONTAINER_QUALIFIER); // perform request - TestUtil.getWarningCount("MessageBodyReader: org.jboss.resteasy.plugins.providers.StringTextStar", false); - TestUtil.getWarningCount("MessageBodyWriter: org.jboss.resteasy.plugins.providers.StringTextStar", false); + TestUtil.getWarningCount("MessageBodyReader: org.jboss.resteasy.plugins.providers.StringTextStar", false, DEFAULT_CONTAINER_QUALIFIER); + TestUtil.getWarningCount("MessageBodyWriter: org.jboss.resteasy.plugins.providers.StringTextStar", false, DEFAULT_CONTAINER_QUALIFIER); WebTarget base = client.target(PortProviderUtil.generateURL("/custom", CUSTOM)); Response response = base.request().post(Entity.entity("data", "aaa/bbb")); Assert.assertEquals(HttpResponseCodes.SC_OK, response.getStatus()); diff --git a/testsuite/integration-tests/src/test/java/org/jboss/resteasy/test/core/spi/ResourceClassProcessorErrorTest.java b/testsuite/integration-tests/src/test/java/org/jboss/resteasy/test/core/spi/ResourceClassProcessorErrorTest.java index 57f9ae96ade..375f42a6d1a 100644 --- a/testsuite/integration-tests/src/test/java/org/jboss/resteasy/test/core/spi/ResourceClassProcessorErrorTest.java +++ b/testsuite/integration-tests/src/test/java/org/jboss/resteasy/test/core/spi/ResourceClassProcessorErrorTest.java @@ -18,6 +18,7 @@ import org.junit.runner.RunWith; import static org.hamcrest.Matchers.greaterThanOrEqualTo; +import static org.jboss.resteasy.test.ContainerConstants.DEFAULT_CONTAINER_QUALIFIER; /** * @tpSubChapter ResourceClassProcessor SPI @@ -55,7 +56,7 @@ public static Archive deploy() { @Test public void errorTest() { LogCounter errorLogCounter = new LogCounter("java.lang.RuntimeException: Exception from ResourceClassProcessorErrorImplementation", - false); + false, DEFAULT_CONTAINER_QUALIFIER); try { deployer.deploy(DEPLOYMENT_NAME); Assert.fail("Exception from ResourceClassProcessor was not thrown"); diff --git a/testsuite/integration-tests/src/test/java/org/jboss/resteasy/test/interceptor/gzip/AllowGzipOnServerAbstractTestBase.java b/testsuite/integration-tests/src/test/java/org/jboss/resteasy/test/interceptor/gzip/AllowGzipOnServerAbstractTestBase.java index 2c7eb382e7f..e4feba16ade 100644 --- a/testsuite/integration-tests/src/test/java/org/jboss/resteasy/test/interceptor/gzip/AllowGzipOnServerAbstractTestBase.java +++ b/testsuite/integration-tests/src/test/java/org/jboss/resteasy/test/interceptor/gzip/AllowGzipOnServerAbstractTestBase.java @@ -10,6 +10,9 @@ import org.junit.After; import org.junit.Before; +import static org.jboss.resteasy.test.ContainerConstants.GZIP_CONTAINER_PORT_OFFSET; +import static org.jboss.resteasy.test.ContainerConstants.GZIP_CONTAINER_QUALIFIER; + /** * Abstract base class for tests with gzip enabled on server side. * @@ -21,13 +24,8 @@ */ public class AllowGzipOnServerAbstractTestBase extends GzipAbstractTestBase { - /** - * Name of server with allowed gzip - */ - protected static final String GZIP_SERVER_NAME = "jbossas-manual-gzip"; - //keep in sync with offset in arquillian.xml - protected static String gzipServerBaseUrl = "http://" + PortProviderUtil.getHost() + ":" + (PortProviderUtil.getPort() + 1000); + protected static String gzipServerBaseUrl = "http://" + PortProviderUtil.getHost() + ":" + (PortProviderUtil.getPort() + GZIP_CONTAINER_PORT_OFFSET); @ArquillianResource protected ContainerController containerController; @@ -37,8 +35,8 @@ public class AllowGzipOnServerAbstractTestBase extends GzipAbstractTestBase { @Before public void startContainerWithGzipEnabledAndDeploy() { - if (!containerController.isStarted(GZIP_SERVER_NAME)) { - containerController.start(GZIP_SERVER_NAME); + if (!containerController.isStarted(GZIP_CONTAINER_QUALIFIER)) { + containerController.start(GZIP_CONTAINER_QUALIFIER); } deployer.deploy(WAR_WITH_PROVIDERS_FILE); @@ -47,10 +45,10 @@ public void startContainerWithGzipEnabledAndDeploy() { @After public void undeployAndStopContainerWithGzipEnabled() { - if (containerController.isStarted(GZIP_SERVER_NAME)) { + if (containerController.isStarted(GZIP_CONTAINER_QUALIFIER)) { deployer.undeploy(WAR_WITH_PROVIDERS_FILE); deployer.undeploy(WAR_WITHOUT_PROVIDERS_FILE); - containerController.stop(GZIP_SERVER_NAME); + containerController.stop(GZIP_CONTAINER_QUALIFIER); } } @@ -58,7 +56,7 @@ public void undeployAndStopContainerWithGzipEnabled() { * Deployment with javax.ws.rs.ext.Providers file, that contains gzip interceptor definition */ @Deployment(name = WAR_WITH_PROVIDERS_FILE, managed = false, testable = false) - @TargetsContainer(GZIP_SERVER_NAME) + @TargetsContainer(GZIP_CONTAINER_QUALIFIER) public static Archive createWebDeploymentWithGzipProvidersFile() { return createWebArchive(WAR_WITH_PROVIDERS_FILE, true); } @@ -67,7 +65,7 @@ public static Archive createWebDeploymentWithGzipProvidersFile() { * Deployment without any javax.ws.rs.ext.Providers file */ @Deployment(name = WAR_WITHOUT_PROVIDERS_FILE, managed = false, testable = false) - @TargetsContainer(GZIP_SERVER_NAME) + @TargetsContainer(GZIP_CONTAINER_QUALIFIER) public static Archive createWebDeploymentWithoutGzipProvidersFile() { return createWebArchive(WAR_WITHOUT_PROVIDERS_FILE, false); } diff --git a/testsuite/integration-tests/src/test/java/org/jboss/resteasy/test/providers/custom/DuplicateProviderRegistrationTest.java b/testsuite/integration-tests/src/test/java/org/jboss/resteasy/test/providers/custom/DuplicateProviderRegistrationTest.java index 4f96f728caf..213ea7ddbf6 100644 --- a/testsuite/integration-tests/src/test/java/org/jboss/resteasy/test/providers/custom/DuplicateProviderRegistrationTest.java +++ b/testsuite/integration-tests/src/test/java/org/jboss/resteasy/test/providers/custom/DuplicateProviderRegistrationTest.java @@ -3,6 +3,7 @@ import org.jboss.arquillian.container.test.api.Deployment; import org.jboss.arquillian.junit.Arquillian; import org.jboss.resteasy.category.NotForForwardCompatibility; +import org.jboss.resteasy.test.ContainerConstants; import org.jboss.resteasy.test.providers.custom.resource.DuplicateProviderRegistrationFeature; import org.jboss.resteasy.test.providers.custom.resource.DuplicateProviderRegistrationFilter; import org.jboss.resteasy.test.providers.custom.resource.DuplicateProviderRegistrationInterceptor; @@ -26,6 +27,8 @@ import java.util.PropertyPermission; import java.util.logging.LoggingPermission; +import static org.jboss.resteasy.test.ContainerConstants.DEFAULT_CONTAINER_QUALIFIER; + /** * @tpSubChapter Providers * @tpChapter Integration tests @@ -41,12 +44,12 @@ public class DuplicateProviderRegistrationTest { public static Archive createTestArchive() { WebArchive war = TestUtil.prepareArchive(DuplicateProviderRegistrationTest.class.getSimpleName()); war.addClasses(DuplicateProviderRegistrationFeature.class, DuplicateProviderRegistrationFilter.class, - TestUtil.class, DuplicateProviderRegistrationInterceptor.class); + TestUtil.class, DuplicateProviderRegistrationInterceptor.class, ContainerConstants.class); war.addClass(NotForForwardCompatibility.class); // Arquillian in the deployment, test reads the server.log war.addAsManifestResource(PermissionUtil.createPermissionsXmlAsset( new ReflectPermission("suppressAccessChecks"), - new FilePermission(TestUtil.getJbossHome() + File.separator + "standalone" + File.separator + "log" + + new FilePermission(TestUtil.getStandaloneDir(DEFAULT_CONTAINER_QUALIFIER) + File.separator + "log" + File.separator + "server.log", "read"), new LoggingPermission("control", ""), new PropertyPermission("arquillian.*", "read"), diff --git a/testsuite/integration-tests/src/test/java/org/jboss/resteasy/test/providers/custom/MissingProducerTest.java b/testsuite/integration-tests/src/test/java/org/jboss/resteasy/test/providers/custom/MissingProducerTest.java index 5502f0061b5..4fe4a82609c 100644 --- a/testsuite/integration-tests/src/test/java/org/jboss/resteasy/test/providers/custom/MissingProducerTest.java +++ b/testsuite/integration-tests/src/test/java/org/jboss/resteasy/test/providers/custom/MissingProducerTest.java @@ -12,6 +12,8 @@ import org.junit.experimental.categories.Category; import org.junit.runner.RunWith; +import static org.jboss.resteasy.test.ContainerConstants.DEFAULT_CONTAINER_QUALIFIER; + /** * @tpSubChapter Core * @tpChapter Integration tests @@ -27,13 +29,13 @@ public class MissingProducerTest { private static int initLogMsg3Count = parseLog3(); private static int parseLog1() { - return TestUtil.getWarningCount("RESTEASY002120: ClassNotFoundException: ", false); + return TestUtil.getWarningCount("RESTEASY002120: ClassNotFoundException: ", false, DEFAULT_CONTAINER_QUALIFIER); } private static int parseLog2() { - return TestUtil.getWarningCount("Unable to load builtin provider org.jboss.resteasy.Missing from ", false); + return TestUtil.getWarningCount("Unable to load builtin provider org.jboss.resteasy.Missing from ", false, DEFAULT_CONTAINER_QUALIFIER); } private static int parseLog3() { - return TestUtil.getWarningCount("classes/META-INF/services/javax.ws.rs.ext.Providers", false); + return TestUtil.getWarningCount("classes/META-INF/services/javax.ws.rs.ext.Providers", false, DEFAULT_CONTAINER_QUALIFIER); } @SuppressWarnings(value = "unchecked") diff --git a/testsuite/integration-tests/src/test/java/org/jboss/resteasy/test/providers/jsonb/basic/JsonBindingAnnotationsJacksonTest.java b/testsuite/integration-tests/src/test/java/org/jboss/resteasy/test/providers/jsonb/basic/JsonBindingAnnotationsJacksonTest.java index 4be523dee8f..3adb492ae0b 100644 --- a/testsuite/integration-tests/src/test/java/org/jboss/resteasy/test/providers/jsonb/basic/JsonBindingAnnotationsJacksonTest.java +++ b/testsuite/integration-tests/src/test/java/org/jboss/resteasy/test/providers/jsonb/basic/JsonBindingAnnotationsJacksonTest.java @@ -28,6 +28,7 @@ import javax.ws.rs.core.Response; import static org.hamcrest.CoreMatchers.is; +import static org.jboss.resteasy.test.ContainerConstants.DEFAULT_CONTAINER_QUALIFIER; /** * @tpSubChapter Json-binding provider. @@ -137,7 +138,7 @@ public void jsonbNotOnServerNotOnClientTest() throws Exception { */ @Test public void negativeScenarioOnServer() throws Exception { - LogCounter errorLogCounter = new LogCounter("ERROR", false); + LogCounter errorLogCounter = new LogCounter("ERROR", false, DEFAULT_CONTAINER_QUALIFIER); try { ResteasyClient client = new ResteasyClientBuilder().register(JsonBindingCustomRepeaterProvider.class).build(); String charset = "UTF-8"; diff --git a/testsuite/integration-tests/src/test/java/org/jboss/resteasy/test/resource/request/NotFoundErrorMessageTest.java b/testsuite/integration-tests/src/test/java/org/jboss/resteasy/test/resource/request/NotFoundErrorMessageTest.java index c1865921283..d63961dddb9 100644 --- a/testsuite/integration-tests/src/test/java/org/jboss/resteasy/test/resource/request/NotFoundErrorMessageTest.java +++ b/testsuite/integration-tests/src/test/java/org/jboss/resteasy/test/resource/request/NotFoundErrorMessageTest.java @@ -22,6 +22,8 @@ import javax.ws.rs.core.Response; import java.io.IOException; +import static org.jboss.resteasy.test.ContainerConstants.DEFAULT_CONTAINER_QUALIFIER; + /** * @tpSubChapter Core * @tpChapter Integration tests @@ -44,7 +46,7 @@ public static void close() { } private static int getWarningCount() { - return TestUtil.getWarningCount("RESTEASY002010", false); + return TestUtil.getWarningCount("RESTEASY002010", false, DEFAULT_CONTAINER_QUALIFIER); } @Deployment diff --git a/testsuite/integration-tests/src/test/java/org/jboss/resteasy/test/response/DuplicitePathTest.java b/testsuite/integration-tests/src/test/java/org/jboss/resteasy/test/response/DuplicitePathTest.java index 985eaa68e06..4a266043805 100644 --- a/testsuite/integration-tests/src/test/java/org/jboss/resteasy/test/response/DuplicitePathTest.java +++ b/testsuite/integration-tests/src/test/java/org/jboss/resteasy/test/response/DuplicitePathTest.java @@ -32,6 +32,7 @@ import static org.hamcrest.CoreMatchers.either; import static org.hamcrest.CoreMatchers.is; +import static org.jboss.resteasy.test.ContainerConstants.DEFAULT_CONTAINER_QUALIFIER; /** * @tpSubChapter Response @@ -45,7 +46,7 @@ public class DuplicitePathTest { static ResteasyClient client; private static int getWarningCount() { - return TestUtil.getWarningCount("RESTEASY002142", false); + return TestUtil.getWarningCount("RESTEASY002142", false, DEFAULT_CONTAINER_QUALIFIER); } @Deployment diff --git a/testsuite/integration-tests/src/test/java/org/jboss/resteasy/test/warning/SubResourceWarningTest.java b/testsuite/integration-tests/src/test/java/org/jboss/resteasy/test/warning/SubResourceWarningTest.java index ae51a99a8d7..742704b9938 100644 --- a/testsuite/integration-tests/src/test/java/org/jboss/resteasy/test/warning/SubResourceWarningTest.java +++ b/testsuite/integration-tests/src/test/java/org/jboss/resteasy/test/warning/SubResourceWarningTest.java @@ -17,6 +17,8 @@ import org.junit.runner.RunWith; import org.wildfly.extras.creaper.core.online.OnlineManagementClient; +import static org.jboss.resteasy.test.ContainerConstants.DEFAULT_CONTAINER_QUALIFIER; + /** * @tpSubChapter Miscellaneous * @tpChapter Integration tests @@ -28,7 +30,7 @@ public class SubResourceWarningTest { // check server.log msg count before app is deployed. Deploying causes messages to be logged. - private static int preTestCnt = TestUtil.getWarningCount("have the same path, [test", false); + private static int preTestCnt = TestUtil.getWarningCount("have the same path, [test", false, DEFAULT_CONTAINER_QUALIFIER); @Deployment public static Archive deploySimpleResource() { @@ -59,7 +61,7 @@ public static void removeLogging() throws Exception { */ @Test public void testWarningMsg () throws Exception { - int cnt = TestUtil.getWarningCount("have the same path, [test", false); + int cnt = TestUtil.getWarningCount("have the same path, [test", false, DEFAULT_CONTAINER_QUALIFIER); Assert.assertEquals( "Improper log WARNING count", preTestCnt+2, cnt); } } diff --git a/testsuite/integration-tests/src/test/resources/arquillian.xml b/testsuite/integration-tests/src/test/resources/arquillian.xml index 99ca940bb72..cd8df9952fd 100644 --- a/testsuite/integration-tests/src/test/resources/arquillian.xml +++ b/testsuite/integration-tests/src/test/resources/arquillian.xml @@ -5,24 +5,26 @@ http://jboss.org/schema/arquillian/arquillian_1_0.xsd"> - + ${jboss.home} ${securityManagerArg} ${jboss.server.config.file.name:standalone-full.xml} - -server -Xms256m -Xmx1G -Djboss.bind.address=${node} -Djboss.bind.address.management=${node} -Dnode=${node} -Dipv6=${ipv6} ${additionalJvmArgs} ${ipv6ArquillianSettings} ${jacoco.agent} -Djboss.socket.binding.port-offset=0 + -server -Xms256m -Xmx1G -Djboss.bind.address=${node} -Djboss.bind.address.management=${node} -Dnode=${node} -Dipv6=${ipv6} ${additionalJvmArgs} ${ipv6ArquillianSettings} ${jacoco.agent} -Djboss.socket.binding.port-offset=${container.offset.managed} -Djboss.server.base.dir=${container.base.dir.managed} + ${node} - 9990 + ${container.management.port.managed} - + ${jboss.home} ${securityManagerArg} ${jboss.server.config.file.name:standalone-full.xml} - -server -Xms256m -Xmx1G -Djboss.bind.address=${node} -Djboss.bind.address.management=${node} -Dnode=${node} -Dipv6=${ipv6} ${additionalJvmArgs} ${ipv6ArquillianSettings} ${jacoco.agent} -Djboss.socket.binding.port-offset=1000 -Dresteasy.allowGzip=true + -server -Xms256m -Xmx1G -Djboss.bind.address=${node} -Djboss.bind.address.management=${node} -Dnode=${node} -Dipv6=${ipv6} ${additionalJvmArgs} ${ipv6ArquillianSettings} ${jacoco.agent} -Djboss.socket.binding.port-offset=${container.offset.manual.gzip} -Dresteasy.allowGzip=true -Djboss.server.base.dir=${container.base.dir.manual.gzip} + ${node} - 10990 + ${container.management.port.manual.gzip} diff --git a/testsuite/pom.xml b/testsuite/pom.xml index 49546596118..21787048786 100755 --- a/testsuite/pom.xml +++ b/testsuite/pom.xml @@ -217,7 +217,7 @@ copy - generate-test-sources + process-test-resources