📄 roundtriptestservicetestcase.java
字号:
assertEquals("Returned map is not correct.", actual.getMap().get("Test"), "Test Works"); assertEquals("The expected and actual values did not match.", date, actual.getOptions()[0].getCallDate()); date.setTime(new Date(1013441507328L)); assertEquals("The expected and actual values did not match.", date, actual.getOptions()[1].getCallDate()); assertEquals("The expected and actual values did not match.", new Short((short) 33), actual.getWrapperShortArray()[0]); assertEquals("The expected and actual values did not match.", new Short((short) 86), actual.getWrapperShortArray()[1]); assertEquals("The expected and actual values did not match.", new Byte((byte) 4), actual.getWrapperByteArray()[0]); assertEquals("The expected and actual values did not match.", new Byte((byte) 18), actual.getWrapperByteArray()[1]); assertEquals("The expected and actual values did not match.", new Double(33.232D), actual.getWrapperDouble()); assertEquals("The expected and actual values did not match.", new Float(2.23F), actual.getWrapperFloat()); assertEquals("The expected and actual values did not match.", new Integer(3), actual.getWrapperInteger()); assertEquals("The expected and actual values did not match.", new Short((short) 2), actual.getWrapperShort()); assertEquals("The expected and actual values did not match.", new Byte((byte) 21), actual.getWrapperByte()); assertEquals("The expected and actual values did not match.", new Boolean(false), actual.getWrapperBoolean()); assertEquals("The expected and actual values did not match.", (short) 36, actual.getShortArray()[0]); assertEquals("The expected and actual values did not match.", (byte) 7, actual.getByteArray()[0]); date.setTime(new Date(1012937862997L)); assertEquals("The expected and actual values did not match.", date, actual.getCallableDate()); assertEquals("The expected and actual values did not match.", new BigDecimal("2735.23"), actual.getBondAmount()); assertEquals("The expected and actual values did not match.", new BigInteger("21093"), actual.getPortfolioType()); assertEquals("The expected and actual values did not match.", new String("AMEX"), actual.getTradeExchange()); assertEquals("The expected and actual values did not match.", 415.012D, actual.getFiftyTwoWeekHigh(), DOUBLE_DELTA); assertEquals("The expected and actual values did not match.", 8795.32F, actual.getLastTradePrice(), FLOAT_DELTA); assertEquals("The expected and actual values did not match.", 575L, actual.getYield()); assertEquals("The expected and actual values did not match.", 3, actual.getStockBeta()); assertEquals("The expected and actual values did not match.", (short) 45, actual.getDocType()); assertEquals("The expected and actual values did not match.", (byte) 8, actual.getTaxIndicator()); } // testBondInvestmentOut /** * The BondInvestment class contains all the supported data members: * primitives, standard Java classes, arrays, and primitive wrapper * classes. This test insures that a remote method can recieve the * BondInvestment class and that its values match the expected values. */ public void testBondInvestmentIn() throws RemoteException { 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(1013441507388L)); callOptions[0].setCallDate(date); callOptions[1] = new CallOptions(); date = Calendar.getInstance(); date.setTimeZone(gmt); date.setTime(new Date(1013441507390L)); callOptions[1].setCallDate(date); HashMap map = new HashMap(); map.put("Test", "Test Works"); short[] shortArray = {(short) 30}; byte[] byteArray = {(byte) 1}; Short[] wrapperShortArray = {new Short((short) 23), new Short((short) 56)}; Byte[] wrapperByteArray = {new Byte((byte) 2), new Byte((byte) 15)}; 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(2323.232D)); sendValue.setWrapperFloat(new Float(23.023F)); sendValue.setWrapperInteger(new Integer(2093)); sendValue.setWrapperShort(new Short((short) 203)); sendValue.setWrapperByte(new Byte((byte) 20)); sendValue.setWrapperBoolean(new Boolean(true)); sendValue.setShortArray(shortArray); sendValue.setByteArray(byteArray); date = Calendar.getInstance(); date.setTimeZone(gmt); date.setTime(new Date(1012937861996L)); sendValue.setCallableDate(date); sendValue.setBondAmount(new BigDecimal("2675.23")); sendValue.setPortfolioType(new BigInteger("2093")); sendValue.setTradeExchange("NYSE"); sendValue.setFiftyTwoWeekHigh(45.012D); sendValue.setLastTradePrice(87895.32F); sendValue.setYield(5475L); sendValue.setStockBeta(32); sendValue.setDocType((short) 35); sendValue.setTaxIndicator((byte) 3); binding.methodBondInvestmentIn(sendValue); } // testBondInvestmentIn /** * Test the overloaded method getId with a BondInvestment. */ public void testBondInvestmentGetId() throws RemoteException { 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(1013441507388L)); callOptions[0].setCallDate(date); callOptions[1] = new CallOptions(); date = Calendar.getInstance(); date.setTimeZone(gmt); date.setTime(new Date(1013441507390L)); callOptions[1].setCallDate(date); short[] shortArray = {(short) 30}; byte[] byteArray = {(byte) 1}; Short[] wrapperShortArray = {new Short((short) 23), new Short((short) 56)}; Byte[] wrapperByteArray = {new Byte((byte) 2), new Byte((byte) 15)}; BondInvestment sendValue = new BondInvestment(); sendValue.setOptions(callOptions); sendValue.setOptions2(callOptions); sendValue.setOptions3(callOptions[0]); sendValue.setWrapperShortArray(wrapperShortArray); sendValue.setWrapperByteArray(wrapperByteArray); sendValue.setWrapperDouble(new Double(2323.232D)); sendValue.setWrapperFloat(new Float(23.023F)); sendValue.setWrapperInteger(new Integer(2093)); sendValue.setWrapperShort(new Short((short) 203)); sendValue.setWrapperByte(new Byte((byte) 20)); sendValue.setWrapperBoolean(new Boolean(true)); sendValue.setShortArray(shortArray); sendValue.setByteArray(byteArray); date = Calendar.getInstance(); date.setTimeZone(gmt); date.setTime(new Date(1012937861996L)); sendValue.setCallableDate(date); sendValue.setBondAmount(new BigDecimal("2675.23")); sendValue.setPortfolioType(new BigInteger("2093")); sendValue.setTradeExchange("NYSE"); sendValue.setFiftyTwoWeekHigh(45.012D); sendValue.setLastTradePrice(87895.32F); sendValue.setYield(5475L); sendValue.setStockBeta(32); sendValue.setDocType((short) 35); sendValue.setTaxIndicator((byte) 3); sendValue.setId(-123); int id = binding.getId(sendValue); assertEquals("The wrong id was sent back", -123, id); } // testBondInvestmentGetId /** * Test the overloaded method getId with a StockInvestment. */ public void testInvestmentGetId() throws RemoteException { StockInvestment stock = new StockInvestment(); stock.setName("International Business Machines"); stock.setId(1); stock.setTradeExchange("NYSE"); stock.setLastTradePrice(200.55F); // Temporarily commented out until I can get this to work. int id = binding.getId(stock); assertEquals("The wrong id was sent back", 1, id); } // testInvestmentGetId /** * Test to insure that a multiple array sent by a remote method can be * received and its values match the expected values. */ public void testMethodStringMArrayOut() throws RemoteException { String[][] expected = {{"Out-0-0"}, {"Out-1-0"}}; String[][] actual = binding.methodStringMArrayOut(); assertEquals("The expected and actual values did not match.", expected[0][0], actual[0][0]); assertEquals("The expected and actual values did not match.", expected[1][0], actual[1][0]); } // testMethodStringMArrayOut /** * Test to insure that a multiple array can be sent to a remote method. The * server matches the received array against its expected values. */ public void testMethodStringMArrayIn() throws RemoteException { String[][] sendArray = {{"In-0-0", "In-0-1"}, {"In-1-0", "In-1-1"}}; binding.methodStringMArrayIn(sendArray); } // testMethodStringMArrayIn /** * Test to insure that a multiple array matches the expected values on both * the client and server. */ public void testMethodStringMArrayInOut() throws RemoteException { String[][] sendArray = {{"Request-0-0", "Request-0-1"}, {"Request-1-0", "Request-1-1"}}; String[][] expected = {{"Response-0-0", "Response-0-1"}, {"Response-1-0", "Response-1-1"}}; String[][] actual = binding.methodStringMArrayInOut(sendArray); assertEquals("The expected and actual values did not match.", expected[0][0], actual[0][0]); assertEquals("The expected and actual values did not match.", expected[0][1], actual[0][1]); assertEquals("The expected and actual values did not match.", expected[1][0], actual[1][0]); assertEquals("The expected and actual values did not match.", expected[1][1], actual[1][1]); } // testMethodStringMArrayInOut /** * Test to insure that an int array can be sent by a remote method and * the received values match the expected values on the client. */ public void testMethodIntArrayOut() throws RemoteException { int[] expected = {3, 78, 102}; int[] actual = binding.methodIntArrayOut(); assertEquals("The expected and actual values did not match.", expected[0], actual[0]); assertEquals("The expected and actual values did not match.", expected[1], actual[1]); assertEquals("The expected and actual values did not match.", expected[2], actual[2]); } // testMethodIntArrayOut /** * Test to insure that an int array can be sent to a remote method. The server * checks the received array against its expected values. */ public void testMethodIntArrayIn() throws RemoteException { int[] sendValue = {91, 54, 47, 10}; binding.methodIntArrayIn(sendValue); } // testMethodIntArrayIn /** * Test to insure that an int array can roundtrip between the client * and server. The actual and expected values are compared on both * the client and server. */ public void testMethodIntArrayInOut() throws RemoteException { int[] sendValue = {90, 34, 45, 239, 45, 10}; int[] expected = {12, 39, 50, 60, 28, 39}; int[] actual = binding.methodIntArrayInOut(sendValue); assertEquals("The expected and actual values did not match.", expected[0], actual[0]); assertEquals("The expected and actual values did not match.", expected[1], actual[1]); assertEquals("The expected and actual values did not match.", expected[2], actual[2]); assertEquals("The expected and actual values did not match.", expected[3], actual[3]); assertEquals("The expected and actual values did not match.", expected[4], actual[4]); assertEquals("The expected and actual values did not match.", expected[5], actual[5]); } // testMethodIntArrayInOut /** * Test to insure that all the XML -> Java types can be sent to a remote * method. The server checks for the expected values. */ public void testMethodAllTypesIn() throws RemoteException { byte[] sendByteArray = {(byte) 5, (byte) 10, (byte) 12}; Byte[] sendWrapperByteArray = {new Byte((byte) 9), new Byte((byte) 7)}; Calendar dateTime = Calendar.getInstance(); TimeZone gmt = TimeZone.getTimeZone("GMT"); dateTime.setTimeZone(gmt); dateTime.setTime(new Date(1012937861986L)); binding.methodAllTypesIn(new String("Request methodAllTypesIn"), new BigInteger("545"), new BigDecimal("546.545"), dateTime, dateTime, true, (byte) 2, (short) 14, 234, 10900L, 23098.23F,
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -