Package com.ngt.jopenmetaverse.shared.types

Examples of com.ngt.jopenmetaverse.shared.types.UUID


    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


    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

{
  @Test
  public void UUIDs()
  {
    // Creation
    UUID a = new UUID();
    byte[] bytes = a.GetBytes();
    for (int i = 0; i < 16; i++)
      Assert.assertTrue(bytes[i] == 0x00);

    // Comparison
    a = new UUID(new byte[] { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A,
        0x0B, 0x0C, 0x0D, 0x0E, 0x0F, (byte) 0xFF, (byte) 0xFF }, 0);
    UUID b = new UUID(new byte[] { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A,
        0x0B, 0x0C, 0x0D, 0x0E, 0x0F }, 0);

    Assert.assertTrue("UUID comparison operator failed, " + a.toString() + " should equal " +
        b.toString(), a.equals(b));

    // From String
    a = new UUID(new byte[] { 0x00, 0x01, 0x02, 0x03, 0x04, 0x05, 0x06, 0x07, 0x08, 0x09, 0x0A,
        0x0B, 0x0C, 0x0D, 0x0E, 0x0F }, 0);
    String zeroonetwo = "00010203-0405-0607-0809-0a0b0c0d0e0f";
    b = new UUID(zeroonetwo);

    Assert.assertTrue("UUID hyphenated String constructor failed, should have " + a.toString() +
        " but we got " + b.toString(), a.equals(b));

    // ToString()           
    Assert.assertTrue(a.equals(b));                       
    Assert.assertTrue(a.equals(UUID.Parse(zeroonetwo)));
View Full Code Here

public class AcceptCallingCardPacketTest {

  @Test
  public void ToBytesMultiple() throws MalformedDataException
  {
    UUID testID = UUID.Random();

    AcceptCallingCardPacket bigPacket = new AcceptCallingCardPacket();
    bigPacket.header.Zerocoded = false;
    bigPacket.header.Sequence = 42;
    bigPacket.header.AppendedAcks = true;
    //Unsigned int
    bigPacket.header.AckList = new long[50];
    for (int i = 0; i < bigPacket.header.AckList.length; i++) { bigPacket.header.AckList[i] = (long)i; }
    bigPacket.AgentData.AgentID = testID;
    bigPacket.AgentData.SessionID = testID;
    bigPacket.TransactionBlock.TransactionID = testID;
   
    bigPacket.FolderData = new AcceptCallingCardPacket.FolderDataBlock[200];
    for(int i = 0; i < bigPacket.FolderData.length; i++)
    {
      AcceptCallingCardPacket.FolderDataBlock fdb = new AcceptCallingCardPacket.FolderDataBlock();
      fdb.FolderID = testID;
      bigPacket.FolderData[i] = fdb;
    }
   
    //System.out.println(Utils.bytesToHexString(bigPacket.ToBytes(), "AcceptCallingCardPacketTest ToBytes"));
   
    byte[][] splitPackets = bigPacket.ToBytesMultiple();

    int queryDataCount = 0;
    for (int i = 0; i < splitPackets.length; i++)
    {
      byte[] packetData = splitPackets[i];
     
      //System.out.println(Utils.bytesToHexString(packetData, "AcceptCallingCardPacketTest SplitPacket " + i));
     
      int[] len = new int[]{packetData.length - 1};
      AcceptCallingCardPacket packet = (AcceptCallingCardPacket)Packet.BuildPacket(packetData, len, packetData);

      Assert.assertTrue(packet.AgentData.AgentID.equals(bigPacket.AgentData.AgentID));
      Assert.assertTrue(packet.AgentData.SessionID.equals(bigPacket.AgentData.SessionID));
      Assert.assertTrue(packet.TransactionBlock.TransactionID.equals(bigPacket.TransactionBlock.TransactionID));

      for (int j = 0; j < packet.FolderData.length; j++)
      {
        Assert.assertTrue("Expected FolderId of " + testID.toString() + " but got " + packet.FolderData[j].FolderID.toString(),
            packet.FolderData[j].FolderID.equals(testID));
      }

      queryDataCount += packet.FolderData.length;
    }
View Full Code Here

  @Test
  public void inventoryCreationTests()
  {
    GridClient client = new GridClient();
    UUID uuid1 = new UUID("83a92bbc-d795-458d-baf9-822c75ec0d92");
    Inventory inventory = new Inventory(client, client.inventory, uuid1);
    InventoryFolder rootFolder = new InventoryFolder(uuid1);
    rootFolder.Name = "";
    rootFolder.ParentUUID = UUID.Zero;
    inventory.setRootFolder(rootFolder);
   
    UUID uuid2 = new UUID("83a92bbc-d795-458d-baf9-822c75ec0d92");
   
    inventory.printItems();
   
    Map<UUID, InventoryFolder> testHash = new HashMap<UUID, InventoryFolder>();
    testHash.put(uuid1, rootFolder);
    Assert.assertTrue(uuid2.equals((Object)uuid1));
    Assert.assertTrue(testHash.containsKey(uuid2));
   
    Assert.assertTrue(inventory.contains(uuid1));
    Assert.assertTrue(inventory.contains(uuid2));
   
View Full Code Here

  }

  @Test
  public void ToBytesMultiple() throws MalformedDataException
  {
    UUID testID = UUID.Random();

    DirPlacesReplyPacket bigPacket = new DirPlacesReplyPacket();
    bigPacket.header.Zerocoded = false;
    bigPacket.header.Sequence = 42;
    bigPacket.header.AppendedAcks = true;
View Full Code Here

    AssetCache assetCache = new AssetCache(client);
    Login(client);
    PlatformUtils.sleep(5000);
   
    Map<UUID, byte[]> inventory = new HashMap<UUID, byte[]>();
    UUID tmpAsset = UUID.Random();
    byte[] bytes;
//    boolean status;
   
    saveAndTest(assetCache, inventory, UUID.Random(), Utils.stringToBytes("This is test message"));
    saveAndTest(assetCache, inventory, UUID.Random(), Utils.stringToBytes("This is test message2"));
View Full Code Here

    URL fileLocation1 =  getClass().getClassLoader().getResource("data/files/xml/regionsettings.xml");
    File f1 = new File(fileLocation1.getPath());
    FileInputStream fs1 = new FileInputStream(f1);
    RegionSettings rs1 = RegionSettings.FromStream(fs1);
    System.out.println(rs1.TerrainDetail0.toString());
    Assert.assertEquals(rs1.TerrainDetail0, new UUID("98834a27-4edb-44c6-ab98-84bb8c101421"));
   
    }
    catch(Exception e)
    {
      JLogger.error(Utils.getExceptionStackTraceAsString(e));
View Full Code Here

TOP

Related Classes of com.ngt.jopenmetaverse.shared.types.UUID

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.