diff options
author | Oliver Tappe | 2007-12-28 18:55:25 +0100 |
---|---|---|
committer | Oliver Tappe | 2007-12-28 18:55:25 +0100 |
commit | b27afb64e9d2b18e524ef3c957baa530ed5f9904 (patch) | |
tree | 2376e0a39d2cb2b714667a7943ff28ee6d09ca85 /config-db/t/29-transaction.t | |
parent | * added more tests for basic DB-features: group, global_info and (diff) | |
download | core-b27afb64e9d2b18e524ef3c957baa530ed5f9904.tar.gz core-b27afb64e9d2b18e524ef3c957baa530ed5f9904.tar.xz core-b27afb64e9d2b18e524ef3c957baa530ed5f9904.zip |
* completed basic tests and started to work on tests for aggregated values
(attributes)
git-svn-id: http://svn.openslx.org/svn/openslx/trunk@1436 95ad53e4-c205-0410-b2fa-d234c58c8868
Diffstat (limited to 'config-db/t/29-transaction.t')
-rw-r--r-- | config-db/t/29-transaction.t | 55 |
1 files changed, 55 insertions, 0 deletions
diff --git a/config-db/t/29-transaction.t b/config-db/t/29-transaction.t new file mode 100644 index 00000000..89b0df83 --- /dev/null +++ b/config-db/t/29-transaction.t @@ -0,0 +1,55 @@ +use Test::More qw(no_plan); + +use lib '/opt/openslx/lib'; + +# basic init +use OpenSLX::ConfigDB; + +my $configDB = OpenSLX::ConfigDB->new; +$configDB->connect(); + +my @vendorOSes = $configDB->fetchVendorOSByFilter(); +my @exports = $configDB->fetchExportByFilter(); +my @systems = $configDB->fetchSystemByFilter(); +my @clients = $configDB->fetchClientByFilter(); +my @groups = $configDB->fetchGroupByFilter(); + +ok($configDB->startTransaction(), 'starting a transaction'); + +ok($configDB->emptyDatabase(), 'emptying the DB'); + +ok($configDB->rollbackTransaction(), 'rolling back the transaction'); + +my @vendorOSes2 = $configDB->fetchVendorOSByFilter(); +my @exports2 = $configDB->fetchExportByFilter(); +my @systems2 = $configDB->fetchSystemByFilter(); +my @clients2 = $configDB->fetchClientByFilter(); +my @groups2 = $configDB->fetchGroupByFilter(); + +is( + scalar @vendorOSes2, scalar @vendorOSes, "should still have all vendor-OSes" +); +is(scalar @exports2, scalar @exports, "should still have all exports"); +is(scalar @systems2, scalar @systems, "should still have all systems"); +is(scalar @clients2, scalar @clients, "should still have all clients"); +is(scalar @groups2, scalar @groups, "should still have all groups"); + +ok($configDB->startTransaction(), 'starting a transaction'); + +ok($configDB->emptyDatabase(), 'emptying the DB'); + +ok($configDB->commitTransaction(), 'committing the transaction'); + +my @vendorOSes3 = $configDB->fetchVendorOSByFilter(); +my @exports3 = $configDB->fetchExportByFilter(); +my @systems3 = $configDB->fetchSystemByFilter(); +my @clients3 = $configDB->fetchClientByFilter(); +my @groups3 = $configDB->fetchGroupByFilter(); + +is(scalar @vendorOSes3, 0, "should have no vendor-OSes"); +is(scalar @exports3, 0, "should have no exports"); +is(scalar @systems3, 1, "should have one system (default)"); +is(scalar @clients3, 1, "should have one client (default)"); +is(scalar @groups3, 0, "should have no groups"); + +$configDB->disconnect(); |