Package cc.plural.jsonij

Examples of cc.plural.jsonij.JSON


    }

    @Test
    public void testExpression1() throws IOException, ParserException {
        System.out.println("Test Expression1 - Single Expression Query String");
        JSON json = JSON.parse(JSONTestExamples.RESUME_SAMPLE);

        JPathParser jPathParser = new JPathParser();
        JPath<?> path1 = jPathParser.parse("/resume/misc\\/other[0]");
        path1.setRecordEvaluateTime(true);
        Value value1 = path1.evaluate(json);
View Full Code Here


    @Test
    public void testExpression2() throws IOException, ParserException {
        System.out.println("Test Expression2 - Multiple and Expression Query");

        JSON json = JSON.parse(JSONTestExamples.RESUME_SAMPLE);

        JPathParser jPathParser = new JPathParser();

        JPath<?> path1 = jPathParser.parse("/resume/employment[?(@.city=\"Newcastle\" && @.start date={\"day\":1,\"month\":8,\"year\":2003})]/employer");
        path1.setRecordEvaluateTime(true);
View Full Code Here

    public void testExpression3() throws IOException, ParserException {
        System.out.println("Test Expression3 - Memory Test Overflow");
        String startDate1 = "2010-01-01";
        String endDate1 = "2011-01-01";
        String startDate2 = "2010-01-01";
        JSON json = JSON.parse(JSONTestExamples.METER_SAMPLE);
        assertEquals(startDate1, JPath.parse("/enrollments[?(@.key=\"Carbon\")]/start").evaluate(json).getString());
        assertEquals(endDate1, JPath.parse("/enrollments[?(@.key=\"Carbon\")]/end").evaluate(json).getString());
        try {
            JPath.parse("/enrollments[?(@.key=\"Carbon\"]/channels[?(@.channelid=\"CH-0\"]/start").evaluate(json).getString();
        }
View Full Code Here

    public void testExpression4() throws IOException, ParserException {
        System.out.println("Test Expression4 - Working Query");
        String startDate1 = "2010-01-01";
        String endDate1 = "2011-01-01";
        String startDate2 = "2010-01-01";
        JSON json = JSON.parse(JSONTestExamples.METER_SAMPLE);
        assertEquals(startDate1, JPath.parse("/enrollments[?(@.key=\"Carbon\")]/start").evaluate(json).getString());
        assertEquals(endDate1, JPath.parse("/enrollments[?(@.key=\"Carbon\")]/end").evaluate(json).getString());
        assertEquals(startDate2, JPath.parse("/enrollments[?(@.key=\"Carbon\")]/channels[?(@.channelid=\"CH-0\")]/start").evaluate(json).getString());
    }
View Full Code Here

    }

    @Test
    public void testExpression5() throws IOException, ParserException {
        System.out.println("Test Expression5 - Working Query");
        JSON json = JSON.parse(JSONTestExamples.MC_EXAMPLE);
        Value settingsValue = JPath.parse("/settings").evaluate(json);
        System.out.println("Settings:" + settingsValue);
        assertEquals("java", JPath.parse("/settings/java exe").evaluate(json).getString());
    }
View Full Code Here

    }

    @Test
    public void testExpression6() throws IOException, ParserException {
        System.out.println("Test testExpression6 - Union Query");
        JSON json = JSON.parse(JSONTestExamples.STORE_SAMPLE);
        Value[] values = JPath.parse("/store/book[2,3,0,-1]").evaluateAll(json);
        System.out.println("ResultSize:" + values.length);
        for (int i = 0; i < values.length; i++) {
            System.out.println("[" + i + "]" + values[i].toJSON());
        }
View Full Code Here

    }

    @Test
    public void testExpression7() throws Exception {
        System.out.println("testExpression7");
        JSON json = JSON.parse(JSONTestExamples.STORE_SAMPLE);
        Value[] values = JPath.parse("/store/bicycle[?(regex(@.color,\"^re.*$\"))]").evaluateAll(json);
        System.out.println("ResultSize:" + values.length);
        for (int i = 0; i < values.length; i++) {
            System.out.println("[" + i + "]" + values[i].toJSON());
        }
View Full Code Here

    }

    @Test
    public void testExpression8() throws Exception {
        System.out.println("testExpression8");
        JSON json = JSON.parse(JSONTestExamples.STORE_SAMPLE);
        Value[] values = JPath.parse("/store/book[?(regex(@.title,\"^.*Lord.*$\"))]").evaluateAll(json);
        System.out.println("ResultSize:" + values.length);
        for (int i = 0; i < values.length; i++) {
            System.out.println("[" + i + "]" + values[i].toJSON());
        }
View Full Code Here

    }

    @Test
    public void testExpression9() throws Exception {
        System.out.println("testExpression9");
        JSON json = JSON.parse(JSONTestExamples.STORE_SAMPLE);
        Value[] values = JPath.parse("/store/book[?(regex(@.title,\"^.*of.*$\"))]").evaluateAll(json);
        System.out.println("ResultSize:" + values.length);
        for (int i = 0; i < values.length; i++) {
            System.out.println("[" + i + "]" + values[i].toJSON());
        }
View Full Code Here

    }

    @Test
    public void testExpression10() throws Exception {
        System.out.println("testExpression10");
        JSON json = JSON.parse(JSONTestExamples.STORE_SAMPLE);
        Value[] values = JPath.parse("/store/bicycle[?(regex(@.color,\"^blue.*$\"))]").evaluateAll(json);
        System.out.println("ResultSize:" + values.length);
        for (int i = 0; i < values.length; i++) {
            System.out.println("[" + i + "]" + values[i].toJSON());
        }
View Full Code Here

TOP

Related Classes of cc.plural.jsonij.JSON

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.