|
Apache CXF example source code file (AbstractHeaderServiceRpcLitTest.java)
The Apache CXF AbstractHeaderServiceRpcLitTest.java source code/** * 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.systest.coloc; import javax.xml.namespace.QName; import javax.xml.ws.BindingProvider; import javax.xml.ws.Holder; import javax.xml.ws.WebServiceException; import static junit.framework.Assert.assertEquals; import org.apache.cxf.message.Message; import org.apache.headers.coloc.types.FaultDetailT; import org.apache.headers.coloc.types.HeaderInfo; import org.apache.headers.coloc.types.InHeaderResponseT; import org.apache.headers.coloc.types.InHeaderT; import org.apache.headers.coloc.types.InoutHeaderResponseT; import org.apache.headers.coloc.types.InoutHeaderT; import org.apache.headers.coloc.types.OutHeaderResponseT; import org.apache.headers.coloc.types.OutHeaderT; import org.apache.headers.coloc.types.PingMeResponseT; import org.apache.headers.coloc.types.PingMeT; import org.apache.headers.rpc_lit.HeaderTester; import org.apache.headers.rpc_lit.PingMeFault; import org.junit.Before; //import org.junit.Ignore; import org.junit.Test; /** * This class invokes the service described in /wsdl/header_rpc_lit.wsdl. * This WSDL contains operations with in-out parameters. * It sets up the a client in "testRouter()" to send requests to the * router which is listening on port 9001 (SOAP/HTTP). * The subclass defines where CXF configuration and the * target server (transport, etc). * */ public abstract class AbstractHeaderServiceRpcLitTest extends AbstractColocTest { static final QName SERVICE_NAME = new QName("http://apache.org/headers/rpc_lit", "SOAPHeaderService"); static final QName PORT_NAME = new QName("http://apache.org/headers/rpc_lit", "SoapPort"); static final String WSDL_LOCATION = "/wsdl/header_rpc_lit.wsdl"; private HeaderTester port; @Before public void setUp() throws Exception { super.setUp(); port = getPort( getServiceQname(), getPortQName(), getWsdlLocation(), HeaderTester.class); } @Test public void testTwoWayOperation() { for (int idx = 0; idx < 2; idx++) { verifyTwoWay(port); } } @Test public void testInHeaderParts() { for (int idx = 0; idx < 2; idx++) { verifyInHeaderParts(port); } } @Test public void testInOutHeaderParts() { for (int idx = 0; idx < 2; idx++) { verifyInOutHeaderParts(port); } } @Test public void testOutHeaderParts() { for (int idx = 0; idx < 2; idx++) { verifyOutHeaderParts(port); } } @Test public void testFault() { for (int idx = 0; idx < 2; idx++) { verifyFaults(port); } } @Test public void testAll() { for (int idx = 0; idx < 2; idx++) { verifyTwoWay(port); verifyInHeaderParts(port); verifyInOutHeaderParts(port); verifyOutHeaderParts(port); verifyFaults(port); } } public void verifyTwoWay(HeaderTester ht) { getLogger().debug("Client: calling pingMe"); PingMeT in = new PingMeT(); try { in.setFaultType("ABCD"); PingMeResponseT ret = ht.pingMe(in); assertNotNull(ret); } catch (Exception ex) { fail("Should not throw any exception"); } } protected void verifyInHeaderParts(HeaderTester ht) { getLogger().debug("Client: calling inHeader"); InHeaderT inHeader = new InHeaderT(); inHeader.setRequestType(HeaderTesterUtil.IN_REQUEST_TYPE); HeaderInfo headerInfo = new HeaderInfo(); headerInfo.setMessage(HeaderTesterUtil.IN_MESSAGE); headerInfo.setOriginator(HeaderTesterUtil.IN_ORIGINATOR); InHeaderResponseT inHeaderResponse = ht.inHeader(inHeader, headerInfo); assertEquals(HeaderTesterUtil.OUT_RESPONSE_TYPE, inHeaderResponse.getResponseType()); } protected void verifyInOutHeaderParts(HeaderTester ht) { getLogger().debug("Client: calling inoutHeader"); InoutHeaderT inoutHeader = new InoutHeaderT(); inoutHeader.setRequestType(HeaderTesterUtil.INOUT_REQUEST_TYPE_IN); HeaderInfo headerInfo = new HeaderInfo(); headerInfo.setMessage(HeaderTesterUtil.INOUT_MESSAGE_IN); headerInfo.setOriginator(HeaderTesterUtil.INOUT_ORIGINATOR_IN); Holder<HeaderInfo> holder = new Holder Other Apache CXF examples (source code examples)Here is a short list of links related to this Apache CXF AbstractHeaderServiceRpcLitTest.java source code file: |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.