Package com.ngt.jopenmetaverse.shared.structureddata

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


    }

    @Test
    public void SerializeUndef() throws Exception
    {
        OSD llsdUndef = new OSD();
        byte[] binaryUndefSerialized = BinaryLLSDOSDParser.SerializeLLSDBinary(llsdUndef);
        Assert.assertArrayEquals(binaryUndef, binaryUndefSerialized);
    }
View Full Code Here


    private static byte[] binaryFalse = (byte[])mergeArrays(binaryHead, binaryFalseValue);

    @Test
    public void DeserializeBool() throws IOException, OSDException
    {
        OSD llsdTrue = BinaryLLSDOSDParser.DeserializeLLSDBinary(binaryTrue);
        Assert.assertEquals(OSDType.Boolean, llsdTrue.getType());
        Assert.assertTrue(llsdTrue.asBoolean());

        OSD llsdFalse = BinaryLLSDOSDParser.DeserializeLLSDBinary(binaryFalse);
        Assert.assertEquals(OSDType.Boolean, llsdFalse.getType());
        Assert.assertFalse(llsdFalse.asBoolean());
    }
View Full Code Here

    }

    @Test
    public void SerializeBool() throws Exception
    {
        OSD llsdTrue = OSD.FromBoolean(true);
        byte[] binaryTrueSerialized = BinaryLLSDOSDParser.SerializeLLSDBinary(llsdTrue);
        Assert.assertArrayEquals(binaryTrue, binaryTrueSerialized);

        OSD llsdFalse = OSD.FromBoolean(false);
        byte[] binaryFalseSerialized = BinaryLLSDOSDParser.SerializeLLSDBinary(llsdFalse);
        Assert.assertArrayEquals(binaryFalse, binaryFalseSerialized);
    }
View Full Code Here

    private static byte[] binaryAnInt = (byte[])mergeArrays(binaryHead, binaryAnIntValue);

    @Test
    public void DeserializeInteger() throws IOException, OSDException
    {
        OSD llsdZeroInteger = BinaryLLSDOSDParser.DeserializeLLSDBinary(binaryZeroInt);
        Assert.assertEquals(OSDType.Integer, llsdZeroInteger.getType());
        Assert.assertEquals(0, llsdZeroInteger.asInteger());


        OSD llsdAnInteger = BinaryLLSDOSDParser.DeserializeLLSDBinary(binaryAnInt);
        Assert.assertEquals(OSDType.Integer, llsdAnInteger.getType());
        Assert.assertEquals(1234843, llsdAnInteger.asInteger());
    }
