Package com.javaeye.jert.domain

Examples of com.javaeye.jert.domain.ReportInstance


    private static final String CREATE_TABLE = "DROP TABLE USER IF EXISTS; CREATE TABLE USER (USER_NAME varchar(255), EMAIL varchar(255));";
   
    public void testGenerateStaticQueryReport() {
        ReportDefinition rd = getReportDefinition();

        ReportInstance instance = new ReportInstance(2);
        instance.setReportDefinition(rd);
        instance.generateItems(null);
        ResultSetOutput output = instance.getResultSetOutput();
        assertEquals(5, instance.getTotalCount());
        assertEquals(2, output.getColumns().size());
       
        assertEquals("USER_NAME", output.getHeaderNames()[0]);
        assertEquals("EMAIL", output.getHeaderNames()[1]);
       
View Full Code Here


    }

    public void testGenerateReportStartIndex() {
        ReportDefinition rd = getReportDefinition();
       
        ReportInstance instance = new ReportInstance(2);
        instance.setReportDefinition(rd);
        instance.setStartIndex(2);
        instance.generateItems(null);
       
        ResultSetOutput output = instance.getResultSetOutput();
        assertEquals(5, instance.getTotalCount());
        assertEquals(2, output.getColumns().size());
        Object[] user3 = (Object[]) output.getColumns().get(0);
        assertEquals("user3", user3[0]);
        assertEquals("user3@javaeye.com", user3[1]);
    }
View Full Code Here

        rd.setDatabase(db);
        rd.setSql("select * from user where user_name = #name#");
        rd.setQueryType(QueryBuilder.QUERY_TYPE_SIMPLE_PARAMETER);
        rd.setupDefaultParameterDefinition();
       
        ReportInstance instance = new ReportInstance();
        instance.setReportDefinition(rd);
        QueryParameter[] parameters = rd.getDefaultQueryParameters();
        parameters[0].setValue("user1");
       
        instance.generateItems(parameters);
        assertEquals(1, instance.getTotalCount());
       
        ResultSetOutput output = instance.getResultSetOutput();
        Object[] user1 = (Object[]) output.getColumns().get(0);
        assertEquals("user1", user1[0]);
        assertEquals("user1@javaeye.com", user1[1]);       
    }
View Full Code Here

                + "<dynamic type=\"isNotEmpty\" append-before=\"and user_name = \" parameter-name=\"name\"/>"
                + "<dynamic type=\"isNotEmpty\" append-before=\"and email = \" parameter-name=\"email\"/>");
        rd.setQueryType(QueryBuilder.QUERY_TYPE_DYNAMIC_PARAMETER);
        rd.setupDefaultParameterDefinition();

        ReportInstance instance = new ReportInstance();
        instance.setReportDefinition(rd);
        QueryParameter[] parameters = rd.getDefaultQueryParameters();
        instance.generateItems(parameters);
        assertEquals(5, instance.getTotalCount());

        parameters = rd.getDefaultQueryParameters();
        parameters[0].setValue("user1");
        instance.generateItems(parameters);
        assertEquals(1, instance.getTotalCount());
       
        parameters = rd.getDefaultQueryParameters();
        parameters[0].setValue("user1");
        parameters[1].setValue("user2@javaeye.com");
        instance.generateItems(parameters);
        assertEquals(0, instance.getTotalCount());       
    }
View Full Code Here

TOP

Related Classes of com.javaeye.jert.domain.ReportInstance

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.