reta commented on a change in pull request #654: CXF-8242: Stop blocking executor thread on microprofile rest asynchronous call URL: https://github.com/apache/cxf/pull/654#discussion_r399701660
########## File path: rt/frontend/jaxws/src/test/java/org/apache/cxf/jaxws/JaxwsClientCallbackTest.java ########## @@ -0,0 +1,162 @@ +/** + * Licensed to the Apache Software Foundation (ASF) under one + * or more contributor license agreements. See the NOTICE file + * distributed with this work for additional information + * regarding copyright ownership. The ASF licenses this file + * to you 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 org.apache.cxf.jaxws; + +import java.util.HashMap; +import java.util.Map; +import java.util.concurrent.CyclicBarrier; +import java.util.concurrent.ExecutionException; +import java.util.concurrent.Executors; +import java.util.concurrent.ScheduledExecutorService; +import java.util.concurrent.TimeUnit; +import java.util.concurrent.TimeoutException; + +import javax.xml.ws.AsyncHandler; +import javax.xml.ws.Response; + +import org.apache.cxf.message.MessageImpl; + +import org.junit.After; +import org.junit.Before; +import org.junit.Test; + +import static org.hamcrest.CoreMatchers.equalTo; +import static org.hamcrest.MatcherAssert.assertThat; +import static org.junit.Assert.assertThrows; + +public class JaxwsClientCallbackTest { + private Map<String, Object> ctx; + private JaxwsClientCallback<String> callback; + private AsyncHandler<String> handler; + private ScheduledExecutorService executor; + + @Before + public void setUp() { + executor = Executors.newSingleThreadScheduledExecutor(); + handler = new AsyncHandler<String>() { + @Override + public void handleResponse(Response<String> res) { + } + }; + + callback = new JaxwsClientCallback<String>(handler, null); + ctx = new HashMap<String, Object>(); + } + + @After + public void tearDown() throws Exception { + executor.shutdown(); + executor.awaitTermination(5, TimeUnit.SECONDS); + } + + @Test + public void testHandleResponseCallback() throws Exception { Review comment: Hm ... turned out to be more complicated than I thought. This is a test code and each callback is in different module (cfx-core, cxf-rt-client, cxf-mp-client, cxf-jarws-frontend). I could move all of them the `systests` but the tests really belong to the its module (where callbacks live). ---------------------------------------------------------------- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. For queries about this service, please contact Infrastructure at: us...@infra.apache.org With regards, Apache Git Services