Changeset 24355 for trunk/Nebulous-Server
- Timestamp:
- Jun 8, 2009, 11:46:09 AM (17 years ago)
- Location:
- trunk/Nebulous-Server
- Files:
-
- 2 edited
-
lib/Nebulous/Server.pm (modified) (3 diffs)
-
t/02_server_setup.t (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/Nebulous-Server/lib/Nebulous/Server.pm
r24354 r24355 13 13 use base qw( Class::Accessor::Fast ); 14 14 15 use Cache::Memcached::Managed; 15 16 use DBI; 16 17 use Digest::SHA1 qw( sha1_hex ); … … 27 28 use Params::Validate qw( validate validate_pos SCALAR SCALARREF UNDEF BOOLEAN ); 28 29 use URI::file; 29 use Cache::Memcached::Managed;30 30 31 31 __PACKAGE__->mk_accessors(qw( log sql config cache )); … … 64 64 $self->config($config); 65 65 $self->cache(Cache::Memcached::Managed->new($config->memcached)); 66 $log->logdie("at least one database must be defined") unless $config->n_db; 67 66 68 # cause a db session to be started 67 69 $self->_db_for_index(0); -
trunk/Nebulous-Server/t/02_server_setup.t
r23932 r24355 17 17 Test::Nebulous->setup; 18 18 19 isa_ok(Nebulous::Server->new(), "Nebulous::Server");20 21 Test::Nebulous->setup;22 23 19 # ->new() 24 {25 my $neb = Nebulous::Server->new( trace => 'off' );26 27 ok($neb, "set log level");28 }29 30 Test::Nebulous->setup;31 20 32 21 { 33 22 my $neb = Nebulous::Server->new( 34 dsn => "DBI:mysql:database=foobar:host=localhost",35 dbuser => "baz",36 dbpasswd => "boo",23 dsn => $NEB_DB, 24 dbuser => $NEB_USER, 25 dbpasswd => $NEB_PASS, 37 26 ); 38 27 … … 42 31 Test::Nebulous->setup; 43 32 33 { 34 my $neb = Nebulous::Server->new( 35 dsn => $NEB_DB, 36 dbuser => $NEB_USER, 37 dbpasswd => $NEB_PASS, 38 trace => 'off', 39 ); 40 41 ok($neb, "set log level"); 42 } 43 44 Test::Nebulous->setup; 45 44 46 # add dbs after ->new() 45 47 { 46 my $ neb = Nebulous::Server->new;48 my $config = Nebulous::Server::Config->new; 47 49 48 ok($ neb->config->add_db(50 ok($config->add_db( 49 51 dbindex => 0, 50 dsn => "DBI:mysql:database=foobar:host=localhost",51 dbuser => "baz",52 dbpasswd => "boo",52 dsn => $NEB_DB, 53 dbuser => $NEB_USER, 54 dbpasswd => $NEB_PASS, 53 55 ), "add db"); 54 56 55 ok($ neb->config->add_db(57 ok($config->add_db( 56 58 dbindex => 1, 57 dsn => "DBI:mysql:database=foobar:host=localhost",58 dbuser => "baz",59 dbpasswd => "boo",59 dsn => $NEB_DB, 60 dbuser => $NEB_USER, 61 dbpasswd => $NEB_PASS, 60 62 ), "add dbs"); 61 63 62 is($neb->config->n_db, 2, "n dbs") 64 is($config->n_db, 2, "n dbs"); 65 66 my $neb = Nebulous::Server->new_from_config($config); 67 68 isa_ok($neb, 'Nebulous::Server'); 63 69 } 64 70
Note:
See TracChangeset
for help on using the changeset viewer.
