[Bps-public-commit] r15688 - in Prophet/trunk: . t

sartak at bestpractical.com sartak at bestpractical.com
Mon Sep 1 22:40:57 EDT 2008


Author: sartak
Date: Mon Sep  1 22:40:56 2008
New Revision: 15688

Modified:
   Prophet/trunk/   (props changed)
   Prophet/trunk/lib/Prophet/Record.pm
   Prophet/trunk/t/export.t
   Prophet/trunk/t/publish-pull.t
   Prophet/trunk/t/real-conflicting-merge.t
   Prophet/trunk/t/resty-server.t
   Prophet/trunk/t/simple-conflicting-merge.t
   Prophet/trunk/t/simple-push.t

Log:
 r70846 at onn:  sartak | 2008-09-01 22:40:47 -0400
 Split up creator and original_replica


Modified: Prophet/trunk/lib/Prophet/Record.pm
==============================================================================
--- Prophet/trunk/lib/Prophet/Record.pm	(original)
+++ Prophet/trunk/lib/Prophet/Record.pm	Mon Sep  1 22:40:56 2008
@@ -511,16 +511,24 @@
 
 =head2 default_prop_creator
 
-Default the creator of every record to the changeset_creator @ replica uuid
+Default the creator of every record to the changeset_creator (usually C<$USER>)
 
 =cut
 
 sub default_prop_creator {
     my $self = shift;
+    return $self->handle->changeset_creator;
+}
+
+=head2 default_prop_original_replica
+
+Default the original_replica of every record to the replica's uuid
 
-    return sprintf '%s@%s',
-        $self->handle->changeset_creator,
-        $self->handle->uuid;
+=cut
+
+sub default_prop_original_replica {
+    my $self = shift;
+    return $self->handle->uuid;
 }
 
 =head2 _default_summary_format

Modified: Prophet/trunk/t/export.t
==============================================================================
--- Prophet/trunk/t/export.t	(original)
+++ Prophet/trunk/t/export.t	Mon Sep  1 22:40:56 2008
@@ -40,8 +40,9 @@
         ['show', '--type', 'Bug', '--uuid', $record_id, '--batch'],
         [
             qr/id: (\d+) \($record_id\)/,
-              "creator: alice\@" . replica_uuid_for('alice'),
+              'creator: alice',
               'from: alice',
+              'original_replica: ' . replica_uuid_for('alice'),
               'status: stalled',
         ],
         'content is correct'

Modified: Prophet/trunk/t/publish-pull.t
==============================================================================
--- Prophet/trunk/t/publish-pull.t	(original)
+++ Prophet/trunk/t/publish-pull.t	Mon Sep  1 22:40:56 2008
@@ -119,7 +119,11 @@
                 },
                 creator => {
                     old_value => undef,
-                    new_value => 'alice@' . replica_uuid_for('alice'),
+                    new_value => 'alice',
+                },
+                original_replica => {
+                    old_value => undef,
+                    new_value => replica_uuid_for('alice'),
                 },
             },
         },

Modified: Prophet/trunk/t/real-conflicting-merge.t
==============================================================================
--- Prophet/trunk/t/real-conflicting-merge.t	(original)
+++ Prophet/trunk/t/real-conflicting-merge.t	Mon Sep  1 22:40:56 2008
@@ -34,8 +34,9 @@
         [ 'show', '--type', 'Bug', '--uuid', $record_id, '--batch' ],
         [
         qr/id: (\d+) \($record_id\)/,
-          'creator: alice@' . replica_uuid_for('alice'),
+          'creator: alice',
           'from: alice',
+          'original_replica: ' . replica_uuid_for('alice'),
           'status: stalled',
         ],
         'content is correct'
@@ -50,8 +51,9 @@
         [ 'show', '--type', 'Bug', '--uuid', $record_id, '--batch' ],
         [
             qr/id: (\d+) \($record_id\)/,
-              'creator: alice@' . replica_uuid_for('alice'),
+              'creator: alice',
               'from: alice',
+              'original_replica: ' . replica_uuid_for('alice'),
               'status: open',
         ],
         'content is correct'

