basic cstore communication via opensrf perl
authorerickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 24 Jun 2009 17:56:59 +0000 (17:56 +0000)
committererickson <erickson@dcc99617-32d9-48b4-a31d-7c20da2025e4>
Wed, 24 Jun 2009 17:56:59 +0000 (17:56 +0000)
git-svn-id: svn://svn.open-ils.org/ILS/trunk@13460 dcc99617-32d9-48b4-a31d-7c20da2025e4

Open-ILS/src/support-scripts/test-scripts/cstore_simple.pl [new file with mode: 0755]

diff --git a/Open-ILS/src/support-scripts/test-scripts/cstore_simple.pl b/Open-ILS/src/support-scripts/test-scripts/cstore_simple.pl
new file mode 100755 (executable)
index 0000000..b0a33d2
--- /dev/null
@@ -0,0 +1,36 @@
+#!/usr/bin/perl
+#----------------------------------------------------------------
+# Simple cstore example
+#----------------------------------------------------------------
+
+require '../oils_header.pl';
+use strict; use warnings;
+use OpenSRF::AppSession;
+use OpenILS::Utils::Fieldmapper;
+
+my $config = shift; # path to opensrf_core.xml
+osrf_connect($config); # connect to jabber
+
+my $ses = OpenSRF::AppSession->create("open-ils.cstore");
+$ses->connect;
+
+my $req = $ses->request('open-ils.cstore.transaction.begin');
+my $stat = $req->gather(1);
+die "cannot start transaction\n" unless $stat;
+
+my $btype = Fieldmapper::config::billing_type->new;
+$btype->name('Test 1');
+$btype->owner(1);
+
+$req = $ses->request('open-ils.cstore.direct.config.billing_type.create', $btype);
+$stat = $req->gather(1);
+die "cannot create object\n" unless $stat;
+print "create returned $stat\n";
+
+$req = $ses->request('open-ils.cstore.transaction.rollback');
+$stat = $req->gather(1);
+die "cannot rollback transaction\n" unless $stat;
+
+$ses->disconnect;
+
+