Merge tag 'upstream/3.3.3'
[debian/amanda] / installcheck / Amanda_Recovery_Scan.pl
index 40cf557332bb67a998a286cbf51d5b9033724760..65066420e170d520f0f4b780c0091c211aa4e912 100644 (file)
@@ -1,8 +1,9 @@
-# Copyright (c) 2010 Zmanda, Inc.  All Rights Reserved.
+# Copyright (c) 2010-2012 Zmanda, Inc.  All Rights Reserved.
 #
-# This program is free software; you can redistribute it and/or modify it
-# under the terms of the GNU General Public License version 2 as published
-# by the Free Software Foundation.
+# This program is free software; you can redistribute it and/or
+# modify it under the terms of the GNU General Public License
+# as published by the Free Software Foundation; either version 2
+# of the License, or (at your option) any later version.
 #
 # This program is distributed in the hope that it will be useful, but
 # WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY
@@ -41,11 +42,11 @@ Installcheck::log_test_output();
 Amanda::Debug::disable_die_override();
 
 # --------
-# Interactive package
+# Interactivity package
 
-package Amanda::Interactive::Installcheck;
+package Amanda::Interactivity::Installcheck;
 use vars qw( @ISA );
-@ISA = qw( Amanda::Interactive );
+@ISA = qw( Amanda::Interactivity );
 
 sub new {
     my $class = shift;
@@ -58,7 +59,7 @@ sub user_request {
     my %params = @_;
 
     Amanda::Debug::debug("Change changer to multi-changer");
-    $params{'finished_cb'}->(undef, "multi-changer");
+    $params{'request_cb'}->(undef, "multi-changer");
 };
 
 # --------
@@ -211,7 +212,8 @@ sub test_searching {
     my $res03;
 
     my $steps = define_steps
-       cb_ref => \$finished_cb;
+       cb_ref => \$finished_cb,
+       finalize => sub { $scan->quit() };
 
     step start => sub {
        $scan = Amanda::Recovery::Scan->new(chg => $chg);
@@ -378,7 +380,8 @@ sub test_scan_poll {
     my $res04;
 
     my $steps = define_steps
-       cb_ref => \$finished_cb;
+       cb_ref => \$finished_cb,
+       finalize => sub { $scan->quit() };
 
     step start => sub {
        $chg = Amanda::Changer->new($chg_name);
@@ -437,15 +440,17 @@ sub test_scan_ask_poll {
     my $chg_name = "multi-changer";
     my $chg = Amanda::Changer->new($chg_name);
     amlabel_sync($chg, $chg_name, 2, 'TESTCONF05');
+    $chg->quit();
     $chg = Amanda::Changer->new("disk-changer");
 
     my $steps = define_steps
-       cb_ref => \$finished_cb;
+       cb_ref => \$finished_cb,
+       finalize => sub { $scan->quit() };
 
     step start => sub {
-       my $interactive = Amanda::Interactive::Installcheck->new();
+       my $interactivity = Amanda::Interactivity::Installcheck->new();
        $scan = Amanda::Recovery::Scan->new(chg =>         $chg,
-                                           interactive => $interactive);
+                                           interactivity => $interactivity);
        $scan->{'scan_conf'}->{'poll_delay'} = 10; # 10 ms
 
        $steps->{'find_05'}->();
@@ -460,7 +465,7 @@ sub test_scan_ask_poll {
        (my $err, $res05) = @_;
 
        ok(!$err, "found TESTCONF05 on changer multi");
-       ok($res05, "TESTCONF05 give a reservation after interactive");
+       ok($res05, "TESTCONF05 give a reservation after interactivity");
        is($res05->{'chg'}->{'chg_name'}, $chg_name,
           "found TESTCONF05 on correct changer: $chg_name");