Package org.apache.xindice.core.meta.inline

Examples of org.apache.xindice.core.meta.inline.ResourceTypeReader


*/
public class ResourceTypeReaderTest extends TestCase {

    public void testResourceTypeReaderRead() throws Exception {

        ResourceTypeReader reader = new ResourceTypeReader();
       
        byte[] binaryData = new byte[] {
            0x03, 0x01, 0x02, 0x09, 0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01};
        byte[] evilData = new byte[] {
            0x03, 0x01, 0x03, 0x09, 0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01};
        byte[] xmlData = new byte[] {
            0x03, 0x01, 0x01, 0x09, 0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01};

        InlineMetaMap map;

        map = reader.read(binaryData, 2, 1);
        assertEquals(ResourceTypeReader.BINARY, map.get("type"));

        map = reader.read(xmlData, 2, 1);
        assertEquals(ResourceTypeReader.XML, map.get("type"));
       
        try {
            reader.read(evilData, 2, 1);
            fail("failed to throw InlineMetaException on bad type value (3)");
        } catch (InlineMetaException e) {
            // expected exception
        }
    }
View Full Code Here


*/
public class ResourceTypeReaderTest extends TestCase {

    public void testResourceTypeReaderRead() throws Exception {

        ResourceTypeReader reader = new ResourceTypeReader();
       
        byte[] binaryData = new byte[] {
            0x03, 0x01, 0x02, 0x09, 0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01};
        byte[] evilData = new byte[] {
            0x03, 0x01, 0x03, 0x09, 0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01};
        byte[] xmlData = new byte[] {
            0x03, 0x01, 0x01, 0x09, 0x08, 0x07, 0x06, 0x05, 0x04, 0x03, 0x02, 0x01};

        InlineMetaMap map;

        map = reader.read(binaryData, 2, 1);
        assertEquals(ResourceTypeReader.BINARY, map.get("type"));

        map = reader.read(xmlData, 2, 1);
        assertEquals(ResourceTypeReader.XML, map.get("type"));
       
        try {
            reader.read(evilData, 2, 1);
            fail("failed to throw InlineMetaException on bad type value (3)");
        } catch (InlineMetaException e) {
            // expected exception
        }
    }
View Full Code Here

TOP

Related Classes of org.apache.xindice.core.meta.inline.ResourceTypeReader

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.