protected void createRolesAndPermissions(DataSource ds) {
        Connection conn = null;
        Statement sql = null;
        try {
            conn = ds.getConnection();
            sql = conn.createStatement();
            sql.executeUpdate("create table user_roles (username varchar(20), role_name varchar(20))");
            sql.executeUpdate("insert into user_roles values ('" + username + "', '" + testRole + "')");
            sql.executeUpdate("create table roles_permissions (role_name varchar(20), permission varchar(40))");
            sql.executeUpdate(
                    "insert into roles_permissions values ('" + testRole + "', '" + testPermissionString + "')");
        } catch (SQLException ex) {
            fail("Exception adding test role and permission");
        } finally {
            JdbcUtils.closeStatement(sql);
            JdbcUtils.closeConnection(conn);
        }
    }
Creates and adds test data to user_role and roles_permissions tables.
core/src/test/java/org/apache/shiro/realm/jdbc/JDBCRealmTest.java