Skip to content

W-17463327: Update parent-pom version in http-connector #977

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 12 commits into
base: master
Choose a base branch
from
Draft
23 changes: 13 additions & 10 deletions build.yaml
Original file line number Diff line number Diff line change
@@ -1,18 +1,21 @@
projectType: extension
mavenTool: "3.9.9"

mavenAdditionalArgs: -pl .,mule-http-connector
jdkTool: OPEN-JDK17
testJdkTool: OPEN-JDK17
mavenAdditionalArgs: -Drevapi.skip -DexportedPackagesValidator.skip -Dmaven.javadoc.skip=true -Dmule.jvm.version.extension.enforcement=LOOSE -Dmule.module.tweaking.validation.skip=true

additionalTestConfigs:
functionalTests:
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:
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
mtf-jdk8:
testJdkTool: OPEN-JDK8
mavenAdditionalArgs: -pl mule-http-connector -DskipUnitTests=true
# TODO W-17496009
# mtf-jdk11:
# testJdkTool: OPEN-JDK11
# mavenAdditionalArgs: -pl mule-http-connector -DskipUnitTests=true
jdk21:
testJdkTool: TEMURIN-JDK21
netty-functionalTests:
jdkTool: OPEN-JDK17
mavenAdditionalArgs: -pl functional-tests,functional-tests/http,functional-tests/cors -Dmule.http.service.implementation=NETTY -Drevapi.skip -DexportedPackagesValidator.skip -Dmaven.javadoc.skip=true -Dmule.jvm.version.extension.enforcement=LOOSE -Dmule.module.tweaking.validation.skip=true
mavenAdditionalArgs: -pl functional-tests,functional-tests/http,functional-tests/cors -Dmule.http.service.implementation=NETTY -Drevapi.skip
netty-munitTests:
testJdkTool: OPEN-JDK17
mavenAdditionalArgs: -pl mule-http-connector -Dmule.http.service.implementation=NETTY -DmunitMinMuleVersion=4.9.0 -Drevapi.skip -DexportedPackagesValidator.skip -Dmaven.javadoc.skip=true -Dmule.jvm.version.extension.enforcement=LOOSE -Dmule.module.tweaking.validation.skip=true
1 change: 0 additions & 1 deletion functional-tests/http/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,6 @@
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>${junit.version}</version>
<scope>test</scope>
</dependency>
<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,35 @@
*/
package org.mule.test.http.functional.listener;

import static org.mule.runtime.core.api.config.i18n.CoreMessages.errorReadingStream;
import static org.mule.runtime.core.api.util.IOUtils.copyLarge;
import static org.mule.runtime.http.api.HttpHeaders.Names.CONTENT_TYPE;

import static java.util.Arrays.asList;

import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.containsString;
import static org.hamcrest.Matchers.is;

import org.mule.functional.api.component.TestConnectorQueueHandler;
import org.mule.runtime.api.exception.MuleException;
import org.mule.runtime.api.message.Message;
import org.mule.runtime.api.metadata.DataType;
import org.mule.runtime.api.streaming.bytes.CursorStreamProvider;
import org.mule.runtime.core.api.event.CoreEvent;
import org.mule.runtime.core.api.processor.Processor;
import org.mule.runtime.core.api.transformer.AbstractTransformer;
import org.mule.runtime.core.api.transformer.MessageTransformerException;
import org.mule.runtime.core.api.transformer.TransformerException;
import org.mule.runtime.core.api.util.StringMessageUtils;
import org.mule.runtime.core.internal.transformer.ExtendedTransformationService;
import org.mule.tck.junit4.rule.DynamicPort;
import org.mule.test.http.functional.AbstractHttpTestCase;
import org.mule.test.runner.RunnerDelegateTo;

import java.io.ByteArrayOutputStream;
import java.io.IOException;
import java.io.InputStream;
import java.nio.charset.Charset;
import java.util.Arrays;
import java.util.Collection;

