From 61fd66e10722b903379209b489a07291a4266220 Mon Sep 17 00:00:00 2001 From: mposolda Date: Fri, 20 Mar 2020 15:50:51 +0100 Subject: [PATCH] KEYCLOAK-13368 TestClassProvider undertow server not stopped after testsuite --- .../testsuite/arquillian/AuthServerTestEnricher.java | 11 +++++++++-- .../keycloak/testsuite/arquillian/SuiteContext.java | 10 ++++++++++ 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/arquillian/AuthServerTestEnricher.java b/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/arquillian/AuthServerTestEnricher.java index 595ccc2a5e..13341e76d3 100644 --- a/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/arquillian/AuthServerTestEnricher.java +++ b/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/arquillian/AuthServerTestEnricher.java @@ -35,6 +35,7 @@ import org.jboss.arquillian.core.api.annotation.Observes; import org.jboss.arquillian.test.spi.annotation.ClassScoped; import org.jboss.arquillian.test.spi.annotation.SuiteScoped; import org.jboss.arquillian.test.spi.event.suite.AfterClass; +import org.jboss.arquillian.test.spi.event.suite.AfterSuite; import org.jboss.arquillian.test.spi.event.suite.BeforeClass; import org.jboss.arquillian.test.spi.event.suite.BeforeSuite; import org.jboss.logging.Logger; @@ -595,8 +596,14 @@ public class AuthServerTestEnricher { suiteContext.getServerLogChecker().updateLastCheckedPositionsOfAllFilesToEndOfFile(); } - public void startTestClassProvider(@Observes(precedence = 100) BeforeSuite beforeSuite) { - new TestClassProvider().start(); + public void startTestClassProvider(@Observes(precedence = 1) BeforeSuite beforeSuite) { + TestClassProvider testClassProvider = new TestClassProvider(); + testClassProvider.start(); + suiteContext.setTestClassProvider(testClassProvider); + } + + public void stopTestClassProvider(@Observes(precedence = -1) AfterSuite afterSuite) { + suiteContext.getTestClassProvider().stop(); } private static final Pattern UNEXPECTED_UNCAUGHT_ERROR = Pattern.compile( diff --git a/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/arquillian/SuiteContext.java b/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/arquillian/SuiteContext.java index 2ca13df39a..5be255f023 100644 --- a/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/arquillian/SuiteContext.java +++ b/testsuite/integration-arquillian/tests/base/src/main/java/org/keycloak/testsuite/arquillian/SuiteContext.java @@ -51,6 +51,8 @@ public final class SuiteContext { private TextFileChecker serverLogChecker; + private TestClassProvider testClassProvider; + /** * True if the testsuite is running in the adapter backward compatibility testing mode, * i.e. if the tests are running against newer auth server @@ -73,6 +75,14 @@ public final class SuiteContext { this.serverLogChecker = serverLogChecker; } + public TestClassProvider getTestClassProvider() { + return testClassProvider; + } + + public void setTestClassProvider(TestClassProvider testClassProvider) { + this.testClassProvider = testClassProvider; + } + public boolean isAdminPasswordUpdated() { return adminPasswordUpdated; }