コード例 #1
0
 public void testAddRequestArgs_syncStops() {
   requestItem = new RequestItem(IServerProxyConstants.ACT_SYNC_STOPS, proxy);
   requestItem.params = new Vector();
   Address address = new Address();
   Stop stop = new Stop();
   stop.setCity("EAST BOSTON");
   stop.setCity("US");
   stop.setProvince("MA");
   address.setStop(stop);
   Vector addresses = new Vector();
   addresses.add(address);
   FavoriteCatalog favoriteCatalog = new FavoriteCatalog();
   favoriteCatalog.setName("sports");
   Vector categories = new Vector();
   Vector receivedAddresses = new Vector();
   categories.add(favoriteCatalog);
   requestItem.params.add(0, 131712312L);
   requestItem.params.add(1, addresses);
   requestItem.params.add(2, addresses);
   requestItem.params.add(3, categories);
   requestItem.params.add(4, receivedAddresses);
   try {
     proxy.addRequestArgs(requestVector, requestItem);
   } catch (Exception e) {
     fail(e.toString());
   }
   ProtocolBuffer pb = (ProtocolBuffer) requestVector.get(0);
   assertEquals(1, requestVector.size());
   //        Assert.assertArrayEquals(synStops_data, pb.getBufferData());
   assertEquals(IServerProxyConstants.ACT_SYNC_STOPS, pb.getObjType());
 }
コード例 #2
0
 public void testAddRequestArgs_syncStops_exception_lessParames() {
   requestItem = new RequestItem(IServerProxyConstants.ACT_SYNC_STOPS, proxy);
   requestItem.params = new Vector();
   Address address = new Address();
   Stop stop = new Stop();
   stop.setCity("EAST BOSTON");
   stop.setCity("US");
   stop.setProvince("MA");
   address.setStop(stop);
   Vector addresses = new Vector();
   addresses.add(address);
   requestItem.params.add(0, 131712312L);
   requestItem.params.add(1, addresses);
   requestItem.params.add(2, addresses);
   try {
     proxy.addRequestArgs(requestVector, requestItem);
   } catch (IllegalArgumentException e) {
     illegalArgumentException = e;
   } catch (Exception e) {
     fail(e.toString());
   } finally {
     assertNotNull(illegalArgumentException);
   }
 }