Package com.ngt.jopenmetaverse.shared.structureddata

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


  /// it's understood if there was a design reason for the Int32.
  /// </summary>
  @Test
  public void DeserializeIntegers()
  {
    OSD theSD = null;
    OSDArray array = null;
    OSDInteger tempInt = null;

    String testSD = "<?xml version='1.0' encoding='UTF-8'?> \n" +
        "<llsd> \n" +
View Full Code Here


  /// Test that various UUID representations are parsed correctly.
  /// </summary>
  @Test
  public void DeserializeUUID()
  {
    OSD theSD = null;
    OSDArray array = null;
    OSDUUID tempUUID = null;

    String testSD = "<?xml version='1.0' encoding='UTF-8'?> \n" +
        "<llsd> \n" +
View Full Code Here

  /// Test that various date representations are parsed correctly.
  /// </summary>
  @Test
  public void DeserializeDates()
  {
    OSD theSD = null;
    OSDArray array = null;
    OSDDate tempDate = null;
    Date[] testDate = new Date[1];

    String testSD = "<?xml version='1.0' encoding='UTF-8'?> \n" +
View Full Code Here

  /// Test that various Boolean representations are parsed correctly.
  /// </summary>
  @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" +
View Full Code Here

  /// Test that binary elements are parsed correctly.
  /// </summary>
  @Test
  public void DeserializeBinary()
  {
    OSD theSD = null;
    OSDArray array = null;
    OSDBinary tempBinary = null;

    String testSD = "<?xml version='1.0' encoding='UTF-8'?> \n" +
        "<llsd> \n" +
View Full Code Here

  /// current implementation generates an instance of SD
  /// </summary>
  @Test
  public void DeserializeUndef()
  {
    OSD theSD = null;

    String testSD = "<?xml version='1.0' encoding='UTF-8'?> \n" +
        "<llsd> \n" +
        "<undef/> \n" +
        "</llsd>";
View Full Code Here

  /// Test that various URI representations are parsed correctly.
  /// </summary>
  @Test
  public void DeserializeURI() throws URISyntaxException
  {
    OSD theSD = null;
    OSDArray array = null;
    OSDUri tempURI = null;

    String testSD = "<?xml version='1.0' encoding='UTF-8'?> \n" +
        "<llsd> \n" +
View Full Code Here

  /// but it should reveal basic nesting issues.
  /// </summary>
  @Test
  public void DeserializeNestedContainers()
  {
    OSD theSD = null;
    OSDArray array = null;
    OSDMap map = null;
    OSD tempSD = null;

    String testSD = "<?xml version='1.0' encoding='UTF-8'?> \n" +
        "<llsd> \n" +
        "<array> \n" +
        "<map> \n" +
        "<key>Map One</key> \n" +
        "<map> \n" +
        "<key>Array One</key> \n" +
        "<array> \n" +
        "<integer>1</integer> \n" +
        "<integer>2</integer> \n" +
        "</array> \n" +
        "</map> \n" +
        "</map> \n" +
        "<array> \n" +
        "<string>A</string> \n" +
        "<string>B</string> \n" +
        "<array> \n" +
        "<integer>1</integer> \n" +
        "<integer>4</integer> \n" +
        "<integer>9</integer> \n" +
        "</array> \n" +
        "</array> \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(2, array.count());

    //The first element of top level array, a map
    Assert.assertEquals(OSDType.Map, array.get(0).getType());
    map = (OSDMap)array.get(0);
    //First nested map
    tempSD = map.get("Map One");
    Assert.assertNotNull(tempSD);
    Assert.assertEquals(OSDType.Map, tempSD.getType());
    map = (OSDMap)tempSD;
    //First nested array
    tempSD = map.get("Array One");
    Assert.assertNotNull(tempSD);
    Assert.assertEquals(OSDType.Array, tempSD.getType());
    array = (OSDArray)tempSD;
    Assert.assertEquals(2, array.count());

    array = (OSDArray)theSD;
    //Second element of top level array, an array
    tempSD = array.get(1);
    Assert.assertEquals(OSDType.Array, tempSD.getType());
    array = (OSDArray)tempSD;
    Assert.assertEquals(3, array.count());
    //Nested array
    tempSD = array.get(2);
    Assert.assertEquals(OSDType.Array, tempSD.getType());
    array = (OSDArray)tempSD;
    Assert.assertEquals(3, array.count());
  }
View Full Code Here

      AssetMesh assetMesh  = new AssetMesh();
      assetMesh.AssetData = bytes;
      assetMesh.Decode();
     
      ByteArrayInputStream baos = new ByteArrayInputStream(assetMesh.AssetData);
      OSD osd = BinaryLLSDOSDParser.DeserializeLLSDBinary(baos);
      OSDMap header = (OSDMap) osd;
      for(String partName : header.keys())
      {
        System.out.println(partName);
      }
View Full Code Here

   
   
    @Test
    public void deserializeUndef() throws IOException, OSDException
    {
        OSD llsdUndef = BinaryLLSDOSDParser.DeserializeLLSDBinary(binaryUndef);
        Assert.assertEquals(OSDType.Unknown, llsdUndef.getType());
    }
View Full Code Here

TOP

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

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.