#! /usr/bin/env perl

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

use Globus::Core::Paths;
use Globus::Testing::Container;
use POSIX qw(getcwd);
use Test;
use strict;

my (@tests) = ();
my $c_container = new Globus::Testing::Container(
    {
        type => 'c',
        security => 0
    });
my $java_container = new Globus::Testing::Container(
    {
        type => 'java',
        security => 0
    });
my $c_contact = $c_container->contact();
my $java_contact = $java_container->contact();

my @test_cases = qw(
    test-counter-notify
);

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

    skip($exec eq 'test-counter-notify' && $contact eq $c_contact,
        (system("./$exec $service_contact 10 1>&2")) >>8,
        0);
}

push (@tests, map { "test_case(\"$_\", \"$c_contact\")" } @test_cases);
push (@tests, map { "test_case(\"$_\", \"$java_contact\")" } @test_cases);

plan tests => scalar(@tests);

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