Package com.alibaba.dubbo.rpc.service

Examples of com.alibaba.dubbo.rpc.service.GenericService.$invoke()


                parameter.put("name", "liangfei");
                parameter.put("Email", "liangfei@liang.fei");
                parameter.put("Age", 50);
                parameter.put("LoginDate", new Date(System.currentTimeMillis() - 1000000));
                parameter.put("ExpiryDate", new Date(System.currentTimeMillis() + 1000000));
                validationService.$invoke("save", new String[] {ValidationParameter.class.getName()}, new Object[] {parameter});
               
                // Save Error
                try {
                    parameter = new HashMap<String, Object>();
                    validationService.$invoke("save", new String[] {ValidationParameter.class.getName()}, new Object[] {parameter});
View Full Code Here


                validationService.$invoke("save", new String[] {ValidationParameter.class.getName()}, new Object[] {parameter});
               
                // Save Error
                try {
                    parameter = new HashMap<String, Object>();
                    validationService.$invoke("save", new String[] {ValidationParameter.class.getName()}, new Object[] {parameter});
                    Assert.fail();
                } catch (RpcException e) {
                    Assert.assertTrue(e.getMessage().contains("ConstraintViolation"));
                }
               
View Full Code Here

                } catch (RpcException e) {
                    Assert.assertTrue(e.getMessage().contains("ConstraintViolation"));
                }
               
                // Delete OK
                validationService.$invoke("delete", new String[] {long.class.getName(), String.class.getName()}, new Object[] {2, "abc"});
               
                // Delete Error
                try {
                    validationService.$invoke("delete", new String[] {long.class.getName(), String.class.getName()}, new Object[] {0, "abc"});
                    Assert.fail();
View Full Code Here

                // Delete OK
                validationService.$invoke("delete", new String[] {long.class.getName(), String.class.getName()}, new Object[] {2, "abc"});
               
                // Delete Error
                try {
                    validationService.$invoke("delete", new String[] {long.class.getName(), String.class.getName()}, new Object[] {0, "abc"});
                    Assert.fail();
                } catch (RpcException e) {
                    Assert.assertTrue(e.getMessage().contains("ConstraintViolation"));
                }
                try {
View Full Code Here

                    Assert.fail();
                } catch (RpcException e) {
                    Assert.assertTrue(e.getMessage().contains("ConstraintViolation"));
                }
                try {
                    validationService.$invoke("delete", new String[] {long.class.getName(), String.class.getName()}, new Object[] {2, null});
                    Assert.fail();
                } catch (RpcException e) {
                    Assert.assertTrue(e.getMessage().contains("ConstraintViolation"));
                }
                try {
View Full Code Here

                    Assert.fail();
                } catch (RpcException e) {
                    Assert.assertTrue(e.getMessage().contains("ConstraintViolation"));
                }
                try {
                    validationService.$invoke("delete", new String[] {long.class.getName(), String.class.getName()}, new Object[] {0, null});
                    Assert.fail();
                } catch (RpcException e) {
                    Assert.assertTrue(e.getMessage().contains("ConstraintViolation"));
                }
            } finally {
View Full Code Here

                List<Map<String, Object>> users = new ArrayList<Map<String, Object>>();
                Map<String, Object> user = new HashMap<String, Object>();
                user.put("class", "com.alibaba.dubbo.config.api.User");
                user.put("name", "actual.provider");
                users.add(user);
                users = (List<Map<String, Object>>) genericService.$invoke("getUsers", new String[]{List.class.getName()}, new Object[]{users});
                Assert.assertEquals(1, users.size());
                Assert.assertEquals("actual.provider", users.get(0).get("name"));
            } finally {
                reference.destroy();
            }
View Full Code Here

                String name = "kimi";
                ByteArrayOutputStream bos = new ByteArrayOutputStream(512);
                ExtensionLoader.getExtensionLoader(Serialization.class)
                    .getExtension("nativejava").serialize(null, bos).writeObject(name);
                byte[] arg = bos.toByteArray();
                Object obj = genericService.$invoke("sayName", new String[]{String.class.getName()}, new Object[]{arg});
                Assert.assertTrue(obj instanceof byte[]);
                byte[] result = (byte[]) obj;
                Assert.assertEquals(ref.sayName(name), ExtensionLoader.getExtensionLoader(Serialization.class)
                    .getExtension("nativejava").deserialize(null, new ByteArrayInputStream(result)).readObject().toString());
View Full Code Here

                user.setName(name);
                users.add(user);
                bos = new ByteArrayOutputStream(512);
                ExtensionLoader.getExtensionLoader(Serialization.class)
                    .getExtension("nativejava").serialize(null, bos).writeObject(users);
                obj = genericService.$invoke("getUsers",
                                             new String[]{List.class.getName()},
                                             new Object[]{bos.toByteArray()});
                Assert.assertTrue(obj instanceof byte[]);
                result = (byte[]) obj;
                Assert.assertEquals(users,
View Full Code Here

                // echo(int)
                bos = new ByteArrayOutputStream(512);
                ExtensionLoader.getExtensionLoader(Serialization.class).getExtension("nativejava")
                    .serialize(null, bos).writeObject(Integer.MAX_VALUE);
                obj = genericService.$invoke("echo", new String[]{int.class.getName()}, new Object[]{bos.toByteArray()});
                Assert.assertTrue(obj instanceof byte[]);
                Assert.assertEquals(Integer.MAX_VALUE,
                                    ExtensionLoader.getExtensionLoader(Serialization.class)
                                        .getExtension("nativejava")
                                        .deserialize(null, new ByteArrayInputStream((byte[]) obj))
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.