10 use MogileFS::Util qw(error_code);
15 $obj = MogileFS::ReplicationPolicy->new_from_policy_string("MultipleHosts(5)");
16 isa_ok($obj, "MogileFS::ReplicationPolicy::MultipleHosts", "got a multiple hosts policy")
17 or die "can't proceed";
18 is($obj->mindevcount, 5, "got correct devcount");
20 $obj = MogileFS::ReplicationPolicy->new_from_policy_string("MultipleHosts()");
21 isa_ok($obj, "MogileFS::ReplicationPolicy::MultipleHosts", "got a multiple hosts policy")
22 or die "can't proceed";
24 foreach my $str ("Union(MultipleHosts(5), MultipleHosts(2))",
25 "Union(MultipleHosts(5), MultipleHosts(2), )",
26 "Union( MultipleHosts(5), MultipleHosts(2) )",
27 "Union(MultipleHosts( 5),MultipleHosts(2))",
28 "Union ( MultipleHosts ( 5 ) , MultipleHosts ( 2 ) )",
29 "Union ( MultipleHosts ( 5 ) ,\n MultipleHosts ( 2 ) )",
30 "Union ( MultipleHosts ( 5 ) , \n MultipleHosts ( 2 ), )",
33 $obj = MogileFS::ReplicationPolicy->new_from_policy_string($str);
34 isa_ok($obj, "MogileFS::ReplicationPolicy::Union") or die "Failed to parse: $str";
35 is(scalar @{$obj->{policies}}, 2, "got 2 sub policies");
36 isa_ok($obj->{policies}[0], "MogileFS::ReplicationPolicy::MultipleHosts");
37 isa_ok($obj->{policies}[1], "MogileFS::ReplicationPolicy::MultipleHosts");