import org.apache.http.client.fluent.Request;
Expand Down Expand Up @@ -52,15 +66,9 @@ public class HttpListenerEncodingTestCase extends AbstractHttpTestCase {

@Parameterized.Parameters(name = "{0}")
public static Collection<Object[]> parameters() {
return asList(new Object[][] {
{"EUC-JP", JAPANESE_MESSAGE},
{"Windows-31J", JAPANESE_MESSAGE},
{"ISO-2022-JP", JAPANESE_MESSAGE},
{"UTF-8", JAPANESE_MESSAGE},
{"Arabic", ARABIC_MESSAGE},
{"Windows-1256", ARABIC_MESSAGE},
{"Windows-1251", CYRILLIC_MESSAGE},
{"Cyrillic", CYRILLIC_MESSAGE},
return Arrays.asList(new Object[][] {{"EUC-JP", JAPANESE_MESSAGE}, {"Windows-31J", JAPANESE_MESSAGE},
{"ISO-2022-JP", JAPANESE_MESSAGE}, {"UTF-8", JAPANESE_MESSAGE}, {"Arabic", ARABIC_MESSAGE},
{"Windows-1256", ARABIC_MESSAGE}, {"Windows-1251", CYRILLIC_MESSAGE}, {"Cyrillic", CYRILLIC_MESSAGE},
{"US-ASCII", SIMPLE_MESSAGE}});
}

Expand Down Expand Up @@ -88,4 +96,53 @@ public void testEncoding() throws Exception {
assertThat(message.getPayload().getDataType().getMediaType().getCharset().get(), is(charset));
}

public static class ObjectToStringProcessor extends AbstractTransformer implements Processor {

public ObjectToStringProcessor() {
registerSourceType(DataType.CURSOR_STREAM_PROVIDER);
setReturnDataType(DataType.STRING);
}

@Override
public CoreEvent process(CoreEvent event) throws MuleException {
if (event != null && event.getMessage() != null) {
try {
return CoreEvent.builder(event)
.message(((ExtendedTransformationService) muleContext.getTransformationService())
.applyTransformers(event.getMessage(), event, this))
.build();
} catch (Exception e) {
throw new MessageTransformerException(this, e, event.getMessage());
}
}
return event;
}

@Override
public Object doTransform(Object src, Charset outputEncoding) throws TransformerException {
if (src instanceof CursorStreamProvider) {
return createStringFromInputStream(((CursorStreamProvider) src).openCursor(), outputEncoding);
} else {
return StringMessageUtils.toString(src);
}
}

protected String createStringFromInputStream(InputStream input, Charset outputEncoding)
throws TransformerException {
try {
ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
copyLarge(input, outputStream);
return outputStream.toString(outputEncoding.name());
} catch (IOException e) {
throw new TransformerException(errorReadingStream(), e);
} finally {
try {
input.close();
} catch (IOException e) {
logger.warn("Could not close stream", e);
}
}
}
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -12,8 +12,9 @@

import static org.hamcrest.CoreMatchers.both;
import static org.hamcrest.CoreMatchers.is;
import static org.hamcrest.Matchers.containsString;
import static org.junit.Assert.assertThat;
import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.containsStringIgnoringCase;
import static org.hamcrest.core.StringContains.containsString;
import static org.junit.Assume.assumeFalse;
import static org.junit.Assume.assumeTrue;

Expand All @@ -24,11 +25,12 @@
import java.net.HttpURLConnection;
import java.net.URL;

import org.hamcrest.MatcherAssert;
import org.junit.Before;
import org.junit.BeforeClass;
import org.junit.Test;

import org.hamcrest.MatcherAssert;

public class HttpStandardRevocationConfigTestCase extends AbstractHttpTestCase {

@Override
Expand Down Expand Up @@ -65,6 +67,6 @@ public void revocationWorksWithoutTrustStore() throws Exception {
CoreEvent event = flowRunner("test").keepStreamsOpen().run();
MatcherAssert.assertThat(((HttpResponseAttributes) event.getMessage().getAttributes().getValue()).getStatusCode(),
is(OK.getStatusCode()));
assertThat(event.getMessage(), hasPayload(both(containsString("test")).and(containsString("google"))));
assertThat(event.getMessage(), hasPayload(both(containsString("test")).and(containsStringIgnoringCase("google"))));
}
}
27 changes: 17 additions & 10 deletions mule-http-connector/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,7 @@
<parent>
<groupId>org.mule.extensions</groupId>
<artifactId>mule-core-modules-parent</artifactId>
<!-- TODO MULE-15249 if this is upgraded, change the Map to Set in HttpResponseHeaderBuilder -->
<!-- TODO MULE-15803 if this is upgraded, change HttpRequestAttributes#lazyClientCertificate-->
<version>1.1.11</version>
<version>1.9.0-rc1</version>
<relativePath/>
</parent>
<modelVersion>4.0.0</modelVersion>
Expand All @@ -21,6 +19,8 @@
<description>A Mule extension that provides HTTP server and client functionality</description>

<properties>
<java.release.version>8</java.release.version>

<jacoco.version>0.8.11</jacoco.version>
<aspectjVersion>1.9.22.1</aspectjVersion>

Expand All @@ -31,6 +31,8 @@
<commonsLang3Version>3.12.0</commonsLang3Version>
<formatterConfigPath>../formatter.xml</formatterConfigPath>

<muleSchedulerServiceVersion>1.1.11</muleSchedulerServiceVersion>
<muleHttpServiceVersion>1.1.1</muleHttpServiceVersion>
<muleJavaEeBomVersion>4.7.2</muleJavaEeBomVersion>
<muleSocketsConnectorVersion>1.2.5</muleSocketsConnectorVersion>
<muleCorsKernelVersion>1.1.2</muleCorsKernelVersion>
Expand All @@ -49,8 +51,8 @@
<munit.version>3.3.1</munit.version>
<mtf-tools.version>1.2.0</mtf-tools.version>
<mavenResources.version>3.3.1</mavenResources.version>
<!-- MUnit minMuleVersion is 4.3.0 -->
<munitMinMuleVersion>4.6.0</munitMinMuleVersion>
<!-- MUnit minMuleVersion is 4.8.3-S, previous versions are configured via `additionalProducts` -->
<munitMinMuleVersion>4.8.3-SNAPSHOT</munitMinMuleVersion>

<muleObjectStoreConnectorTestVersion>1.2.2</muleObjectStoreConnectorTestVersion>

Expand All @@ -68,14 +70,15 @@
<bcpg-fips.version>1.0.7.1</bcpg-fips.version>
<bcmail-fips.version>1.0.4</bcmail-fips.version>
<bc-fips.version>1.0.2.5</bc-fips.version>

<skipUnitTests>false</skipUnitTests>
</properties>

<build>
<plugins>
<plugin>
<groupId>com.mycila</groupId>
<artifactId>license-maven-plugin</artifactId>
<version>${license.maven.plugin.version}</version>
<dependencies>
<dependency>
<groupId>com.mulesoft.license</groupId>
Expand Down Expand Up @@ -110,6 +113,7 @@
<artifactId>maven-jar-plugin</artifactId>
<executions>
<execution>
<id>default-jar</id>
<goals>
<goal>jar</goal>
<goal>test-jar</goal>
Expand All @@ -120,7 +124,6 @@

<plugin>
<artifactId>maven-resources-plugin</artifactId>
<version>${mavenResources.version}</version>
<executions>
<execution>
<id>copy-munit-resources</id>
Expand All @@ -144,7 +147,6 @@
<plugin>
<groupId>com.mulesoft.munit</groupId>
<artifactId>munit-extensions-maven-plugin</artifactId>
<version>${munit.extensions.maven.plugin.version}</version>
<executions>
<execution>
<goals>
Expand Down Expand Up @@ -175,6 +177,10 @@
<includeSnapshots>true</includeSnapshots>
<latestPatches>true</latestPatches>
</discoverRuntimes>
<additionalRuntimes>
<additionalRuntime>MULE_EE:4.6.11-SNAPSHOT</additionalRuntime>
<additionalRuntime>MULE_EE:4.4.1-SNAPSHOT</additionalRuntime>
</additionalRuntimes>
</runtimeConfiguration>
</configuration>
<dependencies>
Expand Down Expand Up @@ -208,6 +214,9 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<configuration>
<skipTests>${skipUnitTests}</skipTests>
</configuration>
<dependencies>
<dependency>
<groupId>org.aspectj</groupId>
Expand Down Expand Up @@ -468,7 +477,6 @@
<plugin>
<groupId>com.mulesoft.munit</groupId>
<artifactId>munit-extensions-maven-plugin</artifactId>
<version>${munit.extensions.maven.plugin.version}</version>
<configuration>
<argLines>
<argLine>
Expand Down Expand Up @@ -528,7 +536,6 @@
<plugin>
<groupId>com.mulesoft.munit</groupId>
<artifactId>munit-extensions-maven-plugin</artifactId>
<version>${munit.extensions.maven.plugin.version}</version>
<configuration>
<argLines>
<argLine>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,8 @@ public class BaseHttpRequestAttributes extends HttpAttributes {
@Parameter
protected String requestPath;

public BaseHttpRequestAttributes() {}

public BaseHttpRequestAttributes(MultiMap<String, String> headers, MultiMap<String, String> queryParams,
Map<String, String> uriParams, String requestPath) {
super(headers);
Expand All @@ -50,11 +52,23 @@ public String getRequestPath() {
return requestPath;
}

public void setRequestPath(String requestPath) {
this.requestPath = requestPath;
}

public MultiMap<String, String> getQueryParams() {
return queryParams;
}

public void setQueryParams(MultiMap<String, String> queryParams) {
this.queryParams = queryParams;
}

public Map<String, String> getUriParams() {
return uriParams;
}

public void setUriParams(Map<String, String> uriParams) {
this.uriParams = uriParams;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
package org.mule.extension.http.api;

import static java.lang.System.lineSeparator;

import static org.apache.commons.lang3.builder.ToStringStyle.SHORT_PREFIX_STYLE;

import org.mule.runtime.api.util.MultiMap;
Expand Down Expand Up @@ -36,6 +37,8 @@ public abstract class HttpAttributes implements Serializable {
@Parameter
protected MultiMap<String, String> headers;

public HttpAttributes() {}

public HttpAttributes(MultiMap<String, String> headers) {
this.headers = headers.toImmutableMultiMap();
}
Expand All @@ -44,6 +47,10 @@ public MultiMap<String, String> getHeaders() {
return headers;
}

public void setHeaders(MultiMap<String, String> headers) {
this.headers = headers;
}

@Override
public String toString() {
return ReflectionToStringBuilder.toString(this, SHORT_PREFIX_STYLE);
Expand Down
Loading