Search in sources :

Example 1 with BigPerson

use of com.alibaba.dubbo.common.model.person.BigPerson in project dubbo by alibaba.

the class JavaBeanSerializeUtilTest method createBigPerson.

static BigPerson createBigPerson() {
    BigPerson bigPerson;
    bigPerson = new BigPerson();
    bigPerson.setPersonId("superman111");
    bigPerson.setLoginName("superman");
    bigPerson.setStatus(PersonStatus.ENABLED);
    bigPerson.setEmail("sm@1.com");
    bigPerson.setPenName("pname");
    ArrayList<Phone> phones = new ArrayList<Phone>();
    Phone phone1 = new Phone("86", "0571", "87654321", "001");
    Phone phone2 = new Phone("86", "0571", "87654322", "002");
    phones.add(phone1);
    phones.add(phone2);
    PersonInfo pi = new PersonInfo();
    pi.setPhones(phones);
    Phone fax = new Phone("86", "0571", "87654321", null);
    pi.setFax(fax);
    FullAddress addr = new FullAddress("CN", "zj", "3480", "wensanlu", "315000");
    pi.setFullAddress(addr);
    pi.setMobileNo("13584652131");
    pi.setMale(true);
    pi.setDepartment("b2b");
    pi.setHomepageUrl("www.capcom.com");
    pi.setJobTitle("qa");
    pi.setName("superman");
    bigPerson.setInfoProfile(pi);
    return bigPerson;
}
Also used : FullAddress(com.alibaba.dubbo.common.model.person.FullAddress) PersonInfo(com.alibaba.dubbo.common.model.person.PersonInfo) Phone(com.alibaba.dubbo.common.model.person.Phone) ArrayList(java.util.ArrayList) BigPerson(com.alibaba.dubbo.common.model.person.BigPerson)

Example 2 with BigPerson

use of com.alibaba.dubbo.common.model.person.BigPerson in project dubbo by alibaba.

the class AbstractSerializationTest method test_MultiObject_WithType.

@Test
public void test_MultiObject_WithType() throws Exception {
    ObjectOutput objectOutput = serialization.serialize(url, byteArrayOutputStream);
    objectOutput.writeBool(false);
    objectOutput.writeObject(bigPerson);
    objectOutput.writeByte((byte) 23);
    objectOutput.writeObject(mediaContent);
    objectOutput.writeInt(-23);
    objectOutput.flushBuffer();
    ByteArrayInputStream byteArrayInputStream = new ByteArrayInputStream(byteArrayOutputStream.toByteArray());
    ObjectInput deserialize = serialization.deserialize(url, byteArrayInputStream);
    assertEquals(false, deserialize.readBool());
    assertEquals(bigPerson, deserialize.readObject(BigPerson.class));
    assertEquals((byte) 23, deserialize.readByte());
    assertEquals(mediaContent, deserialize.readObject(MediaContent.class));
    assertEquals(-23, deserialize.readInt());
    try {
        deserialize.readObject();
        fail();
    } catch (IOException expected) {
    }
}
Also used : ObjectOutput(com.alibaba.dubbo.common.serialize.ObjectOutput) ByteArrayInputStream(java.io.ByteArrayInputStream) MediaContent(com.alibaba.dubbo.common.model.media.MediaContent) ObjectInput(com.alibaba.dubbo.common.serialize.ObjectInput) IOException(java.io.IOException) BigPerson(com.alibaba.dubbo.common.model.person.BigPerson) Test(org.junit.Test)

Aggregations

BigPerson (com.alibaba.dubbo.common.model.person.BigPerson)2 MediaContent (com.alibaba.dubbo.common.model.media.MediaContent)1 FullAddress (com.alibaba.dubbo.common.model.person.FullAddress)1 PersonInfo (com.alibaba.dubbo.common.model.person.PersonInfo)1 Phone (com.alibaba.dubbo.common.model.person.Phone)1 ObjectInput (com.alibaba.dubbo.common.serialize.ObjectInput)1 ObjectOutput (com.alibaba.dubbo.common.serialize.ObjectOutput)1 ByteArrayInputStream (java.io.ByteArrayInputStream)1 IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1 Test (org.junit.Test)1