# Copyright (c) 2011 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: RealmFile3.bunit,v 2.2 2011/03/10 17:48:02 nagler Exp $ Request(); req()->set_realm_and_user('fourem', 'root'); my($rf) = model('RealmFile'); foreach my $msg (glob('RealmFile3/Mail/*/*.eml')) { IO_File()->set_modified_date_time( $msg, Mail_Incoming()->new(IO_File()->read($msg)) ->get_date_time, ); } IO_File()->chdir('RealmFile3'); [ sub { return Bivio_ShellUtil()->new_other(class()) ->put(force => 1); } => [ import_tree => [ '/' => sub { my($bb); model(RealmMail()) ->do_iterate( sub { my($it) = @_; my($id) = $it->get('message_id'); if ($id eq 'bb@b.b') { $bb = $it->get('realm_file_id'); assert_equals( $bb, $it->get('thread_root_id'), ); assert_equals( undef, $it->get('thread_parent_id'), ); } else { assert_equals( 'aa@a.a', $id, ); assert_equals( $bb, $it->get('thread_root_id'), ); assert_equals( $bb, $it->get('thread_parent_id'), ); } return 1; }, 'realm_file_id asc', {subject => 'RealmMail3.bunit'}, ); b_die('no bb') unless $bb; return 1; }, ], ], ];