Package com.ngt.jopenmetaverse.shared.structureddata

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


  @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" +
        "<llsd> \n" +
        "<array> \n" +
        "<date>2006-02-01T14:29:53Z</date> \n" +
        "<date>1999-01-01T00:00:00Z</date> \n" +
        "<date/> \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.Date, array.get(0).getType());
    tempDate = (OSDDate)array.get(0);
    Utils.tryParseDate("2006-02-01T14:29:53Z", testDate);
    Assert.assertEquals(testDate[0], tempDate.asDate());

    Assert.assertEquals(OSDType.Date, array.get(1).getType());
    tempDate = (OSDDate)array.get(1);
    Utils.tryParseDate("1999-01-01T00:00:00Z", testDate);
    Assert.assertEquals(testDate[0], tempDate.asDate());

    Assert.assertEquals(OSDType.Date, array.get(2).getType());
    tempDate = (OSDDate)array.get(2);
    Assert.assertEquals(Utils.Epoch, tempDate.asDate());
  }
View Full Code Here


  @Test
  public void DeserializeDates()
  {
    OSD theSD = null;
    OSDArray array = null;
    OSDDate tempDate = null;
    Date[] testDate = new Date[1];

    String testSD = "[ \n" +
        "[ \n" +
        "\"2006-02-01T14:29:53Z\", \n" +
        "\"1999-01-01T00:00:00Z\" \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.Date, array.get(0).getType());
    tempDate = (OSDDate)array.get(0);
    Utils.tryParseDate("2006-02-01T14:29:53Z", testDate);
    Assert.assertEquals(testDate[0], tempDate.asDate());

    Assert.assertEquals(OSDType.Date, array.get(1).getType());
    tempDate = (OSDDate)array.get(1);
    Utils.tryParseDate("1999-01-01T00:00:00Z", testDate);
    Assert.assertEquals(testDate[0], tempDate.asDate());

//    Assert.assertEquals(OSDType.Date, array.get(2).getType());
//    tempDate = (OSDDate)array.get(2);
//    Assert.assertEquals(Utils.Epoch, tempDate.asDate());
  }
View Full Code Here

TOP

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

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.