From 06c5c4a6a74a7c8bd8e7b4dfa78e02eb8e1489c6 Mon Sep 17 00:00:00 2001 From: Ezequiel Werner Date: Fri, 24 May 2024 18:11:25 -0300 Subject: [PATCH 01/15] Test with Netty --- build.yaml | 12 +++++++++--- 1 file changed, 9 insertions(+), 3 deletions(-) diff --git a/build.yaml b/build.yaml index ff44517c4..4760d6e6b 100644 --- a/build.yaml +++ b/build.yaml @@ -1,12 +1,18 @@ projectType: extension -mavenTool: "3.9.5" +mavenTool: "3.9.9" mavenAdditionalArgs: -pl .,mule-http-connector additionalTestConfigs: - functionalTests: + functionalTestsGrizzly: jdkTool: OPEN-JDK17 mavenAdditionalArgs: -pl functional-tests,functional-tests/http,functional-tests/cors -Drevapi.skip -DexportedPackagesValidator.skip -Dmaven.javadoc.skip=true -Dmule.jvm.version.extension.enforcement=LOOSE -Dmule.module.tweaking.validation.skip=true - munitTests: + munitTestsGrizzly: testJdkTool: OPEN-JDK17 mavenAdditionalArgs: -pl mule-http-connector -DmunitMinMuleVersion=4.6.0 -Drevapi.skip -DexportedPackagesValidator.skip -Dmaven.javadoc.skip=true -Dmule.jvm.version.extension.enforcement=LOOSE -Dmule.module.tweaking.validation.skip=true + functionalTestsNetty: + jdkTool: OPEN-JDK17 + mavenAdditionalArgs: -pl functional-tests,functional-tests/http,functional-tests/cors -Drevapi.skip -DexportedPackagesValidator.skip -Dmaven.javadoc.skip=true -Dmule.jvm.version.extension.enforcement=LOOSE -Dmule.module.tweaking.validation.skip=true -Dmule.http.service.implementation=NETTY + munitTestsNetty: + testJdkTool: OPEN-JDK17 + mavenAdditionalArgs: -pl mule-http-connector -DmunitMinMuleVersion=4.6.0 -Drevapi.skip -DexportedPackagesValidator.skip -Dmaven.javadoc.skip=true -Dmule.jvm.version.extension.enforcement=LOOSE -Dmule.module.tweaking.validation.skip=true -Dmule.http.service.implementation=NETTY From 85af105b14a8edd62195e228eedb2c8b974ce338 Mon Sep 17 00:00:00 2001 From: Ezequiel Werner Date: Tue, 28 May 2024 20:46:38 -0300 Subject: [PATCH 02/15] Add failureaccess --- mule-http-connector/pom.xml | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/mule-http-connector/pom.xml b/mule-http-connector/pom.xml index 94526a8f1..9405c6762 100644 --- a/mule-http-connector/pom.xml +++ b/mule-http-connector/pom.xml @@ -228,7 +228,7 @@ pom import - + org.springframework @@ -415,6 +415,12 @@ ${bctls-fips.version} test + + com.google.guava + failureaccess + 1.0.2 + test + From 681699b855070bf8d63cc4e38ae467f87da92403 Mon Sep 17 00:00:00 2001 From: Ezequiel Werner Date: Wed, 29 May 2024 10:13:40 -0300 Subject: [PATCH 03/15] adapt some tests --- .../http/functional/AbstractHttpTestCase.java | 3 +++ .../HttpListenerConfigFunctionalTestCase.java | 15 +++++++++++++-- .../HttpListenerResponseBuildersTestCase.java | 1 - 3 files changed, 16 insertions(+), 3 deletions(-) diff --git a/functional-tests/http/src/test/java/org/mule/test/http/functional/AbstractHttpTestCase.java b/functional-tests/http/src/test/java/org/mule/test/http/functional/AbstractHttpTestCase.java index 2500189f6..0d0ba9b98 100644 --- a/functional-tests/http/src/test/java/org/mule/test/http/functional/AbstractHttpTestCase.java +++ b/functional-tests/http/src/test/java/org/mule/test/http/functional/AbstractHttpTestCase.java @@ -52,6 +52,8 @@ public abstract class AbstractHttpTestCase extends MuleArtifactFunctionalTestCas protected static final String J17_SSL_ERROR_RESPONSE = "PKIX path validation failed"; // Expected validation messages for certificates when testing fips. public static final String BOUNCY_CASTLE_CERTIFICATE_UNKNOWN_ERROR_MESSAGE = "certificate_unknown"; + // Expected validation error message when using Netty. + protected static final String NETTY_SSL_ERROR_RESPONSE = "Received fatal alert: handshake_failure"; protected static final String APPROPRIATE_PROTOCOL_ERROR = "No appropriate protocol (protocol is disabled or cipher suites are inappropriate)"; @@ -83,6 +85,7 @@ protected Matcher sslValidationError() { containsString(J8_275_SSL_ERROR_RESPONSE), containsString(J11_SSL_ERROR_RESPONSE), containsString(J17_SSL_ERROR_RESPONSE), + containsString(NETTY_SSL_ERROR_RESPONSE), containsString(APPROPRIATE_PROTOCOL_ERROR))); } } diff --git a/functional-tests/http/src/test/java/org/mule/test/http/functional/listener/HttpListenerConfigFunctionalTestCase.java b/functional-tests/http/src/test/java/org/mule/test/http/functional/listener/HttpListenerConfigFunctionalTestCase.java index cf2ab31c4..97c761b08 100644 --- a/functional-tests/http/src/test/java/org/mule/test/http/functional/listener/HttpListenerConfigFunctionalTestCase.java +++ b/functional-tests/http/src/test/java/org/mule/test/http/functional/listener/HttpListenerConfigFunctionalTestCase.java @@ -23,6 +23,7 @@ import org.mule.runtime.http.api.HttpConstants.HttpStatus; import org.mule.runtime.http.api.domain.entity.ByteArrayHttpEntity; import org.mule.runtime.http.api.domain.message.request.HttpRequest; +import org.mule.service.http.netty.impl.provider.NettyHttpServiceProvider; import org.mule.tck.junit4.rule.DynamicPort; import org.mule.tck.junit4.rule.SystemProperty; import org.mule.test.http.functional.AbstractHttpTestCase; @@ -113,8 +114,18 @@ public void noListenerConfigWithSpecialCharacters() throws Exception { SocketRequester socketRequester = new SocketRequester("localhost", noListenerConfigPort.getNumber()); socketRequester.initialize(); socketRequester.doRequest("GET " + invalidPathWithSpecialCharacters + " HTTP/1.1"); - assertThat(socketRequester.getResponse(), - containsString(format(NO_LISTENER_ENTITY_FORMAT, escapeHtml4(invalidPathWithSpecialCharacters)))); + + String errorMessage; + if (System.getProperty("mule.http.service.implementation", "GRIZZLY").equals("GRIZZLY")) { + errorMessage = format(NO_LISTENER_ENTITY_FORMAT, escapeHtml4(invalidPathWithSpecialCharacters)); + } else { + String url = format("http://127.0.0.1:%d%s", noListenerConfigPort.getNumber(), invalidPathWithSpecialCharacters); + int indexOfLT = url.indexOf('<'); + errorMessage = + format("HTTP request parsing failed with error: \"Illegal character in path at index %d: %s\"", indexOfLT, url); + } + + assertThat(socketRequester.getResponse(), containsString(errorMessage)); socketRequester.finalizeGracefully(); } diff --git a/functional-tests/http/src/test/java/org/mule/test/http/functional/listener/HttpListenerResponseBuildersTestCase.java b/functional-tests/http/src/test/java/org/mule/test/http/functional/listener/HttpListenerResponseBuildersTestCase.java index 8e4b89669..dc18261b5 100644 --- a/functional-tests/http/src/test/java/org/mule/test/http/functional/listener/HttpListenerResponseBuildersTestCase.java +++ b/functional-tests/http/src/test/java/org/mule/test/http/functional/listener/HttpListenerResponseBuildersTestCase.java @@ -206,7 +206,6 @@ private HttpResponse statusLineResponseBuilderTest(String url, int expectedStatu throws IOException { final Response response = Request.Get(url).connectTimeout(DEFAULT_TIMEOUT).execute(); final HttpResponse httpResponse = response.returnResponse(); - assertThat(httpResponse.getAllHeaders().length, is(greaterThanOrEqualTo((2)))); assertThat(httpResponse.getStatusLine().getStatusCode(), is(expectedStatus)); assertThat(httpResponse.getStatusLine().getReasonPhrase(), is(expectedReasonPhrase)); return httpResponse; From 173bbcc8077f4155f69b4b9ec350ac787647ad59 Mon Sep 17 00:00:00 2001 From: Ezequiel Werner Date: Thu, 30 May 2024 18:19:21 -0300 Subject: [PATCH 04/15] adapt message --- .../requester/HttpRequestExceptionMessagesTestCase.java | 9 ++++++--- 1 file changed, 6 insertions(+), 3 deletions(-) diff --git a/functional-tests/http/src/test/java/org/mule/test/http/functional/requester/HttpRequestExceptionMessagesTestCase.java b/functional-tests/http/src/test/java/org/mule/test/http/functional/requester/HttpRequestExceptionMessagesTestCase.java index ab4f27d6d..c48253cc3 100644 --- a/functional-tests/http/src/test/java/org/mule/test/http/functional/requester/HttpRequestExceptionMessagesTestCase.java +++ b/functional-tests/http/src/test/java/org/mule/test/http/functional/requester/HttpRequestExceptionMessagesTestCase.java @@ -37,10 +37,13 @@ public void errorMessageIsLoadedFromCauseIfNull() throws Exception { String msg = exception.getMessage(); assertThat(msg, containsString("HTTP GET on resource 'http://notarealsite.mulesoft:124/fakeresource'")); - // Using runtime version 4.1.1, the message contains the name of the exception: "UnresolvedAddressException" - // Using latest, the message is "Couldn't resolve address" + // Using latest grizzly, the message is "Couldn't resolve address" + // Using latest Netty, the message is "nodename nor servname provided, or not known" + // Using Reactor Netty, the message is "Failed to resolve..." assertThat(msg, anyOf(containsString("UnresolvedAddressException"), - containsString("Couldn't resolve address"))); + containsString("Couldn't resolve address"), + containsString("nodename nor servname provided, or not known"), + containsString("Failed to resolve"))); } } From 3779e5991442c866fd2acaf3aef142afba82b02f Mon Sep 17 00:00:00 2001 From: Ezequiel Werner Date: Thu, 30 May 2024 18:33:01 -0300 Subject: [PATCH 05/15] adapt --- .../HttpRequestErrorHandlingTestCase.java | 21 ++++++++++--------- 1 file changed, 11 insertions(+), 10 deletions(-) diff --git a/functional-tests/http/src/test/java/org/mule/test/http/functional/requester/HttpRequestErrorHandlingTestCase.java b/functional-tests/http/src/test/java/org/mule/test/http/functional/requester/HttpRequestErrorHandlingTestCase.java index bc0aac662..14a8ddf2a 100644 --- a/functional-tests/http/src/test/java/org/mule/test/http/functional/requester/HttpRequestErrorHandlingTestCase.java +++ b/functional-tests/http/src/test/java/org/mule/test/http/functional/requester/HttpRequestErrorHandlingTestCase.java @@ -32,6 +32,7 @@ import static java.lang.String.format; +import static org.hamcrest.Matchers.anyOf; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.is; import static org.junit.Assert.assertThat; @@ -53,7 +54,6 @@ import io.qameta.allure.Issue; import io.qameta.allure.Stories; import io.qameta.allure.Story; -import org.apache.commons.lang3.SystemUtils; import org.junit.Rule; import org.junit.Test; @@ -157,17 +157,18 @@ public void timeout() throws Exception { @Test public void connectivity() throws Exception { - - String customMessage = ": Connection refused"; - if (SystemUtils.IS_OS_WINDOWS) { - customMessage = customMessage.concat(": no further information"); - } + String errorMessageGrizzly = getErrorMessage(": Connection refused", unusedPort) + " connectivity"; + String errorMessageNetty = + getErrorMessage(": Connection refused: localhost/127.0.0.1:" + unusedPort.getNumber(), unusedPort) + " connectivity"; + String errorMessageReactorNetty = + getErrorMessage(": Connection refused: localhost/0:0:0:0:0:0:0:1:" + unusedPort.getNumber(), unusedPort) + + " connectivity"; + String errorMessageGrizzlyWindows = + getErrorMessage(": Connection refused: no further information", unusedPort) + " connectivity"; CoreEvent result = getFlowRunner("handled", unusedPort.getNumber()).run(); - assertThat(result.getMessage(), - hasPayload(equalTo(getErrorMessage(customMessage, unusedPort) - + " connectivity"))); - + assertThat(result.getMessage(), hasPayload(anyOf(equalTo(errorMessageNetty), equalTo(errorMessageGrizzly), + equalTo(errorMessageReactorNetty), equalTo(errorMessageGrizzlyWindows)))); } @Test From 3db7fb39e2209b5b4aff35dd05c955ddf1310bc0 Mon Sep 17 00:00:00 2001 From: Ezequiel Werner Date: Thu, 30 May 2024 18:38:45 -0300 Subject: [PATCH 06/15] message and ntlm --- .../ntlm/NtlmProxyTestAuthorizer.java | 32 +++++++++---------- ...pTlsContextClient12ToServer13TestCase.java | 5 ++- 2 files changed, 20 insertions(+), 17 deletions(-) diff --git a/functional-tests/http/src/test/java/org/mule/test/http/functional/requester/ntlm/NtlmProxyTestAuthorizer.java b/functional-tests/http/src/test/java/org/mule/test/http/functional/requester/ntlm/NtlmProxyTestAuthorizer.java index 484376128..a1d71b568 100644 --- a/functional-tests/http/src/test/java/org/mule/test/http/functional/requester/ntlm/NtlmProxyTestAuthorizer.java +++ b/functional-tests/http/src/test/java/org/mule/test/http/functional/requester/ntlm/NtlmProxyTestAuthorizer.java @@ -18,6 +18,7 @@ import static javax.servlet.http.HttpServletResponse.SC_OK; import static javax.servlet.http.HttpServletResponse.SC_UNAUTHORIZED; +import org.mule.runtime.core.api.util.Base64; import org.mule.test.http.functional.requester.TestAuthorizer; import java.io.IOException; @@ -31,7 +32,6 @@ public class NtlmProxyTestAuthorizer implements TestAuthorizer { private static final String TYPE_2_MESSAGE_CHALLENGE = "TlRMTVNTUAACAAAAAAAAACgAAAABggAAU3J2Tm9uY2UAAAAAAAAAAA=="; private static final String TYPE_2_MESSAGE = "NTLM " + TYPE_2_MESSAGE_CHALLENGE; - private static final String TYPE_1_MESSAGE = "NTLM TlRMTVNTUAABAAAAAYIIogAAAAAoAAAAAAAAACgAAAAFASgKAAAADw=="; private static final String AUTHORIZED = "Authorized"; private String clientAuthHeader; @@ -42,8 +42,6 @@ public class NtlmProxyTestAuthorizer implements TestAuthorizer { private String domain; private String workstation; - private String type3Message; - public NtlmProxyTestAuthorizer(String clientAuthHeader, String serverAuthHeader, int unauthorizedHeader, String user, String password, String domain, String workstation) { @@ -56,12 +54,6 @@ public NtlmProxyTestAuthorizer(String clientAuthHeader, String serverAuthHeader, this.workstation = workstation; } - public void setUp() throws Exception { - String ntlmHost = workstation != null ? workstation : getLocalHost().getHostName(); - String type3Challenge = NTLMEngine.INSTANCE.generateType3Msg(user, password, domain, ntlmHost, TYPE_2_MESSAGE_CHALLENGE); - type3Message = "NTLM " + type3Challenge; - } - @Override public boolean authorizeRequest(String address, HttpServletRequest request, HttpServletResponse response, boolean addAuthorizeMessageInProxy) @@ -72,11 +64,11 @@ public boolean authorizeRequest(String address, HttpServletRequest request, Http response.addHeader(serverAuthHeader, "NTLM"); return false; } - if (TYPE_1_MESSAGE.equals(auth)) { + if (isNtlmTypeN(auth, 1)) { response.setStatus(unauthorizedHeader); response.setHeader(serverAuthHeader, TYPE_2_MESSAGE); return false; - } else if (type3Message.equals(auth)) { + } else if (isNtlmTypeN(auth, 3)) { response.setStatus(SC_OK); if (addAuthorizeMessageInProxy) { response.getWriter().print(AUTHORIZED); @@ -88,6 +80,17 @@ public boolean authorizeRequest(String address, HttpServletRequest request, Http } } + private static boolean isNtlmTypeN(String header, int n) { + if (!header.startsWith("NTLM ")) { + return false; + } + + String base64 = header.substring(5); + byte[] asByteArray = Base64.decode(base64); + byte type = asByteArray[8]; + return type == n; + } + public static class Builder { private String clientAuthHeader; @@ -134,11 +137,8 @@ public Builder setWorkstation(String workstation) { } public NtlmProxyTestAuthorizer build() throws Exception { - NtlmProxyTestAuthorizer testAuthorizer = new NtlmProxyTestAuthorizer(clientAuthHeader, serverAuthHeader, unauthorizedHeader, - user, password, domain, workstation); - testAuthorizer.setUp(); - - return testAuthorizer; + return new NtlmProxyTestAuthorizer(clientAuthHeader, serverAuthHeader, unauthorizedHeader, user, password, domain, + workstation); } } } diff --git a/functional-tests/http/src/test/java/org/mule/test/http/functional/tls/HttpTlsContextClient12ToServer13TestCase.java b/functional-tests/http/src/test/java/org/mule/test/http/functional/tls/HttpTlsContextClient12ToServer13TestCase.java index eac39c02b..7a35460d9 100644 --- a/functional-tests/http/src/test/java/org/mule/test/http/functional/tls/HttpTlsContextClient12ToServer13TestCase.java +++ b/functional-tests/http/src/test/java/org/mule/test/http/functional/tls/HttpTlsContextClient12ToServer13TestCase.java @@ -12,6 +12,7 @@ import static java.lang.System.getProperty; import static org.apache.commons.lang3.SystemUtils.isJavaVersionAtLeast; +import static org.hamcrest.CoreMatchers.anyOf; import static org.hamcrest.CoreMatchers.containsString; import static org.junit.Assume.assumeTrue; @@ -80,7 +81,9 @@ public static void assumeJdkIsCompatible() { @Test public void testClient12ToServer13() throws Exception { expectedError.expectErrorType("HTTP", "CONNECTIVITY"); - expectedError.expectMessage(containsString(ERROR_RESPONSE)); + expectedError.expectMessage(anyOf( + containsString(ERROR_RESPONSE), + containsString("Received fatal alert: protocol_version"))); flowRunner(client12).run(); } From 354320d61b08d1e853956d8474616eab9eec05fe Mon Sep 17 00:00:00 2001 From: Ezequiel Werner Date: Thu, 30 May 2024 23:09:20 -0300 Subject: [PATCH 07/15] msg --- .../org/mule/test/http/functional/AbstractHttpTestCase.java | 4 +++- .../functional/requester/ntlm/NtlmProxyTestAuthorizer.java | 4 ---- 2 files changed, 3 insertions(+), 5 deletions(-) diff --git a/functional-tests/http/src/test/java/org/mule/test/http/functional/AbstractHttpTestCase.java b/functional-tests/http/src/test/java/org/mule/test/http/functional/AbstractHttpTestCase.java index 0d0ba9b98..76dcaf0c6 100644 --- a/functional-tests/http/src/test/java/org/mule/test/http/functional/AbstractHttpTestCase.java +++ b/functional-tests/http/src/test/java/org/mule/test/http/functional/AbstractHttpTestCase.java @@ -56,6 +56,7 @@ public abstract class AbstractHttpTestCase extends MuleArtifactFunctionalTestCas protected static final String NETTY_SSL_ERROR_RESPONSE = "Received fatal alert: handshake_failure"; protected static final String APPROPRIATE_PROTOCOL_ERROR = "No appropriate protocol (protocol is disabled or cipher suites are inappropriate)"; + protected static final String NETTY_APPROPRIATE_PROTOCOL_ERROR = "Received fatal alert: protocol_version"; @Rule public TestHttpClient httpClient = new TestHttpClient.Builder(getService(HttpService.class)).build(); @@ -86,6 +87,7 @@ protected Matcher sslValidationError() { containsString(J11_SSL_ERROR_RESPONSE), containsString(J17_SSL_ERROR_RESPONSE), containsString(NETTY_SSL_ERROR_RESPONSE), - containsString(APPROPRIATE_PROTOCOL_ERROR))); + containsString(APPROPRIATE_PROTOCOL_ERROR), + containsString(NETTY_APPROPRIATE_PROTOCOL_ERROR))); } } diff --git a/functional-tests/http/src/test/java/org/mule/test/http/functional/requester/ntlm/NtlmProxyTestAuthorizer.java b/functional-tests/http/src/test/java/org/mule/test/http/functional/requester/ntlm/NtlmProxyTestAuthorizer.java index a1d71b568..081e5f7b7 100644 --- a/functional-tests/http/src/test/java/org/mule/test/http/functional/requester/ntlm/NtlmProxyTestAuthorizer.java +++ b/functional-tests/http/src/test/java/org/mule/test/http/functional/requester/ntlm/NtlmProxyTestAuthorizer.java @@ -13,8 +13,6 @@ * LICENSE.txt file. */ -import static org.mule.runtime.core.api.util.NetworkUtils.getLocalHost; - import static javax.servlet.http.HttpServletResponse.SC_OK; import static javax.servlet.http.HttpServletResponse.SC_UNAUTHORIZED; @@ -26,8 +24,6 @@ import javax.servlet.http.HttpServletRequest; import javax.servlet.http.HttpServletResponse; -import com.ning.http.client.ntlm.NTLMEngine; - public class NtlmProxyTestAuthorizer implements TestAuthorizer { private static final String TYPE_2_MESSAGE_CHALLENGE = "TlRMTVNTUAACAAAAAAAAACgAAAABggAAU3J2Tm9uY2UAAAAAAAAAAA=="; From d4c4be81ddbd556f9f13d3a5bcb82171f7d5878f Mon Sep 17 00:00:00 2001 From: Ezequiel Werner Date: Tue, 11 Jun 2024 19:53:09 -0300 Subject: [PATCH 08/15] asd --- .../functional/requester/HttpRequestErrorHandlingTestCase.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/functional-tests/http/src/test/java/org/mule/test/http/functional/requester/HttpRequestErrorHandlingTestCase.java b/functional-tests/http/src/test/java/org/mule/test/http/functional/requester/HttpRequestErrorHandlingTestCase.java index 14a8ddf2a..aa9a657d8 100644 --- a/functional-tests/http/src/test/java/org/mule/test/http/functional/requester/HttpRequestErrorHandlingTestCase.java +++ b/functional-tests/http/src/test/java/org/mule/test/http/functional/requester/HttpRequestErrorHandlingTestCase.java @@ -161,7 +161,7 @@ public void connectivity() throws Exception { String errorMessageNetty = getErrorMessage(": Connection refused: localhost/127.0.0.1:" + unusedPort.getNumber(), unusedPort) + " connectivity"; String errorMessageReactorNetty = - getErrorMessage(": Connection refused: localhost/0:0:0:0:0:0:0:1:" + unusedPort.getNumber(), unusedPort) + getErrorMessage(": Connection refused: localhost/[0:0:0:0:0:0:0:1]:" + unusedPort.getNumber(), unusedPort) + " connectivity"; String errorMessageGrizzlyWindows = getErrorMessage(": Connection refused: no further information", unusedPort) + " connectivity"; From 1d75a052a0831903a22291895c816777f1c2e219 Mon Sep 17 00:00:00 2001 From: Ezequiel Werner Date: Fri, 14 Jun 2024 17:52:55 -0300 Subject: [PATCH 09/15] Ignore test with a TODO --- .../requester/HttpRequestExpectHeaderFailTestCase.java | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/functional-tests/http/src/test/java/org/mule/test/http/functional/requester/HttpRequestExpectHeaderFailTestCase.java b/functional-tests/http/src/test/java/org/mule/test/http/functional/requester/HttpRequestExpectHeaderFailTestCase.java index 6631ae4d9..ee2f6cf5e 100644 --- a/functional-tests/http/src/test/java/org/mule/test/http/functional/requester/HttpRequestExpectHeaderFailTestCase.java +++ b/functional-tests/http/src/test/java/org/mule/test/http/functional/requester/HttpRequestExpectHeaderFailTestCase.java @@ -8,7 +8,11 @@ import static org.mule.runtime.http.api.HttpConstants.HttpStatus.EXPECTATION_FAILED; -import static org.junit.Assert.assertThat; +import static java.lang.System.getProperty; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.is; +import static org.junit.Assume.assumeThat; import org.mule.extension.http.api.HttpResponseAttributes; import org.mule.runtime.core.api.event.CoreEvent; @@ -31,6 +35,9 @@ protected String getConfigFile() { @Test public void handlesExpectationFailedResponse() throws Exception { + // TODO (W-15666548): Enable this for NETTY too. + assumeThat(getProperty("mule.http.service.implementation", "GRIZZLY"), is("GRIZZLY")); + startExpectFailedServer(); // Set a payload that will fail when consumed. As the server rejects the request after processing @@ -48,5 +55,4 @@ public int read() throws IOException { stopServer(); } - } From 15933571338cb15b1b0ab6bae2644071c5174e3b Mon Sep 17 00:00:00 2001 From: Ezequiel Werner Date: Fri, 14 Jun 2024 20:43:57 -0300 Subject: [PATCH 10/15] simplify assertion --- .../HttpRequestErrorHandlingTestCase.java | 18 +++++------------- 1 file changed, 5 insertions(+), 13 deletions(-) diff --git a/functional-tests/http/src/test/java/org/mule/test/http/functional/requester/HttpRequestErrorHandlingTestCase.java b/functional-tests/http/src/test/java/org/mule/test/http/functional/requester/HttpRequestErrorHandlingTestCase.java index aa9a657d8..346a7c8c9 100644 --- a/functional-tests/http/src/test/java/org/mule/test/http/functional/requester/HttpRequestErrorHandlingTestCase.java +++ b/functional-tests/http/src/test/java/org/mule/test/http/functional/requester/HttpRequestErrorHandlingTestCase.java @@ -32,10 +32,10 @@ import static java.lang.String.format; -import static org.hamcrest.Matchers.anyOf; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.containsString; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.is; -import static org.junit.Assert.assertThat; import org.mule.extension.http.api.HttpResponseAttributes; import org.mule.extension.http.api.error.HttpError; @@ -157,18 +157,10 @@ public void timeout() throws Exception { @Test public void connectivity() throws Exception { - String errorMessageGrizzly = getErrorMessage(": Connection refused", unusedPort) + " connectivity"; - String errorMessageNetty = - getErrorMessage(": Connection refused: localhost/127.0.0.1:" + unusedPort.getNumber(), unusedPort) + " connectivity"; - String errorMessageReactorNetty = - getErrorMessage(": Connection refused: localhost/[0:0:0:0:0:0:0:1]:" + unusedPort.getNumber(), unusedPort) - + " connectivity"; - String errorMessageGrizzlyWindows = - getErrorMessage(": Connection refused: no further information", unusedPort) + " connectivity"; - CoreEvent result = getFlowRunner("handled", unusedPort.getNumber()).run(); - assertThat(result.getMessage(), hasPayload(anyOf(equalTo(errorMessageNetty), equalTo(errorMessageGrizzly), - equalTo(errorMessageReactorNetty), equalTo(errorMessageGrizzlyWindows)))); + + // The exact message depends on the OS and the underlying framework, but all contain "Connection refused". + assertThat(result.getMessage(), hasPayload(containsString("Connection refused"))); } @Test From bc4b10111fb537b210357c7b85cbdfe48e576846 Mon Sep 17 00:00:00 2001 From: Ezequiel Werner Date: Mon, 23 Sep 2024 16:40:50 -0300 Subject: [PATCH 11/15] netty since 4.8 --- build.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.yaml b/build.yaml index 4760d6e6b..df59d4a27 100644 --- a/build.yaml +++ b/build.yaml @@ -15,4 +15,4 @@ additionalTestConfigs: mavenAdditionalArgs: -pl functional-tests,functional-tests/http,functional-tests/cors -Drevapi.skip -DexportedPackagesValidator.skip -Dmaven.javadoc.skip=true -Dmule.jvm.version.extension.enforcement=LOOSE -Dmule.module.tweaking.validation.skip=true -Dmule.http.service.implementation=NETTY munitTestsNetty: testJdkTool: OPEN-JDK17 - mavenAdditionalArgs: -pl mule-http-connector -DmunitMinMuleVersion=4.6.0 -Drevapi.skip -DexportedPackagesValidator.skip -Dmaven.javadoc.skip=true -Dmule.jvm.version.extension.enforcement=LOOSE -Dmule.module.tweaking.validation.skip=true -Dmule.http.service.implementation=NETTY + mavenAdditionalArgs: -pl mule-http-connector -DmunitMinMuleVersion=4.8.0 -Drevapi.skip -DexportedPackagesValidator.skip -Dmaven.javadoc.skip=true -Dmule.jvm.version.extension.enforcement=LOOSE -Dmule.module.tweaking.validation.skip=true -Dmule.http.service.implementation=NETTY From 4651a87ecc8b83a623a4a508aa049242b9e65a7d Mon Sep 17 00:00:00 2001 From: Ezequiel Werner Date: Mon, 16 Dec 2024 17:23:33 -0300 Subject: [PATCH 12/15] change mmv --- build.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/build.yaml b/build.yaml index df59d4a27..d26855e5d 100644 --- a/build.yaml +++ b/build.yaml @@ -15,4 +15,4 @@ additionalTestConfigs: mavenAdditionalArgs: -pl functional-tests,functional-tests/http,functional-tests/cors -Drevapi.skip -DexportedPackagesValidator.skip -Dmaven.javadoc.skip=true -Dmule.jvm.version.extension.enforcement=LOOSE -Dmule.module.tweaking.validation.skip=true -Dmule.http.service.implementation=NETTY munitTestsNetty: testJdkTool: OPEN-JDK17 - mavenAdditionalArgs: -pl mule-http-connector -DmunitMinMuleVersion=4.8.0 -Drevapi.skip -DexportedPackagesValidator.skip -Dmaven.javadoc.skip=true -Dmule.jvm.version.extension.enforcement=LOOSE -Dmule.module.tweaking.validation.skip=true -Dmule.http.service.implementation=NETTY + mavenAdditionalArgs: -pl mule-http-connector -DmunitMinMuleVersion=4.10.0-SNAPSHOT -Drevapi.skip -DexportedPackagesValidator.skip -Dmaven.javadoc.skip=true -Dmule.jvm.version.extension.enforcement=LOOSE -Dmule.module.tweaking.validation.skip=true -Dmule.http.service.implementation=NETTY From 49c603c67092cf087be1b65d9363b9baf0b07afc Mon Sep 17 00:00:00 2001 From: Ezequiel Werner Date: Mon, 16 Dec 2024 17:50:06 -0300 Subject: [PATCH 13/15] Point to latest --- functional-tests/cors/pom.xml | 4 ++-- functional-tests/http/pom.xml | 8 +------- functional-tests/pom.xml | 6 +++--- 3 files changed, 6 insertions(+), 12 deletions(-) diff --git a/functional-tests/cors/pom.xml b/functional-tests/cors/pom.xml index c0c5d4322..8e5705212 100644 --- a/functional-tests/cors/pom.xml +++ b/functional-tests/cors/pom.xml @@ -106,7 +106,7 @@ org.mule.runtime mule-dwb-api - 2.9.0-20241028 + 2.10.0-SNAPSHOT provided @@ -126,4 +126,4 @@ - \ No newline at end of file + diff --git a/functional-tests/http/pom.xml b/functional-tests/http/pom.xml index 1f478050f..dbdbdf45c 100644 --- a/functional-tests/http/pom.xml +++ b/functional-tests/http/pom.xml @@ -249,12 +249,6 @@ ${mule.version} provided - - org.mule.runtime - mule-module-javaee - ${mule.version} - provided - @@ -273,7 +267,7 @@ org.mule.runtime mule-dwb-api - 2.9.0-20241028 + 2.10.0-SNAPSHOT provided diff --git a/functional-tests/pom.xml b/functional-tests/pom.xml index a8f1e32f6..7ca271ae1 100644 --- a/functional-tests/pom.xml +++ b/functional-tests/pom.xml @@ -61,9 +61,9 @@ 3.5.2 1.x-SNAPSHOT - 4.9.0-SNAPSHOT + 4.10.0-SNAPSHOT ${mule.version} - 1.9.0-SNAPSHOT + 1.10.0-SNAPSHOT ${project.version} @@ -96,7 +96,7 @@ org.mule.runtime mule-dwb-api - 2.9.0-20241028 + 2.10.0-SNAPSHOT From c37600d40520cf3af3445a240620475aba65ac04 Mon Sep 17 00:00:00 2001 From: Ezequiel Werner Date: Thu, 19 Dec 2024 14:27:25 -0300 Subject: [PATCH 14/15] impr --- .../HttpListenerPersistentConnectionsTestCase.java | 14 +++++++++++--- .../test/resources/{log4j2.xml => log4j2-test.xml} | 3 ++- .../src/test/resources/log4j2-test.xml | 2 +- 3 files changed, 14 insertions(+), 5 deletions(-) rename functional-tests/http/src/test/resources/{log4j2.xml => log4j2-test.xml} (91%) diff --git a/functional-tests/http/src/test/java/org/mule/test/http/functional/listener/HttpListenerPersistentConnectionsTestCase.java b/functional-tests/http/src/test/java/org/mule/test/http/functional/listener/HttpListenerPersistentConnectionsTestCase.java index 3d6ab595f..b09956bf2 100644 --- a/functional-tests/http/src/test/java/org/mule/test/http/functional/listener/HttpListenerPersistentConnectionsTestCase.java +++ b/functional-tests/http/src/test/java/org/mule/test/http/functional/listener/HttpListenerPersistentConnectionsTestCase.java @@ -6,10 +6,14 @@ */ package org.mule.test.http.functional.listener; -import static org.hamcrest.Matchers.is; -import static org.junit.Assert.assertThat; import static org.mule.runtime.http.api.HttpHeaders.Names.CONNECTION; import static org.mule.runtime.http.api.HttpHeaders.Values.KEEP_ALIVE; + +import static org.hamcrest.MatcherAssert.assertThat; +import static org.hamcrest.Matchers.emptyOrNullString; +import static org.hamcrest.Matchers.is; +import static org.hamcrest.Matchers.not; + import org.mule.runtime.core.api.util.StringUtils; import org.mule.tck.junit4.rule.DynamicPort; import org.mule.test.http.functional.AbstractHttpTestCase; @@ -122,7 +126,11 @@ private HttpResponse doPerformRequest(int port, HttpVersion httpVersion, boolean } private void assertResponse(String response, boolean shouldBeValid) { - assertThat(StringUtils.isEmpty(response), is(!shouldBeValid)); + if (shouldBeValid) { + assertThat(response, not(emptyOrNullString())); + } else { + assertThat(response, emptyOrNullString()); + } } private void sendRequest(Socket socket, HttpVersion httpVersion) throws IOException { diff --git a/functional-tests/http/src/test/resources/log4j2.xml b/functional-tests/http/src/test/resources/log4j2-test.xml similarity index 91% rename from functional-tests/http/src/test/resources/log4j2.xml rename to functional-tests/http/src/test/resources/log4j2-test.xml index f76a34117..b524f2619 100644 --- a/functional-tests/http/src/test/resources/log4j2.xml +++ b/functional-tests/http/src/test/resources/log4j2-test.xml @@ -11,7 +11,8 @@ - + + diff --git a/mule-http-connector/src/test/resources/log4j2-test.xml b/mule-http-connector/src/test/resources/log4j2-test.xml index 79217cd8d..8c92d529c 100644 --- a/mule-http-connector/src/test/resources/log4j2-test.xml +++ b/mule-http-connector/src/test/resources/log4j2-test.xml @@ -21,7 +21,7 @@ - + From 73e7456c8fc597f832a8ea676503fca7a083d4fc Mon Sep 17 00:00:00 2001 From: Ezequiel Werner Date: Fri, 20 Dec 2024 11:51:12 -0300 Subject: [PATCH 15/15] decrease logs --- functional-tests/http/src/test/resources/log4j2-test.xml | 2 +- mule-http-connector/src/test/resources/log4j2-test.xml | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/functional-tests/http/src/test/resources/log4j2-test.xml b/functional-tests/http/src/test/resources/log4j2-test.xml index b524f2619..04060218c 100644 --- a/functional-tests/http/src/test/resources/log4j2-test.xml +++ b/functional-tests/http/src/test/resources/log4j2-test.xml @@ -12,7 +12,7 @@ - + diff --git a/mule-http-connector/src/test/resources/log4j2-test.xml b/mule-http-connector/src/test/resources/log4j2-test.xml index 8c92d529c..79217cd8d 100644 --- a/mule-http-connector/src/test/resources/log4j2-test.xml +++ b/mule-http-connector/src/test/resources/log4j2-test.xml @@ -21,7 +21,7 @@ - +