📄 roundtriptestsoapbindingimpl.java
字号:
/* * Copyright 2001-2004 The Apache Software Foundation. * * 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 test.wsdl.roundtrip;import test.wsdl.roundtrip.holders.BondInvestmentHolder;import javax.xml.rpc.holders.StringHolder;import java.math.BigDecimal;import java.math.BigInteger;import java.rmi.RemoteException;import java.util.Calendar;import java.util.Date;import java.util.HashMap;import java.util.TimeZone;/** * This class contains the implementations of the methods defined in the * RoundtripPortType interface. Most of the methods compare the actual * values received from the client against some expected values. * * @version 1.00 06 Feb 2002 * @author Brent Ulbricht */public class RoundtripTestSoapBindingImpl implements RoundtripPortType { public float getRealtimeLastTradePrice(StockInvestment in0) throws RemoteException { if ((in0.getLastTradePrice() == 200.55F) && (in0.getTradeExchange().equals("NYSE")) && (in0.getName().equals("International Business Machines")) && (in0.getId() == 1)) { return 201.25F; } else { throw new RemoteException("Actual Value Did Not Match Expected Value."); } } // getRealtimeLastTradePrice public PreferredStockInvestment getDividends(PreferredStockInvestment in0) throws RemoteException { if ((in0.getLastTradePrice() == 10.50F) && (in0.getTradeExchange().equals("NASDAQ")) && (in0.getName().equals("SOAP Inc.")) && (in0.getId() == 202) && (in0.getDividendsInArrears() == 100.44D) && (in0.getPreferredYield().equals(new BigDecimal("7.00")))) { in0.setName("AXIS Inc."); in0.setId(203); in0.setTradeExchange("NASDAQ"); in0.setLastTradePrice(11.50F); in0.setDividendsInArrears(101.44D); in0.setPreferredYield(new BigDecimal("8.00")); return in0; } else { throw new RemoteException("Actual Value Did Not Match Expected Value."); } } // getDividend public BondInvestment methodBondInvestmentInOut(BondInvestment in0) throws RemoteException { short[] shortArray = {(short) 36}; byte[] byteArray = {(byte) 7}; CallOptions[] callOptions = new CallOptions[2]; callOptions[0] = new CallOptions(); Calendar date = Calendar.getInstance(); TimeZone gmt = TimeZone.getTimeZone("GMT"); date.setTimeZone(gmt); date.setTime(new Date(1013441507308L)); callOptions[0].setCallDate(date); callOptions[1] = new CallOptions(); date = Calendar.getInstance(); date.setTimeZone(gmt); date.setTime(new Date(1013441507328L)); callOptions[1].setCallDate(date); HashMap map = new HashMap(); map.put("Test", "Test Works"); Short[] wrapperShortArray = {new Short((short) 33), new Short((short) 86)}; Byte[] wrapperByteArray = {new Byte((byte) 4), new Byte((byte) 18)}; BondInvestment sendValue = new BondInvestment(); sendValue.setMap(map); sendValue.setOptions(callOptions); sendValue.setOptions2(callOptions); sendValue.setOptions3(callOptions[0]); sendValue.setWrapperShortArray(wrapperShortArray); sendValue.setWrapperByteArray(wrapperByteArray); sendValue.setWrapperDouble(new Double(33.232D)); sendValue.setWrapperFloat(new Float(2.23F)); sendValue.setWrapperInteger(new Integer(3)); sendValue.setWrapperShort(new Short((short) 2)); sendValue.setWrapperByte(new Byte((byte) 21)); sendValue.setWrapperBoolean(new Boolean(false)); sendValue.setShortArray(shortArray); sendValue.setByteArray(byteArray); date = Calendar.getInstance(); date.setTimeZone(gmt); date.setTime(new Date(1012937862997L)); sendValue.setCallableDate(date); sendValue.setBondAmount(new BigDecimal("2735.23")); sendValue.setPortfolioType(new BigInteger("21093")); sendValue.setTradeExchange("AMEX"); sendValue.setFiftyTwoWeekHigh(415.012D); sendValue.setLastTradePrice(8795.32F); sendValue.setYield(575L); sendValue.setStockBeta(3); sendValue.setDocType((short) 45); sendValue.setTaxIndicator((byte) 8); if ((in0.getStockBeta() == 32) && (in0.getDocType() == (short) 35) && (in0.getTaxIndicator() == (byte) 3)) ; else throw new RemoteException("Actual attribute values did not match expected values."); Calendar expectedDate0 = Calendar.getInstance(); expectedDate0.setTimeZone(gmt); expectedDate0.setTime(new Date(1013441507388L)); Calendar expectedDate1 = Calendar.getInstance(); expectedDate1.setTimeZone(gmt); expectedDate1.setTime(new Date(1013441507390L)); Calendar expectedDate2 = Calendar.getInstance(); expectedDate2.setTimeZone(gmt); expectedDate2.setTime(new Date(1013441507388L)); Calendar expectedDate3 = Calendar.getInstance(); expectedDate3.setTimeZone(gmt); expectedDate3.setTime(new Date(1013441507390L)); Calendar expectedDate4 = Calendar.getInstance(); expectedDate4.setTimeZone(gmt); expectedDate4.setTime(new Date(1012937861996L)); if ((in0.getMap().get("Test").equals("Test Works")) && (in0.getOptions()[0].getCallDate().equals(expectedDate0)) && (in0.getOptions()[1].getCallDate().equals(expectedDate1)) && (((CallOptions[])in0.getOptions2())[0].getCallDate().equals(expectedDate2)) && (((CallOptions[])in0.getOptions2())[1].getCallDate().equals(expectedDate3)) && (in0.getWrapperShortArray()[0].equals(new Short((short) 23))) && (in0.getWrapperShortArray()[1].equals(new Short((short) 56))) && (in0.getWrapperByteArray()[0].equals(new Byte((byte) 2))) && (in0.getWrapperByteArray()[1].equals(new Byte((byte) 15))) && (in0.getWrapperDouble().equals(new Double(2323.232D))) && (in0.getWrapperFloat().equals(new Float(23.023F))) && (in0.getWrapperInteger().equals(new Integer(2093))) && (in0.getWrapperShort().equals(new Short((short) 203))) && (in0.getWrapperByte().equals(new Byte((byte) 20))) && (in0.getWrapperBoolean().equals(new Boolean(true))) && (in0.getShortArray()[0] == (short) 30) && (in0.getByteArray()[0] == (byte) 1) && (in0.getCallableDate().equals(expectedDate4)) && (in0.getBondAmount().equals(new BigDecimal("2675.23"))) && (in0.getPortfolioType().equals(new BigInteger("2093"))) && (in0.getTradeExchange().equals("NYSE")) && (in0.getFiftyTwoWeekHigh() == 45.012D) && (in0.getLastTradePrice() == 87895.32F) && (in0.getYield() == 5475L) && (in0.getStockBeta() == 32) && (in0.getDocType() == (short) 35) && (in0.getTaxIndicator() == (byte) 3)) { return sendValue; } else { throw new RemoteException("Actual values did not match expected values."); } } // methodBondInvestmentInOut public BondInvestment methodBondInvestmentOut() throws RemoteException { short[] shortArray = {(short) 36}; byte[] byteArray = {(byte) 7}; CallOptions[] callOptions = new CallOptions[2]; callOptions[0] = new CallOptions(); Calendar date = Calendar.getInstance(); TimeZone gmt = TimeZone.getTimeZone("GMT"); date.setTimeZone(gmt); date.setTime(new Date(1013441507308L)); callOptions[0].setCallDate(date); callOptions[1] = new CallOptions(); date = Calendar.getInstance(); date.setTimeZone(gmt); date.setTime(new Date(1013441507328L)); callOptions[1].setCallDate(date); Short[] wrapperShortArray = {new Short((short) 33), new Short((short) 86)}; Byte[] wrapperByteArray = {new Byte((byte) 4), new Byte((byte) 18)}; HashMap map = new HashMap(); map.put("Test", "Test Works"); BondInvestment sendValue = new BondInvestment(); sendValue.setMap(map); sendValue.setOptions(callOptions); sendValue.setOptions2(callOptions); sendValue.setOptions3(callOptions[0]); sendValue.setWrapperShortArray(wrapperShortArray); sendValue.setWrapperByteArray(wrapperByteArray); sendValue.setWrapperDouble(new Double(33.232D)); sendValue.setWrapperFloat(new Float(2.23F)); sendValue.setWrapperInteger(new Integer(3)); sendValue.setWrapperShort(new Short((short) 2)); sendValue.setWrapperByte(new Byte((byte) 21)); sendValue.setWrapperBoolean(new Boolean(false)); sendValue.setShortArray(shortArray); sendValue.setByteArray(byteArray); date = Calendar.getInstance(); date.setTimeZone(gmt); date.setTime(new Date(1012937862997L)); sendValue.setCallableDate(date); sendValue.setBondAmount(new BigDecimal("2735.23")); sendValue.setPortfolioType(new BigInteger("21093")); sendValue.setTradeExchange("AMEX"); sendValue.setFiftyTwoWeekHigh(415.012D); sendValue.setLastTradePrice(8795.32F); sendValue.setYield(575L); sendValue.setStockBeta(3); sendValue.setDocType((short) 45); sendValue.setTaxIndicator((byte) 8); return sendValue; } // methodBondInvestmentOut public void methodBondInvestmentIn(BondInvestment in0) throws RemoteException { Calendar expectedDate0 = Calendar.getInstance(); TimeZone gmt = TimeZone.getTimeZone("GMT"); expectedDate0.setTimeZone(gmt); expectedDate0.setTime(new Date(1013441507388L)); Calendar expectedDate1 = Calendar.getInstance(); expectedDate1.setTimeZone(gmt); expectedDate1.setTime(new Date(1013441507390L)); Calendar expectedDate2 = Calendar.getInstance(); expectedDate2.setTimeZone(gmt); expectedDate2.setTime(new Date(1013441507388L)); Calendar expectedDate3 = Calendar.getInstance(); expectedDate3.setTimeZone(gmt); expectedDate3.setTime(new Date(1013441507390L)); Calendar expectedDate4 = Calendar.getInstance(); expectedDate4.setTimeZone(gmt); expectedDate4.setTime(new Date(1012937861996L)); if (!((in0.getMap().get("Test").equals("Test Works")) && (in0.getOptions()[0].getCallDate().equals(expectedDate0)) && (in0.getOptions()[1].getCallDate().equals(expectedDate1)) && (((CallOptions[])in0.getOptions2())[0].getCallDate().equals(expectedDate2)) && (((CallOptions[])in0.getOptions2())[1].getCallDate().equals(expectedDate3)) && (in0.getWrapperShortArray()[0].equals(new Short((short) 23))) && (in0.getWrapperShortArray()[1].equals(new Short((short) 56))) && (in0.getWrapperByteArray()[0].equals(new Byte((byte) 2))) && (in0.getWrapperByteArray()[1].equals(new Byte((byte) 15))) && (in0.getWrapperDouble().equals(new Double(2323.232D))) && (in0.getWrapperFloat().equals(new Float(23.023F))) && (in0.getWrapperInteger().equals(new Integer(2093))) && (in0.getWrapperShort().equals(new Short((short) 203))) && (in0.getWrapperByte().equals(new Byte((byte) 20))) && (in0.getWrapperBoolean().equals(new Boolean(true))) && (in0.getShortArray()[0] == (short) 30) && (in0.getByteArray()[0] == (byte) 1) && (in0.getCallableDate().equals(expectedDate4)) && (in0.getBondAmount().equals(new BigDecimal("2675.23"))) && (in0.getPortfolioType().equals(new BigInteger("2093"))) && (in0.getTradeExchange().equals("NYSE")) && (in0.getFiftyTwoWeekHigh() == 45.012D) && (in0.getLastTradePrice() == 87895.32F) && (in0.getYield() == 5475L) && (in0.getStockBeta() == 32) && (in0.getDocType() == (short) 35) && (in0.getTaxIndicator() == (byte) 3))) { throw new RemoteException("Actual values did not match expected values."); } } // methodBondInvestmentIn public String[][] methodStringMArrayOut() throws RemoteException { String[][] sendArray = { {"Out-0-0"}, {"Out-1-0"}}; return sendArray; } // methodStringMArrayOut public void methodStringMArrayIn(String[][] in0) throws RemoteException { if (!((in0[0][0].equals("In-0-0")) && (in0[0][1].equals("In-0-1")) && (in0[1][0].equals("In-1-0")) && (in0[1][1].equals("In-1-1")))) { throw new RemoteException("The actual values did not match expected values."); } } // methodStringMArrayIn public String[][] methodStringMArrayInOut(String[][] in0) throws RemoteException { String[][] sendArray = { {"Response-0-0", "Response-0-1"}, {"Response-1-0", "Response-1-1"}}; if ((in0[0][0].equals("Request-0-0")) && (in0[0][1].equals("Request-0-1")) && (in0[1][0].equals("Request-1-0")) && (in0[1][1].equals("Request-1-1"))) { return sendArray; } else { throw new RemoteException("The actual values did not match expected values."); } } // methodStringMArrayInOut public int[] methodIntArrayOut() throws RemoteException { int[] returnByteArray = {3, 78, 102}; return returnByteArray; } // methodIntArrayOut public void methodIntArrayIn(int[] in0) throws RemoteException { if (!((in0[0] == 91) && (in0[1] == 54) &&
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -