[Bps-public-commit] r11340 - SVN-PropDB/lib/Prophet/Test

clkao at bestpractical.com clkao at bestpractical.com
Tue Apr 1 18:52:17 EDT 2008


Author: clkao
Date: Tue Apr  1 18:52:16 2008
New Revision: 11340

Modified:
   SVN-PropDB/lib/Prophet/Test/Arena.pm
   SVN-PropDB/lib/Prophet/Test/Participant.pm

Log:
normalize record uuid to a sequence in arena recorder.


Modified: SVN-PropDB/lib/Prophet/Test/Arena.pm
==============================================================================
--- SVN-PropDB/lib/Prophet/Test/Arena.pm	(original)
+++ SVN-PropDB/lib/Prophet/Test/Arena.pm	Tue Apr  1 18:52:16 2008
@@ -73,8 +73,16 @@
 }
 
 sub record {
-    my ($self, $name, $action, @args) = @_;
-    push @{$self->{history} ||= []}, [$name, $action, @args];
+    my ($self, $name, $action, $args) = @_;
+    my $stored = { %$args };
+    if ( my $record = $stored->{record} ) {
+        $stored->{record} = $self->{record_map}{ $record };
+    }
+    elsif (my $result = $stored->{result}) {
+        $stored->{result} = $self->{record_map}{ $result } =
+            ++$self->{record_cnt};
+    }
+    push @{$self->{history} ||= []}, [$name, $action, $stored];
 }
 
 1;

Modified: SVN-PropDB/lib/Prophet/Test/Participant.pm
==============================================================================
--- SVN-PropDB/lib/Prophet/Test/Participant.pm	(original)
+++ SVN-PropDB/lib/Prophet/Test/Participant.pm	Tue Apr  1 18:52:16 2008
@@ -120,7 +120,7 @@
     my $self = shift;
     my $lucky = shift || (shuffle(grep { $_->name ne $self->name} @{$self->arena->chickens}))[0];
 
-    $self->record_action('sync_from_peer', $lucky->name);
+    $self->record_action('sync_from_peer', { from => $lucky->name } );
 
   
 #    my $lucky = shift @peers;



More information about the Bps-public-commit mailing list