Skip to content
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

Fix MP REST 1.4 TCK #7639

Merged
merged 1 commit into from
Mar 6, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion build-parent/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@
<microprofile-metrics-api.version>2.3</microprofile-metrics-api.version>
<microprofile-fault-tolerance-api.version>2.1</microprofile-fault-tolerance-api.version>
<microprofile-reactive-messaging-api.version>1.0</microprofile-reactive-messaging-api.version>
<microprofile-rest-client-api.version>1.3.4</microprofile-rest-client-api.version>
<microprofile-rest-client-api.version>1.4.0</microprofile-rest-client-api.version>
<microprofile-open-api.version>1.1.2</microprofile-open-api.version>
<microprofile-opentracing-api.version>1.3.3</microprofile-opentracing-api.version>
<microprofile-context-propagation.version>1.0.1</microprofile-context-propagation.version>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,7 @@
import org.jboss.resteasy.spi.ResteasyConfiguration;

import io.quarkus.arc.deployment.AdditionalBeanBuildItem;
import io.quarkus.arc.deployment.BeanContainerListenerBuildItem;
import io.quarkus.arc.deployment.BeanRegistrarBuildItem;
import io.quarkus.arc.processor.BeanConfigurator;
import io.quarkus.arc.processor.BeanRegistrar;
Expand Down Expand Up @@ -96,6 +97,12 @@ void setupProviders(BuildProducer<NativeImageResourceBuildItem> resources,
resources.produce(new NativeImageResourceBuildItem(PROVIDERS_SERVICE_FILE));
}

@Record(ExecutionTime.STATIC_INIT)
@BuildStep
BeanContainerListenerBuildItem fixExtension(RestClientRecorder restClientRecorder) {
return new BeanContainerListenerBuildItem(restClientRecorder.hackAroundExtension());
}

@BuildStep
NativeImageProxyDefinitionBuildItem addProxy() {
return new NativeImageProxyDefinitionBuildItem(ResteasyConfiguration.class.getName());
Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,21 @@
package io.quarkus.restclient.runtime;

import java.lang.reflect.Field;
import java.util.Set;

import javax.enterprise.inject.spi.CDI;
import javax.ws.rs.RuntimeType;

import org.eclipse.microprofile.rest.client.spi.RestClientBuilderResolver;
import org.jboss.resteasy.core.providerfactory.ResteasyProviderFactoryImpl;
import org.jboss.resteasy.microprofile.client.RestClientBuilderImpl;
import org.jboss.resteasy.microprofile.client.RestClientExtension;
import org.jboss.resteasy.plugins.providers.RegisterBuiltin;
import org.jboss.resteasy.spi.InjectorFactory;
import org.jboss.resteasy.spi.ResteasyProviderFactory;

import io.quarkus.arc.runtime.BeanContainer;
import io.quarkus.arc.runtime.BeanContainerListener;
import io.quarkus.runtime.RuntimeValue;
import io.quarkus.runtime.annotations.Recorder;

Expand All @@ -20,6 +25,21 @@ public class RestClientRecorder {
public static ResteasyProviderFactory providerFactory;
public static boolean SSL_ENABLED;

public BeanContainerListener hackAroundExtension() {
return new BeanContainerListener() {
@Override
public void created(BeanContainer container) {
try {
Field f = RestClientExtension.class.getDeclaredField("manager");
f.setAccessible(true);
f.set(null, CDI.current().getBeanManager());
} catch (Exception e) {
throw new RuntimeException(e);
}
}
};
}

public void setRestClientBuilderResolver() {
RestClientBuilderResolver.setInstance(new BuilderResolver());
}
Expand Down