#! /usr/bin/env perl

BEGIN
{
    push(@INC, $ENV{'GLOBUS_LOCATION'} . '/lib/perl');
}

use Globus::Core::Paths;
use Globus::Testing::Container;
use Test;
use strict;

my (@tests) = ();
my $c_container = new Globus::Testing::Container();
my $c_contact = $c_container->contact();

my @counter_tests = qw(
    test-counter-get-resource-property
    test-counter-destroy
);

sub counter_test_case
{
    my $exec = $_[0];
    my $contact = $_[1];
    my $service_contact = "${contact}wsrf/services/CounterService";

    ok(system("./$exec $service_contact 2> /dev/null") >> 8, 0);
}

push (@tests,
    map { "counter_test_case(\"$_\", \"$c_contact\")" } @counter_tests);

plan tests => scalar(@tests);

foreach (@tests)
{
    eval "&$_";
}
