com.alibaba.dubbo.common.utils.PojoUtilsTest Java Examples
The following examples show how to use
com.alibaba.dubbo.common.utils.PojoUtilsTest.
You can vote up the ones you like or vote down the ones you don't like,
and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: JavaBeanSerializeUtilTest.java From dubbo-2.6.5 with Apache License 2.0 | 6 votes |
@Test public void test_Circular_Reference() throws Exception { PojoUtilsTest.Parent parent = new PojoUtilsTest.Parent(); parent.setAge(Integer.MAX_VALUE); parent.setEmail("a@b"); parent.setName("zhangsan"); PojoUtilsTest.Child child = new PojoUtilsTest.Child(); child.setAge(100); child.setName("lisi"); child.setParent(parent); parent.setChild(child); JavaBeanDescriptor descriptor = JavaBeanSerializeUtil.serialize(parent, JavaBeanAccessor.METHOD); Assert.assertTrue(descriptor.isBeanType()); assertEqualsPrimitive(parent.getAge(), descriptor.getProperty("age")); assertEqualsPrimitive(parent.getName(), descriptor.getProperty("name")); assertEqualsPrimitive(parent.getEmail(), descriptor.getProperty("email")); JavaBeanDescriptor childDescriptor = (JavaBeanDescriptor) descriptor.getProperty("child"); Assert.assertTrue(descriptor == childDescriptor.getProperty("parent")); assertEqualsPrimitive(child.getName(), childDescriptor.getProperty("name")); assertEqualsPrimitive(child.getAge(), childDescriptor.getProperty("age")); }
Example #2
Source File: JavaBeanSerializeUtilTest.java From dubbox with Apache License 2.0 | 6 votes |
@Test public void test_Circular_Reference() throws Exception { PojoUtilsTest.Parent parent = new PojoUtilsTest.Parent(); parent.setAge(Integer.MAX_VALUE); parent.setEmail("a@b"); parent.setName("zhangsan"); PojoUtilsTest.Child child = new PojoUtilsTest.Child(); child.setAge(100); child.setName("lisi"); child.setParent(parent); parent.setChild(child); JavaBeanDescriptor descriptor = JavaBeanSerializeUtil.serialize(parent, JavaBeanAccessor.METHOD); Assert.assertTrue(descriptor.isBeanType()); assertEqualsPrimitive(parent.getAge(), descriptor.getProperty("age")); assertEqualsPrimitive(parent.getName(), descriptor.getProperty("name")); assertEqualsPrimitive(parent.getEmail(), descriptor.getProperty("email")); JavaBeanDescriptor childDescriptor = (JavaBeanDescriptor) descriptor.getProperty("child"); Assert.assertTrue(descriptor == childDescriptor.getProperty("parent")); assertEqualsPrimitive(child.getName(), childDescriptor.getProperty("name")); assertEqualsPrimitive(child.getAge(), childDescriptor.getProperty("age")); }
Example #3
Source File: JavaBeanSerializeUtilTest.java From dubbox-hystrix with Apache License 2.0 | 6 votes |
@Test public void test_Circular_Reference() throws Exception { PojoUtilsTest.Parent parent = new PojoUtilsTest.Parent(); parent.setAge(Integer.MAX_VALUE); parent.setEmail("a@b"); parent.setName("zhangsan"); PojoUtilsTest.Child child = new PojoUtilsTest.Child(); child.setAge(100); child.setName("lisi"); child.setParent(parent); parent.setChild(child); JavaBeanDescriptor descriptor = JavaBeanSerializeUtil.serialize(parent, JavaBeanAccessor.METHOD); Assert.assertTrue(descriptor.isBeanType()); assertEqualsPrimitive(parent.getAge(), descriptor.getProperty("age")); assertEqualsPrimitive(parent.getName(), descriptor.getProperty("name")); assertEqualsPrimitive(parent.getEmail(), descriptor.getProperty("email")); JavaBeanDescriptor childDescriptor = (JavaBeanDescriptor) descriptor.getProperty("child"); Assert.assertTrue(descriptor == childDescriptor.getProperty("parent")); assertEqualsPrimitive(child.getName(), childDescriptor.getProperty("name")); assertEqualsPrimitive(child.getAge(), childDescriptor.getProperty("age")); }
Example #4
Source File: JavaBeanSerializeUtilTest.java From dubbo3 with Apache License 2.0 | 6 votes |
@Test public void test_Circular_Reference() throws Exception { PojoUtilsTest.Parent parent = new PojoUtilsTest.Parent(); parent.setAge(Integer.MAX_VALUE); parent.setEmail("a@b"); parent.setName("zhangsan"); PojoUtilsTest.Child child = new PojoUtilsTest.Child(); child.setAge(100); child.setName("lisi"); child.setParent(parent); parent.setChild(child); JavaBeanDescriptor descriptor = JavaBeanSerializeUtil.serialize(parent, JavaBeanAccessor.METHOD); Assert.assertTrue(descriptor.isBeanType()); assertEqualsPrimitive(parent.getAge(), descriptor.getProperty("age")); assertEqualsPrimitive(parent.getName(), descriptor.getProperty("name")); assertEqualsPrimitive(parent.getEmail(), descriptor.getProperty("email")); JavaBeanDescriptor childDescriptor = (JavaBeanDescriptor) descriptor.getProperty("child"); Assert.assertTrue(descriptor == childDescriptor.getProperty("parent")); assertEqualsPrimitive(child.getName(), childDescriptor.getProperty("name")); assertEqualsPrimitive(child.getAge(), childDescriptor.getProperty("age")); }
Example #5
Source File: JavaBeanSerializeUtilTest.java From dubbox with Apache License 2.0 | 6 votes |
@Test public void test_Circular_Reference() throws Exception { PojoUtilsTest.Parent parent = new PojoUtilsTest.Parent(); parent.setAge(Integer.MAX_VALUE); parent.setEmail("a@b"); parent.setName("zhangsan"); PojoUtilsTest.Child child = new PojoUtilsTest.Child(); child.setAge(100); child.setName("lisi"); child.setParent(parent); parent.setChild(child); JavaBeanDescriptor descriptor = JavaBeanSerializeUtil.serialize(parent, JavaBeanAccessor.METHOD); Assert.assertTrue(descriptor.isBeanType()); assertEqualsPrimitive(parent.getAge(), descriptor.getProperty("age")); assertEqualsPrimitive(parent.getName(), descriptor.getProperty("name")); assertEqualsPrimitive(parent.getEmail(), descriptor.getProperty("email")); JavaBeanDescriptor childDescriptor = (JavaBeanDescriptor) descriptor.getProperty("child"); Assert.assertTrue(descriptor == childDescriptor.getProperty("parent")); assertEqualsPrimitive(child.getName(), childDescriptor.getProperty("name")); assertEqualsPrimitive(child.getAge(), childDescriptor.getProperty("age")); }
Example #6
Source File: JavaBeanSerializeUtilTest.java From dubbox with Apache License 2.0 | 6 votes |
@Test public void test_Circular_Reference() throws Exception { PojoUtilsTest.Parent parent = new PojoUtilsTest.Parent(); parent.setAge(Integer.MAX_VALUE); parent.setEmail("a@b"); parent.setName("zhangsan"); PojoUtilsTest.Child child = new PojoUtilsTest.Child(); child.setAge(100); child.setName("lisi"); child.setParent(parent); parent.setChild(child); JavaBeanDescriptor descriptor = JavaBeanSerializeUtil.serialize(parent, JavaBeanAccessor.METHOD); Assert.assertTrue(descriptor.isBeanType()); assertEqualsPrimitive(parent.getAge(), descriptor.getProperty("age")); assertEqualsPrimitive(parent.getName(), descriptor.getProperty("name")); assertEqualsPrimitive(parent.getEmail(), descriptor.getProperty("email")); JavaBeanDescriptor childDescriptor = (JavaBeanDescriptor) descriptor.getProperty("child"); Assert.assertTrue(descriptor == childDescriptor.getProperty("parent")); assertEqualsPrimitive(child.getName(), childDescriptor.getProperty("name")); assertEqualsPrimitive(child.getAge(), childDescriptor.getProperty("age")); }