forked from quarkus-qe/quarkus-test-suite
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request quarkus-qe#688 from pjgg/backport_2.7_1
[2.7] Bulk - Backport from upstream _1
- Loading branch information
Showing
479 changed files
with
1,906 additions
and
1,116 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...va/io/quarkus/ts/http/graphql/Person.java → ...kus/ts/http/graphql/telemetry/Person.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
2 changes: 1 addition & 1 deletion
2
...rkus/ts/http/graphql/PersonsEndpoint.java → ...tp/graphql/telemetry/PersonsEndpoint.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 8 additions & 0 deletions
8
...metry/src/test/java/io/quarkus/ts/http/graphql/telemetry/OpenShiftGraphQLTelemetryIT.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
package io.quarkus.ts.http.graphql.telemetry; | ||
|
||
import io.quarkus.test.scenarios.OpenShiftScenario; | ||
|
||
@OpenShiftScenario | ||
public class OpenShiftGraphQLTelemetryIT extends GraphQLTelemetryIT { | ||
|
||
} |
2 changes: 1 addition & 1 deletion
2
...ava/io/quarkus/ts/http/graphql/Utils.java → ...rkus/ts/http/graphql/telemetry/Utils.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
8 changes: 0 additions & 8 deletions
8
http/graphql/src/test/java/io/quarkus/ts/http/graphql/OpenShiftTracingIT.java
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -10,4 +10,5 @@ public Hello(String content) { | |
public String getContent() { | ||
return content; | ||
} | ||
|
||
} |
26 changes: 26 additions & 0 deletions
26
...dvanced-reactive/src/main/java/io/quarkus/ts/http/advanced/reactive/HelloAllResource.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
package io.quarkus.ts.http.advanced.reactive; | ||
|
||
import static io.quarkus.ts.http.advanced.reactive.HelloResource.NAME; | ||
|
||
import javax.ws.rs.DefaultValue; | ||
import javax.ws.rs.GET; | ||
import javax.ws.rs.Path; | ||
import javax.ws.rs.Produces; | ||
import javax.ws.rs.QueryParam; | ||
import javax.ws.rs.core.MediaType; | ||
|
||
import io.smallrye.mutiny.Uni; | ||
|
||
@Path("/hello") | ||
public class HelloAllResource { | ||
private static final String TEMPLATE = "Hello all, %s!"; | ||
public static final String ALL_ENDPOINT_PATH = "/all"; | ||
|
||
@Path(ALL_ENDPOINT_PATH) | ||
@GET | ||
@Produces(MediaType.APPLICATION_JSON) | ||
public Uni<Hello> get(@QueryParam(NAME) @DefaultValue("World") String name) { | ||
return Uni.createFrom().item(new Hello(String.format(TEMPLATE, name))); | ||
} | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
68 changes: 68 additions & 0 deletions
68
...vanced-reactive/src/main/java/io/quarkus/ts/http/advanced/reactive/MediaTypeResource.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
package io.quarkus.ts.http.advanced.reactive; | ||
|
||
import static io.quarkus.ts.http.advanced.reactive.MediaTypeResource.MEDIA_TYPE_PATH; | ||
import static javax.ws.rs.core.HttpHeaders.ACCEPT_ENCODING; | ||
import static javax.ws.rs.core.HttpHeaders.ACCEPT_LANGUAGE; | ||
import static javax.ws.rs.core.MediaType.APPLICATION_JSON; | ||
import static javax.ws.rs.core.MediaType.APPLICATION_OCTET_STREAM; | ||
import static javax.ws.rs.core.MediaType.APPLICATION_XML; | ||
import static javax.ws.rs.core.MediaType.MULTIPART_FORM_DATA; | ||
import static javax.ws.rs.core.MediaType.TEXT_HTML; | ||
import static javax.ws.rs.core.MediaType.TEXT_PLAIN; | ||
|
||
import java.io.IOException; | ||
|
||
import javax.ws.rs.GET; | ||
import javax.ws.rs.Path; | ||
import javax.ws.rs.Produces; | ||
import javax.ws.rs.container.ContainerRequestContext; | ||
import javax.ws.rs.container.ContainerResponseContext; | ||
import javax.ws.rs.container.ContainerResponseFilter; | ||
import javax.ws.rs.core.HttpHeaders; | ||
import javax.ws.rs.core.Response; | ||
import javax.ws.rs.ext.Provider; | ||
|
||
import io.quarkus.vertx.web.RouteFilter; | ||
import io.vertx.ext.web.RoutingContext; | ||
|
||
@Path(MEDIA_TYPE_PATH) | ||
public class MediaTypeResource { | ||
|
||
public static final String MEDIA_TYPE_PATH = "/media-type"; | ||
private static final String IMAGE_PNG = "image/png"; | ||
private static final String IMAGE_JPEG = "image/jpeg"; | ||
private static final String TEXT_CSS = "text/css"; | ||
private static final String TEXT_XML = "text/xml"; | ||
public static final String APPLICATION_YAML = "application/yaml"; | ||
public static final String ENGLISH = "en"; | ||
public static final String JAPANESE = "ja"; | ||
public static final String ANY_ENCODING = "*"; | ||
|
||
@Produces({ APPLICATION_JSON, APPLICATION_XML, TEXT_HTML, TEXT_PLAIN, APPLICATION_OCTET_STREAM, | ||
MULTIPART_FORM_DATA, IMAGE_PNG, IMAGE_JPEG, APPLICATION_YAML, TEXT_CSS, TEXT_XML }) | ||
@GET | ||
public Response getMediaType() { | ||
return Response.ok(new MediaTypeWrapper()).build(); | ||
} | ||
|
||
public static class ContentNegotiationRoutingFilter { | ||
@RouteFilter | ||
void addHeaders(final RoutingContext rc) { | ||
rc.response().headers().add(HttpHeaders.VARY, ACCEPT_LANGUAGE); | ||
rc.response().headers().add(ACCEPT_LANGUAGE, ENGLISH); | ||
rc.next(); | ||
} | ||
} | ||
|
||
@Provider | ||
public static class ContentNegotiationContainerResponseFilter implements | ||
ContainerResponseFilter { | ||
@Override | ||
public void filter(final ContainerRequestContext requestContext, final ContainerResponseContext responseContext) | ||
throws IOException { | ||
responseContext.getHeaders().add(HttpHeaders.VARY, ACCEPT_ENCODING); | ||
responseContext.getHeaders().add(ACCEPT_ENCODING, ANY_ENCODING); | ||
responseContext.getHeaders().add(ACCEPT_LANGUAGE, JAPANESE); | ||
} | ||
} | ||
} |
19 changes: 19 additions & 0 deletions
19
...dvanced-reactive/src/main/java/io/quarkus/ts/http/advanced/reactive/MediaTypeWrapper.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
package io.quarkus.ts.http.advanced.reactive; | ||
|
||
import javax.ws.rs.core.MediaType; | ||
|
||
import io.quarkus.runtime.annotations.RegisterForReflection; | ||
|
||
@RegisterForReflection | ||
public class MediaTypeWrapper { | ||
|
||
private MediaType mediaType; | ||
|
||
public MediaType getMediaType() { | ||
return mediaType; | ||
} | ||
|
||
public void setMediaType(MediaType mediaType) { | ||
this.mediaType = mediaType; | ||
} | ||
} |
33 changes: 33 additions & 0 deletions
33
...active/src/main/java/io/quarkus/ts/http/advanced/reactive/MediaTypeWrapperSerializer.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
package io.quarkus.ts.http.advanced.reactive; | ||
|
||
import java.io.IOException; | ||
import java.io.OutputStream; | ||
import java.lang.annotation.Annotation; | ||
import java.lang.reflect.Type; | ||
|
||
import javax.ws.rs.WebApplicationException; | ||
import javax.ws.rs.core.MediaType; | ||
import javax.ws.rs.core.MultivaluedMap; | ||
import javax.ws.rs.ext.MessageBodyWriter; | ||
import javax.ws.rs.ext.Provider; | ||
|
||
import com.fasterxml.jackson.databind.ObjectMapper; | ||
|
||
@Provider | ||
public class MediaTypeWrapperSerializer implements MessageBodyWriter<MediaTypeWrapper> { | ||
|
||
@Override | ||
public boolean isWriteable(Class<?> type, Type genericType, Annotation[] annotations, | ||
MediaType mediaType) { | ||
return type == MediaTypeWrapper.class; | ||
} | ||
|
||
@Override | ||
public void writeTo(MediaTypeWrapper mediaTypeWrapper, Class<?> type, | ||
Type genericType, Annotation[] annotations, MediaType mediaType, | ||
MultivaluedMap<String, Object> httpHeaders, OutputStream entityStream) | ||
throws IOException, WebApplicationException { | ||
mediaTypeWrapper.setMediaType(mediaType); | ||
entityStream.write(new ObjectMapper().writeValueAsBytes(mediaTypeWrapper)); | ||
} | ||
} |
23 changes: 23 additions & 0 deletions
23
...ced-reactive/src/main/java/io/quarkus/ts/http/advanced/reactive/MultipartFormDataDTO.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,23 @@ | ||
package io.quarkus.ts.http.advanced.reactive; | ||
|
||
import io.quarkus.runtime.annotations.RegisterForReflection; | ||
|
||
@RegisterForReflection | ||
public class MultipartFormDataDTO { | ||
|
||
private final String text; | ||
private final String file; | ||
|
||
public MultipartFormDataDTO(String text, String file) { | ||
this.text = text; | ||
this.file = file; | ||
} | ||
|
||
public String getText() { | ||
return text; | ||
} | ||
|
||
public String getFile() { | ||
return file; | ||
} | ||
} |
48 changes: 48 additions & 0 deletions
48
...vanced-reactive/src/main/java/io/quarkus/ts/http/advanced/reactive/MultipartResource.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
package io.quarkus.ts.http.advanced.reactive; | ||
|
||
import static io.quarkus.ts.http.advanced.reactive.MultipartResource.MULTIPART_FORM_PATH; | ||
|
||
import java.io.IOException; | ||
import java.io.InputStream; | ||
import java.nio.charset.StandardCharsets; | ||
|
||
import javax.ws.rs.Consumes; | ||
import javax.ws.rs.POST; | ||
import javax.ws.rs.Path; | ||
import javax.ws.rs.Produces; | ||
import javax.ws.rs.core.MediaType; | ||
import javax.ws.rs.core.Response; | ||
import javax.ws.rs.core.Response.Status; | ||
|
||
import org.apache.commons.io.IOUtils; | ||
import org.jboss.logging.Logger; | ||
import org.jboss.resteasy.plugins.providers.multipart.MultipartFormDataInput; | ||
|
||
@Path(MULTIPART_FORM_PATH) | ||
public class MultipartResource { | ||
|
||
private static final Logger LOGGER = Logger.getLogger(MediaTypeResource.class); | ||
public static final String TEXT = "text"; | ||
public static final String FILE = "file"; | ||
public static final String MULTIPART_FORM_PATH = "/multipart-form-data"; | ||
|
||
@POST | ||
@Consumes(MediaType.MULTIPART_FORM_DATA) | ||
@Produces(MediaType.APPLICATION_JSON) | ||
public Response multipartFormData(final MultipartFormDataInput input) { | ||
var inputPartText = input.getFormDataMap().get(TEXT).stream().findAny().orElse(null); | ||
if (inputPartText != null) { | ||
try { | ||
String fileContent = IOUtils.toString(input.getFormDataPart(FILE, InputStream.class, null), | ||
StandardCharsets.UTF_8); | ||
String text = inputPartText.getBodyAsString(); | ||
return Response.ok(new MultipartFormDataDTO(text, fileContent)).build(); | ||
} catch (IOException e) { | ||
LOGGER.errorf("Failed to retrieve form field value: %s", e.getMessage()); | ||
} | ||
} else { | ||
LOGGER.warnf("Multipart Form Data does not contain value of form field '%s'.", TEXT); | ||
} | ||
return Response.status(Status.BAD_REQUEST).build(); | ||
} | ||
} |
Oops, something went wrong.