r206@brr: dpavlin | 2007-11-12 23:02:21 +0100
[perl-cwmp.git] / t / 30-server.t
index b82d1e2..4b7747c 100755 (executable)
@@ -25,13 +25,18 @@ eval {
 ok(my $abs_path = abs_path($0), "abs_path");
 $abs_path =~ s!/[^/]*$!/!;     #!fix-vim
 
-my $store_path = "$abs_path/var/state.db";
-unlink $store_path if -e $store_path;
+my $store_path = "$abs_path/var/";
+#my $store_module = 'DBMDeep';
+my $store_module = 'YAML';
 
 ok( my $server = CWMP::Server->new({
        debug => $debug,
        port => $port,
-       store_path => $store_path,
+       store => {
+               module => $store_module,
+               path => $store_path,
+               clean => 1,
+       },
 }), 'new' );
 isa_ok( $server, 'CWMP::Server' );
 
@@ -152,7 +157,7 @@ ok( $s->write_chunk_eof, 'write_chunk_eof' );
 
 sleep 1;
 
-ok( my $store = CWMP::Store->new({ path => $store_path, debug => $debug }), 'another store' );
+ok( my $store = CWMP::Store->new({ module => $store_module, path => $store_path, debug => $debug }), 'another store' );
 
 my $state = {
   CurrentTime    => "1970-01-01T00:04:33Z",
@@ -165,7 +170,7 @@ my $state = {
   EventStruct    => ["0 BOOTSTRAP", "1 BOOT", "4 VALUE CHANGE"],
   ID             => "1_THOM_TR69_ID",
   MaxEnvelopes   => 2,
-  NoMoreRequests => undef,
+#  NoMoreRequests => undef,
   Parameter      => {
                       "\nInternetGatewayDevice.DeviceInfo.SpecVersion"                  => "1.1",
                       ".ExternalIPAddress"                                              => "192.168.1.254",
@@ -184,7 +189,9 @@ my $state = {
   _dispatch      => "InformResponse",
 };
 
-is_deeply( $store->state( ID => '1_THOM_TR69_ID' ), $state, 'new store->state' );
+is_deeply( $store->current_store->get_state( 'CP0644JTHJ4' ), $state, 'store->current_store->get_state' );
+
+diag "shutdown server";
 
 ok( kill(9,$pid), 'kill ' . $pid );