|
From: <pau...@us...> - 2008-10-15 21:28:35
|
Revision: 1016
http://everydevel.svn.sourceforge.net/everydevel/?rev=1016&view=rev
Author: paul_the_nomad
Date: 2008-10-15 21:28:26 +0000 (Wed, 15 Oct 2008)
Log Message:
-----------
Merge branch 'master' of /home/paul/git/edev into HEAD
Conflicts:
ebase/lib/Everything/DB/Pg.pm
ebase/lib/Everything/DB/Test/Pg.pm
ebase/lib/Everything/DB/mysql.pm
ebase/t/DB/Live/Pg.t
ebase/t/DB/Live/mysql.t
Modified Paths:
--------------
trunk/ebase/Build.PL
trunk/ebase/lib/Everything/Auth/Test/EveryAuth.pm
trunk/ebase/lib/Everything/Build.pm
trunk/ebase/lib/Everything/DB/Pg.pm
trunk/ebase/lib/Everything/DB/Test/Pg.pm
trunk/ebase/lib/Everything/DB/mysql.pm
trunk/ebase/lib/Everything/HTTP/Apache.pm
trunk/ebase/lib/Everything/HTTP/Test/Apache.pm
trunk/ebase/lib/Everything/HTTP/Test/CGI.pm
trunk/ebase/lib/Everything/Storage/Nodeball.pm
trunk/ebase/lib/Everything/Test/DB.pm
trunk/ebase/lib/Everything/Test/Ecore/Compile.pm
trunk/ebase/lib/Everything/Test/Ecore/Install.pm
trunk/ebase/lib/Everything/Test/HTML.pm
trunk/ebase/lib/Everything/Test/NodeBase.pm
Added Paths:
-----------
trunk/ebase/t/ecore/Pg/
trunk/ebase/t/ecore/Pg/010-install.t
trunk/ebase/t/ecore/Pg/020-compile.t
trunk/ebase/t/ecore/Pg/090-drop-database.t
trunk/ebase/t/ecore/mysql/
trunk/ebase/t/ecore/mysql/010-install.t
trunk/ebase/t/ecore/mysql/020-compile.t
trunk/ebase/t/ecore/mysql/090-drop-database.t
trunk/ebase/t/ecore/sqlite/
trunk/ebase/t/ecore/sqlite/010-install.t
trunk/ebase/t/ecore/sqlite/020-compile.t
trunk/ebase/t/ecore/sqlite/090-drop-database.t
trunk/ebase/t/lib/DBTestUtil.pm
trunk/ebase/t/lib/db/Pg.conf.template
trunk/ebase/t/lib/db/mysql.conf.template
Modified: trunk/ebase/Build.PL
===================================================================
--- trunk/ebase/Build.PL 2008-10-15 20:15:59 UTC (rev 1015)
+++ trunk/ebase/Build.PL 2008-10-15 21:28:26 UTC (rev 1016)
@@ -36,7 +36,7 @@
'Mail::Sender' => 0,
'Scalar::Util' => 1.01,
'SUPER' => 1.16,
- 'Object::InsideOut' => 3.21,
+ 'Object::InsideOut' => 3.46,
'Archive::Tar' => 0,
'Class::Factory' => 0,
'SQL::Statement' => 1.15,
@@ -54,7 +54,7 @@
'File::Temp' => 0.18,
},
scripts => [ File::Spec->catfile( 'bin', 'nbmasta' ) ],
- test_files => join( ' ', @test_files ),
+ test_files => join( ' ', sort @test_files ),
);
my $httpconf = '';
Modified: trunk/ebase/lib/Everything/Auth/Test/EveryAuth.pm
===================================================================
--- trunk/ebase/lib/Everything/Auth/Test/EveryAuth.pm 2008-10-15 20:15:59 UTC (rev 1015)
+++ trunk/ebase/lib/Everything/Auth/Test/EveryAuth.pm 2008-10-15 21:28:26 UTC (rev 1016)
@@ -165,7 +165,7 @@
{ title => $name, passwd => $pw, lasttime => 'timestamp' };
my $crypted = crypt( $pw, $name );
$mock->set_series( 'getNode', undef, $expected_rv );
- $mock->set_true('getType');
+ $mock->set_true('getType', 'now');
$mock->set_always( 'sqlSelect', 'timestamp' );
my $confirmUser = \&{ $class . '::confirmUser' };
Modified: trunk/ebase/lib/Everything/Build.pm
===================================================================
--- trunk/ebase/lib/Everything/Build.pm 2008-10-15 20:15:59 UTC (rev 1015)
+++ trunk/ebase/lib/Everything/Build.pm 2008-10-15 21:28:26 UTC (rev 1016)
@@ -9,15 +9,6 @@
use vars '@ISA';
@ISA = 'Module::Build';
-sub ACTION_test
-{
- my $self = shift;
- my @files;
-
- find( sub { /\.t\z/ and push @files, $File::Find::name }, 't' );
- $self->SUPER::ACTION_test( 'test_files=' . join( ' ', @files ) );
-}
-
sub ACTION_install
{
my $self = shift;
Modified: trunk/ebase/lib/Everything/DB/Pg.pm
===================================================================
--- trunk/ebase/lib/Everything/DB/Pg.pm 2008-10-15 20:15:59 UTC (rev 1015)
+++ trunk/ebase/lib/Everything/DB/Pg.pm 2008-10-15 21:28:26 UTC (rev 1016)
@@ -137,9 +137,24 @@
}
sub databaseExists {
- my ( $self, $database ) = @_;
- my $c = $self->{dbh}->prepare("select count(1) from pg_catalog.pg_database where datname = ?");
+ my ( $self, $database, $user, $password, $host, $port ) = @_;
+
+ $host ||= 'localhost';
+ $port ||= 5432;
+
+ my $dbh;
+
+ if ( ! ref $self || ! $self->{dbh} ) {
+ $dbh = DBI->connect( "DBI:Pg:dbname=postgres;host=$host;port=$port", $user, $password );
+ } else {
+
+ $dbh = $self->getDatabaseHandle
+
+ }
+
+ my $c = $dbh->prepare("select count(1) from pg_catalog.pg_database where datname = ?");
+
$c->execute( $database );
my ( $rv ) = $c->fetchrow;
return $rv;
@@ -269,6 +284,8 @@
# Text blobs cannot have default strings. They need to be empty.
$default = "";
+ } elsif ( not defined $default ) {
+ $default = '';
}
$sql = "alter table \"$table\" add $fieldname $type";
Modified: trunk/ebase/lib/Everything/DB/Test/Pg.pm
===================================================================
--- trunk/ebase/lib/Everything/DB/Test/Pg.pm 2008-10-15 20:15:59 UTC (rev 1015)
+++ trunk/ebase/lib/Everything/DB/Test/Pg.pm 2008-10-15 21:28:26 UTC (rev 1016)
@@ -404,9 +404,9 @@
#### if the new field is a primary key but there is no current primary key
$fields = [
- { Field => 'foo', Key => '' },
- { Field => 'bar', Key => '' },
- { Field => 'baz', Key => '' }
+ { COLUMN_NAME => 'foo', Key => '' },
+ { COLUMN_NAME => 'bar', Key => '' },
+ { COLUMN_NAME => 'baz', Key => '' }
];
$self->{instance}->{dbh}->set_series( 'fetchrow_hashref', @$fields )->clear;
Modified: trunk/ebase/lib/Everything/DB/mysql.pm
===================================================================
--- trunk/ebase/lib/Everything/DB/mysql.pm 2008-10-15 20:15:59 UTC (rev 1015)
+++ trunk/ebase/lib/Everything/DB/mysql.pm 2008-10-15 21:28:26 UTC (rev 1016)
@@ -383,8 +383,19 @@
sub databaseExists
{
- my ( $this, $database ) = @_;
- my $sth = $this->{dbh}->prepare('show databases');
+ my ( $this, $database, $user, $password, $host, $port ) = @_;
+
+ my $dbh;
+
+ if ( ! ref $this || ! $this->{dbh} ) {
+ $dbh = DBI->connect( "DBI:mysql:database=mysql;host=$host;port=$port", $user, $password );
+ } else {
+
+ $dbh = $this->getDatabaseHandle
+
+ }
+
+ my $sth = $dbh->prepare('show databases');
$sth->execute();
while ( my ($dbname) = $sth->fetchrow() )
Modified: trunk/ebase/lib/Everything/HTTP/Apache.pm
===================================================================
--- trunk/ebase/lib/Everything/HTTP/Apache.pm 2008-10-15 20:15:59 UTC (rev 1015)
+++ trunk/ebase/lib/Everything/HTTP/Apache.pm 2008-10-15 21:28:26 UTC (rev 1016)
@@ -73,12 +73,6 @@
### XXX- response factory should set up the environment that htmlpage needs
my $response = Everything::HTTP::ResponseFactory->new( $e->get_response_type || 'htmlpage', { config => $config, request => $e } );
-
- ### new actually creates the response - so get rid of 'create http body'
- ### check response code
- ### check headers
- ### check content
- ### return status_code
my $html = $response->content();
Modified: trunk/ebase/lib/Everything/HTTP/Test/Apache.pm
===================================================================
--- trunk/ebase/lib/Everything/HTTP/Test/Apache.pm 2008-10-15 20:15:59 UTC (rev 1015)
+++ trunk/ebase/lib/Everything/HTTP/Test/Apache.pm 2008-10-15 21:28:26 UTC (rev 1016)
@@ -24,6 +24,7 @@
$mock->set_true(qw/content/)
->set_always( content_type => 'a mime type' )
->set_always( 'content', 'the html body' );
+ $mock->set_list('-headers', () );
$mock->set_always( status_code => 0 );
$self->{class} = $self->module_class;
Modified: trunk/ebase/lib/Everything/HTTP/Test/CGI.pm
===================================================================
--- trunk/ebase/lib/Everything/HTTP/Test/CGI.pm 2008-10-15 20:15:59 UTC (rev 1015)
+++ trunk/ebase/lib/Everything/HTTP/Test/CGI.pm 2008-10-15 21:28:26 UTC (rev 1016)
@@ -26,7 +26,7 @@
'setup_standard_system_vars', '-get_initializer',
'set_cgi_standard', 'set_node_from_cgi',
'setup_everything_html', 'authorise_user',
- 'execute_opcodes', 'print'
+ 'execute_opcodes', 'print', '-content_type'
);
$mock->set_series( 'isOfType', 0, 0, 1, 1, 0, 1, 1, 0 );
Modified: trunk/ebase/lib/Everything/Storage/Nodeball.pm
===================================================================
--- trunk/ebase/lib/Everything/Storage/Nodeball.pm 2008-10-15 20:15:59 UTC (rev 1015)
+++ trunk/ebase/lib/Everything/Storage/Nodeball.pm 2008-10-15 21:28:26 UTC (rev 1016)
@@ -1072,7 +1072,7 @@
#don't let this bite you in the ass
- return unless ( -e $dir and -d $dir and !( -l $dir ) );
+ return unless ( defined $dir and -e $dir and -d $dir and !( -l $dir ) );
use File::Path;
rmtree($dir);
}
Modified: trunk/ebase/lib/Everything/Test/DB.pm
===================================================================
--- trunk/ebase/lib/Everything/Test/DB.pm 2008-10-15 20:15:59 UTC (rev 1015)
+++ trunk/ebase/lib/Everything/Test/DB.pm 2008-10-15 21:28:26 UTC (rev 1016)
@@ -96,6 +96,7 @@
$self->{instance}->{dbh}->set_true('finish', 'do', '-begin_work', '-rollback', '-commit');
+ $self->{instance}->{dbh}->set_false(qw/-err/);
}
Modified: trunk/ebase/lib/Everything/Test/Ecore/Compile.pm
===================================================================
--- trunk/ebase/lib/Everything/Test/Ecore/Compile.pm 2008-10-15 20:15:59 UTC (rev 1015)
+++ trunk/ebase/lib/Everything/Test/Ecore/Compile.pm 2008-10-15 21:28:26 UTC (rev 1016)
@@ -3,6 +3,7 @@
use base 'Test::Class';
use Everything::HTML ();
+use Everything ();
use HTML::Lint;
use Test::More;
use Test::MockObject;
@@ -11,11 +12,45 @@
use strict;
use warnings;
+## error handling - until error handling is made more flexible
+
+my $err;
+no warnings 'redefine';
+*Everything::getFrontsideErrors =sub {
+
+ my @temp = @Everything::fsErrors;
+ $err = \@temp;
+ return \@Everything::fsErrors;
+};
+use warnings 'redefine';
+
+sub report_error {
+
+ diag join( "\n", map { join "\n", $_->{context}->get_title, $_->{context}->get_node_id, $_->{error} } @$err);
+
+}
+
+
+sub test_node_error {
+ my $node = shift;
+
+ my $error = join "\n", map { $_->{error} } @$err;
+ is( $error, '',
+"...execute node $$node{title}, type $$node{type}{title}, id, $$node{node_id}"
+ ) || report_error();
+
+}
+
+sub SKIP_CLASS {
+ my $self = shift;
+ my $class = ref $self ? ref $self : $self;
+ $class->SUPER( @_ );
+}
+
sub startup : Test( startup ) {
my $self = shift;
- my $nb = $self->{nodebase}
- || croak "Must have a nodebase object to continue, $!.";
+ my $nb = $self->{nodebase} || croak "No nodebase. Need a nodebase to run tests.";
my @nodes_under_test = ();
foreach (
@@ -33,7 +68,7 @@
$self->{mock} = $mock;
}
-
+
sub pretest_setup : Test(setup) {
my $self = shift;
@@ -130,11 +165,6 @@
my @nodes = @{ $self->{nodes_under_test} };
$self->num_tests( scalar @nodes );
- local *Everything::HTML::logErrors;
- local *Everything::logErrors;
- my $err = '';
- *Everything::HTML::logErrors = sub { $err .= "@_"; };
- *Everything::logErrors = sub { $err .= "@_"; };
my %successful_nodes;
foreach (@nodes) {
@@ -167,31 +197,16 @@
my @nodes_to_test = grep { $$compilable{ $_->{node_id} } } @$test_nodes;
$self->num_tests( scalar(@nodes_to_test) * 2 );
- local *Everything::HTML::logErrors;
- local *Everything::logErrors;
-
- my $err;
-
- my $error_code = sub {
- my ( $warn, $error, $text, $node ) = @_;
- $err .= join "\n", $warn, $error, $text, $$node{title};
- $err .= "\n" . '#' x 30;
- $err .= "\n\n";
- };
-
- *Everything::HTML::logErrors = $error_code;
- *Everything::logErrors = $error_code;
-
$mock->{node_id} = 123;
$mock->{to_node} = 456;
my @args;
foreach (@nodes_to_test) {
- $err = '';
my $node = $self->{nodebase}->getNode($_);
- diag "\nNow testing htmlcode named '$$node{title}'.\n\n";
+ $err = [];
+
my @args = ();
if ( $$node{title} eq 'formatCols' ) {
@@ -200,10 +215,9 @@
my $ehtml = Everything::HTML->new( { request => $mock } );
my $rv = $node->run( { args => \@args, ehtml => $ehtml } );
- ok( !$err,
-"...execute node $$node{title}, type $$node{type}{title}, id, $$node{node_id}"
- ) || diag $err;
+ test_node_error( $node );
+
my $linter = HTML::Lint->new;
$linter->only_types( 'HTML::Lint::Error::HELPER',
'HTML::Lint::Error::FLUFF' )
@@ -233,35 +247,20 @@
my @nodes_to_test = grep { $$compilable{ $_->{node_id} } } @$test_nodes;
$self->num_tests( scalar(@nodes_to_test) );
- local *Everything::HTML::logErrors;
- local *Everything::logErrors;
-
- my $err;
-
- my $error_code = sub {
- my ( $warn, $error, $text, $node ) = @_;
- $err .= join "\n", $warn, $error, $text, $$node{title};
- $err .= "\n" . '#' x 30;
- $err .= "\n\n";
- };
-
- *Everything::HTML::logErrors = $error_code;
- *Everything::logErrors = $error_code;
-
$mock->{group} = [];
foreach (@nodes_to_test) {
$err = '';
$Everything::HTML::GNODE = $mock;
my $node = $self->{nodebase}->getNode($_);
- diag "\nNow testing 'opcode' named '$$node{title}'.\n\n";
+
my @args = ();
# opcodes are only passed the request object as the only argument
my $rv = $node->run( { args => [$mock] } );
- ok( !$err,
-"...execute node $$node{title}, type $$node{type}{title}, id, $$node{node_id}"
- ) || diag $err;
+
+ test_node_error( $node );
+
}
}
@@ -351,42 +350,26 @@
my @nodes_to_test = grep { $$compilable{ $_->{node_id} } } @$test_nodes;
$self->num_tests( scalar(@nodes_to_test) * 10 );
- local *Everything::HTML::logErrors;
- local *Everything::logErrors;
-
- my $err;
-
- my $error_code = sub {
- my ( $warn, $error, $text, $node ) = @_;
- $err .= join "\n", $warn, $error, $text, $$node{title};
- $err .= "\n" . '#' x 30;
- $err .= "\n\n";
- };
-
- *Everything::HTML::logErrors = $error_code;
- *Everything::logErrors = $error_code;
-
my $setup_parser = setup_parser();
foreach (@nodes_to_test) {
- $err = '';
+
my $node = $self->{nodebase}->getNode($_);
- diag "\nNow testing $nodetype named '$$node{title}'.\n\n";
-
foreach my $parsetype (qw/TEXT PERL HTMLCODE HTMLSNIPPET ALL/) {
+ $err = [];
+
$setup_parser->( $parsetype, $node );
my @args = ();
my $ehtml = Everything::HTML->new( { request => $mock } );
my $rv = $node->run( { args => \@args, ehtml => $ehtml } );
- ok( !$err,
-"...execute node $$node{title}, type $$node{type}{title}, id, $$node{node_id}"
- ) || diag $err;
+ test_node_error( $node );
+
my $linter = HTML::Lint->new;
$filterlinter_cb->( $linter, $node ) if $filterlinter_cb;
$linter->parse($rv);
Modified: trunk/ebase/lib/Everything/Test/Ecore/Install.pm
===================================================================
--- trunk/ebase/lib/Everything/Test/Ecore/Install.pm 2008-10-15 20:15:59 UTC (rev 1015)
+++ trunk/ebase/lib/Everything/Test/Ecore/Install.pm 2008-10-15 21:28:26 UTC (rev 1016)
@@ -2,7 +2,11 @@
package Everything::Test::Ecore::Install;
use Everything::NodeBase;
+use Everything::Install;
use Everything::Storage::Nodeball;
+use Everything::DB::mysql;
+use Everything::DB::Pg;
+use Everything::DB::sqlite;
use Carp qw/confess cluck croak/;
use Test::More;
use base 'Test::Class';
@@ -10,6 +14,57 @@
use strict;
use warnings;
+sub SKIP_CLASS {
+ my $self = shift;
+ my $class = ref $self ? ref $self : $self;
+ $class->SUPER( @_ );
+}
+
+sub startup :Test(startup) {
+ my $self = shift;
+
+ my $config = $self->{ config };
+
+ my $ball = $self->{ nodeball };
+
+ my $opts = $self->{ opts } || {};
+
+ my $installer = Everything::Install->new;
+
+ $installer->set_nodeball( Everything::Storage::Nodeball->new( nodeball => $ball ) );
+
+ if ( $config ) {
+
+ $$opts{ type } = $config->database_type;
+ $$opts{ user } = $config->database_user;
+ $$opts{ database } = $config->database_name;
+ $$opts{ password } = $config->database_password;
+ $$opts{ db_rootuser } = $config->database_superuser;
+ $$opts{ db_rootpass } = $config->database_superpassword;
+
+ }
+
+
+ if ( "Everything::DB::$$opts{ type }"->databaseExists( map { defined $_ ? $_ : '' } @$opts{ qw/database db_rootuser db_rootpass host port/ } ) ) {
+ diag "Database $$opts{ database } exists will try to drop....";
+ if (! "Everything::DB::$$opts{ type }"->drop_database( map { defined $_ ? $_ : '' } @$opts{ qw/database db_rootuser db_rootpass host port/ } ) ) {
+ $self->BAILOUT( "... drop database failed, bailing.");
+ } else {
+ diag "...drop database succeeded. Continuing.";
+ }
+ }
+
+
+ $installer->create_storage( $opts );
+
+ my $nb = $installer->get_nodebase;
+
+ $self->{nb} = $nb;
+ $self->{db_type} = $$opts{ type };
+ $self->{installer} = $installer;
+
+}
+
sub test_10_sql_tables : Test(1) {
my $self = shift;
Modified: trunk/ebase/lib/Everything/Test/HTML.pm
===================================================================
--- trunk/ebase/lib/Everything/Test/HTML.pm 2008-10-15 20:15:59 UTC (rev 1015)
+++ trunk/ebase/lib/Everything/Test/HTML.pm 2008-10-15 21:28:26 UTC (rev 1016)
@@ -32,6 +32,8 @@
$mock->fake_module('Everything::Auth');
$mock->fake_module( 'Everything', logErrors => sub { push @le, [@_] } );
+ $mock->set_true( qw/get_user set_message/ );
+
$self->{mock} = $mock;
$self->{class} = $class;
use_ok($class) or die;
@@ -565,7 +567,7 @@
my $package = $self->{class};
my $mock = $self->mock_everything_request;
-
+ $mock->set_true('set_message');
$mock->{node_id} = 999; #prevents warning;
$mock->set_always( -isGod => 'randomdata' );
my $list_flag = 0;
Modified: trunk/ebase/lib/Everything/Test/NodeBase.pm
===================================================================
--- trunk/ebase/lib/Everything/Test/NodeBase.pm 2008-10-15 20:15:59 UTC (rev 1015)
+++ trunk/ebase/lib/Everything/Test/NodeBase.pm 2008-10-15 21:28:26 UTC (rev 1016)
@@ -8,6 +8,7 @@
use Test::More;
use Test::MockObject;
use Test::MockObject::Extends;
+use Test::Warn;
use Scalar::Util 'blessed';
@@ -124,7 +125,7 @@
'... reblessing into workspace package' );
}
-sub test_build_nodetype_modules :Test( 2 )
+sub test_build_nodetype_modules :Test( 3 )
{
my $self = shift;
my $nb = $self->{nb};
@@ -137,7 +138,9 @@
);
$storage->set_always( getFieldsHash => '' );
- my $result = $nb->buildNodetypeModules();
+ my $result;
+
+ warning_like { $result = $nb->buildNodetypeModules() } qr/no such nodetype/i;
is( keys %$result, 3, 'buildNodetypeModules() should return a hash ref' );
is_deeply(
$result,
Added: trunk/ebase/t/ecore/Pg/010-install.t
===================================================================
--- trunk/ebase/t/ecore/Pg/010-install.t (rev 0)
+++ trunk/ebase/t/ecore/Pg/010-install.t 2008-10-15 21:28:26 UTC (rev 1016)
@@ -0,0 +1,27 @@
+#!/usr/bin/perl
+
+use lib 't/lib';
+use DBTestUtil qw/config_file skip_cond/;
+use Everything::Test::Ecore::Install;
+use Everything::Config;
+use Everything::CmdLine qw/abs_path/;
+use strict;
+use warnings;
+
+my $ball = '../ecore';
+
+my $config_file = config_file();
+
+my @config_args;
+
+push @config_args, file => $config_file if -e $config_file;
+
+my $skip = skip_cond();
+
+Everything::Test::Ecore::Install->SKIP_CLASS( $skip ) if $skip;
+
+my $config = Everything::Config->new( @config_args );
+
+my $tests = Everything::Test::Ecore::Install->new( nodeball => abs_path( $ball ), config => $config );
+
+$tests->runtests;
Property changes on: trunk/ebase/t/ecore/Pg/010-install.t
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:eol-style
+ native
Added: trunk/ebase/t/ecore/Pg/020-compile.t
===================================================================
--- trunk/ebase/t/ecore/Pg/020-compile.t (rev 0)
+++ trunk/ebase/t/ecore/Pg/020-compile.t 2008-10-15 21:28:26 UTC (rev 1016)
@@ -0,0 +1,23 @@
+#!/usr/bin/perl
+
+use lib 't/lib';
+use Everything::Test::Ecore::Compile;
+use DBTestUtil qw/skip_cond nodebase/;
+use Test::More;
+use strict;
+use warnings;
+
+use Carp;
+
+my $skip = skip_cond();
+my $nodebase;
+
+if ( $skip ) {
+ Everything::Test::Ecore::Compile->SKIP_CLASS( $skip );
+} else {
+ $nodebase = nodebase();
+}
+
+my $tests = Everything::Test::Ecore::Compile->new( nodebase => $nodebase );
+
+$tests->runtests;
Property changes on: trunk/ebase/t/ecore/Pg/020-compile.t
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:eol-style
+ native
Added: trunk/ebase/t/ecore/Pg/090-drop-database.t
===================================================================
--- trunk/ebase/t/ecore/Pg/090-drop-database.t (rev 0)
+++ trunk/ebase/t/ecore/Pg/090-drop-database.t 2008-10-15 21:28:26 UTC (rev 1016)
@@ -0,0 +1,13 @@
+#!/usr/bin/perl
+
+use lib 't/lib';
+use DBTestUtil qw/drop_database skip_cond/;
+use Test::More;
+
+if ( my $skip = skip_cond() ) {
+ plan skip_all => $skip;
+} else {
+ plan tests => 1;
+}
+
+ok( drop_database(), '...drops the test database.' );
Property changes on: trunk/ebase/t/ecore/Pg/090-drop-database.t
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:eol-style
+ native
Added: trunk/ebase/t/ecore/mysql/010-install.t
===================================================================
--- trunk/ebase/t/ecore/mysql/010-install.t (rev 0)
+++ trunk/ebase/t/ecore/mysql/010-install.t 2008-10-15 21:28:26 UTC (rev 1016)
@@ -0,0 +1,27 @@
+#!/usr/bin/perl
+
+use lib 't/lib';
+use DBTestUtil qw/config_file skip_cond/;
+use Everything::Test::Ecore::Install;
+use Everything::Config;
+use Everything::CmdLine qw/abs_path/;
+use strict;
+use warnings;
+
+my $ball = '../ecore';
+
+my $config_file = config_file();
+
+my @config_args;
+
+push @config_args, file => $config_file if -e $config_file;
+
+my $skip = skip_cond();
+
+Everything::Test::Ecore::Install->SKIP_CLASS( $skip ) if $skip;
+
+my $config = Everything::Config->new( @config_args );
+
+my $tests = Everything::Test::Ecore::Install->new( nodeball => abs_path( $ball ), config => $config );
+
+$tests->runtests;
Property changes on: trunk/ebase/t/ecore/mysql/010-install.t
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:eol-style
+ native
Added: trunk/ebase/t/ecore/mysql/020-compile.t
===================================================================
--- trunk/ebase/t/ecore/mysql/020-compile.t (rev 0)
+++ trunk/ebase/t/ecore/mysql/020-compile.t 2008-10-15 21:28:26 UTC (rev 1016)
@@ -0,0 +1,23 @@
+#!/usr/bin/perl
+
+use lib 't/lib';
+use Everything::Test::Ecore::Compile;
+use DBTestUtil qw/skip_cond nodebase/;
+use Test::More;
+use strict;
+use warnings;
+
+use Carp;
+
+my $skip = skip_cond();
+my $nodebase;
+
+if ( $skip ) {
+ Everything::Test::Ecore::Compile->SKIP_CLASS( $skip );
+} else {
+ $nodebase = nodebase();
+}
+
+my $tests = Everything::Test::Ecore::Compile->new( nodebase => $nodebase );
+
+$tests->runtests;
Property changes on: trunk/ebase/t/ecore/mysql/020-compile.t
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:eol-style
+ native
Added: trunk/ebase/t/ecore/mysql/090-drop-database.t
===================================================================
--- trunk/ebase/t/ecore/mysql/090-drop-database.t (rev 0)
+++ trunk/ebase/t/ecore/mysql/090-drop-database.t 2008-10-15 21:28:26 UTC (rev 1016)
@@ -0,0 +1,13 @@
+#!/usr/bin/perl
+
+use lib 't/lib';
+use DBTestUtil qw/drop_database skip_cond/;
+use Test::More;
+
+if ( my $skip = skip_cond() ) {
+ plan skip_all => $skip;
+} else {
+ plan tests => 1;
+}
+
+ok( drop_database(), '...drops the test database.' );
Property changes on: trunk/ebase/t/ecore/mysql/090-drop-database.t
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:eol-style
+ native
Added: trunk/ebase/t/ecore/sqlite/010-install.t
===================================================================
--- trunk/ebase/t/ecore/sqlite/010-install.t (rev 0)
+++ trunk/ebase/t/ecore/sqlite/010-install.t 2008-10-15 21:28:26 UTC (rev 1016)
@@ -0,0 +1,27 @@
+#!/usr/bin/perl
+
+use lib 't/lib';
+use DBTestUtil qw/config_file skip_cond/;
+use Everything::Test::Ecore::Install;
+use Everything::Config;
+use Everything::CmdLine qw/abs_path/;
+use strict;
+use warnings;
+
+my $ball = '../ecore';
+
+my $config_file = config_file();
+
+my @config_args;
+
+push @config_args, file => $config_file if -e $config_file;
+
+my $skip = skip_cond();
+
+Everything::Test::Ecore::Install->SKIP_CLASS( $skip ) if $skip;
+
+my $config = Everything::Config->new( @config_args );
+
+my $tests = Everything::Test::Ecore::Install->new( nodeball => abs_path( $ball ), config => $config );
+
+$tests->runtests;
Property changes on: trunk/ebase/t/ecore/sqlite/010-install.t
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:eol-style
+ native
Added: trunk/ebase/t/ecore/sqlite/020-compile.t
===================================================================
--- trunk/ebase/t/ecore/sqlite/020-compile.t (rev 0)
+++ trunk/ebase/t/ecore/sqlite/020-compile.t 2008-10-15 21:28:26 UTC (rev 1016)
@@ -0,0 +1,23 @@
+#!/usr/bin/perl
+
+use lib 't/lib';
+use Everything::Test::Ecore::Compile;
+use DBTestUtil qw/skip_cond nodebase/;
+use Test::More;
+use strict;
+use warnings;
+
+use Carp;
+
+my $skip = skip_cond();
+my $nodebase;
+
+if ( $skip ) {
+ Everything::Test::Ecore::Compile->SKIP_CLASS( $skip );
+} else {
+ $nodebase = nodebase();
+}
+
+my $tests = Everything::Test::Ecore::Compile->new( nodebase => $nodebase );
+
+$tests->runtests;
Property changes on: trunk/ebase/t/ecore/sqlite/020-compile.t
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:eol-style
+ native
Added: trunk/ebase/t/ecore/sqlite/090-drop-database.t
===================================================================
--- trunk/ebase/t/ecore/sqlite/090-drop-database.t (rev 0)
+++ trunk/ebase/t/ecore/sqlite/090-drop-database.t 2008-10-15 21:28:26 UTC (rev 1016)
@@ -0,0 +1,13 @@
+#!/usr/bin/perl
+
+use lib 't/lib';
+use DBTestUtil qw/drop_database skip_cond/;
+use Test::More;
+
+if ( my $skip = skip_cond() ) {
+ plan skip_all => $skip;
+} else {
+ plan tests => 1;
+}
+
+ok( drop_database(), '...drops the test database.' );
Property changes on: trunk/ebase/t/ecore/sqlite/090-drop-database.t
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:eol-style
+ native
Added: trunk/ebase/t/lib/DBTestUtil.pm
===================================================================
--- trunk/ebase/t/lib/DBTestUtil.pm (rev 0)
+++ trunk/ebase/t/lib/DBTestUtil.pm 2008-10-15 21:28:26 UTC (rev 1016)
@@ -0,0 +1,72 @@
+package DBTestUtil;
+
+use base 'Exporter';
+use Everything::Config;
+
+our @EXPORT_OK = qw/config_file drop_database skip_cond nodebase/;
+
+
+sub config_file {
+
+ my $db_type = db_type();
+ return "t/lib/db/$db_type.conf";
+
+}
+
+sub db_type {
+
+ $0 =~ m|t/ecore/(.*?)/\d{3}\-[\w-]+\.t$|;
+ return $1;
+
+}
+
+sub drop_database {
+
+ my $config_file = config_file();
+ my $config = Everything::Config->new( file => $config_file );
+
+ my $storage_class = 'Everything::DB::' . $config->database_type;
+
+ ( my $file = $storage_class ) =~ s/::/\//g;
+ $file .= '.pm';
+ require $file;
+
+ $storage_class->drop_database (
+ $config->database_name,
+ $config->database_superuser,
+ $config->database_superpassword
+ );
+
+
+}
+
+sub skip_cond {
+ my ( $class ) = @_;
+
+ my $run_tests = 't/lib/db/run-tests';
+
+ my $config_file = config_file();
+
+ my $msg = '';
+
+
+ if ( ! -e $run_tests ) {
+
+ return "Time consuming DB tests skipped by default. Touch '$run_tests' to run.";
+
+ } elsif ( ! -e $config_file ) {
+
+ return "The config file '$config_file' must exist to run these tests.";
+ }
+
+ return;
+
+}
+
+sub nodebase {
+
+ my $config = Everything::Config->new( file => config_file() );
+ return $config->nodebase;
+
+
+}
Property changes on: trunk/ebase/t/lib/DBTestUtil.pm
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:eol-style
+ native
Added: trunk/ebase/t/lib/db/Pg.conf.template
===================================================================
--- trunk/ebase/t/lib/db/Pg.conf.template (rev 0)
+++ trunk/ebase/t/lib/db/Pg.conf.template 2008-10-15 21:28:26 UTC (rev 1016)
@@ -0,0 +1,21 @@
+## To run postgres tests copy this to t/lib/db/Pg.conf and
+## edit the following fields as required for your setup
+
+# The database superuser should have create role, grant privileges and
+# create database privileges
+database_superuser =
+database_superpassword =
+
+## The name of the database we create to run the tests, you can change
+## it if you need to
+database_name = ecoretest
+
+## The name of the user that will be created by these tests
+database_user = ecoretester
+database_password = ecoretester
+
+## You shouldn't need to change this
+database_type = Pg
+
+
+
Property changes on: trunk/ebase/t/lib/db/Pg.conf.template
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:eol-style
+ native
Added: trunk/ebase/t/lib/db/mysql.conf.template
===================================================================
--- trunk/ebase/t/lib/db/mysql.conf.template (rev 0)
+++ trunk/ebase/t/lib/db/mysql.conf.template 2008-10-15 21:28:26 UTC (rev 1016)
@@ -0,0 +1,19 @@
+## Copy this file to t/lib/db/mysql.conf and edit it as require
+## to run mysql database tetss
+
+# The database superuser should have privileges to create databases,
+# users and grant privileges
+database_superuser =
+database_superpassword =
+
+## The name of the database and user that will be created, change it
+## if it doesn't work with your setup
+database_name = ecoretest
+
+## The database user and password, change it if it doesn't work for your setup
+database_user = ecoretester
+database_password = ecoretester
+
+## You probably won't need to amend this
+database_type = mysql
+
Property changes on: trunk/ebase/t/lib/db/mysql.conf.template
___________________________________________________________________
Added: svn:mime-type
+ text/plain
Added: svn:eol-style
+ native
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|