| 1 |
/* |
| 2 |
* Copyright 2001-2004 The Apache Software Foundation. |
| 3 |
* |
| 4 |
* Licensed under the Apache License, Version 2.0 (the "License"); |
| 5 |
* you may not use this file except in compliance with the License. |
| 6 |
* You may obtain a copy of the License at |
| 7 |
* |
| 8 |
* http://www.apache.org/licenses/LICENSE-2.0 |
| 9 |
* |
| 10 |
* Unless required by applicable law or agreed to in writing, software |
| 11 |
* distributed under the License is distributed on an "AS IS" BASIS, |
| 12 |
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 13 |
* See the License for the specific language governing permissions and |
| 14 |
* limitations under the License. |
| 15 |
*/ |
| 16 |
|
| 17 |
package test.wsdl.roundtrip; |
| 18 |
|
| 19 |
import junit.framework.TestCase; |
| 20 |
import test.wsdl.roundtrip.holders.BondInvestmentHolder; |
| 21 |
|
| 22 |
import javax.xml.rpc.ServiceException; |
| 23 |
import javax.xml.rpc.holders.StringHolder; |
| 24 |
import java.math.BigDecimal; |
| 25 |
import java.math.BigInteger; |
| 26 |
import java.rmi.RemoteException; |
| 27 |
import java.util.Calendar; |
| 28 |
import java.util.Date; |
| 29 |
import java.util.HashMap; |
| 30 |
import java.util.TimeZone; |
| 31 |
|
| 32 |
/** |
| 33 |
* This class contains the test methods to verify that Java mapping |
| 34 |
* to XML/WSDL works as specified by the JAX-RPC specification. |
| 35 |
* |
| 36 |
* The following items are tested: |
| 37 |
* - Primitives |
| 38 |
* - Standard Java Classes |
| 39 |
* - Arrays |
| 40 |
* - Multiple Arrays |
| 41 |
* - JAX-RPC Value Types |
| 42 |
* - Nillables (when used with literal element declarations) |
| 43 |
* |
| 44 |
* @version 1.00 06 Feb 2002 |
| 45 |
* @author Brent Ulbricht |
| 46 |
*/ |
| 47 |
public class RoundtripTestServiceTestCase extends TestCase { |
| 48 |
|
| 49 |
private RoundtripPortType binding = null; |
| 50 |
private RoundtripPortType binding2 = null; |
| 51 |
private static final double DOUBLE_DELTA = 0.0D; |
| 52 |
private static final float FLOAT_DELTA = 0.0F; |
| 53 |
|
| 54 |
/** |
| 55 |
* The Junit framework requires that each class that subclasses |
| 56 |
* TestCase define a constructor accepting a string. This method |
| 57 |
* can be used to specify a specific testXXXXX method in this |
| 58 |
* class to run. |
| 59 |
*/ |
| 60 |
public RoundtripTestServiceTestCase(String name) { |
| 61 |
super(name); |
| 62 |
} // Constructor |
| 63 |
|
| 64 |
/** |
| 65 |
* The setUp method executes before each test method in this class |
| 66 |
* to get the binding. |
| 67 |
*/ |
| 68 |
public void setUp() { |
| 69 |
|
| 70 |
try { |
| 71 |
binding = new RoundtripPortTypeServiceLocator().getRoundtripTest(); |
| 72 |
binding2 = new RoundtripPortTypeServiceLocator().getRoundtripTest2(); |
| 73 |
} catch (ServiceException jre) { |
| 74 |
fail("JAX-RPC ServiceException caught: " + jre); |
| 75 |
} |
| 76 |
assertTrue("binding is null", binding != null); |
| 77 |
|
| 78 |
} // setUp |
| 79 |
|
| 80 |
/** |
| 81 |
* Test to insure that a JAX-RPC Value Type works correctly. StockInvestment |
| 82 |
* subclasses Investment and should pass data members in both the Investment |
| 83 |
* and StockInvestment classes across the wire correctly. |
| 84 |
*/ |
| 85 |
public void testStockInvestment() throws Exception { |
| 86 |
StockInvestment stock = new StockInvestment(); |
| 87 |
stock.setName("International Business Machines"); |
| 88 |
stock.setId(1); |
| 89 |
stock.setTradeExchange("NYSE"); |
| 90 |
stock.setLastTradePrice(200.55F); |
| 91 |
float lastTradePrice = binding.getRealtimeLastTradePrice(stock); |
| 92 |
assertEquals("The expected and actual values did not match.", |
| 93 |
201.25F, |
| 94 |
lastTradePrice, |
| 95 |
FLOAT_DELTA); |
| 96 |
// Make sure static field dontMapToWSDL is not mapped. |
| 97 |
try { |
| 98 |
(StockInvestment.class). |
| 99 |
getDeclaredMethod("getDontMapToWSDL", |
| 100 |
new Class[] {}); |
| 101 |
fail("Should not map static member dontMapToWSDL"); |
| 102 |
} catch (NoSuchMethodException e) { |
| 103 |
// Cool the method should not be in the class |
| 104 |
} |
| 105 |
|
| 106 |
// Make sure private field avgYearlyReturn is not mapped. |
| 107 |
try { |
| 108 |
(StockInvestment.class).getDeclaredMethod("getAvgYearlyReturn", |
| 109 |
new Class[] {}); |
| 110 |
fail("Should not map private member avgYearlyReturn"); |
| 111 |
} catch (NoSuchMethodException e) { |
| 112 |
// Cool the method should not be in the class |
| 113 |
} |
| 114 |
} // testStockInvestment |
| 115 |
|
| 116 |
/** |
| 117 |
* Like the above test, but uses the alternate port. |
| 118 |
*/ |
| 119 |
public void testStockInvestmentWithPort2() throws Exception { |
| 120 |
StockInvestment stock = new StockInvestment(); |
| 121 |
stock.setName("International Business Machines"); |
| 122 |
stock.setId(1); |
| 123 |
stock.setTradeExchange("NYSE"); |
| 124 |
stock.setLastTradePrice(200.55F); |
| 125 |
float lastTradePrice = binding2.getRealtimeLastTradePrice(stock); |
| 126 |
assertEquals("The expected and actual values did not match.", |
| 127 |
201.25F, |
| 128 |
lastTradePrice, |
| 129 |
FLOAT_DELTA); |
| 130 |
// Make sure static field dontMapToWSDL is not mapped. |
| 131 |
try { |
| 132 |
(StockInvestment.class).getDeclaredMethod("getDontMapToWSDL", |
| 133 |
new Class[] {}); |
| 134 |
fail("Should not map static member dontMapToWSDL"); |
| 135 |
} catch (NoSuchMethodException e) { |
| 136 |
// Cool the method should not be in the class |
| 137 |
} |
| 138 |
|
| 139 |
// Make sure private field avgYearlyReturn is not mapped. |
| 140 |
try { |
| 141 |
(StockInvestment.class).getDeclaredMethod("getAvgYearlyReturn", |
| 142 |
new Class[] {}); |
| 143 |
fail("Should not map private member avgYearlyReturn"); |
| 144 |
} catch (NoSuchMethodException e) { |
| 145 |
// Cool the method should not be in the class |
| 146 |
} |
| 147 |
} // testStockInvestmentWithPort2 |
| 148 |
|
| 149 |
/** |
| 150 |
* Test to insure that a JAX-RPC Value Type works correctly. PreferredStockInvestment |
| 151 |
* subclasses StockInvestment and should pass data members in both the Investment, |
| 152 |
* StockInvestment, and PreferredStockInvestment classes across the wire correctly. |
| 153 |
*/ |
| 154 |
public void testPreferredStockInvestment() throws RemoteException { |
| 155 |
PreferredStockInvestment oldStock = new PreferredStockInvestment(); |
| 156 |
oldStock.setName("SOAP Inc."); |
| 157 |
oldStock.setId(202); |
| 158 |
oldStock.setTradeExchange("NASDAQ"); |
| 159 |
oldStock.setLastTradePrice(10.50F); |
| 160 |
oldStock.setDividendsInArrears(100.44D); |
| 161 |
oldStock.setPreferredYield(new BigDecimal("7.00")); |
| 162 |
PreferredStockInvestment newStock = binding.getDividends(oldStock); |
| 163 |
assertEquals("The expected and actual values did not match.", |
| 164 |
newStock.getName(), |
| 165 |
"AXIS Inc."); |
| 166 |
assertEquals("The expected and actual values did not match.", |
| 167 |
203, |
| 168 |
newStock.getId()); |
| 169 |
assertEquals("The expected and actual values did not match.", |
| 170 |
"NASDAQ", |
| 171 |
newStock.getTradeExchange()); |
| 172 |
assertEquals("The expected and actual values did not match.", |
| 173 |
101.44D, |
| 174 |
newStock.getDividendsInArrears(), |
| 175 |
DOUBLE_DELTA); |
| 176 |
assertEquals("The expected and actual values did not match.", |
| 177 |
new BigDecimal("8.00"), |
| 178 |
newStock.getPreferredYield()); |
| 179 |
assertEquals("The expected and actual values did not match.", |
| 180 |
11.50F, |
| 181 |
newStock.getLastTradePrice(), |
| 182 |
FLOAT_DELTA); |
| 183 |
} // testPreferredStockInvestment |
| 184 |
|
| 185 |
/** |
| 186 |
* The BondInvestment class contains all the supported data members: |
| 187 |
* primitives, standard Java classes, arrays, and primitive wrapper |
| 188 |
* classes. This test insures that the data is transmitted across |
| 189 |
* the wire correctly. |
| 190 |
*/ |
| 191 |
public void testRoundtripBondInvestment() throws RemoteException { |
| 192 |
CallOptions[] callOptions = new CallOptions[2]; |
| 193 |
callOptions[0] = new CallOptions(); |
| 194 |
Calendar date = Calendar.getInstance(); |
| 195 |
TimeZone gmt = TimeZone.getTimeZone("GMT"); |
| 196 |
date.setTimeZone(gmt); |
| 197 |
date.setTime(new Date(1013441507388L)); |
| 198 |
callOptions[0].setCallDate(date); |
| 199 |
callOptions[1] = new CallOptions(); |
| 200 |
date = Calendar.getInstance(); |
| 201 |
date.setTimeZone(gmt); |
| 202 |
date.setTime(new Date(1013441507390L)); |
| 203 |
callOptions[1].setCallDate(date); |
| 204 |
HashMap map = new HashMap(); |
| 205 |
map.put("Test", "Test Works"); |
| 206 |
|
| 207 |
short[] shortArray = {(short) 30}; |
| 208 |
byte[] byteArray = {(byte) 1}; |
| 209 |
Short[] wrapperShortArray = {new Short((short) 23), new Short((short) 56)}; |
| 210 |
Byte[] wrapperByteArray = {new Byte((byte) 2), new Byte((byte) 15)}; |
| 211 |
|
| 212 |
BondInvestment sendValue = new BondInvestment(); |
| 213 |
|
| 214 |
sendValue.setMap(map); |
| 215 |
sendValue.setOptions(callOptions); |
| 216 |
sendValue.setOptions2(callOptions); |
| 217 |
sendValue.setOptions3(callOptions[0]); |
| 218 |
sendValue.setWrapperShortArray(wrapperShortArray); |
| 219 |
sendValue.setWrapperByteArray(wrapperByteArray); |
| 220 |
sendValue.setWrapperDouble(new Double(2323.232D)); |
| 221 |
sendValue.setWrapperFloat(new Float(23.023F)); |
| 222 |
sendValue.setWrapperInteger(new Integer(2093)); |
| 223 |
sendValue.setWrapperShort(new Short((short) 203)); |
| 224 |
sendValue.setWrapperByte(new Byte((byte) 20)); |
| 225 |
sendValue.setWrapperBoolean(new Boolean(true)); |
| 226 |
sendValue.setShortArray(shortArray); |
| 227 |
sendValue.setByteArray(byteArray); |
| 228 |
date = Calendar.getInstance(); |
| 229 |
date.setTimeZone(gmt); |
| 230 |
date.setTime(new Date(1012937861996L)); |
| 231 |
sendValue.setCallableDate(date); |
| 232 |
sendValue.setBondAmount(new BigDecimal("2675.23")); |
| 233 |
sendValue.setPortfolioType(new BigInteger("2093")); |
| 234 |
sendValue.setTradeExchange("NYSE"); |
| 235 |
sendValue.setFiftyTwoWeekHigh(45.012D); |
| 236 |
sendValue.setLastTradePrice(87895.32F); |
| 237 |
sendValue.setYield(5475L); |
| 238 |
sendValue.setStockBeta(32); |
| 239 |
sendValue.setDocType((short) 35); |
| 240 |
sendValue.setTaxIndicator((byte) 3); |
| 241 |
|
| 242 |
BondInvestment actual = binding.methodBondInvestmentInOut(sendValue); |
| 243 |
date.setTime(new Date(1013441507308L)); |
| 244 |
|
| 245 |
assertEquals("Returned map is not correct.", |
| 246 |
actual.getMap().get("Test"), "Test Works"); |
| 247 |
assertEquals("The expected and actual values did not match.", |
| 248 |
date, |
| 249 |
actual.getOptions()[0].getCallDate()); |
| 250 |
date.setTime(new Date(1013441507328L)); |
| 251 |
assertEquals("The expected and actual values did not match.", |
| 252 |
date, |
| 253 |
actual.getOptions()[1].getCallDate()); |
| 254 |
assertEquals("The expected and actual values did not match.", |
| 255 |
new Short((short) 33), |
| 256 |
actual.getWrapperShortArray()[0]); |
| 257 |
assertEquals("The expected and actual values did not match.", |
| 258 |
new Short((short) 86), |
| 259 |
actual.getWrapperShortArray()[1]); |
| 260 |
assertEquals("The expected and actual values did not match.", |
| 261 |
new Byte((byte) 4), |
| 262 |
actual.getWrapperByteArray()[0]); |
| 263 |
assertEquals("The expected and actual values did not match.", |
| 264 |
new Byte((byte) 18), |
| 265 |
actual.getWrapperByteArray()[1]); |
| 266 |
assertEquals("The expected and actual values did not match.", |
| 267 |
new Double(33.232D), |
| 268 |
actual.getWrapperDouble()); |
| 269 |
assertEquals("The expected and actual values did not match.", |
| 270 |
new Float(2.23F), |
| 271 |
actual.getWrapperFloat()); |
| 272 |
assertEquals("The expected and actual values did not match.", |
| 273 |
new Integer(3), |
| 274 |
actual.getWrapperInteger()); |
| 275 |
assertEquals("The expected and actual values did not match.", |
| 276 |
new Short((short) 2), |
| 277 |
actual.getWrapperShort()); |
| 278 |
assertEquals("The expected and actual values did not match.", |
| 279 |
new Byte((byte) 21), |
| 280 |
actual.getWrapperByte()); |
| 281 |
assertEquals("The expected and actual values did not match.", |
| 282 |
new Boolean(false), |
| 283 |
actual.getWrapperBoolean()); |
| 284 |
assertEquals("The expected and actual values did not match.", |
| 285 |
(short) 36, |
| 286 |
actual.getShortArray()[0]); |
| 287 |
assertEquals("The expected and actual values did not match.", |
| 288 |
(byte) 7, |
| 289 |
actual.getByteArray()[0]); |
| 290 |
date.setTime(new Date(1012937862997L)); |
| 291 |
assertEquals("The expected and actual values did not match.", |
| 292 |
date, |
| 293 |
actual.getCallableDate()); |
| 294 |
assertEquals("The expected and actual values did not match.", |
| 295 |
new BigDecimal("2735.23"), |
| 296 |
actual.getBondAmount()); |
| 297 |
assertEquals("The expected and actual values did not match.", |
| 298 |
new BigInteger("21093"), |
| 299 |
actual.getPortfolioType()); |
| 300 |
assertEquals("The expected and actual values did not match.", |
| 301 |
new String("AMEX"), |
| 302 |
actual.getTradeExchange()); |
| 303 |
assertEquals("The expected and actual values did not match.", |
| 304 |
415.012D, |
| 305 |
actual.getFiftyTwoWeekHigh(), |
| 306 |
DOUBLE_DELTA); |
| 307 |
assertEquals("The expected and actual values did not match.", |
| 308 |
8795.32F, |
| 309 |
actual.getLastTradePrice(), |
| 310 |
FLOAT_DELTA); |
| 311 |
assertEquals("The expected and actual values did not match.", |
| 312 |
575L, |
| 313 |
actual.getYield()); |
| 314 |
assertEquals("The expected and actual values did not match.", |
| 315 |
3, |
| 316 |
actual.getStockBeta()); |
| 317 |
assertEquals("The expected and actual values did not match.", |
| 318 |
(short) 45, |
| 319 |
actual.getDocType()); |
| 320 |
assertEquals("The expected and actual values did not match.", |
| 321 |
(byte) 8, |
| 322 |
actual.getTaxIndicator()); |
| 323 |
} // testRoundtripBondInvestment |
| 324 |
|
| 325 |
/** |
| 326 |
* The BondInvestment class contains all the supported data members: |
| 327 |
* primitives, standard Java classes, arrays, and primitive wrapper |
| 328 |
* classes. This test insures that a BondInvestment class received |
| 329 |
* by a remote method contains the expected values. |
| 330 |
*/ |
| 331 |
public void testBondInvestmentOut() throws RemoteException { |
| 332 |
BondInvestment actual = binding.methodBondInvestmentOut(); |
| 333 |
Calendar date = Calendar.getInstance(); |
| 334 |
TimeZone gmt = TimeZone.getTimeZone("GMT"); |
| 335 |
date.setTimeZone(gmt); |
| 336 |
date.setTime(new Date(1013441507308L)); |
| 337 |
assertEquals("Returned map is not correct.", |
| 338 |
actual.getMap().get("Test"), "Test Works"); |
| 339 |
assertEquals("The expected and actual values did not match.", |
| 340 |
date, |
| 341 |
actual.getOptions()[0].getCallDate()); |
| 342 |
date.setTime(new Date(1013441507328L)); |
| 343 |
assertEquals("The expected and actual values did not match.", |
| 344 |
date, |
| 345 |
actual.getOptions()[1].getCallDate()); |
| 346 |
assertEquals("The expected and actual values did not match.", |
| 347 |
new Short((short) 33), |
| 348 |
actual.getWrapperShortArray()[0]); |
| 349 |
assertEquals("The expected and actual values did not match.", |
| 350 |
new Short((short) 86), |
| 351 |
actual.getWrapperShortArray()[1]); |
| 352 |
assertEquals("The expected and actual values did not match.", |
| 353 |
new Byte((byte) 4), |
| 354 |
actual.getWrapperByteArray()[0]); |
| 355 |
assertEquals("The expected and actual values did not match.", |
| 356 |
new Byte((byte) 18), |
| 357 |
actual.getWrapperByteArray()[1]); |
| 358 |
assertEquals("The expected and actual values did not match.", |
| 359 |
new Double(33.232D), |
| 360 |
actual.getWrapperDouble()); |
| 361 |
assertEquals("The expected and actual values did not match.", |
| 362 |
new Float(2.23F), |
| 363 |
actual.getWrapperFloat()); |
| 364 |
assertEquals("The expected and actual values did not match.", |
| 365 |
new Integer(3), |
| 366 |
actual.getWrapperInteger()); |
| 367 |
assertEquals("The expected and actual values did not match.", |
| 368 |
new Short((short) 2), |
| 369 |
actual.getWrapperShort()); |
| 370 |
assertEquals("The expected and actual values did not match.", |
| 371 |
new Byte((byte) 21), |
| 372 |
actual.getWrapperByte()); |
| 373 |
assertEquals("The expected and actual values did not match.", |
| 374 |
new Boolean(false), |
| 375 |
actual.getWrapperBoolean()); |
| 376 |
assertEquals("The expected and actual values did not match.", |
| 377 |
(short) 36, |
| 378 |
actual.getShortArray()[0]); |
| 379 |
assertEquals("The expected and actual values did not match.", |
| 380 |
(byte) 7, |
| 381 |
actual.getByteArray()[0]); |
| 382 |
date.setTime(new Date(1012937862997L)); |
| 383 |
assertEquals("The expected and actual values did not match.", |
| 384 |
date, |
| 385 |
actual.getCallableDate()); |
| 386 |
assertEquals("The expected and actual values did not match.", |
| 387 |
new BigDecimal("2735.23"), |
| 388 |
actual.getBondAmount()); |
| 389 |
assertEquals("The expected and actual values did not match.", |
| 390 |
new BigInteger("21093"), |
| 391 |
actual.getPortfolioType()); |
| 392 |
assertEquals("The expected and actual values did not match.", |
| 393 |
new String("AMEX"), |
| 394 |
actual.getTradeExchange()); |
| 395 |
assertEquals("The expected and actual values did not match.", |
| 396 |
415.012D, |
| 397 |
actual.getFiftyTwoWeekHigh(), |
| 398 |
DOUBLE_DELTA); |
| 399 |
assertEquals("The expected and actual values did not match.", |
| 400 |
8795.32F, |
| 401 |
actual.getLastTradePrice(), |
| 402 |
FLOAT_DELTA); |
| 403 |
assertEquals("The expected and actual values did not match.", |
| 404 |
575L, |
| 405 |
actual.getYield()); |
| 406 |
assertEquals("The expected and actual values did not match.", |
| 407 |
3, |
| 408 |
actual.getStockBeta()); |
| 409 |
assertEquals("The expected and actual values did not match.", |
| 410 |
(short) 45, |
| 411 |
actual.getDocType()); |
| 412 |
assertEquals("The expected and actual values did not match.", |
| 413 |
(byte) 8, |
| 414 |
actual.getTaxIndicator()); |
| 415 |
} // testBondInvestmentOut |
| 416 |
|
| 417 |
/** |
| 418 |
* The BondInvestment class contains all the supported data members: |
| 419 |
* primitives, standard Java classes, arrays, and primitive wrapper |
| 420 |
* classes. This test insures that a remote method can recieve the |
| 421 |
* BondInvestment class and that its values match the expected values. |
| 422 |
*/ |
| 423 |
public void testBondInvestmentIn() throws RemoteException { |
| 424 |
CallOptions[] callOptions = new CallOptions[2]; |
| 425 |
callOptions[0] = new CallOptions(); |
| 426 |
Calendar date = Calendar.getInstance(); |
| 427 |
TimeZone gmt = TimeZone.getTimeZone("GMT"); |
| 428 |
date.setTimeZone(gmt); |
| 429 |
date.setTime(new Date(1013441507388L)); |
| 430 |
callOptions[0].setCallDate(date); |
| 431 |
callOptions[1] = new CallOptions(); |
| 432 |
date = Calendar.getInstance(); |
| 433 |
date.setTimeZone(gmt); |
| 434 |
date.setTime(new Date(1013441507390L)); |
| 435 |
callOptions[1].setCallDate(date); |
| 436 |
HashMap map = new HashMap(); |
| 437 |
map.put("Test", "Test Works"); |
| 438 |
|
| 439 |
|
| 440 |
short[] shortArray = {(short) 30}; |
| 441 |
byte[] byteArray = {(byte) 1}; |
| 442 |
Short[] wrapperShortArray = {new Short((short) 23), new Short((short) 56)}; |
| 443 |
Byte[] wrapperByteArray = {new Byte((byte) 2), new Byte((byte) 15)}; |
| 444 |
|
| 445 |
BondInvestment sendValue = new BondInvestment(); |
| 446 |
|
| 447 |
sendValue.setMap(map); |
| 448 |
sendValue.setOptions(callOptions); |
| 449 |
sendValue.setOptions2(callOptions); |
| 450 |
sendValue.setOptions3(callOptions[0]); |
| 451 |
sendValue.setWrapperShortArray(wrapperShortArray); |
| 452 |
sendValue.setWrapperByteArray(wrapperByteArray); |
| 453 |
sendValue.setWrapperDouble(new Double(2323.232D)); |
| 454 |
sendValue.setWrapperFloat(new Float(23.023F)); |
| 455 |
sendValue.setWrapperInteger(new Integer(2093)); |
| 456 |
sendValue.setWrapperShort(new Short((short) 203)); |
| 457 |
sendValue.setWrapperByte(new Byte((byte) 20)); |
| 458 |
sendValue.setWrapperBoolean(new Boolean(true)); |
| 459 |
sendValue.setShortArray(shortArray); |
| 460 |
sendValue.setByteArray(byteArray); |
| 461 |
date = Calendar.getInstance(); |
| 462 |
date.setTimeZone(gmt); |
| 463 |
date.setTime(new Date(1012937861996L)); |
| 464 |
sendValue.setCallableDate(date); |
| 465 |
sendValue.setBondAmount(new BigDecimal("2675.23")); |
| 466 |
sendValue.setPortfolioType(new BigInteger("2093")); |
| 467 |
sendValue.setTradeExchange("NYSE"); |
| 468 |
sendValue.setFiftyTwoWeekHigh(45.012D); |
| 469 |
sendValue.setLastTradePrice(87895.32F); |
| 470 |
sendValue.setYield(5475L); |
| 471 |
sendValue.setStockBeta(32); |
| 472 |
sendValue.setDocType((short) 35); |
| 473 |
sendValue.setTaxIndicator((byte) 3); |
| 474 |
|
| 475 |
binding.methodBondInvestmentIn(sendValue); |
| 476 |
} // testBondInvestmentIn |
| 477 |
|
| 478 |
/** |
| 479 |
* Test the overloaded method getId with a BondInvestment. |
| 480 |
*/ |
| 481 |
public void testBondInvestmentGetId() throws RemoteException { |
| 482 |
CallOptions[] callOptions = new CallOptions[2]; |
| 483 |
callOptions[0] = new CallOptions(); |
| 484 |
Calendar date = Calendar.getInstance(); |
| 485 |
TimeZone gmt = TimeZone.getTimeZone("GMT"); |
| 486 |
date.setTimeZone(gmt); |
| 487 |
date.setTime(new Date(1013441507388L)); |
| 488 |
callOptions[0].setCallDate(date); |
| 489 |
callOptions[1] = new CallOptions(); |
| 490 |
date = Calendar.getInstance(); |
| 491 |
date.setTimeZone(gmt); |
| 492 |
date.setTime(new Date(1013441507390L)); |
| 493 |
callOptions[1].setCallDate(date); |
| 494 |
|
| 495 |
short[] shortArray = {(short) 30}; |
| 496 |
byte[] byteArray = {(byte) 1}; |
| 497 |
Short[] wrapperShortArray = {new Short((short) 23), new Short((short) 56)}; |
| 498 |
Byte[] wrapperByteArray = {new Byte((byte) 2), new Byte((byte) 15)}; |
| 499 |
|
| 500 |
BondInvestment sendValue = new BondInvestment(); |
| 501 |
|
| 502 |
sendValue.setOptions(callOptions); |
| 503 |
sendValue.setOptions2(callOptions); |
| 504 |
sendValue.setOptions3(callOptions[0]); |
| 505 |
sendValue.setWrapperShortArray(wrapperShortArray); |
| 506 |
sendValue.setWrapperByteArray(wrapperByteArray); |
| 507 |
sendValue.setWrapperDouble(new Double(2323.232D)); |
| 508 |
sendValue.setWrapperFloat(new Float(23.023F)); |
| 509 |
sendValue.setWrapperInteger(new Integer(2093)); |
| 510 |
sendValue.setWrapperShort(new Short((short) 203)); |
| 511 |
sendValue.setWrapperByte(new Byte((byte) 20)); |
| 512 |
sendValue.setWrapperBoolean(new Boolean(true)); |
| 513 |
sendValue.setShortArray(shortArray); |
| 514 |
sendValue.setByteArray(byteArray); |
| 515 |
date = Calendar.getInstance(); |
| 516 |
date.setTimeZone(gmt); |
| 517 |
date.setTime(new Date(1012937861996L)); |
| 518 |
sendValue.setCallableDate(date); |
| 519 |
sendValue.setBondAmount(new BigDecimal("2675.23")); |
| 520 |
sendValue.setPortfolioType(new BigInteger("2093")); |
| 521 |
sendValue.setTradeExchange("NYSE"); |
| 522 |
sendValue.setFiftyTwoWeekHigh(45.012D); |
| 523 |
sendValue.setLastTradePrice(87895.32F); |
| 524 |
sendValue.setYield(5475L); |
| 525 |
sendValue.setStockBeta(32); |
| 526 |
sendValue.setDocType((short) 35); |
| 527 |
sendValue.setTaxIndicator((byte) 3); |
| 528 |
sendValue.setId(-123); |
| 529 |
|
| 530 |
int id = binding.getId(sendValue); |
| 531 |
assertEquals("The wrong id was sent back", -123, id); |
| 532 |
} // testBondInvestmentGetId |
| 533 |
|
| 534 |
/** |
| 535 |
* Test the overloaded method getId with a StockInvestment. |
| 536 |
*/ |
| 537 |
public void testInvestmentGetId() throws RemoteException { |
| 538 |
StockInvestment stock = new StockInvestment(); |
| 539 |
stock.setName("International Business Machines"); |
| 540 |
stock.setId(1); |
| 541 |
stock.setTradeExchange("NYSE"); |
| 542 |
stock.setLastTradePrice(200.55F); |
| 543 |
|
| 544 |
// Temporarily commented out until I can get this to work. |
| 545 |
int id = binding.getId(stock); |
| 546 |
assertEquals("The wrong id was sent back", 1, id); |
| 547 |
} // testInvestmentGetId |
| 548 |
|
| 549 |
/** |
| 550 |
* Test to insure that a multiple array sent by a remote method can be |
| 551 |
* received and its values match the expected values. |
| 552 |
*/ |
| 553 |
public void testMethodStringMArrayOut() throws RemoteException { |
| 554 |
String[][] expected = {{"Out-0-0"}, {"Out-1-0"}}; |
| 555 |
String[][] actual = binding.methodStringMArrayOut(); |
| 556 |
assertEquals("The expected and actual values did not match.", |
| 557 |
expected[0][0], |
| 558 |
actual[0][0]); |
| 559 |
assertEquals("The expected and actual values did not match.", |
| 560 |
expected[1][0], |
| 561 |
actual[1][0]); |
| 562 |
} // testMethodStringMArrayOut |
| 563 |
|
| 564 |
/** |
| 565 |
* Test to insure that a multiple array can be sent to a remote method. The |
| 566 |
* server matches the received array against its expected values. |
| 567 |
*/ |
| 568 |
public void testMethodStringMArrayIn() throws RemoteException { |
| 569 |
String[][] sendArray = {{"In-0-0", "In-0-1"}, {"In-1-0", "In-1-1"}}; |
| 570 |
binding.methodStringMArrayIn(sendArray); |
| 571 |
} // testMethodStringMArrayIn |
| 572 |
|
| 573 |
/** |
| 574 |
* Test to insure that a multiple array matches the expected values on both |
| 575 |
* the client and server. |
| 576 |
*/ |
| 577 |
public void testMethodStringMArrayInOut() throws RemoteException { |
| 578 |
String[][] sendArray = {{"Request-0-0", "Request-0-1"}, {"Request-1-0", "Request-1-1"}}; |
| 579 |
String[][] expected = {{"Response-0-0", "Response-0-1"}, {"Response-1-0", "Response-1-1"}}; |
| 580 |
String[][] actual = binding.methodStringMArrayInOut(sendArray); |
| 581 |
assertEquals("The expected and actual values did not match.", |
| 582 |
expected[0][0], |
| 583 |
actual[0][0]); |
| 584 |
assertEquals("The expected and actual values did not match.", |
| 585 |
expected[0][1], |
| 586 |
actual[0][1]); |
| 587 |
assertEquals("The expected and actual values did not match.", |
| 588 |
expected[1][0], |
| 589 |
actual[1][0]); |
| 590 |
assertEquals("The expected and actual values did not match.", |
| 591 |
expected[1][1], |
| 592 |
actual[1][1]); |
| 593 |
} // testMethodStringMArrayInOut |
| 594 |
|
| 595 |
/** |
| 596 |
* Test to insure that an int array can be sent by a remote method and |
| 597 |
* the received values match the expected values on the client. |
| 598 |
*/ |
| 599 |
public void testMethodIntArrayOut() throws RemoteException { |
| 600 |
int[] expected = {3, 78, 102}; |
| 601 |
int[] actual = binding.methodIntArrayOut(); |
| 602 |
assertEquals("The expected and actual values did not match.", |
| 603 |
expected[0], |
| 604 |
actual[0]); |
| 605 |
assertEquals("The expected and actual values did not match.", |
| 606 |
expected[1], |
| 607 |
actual[1]); |
| 608 |
assertEquals("The expected and actual values did not match.", |
| 609 |
expected[2], |
| 610 |
actual[2]); |
| 611 |
} // testMethodIntArrayOut |
| 612 |
|
| 613 |
/** |
| 614 |
* Test to insure that an int array can be sent to a remote method. The server |
| 615 |
* checks the received array against its expected values. |
| 616 |
*/ |
| 617 |
public void testMethodIntArrayIn() throws RemoteException { |
| 618 |
int[] sendValue = {91, 54, 47, 10}; |
| 619 |
binding.methodIntArrayIn(sendValue); |
| 620 |
} // testMethodIntArrayIn |
| 621 |
|
| 622 |
/** |
| 623 |
* Test to insure that an int array can roundtrip between the client |
| 624 |
* and server. The actual and expected values are compared on both |
| 625 |
* the client and server. |
| 626 |
*/ |
| 627 |
public void testMethodIntArrayInOut() throws RemoteException { |
| 628 |
int[] sendValue = {90, 34, 45, 239, 45, 10}; |
| 629 |
int[] expected = {12, 39, 50, 60, 28, 39}; |
| 630 |
int[] actual = binding.methodIntArrayInOut(sendValue); |
| 631 |
assertEquals("The expected and actual values did not match.", |
| 632 |
expected[0], |
| 633 |
actual[0]); |
| 634 |
assertEquals("The expected and actual values did not match.", |
| 635 |
expected[1], |
| 636 |
actual[1]); |
| 637 |
assertEquals("The expected and actual values did not match.", |
| 638 |
expected[2], |
| 639 |
actual[2]); |
| 640 |
assertEquals("The expected and actual values did not match.", |
| 641 |
expected[3], |
| 642 |
actual[3]); |
| 643 |
assertEquals("The expected and actual values did not match.", |
| 644 |
expected[4], |
| 645 |
actual[4]); |
| 646 |
assertEquals("The expected and actual values did not match.", |
| 647 |
expected[5], |
| 648 |
actual[5]); |
| 649 |
} // testMethodIntArrayInOut |
| 650 |
|
| 651 |
/** |
| 652 |
* Test to insure that all the XML -> Java types can be sent to a remote |
| 653 |
* method. The server checks for the expected values. |
| 654 |
*/ |
| 655 |
public void testMethodAllTypesIn() throws RemoteException { |
| 656 |
byte[] sendByteArray = {(byte) 5, (byte) 10, (byte) 12}; |
| 657 |
Byte[] sendWrapperByteArray = {new Byte((byte) 9), new Byte((byte) 7)}; |
| 658 |
Calendar dateTime = Calendar.getInstance(); |
| 659 |
TimeZone gmt = TimeZone.getTimeZone("GMT"); |
| 660 |
dateTime.setTimeZone(gmt); |
| 661 |
dateTime.setTime(new Date(1012937861986L)); |
| 662 |
binding.methodAllTypesIn(new String("Request methodAllTypesIn"), |
| 663 |
new BigInteger("545"), |
| 664 |
new BigDecimal("546.545"), |
| 665 |
dateTime, |
| 666 |
dateTime, |
| 667 |
true, |
| 668 |
(byte) 2, |
| 669 |
(short) 14, |
| 670 |
234, |
| 671 |
10900L, |
| 672 |
23098.23F, |
| 673 |
2098098.01D, |
| 674 |
sendByteArray, |
| 675 |
new Boolean(false), |
| 676 |
new Byte((byte) 11), |
| 677 |
new Short((short) 45), |
| 678 |
new Integer(101), |
| 679 |
new Long(232309L), |
| 680 |
new Float(67634.12F), |
| 681 |
new Double(892387.232D), |
| 682 |
sendWrapperByteArray); |
| 683 |
} // testMethodAllTypesIn |
| 684 |
|
| 685 |
/** |
| 686 |
* Test to insure that a primitive byte array matches the expected values on |
| 687 |
* both the client and server. |
| 688 |
*/ |
| 689 |
public void testMethodByteArray() throws RemoteException { |
| 690 |
byte[] expected = {(byte) 5, (byte) 4}; |
| 691 |
byte[] sendByte = {(byte) 3, (byte) 9}; |
| 692 |
byte[] actual = binding.methodByteArray(sendByte); |
| 693 |
assertEquals("The expected and actual values did not match.", |
| 694 |
expected[0], |
| 695 |
actual[0]); |
| 696 |
assertEquals("The expected and actual values did not match.", |
| 697 |
expected[1], |
| 698 |
actual[1]); |
| 699 |
} // testMethodByteArray |
| 700 |
|
| 701 |
/** |
| 702 |
* Test to insure that a Calendar object matches the expected values |
| 703 |
* on both the client and server. |
| 704 |
*/ |
| 705 |
public void testMethodDateTime() throws RemoteException { |
| 706 |
Calendar expected = Calendar.getInstance(); |
| 707 |
TimeZone gmt = TimeZone.getTimeZone("GMT"); |
| 708 |
expected.setTimeZone(gmt); |
| 709 |
expected.setTime(new Date(1012937861800L)); |
| 710 |
Calendar parameter = Calendar.getInstance(); |
| 711 |
parameter.setTimeZone(gmt); |
| 712 |
parameter.setTime(new Date(1012937861996L)); |
| 713 |
Calendar actual = binding.methodDateTime(parameter); |
| 714 |
assertEquals("The expected and actual values did not match.", |
| 715 |
expected, |
| 716 |
actual); |
| 717 |
} // testMethodDateTime |
| 718 |
|
| 719 |
/** |
| 720 |
* Just do the same thing that testMethodDateTime does. The REAL |
| 721 |
* test here is a compile test. Both Calendar and Date map to |
| 722 |
* xsd:dateTime. The original SEI in this roundtrip test contained |
| 723 |
* method: "Date methodDate(Date)". But taking that Java -> WSDL -> |
| 724 |
* Java should result in: "Calendar methodDate(Calendar)". If that |
| 725 |
* didn't happen, then the compile would fail. |
| 726 |
*/ |
| 727 |
public void testMethodDate() throws RemoteException { |
| 728 |
Calendar expected = Calendar.getInstance(); |
| 729 |
TimeZone gmt = TimeZone.getTimeZone("GMT"); |
| 730 |
expected.setTimeZone(gmt); |
| 731 |
expected.setTime(new Date(1012937861800L)); |
| 732 |
Calendar parameter = Calendar.getInstance(); |
| 733 |
parameter.setTimeZone(gmt); |
| 734 |
parameter.setTime(new Date(1012937861996L)); |
| 735 |
Calendar actual = binding.methodDate(parameter); |
| 736 |
assertEquals("The expected and actual values did not match.", |
| 737 |
expected, |
| 738 |
actual); |
| 739 |
} // testMethodDate |
| 740 |
|
| 741 |
/** |
| 742 |
* Test to insure that a BigDecimal matches the expected values on |
| 743 |
* both the client and server. |
| 744 |
*/ |
| 745 |
public void testMethodBigDecimal() throws RemoteException { |
| 746 |
BigDecimal expected = new BigDecimal("903483.304"); |
| 747 |
BigDecimal actual = binding.methodBigDecimal(new BigDecimal("3434.456")); |
| 748 |
assertEquals("The expected and actual values did not match.", |
| 749 |
expected, |
| 750 |
actual); |
| 751 |
} // testMethodBigDecimal |
| 752 |
|
| 753 |
/** |
| 754 |
* Test to insure that a BigInteger matches the expected values on |
| 755 |
* both the client and server. |
| 756 |
*/ |
| 757 |
public void testMethodBigInteger() throws RemoteException { |
| 758 |
BigInteger expected = new BigInteger("2323"); |
| 759 |
BigInteger actual = binding.methodBigInteger(new BigInteger("8789")); |
| 760 |
assertEquals("The expected and actual values did not match.", |
| 761 |
expected, |
| 762 |
actual); |
| 763 |
} // testMethodBigInteger |
| 764 |
|
| 765 |
/** |
| 766 |
* Test to insure that a String matches the expected values on |
| 767 |
* both the client and server. |
| 768 |
*/ |
| 769 |
public void testMethodString() throws RemoteException { |
| 770 |
String expected = "Response"; |
| 771 |
String actual = binding.methodString(new String("Request")); |
| 772 |
assertEquals("The expected and actual values did not match.", |
| 773 |
expected, |
| 774 |
actual); |
| 775 |
} // testMethodString |
| 776 |
|
| 777 |
/** |
| 778 |
* Test to insure that a primitive double matches the expected |
| 779 |
* values on both the client and server. |
| 780 |
*/ |
| 781 |
public void testMethodDouble() throws RemoteException { |
| 782 |
double expected = 567.547D; |
| 783 |
double actual = binding.methodDouble(87502.002D); |
| 784 |
assertEquals("The expected and actual values did not match.", |
| 785 |
expected, |
| 786 |
actual, |
| 787 |
DOUBLE_DELTA); |
| 788 |
} // testMethodDouble |
| 789 |
|
| 790 |
/** |
| 791 |
* Test to insure that a primitive float matches the expected |
| 792 |
* values on both the client and server. |
| 793 |
*/ |
| 794 |
public void testMethodFloat() throws RemoteException { |
| 795 |
float expected = 12325.545F; |
| 796 |
float actual = binding.methodFloat(8787.25F); |
| 797 |
assertEquals("The expected and actual values did not match.", |
| 798 |
expected, |
| 799 |
actual, |
| 800 |
FLOAT_DELTA); |
| 801 |
} // testMethodFloat |
| 802 |
|
| 803 |
/** |
| 804 |
* Test to insure that a primitive long matches the expected |
| 805 |
* values on both the client and server. |
| 806 |
*/ |
| 807 |
public void testMethodLong() throws RemoteException { |
| 808 |
long expected = 787985L; |
| 809 |
long actual = binding.methodLong(45425L); |
| 810 |
assertEquals("The expected and actual values did not match.", |
| 811 |
expected, |
| 812 |
actual); |
| 813 |
} // testMethodLong |
| 814 |
|
| 815 |
/** |
| 816 |
* Test to insure that a primitive int matches the expected |
| 817 |
* values on both the client and server. |
| 818 |
*/ |
| 819 |
public void testMethodInt() throws RemoteException { |
| 820 |
int expected = 10232; |
| 821 |
int actual = binding.methodInt(1215); |
| 822 |
assertEquals("The expected and actual values did not match.", |
| 823 |
expected, |
| 824 |
actual); |
| 825 |
} // testMethodInt |
| 826 |
|
| 827 |
/** |
| 828 |
* Test to insure that a primitive short matches the expected |
| 829 |
* values on both the client and server. |
| 830 |
*/ |
| 831 |
public void testMethodShort() throws RemoteException { |
| 832 |
short expected = (short) 124; |
| 833 |
short actual = binding.methodShort((short) 302); |
| 834 |
assertEquals("The expected and actual values did not match.", |
| 835 |
expected, |
| 836 |
actual); |
| 837 |
} // testMethodShort |
| 838 |
|
| 839 |
/** |
| 840 |
* Test to insure that a primitive byte matches the expected |
| 841 |
* values on both the client and server. |
| 842 |
*/ |
| 843 |
public void testMethodByte() throws RemoteException { |
| 844 |
byte expected = (byte) 35; |
| 845 |
byte actual = binding.methodByte((byte) 61); |
| 846 |
assertEquals("The expected and actual values did not match.", |
| 847 |
expected, |
| 848 |
actual); |
| 849 |
} // testMethodByte |
| 850 |
|
| 851 |
/** |
| 852 |
* Test to insure that a primitive boolean matches the expected |
| 853 |
* values on both the client and server. |
| 854 |
*/ |
| 855 |
public void testMethodBoolean() throws RemoteException { |
| 856 |
boolean expected = false; |
| 857 |
boolean actual = binding.methodBoolean(true); |
| 858 |
assertEquals("The expected and actual values did not match.", |
| 859 |
expected, |
| 860 |
actual); |
| 861 |
} // testMethodBoolean |
| 862 |
|
| 863 |
|
| 864 |
/** |
| 865 |
* Test to insure that an array of a user defined class matches |
| 866 |
* the expected values on both the client and server. |
| 867 |
*/ |
| 868 |
public void testMethodCallOptions() throws RemoteException { |
| 869 |
CallOptions[] callOptions = new CallOptions[1]; |
| 870 |
callOptions[0] = new CallOptions(); |
| 871 |
Calendar cal = Calendar.getInstance(); |
| 872 |
TimeZone gmt = TimeZone.getTimeZone("GMT"); |
| 873 |
cal.setTimeZone(gmt); |
| 874 |
cal.setTime(new Date(1013459984577L)); |
| 875 |
callOptions[0].setCallDate(cal); |
| 876 |
|
| 877 |
CallOptions[] actual = binding.methodCallOptions(callOptions); |
| 878 |
cal.setTime(new Date(1013459984507L)); |
| 879 |
assertEquals("The expected and actual values did not match.", |
| 880 |
cal, |
| 881 |
actual[0].getCallDate()); |
| 882 |
} // testMethodCallOptions |
| 883 |
|
| 884 |
/** |
| 885 |
* Test to insure that a wrapper Float object matches |
| 886 |
* the expected values on both the client and server. |
| 887 |
*/ |
| 888 |
public void testMethodSoapFloat() throws RemoteException { |
| 889 |
Float actual = binding.methodSoapFloat(new Float(23423.234F)); |
| 890 |
assertEquals("The expected and actual values did not match.", |
| 891 |
new Float(232.23F), |
| 892 |
actual); |
| 893 |
} // testMethodSoapFloat |
| 894 |
|
| 895 |
/** |
| 896 |
* Test to insure that a wrapper Double object matches |
| 897 |
* the expected values on both the client and server. |
| 898 |
*/ |
| 899 |
public void testMethodSoapDouble() throws RemoteException { |
| 900 |
Double actual = binding.methodSoapDouble(new Double(123423.234D)); |
| 901 |
assertEquals("The expected and actual values did not match.", |
| 902 |
new Double(2232.23D), |
| 903 |
actual); |
| 904 |
} // testMethodSoapDouble |
| 905 |
|
| 906 |
/** |
| 907 |
* Test to insure that a wrapper Boolean object matches |
| 908 |
* the expected values on both the client and server. |
| 909 |
*/ |
| 910 |
public void testMethodSoapBoolean() throws RemoteException { |
| 911 |
Boolean actual = binding.methodSoapBoolean(new Boolean(true)); |
| 912 |
assertEquals("The expected and actual values did not match.", |
| 913 |
new Boolean(false), |
| 914 |
actual); |
| 915 |
} // testMethodSoapBoolean |
| 916 |
|
| 917 |
/** |
| 918 |
* Test to insure that a wrapper Byte object matches |
| 919 |
* the expected values on both the client and server. |
| 920 |
*/ |
| 921 |
public void testMethodSoapByte() throws RemoteException { |
| 922 |
Byte actual = binding.methodSoapByte(new Byte((byte) 9)); |
| 923 |
assertEquals("The expected and actual values did not match.", |
| 924 |
new Byte((byte) 10), |
| 925 |
actual); |
| 926 |
} // testMethodSoapByte |
| 927 |
|
| 928 |
/** |
| 929 |
* Test to insure that a wrapper Short object matches |
| 930 |
* the expected values on both the client and server. |
| 931 |
*/ |
| 932 |
public void testMethodSoapShort() throws RemoteException { |
| 933 |
Short actual = binding.methodSoapShort(new Short((short) 32)); |
| 934 |
assertEquals("The expected and actual values did not match.", |
| 935 |
new Short((short) 44), |
| 936 |
actual); |
| 937 |
} // testMethodSoapShort |
| 938 |
|
| 939 |
/** |
| 940 |
* Test to insure that a wrapper Integer object matches |
| 941 |
* the expected values on both the client and server. |
| 942 |
*/ |
| 943 |
public void testMethodSoapInt() throws RemoteException { |
| 944 |
Integer actual = binding.methodSoapInt(new Integer(332)); |
| 945 |
assertEquals("The expected and actual values did not match.", |
| 946 |
new Integer(441), |
| 947 |
actual); |
| 948 |
} // testMethodSoapInt |
| 949 |
|
| 950 |
/** |
| 951 |
* Test to insure that a wrapper Long object matches |
| 952 |
* the expected values on both the client and server. |
| 953 |
*/ |
| 954 |
public void testMethodSoapLong() throws RemoteException { |
| 955 |
Long actual = binding.methodSoapLong(new Long(3321L)); |
| 956 |
assertEquals("The expected and actual values did not match.", |
| 957 |
new Long(4412L), |
| 958 |
actual); |
| 959 |
} // testMethodSoapLong |
| 960 |
|
| 961 |
/** |
| 962 |
* Test to insure that a user defined exception can be |
| 963 |
* thrown and received. |
| 964 |
*/ |
| 965 |
public void testInvalidTickerSymbol() throws RemoteException { |
| 966 |
try { |
| 967 |
binding.throwInvalidTickerException(); |
| 968 |
fail("Should have received an InvalidTickerSymbol exception."); |
| 969 |
} catch (InvalidTickerSymbol its) { |
| 970 |
// Test was successful |
| 971 |
assertEquals("The expected and actual values did not match.", |
| 972 |
"ABC", |
| 973 |
its.getTickerSymbol()); |
| 974 |
} |
| 975 |
} // testInvalidTickerSymbol |
| 976 |
|
| 977 |
/** |
| 978 |
* Test to insure that more than one user defined exception can be |
| 979 |
* defined in a method. |
| 980 |
*/ |
| 981 |
public void testInvalidTradeExchange() throws RemoteException { |
| 982 |
try { |
| 983 |
binding.throwInvalidTradeExchange(); |
| 984 |
fail("TRY: Should have received an InvalidTradeExchange exception."); |
| 985 |
} catch (InvalidTradeExchange ite) { |
| 986 |
// Test was successful |
| 987 |
assertEquals("The expected and actual values did not match.", |
| 988 |
"XYZ", |
| 989 |
ite.getTradeExchange()); |
| 990 |
} catch (InvalidTickerSymbol its) { |
| 991 |
fail("ITS: Should have received an InvalidTradeExchange exception."); |
| 992 |
} catch (InvalidCompanyId ici) { |
| 993 |
fail("ICI: Should have received an InvalidTradeExchange exception."); |
| 994 |
} |
| 995 |
} // testInvalidTradeExchange |
| 996 |
|
| 997 |
/** |
| 998 |
* Make sure holder inout parameters can be round tripped. |
| 999 |
*/ |
| 1000 |
public void testHolderTest() throws RemoteException { |
| 1001 |
StringHolder sh = new StringHolder("hi there"); |
| 1002 |
BondInvestment bi = new BondInvestment(); |
| 1003 |
BondInvestmentHolder bih = new BondInvestmentHolder(bi); |
| 1004 |
binding.holderTest(sh, bih); |
| 1005 |
} // testHolderTest |
| 1006 |
|
| 1007 |
} // End class RoundtripTestServiceTestCase |