Package com.javaeye.jert.domain

Examples of com.javaeye.jert.domain.Database


        assertEquals("user3@javaeye.com", user3[1]);
    }
   
   
    private ReportDefinition getReportDefinition() {
        Database db = getDatabase();

        ReportDefinition rd = new ReportDefinition();
        rd.setDatabase(db);
        rd.setSql("select * from user order by user_name");
        rd.setQueryType(QueryBuilder.QUERY_TYPE_STATIC);
View Full Code Here


        rd.setQueryType(QueryBuilder.QUERY_TYPE_STATIC);
        return rd;
    }   
   
    public void testGenerateSimpleParameterQueryReport() {
        Database db = getDatabase();
        ReportDefinition rd = new ReportDefinition();
        rd.setDatabase(db);
        rd.setSql("select * from user where user_name = #name#");
        rd.setQueryType(QueryBuilder.QUERY_TYPE_SIMPLE_PARAMETER);
        rd.setupDefaultParameterDefinition();
View Full Code Here

        assertEquals("user1", user1[0]);
        assertEquals("user1@javaeye.com", user1[1]);       
    }
   
    public void testGenerateDynamicParameterQueryReport() {
        Database db = getDatabase();
        ReportDefinition rd = new ReportDefinition();
        rd.setDatabase(db);
        rd.setSql("<plain>select * from user where 1 = 1</plain>"
                + "<dynamic type=\"isNotEmpty\" append-before=\"and user_name = \" parameter-name=\"name\"/>"
                + "<dynamic type=\"isNotEmpty\" append-before=\"and email = \" parameter-name=\"email\"/>");
View Full Code Here

        instance.generateItems(parameters);
        assertEquals(0, instance.getTotalCount());       
    }
   
    private Database getDatabase() {
        Database db = new Database();
        db.setDriver("org.hsqldb.jdbcDriver");
        db.setUrl("jdbc:hsqldb:mem:reportdefinition_test");
        db.setUsername("sa");
        db.setPassword("");

        db.setConnectionManager(new DBCPConnectionManager());
        return db;
    }
View Full Code Here

    private void loadSamples() {
        if (databaseSamples != null) return;
        int count = Integer.parseInt(getText("databaseSamplesCount"));
        databaseSamples = new ArrayList(count);
        for (int i = 0; i < count; i++) {
            Database db = new Database();
            db.setName(getText("databaseSample." + i + ".name"));
            db.setDriver(getText("databaseSample." + i + ".driver"));
            db.setUrl(getText("databaseSample." + i + ".url"));
            databaseSamples.add(db);
        }
    }
View Full Code Here

       
        service.removeReportPermissionFromGroup(reportDefinition, group);
    }
   
    private ReportDefinition getReportDefintion() {
        Database db = new Database();
        ((DatabaseService) context.getBean("databaseService")).createDatabase(db);

        ReportDefinition rd = new ReportDefinition();
        rd.setDatabase(db);
        rd.setName("test");
View Full Code Here

        super.setUp();
        ddcService= (DrillDownColumnService) context.getBean("drillDownColumnService");
    }
   
    public void testCRUDDrillDownColumn() throws Exception{
        Database db = new Database();
        ((DatabaseService) context.getBean("databaseService")).createDatabase(db);
        ReportDefinition rd = new ReportDefinition();
        rd.setDatabase(db);
        rd.setName("test report one");
        rd.setSql("select * from user");
View Full Code Here

    protected ApplicationContext getContext() {
        return new ClassPathXmlApplicationContext("com/javaeye/jert/service/test/DatabaseServiceTest.xml");
    }
   
    public void testCRUD() {
        Database db = new Database();
        db.setName("unit_test_database");
        db.setDriver("org.hsqldb.jdbcDriver");
        db.setUrl("jdbc:hsqldb:mem:jert_unit_test");
        db.setUsername("sa");
        db.setPassword("");
       
        service.createDatabase(db);
       
        Database stored = service.getDatabase(db.getId());
        assertEquals("unit_test_database", stored.getName());
        assertEquals("org.hsqldb.jdbcDriver", stored.getDriver());
        assertEquals("jdbc:hsqldb:mem:jert_unit_test", stored.getUrl());
        assertEquals("sa", stored.getUsername());
        assertEquals("", stored.getPassword());
       
        stored.setPassword("changed");
        service.updateDatabase(stored);
       
        stored = service.getDatabase(db.getId());
        assertEquals("changed", stored.getPassword());
       
        service.deleteDatabase(stored);
       
        assertNull(service.getDatabase(stored.getId()));
    }
View Full Code Here

       
        assertNull(service.getDatabase(stored.getId()));
    }
   
    public void testSameNameCheck() {
        Database db = new Database();
        db.setName("samename_test");
        service.createDatabase(db);
       
        Database samename = new Database();
        samename.setName("samename_test");
        try{
            service.createDatabase(samename);
            fail("Did not throw exception");
        }catch(GenericServiceException e){
            assertEquals("error.same.name.db.exists", e.getMessage());           
        }
       
        samename.setName("samename_test_update");
        service.createDatabase(samename);
       
        samename.setName("samename_test");
        try{
            service.updateDatabase(samename);
            fail("Did not throw exception");
        }catch(GenericServiceException e){
            assertEquals("error.same.name.db.exists", e.getMessage());           
View Full Code Here

        super.setUp();
        service = (ReportDefinitionService) context.getBean("reportDefinitionService");
    }

    public void testCRUD() {
        Database db = new Database();
        ((DatabaseService) context.getBean("databaseService")).createDatabase(db);

        ReportDefinition rd = new ReportDefinition();
        rd.setDatabase(db);
        rd.setName("test report one");
View Full Code Here

TOP

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

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.