DB2-Admin

 view release on metacpan or  search on metacpan

t/01lowlevel.t  view on Meta::CPAN

#
# Tests of the low-level raw API
#
# $Id: 01lowlevel.t,v 165.2 2009/04/22 13:46:35 biersma Exp $
#

use strict;
use Test::More tests => 28;
#use Test::Differences;
use Data::Dumper;
BEGIN { use_ok('DB2::Admin'); }
BEGIN { use_ok('DB2::Admin::Constants') };

die "Environment variable DB2_VERSION not set" 
  unless (defined $ENV{DB2_VERSION});

#
# Get the database name and whether to update the dbm cfg from the
# CONFIG file
#
our %myconfig;
require "util/parse_config";
my $db_name = $myconfig{DBNAME};
my $update_dbm_cfg = $myconfig{UPDATE_DBM_CONFIG};

$| = 1;

#
# Lookup two constants
#
my $version = DB2::Admin::Constants::->GetValue('SQLM_CURRENT_VERSION');
ok($version, "constant for current_version ($version)");
my $node = DB2::Admin::Constants::->GetValue('SQLM_CURRENT_NODE');
ok($node, "constant for current_node ($node)");

#
# Attach
#
my $data = DB2::Admin::sqleatin($ENV{DB2INSTANCE}, '', '');
ok($data, "sqletain - attach");

#
# InquireAttach
#
$data = DB2::Admin::sqleatin('', '', '');
ok($data, "sqleatin - inquire");

#
# Get Monitor Switches
#
DB2::Admin::db2MonitorSwitches({}, $version, $node) || 
  do {
      diag("Error with sqlcode ", DB2::Admin::sqlcode() .
           " and error message ", DB2::Admin::sqlaintp(), "\n");
      fail("db2MonitorSwitches");
      exit(1);
  };
pass("db2MonitorSwitches - inquire");

#
# Set Monitor Switches
#
my $rc = DB2::Admin::db2MonitorSwitches({ Table => 1 }, $version, $node);
ok($rc, "db2MonitorSwitches - set");

#
# Reset Monitor
#
$rc = DB2::Admin::db2ResetMonitor(1, '', $version, $node);



( run in 2.726 seconds using v1.01-cache-2.11-cpan-39bf76dae61 )