Package com.ngt.jopenmetaverse.shared.structureddata

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


      OSDArray badIDs = new OSDArray();
      if (BadIDs != null && BadIDs.length > 0)
      {
        for (int i=0; i<BadIDs.length; i++)
        {
          badIDs.add(new OSDUUID(BadIDs[i]));
        }
      }

      OSDMap ret = new OSDMap();
      ret.put("agents", agents);
View Full Code Here


  public void DeserializeLLSDSample()
  {
    OSD theSD = null;
    OSDMap map = null;
    OSD tempSD = null;
    OSDUUID tempUUID = null;
    OSDString tempStr = null;
    OSDReal tempReal = null;

    String testSD = "<?xml version='1.0' encoding='UTF-8'?> \n" +
        "<llsd> \n" +
        "<map> \n" +
        "<key>region_id</key> \n" +
        "<uuid>67153d5b-3659-afb4-8510-adda2c034649</uuid> \n" +
        "<key>scale</key> \n" +
        "<string>one minute</string> \n" +
        "<key>simulator statistics</key> \n" +
        "<map> \n" +
        "<key>time dilation</key> \n" +
        "<real>0.9878624</real> \n" +
        "<key>sim fps</key> \n" +
        "<real>44.38898</real> \n" +
        "<key>agent updates per second</key> \n" +
        "<real>nan</real> \n" +
        "<key>total task count</key> \n" +
        "<real>4</real> \n" +
        "<key>active task count</key> \n" +
        "<real>0</real> \n" +
        "<key>pending uploads</key> \n" +
        "<real>0.0001096525</real> \n" +
        "</map> \n" +
        "</map> \n" +
        "</llsd>";

    //Deserialize the string
    byte[] bytes = Utils.stringToBytes(testSD);
    theSD =XmlLLSDOSDParser.DeserializeLLSDXml(bytes);

    //Confirm the contents
    Assert.assertNotNull(theSD);
    Assert.assertTrue(theSD instanceof OSDMap);
    System.out.println(theSD.getType().toString());
    Assert.assertTrue(theSD.getType() == OSDType.Map);
    map = (OSDMap)theSD;

    tempSD = map.get("region_id");
    Assert.assertNotNull(tempSD);
    Assert.assertTrue(tempSD instanceof OSDUUID);
    Assert.assertTrue(tempSD.getType() == OSDType.UUID);
    tempUUID = (OSDUUID)tempSD;
    Assert.assertEquals(new UUID("67153d5b-3659-afb4-8510-adda2c034649"), tempUUID.asUUID());

    tempSD = map.get("scale");
    Assert.assertNotNull(tempSD);
    Assert.assertTrue(tempSD instanceof OSDString);
    Assert.assertTrue(tempSD.getType() == OSDType.String);
View Full Code Here

  @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" +
        "<array> \n" +
        "<uuid>d7f4aeca-88f1-42a1-b385-b9db18abb255</uuid> \n" +
        "<uuid/> \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.UUID, array.get(0).getType());
    tempUUID = (OSDUUID)array.get(0);
    Assert.assertEquals(new UUID("d7f4aeca-88f1-42a1-b385-b9db18abb255"), tempUUID.asUUID());

    Assert.assertEquals(OSDType.UUID, array.get(1).getType());
    tempUUID = (OSDUUID)array.get(1);
    Assert.assertEquals(UUID.Zero, tempUUID.asUUID());
  }
View Full Code Here

  public void DeserializeLLSDSample()
  {
    OSD theSD = null;
    OSDMap map = null;
    OSD tempSD = null;
    OSDUUID tempUUID = null;
    OSDString tempStr = null;
    OSDReal tempReal = null;

    String testSD = "[ \n" +
        "{ \n" +
        "\"region_id\": \"67153d5b-3659-afb4-8510-adda2c034649\", \n" +
        "\"scale\": \"one minute\", \n" +
        "\"simulator statistics\": { \n" +
        "\"time dilation\": 0.9878624, \n" +
        "\"sim fps\": 44.38898, \n" +
//        "\"agent updates per second\": NaN, \n" +
        "\"total task count\": 4.0, \n" +
        "\"active task count\": 0.0, \n" +
        "\"pending uploads\": 0.0001096525 \n" +
        "}\n" +
        "}\n" +
        "]";

    //Deserialize the string
    System.out.println(testSD);
    byte[] bytes = Utils.stringToBytes(testSD);
    theSD =JsonLLSDOSDParser.DeserializeLLSDJson(bytes);

    //Confirm the contents
    Assert.assertNotNull(theSD);
    Assert.assertTrue(theSD instanceof OSDMap);
    System.out.println(theSD.getType().toString());
    Assert.assertTrue(theSD.getType() == OSDType.Map);
    map = (OSDMap)theSD;

    tempSD = map.get("region_id");
    Assert.assertNotNull(tempSD);
    Assert.assertTrue(tempSD instanceof OSDUUID);
    Assert.assertTrue(tempSD.getType() == OSDType.UUID);
    tempUUID = (OSDUUID)tempSD;
    Assert.assertEquals(new UUID("67153d5b-3659-afb4-8510-adda2c034649"), tempUUID.asUUID());

    tempSD = map.get("scale");
    Assert.assertNotNull(tempSD);
    Assert.assertTrue(tempSD instanceof OSDString);
    Assert.assertTrue(tempSD.getType() == OSDType.String);
View Full Code Here

  @Test
  public void DeserializeUUID()
  {
    OSD theSD = null;
    OSDArray array = null;
    OSDUUID tempUUID = null;

    String testSD = "[ \n" +
        "[ \n" +
        "\"d7f4aeca-88f1-42a1-b385-b9db18abb255\",\n" +
        "\"00000000-0000-0000-0000-000000000000\" \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.UUID, array.get(0).getType());
    tempUUID = (OSDUUID)array.get(0);
    Assert.assertEquals(new UUID("d7f4aeca-88f1-42a1-b385-b9db18abb255"), tempUUID.asUUID());

    Assert.assertEquals(OSDType.UUID, array.get(1).getType());
    tempUUID = (OSDUUID)array.get(1);
    Assert.assertEquals(UUID.Zero, tempUUID.asUUID());
  }
View Full Code Here

TOP

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

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.