Skip to content

Commit

Permalink
Add a reproducer for quarkiverse#580 Clients with a class with postpo…
Browse files Browse the repository at this point in the history
…ned initialization in their method signatures cannot be compiled to native
  • Loading branch information
ppalaga committed Apr 30, 2023
1 parent c271826 commit cd4fb03
Show file tree
Hide file tree
Showing 3 changed files with 64 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@

import io.quarkiverse.cxf.CXFClientInfo;
import io.quarkiverse.cxf.annotation.CXFClient;
import io.quarkiverse.cxf.client.it.rtinit.ClientWithRuntimeInitializedPayload;

@Path("/cxf/client")
public class CxfClientResource {
Expand Down Expand Up @@ -46,6 +47,10 @@ public class CxfClientResource {
@Named("org.jboss.eap.quickstarts.wscalculator.calculator.CalculatorService")
CXFClientInfo calculatorClientInfo;

@Inject
@CXFClient("clientWithRuntimeInitializedPayload") // name used in application.properties
ClientWithRuntimeInitializedPayload clientWithRuntimeInitializedPayload;

@GET
@Path("/calculator/{client}/multiply")
@Produces(MediaType.TEXT_PLAIN)
Expand All @@ -64,6 +69,14 @@ public int codeFirstClient(@QueryParam("a") int a, @QueryParam("b") int b) {
return codeFirstClient.multiply(a, b);
}

@GET
@Path("/clientWithRuntimeInitializedPayload/addOperands")
@Produces(MediaType.TEXT_PLAIN)
public int clientWithRuntimeInitializedPayload(@QueryParam("a") int a, @QueryParam("b") int b) {
return clientWithRuntimeInitializedPayload.addOperands(new io.quarkiverse.cxf.client.it.rtinit.Operands(a, b))
.getResult();
}

@GET
@Path("/calculator/{client}/addOperands")
@Produces(MediaType.TEXT_PLAIN)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
/*
* JBoss, Home of Professional Open Source
* Copyright 2015, Red Hat, Inc. and/or its affiliates, and individual
* contributors by the @authors tag. See the copyright.txt in the
* distribution for a full listing of individual contributors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
* http://www.apache.org/licenses/LICENSE-2.0
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package io.quarkiverse.cxf.client.it.rtinit;

import javax.jws.WebMethod;
import javax.jws.WebService;

/**
* We declare {@link Operands} and {@link Result} as runtime initialized in {@code application.properties} to make
* sure that we fixed <a href="https://github.com/quarkiverse/quarkus-cxf/issues/580">#580</a> properly.
* <p>
* The addOperands() operation is copied from
* https://github.com/l2x6/calculator-ws/blob/1.0/src/main/java/org/jboss/as/quickstarts/wscalculator/CalculatorService.java
* CXF should be able to use this to produce a partial client communicating with a compatible service endpoint.
*/
@WebService(targetNamespace = ClientWithRuntimeInitializedPayload.TARGET_NS, name = "CalculatorService")
public interface ClientWithRuntimeInitializedPayload {

public static final String TARGET_NS = "http://www.jboss.org/eap/quickstarts/wscalculator/Calculator";

@WebMethod
public Result addOperands(Operands arg0);
}
Original file line number Diff line number Diff line change
Expand Up @@ -301,4 +301,18 @@ void wsdlIncluded() throws IOException {

}

/**
* Test whether a code-first client (without WSDL) works properly.
*/
@Test
void clientWithRuntimeInitializedPayload() {
RestAssured.given()
.queryParam("a", 7)
.queryParam("b", 8)
.get("/cxf/client/clientWithRuntimeInitializedPayload/addOperands")
.then()
.statusCode(200)
.body(is("15"));
}

}

0 comments on commit cd4fb03

Please sign in to comment.