View Full Code Here

    }

    @Test
    public void SerializeInteger() throws Exception
    {
        OSD llsdZeroInt = OSD.FromInteger(0);
        byte[] binaryZeroIntSerialized = BinaryLLSDOSDParser.SerializeLLSDBinary(llsdZeroInt);
        Assert.assertArrayEquals(binaryZeroInt, binaryZeroIntSerialized);

        binaryZeroIntSerialized = BinaryLLSDOSDParser.SerializeLLSDBinary(llsdZeroInt, false);
        Assert.assertArrayEquals(binaryZeroIntValue, binaryZeroIntSerialized);

        OSD llsdAnInt = OSD.FromInteger(1234843);
        byte[] binaryAnIntSerialized = BinaryLLSDOSDParser.SerializeLLSDBinary(llsdAnInt);
        Assert.assertArrayEquals(binaryAnInt, binaryAnIntSerialized);

        binaryAnIntSerialized = BinaryLLSDOSDParser.SerializeLLSDBinary(llsdAnInt, false);
        Assert.assertArrayEquals(binaryAnIntValue, binaryAnIntSerialized);
View Full Code Here

    private static byte[] binaryReal = (byte[])mergeArrays(binaryHead, binaryRealValue);

    @Test
    public void DeserializeReal() throws IOException, OSDException
    {
        OSD llsdReal = BinaryLLSDOSDParser.DeserializeLLSDBinary(binaryReal);
        Assert.assertEquals(OSDType.Real, llsdReal.getType());
        Assert.assertEquals(947835.234d, llsdReal.asReal(), 0);
    }
View Full Code Here

    }

    @Test
    public void SerializeReal() throws Exception
    {
        OSD llsdReal = OSD.FromReal(947835.234d);
        byte[] binaryRealSerialized = BinaryLLSDOSDParser.SerializeLLSDBinary(llsdReal);
        Assert.assertArrayEquals(binaryReal, binaryRealSerialized);

        binaryRealSerialized = BinaryLLSDOSDParser.SerializeLLSDBinary(llsdReal);
        Assert.assertArrayEquals(binaryReal, binaryRealSerialized);
View Full Code Here


    @Test
    public void DeserializeUUID() throws IOException, OSDException
    {
        OSD llsdAUUID = BinaryLLSDOSDParser.DeserializeLLSDBinary(binaryAUUID);
        Assert.assertEquals(OSDType.UUID, llsdAUUID.getType());
        Assert.assertEquals("97f4aeca-88a1-42a1-b385-b97b18abb255", llsdAUUID.asString());

        OSD llsdZeroUUID = BinaryLLSDOSDParser.DeserializeLLSDBinary(binaryZeroUUID);
        Assert.assertEquals(OSDType.UUID, llsdZeroUUID.getType());
        Assert.assertEquals("00000000-0000-0000-0000-000000000000", llsdZeroUUID.asString());

    }
View Full Code Here

    }

    @Test
    public void SerializeUUID() throws Exception
    {
        OSD llsdAUUID = OSD.FromUUID(new UUID("97f4aeca-88a1-42a1-b385-b97b18abb255"));
        byte[] binaryAUUIDSerialized = BinaryLLSDOSDParser.SerializeLLSDBinary(llsdAUUID);
        Assert.assertArrayEquals(binaryAUUID, binaryAUUIDSerialized);

        binaryAUUIDSerialized = BinaryLLSDOSDParser.SerializeLLSDBinary(llsdAUUID);
        Assert.assertArrayEquals(binaryAUUID, binaryAUUIDSerialized);

        OSD llsdZeroUUID = OSD.FromUUID(new UUID("00000000-0000-0000-0000-000000000000"));
        byte[] binaryZeroUUIDSerialized = BinaryLLSDOSDParser.SerializeLLSDBinary(llsdZeroUUID);
        Assert.assertArrayEquals(binaryZeroUUID, binaryZeroUUIDSerialized);

        binaryZeroUUIDSerialized = BinaryLLSDOSDParser.SerializeLLSDBinary(llsdZeroUUID);
        Assert.assertArrayEquals(binaryZeroUUID, binaryZeroUUIDSerialized);
View Full Code Here

    private static byte[] binaryBinString = (byte[])mergeArrays(binaryHead, binaryBinStringValue);

    @Test
    public void DeserializeLLSDBinary() throws IOException, OSDException
    {
        OSD llsdBytes = BinaryLLSDOSDParser.DeserializeLLSDBinary(binaryBinString);
        Assert.assertEquals(OSDType.Binary, llsdBytes.getType());
        byte[] contentBinString = { 0x74, 0x65, 0x73, 0x74, 0x69, 0x6e, 0x67, 0x20, 0x61, 0x20, 0x73,
                                    0x69, 0x6d, 0x70, 0x6c, 0x65, 0x20, 0x62, 0x69, 0x6e, 0x61, 0x72, 0x79, 0x20, 0x63, 0x6f,
                                    0x6e, 0x76, 0x65, 0x72, 0x73, 0x69, 0x6f, 0x6e, 0x20, 0x66, 0x6f, 0x72, 0x20, 0x74, 0x68,
                                    0x69, 0x73, 0x20, 0x73, 0x74, 0x72, 0x69, 0x6e, 0x67, 0xa, 0xd };
        Assert.assertArrayEquals(contentBinString, llsdBytes.asBinary());
    }
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.