Package org.geoserver.monitor

Examples of org.geoserver.monitor.Query


        HibUtil.tearDownSession(((HibernateMonitorDAO2)dao).getSessionFactory(), null);
    }
   
    @Test
    public void testGetRequestsFilterIN3() throws Exception {
        List<RequestData> datas = dao.getRequests( new Query().filter(
                "widgets", "resources", Comparison.IN ));
        assertCovered(datas, 11, 14, 18);
    }
View Full Code Here


            public void visit(RequestData data, Object... aggregates) {
                datas.add(data);
                aggs.addAll(Arrays.asList(aggregates));
            }
        };
        dao.getRequests(new Query().properties("path").filter("path","/foo", Comparison.EQ).
                aggregate("count()").group("path"), v);
       
        assertEquals(1, datas.size());
        assertEquals("/foo", datas.get(0).getPath());
        assertEquals(4, ((Number)aggs.get(0)).intValue());
       
        datas.clear();
        aggs.clear();
       
        dao.getRequests(new Query().properties("service", "operation")
                .filter("service", null,  Comparison.NEQ).aggregate("count()")
                .group("service", "operation").sort("count()", SortOrder.DESC), v);
       
        RequestData r = datas.get(0);
        assertEquals("foo", r.getService());
View Full Code Here

        RequestDataVisitor v = new RequestDataVisitor() {
            public void visit(RequestData data, Object... aggregates) {
                aggs.addAll(Arrays.asList(aggregates));
            }
        };
        dao.getRequests(new Query().aggregate("count()").filter("path","/foo", Comparison.EQ), v);
       
        assertEquals(1, aggs.size());
        assertEquals(4, ((Number)aggs.get(0)).intValue());
    }
View Full Code Here

        assertEquals(4, ((Number)aggs.get(0)).intValue());
    }
   
    @Test
    public void testGetRequestsFilterAnd() throws Exception {
        assertEquals(1, dao.getRequests(new Query().filter("path", "/foo", Comparison.EQ)
            .filter("widgets", "resources", Comparison.IN)).size());
    }
View Full Code Here

            .filter("widgets", "resources", Comparison.IN)).size());
    }
   
    @Test
    public void testGetRequestsFilterOr() throws Exception {
        assertEquals(4, dao.getRequests(new Query().filter("path", "/seven", Comparison.EQ)
            .or("widgets", "resources", Comparison.IN)).size());
    }
View Full Code Here

            .or("widgets", "resources", Comparison.IN)).size());
    }
   
    @Test
    public void testGetRequestsJoin() throws Exception {
        List<RequestData> datas = dao.getRequests(new Query().properties("path", "resource")
            .filter("path","/foo", Comparison.EQ). group("path", "resource")
            .sort("resource", SortOrder.ASC));
       
        assertEquals(3, datas.size());
        assertEquals("stuff", datas.get(0).getResources().get(0));
View Full Code Here

            public void visit(RequestData data, Object... aggregates) {
                datas.add(data);
                //aggs.addAll(Arrays.asList(aggregates));
            }
        };
        dao.getRequests(new Query().properties("path", "resource").filter("path","/foo", Comparison.EQ).
                group("path", "resource").sort("resource", SortOrder.ASC), v);
       
        assertEquals(3, datas.size());
        assertEquals(1, datas.get(0).getResources().size());
        assertEquals("stuff", datas.get(0).getResources().get(0));
View Full Code Here

    @Test
    public void testGetRequestsJoin2() throws Exception {
        final List<RequestData> datas = new ArrayList();
        final List<Object> aggs = new ArrayList();
       
        dao.getRequests(new Query().properties("resource").aggregate("count()")
            .filter("resource", null, Comparison.NEQ).group("resource"), new RequestDataVisitor() {
            public void visit(RequestData data, Object... aggregates) {
                datas.add(data);
                aggs.add(aggregates[0]);
            }
View Full Code Here

    }
   
    @Test
    public void testGetRequestsJoinIN() throws Exception {
        List<String> resources = Arrays.asList("widgets", "things");
        List<RequestData> datas = dao.getRequests(new Query().properties("resource")
            .aggregate("count()").filter("resource", resources, Comparison.IN)
            .group("resource").sort("resource", SortOrder.ASC));
       
        assertEquals(2, datas.size());
        assertEquals("things", datas.get(0).getResources().get(0));
View Full Code Here

    public void testGetRequestsAdvancedFilter() throws Exception {
        Filter filter = new Filter("path", "/four", Comparison.EQ)
            .or(new Filter("service", "foo", Comparison.EQ).and(
                new Filter("resource", Arrays.asList("widgets"), Comparison.IN)));
       
        List<RequestData> datas = dao.getRequests(new Query().filter(filter));
        assertEquals(2, datas.size());
        assertCovered(datas, 4, 11);
    }
View Full Code Here

TOP

Related Classes of org.geoserver.monitor.Query

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.