public TransferObjectWrapper getObjectWrapper(TransferInputStream tins) {
     account = new TestAccount();
     account.setId(tins.readInt());
     account.setName(tins.readString());
     account.setAddress(tins.readString());
     return this;
 }
        public TestAccount getAccount(TestAccount account) {
            StandardTransferObject to = transferObjectFactory.createTransferObject();

            to.setCalleeClass("com.qileyuan.tatala.example.proxy.TestServerProxy");
            to.setCalleeMethod("getAccount");
            to.registerReturnType(TransferObject.DATATYPE_WRAPPER);

            TestAccountWrapper accountWrapper = new TestAccountWrapper(account);
            to.putWrapper("account", accountWrapper);

            accountWrapper = (TestAccountWrapper)ServerExecutor.execute(to);

            if (accountWrapper != null) {
                TestAccount returnAccount = accountWrapper.getAccount();
                return returnAccount;
            } else {
                return null;
            }

        }
Beispiel #3
0
        public void RemoteTest() {
            try {
                
                //int, String and return String testing
                int Id = 18;
                String name = "JimT";
                String result = manager.sayHello(Id, name);
                Logging.LogDebug("result: " + result);
                
                //no parameter, void return testing
                manager.doSomething();

                //object parameter, object return testing
                TestAccount account = new TestAccount();
                account.setId(1000);
                account.setName("JimT");
                account = manager.getAccount(account);
                Logging.LogDebug(account);

                //all primitive type parameter, object return testing
                AllTypeBean allTypeBean = manager.getAllTypeBean(true, (byte)25, (short)-2, 'T', 3, (long)4, 5.5f, 6.66d, DateTime.Now, "Hello JimT!");
                Logging.LogDebug("allTypeBean: " + allTypeBean);

                //int array and string array, string array return testing
                int[] intarr = new int[3];
                intarr[0] = 1;
                intarr[1] = 2;
                intarr[2] = 3;
                String[] strarr = new String[3];
                strarr[0] = "Jim ";
                strarr[1] = "Tang ";
                strarr[2] = "Toronto ";
                strarr = manager.getArray(intarr, strarr);
                if (strarr != null) {
                    for (int i = 0; i < strarr.Length; i++) {
                        Logging.LogDebug("strarr: " + strarr[i]);
                    }
                }
                
                //below two are not for performance test
                //compress testing
                account = new TestAccount();
                account.setId(1000);
                string str = "";
                for (int i = 0; i < 50; i++) {
                    str += "The quick brown fox jumps over the lazy dog.  ";
                }
                account.setName(str);
                account = manager.getAccountCompress(account);
                Logging.LogDebug(account);


                //asychronous testing
                account = new TestAccount();
                account.setId(1000);
                account.setName("JimT");
                account = manager.getAccountAsynchronous(account);
                Logging.LogDebug(account);
                
            } catch (Exception ex) {
                Logging.LogError(ex.ToString());
            }
        }
 public void setAccount(TestAccount account) {
     this.account = account;
 }
 public TestAccountWrapper(TestAccount account) {
     this.account = account;
 }
        public TestAccount getAccountAsynchronous(TestAccount account) {
            StandardTransferObject to = transferObjectFactory.createTransferObject();

            to.setCalleeClass("com.qileyuan.tatala.example.proxy.TestServerProxy");
            to.setCalleeMethod("getAccount");
            to.registerReturnType(TransferObject.DATATYPE_WRAPPER);

            TestAccountWrapper accountWrapper = new TestAccountWrapper(account);
            to.putWrapper("account", accountWrapper);
            to.setAsynchronous(true);

            Future future = (Future)ServerExecutor.execute(to);

            accountWrapper = (TestAccountWrapper)future.Get();
            TestAccount returnAccount = accountWrapper.getAccount();

            return returnAccount;
        }