Package com.ngt.jopenmetaverse.shared.structureddata

Examples of com.ngt.jopenmetaverse.shared.structureddata.OSDBoolean


  @Test
  public void DeserializeBoolean()
  {
    OSD theSD = null;
    OSDArray array = null;
    OSDBoolean tempBool = null;

    String testSD = "<?xml version='1.0' encoding='UTF-8'?> \n" +
        "<llsd> \n" +
        "<array> \n" +
        "<boolean>1</boolean> \n" +
        "<boolean>true</boolean> \n" +
        "<boolean>0</boolean> \n" +
        "<boolean>false</boolean> \n" +
        "<boolean/> \n" +
        "</array> \n" +
        "</llsd>";
    //Deserialize the string
    byte[] bytes = Utils.stringToBytes(testSD);
    theSD =XmlLLSDOSDParser.DeserializeLLSDXml(bytes);

    Assert.assertTrue(theSD instanceof OSDArray);
    array = (OSDArray)theSD;

    Assert.assertEquals(OSDType.Boolean, array.get(0).getType());
    tempBool = (OSDBoolean)array.get(0);
    Assert.assertEquals(true, tempBool.asBoolean());

    Assert.assertEquals(OSDType.Boolean, array.get(1).getType());
    tempBool = (OSDBoolean)array.get(1);
    Assert.assertEquals(true, tempBool.asBoolean());

    Assert.assertEquals(OSDType.Boolean, array.get(2).getType());
    tempBool = (OSDBoolean)array.get(2);
    Assert.assertEquals(false, tempBool.asBoolean());

    Assert.assertEquals(OSDType.Boolean, array.get(3).getType());
    tempBool = (OSDBoolean)array.get(3);
    Assert.assertEquals(false, tempBool.asBoolean());

    Assert.assertEquals(OSDType.Boolean, array.get(4).getType());
    tempBool = (OSDBoolean)array.get(4);
    Assert.assertEquals(false, tempBool.asBoolean());
  }
View Full Code Here


  @Test
  public void DeserializeBoolean()
  {
    OSD theSD = null;
    OSDArray array = null;
    OSDBoolean tempBool = null;

    String testSD = "[ \n" +
        "[ \n" +
        "true, \n" +
        "false \n" +
        "] \n" +
        "]";
    //Deserialize the string
    byte[] bytes = Utils.stringToBytes(testSD);
    theSD =JsonLLSDOSDParser.DeserializeLLSDJson(bytes);

    Assert.assertTrue(theSD instanceof OSDArray);
    array = (OSDArray)theSD;

    Assert.assertEquals(OSDType.Boolean, array.get(0).getType());
    tempBool = (OSDBoolean)array.get(0);
    Assert.assertEquals(true, tempBool.asBoolean());

    Assert.assertEquals(OSDType.Boolean, array.get(1).getType());
    tempBool = (OSDBoolean)array.get(1);
    Assert.assertEquals(false, tempBool.asBoolean());
  }
View Full Code Here

TOP

Related Classes of com.ngt.jopenmetaverse.shared.structureddata.OSDBoolean

Copyright © 2018 www.massapicom. 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.