Modified: Prophet/trunk/t/resty-server.t
==============================================================================
--- Prophet/trunk/t/resty-server.t	(original)
+++ Prophet/trunk/t/resty-server.t	Mon Sep  1 22:40:56 2008
@@ -37,7 +37,7 @@
 is( $ua->content, '["Cars"]' );
 
 $ua->get_ok( url( 'records', 'Cars', $uuid . ".json" ) );
-is( $ua->content, '{"creator":"'.$car->default_prop_creator.'","wheels":"4","windshields":"1"}' );
+is( $ua->content, '{"original_replica":"'.$car->handle->uuid.'","creator":"'.$car->default_prop_creator.'","wheels":"4","windshields":"1"}' );
 
 $ua->get( url( 'records', 'Cars', "1234.json" ) );
 is( $ua->status, '404' );
@@ -45,7 +45,7 @@
 $ua->post_ok( url( 'records', 'Cars', $uuid . ".json" ), { wheels => 6 } );
 
 $ua->get_ok( url( 'records', 'Cars', $uuid . ".json" ) );
-is( $ua->content, '{"creator":"'.$car->default_prop_creator.'","wheels":"6","windshields":"1"}' );
+is( $ua->content, '{"original_replica":"'.$car->handle->uuid.'","creator":"'.$car->default_prop_creator.'","wheels":"6","windshields":"1"}' );
 
 $ua->post( url( 'records', 'Cars', "doesnotexist.json" ), { wheels => 6 } );
 is( $ua->status, '404', "Can't update a nonexistant car" );
@@ -62,7 +62,12 @@
 
 my $car2 = Prophet::Record->new( handle => $cli->handle, type => 'Cars' );
 $car2->load( uuid => $new_uuid );
-is_deeply( $car2->get_props, { creator => $car2->default_prop_creator, wheels => 3, seatbelts => 'sure!' }, "The thing we created remotely worked just great" );
+is_deeply( $car2->get_props, {
+    creator => $car2->default_prop_creator,
+    wheels => 3,
+    seatbelts => 'sure!',
+    original_replica => $car2->handle->uuid,
+}, "The thing we created remotely worked just great" );
 
 diag("testing property-level access");
 $ua->get_ok( url( 'records', 'Cars', $uuid, 'wheels' ) );

Modified: Prophet/trunk/t/simple-conflicting-merge.t
==============================================================================
--- Prophet/trunk/t/simple-conflicting-merge.t	(original)
+++ Prophet/trunk/t/simple-conflicting-merge.t	Mon Sep  1 22:40:56 2008
@@ -34,8 +34,9 @@
         [ 'show', '--batch', '--type', 'Bug', '--uuid', $record_id ],
         [
             qr/id: (\d+) \($record_id\)/,
-              'creator: alice@' . replica_uuid_for('alice'),
+              'creator: alice',
               'from: alice',
+              'original_replica: ' . replica_uuid_for('alice'),
               'status: stalled',
         ],
         'content is correct'
@@ -49,8 +50,9 @@
         ['show', '--type', 'Bug', '--uuid', $record_id, '--batch', ],
         [
             qr/id: (\d+) \($record_id\)/,
-              'creator: alice@' . replica_uuid_for('alice'),
+              'creator: alice',
               'from: alice',
+              'original_replica: ' . replica_uuid_for('alice'),
               'status: stalled',
         ],
         'content is correct'

Modified: Prophet/trunk/t/simple-push.t
==============================================================================
--- Prophet/trunk/t/simple-push.t	(original)
+++ Prophet/trunk/t/simple-push.t	Mon Sep  1 22:40:56 2008
@@ -85,9 +85,13 @@
                             'old_value' => undef
                         },
                         'creator' => {
-                            'new_value' => 'bob@' . replica_uuid_for('bob'),
+                            'new_value' => 'bob',
+                            'old_value' => undef
+                        },
+                        'original_replica' => {
+                            'new_value' => replica_uuid_for('bob'),
                             'old_value' => undef
-                        }
+                        },
                     },
                     'record_type' => 'Bug'
                 }
@@ -156,7 +160,11 @@
                             'old_value' => undef
                         },
                         'creator' => {
-                            'new_value' => 'bob@' . replica_uuid_for('bob'),
+                            'new_value' => 'bob',
+                            'old_value' => undef,
+                        },
+                        'original_replica' => {
+                            'new_value' => replica_uuid_for('bob'),
                             'old_value' => undef,
                         },
                     },



More information about the Bps-public-commit mailing list