# Copyright (c) 2009 bivio Software, Inc. All Rights Reserved. # # Visit http://www.bivio.biz for more info. # # This library is free software; you can redistribute it and/or modify # it under the terms of the GNU Lesser General Public License as # published by the Free Software Foundation; either version 2.1 of the # License, or (at your option) any later version. # # This library is distributed in the hope that it will be useful, but # WITHOUT ANY WARRANTY; without even the implied warranty of # MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU # Lesser General Public License for more details. # # You should have received a copy of the GNU Lesser General Public # License along with this library; If not, you may get a copy from: # http://www.opensource.org/licenses/lgpl-license.html # # $Id: RemoteCopy.bunit,v 1.1 2009/03/07 02:48:20 nagler Exp $ Request('initialize_fully'); req()->set_realm('remote_copy_bunit'); my($rfcl) = model('RemoteCopyList', {})->set_cursor_or_die(0); [ class() => [ { method => 'execute', compute_params => sub { my(undef, $params) = @_; req()->set_realm('guest'); req()->put(path_info => $params->[0]); return [req()]; }, compute_return => sub { my($reply) = req('reply'); return [$reply->get_output_type, $reply->get_output]; }, } => [ 'private' => ['text/plain', qr{^@{[class()]}#1\n\S+ /private/file.html\n\S+ /private/image.gif$}s], 'private/file.html' => ['text/html', qr{^.*}iss], ], remote_list => [ sub { req()->set_realm('remote_copy_bunit'); return [$rfcl]; } => [ {map((lc($_) => [qr{^\S+$}, $_]), map("/RemoteCopyBunit/file$_", 1..4))}, undef, ], ], local_list => [ sub { model('RealmFile', {path => '/RemoteCopyBunit/file1'})->delete; model('RealmFile', {path => '/RemoteCopyBunit/file2'}) ->update_with_content({}, \('changed file2')); model('RealmFile')->create_with_content({ path => '/RemoteCopyBunit/file5', user_id => realm_id('remote_copy_user'), }, \('file5')); return [$rfcl]; } => [ {map((lc($_) => [qr{^\S+$}, $_]), map("/RemoteCopyBunit/file$_", 2..5))}, ], ], diff_lists => [ [$rfcl] => [{ to_delete => FilePathArray('/RemoteCopyBunit/file5'), to_create => FilePathArray('/RemoteCopyBunit/file1'), to_update => FilePathArray('/RemoteCopyBunit/file2'), }], ], remote_get => [ ['/RemoteCopyBunit/file1', $rfcl] => [\('file1'), undef], ], ], ];