Imported Upstream version 3.3.2
[debian/amanda] / installcheck / Amanda_Recovery_Scan.pl
index 3c475c5b104cab10cf3e49310d8861884f7ea155..354d0f9d3d824eeb477d13845c8d4a3dc8514c43 100644 (file)
@@ -1,4 +1,4 @@
-# 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
@@ -20,6 +20,7 @@ use Test::More tests => 95;
 use File::Path;
 use Data::Dumper;
 use strict;
+use warnings;
 
 use lib "@amperldir@";
 use Installcheck::Config;
@@ -40,11 +41,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;
@@ -57,7 +58,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");
 };
 
 # --------
@@ -210,7 +211,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);
@@ -377,7 +379,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);
@@ -436,15 +439,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'}->();
@@ -459,7 +464,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");