BPM-Engine

 view release on metacpan or  search on metacpan

t/TestUtils.pm  view on Meta::CPAN

    @ENV{map { "BPMTEST_${_}" } qw/DSN USER PASS KEEP/};

if($dsn && $user && !$DEBUG) {
    $_attr = { RaiseError => 1, AutoCommit => 1 };
    }
else {
    $dsn = $DEBUG ?
        'dbi:SQLite:dbname=t/var/bpmengine.db' : 'dbi:SQLite::memory:';
    $user = '';
    $password = '';
    $_attr = { sqlite_unicode => 1 };    
    }

sub _local_db {
    my $db_file = './t/var/bpmengine.db';
    if(-f $db_file) {
        unlink $db_file or warn "Could not unlink $db_file: $!";
        }
    my (undef, $path) = File::Spec->splitpath(__FILE__);
    $path = Cwd::abs_path($path);
    my $scaffold_db = File::Spec->catfile($path, 'var', 'bpmengine.test.db');

t/TestUtils.pm  view on Meta::CPAN

    File::Copy::copy($scaffold_db, $db_file) or die "Copy failed: $!";
    }

sub schema {
    unless($_schema) {
        _local_db() if $DEBUG;
        eval "require BPM::Engine::Store" 
            or die "failed to require schema: $@";
        $_schema = BPM::Engine::Store->connect($dsn, $user, $password, $_attr) 
            or die "failed to connect to $dsn";
        $_schema->deploy({ add_drop_table => $_attr->{sqlite_unicode} ? 0 : 1 }) 
            unless $DEBUG;
        }
    
    return $_schema;
    }

sub process_wrap_xml {
    my ($xml, $pack, $v) = @_;

    $xml  ||= '';

t/etc/engine.yaml  view on Meta::CPAN

log_dispatch_conf: t/etc/logger_file.conf
connect_info:
    dsn: dbi:SQLite:dbname=t/var/bpmengine.db
    user: testuser
    password: TestPass
    AutoCommit: 1
    sqlite_unicode: 1
    #mysql_enable_utf8: 1
    #pg_enable_utf8: 1
    #on_connect_call: use_foreign_keys
    #on_connect_do:
    #  - PRAGMA synchronous = OFF



( run in 1.039 second using v1.01-cache-2.11-cpan-88abd93f124 )