From: Bill Erickson Date: Wed, 24 Jun 2015 15:01:41 +0000 (-0400) Subject: JBAS-776 MARC stream (connexion) parallel test script X-Git-Url: https://old-git.evergreen-ils.org/?a=commitdiff_plain;h=797c27b03dce5a9eebe2c2bc647b1fae26bb08b4;p=working%2FEvergreen.git JBAS-776 MARC stream (connexion) parallel test script Script for generating a series of parallel marc_stream_importer.pl calls. Signed-off-by: Bill Erickson --- diff --git a/KCLS/test-scripts/marc_stream/hp-hallows.mrc b/KCLS/test-scripts/marc_stream/hp-hallows.mrc new file mode 100644 index 0000000000..67050cca97 --- /dev/null +++ b/KCLS/test-scripts/marc_stream/hp-hallows.mrc @@ -0,0 +1 @@ +01080nam a2200289Ma 4500001001300000003000600013005001700019008004100036040001700077020001800094020001500112035002100127049000900148100001800157245008700175250002800262260004500290300000900335520026600344650004100610650002300651650002100674650002900695650002300724994001200747901003100759ocn779635453OCoLC20150623041534.0091015s19uu nyu 000 0 eng d aTXBAYcTXBAY a9780545139700 a0545139708 a(OCoLC)779635453 aNTGA1 aRowling, J.K.10aHarry Potter and the Deathly Hallows :cBy J.K. Rowling.b#7 Harry Potter Series / a2009 Softcover Edition. aNew York, New York :bScholastic,c2009. a759. aBurdened with the dark, dangerous and seemingly impossible task of locating and destroying Voldemort's remaining Horcruxes, Harry, feeling alone and uncertain about his future, struggles to find the inner strength he needs to follow the path set out before him. 4aHarry Potter - Fictitious Character. 4aWizards - Fiction. 4aMagic - Fiction. 4aComing of Age - Fiction. 4aEngland - Fiction. aC0bNTG a1415986bc1415986tbiblio \ No newline at end of file diff --git a/KCLS/test-scripts/marc_stream/stream_importer_test.pl b/KCLS/test-scripts/marc_stream/stream_importer_test.pl new file mode 100755 index 0000000000..0aeda1281c --- /dev/null +++ b/KCLS/test-scripts/marc_stream/stream_importer_test.pl @@ -0,0 +1,41 @@ +#!/usr/bin/perl +use strict; +use warnings; +use IO::Socket::INET; + +my $parallel = 5; +my $iterations = 2; +my $host = 'localhost'; +my $port = 5544; + +open(MARC, $ARGV[0]) or die "$0 \n"; +my $marc = ; + +for my $proc (0..$parallel-1) { + + next if fork(); # if parent + + for my $iter (0..$iterations-1) { + + my $socket = IO::Socket::INET->new( + PeerAddr => $host, + PeerPort => $port, + Proto => 'tcp' + ) or die "socket failure $!\n"; + + print "$proc : $iter : sending MARC\n"; + $socket->print($marc) or die "socket print failure: $!\n"; + + while (my $line = $socket->getline) { + chomp($line); + print "$proc : $iter : Read: $line\n" if $line; + } + + $socket->shutdown(2); + } + + exit; # kill the child +} + +while (wait() != -1) {} +