[Rt-commit] r9137 - in rt/branches/3.999-DANGEROUS: . etc lib
lib/RT lib/RT/Interface lib/RT/Interface/Web lib/RT/Model
lib/RT/ScripAction lib/RT/Test sbin t t/api t/delegation
t/mail t/shredder t/web
jesse at bestpractical.com
jesse at bestpractical.com
Mon Sep 24 00:17:02 EDT 2007
Author: jesse
Date: Mon Sep 24 00:16:53 2007
New Revision: 9137
Removed:
rt/branches/3.999-DANGEROUS/lib/RT.pm.in
rt/branches/3.999-DANGEROUS/lib/RT/Model/TicketCollection_Overlay_SQL.pm
Modified:
rt/branches/3.999-DANGEROUS/ (props changed)
rt/branches/3.999-DANGEROUS/etc/config.yml
rt/branches/3.999-DANGEROUS/lib/RT/Base.pm
rt/branches/3.999-DANGEROUS/lib/RT/Bootstrap.pm
rt/branches/3.999-DANGEROUS/lib/RT/Dispatcher.pm
rt/branches/3.999-DANGEROUS/lib/RT/Interface/Web.pm
rt/branches/3.999-DANGEROUS/lib/RT/Interface/Web/Standalone.pm
rt/branches/3.999-DANGEROUS/lib/RT/Model/ACE.pm
rt/branches/3.999-DANGEROUS/lib/RT/Model/ACECollection.pm
rt/branches/3.999-DANGEROUS/lib/RT/Model/Attribute.pm
rt/branches/3.999-DANGEROUS/lib/RT/Model/CustomFieldValueCollection.pm
rt/branches/3.999-DANGEROUS/lib/RT/Model/Group.pm
rt/branches/3.999-DANGEROUS/lib/RT/Model/ObjectCustomFieldCollection.pm
rt/branches/3.999-DANGEROUS/lib/RT/Model/TicketCollection.pm
rt/branches/3.999-DANGEROUS/lib/RT/Model/User.pm
rt/branches/3.999-DANGEROUS/lib/RT/Record.pm
rt/branches/3.999-DANGEROUS/lib/RT/SavedSearches.pm
rt/branches/3.999-DANGEROUS/lib/RT/ScripAction/AutoOpen.pm
rt/branches/3.999-DANGEROUS/lib/RT/ScripAction/Autoreply.pm
rt/branches/3.999-DANGEROUS/lib/RT/ScripAction/CreateTickets.pm
rt/branches/3.999-DANGEROUS/lib/RT/ScripAction/EscalatePriority.pm
rt/branches/3.999-DANGEROUS/lib/RT/ScripAction/Generic.pm
rt/branches/3.999-DANGEROUS/lib/RT/ScripAction/Notify.pm
rt/branches/3.999-DANGEROUS/lib/RT/ScripAction/NotifyAsComment.pm
rt/branches/3.999-DANGEROUS/lib/RT/ScripAction/RecordComment.pm
rt/branches/3.999-DANGEROUS/lib/RT/ScripAction/RecordCorrespondence.pm
rt/branches/3.999-DANGEROUS/lib/RT/ScripAction/SetPriority.pm
rt/branches/3.999-DANGEROUS/lib/RT/ScripAction/UserDefined.pm
rt/branches/3.999-DANGEROUS/lib/RT/SearchBuilder.pm
rt/branches/3.999-DANGEROUS/lib/RT/System.pm
rt/branches/3.999-DANGEROUS/lib/RT/Test.pm
rt/branches/3.999-DANGEROUS/lib/RT/Test/Web.pm
rt/branches/3.999-DANGEROUS/sbin/rt-setup-database
rt/branches/3.999-DANGEROUS/t/00-compile.t
rt/branches/3.999-DANGEROUS/t/00-mason-syntax.t
rt/branches/3.999-DANGEROUS/t/api/ace.t
rt/branches/3.999-DANGEROUS/t/api/action-createtickets.t
rt/branches/3.999-DANGEROUS/t/api/attachment.t
rt/branches/3.999-DANGEROUS/t/api/attribute-tests.t
rt/branches/3.999-DANGEROUS/t/api/attribute.t
rt/branches/3.999-DANGEROUS/t/api/cf.t
rt/branches/3.999-DANGEROUS/t/api/cf_combo_casacade.t
rt/branches/3.999-DANGEROUS/t/api/cf_external.t
rt/branches/3.999-DANGEROUS/t/api/cf_pattern.t
rt/branches/3.999-DANGEROUS/t/api/cf_single_values.t
rt/branches/3.999-DANGEROUS/t/api/cf_transaction.t
rt/branches/3.999-DANGEROUS/t/api/condition-ownerchange.t
rt/branches/3.999-DANGEROUS/t/api/currentuser.t
rt/branches/3.999-DANGEROUS/t/api/customfield.t
rt/branches/3.999-DANGEROUS/t/api/date.t
rt/branches/3.999-DANGEROUS/t/api/emailparser.t
rt/branches/3.999-DANGEROUS/t/api/group.t
rt/branches/3.999-DANGEROUS/t/api/groups.t
rt/branches/3.999-DANGEROUS/t/api/i18n.t
rt/branches/3.999-DANGEROUS/t/api/link.t
rt/branches/3.999-DANGEROUS/t/api/queue.t
rt/branches/3.999-DANGEROUS/t/api/record.t
rt/branches/3.999-DANGEROUS/t/api/rights.t
rt/branches/3.999-DANGEROUS/t/api/rt.t
rt/branches/3.999-DANGEROUS/t/api/scrip.t
rt/branches/3.999-DANGEROUS/t/api/scrip_order.t
rt/branches/3.999-DANGEROUS/t/api/searchbuilder.t
rt/branches/3.999-DANGEROUS/t/api/system.t
rt/branches/3.999-DANGEROUS/t/api/template-insert.t
rt/branches/3.999-DANGEROUS/t/api/template.t
rt/branches/3.999-DANGEROUS/t/api/ticket.t
rt/branches/3.999-DANGEROUS/t/api/tickets.t
rt/branches/3.999-DANGEROUS/t/api/tickets_overlay_sql.t
rt/branches/3.999-DANGEROUS/t/api/uri-fsck_com_rt.t
rt/branches/3.999-DANGEROUS/t/api/uri-t.t
rt/branches/3.999-DANGEROUS/t/api/user.t
rt/branches/3.999-DANGEROUS/t/api/users.t
rt/branches/3.999-DANGEROUS/t/clicky.t
rt/branches/3.999-DANGEROUS/t/cron.t
rt/branches/3.999-DANGEROUS/t/delegation/cleanup_stalled.t
rt/branches/3.999-DANGEROUS/t/delegation/revocation.t
rt/branches/3.999-DANGEROUS/t/mail/crypt-gnupg.t
rt/branches/3.999-DANGEROUS/t/mail/gateway.t
rt/branches/3.999-DANGEROUS/t/mail/gnupg-bad.t
rt/branches/3.999-DANGEROUS/t/mail/gnupg-incoming.t
rt/branches/3.999-DANGEROUS/t/mail/gnupg-outcoming.t
rt/branches/3.999-DANGEROUS/t/mail/gnupg-realmail.t
rt/branches/3.999-DANGEROUS/t/mail/gnupg-reverification.t
rt/branches/3.999-DANGEROUS/t/mail/mime_decoding.t
rt/branches/3.999-DANGEROUS/t/mail/sendmail.t
rt/branches/3.999-DANGEROUS/t/mail/verp.t
rt/branches/3.999-DANGEROUS/t/rtname.t
rt/branches/3.999-DANGEROUS/t/savedsearch.t
rt/branches/3.999-DANGEROUS/t/shredder/00load.t
rt/branches/3.999-DANGEROUS/t/shredder/00skeleton.t
rt/branches/3.999-DANGEROUS/t/shredder/01basics.t
rt/branches/3.999-DANGEROUS/t/shredder/01ticket.t
rt/branches/3.999-DANGEROUS/t/shredder/02group_member.t
rt/branches/3.999-DANGEROUS/t/shredder/02queue.t
rt/branches/3.999-DANGEROUS/t/shredder/02template.t
rt/branches/3.999-DANGEROUS/t/shredder/02user.t
rt/branches/3.999-DANGEROUS/t/shredder/03plugin.t
rt/branches/3.999-DANGEROUS/t/shredder/03plugin_summary.t
rt/branches/3.999-DANGEROUS/t/shredder/03plugin_tickets.t
rt/branches/3.999-DANGEROUS/t/shredder/03plugin_users.t
rt/branches/3.999-DANGEROUS/t/shredder/utils.pl
rt/branches/3.999-DANGEROUS/t/ticket/batch-upload-csv.t
rt/branches/3.999-DANGEROUS/t/ticket/deffered_owner.t
rt/branches/3.999-DANGEROUS/t/ticket/link_search.t
rt/branches/3.999-DANGEROUS/t/ticket/linking.t
rt/branches/3.999-DANGEROUS/t/ticket/merge.t
rt/branches/3.999-DANGEROUS/t/ticket/pawsort.t
rt/branches/3.999-DANGEROUS/t/ticket/quicksearch.t
rt/branches/3.999-DANGEROUS/t/ticket/requestor-order.t
rt/branches/3.999-DANGEROUS/t/ticket/search.t
rt/branches/3.999-DANGEROUS/t/ticket/search_by_txn.t
rt/branches/3.999-DANGEROUS/t/ticket/search_by_watcher.t
rt/branches/3.999-DANGEROUS/t/ticket/sort_by_cf.t
rt/branches/3.999-DANGEROUS/t/web/attachments.t
rt/branches/3.999-DANGEROUS/t/web/basic.t
rt/branches/3.999-DANGEROUS/t/web/cf_access.t
rt/branches/3.999-DANGEROUS/t/web/cf_select_one.t
rt/branches/3.999-DANGEROUS/t/web/command_line.t
rt/branches/3.999-DANGEROUS/t/web/compilation_errors.t
rt/branches/3.999-DANGEROUS/t/web/crypt-gnupg.t
rt/branches/3.999-DANGEROUS/t/web/custom_frontpage.t
rt/branches/3.999-DANGEROUS/t/web/custom_search.t
rt/branches/3.999-DANGEROUS/t/web/query_builder.t
rt/branches/3.999-DANGEROUS/t/web/rights.t
rt/branches/3.999-DANGEROUS/t/web/rights1.t
rt/branches/3.999-DANGEROUS/t/web/ticket_owner.t
rt/branches/3.999-DANGEROUS/t/web/ticket_seen.t
Log:
r67476 at pinglin: jesse | 2007-09-22 01:37:03 -0400
checkpoint
Modified: rt/branches/3.999-DANGEROUS/etc/config.yml
==============================================================================
--- rt/branches/3.999-DANGEROUS/etc/config.yml (original)
+++ rt/branches/3.999-DANGEROUS/etc/config.yml Mon Sep 24 00:16:53 2007
@@ -17,7 +17,7 @@
DevelMode: 1
L10N:
PoDir: share/po
- LogLevel: INFO
+ LogLevel: DEBUG
Mailer: Sendmail
MailerArgs: []
Modified: rt/branches/3.999-DANGEROUS/lib/RT/Base.pm
==============================================================================
--- rt/branches/3.999-DANGEROUS/lib/RT/Base.pm (original)
+++ rt/branches/3.999-DANGEROUS/lib/RT/Base.pm Mon Sep 24 00:16:53 2007
@@ -134,9 +134,12 @@
return $self->current_user->loc(@_);
}
- else {
+ elsif(RT->SystemUser) {
return RT->SystemUser->loc(@_);
}
+ else {
+ return(@_);
+ }
}
sub loc_fuzzy {
Modified: rt/branches/3.999-DANGEROUS/lib/RT/Bootstrap.pm
==============================================================================
--- rt/branches/3.999-DANGEROUS/lib/RT/Bootstrap.pm (original)
+++ rt/branches/3.999-DANGEROUS/lib/RT/Bootstrap.pm Mon Sep 24 00:16:53 2007
@@ -1,14 +1,589 @@
-use RT::Bootstrap;
+
+use warnings;
+use strict;
+
+package RT::Bootstrap;
use base qw/Jifty::Bootstrap/;
sub run {
my $self = shift;
- RT::connect_to_database();
- RT::InitLogging();
- RT::InitSystemObjects();
-
- RT::Handle->InsertInitialData();
+ RT::InitLogging();
+ $self->InsertInitialData();
+ $self->InsertData( $RT::EtcPath . "/initialdata" );
+}
+
+=head1 METHODS
+
+
+use File::Spec;
+
+=head2 Database maintanance
+
+=head2 CreateDatabase $DBH
+Creates a new database. This method can be used as class method.
+
+Takes DBI handle. Many database systems require special handle to
+allow you to create a new database, so you have to use L<system_dsn>
+method during connection.
+
+Fetches type and name of the DB from the config.
+
+=cut
+
+sub CreateDatabase {
+ my $self = shift;
+ my $dbh = shift || die "No DBI handle provided";
+ my $db_type = RT->Config->Get('DatabaseType');
+ my $db_name = RT->Config->Get('DatabaseName');
+ print "Creating $db_type database $db_name.\n";
+ if ( $db_type eq 'SQLite' ) {
+ return;
+ }
+ elsif ( $db_type eq 'Pg' ) {
+ # XXX: as we get external DBH we don't know if RaiseError or PrintError
+ # are enabled, so we have to setup it here and restore them back
+ $dbh->do("CREATE DATABASE $db_name WITH ENCODING='UNICODE'");
+ if ( $DBI::errstr ) {
+ $dbh->do("CREATE DATABASE $db_name") || die $DBI::errstr;
+ }
+ }
+ elsif ( $db_type eq 'Informix' ) {
+ local $ENV{'DB_LOCALE'} = 'en_us.utf8';
+ $dbh->do("CREATE DATABASE $db_name WITH BUFFERED LOG");
+ }
+ else {
+ $dbh->do("CREATE DATABASE $db_name") or die $DBI::errstr;
+ }
}
+=head3 DropDatabase $DBH [Force => 0]
+
+Drops RT's database. This method can be used as class method.
+
+Takes DBI handle as first argument. Many database systems require
+special handle to allow you to create a new database, so you have
+to use L<system_dsn> method during connection.
+
+Takes as well optional named argument C<Force>, if it's true than
+no questions would be asked.
+
+Fetches type and name of the DB from the config.
+
+=cut
+
+sub DropDatabase {
+ my $self = shift;
+ my $dbh = shift || die "No DBI handle provided";
+ my %args = ( Force => 0, @_ );
+
+ my $db_type = RT->Config->Get('DatabaseType');
+ my $db_name = RT->Config->Get('DatabaseName');
+ my $db_host = RT->Config->Get('DatabaseHost');
+
+ if ( $db_type eq 'Oracle' ) {
+ print <<END;
+
+To delete the tables and sequences of the RT Oracle database by running
+ \@etc/drop.Oracle
+through SQLPlus.
+
+END
+ return;
+ }
+ unless ( $args{'Force'} ) {
+ print <<END;
+
+About to drop $db_type database $db_name on $db_host.
+WARNING: This will erase all data in $db_name.
+
+END
+ return unless _yesno();
+
+ }
+
+ print "Dropping $db_type database $db_name.\n";
+
+ if ( $db_type eq 'SQLite' ) {
+ my $path = $db_name;
+ $path = "$RT::VarPath/$path" unless substr($path, 0, 1) eq '/';
+ unlink $path or warn $!;
+ return;
+ }
+ $dbh->do("DROP DATABASE ". $db_name) or warn $DBI::errstr;
+}
+
+sub _yesno {
+ print "Proceed [y/N]:";
+ my $x = scalar(<STDIN>);
+ $x =~ /^y/i;
+}
+
+sub InsertACL{}
+
+=head2 InsertSchema
+
+=cut
+
+sub InsertSchema {
+ my $self = shift;
+ my $dbh = shift || $self->dbh;
+ my $base_path = (shift || $RT::EtcPath);
+ my $db_type = RT->Config->Get('DatabaseType');
+
+ my $file = get_version_file( $base_path . "/schema." . $db_type );
+ unless ( $file ) {
+ die "Couldn't find schema file in '$base_path' dir";
+ }
+ unless ( -f $file || -r $file ) {
+ die "File '$file' doesn't exist or couldn't be read";
+ }
+
+ my (@schema);
+ print "Creating database schema.\n";
+
+ open my $fh_schema, "<$file";
+
+ my $has_local = 0;
+ open my $fh_schema_local, "<" . get_version_file( $RT::LocalEtcPath . "/schema." . $db_type )
+ and $has_local = 1;
+
+ my $statement = "";
+ foreach my $line ( <$fh_schema>, ($_ = ';;'), $has_local? <$fh_schema_local>: () ) {
+ $line =~ s/\#.*//g;
+ $line =~ s/--.*//g;
+ $statement .= $line;
+ if ( $line =~ /;(\s*)$/ ) {
+ $statement =~ s/;(\s*)$//g;
+ push @schema, $statement;
+ $statement = "";
+ }
+ }
+ close $fh_schema; close $fh_schema_local;
+
+ local $SIG{__WARN__} = sub {};
+ my $is_local = 0; # local/etc/schema needs to be nonfatal.
+ $dbh->begin_work or die $dbh->errstr;
+ foreach my $statement (@schema) {
+ if ( $statement =~ /^\s*;$/ ) { $is_local = 1; next; }
+
+# print "Executing SQL:\n$statement\n" if defined $args{'debug'};
+ my $sth = $dbh->prepare($statement) or die $dbh->errstr;
+ unless ( $sth->execute or $is_local ) {
+ die "Problem with statement:\n$statement\n" . $sth->errstr;
+ }
+ }
+ $dbh->commit or die $dbh->errstr;
+
+ print "Done setting up database schema.\n";
+}
+
+=head1 get_version_file
+
+Takes base name of the file as argument, scans for <base name>-<version> named
+files and returns file name with closest version to the version of the RT DB.
+
+=cut
+
+sub get_version_file {
+ my $base_name = shift;
+
+ require File::Glob;
+ my @files = File::Glob::bsd_glob("$base_name*");
+ return '' unless @files;
+
+ my %version = map { $_ =~ /\.\w+-([-\w\.]+)$/; ($1||0) => $_ } @files;
+ my $db_version = Jifty->handle->database_version;
+ print "Server version $db_version\n";
+ my $version;
+ foreach ( reverse sort cmp_version keys %version ) {
+ if ( cmp_version( $db_version, $_ ) >= 0 ) {
+ $version = $_;
+ last;
+ }
+ }
+
+ return defined $version? $version{ $version } : undef;
+}
+
+sub cmp_version($$) {
+ my ($a, $b) = (@_);
+ my @a = split /[^0-9]+/, $a;
+ my @b = split /[^0-9]+/, $b;
+ for ( my $i = 0; $i < @a; $i++ ) {
+ return 1 unless defined $b[$i];
+ return $a[$i] <=> $b[$i] if $a[$i] <=> $b[$i];
+ }
+ return 0 if @a == @b;
+ return -1;
+}
+
+
+=head2 InsertInitialData
+
+=cut
+
+sub InsertInitialData {
+ my $self = shift;
+ my $db_type = RT->Config->Get('DatabaseType');
+
+
+
+ #Put together a current user object so we can create a User object
+ require RT::CurrentUser;
+ my $CurrentUser = new RT::CurrentUser();
+
+ print "Checking for existing system user...";
+ my $test_user = RT::Model::User->new(current_user => );
+ $test_user->load('RT_System');
+ if ( $test_user->id ) {
+ print "found!\n\nYou appear to have a functional RT database.\n"
+ . "Exiting, so as not to clobber your existing data.\n";
+ exit(-1);
+
+ }
+ else {
+ print "not found. This appears to be a new installation.\n";
+ }
+
+ print "Creating system user...";
+ my $RT_System = RT::Model::User->new(current_user => );
+
+ my ( $val, $msg ) = $RT_System->_bootstrap_create(
+ Name => 'RT_System',
+ RealName => 'The RT System itself',
+ Comments => 'Do not delete or modify this user. '
+ . 'It is integral to RT\'s internal database structures',
+ Creator => '1',
+ LastUpdatedBy => '1',
+ );
+
+ unless ( $val ) {
+ print "$msg\n";
+ exit(-1);
+ }
+ Jifty::DBI::Record::Cachable->flush_cache;
+ print "done.\n";
+
+ print "Creating system user's ACL...";
+
+ $CurrentUser = new RT::CurrentUser;
+ $CurrentUser->load_by_cols(Name => 'RT_System');
+ unless ( $CurrentUser->id ) {
+ print "Couldn't load system user\n";
+ exit(-1);
+ }
+
+ my $superuser_ace = RT::Model::ACE->new( $CurrentUser );
+ $superuser_ace->_bootstrap_create(
+ PrincipalId => ACLEquivGroupId( $CurrentUser->id ),
+ PrincipalType => 'Group',
+ RightName => 'SuperUser',
+ ObjectType => 'RT::System',
+ ObjectId => 1,
+ );
+
+ print "done.\n";
+}
+
+=head InsertData
+
+=cut
+
+# load some sort of data into the database
+sub InsertData {
+ my $self = shift;
+ my $datafile = shift;
+
+
+ # Slurp in stuff to insert from the datafile. Possible things to go in here:-
+ our (@Groups, @Users, @ACL, @Queues, @ScripActions, @ScripConditions,
+ @Templates, @CustomFields, @Scrips, @Attributes, @Initial, @Final);
+ local (@Groups, @Users, @ACL, @Queues, @ScripActions, @ScripConditions,
+ @Templates, @CustomFields, @Scrips, @Attributes, @Initial, @Final);
+
+ require $datafile
+ || die "Couldn't find initial data for import\n" . $@;
+
+ if ( @Initial ) {
+ print "Running initial actions...\n";
+ # Don't trap errors here, as they *should* be fatal
+ $_->() for @Initial;
+ }
+ if ( @Groups ) {
+ print "Creating groups...";
+ print "My systemuser is ".$RT::SystemUser ."\n";
+ $RT::SystemUser = RT::CurrentUser->new;
+ $RT::SystemUser->load_by_cols(Name => 'RT_System');
+ foreach my $item (@Groups) {
+ my $new_entry = RT::Model::Group->new( $RT::SystemUser );
+ my $member_of = delete $item->{'MemberOf'};
+ my ( $return, $msg ) = $new_entry->_create(%$item);
+ print "(Error: $msg)" unless $return;
+ print $return. ".";
+ if ( $member_of ) {
+ $member_of = [ $member_of ] unless ref $member_of eq 'ARRAY';
+ foreach( @$member_of ) {
+ my $parent = RT::Model::Group->new($RT::SystemUser);
+ if ( ref $_ eq 'HASH' ) {
+ $parent->load_by_cols( %$_ );
+ }
+ elsif ( !ref $_ ) {
+ $parent->loadUserDefinedGroup( $_ );
+ }
+ else {
+ print "(Error: wrong format of MemberOf field."
+ ." Should be name of user defined group or"
+ ." hash reference with 'column => value' pairs."
+ ." Use array reference to add to multiple groups)";
+ next;
+ }
+ unless ( $parent->id ) {
+ print "(Error: couldn't load group to add member)";
+ next;
+ }
+ my ( $return, $msg ) = $parent->AddMember( $new_entry->id );
+ print "(Error: $msg)" unless ($return);
+ print $return. ".";
+ }
+ }
+ }
+ print "done.\n";
+ }
+ if ( @Users ) {
+ print "Creating users...";
+ foreach my $item (@Users) {
+ my $new_entry = new RT::Model::User($RT::SystemUser);
+ my ( $return, $msg ) = $new_entry->create(%$item);
+ print "(Error: $msg)" unless $return;
+ print $return. ".";
+ }
+ print "done.\n";
+ }
+ if ( @Queues ) {
+ print "Creating queues...";
+ for my $item (@Queues) {
+ my $new_entry = new RT::Model::Queue($RT::SystemUser);
+ my ( $return, $msg ) = $new_entry->create(%$item);
+ print "(Error: $msg)" unless $return;
+ print $return. ".";
+ }
+ print "done.\n";
+ }
+ if ( @CustomFields ) {
+ print "Creating custom fields...";
+ for my $item ( @CustomFields ) {
+ my $new_entry = new RT::Model::CustomField( $RT::SystemUser );
+ my $values = delete $item->{'Values'};
+
+ my @queues;
+ # if ref then it's list of queues, so we do things ourself
+ if ( exists $item->{'Queue'} && ref $item->{'Queue'} ) {
+ $item->{'LookupType'} = 'RT::Model::Queue-RT::Model::Ticket';
+ @queues = @{ delete $item->{'Queue'} };
+ }
+
+ my ( $return, $msg ) = $new_entry->create(%$item);
+ unless( $return ) {
+ print "(Error: $msg)\n";
+ next;
+ }
+
+ foreach my $value ( @{$values} ) {
+ my ( $return, $msg ) = $new_entry->AddValue(%$value);
+ print "(Error: $msg)\n" unless $return;
+ }
+
+ # apply by default
+ if ( !@queues && !exists $item->{'Queue'} && $item->{LookupType} ) {
+ my $ocf = RT::Model::ObjectCustomField->new($RT::SystemUser);
+ $ocf->create( CustomField => $new_entry->id );
+ }
+
+ for my $q (@queues) {
+ my $q_obj = RT::Model::Queue->new($RT::SystemUser);
+ $q_obj->load($q);
+ unless ( $q_obj->id ) {
+ print "(Error: Could not find queue " . $q . ")\n";
+ next;
+ }
+ my $OCF = RT::Model::ObjectCustomField->new($RT::SystemUser);
+ ( $return, $msg ) = $OCF->create(
+ CustomField => $new_entry->id,
+ ObjectId => $q_obj->id,
+ );
+ print "(Error: $msg)\n" unless $return and $OCF->id;
+ }
+
+ print $new_entry->id. ".";
+ }
+
+ print "done.\n";
+ }
+ if ( @ACL ) {
+ print "Creating ACL...";
+ for my $item (@ACL) {
+
+ my ($princ, $object);
+
+ # Global rights or Queue rights?
+ if ( $item->{'CF'} ) {
+ $object = RT::Model::CustomField->new( $RT::SystemUser );
+ my @columns = ( Name => $item->{'CF'} );
+ push @columns, Queue => $item->{'Queue'} if $item->{'Queue'} and not ref $item->{'Queue'};
+ $object->load_by_name( @columns );
+ } elsif ( $item->{'Queue'} ) {
+ $object = RT::Model::Queue->new($RT::SystemUser);
+ $object->load( $item->{'Queue'} );
+ } else {
+ $object = $RT::System;
+ }
+
+ print "Couldn't load object" and next unless $object and $object->id;
+
+ # Group rights or user rights?
+ if ( $item->{'GroupDomain'} ) {
+ $princ = RT::Model::Group->new($RT::SystemUser);
+ if ( $item->{'GroupDomain'} eq 'UserDefined' ) {
+ $princ->loadUserDefinedGroup( $item->{'GroupId'} );
+ } elsif ( $item->{'GroupDomain'} eq 'SystemInternal' ) {
+ $princ->load_system_internal_group( $item->{'GroupType'} );
+ } elsif ( $item->{'GroupDomain'} eq 'RT::System-Role' ) {
+ $princ->loadSystemRoleGroup( $item->{'GroupType'} );
+ } elsif ( $item->{'GroupDomain'} eq 'RT::Model::Queue-Role' &&
+ $item->{'Queue'} )
+ {
+ $princ->loadQueueRoleGroup( Type => $item->{'GroupType'},
+ Queue => $object->id);
+ } else {
+ $princ->load( $item->{'GroupId'} );
+ }
+ } else {
+ $princ = RT::Model::User->new($RT::SystemUser);
+ $princ->load( $item->{'UserId'} );
+ }
+
+ unless ($princ->id) {
+ Carp::confess("Could not create principal! - ". YAML::Dump($item));
+ }
+
+ # Grant it
+ my ( $return, $msg ) = $princ->PrincipalObj->GrantRight(
+ Right => $item->{'Right'},
+ Object => $object );
+
+ if ( $return ) {
+ print $return. ".";
+ }
+ else {
+ print $msg . ".";
+
+ }
+
+ }
+ print "done.\n";
+ }
+
+ if ( @ScripActions ) {
+ print "Creating ScripActions...";
+
+ for my $item (@ScripActions) {
+ my $new_entry = RT::Model::ScripAction->new($RT::SystemUser);
+ my $return = $new_entry->create(%$item);
+ print $return. ".";
+ }
+
+ print "done.\n";
+ }
+
+ if ( @ScripConditions ) {
+ print "Creating ScripConditions...";
+
+ for my $item (@ScripConditions) {
+ my $new_entry = RT::Model::ScripCondition->new($RT::SystemUser);
+ my $return = $new_entry->create(%$item);
+ print $return. ".";
+ }
+
+ print "done.\n";
+ }
+
+ if ( @Templates ) {
+ print "Creating templates...";
+
+ for my $item (@Templates) {
+ my $new_entry = new RT::Model::Template($RT::SystemUser);
+ my $return = $new_entry->create(%$item);
+ print $return. ".";
+ }
+ print "done.\n";
+ }
+ if ( @Scrips ) {
+ print "Creating scrips...";
+
+ for my $item (@Scrips) {
+ my $new_entry = new RT::Model::Scrip($RT::SystemUser);
+
+ my @queues = ref $item->{'Queue'} eq 'ARRAY'? @{ $item->{'Queue'} }: $item->{'Queue'} || 0;
+ push @queues, 0 unless @queues; # add global queue at least
+
+ foreach my $q ( @queues ) {
+ my ( $return, $msg ) = $new_entry->create( %$item, Queue => $q );
+ if ( $return ) {
+ print $return. ".";
+ }
+ else {
+ print "(Error: $msg)\n";
+ }
+ }
+ }
+ print "done.\n";
+ }
+
+ if ( @Attributes ) {
+ print "Creating predefined searches...";
+
+ use RT::System;
+ my $sys = RT::System->new($RT::SystemUser);
+ for my $item (@Attributes) {
+ my $obj = delete $item->{Object}; # XXX: make this something loadable
+ $obj ||= $sys;
+ my ( $return, $msg ) = $obj->add_attribute (%$item);
+ if ( $return ) {
+ print $return. ".";
+ }
+ else {
+ print "(Error: $msg)\n";
+ }
+ }
+ print "done.\n";
+ }
+ if ( @Final ) {
+ print "Running final actions...\n";
+ for ( @Final ) {
+ eval { $_->(); };
+ print "(Error: $@)\n" if $@;
+ }
+ }
+
+ my $db_type = RT->Config->Get('DatabaseType');
+ print "Done setting up database content.\n";
+}
+
+=head2 ACLEquivGroupId
+
+Given a userid, return that user's acl equivalence group
+
+=cut
+
+sub ACLEquivGroupId {
+ my $username = shift;
+ my $user = RT::Model::User->new($RT::SystemUser);
+ $user->load($username);
+ my $equiv_group = RT::Model::Group->new($RT::SystemUser);
+ $equiv_group->load_acl_equivalence_group($user);
+ return ( $equiv_group->id );
+}
+
+1;
1;
Modified: rt/branches/3.999-DANGEROUS/lib/RT/Dispatcher.pm
==============================================================================
--- rt/branches/3.999-DANGEROUS/lib/RT/Dispatcher.pm (original)
+++ rt/branches/3.999-DANGEROUS/lib/RT/Dispatcher.pm Mon Sep 24 00:16:53 2007
@@ -7,8 +7,13 @@
use RT;
RT->load_config;
+use RT::Interface::Web;
+use RT::Interface::Web::Handler;
+before qr/.*/ => run {
+RT::InitSystemObjects();
+};
after qr/.*/ => run {
RT::Interface::Web::Handler::CleanupRequest()
Modified: rt/branches/3.999-DANGEROUS/lib/RT/Interface/Web.pm
==============================================================================
--- rt/branches/3.999-DANGEROUS/lib/RT/Interface/Web.pm (original)
+++ rt/branches/3.999-DANGEROUS/lib/RT/Interface/Web.pm Mon Sep 24 00:16:53 2007
@@ -65,7 +65,7 @@
use warnings;
package RT::Interface::Web;
-
+use RT::System;
use RT::SavedSearches;
use URI qw();
Modified: rt/branches/3.999-DANGEROUS/lib/RT/Interface/Web/Standalone.pm
==============================================================================
--- rt/branches/3.999-DANGEROUS/lib/RT/Interface/Web/Standalone.pm (original)
+++ rt/branches/3.999-DANGEROUS/lib/RT/Interface/Web/Standalone.pm Mon Sep 24 00:16:53 2007
@@ -74,7 +74,6 @@
Module::Refresh->refresh if RT->Config->Get('DevelMode');
- RT::connect_to_database();
$self->SUPER::handle_request($cgi);
$RT::Logger->crit($@) if ($@);
Modified: rt/branches/3.999-DANGEROUS/lib/RT/Model/ACE.pm
==============================================================================
--- rt/branches/3.999-DANGEROUS/lib/RT/Model/ACE.pm (original)
+++ rt/branches/3.999-DANGEROUS/lib/RT/Model/ACE.pm Mon Sep 24 00:16:53 2007
@@ -706,27 +706,32 @@
sub _ParseObjectArg {
my $self = shift;
- my %args = ( Object => undef,
- ObjectId => undef,
- ObjectType => undef,
- @_ );
+ my %args = (
+ Object => undef,
+ ObjectId => undef,
+ ObjectType => undef,
+ @_
+ );
- if( $args{'Object'} && ($args{'ObjectId'} || $args{'ObjectType'}) ) {
- $RT::Logger->crit( "Method called with an ObjectType or an ObjectId and Object args" );
- return ();
- } elsif( $args{'Object'} && !UNIVERSAL::can($args{'Object'},'id') ) {
- $RT::Logger->crit( "Method called called Object that has no id method" );
- return ();
- } elsif( $args{'Object'} ) {
- my $obj = $args{'Object'};
- return ($obj, ref $obj, $obj->id);
+ if ( $args{'Object'} && ( $args{'ObjectId'} || $args{'ObjectType'} ) ) {
+ $RT::Logger->crit(
+ "Method called with an ObjectType or an ObjectId and Object args"
+ );
+ return ();
+ } elsif ( $args{'Object'} && !UNIVERSAL::can( $args{'Object'}, 'id' ) ) {
+ $RT::Logger->crit( "Method called called Object that has no id method");
+ return ();
+ } elsif ( $args{'Object'} ) {
+ my $obj = $args{'Object'};
+ return ( $obj, ref $obj, $obj->id );
} elsif ( $args{'ObjectType'} ) {
- my $obj = $args{'ObjectType'}->new( $self->current_user );
- $obj->load( $args{'ObjectId'} );
- return ($obj, ref $obj, $obj->id);
+ my $obj = $args{'ObjectType'}->new( $self->current_user );
+ $obj->load( $args{'ObjectId'} );
+ return ( $obj, ref $obj, $obj->id );
} else {
- $RT::Logger->crit( "Method called with wrong args" );
- return ();
+ Carp::confess;
+ $RT::Logger->crit("Method called with wrong args");
+ return ();
}
}
Modified: rt/branches/3.999-DANGEROUS/lib/RT/Model/ACECollection.pm
==============================================================================
--- rt/branches/3.999-DANGEROUS/lib/RT/Model/ACECollection.pm (original)
+++ rt/branches/3.999-DANGEROUS/lib/RT/Model/ACECollection.pm Mon Sep 24 00:16:53 2007
@@ -63,10 +63,10 @@
=cut
-package RT::Model::ACECollection;
-
use strict;
-no warnings qw(redefine);
+use warnings;
+package RT::Model::ACECollection;
+use base qw/RT::SearchBuilder/;
=head2 Next
Modified: rt/branches/3.999-DANGEROUS/lib/RT/Model/Attribute.pm
==============================================================================
--- rt/branches/3.999-DANGEROUS/lib/RT/Model/Attribute.pm (original)
+++ rt/branches/3.999-DANGEROUS/lib/RT/Model/Attribute.pm Mon Sep 24 00:16:53 2007
@@ -45,10 +45,12 @@
# those contributions and any derivatives thereof.
#
# END BPS TAGGED BLOCK }}}
-package RT::Model::Attribute;
+
+use warnings;
use strict;
-no warnings qw(redefine);
+package RT::Model::Attribute;
+
use Storable qw/nfreeze thaw/;
use MIME::Base64;
@@ -70,7 +72,7 @@
=head1 NAME
- RT::Model::Attribute_Overlay
+ RT::Model::Attribute
=head1 Content
Modified: rt/branches/3.999-DANGEROUS/lib/RT/Model/CustomFieldValueCollection.pm
==============================================================================
--- rt/branches/3.999-DANGEROUS/lib/RT/Model/CustomFieldValueCollection.pm (original)
+++ rt/branches/3.999-DANGEROUS/lib/RT/Model/CustomFieldValueCollection.pm Mon Sep 24 00:16:53 2007
@@ -45,11 +45,13 @@
# those contributions and any derivatives thereof.
#
# END BPS TAGGED BLOCK }}}
-package RT::Model::CustomFieldValueCollection;
use strict;
use warnings;
-no warnings qw(redefine);
+
+package RT::Model::CustomFieldValueCollection;
+
+use base qw/RT::SearchBuilder/;
# {{{ sub limit_to_custom_field
Modified: rt/branches/3.999-DANGEROUS/lib/RT/Model/Group.pm
==============================================================================
--- rt/branches/3.999-DANGEROUS/lib/RT/Model/Group.pm (original)
+++ rt/branches/3.999-DANGEROUS/lib/RT/Model/Group.pm Mon Sep 24 00:16:53 2007
@@ -497,7 +497,6 @@
PrincipalId => $self->current_user->PrincipalId,
@_
);
-
if ( $self->current_user->PrincipalId == $args{'PrincipalId'} ) {
unless ( $self->current_user_has_right('AdminOwnPersonalGroups') ) {
Modified: rt/branches/3.999-DANGEROUS/lib/RT/Model/ObjectCustomFieldCollection.pm
==============================================================================
--- rt/branches/3.999-DANGEROUS/lib/RT/Model/ObjectCustomFieldCollection.pm (original)
+++ rt/branches/3.999-DANGEROUS/lib/RT/Model/ObjectCustomFieldCollection.pm Mon Sep 24 00:16:53 2007
@@ -45,10 +45,11 @@
# those contributions and any derivatives thereof.
#
# END BPS TAGGED BLOCK }}}
-package RT::Model::ObjectCustomFieldCollection;
+use warnings;
use strict;
-no warnings qw(redefine);
+package RT::Model::ObjectCustomFieldCollection;
+use base qw/RT::SearchBuilder/;
sub limit_to_custom_field {
my $self = shift;
Modified: rt/branches/3.999-DANGEROUS/lib/RT/Model/TicketCollection.pm
==============================================================================
--- rt/branches/3.999-DANGEROUS/lib/RT/Model/TicketCollection.pm (original)
+++ rt/branches/3.999-DANGEROUS/lib/RT/Model/TicketCollection.pm Mon Sep 24 00:16:53 2007
@@ -201,7 +201,6 @@
sub can_bundle { return \%can_bundle }
# Bring in the clowns.
-require RT::Model::TicketCollection_Overlay_SQL;
# {{{ sub SortFields
@@ -2869,6 +2868,348 @@
$self->redo_search();
}
+
+
+
+use RT::SQL;
+
+# Import configuration data from the lexcial scope of __PACKAGE__ (or
+# at least where those two Subroutines are defined.)
+
+
+# Lower Case version of columns, for case insensitivity
+my %lcfields = map { ( lc($_) => $_ ) } (keys %FIELD_METADATA);
+
+sub _initSQL {
+ my $self = shift;
+
+ # Private Member Variables (which should get cleaned)
+ $self->{'_sql_transalias'} = undef;
+ $self->{'_sql_trattachalias'} = undef;
+ $self->{'_sql_cf_alias'} = undef;
+ $self->{'_sql_object_cfv_alias'} = undef;
+ $self->{'_sql_watcher_join_users_alias'} = undef;
+ $self->{'_sql_query'} = '';
+ $self->{'_sql_looking_at'} = {};
+}
+
+sub _sql_limit {
+ my $self = shift;
+ my %args = (@_);
+ if ($args{'column'} eq 'EffectiveId' &&
+ (!$args{'alias'} || $args{'alias'} eq 'main' ) ) {
+ $self->{'looking_at_effective_id'} = 1;
+ }
+
+ if ($args{'column'} eq 'Type' &&
+ (!$args{'alias'} || $args{'alias'} eq 'main' ) ) {
+ $self->{'looking_at_type'} = 1;
+ }
+
+ # All SQL stuff goes into one SB subclause so we can deal with all
+ # the aggregation
+ $self->SUPER::limit(%args,
+ subclause => 'ticketsql');
+}
+
+sub _sql_join {
+ # All SQL stuff goes into one SB subclause so we can deal with all
+ # the aggregation
+ my $this = shift;
+
+ $this->join(@_,
+ subclause => 'ticketsql');
+}
+
+# Helpers
+sub open_paren {
+ $_[0]->SUPER::open_paren( 'ticketsql' );
+}
+sub close_paren {
+ $_[0]->SUPER::close_paren( 'ticketsql' );
+}
+
+=head1 SQL Functions
+
+=cut
+
+=head2 Robert's Simple SQL Parser
+
+Documentation In Progress
+
+The Parser/Tokenizer is a relatively simple state machine that scans through a SQL WHERE clause type string extracting a token at a time (where a token is:
+
+ value -> quoted string or number
+ AGGREGator -> AND or OR
+ KEYWORD -> quoted string or single word
+ OPerator -> =,!=,LIKE,etc..
+ PARENthesis -> open or close.
+
+And that stream of tokens is passed through the "machine" in order to build up a structure that looks like:
+
+ KEY OP value
+ AND KEY OP value
+ OR KEY OP value
+
+That also deals with parenthesis for nesting. (The parentheses are
+just handed off the SearchBuilder)
+
+=cut
+
+sub _close_bundle {
+ my ($self, @bundle) = @_;
+ return unless @bundle;
+
+ if ( @bundle == 1 ) {
+ $bundle[0]->{'dispatch'}->(
+ $self,
+ $bundle[0]->{'key'},
+ $bundle[0]->{'op'},
+ $bundle[0]->{'val'},
+ subclause => '',
+ entry_aggregator => $bundle[0]->{ea},
+ subkey => $bundle[0]->{subkey},
+ );
+ }
+ else {
+ my @args;
+ foreach my $chunk (@bundle) {
+ push @args, [
+ $chunk->{key},
+ $chunk->{op},
+ $chunk->{val},
+ subclause => '',
+ entry_aggregator => $chunk->{ea},
+ subkey => $chunk->{subkey},
+ ];
+ }
+ $bundle[0]->{dispatch}->( $self, \@args );
+ }
+}
+
+sub _parser {
+ my ($self,$string) = @_;
+ my @bundle;
+ my $ea = '';
+
+ my %callback;
+ $callback{'open_paren'} = sub {
+ $self->_close_bundle(@bundle); @bundle = ();
+ $self->open_paren
+ };
+ $callback{'close_paren'} = sub {
+ $self->_close_bundle(@bundle); @bundle = ();
+ $self->close_paren;
+ };
+ $callback{'entry_aggregator'} = sub { $ea = $_[0] || '' };
+ $callback{'Condition'} = sub {
+ my ($key, $op, $value) = @_;
+
+ # key has dot then it's compound variant and we have subkey
+ my $subkey = '';
+ ($key, $subkey) = ($1, $2) if $key =~ /^([^\.]+)\.(.+)$/;
+
+ # normalize key and get class (type)
+ my $class;
+ if (exists $lcfields{lc $key}) {
+ $key = $lcfields{lc $key};
+ $class = $FIELD_METADATA{$key}->[0];
+ }
+ die "Unknown field '$key' in '$string'" unless $class;
+
+
+ unless( $dispatch{ $class } ) {
+ die "No dispatch method for class '$class'"
+ }
+ my $sub = $dispatch{ $class };
+
+ if ( $can_bundle{ $class }
+ && ( !@bundle
+ || ( $bundle[-1]->{dispatch} == $sub
+ && $bundle[-1]->{key} eq $key
+ && $bundle[-1]->{subkey} eq $subkey
+ )
+ )
+ )
+ {
+ push @bundle, {
+ dispatch => $sub,
+ key => $key,
+ op => $op,
+ val => $value,
+ ea => $ea,
+ subkey => $subkey,
+ };
+ }
+ else {
+ $self->_close_bundle(@bundle); @bundle = ();
+ $sub->( $self, $key, $op, $value,
+ subclause => '', # don't need anymore
+ entry_aggregator => $ea,
+ subkey => $subkey,
+ );
+ }
+ $self->{_sql_looking_at}{lc $key} = 1;
+ $ea = '';
+ };
+ RT::SQL::Parse($string, \%callback);
+ $self->_close_bundle(@bundle); @bundle = ();
+}
+
+=head2 ClausesToSQL
+
+=cut
+
+sub ClausesToSQL {
+ my $self = shift;
+ my $clauses = shift;
+ my @sql;
+
+ for my $f (keys %{$clauses}) {
+ my $sql;
+ my $first = 1;
+
+ # Build SQL from the data hash
+ for my $data ( @{ $clauses->{$f} } ) {
+ $sql .= $data->[0] unless $first; $first=0; # entry_aggregator
+ $sql .= " '". $data->[2] . "' "; # column
+ $sql .= $data->[3] . " "; # operator
+ $sql .= "'". $data->[4] . "' "; # value
+ }
+
+ push @sql, " ( " . $sql . " ) ";
+ }
+
+ return join("AND", at sql);
+}
+
+=head2 from_sql
+
+Convert a RT-SQL string into a set of SearchBuilder restrictions.
+
+Returns (1, 'Status message') on success and (0, 'Error Message') on
+failure.
+
+
+
+
+=cut
+
+sub from_sql {
+ my ($self,$query) = @_;
+
+ {
+ # preserve first_row and show_rows across the clean_slate
+ local ($self->{'first_row'}, $self->{'show_rows'});
+ $self->clean_slate;
+ }
+ $self->_initSQL();
+
+ return (1, $self->loc("No Query")) unless $query;
+
+ $self->{_sql_query} = $query;
+ eval { $self->_parser( $query ); };
+ if ( $@ ) {
+ $RT::Logger->error( $@ );
+ return (0, $@);
+ }
+
+ # We only want to look at EffectiveId's (mostly) for these searches.
+ unless ( exists $self->{_sql_looking_at}{'effectiveid'} ) {
+ #TODO, we shouldn't be hard #coding the tablename to main.
+ $self->SUPER::limit( column => 'EffectiveId',
+ value => 'main.id',
+ entry_aggregator => 'AND',
+ quote_value => 0,
+ );
+ }
+ # FIXME: Need to bring this logic back in
+
+ # if ($self->_isLimited && (! $self->{'looking_at_effective_id'})) {
+ # $self->SUPER::limit( column => 'EffectiveId',
+ # operator => '=',
+ # quote_value => 0,
+ # value => 'main.id'); #TODO, we shouldn't be hard coding the tablename to main.
+ # }
+ # --- This is hardcoded above. This comment block can probably go.
+ # Or, we need to reimplement the looking_at_effective_id toggle.
+
+ # Unless we've explicitly asked to look at a specific Type, we need
+ # to limit to it.
+ unless ( $self->{looking_at_type} ) {
+ $self->SUPER::limit( column => 'Type', value => 'ticket' );
+ }
+
+ # We don't want deleted tickets unless 'allow_deleted_search' is set
+ unless( $self->{'allow_deleted_search'} ) {
+ $self->SUPER::limit( column => 'Status',
+ operator => '!=',
+ value => 'deleted',
+ );
+ }
+
+ # set SB's dirty flag
+ $self->{'must_redo_search'} = 1;
+ $self->{'RecalcTicketLimits'} = 0;
+
+ return (1, $self->loc("Valid Query"));
+}
+
+=head2 Query
+
+Returns the query that this object was initialized with
+
+=cut
+
+sub Query {
+ return ($_[0]->{_sql_query});
+}
+
+
+
+1;
+
+=pod
+
+=head2 Exceptions
+
+Most of the RT code does not use Exceptions (die/eval) but it is used
+in the TicketSQL code for simplicity and historical reasons. Lest you
+be worried that the dies will trigger user visible errors, all are
+trapped via evals.
+
+99% of the dies fall in subroutines called via from_sql and then parse.
+(This includes all of the _FooLimit routines in TicketCollection_Overlay.pm.)
+The other 1% or so are via _ProcessRestrictions.
+
+All dies are trapped by eval {}s, and will be logged at the 'error'
+log level. The general failure mode is to not display any tickets.
+
+=head2 General Flow
+
+Legacy Layer:
+
+ Legacy LimitFoo routines build up a RestrictionsHash
+
+ _ProcessRestrictions converts the Restrictions to Clauses
+ ([key,op,val,rest]).
+
+ Clauses are converted to RT-SQL (TicketSQL)
+
+New RT-SQL Layer:
+
+ from_sql calls the parser
+
+ The parser calls the _FooLimit routines to do Jifty::DBI
+ limits.
+
+And then the normal SearchBuilder/Ticket routines are used for
+display/navigation.
+
+=cut
+
+
+
=head1 FLAGS
RT::Model::TicketCollection supports several flags which alter search behavior:
Modified: rt/branches/3.999-DANGEROUS/lib/RT/Model/User.pm
==============================================================================
--- rt/branches/3.999-DANGEROUS/lib/RT/Model/User.pm (original)
+++ rt/branches/3.999-DANGEROUS/lib/RT/Model/User.pm Mon Sep 24 00:16:53 2007
@@ -26,8 +26,6 @@
use Digest::MD5;
-use RT::Model::PrincipalCollection;
-use RT::Model::ACE;
use RT::Interface::Email;
use Encode;
@@ -101,6 +99,7 @@
my $record_transaction = delete $args{'_RecordTransaction'};
#Check the ACL
+ Carp::confess unless($self->current_user);
unless ( $self->current_user->has_right(Right => 'AdminUsers', Object => $RT::System) ) {
return ( 0, $self->loc('No permission to create users') );
}
@@ -1087,6 +1086,7 @@
my $obj = RT::Model::Principal->new( $self->current_user );
$obj->load_by_id( $self->id );
unless ( $obj->id && $obj->PrincipalType eq 'User' ) {
+ Carp::cluck;
$RT::Logger->crit( 'Wrong principal for user #'. $self->id );
} else {
$self->{'PrincipalObj'} = $obj;
Modified: rt/branches/3.999-DANGEROUS/lib/RT/Record.pm
==============================================================================
--- rt/branches/3.999-DANGEROUS/lib/RT/Record.pm (original)
+++ rt/branches/3.999-DANGEROUS/lib/RT/Record.pm Mon Sep 24 00:16:53 2007
@@ -72,15 +72,15 @@
use Encode qw();
our $_TABLE_ATTR = { };
-use base qw(RT::Base);
use base qw(Jifty::Record);
+use base qw(RT::Base);
# {{{ sub _init
sub new {
my $class = shift;
my $self = $class->SUPER::new(handle => Jifty->handle, current_user => $_[0]);
- $self->current_user(@_) if (UNIVERSAL::isa($_[0], "RT::CurrentUser"));
+ $self->current_user(@_) if (UNIVERSAL::isa($_[0], "RT::Model::User") || UNIVERSAL::isa($_[0],'RT::CurrentUser'));
$self->_init(@_);
return $self;
}
@@ -93,10 +93,7 @@
$class =~ s/^(.*):://g;
return $class;
}
-
-sub _init {
- my $self = shift;
-}
+sub _init{}
sub __set {
my $self = shift;
@@ -174,7 +171,7 @@
my $self = shift;
unless ($self->{'attributes'}) {
- $self->{'attributes'} = RT::Model::AttributeCollection->new($self->current_user);
+ $self->{'attributes'} = RT::Model::AttributeCollection->new( $self->current_user);
$self->{'attributes'}->LimitToObject($self);
}
return ($self->{'attributes'});
@@ -266,12 +263,6 @@
}
-# {{{ sub _Handle
-sub _Handle { return Jifty->handle }
-sub _handle { return Jifty->handle }
-
-# }}}
-
# {{{ sub create
=head2 Create PARAMHASH
Modified: rt/branches/3.999-DANGEROUS/lib/RT/SavedSearches.pm
==============================================================================
--- rt/branches/3.999-DANGEROUS/lib/RT/SavedSearches.pm (original)
+++ rt/branches/3.999-DANGEROUS/lib/RT/SavedSearches.pm Mon Sep 24 00:16:53 2007
@@ -165,7 +165,7 @@
my $self = shift;
my $CurrentUser = $self->current_user;
- my $groups = RT::Model::GroupCollection->new(current_user => );
+ my $groups = RT::Model::GroupCollection->new($self->current_user );
$groups->LimitToUserDefinedGroups;
$groups->WithMember( PrincipalId => $CurrentUser->id,
Recursively => 1 );
@@ -173,9 +173,4 @@
return ( $CurrentUser->UserObj, @{ $groups->items_array_ref() } );
}
-eval "require RT::SavedSearches_Vendor";
-die $@ if ($@ && $@ !~ qr{^Can't locate RT/SavedSearches_Vendor.pm});
-eval "require RT::SavedSearches_Local";
-die $@ if ($@ && $@ !~ qr{^Can't locate RT/SavedSearches_Local.pm});
-
1;
Modified: rt/branches/3.999-DANGEROUS/lib/RT/ScripAction/AutoOpen.pm
==============================================================================
--- rt/branches/3.999-DANGEROUS/lib/RT/ScripAction/AutoOpen.pm (original)
+++ rt/branches/3.999-DANGEROUS/lib/RT/ScripAction/AutoOpen.pm Mon Sep 24 00:16:53 2007
@@ -96,9 +96,5 @@
return 1;
}
-eval "require RT::ScripAction::AutoOpen_Vendor";
-die $@ if ($@ && $@ !~ qr{^Can't locate RT/Action/AutoOpen_Vendor.pm});
-eval "require RT::ScripAction::AutoOpen_Local";
-die $@ if ($@ && $@ !~ qr{^Can't locate RT/Action/AutoOpen_Local.pm});
1;
Modified: rt/branches/3.999-DANGEROUS/lib/RT/ScripAction/Autoreply.pm
==============================================================================
--- rt/branches/3.999-DANGEROUS/lib/RT/ScripAction/Autoreply.pm (original)
+++ rt/branches/3.999-DANGEROUS/lib/RT/ScripAction/Autoreply.pm Mon Sep 24 00:16:53 2007
@@ -132,9 +132,4 @@
# }}}
-eval "require RT::ScripAction::Autoreply_Vendor";
-die $@ if ($@ && $@ !~ qr{^Can't locate RT/Action/Autoreply_Vendor.pm});
-eval "require RT::ScripAction::Autoreply_Local";
-die $@ if ($@ && $@ !~ qr{^Can't locate RT/Action/Autoreply_Local.pm});
-
1;
Modified: rt/branches/3.999-DANGEROUS/lib/RT/ScripAction/CreateTickets.pm
==============================================================================
--- rt/branches/3.999-DANGEROUS/lib/RT/ScripAction/CreateTickets.pm (original)
+++ rt/branches/3.999-DANGEROUS/lib/RT/ScripAction/CreateTickets.pm Mon Sep 24 00:16:53 2007
@@ -1237,10 +1237,5 @@
}
-eval "require RT::ScripAction::CreateTickets_Vendor";
-die $@ if ( $@ && $@ !~ qr{^Can't locate RT/Action/CreateTickets_Vendor.pm} );
-eval "require RT::ScripAction::CreateTickets_Local";
-die $@ if ( $@ && $@ !~ qr{^Can't locate RT/Action/CreateTickets_Local.pm} );
-
1;
Modified: rt/branches/3.999-DANGEROUS/lib/RT/ScripAction/EscalatePriority.pm
==============================================================================
--- rt/branches/3.999-DANGEROUS/lib/RT/ScripAction/EscalatePriority.pm (original)
+++ rt/branches/3.999-DANGEROUS/lib/RT/ScripAction/EscalatePriority.pm Mon Sep 24 00:16:53 2007
@@ -159,9 +159,5 @@
}
}
-eval "require RT::ScripAction::EscalatePriority_Vendor";
-die $@ if ($@ && $@ !~ qr{^Can't locate RT/Action/EscalatePriority_Vendor.pm});
-eval "require RT::ScripAction::EscalatePriority_Local";
-die $@ if ($@ && $@ !~ qr{^Can't locate RT/Action/EscalatePriority_Local.pm});
1;
Modified: rt/branches/3.999-DANGEROUS/lib/RT/ScripAction/Generic.pm
==============================================================================
--- rt/branches/3.999-DANGEROUS/lib/RT/ScripAction/Generic.pm (original)
+++ rt/branches/3.999-DANGEROUS/lib/RT/ScripAction/Generic.pm Mon Sep 24 00:16:53 2007
@@ -218,9 +218,4 @@
# }}}
-eval "require RT::ScripAction::Generic_Vendor";
-die $@ if ($@ && $@ !~ qr{^Can't locate RT/Action/Generic_Vendor.pm});
-eval "require RT::ScripAction::Generic_Local";
-die $@ if ($@ && $@ !~ qr{^Can't locate RT/Action/Generic_Local.pm});
-
1;
Modified: rt/branches/3.999-DANGEROUS/lib/RT/ScripAction/Notify.pm
==============================================================================
--- rt/branches/3.999-DANGEROUS/lib/RT/ScripAction/Notify.pm (original)
+++ rt/branches/3.999-DANGEROUS/lib/RT/ScripAction/Notify.pm Mon Sep 24 00:16:53 2007
@@ -158,9 +158,4 @@
}
-eval "require RT::ScripAction::Notify_Vendor";
-die $@ if ($@ && $@ !~ qr{^Can't locate RT/Action/Notify_Vendor.pm});
-eval "require RT::ScripAction::Notify_Local";
-die $@ if ($@ && $@ !~ qr{^Can't locate RT/Action/Notify_Local.pm});
-
1;
Modified: rt/branches/3.999-DANGEROUS/lib/RT/ScripAction/NotifyAsComment.pm
==============================================================================
--- rt/branches/3.999-DANGEROUS/lib/RT/ScripAction/NotifyAsComment.pm (original)
+++ rt/branches/3.999-DANGEROUS/lib/RT/ScripAction/NotifyAsComment.pm Mon Sep 24 00:16:53 2007
@@ -70,10 +70,5 @@
return($self->SUPER::set_ReturnAddress(is_comment => 1));
}
-eval "require RT::ScripAction::NotifyAsComment_Vendor";
-die $@ if ($@ && $@ !~ qr{^Can't locate RT/Action/NotifyAsComment_Vendor.pm});
-eval "require RT::ScripAction::NotifyAsComment_Local";
-die $@ if ($@ && $@ !~ qr{^Can't locate RT/Action/NotifyAsComment_Local.pm});
-
1;
Modified: rt/branches/3.999-DANGEROUS/lib/RT/ScripAction/RecordComment.pm
==============================================================================
--- rt/branches/3.999-DANGEROUS/lib/RT/ScripAction/RecordComment.pm (original)
+++ rt/branches/3.999-DANGEROUS/lib/RT/ScripAction/RecordComment.pm Mon Sep 24 00:16:53 2007
@@ -112,9 +112,5 @@
}
-eval "require RT::ScripAction::RecordComment_Vendor";
-die $@ if ($@ && $@ !~ qr{^Can't locate RT/Action/RecordComment_Vendor.pm});
-eval "require RT::ScripAction::RecordComment_Local";
-die $@ if ($@ && $@ !~ qr{^Can't locate RT/Action/RecordComment_Local.pm});
1;
Modified: rt/branches/3.999-DANGEROUS/lib/RT/ScripAction/RecordCorrespondence.pm
==============================================================================
--- rt/branches/3.999-DANGEROUS/lib/RT/ScripAction/RecordCorrespondence.pm (original)
+++ rt/branches/3.999-DANGEROUS/lib/RT/ScripAction/RecordCorrespondence.pm Mon Sep 24 00:16:53 2007
@@ -113,9 +113,5 @@
}
-eval "require RT::ScripAction::RecordCorrespondence_Vendor";
-die $@ if ($@ && $@ !~ qr{^Can't locate RT/Action/RecordCorrespondence_Vendor.pm});
-eval "require RT::ScripAction::RecordCorrespondence_Local";
-die $@ if ($@ && $@ !~ qr{^Can't locate RT/Action/RecordCorrespondence_Local.pm});
1;
Modified: rt/branches/3.999-DANGEROUS/lib/RT/ScripAction/SetPriority.pm
==============================================================================
--- rt/branches/3.999-DANGEROUS/lib/RT/ScripAction/SetPriority.pm (original)
+++ rt/branches/3.999-DANGEROUS/lib/RT/ScripAction/SetPriority.pm Mon Sep 24 00:16:53 2007
@@ -79,9 +79,5 @@
}
-eval "require RT::ScripAction::SetPriority_Vendor";
-die $@ if ($@ && $@ !~ qr{^Can't locate RT/Action/SetPriority_Vendor.pm});
-eval "require RT::ScripAction::SetPriority_Local";
-die $@ if ($@ && $@ !~ qr{^Can't locate RT/Action/SetPriority_Local.pm});
1;
Modified: rt/branches/3.999-DANGEROUS/lib/RT/ScripAction/UserDefined.pm
==============================================================================
--- rt/branches/3.999-DANGEROUS/lib/RT/ScripAction/UserDefined.pm (original)
+++ rt/branches/3.999-DANGEROUS/lib/RT/ScripAction/UserDefined.pm Mon Sep 24 00:16:53 2007
@@ -86,10 +86,6 @@
return ($retval);
}
-eval "require RT::ScripAction::UserDefined_Vendor";
-die $@ if ($@ && $@ !~ qr{^Can't locate RT/Action/UserDefined_Vendor.pm});
-eval "require RT::ScripAction::UserDefined_Local";
-die $@ if ($@ && $@ !~ qr{^Can't locate RT/Action/UserDefined_Local.pm});
1;
Modified: rt/branches/3.999-DANGEROUS/lib/RT/SearchBuilder.pm
==============================================================================
--- rt/branches/3.999-DANGEROUS/lib/RT/SearchBuilder.pm (original)
+++ rt/branches/3.999-DANGEROUS/lib/RT/SearchBuilder.pm Mon Sep 24 00:16:53 2007
@@ -72,24 +72,28 @@
sub new {
my $self = shift->SUPER::new();
- $self->_set_current_user(@_);
+ $self->_set_current_user(@_) if ($_[0]);
$self->_init();
return $self;
}
sub _handle {
+ return Jifty->handle
+}
- return RT->DatabaseHandle;
+sub current_user {
+ shift->{'user'};
}
+
# {{{ sub _init
sub _set_current_user {
my $self = shift;
-
$self->{'user'} = shift;
+
unless(defined($self->current_user)) {
use Carp;
- Carp::confess("$self was Created without a CurrentUser");
+ Carp::confess("$self was Created without a CurrentUser" . join(',', at _));
$RT::Logger->err("$self was Created without a CurrentUser");
return(0);
}
Modified: rt/branches/3.999-DANGEROUS/lib/RT/System.pm
==============================================================================
--- rt/branches/3.999-DANGEROUS/lib/RT/System.pm (original)
+++ rt/branches/3.999-DANGEROUS/lib/RT/System.pm Mon Sep 24 00:16:53 2007
@@ -1,50 +1,4 @@
-# BEGIN BPS TAGGED BLOCK {{{
-#
-# COPYRIGHT:
-#
-# This software is Copyright (c) 1996-2007 Best Practical Solutions, LLC
-# <jesse at bestpractical.com>
-#
-# (Except where explicitly superseded by other copyright notices)
-#
-#
-# LICENSE:
-#
-# This work is made available to you under the terms of Version 2 of
-# the GNU General Public License. A copy of that license should have
-# been provided with this software, but in any event can be snarfed
-# from www.gnu.org.
-#
-# This work 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
-# General Public License for more details.
-#
-# You should have received a copy of the GNU General Public License
-# along with this program; if not, write to the Free Software
-# Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
-# 02110-1301 or visit their web page on the internet at
-# http://www.gnu.org/copyleft/gpl.html.
-#
-#
-# CONTRIBUTION SUBMISSION POLICY:
-#
-# (The following paragraph is not intended to limit the rights granted
-# to you to modify and distribute this software under the terms of
-# the GNU General Public License and is only of importance to you if
-# you choose to contribute your changes and enhancements to the
-# community by submitting them to Best Practical Solutions, LLC.)
-#
-# By intentionally submitting any modifications, corrections or
-# derivatives to this work, or any other work intended for use with
-# Request Tracker, to Best Practical Solutions, LLC, you confirm that
-# you are the copyright holder for those contributions and you grant
-# Best Practical Solutions, LLC a nonexclusive, worldwide, irrevocable,
-# royalty-free, perpetual, license to use, copy, create derivative
-# works based on those contributions, and sublicense and distribute
-# those contributions and any derivatives thereof.
-#
-# END BPS TAGGED BLOCK }}}
+
=head1 NAME
RT::System
@@ -63,13 +17,24 @@
=cut
+use warnings;
+use strict;
package RT::System;
-use base qw /RT::Record/;
-use strict;
+use base qw/RT::Record/;
+
+sub new {
+ my $class = shift;
+ my $self = {};
+ bless $self, $class;
+ return $self;
+
+ }
+
+
+our $RIGHTS;
use RT::Model::ACECollection;
-use vars qw/ $RIGHTS/;
# System rights are rights granted to the whole system
# XXX TODO Can't localize these outside of having an object around.
@@ -125,11 +90,6 @@
return(\%rights);
}
-sub _init {
- my $self = shift;
- $self->SUPER::_init (@_) if @_ && $_[0];
-}
-
=head2 id
Returns RT::System's id. It's 1.
@@ -140,26 +100,9 @@
=cut
*Id = \&id;
-
-sub id {
- return (1);
-}
-
-=head2 Load
-
-Since this object is pretending to be an RT::Record, we need a load method.
-It does nothing
-
-=cut
-
-sub load {
- return (1);
-}
-
-sub Name {
- return 'RT System';
-}
-
+sub id { return (1); }
+sub load { return (1); }
+sub Name { return 'RT System'; }
sub __set { 0 }
sub __value { 0 }
sub create { 0 }
Modified: rt/branches/3.999-DANGEROUS/lib/RT/Test.pm
==============================================================================
--- rt/branches/3.999-DANGEROUS/lib/RT/Test.pm (original)
+++ rt/branches/3.999-DANGEROUS/lib/RT/Test.pm Mon Sep 24 00:16:53 2007
@@ -1,54 +1,43 @@
-package RT::Test;
use strict;
use warnings;
+package RT::Test;
+use base qw/Jifty::Test/;
use Test::More;
-
use File::Temp;
my $config;
our ($existing_server, $port);
my $mailsent;
-BEGIN {
- # TODO: allocate a port dynamically
- if ( my $test_server = $ENV{'RT_TEST_SERVER'} ) {
- my ($host, $test_port) = split(':', $test_server, 2);
- $port = $test_port || 80;
- $existing_server = "http://$host:$port";
- }
- else {
- $port = 11229;
- }
-};
-
-use RT::Interface::Web::Standalone;
-use Test::HTTP::Server::Simple;
-use Test::WWW::Mechanize;
-
-unshift @RT::Interface::Web::Standalone::ISA, 'Test::HTTP::Server::Simple';
-
my @server;
sub import {
my $class = shift;
my %args = @_;
+ $class->_setup_config(%args);
+ $class->SUPER::import(@_);
+ RT::InitSystemObjects();
+}
+
+sub _setup_config {
+ my $class = shift;
+ my %args = (@_);
+ require RT;
+ RT->load_config();
+ my $port = 999;
$config = File::Temp->new;
print $config qq{
set( \$WebPort , $port);
set( \$WebBaseURL , "http://localhost:\$WebPort");
-set( \$DatabaseName , "rt3test");
-set( \$LogToSyslog , undef);
-set( \$LogToScreen , "warning");
+set( \$LogToScreen , "debug");
};
print $config $args{'config'} if $args{'config'};
print $config "\n1;\n";
$ENV{'RT_SITE_CONFIG'} = $config->filename;
close $config;
- use RT;
- RT::load_config;
if (RT->Config->Get('DevelMode')) { require Module::Refresh; }
# make it another function
@@ -59,62 +48,8 @@
return 1;
};
RT::Config->set( 'MailCommand' => $mailfunc);
-
- require RT::Handle;
- unless ( $existing_server ) {
- $class->bootstrap_db( %args );
- }
-
- RT->Init;
}
-
-sub bootstrap_db {
- my $self = shift;
- my %args = @_;
-
- unless (defined $ENV{'RT_DBA_USER'} && defined $ENV{'RT_DBA_PASSWORD'}) {
- die "RT_DBA_USER and RT_DBA_PASSWORD environment variables need to be set in order to run 'make test'";
- }
- # bootstrap with dba cred
- my $dbh = _get_dbh(RT::Handle->system_dsn,
- $ENV{RT_DBA_USER}, $ENV{RT_DBA_PASSWORD});
-
-
- RT::Handle->DropDatabase( $dbh, Force => 1 );
- RT::Handle->CreateDatabase( $dbh );
- $dbh->disconnect;
-
- $dbh = _get_dbh(RT::Handle->dsn,
- $ENV{RT_DBA_USER}, $ENV{RT_DBA_PASSWORD});
-
- Jifty->handle = new RT::Handle;
- Jifty->handle->dbh( $dbh );
- Jifty->handle->InsertSchema( $dbh );
-
- my $db_type = RT->Config->Get('DatabaseType');
- Jifty->handle->InsertACL( $dbh ) unless $db_type eq 'Oracle';
-
- Jifty->handle = new RT::Handle;
- Jifty->handle->dbh( undef );
- RT->connect_to_database;
- RT->InitLogging;
- RT->InitSystemObjects;
- Jifty->handle->InsertInitialData;
-
- Jifty::DBI::Record::Cachable->flush_cache;
- Jifty->handle = new RT::Handle;
- Jifty->handle->dbh( undef );
- RT->Init;
-
- Jifty->handle->print_error;
- Jifty->handle->dbh->{PrintError} = 1;
-
- unless ( $args{'nodata'} ) {
- Jifty->handle->InsertData( $RT::EtcPath . "/initialdata" );
- }
- Jifty::DBI::Record::Cachable->flush_cache;
-}
-
+our $server_url;
sub started_ok {
require RT::Test::Web;
if ( $existing_server ) {
@@ -122,26 +57,10 @@
warn $existing_server;
return ($existing_server, RT::Test::Web->new);
}
- my $s = RT::Interface::Web::Standalone->new($port);
- push @server, $s;
- my $ret = $s->started_ok;
- Jifty->handle = new RT::Handle;
- Jifty->handle->dbh( undef );
- RT->connect_to_database;
- return ($ret, RT::Test::Web->new);
-}
+ my $server = Jifty::Test->make_server;
+ $RT::Test::server_url = $server->started_ok."/";
-sub _get_dbh {
- my ($dsn, $user, $pass) = @_;
- my $dbh = DBI->connect(
- $dsn, $user, $pass,
- { RaiseError => 0, PrintError => 1 },
- );
- unless ( $dbh ) {
- my $msg = "Failed to connect to $dsn as user '$user': ". $DBI::errstr;
- print STDERR $msg; exit -1;
- }
- return $dbh;
+ return ($RT::Test::server_url, RT::Test::Web->new);
}
sub open_mailgate_ok {
Modified: rt/branches/3.999-DANGEROUS/lib/RT/Test/Web.pm
==============================================================================
--- rt/branches/3.999-DANGEROUS/lib/RT/Test/Web.pm (original)
+++ rt/branches/3.999-DANGEROUS/lib/RT/Test/Web.pm Mon Sep 24 00:16:53 2007
@@ -3,7 +3,7 @@
use strict;
use warnings;
-use base qw(Test::WWW::Mechanize);
+use base qw(Jifty::Test::WWW::Mechanize);
require RT::Test;
require Test::More;
@@ -19,7 +19,7 @@
sub rt_base_url {
return $RT::Test::existing_server if $RT::Test::existing_server;
- return "http://localhost:" . RT->Config->Get('WebPort') . RT->Config->Get('WebPath') . "/";
+ return $RT::Test::server_url if $RT::Test::server_url;
}
sub login {
Modified: rt/branches/3.999-DANGEROUS/sbin/rt-setup-database
==============================================================================
--- rt/branches/3.999-DANGEROUS/sbin/rt-setup-database (original)
+++ rt/branches/3.999-DANGEROUS/sbin/rt-setup-database Mon Sep 24 00:16:53 2007
@@ -7,14 +7,9 @@
-#This drags in RT's config.pm
-# We do it in a begin block because RT::Handle needs to know the type to do its
-# inheritance
BEGIN {
use Jifty;
Jifty->new();
- use RT;
- RT::load_config();
};
use Term::ReadKey;
@@ -72,8 +67,6 @@
my $db_user = RT->Config->Get('DatabaseUser') || '';
my $db_pass = RT->Config->Get('DatabasePassword') || '';
-# load it here to get error immidiatly if DB type is not supported
-require RT::Handle;
if ( $db_type eq 'SQLite' && !File::Spec->file_name_is_absolute($db_name) ) {
$db_name = File::Spec->catfile($RT::VarPath, $db_name);
@@ -93,76 +86,8 @@
."User:\t$db_user\nDBA:\t$dba_user\n";
foreach my $action ( @actions ) {
- if ( $action eq 'create' ) {
- my $dbh = get_system_dbh();
- print "Now creating a database for RT.\n";
- if ( $db_type ne 'Oracle' || $dba_user ne $db_user ) {
- RT::Handle->CreateDatabase( $dbh );
- } else {
- print "...skipped as $dba_user is not $db_user or we're working with Oracle.\n";
- }
- }
- elsif ( $action eq 'drop' ) {
- my $dbh = get_system_dbh();
-
- print "Now dropping RT database\n";
- RT::Handle->DropDatabase( $dbh, Force => $args{'force'} );
- }
- elsif ( $action eq 'schema' ) {
- my $dbh = get_admin_dbh();
-
- Jifty->handle = new RT::Handle;
- Jifty->handle->dbh( $dbh );
-
- print "Now populating database schema.\n";
- Jifty->handle->InsertSchema( $dbh, $args{'datadir'} );
- }
- elsif ( $action eq 'acl' ) {
- my $dbh = get_admin_dbh();
-
- Jifty->handle = new RT::Handle;
- Jifty->handle->dbh( $dbh );
-
- print "Now inserting database ACLs\n";
- Jifty->handle->InsertACL( $dbh, $args{'datadir'} ) # unless $db_type eq 'Oracle'
- }
- elsif ( $action eq 'insert' ) {
- RT::Init();
-
- print "Now inserting data\n";
- Jifty->handle->InsertData( $args{'datafile'} || ($args{'datadir'}."/content") );
- }
-}
-
-sub get_dba_password {
- print "In order to create or update your RT database,"
- . " this script needs to connect to your "
- . " $db_type instance on $db_host as $dba_user\n";
- print "Please specify that user's database password below. If the user has no database\n";
- print "password, just press return.\n\n";
- print "Password: ";
- ReadMode('noecho');
- my $password = ReadLine(0);
- ReadMode('normal');
- print "\n";
- return ($password);
-}
-
-=head2 get_system_dbh
-
-Returns L<DBI> database handle connected to B<system> with DBA credentials.
-
-See also L<RT::Handle/system_dsn>.
-
-=cut
-
-sub get_system_dbh {
- return _get_dbh( RT::Handle->system_dsn, $dba_user, $dba_pass );
-}
-
-sub get_admin_dbh {
- return _get_dbh( RT::Handle->dsn, $dba_user, $dba_pass );
-}
+ if ( $action eq 'schema' ) {
+ my $dbh =
=head2 get_rt_dbh [USER, PASSWORD]
Modified: rt/branches/3.999-DANGEROUS/t/00-compile.t
==============================================================================
--- rt/branches/3.999-DANGEROUS/t/00-compile.t (original)
+++ rt/branches/3.999-DANGEROUS/t/00-compile.t Mon Sep 24 00:16:53 2007
@@ -1,14 +1,11 @@
use strict;
use warnings;
-use Carp::REPL;
-use RT::Test nodata => 1;
-use Test::More tests => 32;
+use RT::Test; use Test::More tests => 32;
require_ok("RT");
require_ok("RT::Test");
require_ok("RT::Model::ACECollection");
-require_ok("RT::Handle");
require_ok("RT::Model::Transaction");
require_ok("RT::Interface::CLI");
require_ok("RT::Interface::Email");
Modified: rt/branches/3.999-DANGEROUS/t/00-mason-syntax.t
==============================================================================
--- rt/branches/3.999-DANGEROUS/t/00-mason-syntax.t (original)
+++ rt/branches/3.999-DANGEROUS/t/00-mason-syntax.t Mon Sep 24 00:16:53 2007
@@ -3,7 +3,7 @@
use strict;
use warnings;
-use Test::More tests => 1;
+use RT::Test; use Test::More tests => 1;
my $ok = 1;
Modified: rt/branches/3.999-DANGEROUS/t/api/ace.t
==============================================================================
--- rt/branches/3.999-DANGEROUS/t/api/ace.t (original)
+++ rt/branches/3.999-DANGEROUS/t/api/ace.t Mon Sep 24 00:16:53 2007
@@ -1,10 +1,9 @@
use strict;
use warnings;
-use Test::More;
-plan tests => 76;
-use RT;
-use RT::Test;
+
+use RT::Test;
+use Test::More tests => 76;
{
@@ -25,7 +24,7 @@
my $Queue = RT::Model::Queue->new($RT::SystemUser);
is ($Queue->AvailableRights->{'DeleteTicket'} , 'Delete tickets', "Found the delete ticket right");
-is ($RT::System->AvailableRights->{'SuperUser'}, 'Do anything and everything', "Found the superuser right");
+is (RT::System->AvailableRights->{'SuperUser'}, 'Do anything and everything', "Found the superuser right");
@@ -52,7 +51,6 @@
$q->create(Name =>'DelegationTest');
ok ($q->id, "Created a delegation test queue");
-
#------ First, we test whether a user can delegate a right that's been granted to him personally
my ($val, $msg) = $user_a->PrincipalObj->GrantRight(Object => $RT::System, Right => 'AdminOwnPersonalGroups');
ok($val, $msg);
@@ -62,7 +60,7 @@
ok($user_a->has_right( Object => $RT::System, Right => 'AdminOwnPersonalGroups') ,"user a has the right 'AdminOwnPersonalGroups' directly");
-my $a_delegates = RT::Model::Group->new($user_a);
+my $a_delegates = RT::Model::Group->new( $user_a);
$a_delegates->createPersonalGroup(Name => 'Delegates');
ok( $a_delegates->id ,"user a creates a personal group 'Delegates'");
ok( $a_delegates->AddMember($user_b->PrincipalId) ,"user a adds user b to personal group 'delegates'");
Modified: rt/branches/3.999-DANGEROUS/t/api/action-createtickets.t
==============================================================================
--- rt/branches/3.999-DANGEROUS/t/api/action-createtickets.t (original)
+++ rt/branches/3.999-DANGEROUS/t/api/action-createtickets.t Mon Sep 24 00:16:53 2007
@@ -1,10 +1,10 @@
use strict;
use warnings;
-use Test::More;
+use RT::Test; use Test::More;
plan tests => 49;
use RT;
-use RT::Test;
+
{
Modified: rt/branches/3.999-DANGEROUS/t/api/attachment.t
==============================================================================
--- rt/branches/3.999-DANGEROUS/t/api/attachment.t (original)
+++ rt/branches/3.999-DANGEROUS/t/api/attachment.t Mon Sep 24 00:16:53 2007
@@ -1,10 +1,10 @@
use strict;
use warnings;
-use Test::More;
+use RT::Test; use Test::More;
plan tests => 4;
use RT;
-use RT::Test;
+
{
Modified: rt/branches/3.999-DANGEROUS/t/api/attribute-tests.t
==============================================================================
--- rt/branches/3.999-DANGEROUS/t/api/attribute-tests.t (original)
+++ rt/branches/3.999-DANGEROUS/t/api/attribute-tests.t Mon Sep 24 00:16:53 2007
@@ -1,8 +1,6 @@
use strict;
use warnings;
-use Test::More tests => 34;
-use RT;
-use RT::Test;
+use RT::Test; use Test::More tests => 34;
Modified: rt/branches/3.999-DANGEROUS/t/api/attribute.t
==============================================================================
--- rt/branches/3.999-DANGEROUS/t/api/attribute.t (original)
+++ rt/branches/3.999-DANGEROUS/t/api/attribute.t Mon Sep 24 00:16:53 2007
@@ -1,10 +1,10 @@
use strict;
use warnings;
-use Test::More;
+use RT::Test; use Test::More;
plan tests => 7;
use RT;
-use RT::Test;
+
{
Modified: rt/branches/3.999-DANGEROUS/t/api/cf.t
==============================================================================
--- rt/branches/3.999-DANGEROUS/t/api/cf.t (original)
+++ rt/branches/3.999-DANGEROUS/t/api/cf.t Mon Sep 24 00:16:53 2007
@@ -1,9 +1,8 @@
#!/usr/bin/perl
use strict;
-use Test::More tests => 138;
+use RT::Test tests => 138;
-use RT::Test;
# Before we get going, ditch all object_cfs; this will remove
# all custom fields systemwide;
Modified: rt/branches/3.999-DANGEROUS/t/api/cf_combo_casacade.t
==============================================================================
--- rt/branches/3.999-DANGEROUS/t/api/cf_combo_casacade.t (original)
+++ rt/branches/3.999-DANGEROUS/t/api/cf_combo_casacade.t Mon Sep 24 00:16:53 2007
@@ -1,9 +1,9 @@
#!/usr/bin/perl
use warnings;
use strict;
-use Test::More tests => 13;
+use RT::Test; use Test::More tests => 13;
+
-use RT::Test;
sub fails { ok(!$_[0], "This should fail: $_[1]") }
sub works { ok($_[0], $_[1] || 'This works') }
Modified: rt/branches/3.999-DANGEROUS/t/api/cf_external.t
==============================================================================
--- rt/branches/3.999-DANGEROUS/t/api/cf_external.t (original)
+++ rt/branches/3.999-DANGEROUS/t/api/cf_external.t Mon Sep 24 00:16:53 2007
@@ -2,10 +2,9 @@
use warnings;
use strict;
-use Test::More tests => 11;
+use RT::Test; use Test::More tests => 11;
use RT;
-use RT::Test nodata => 1;
sub new (*) {
my $class = shift;
Modified: rt/branches/3.999-DANGEROUS/t/api/cf_pattern.t
==============================================================================
--- rt/branches/3.999-DANGEROUS/t/api/cf_pattern.t (original)
+++ rt/branches/3.999-DANGEROUS/t/api/cf_pattern.t Mon Sep 24 00:16:53 2007
@@ -1,10 +1,10 @@
#!/usr/bin/perl
use warnings;
use strict;
-use Test::More tests => 17;
+use RT::Test; use Test::More tests => 17;
use RT;
-use RT::Test;
+
sub fails { ok(!$_[0], "This should fail: $_[1]") }
Modified: rt/branches/3.999-DANGEROUS/t/api/cf_single_values.t
==============================================================================
--- rt/branches/3.999-DANGEROUS/t/api/cf_single_values.t (original)
+++ rt/branches/3.999-DANGEROUS/t/api/cf_single_values.t Mon Sep 24 00:16:53 2007
@@ -1,10 +1,10 @@
#!/usr/bin/perl
use warnings;
use strict;
-use Test::More tests => 8;
+use RT::Test; use Test::More tests => 8;
use RT;
-use RT::Test;
+
Modified: rt/branches/3.999-DANGEROUS/t/api/cf_transaction.t
==============================================================================
--- rt/branches/3.999-DANGEROUS/t/api/cf_transaction.t (original)
+++ rt/branches/3.999-DANGEROUS/t/api/cf_transaction.t Mon Sep 24 00:16:53 2007
@@ -3,12 +3,12 @@
use warnings;
use strict;
use Data::Dumper;
-use Test::More;
+use RT::Test; use Test::More;
+
plan tests => 14;
use_ok('RT');
use_ok('RT::Model::TransactionCollection');
-use RT::Test;
my $q = RT::Model::Queue->new($RT::SystemUser);
Modified: rt/branches/3.999-DANGEROUS/t/api/condition-ownerchange.t
==============================================================================
--- rt/branches/3.999-DANGEROUS/t/api/condition-ownerchange.t (original)
+++ rt/branches/3.999-DANGEROUS/t/api/condition-ownerchange.t Mon Sep 24 00:16:53 2007
@@ -1,10 +1,10 @@
use strict;
use warnings;
-use Test::More;
+use RT::Test; use Test::More;
plan tests => 11;
use RT;
-use RT::Test;
+
{
Modified: rt/branches/3.999-DANGEROUS/t/api/currentuser.t
==============================================================================
--- rt/branches/3.999-DANGEROUS/t/api/currentuser.t (original)
+++ rt/branches/3.999-DANGEROUS/t/api/currentuser.t Mon Sep 24 00:16:53 2007
@@ -1,10 +1,10 @@
use strict;
use warnings;
-use Test::More;
+use RT::Test; use Test::More;
plan tests => 8;
use RT;
-use RT::Test;
+
{
Modified: rt/branches/3.999-DANGEROUS/t/api/customfield.t
==============================================================================
--- rt/branches/3.999-DANGEROUS/t/api/customfield.t (original)
+++ rt/branches/3.999-DANGEROUS/t/api/customfield.t Mon Sep 24 00:16:53 2007
@@ -1,10 +1,10 @@
use strict;
use warnings;
-use Test::More;
+use RT::Test; use Test::More;
plan tests => 26;
use RT;
-use RT::Test;
+
{
Modified: rt/branches/3.999-DANGEROUS/t/api/date.t
==============================================================================
--- rt/branches/3.999-DANGEROUS/t/api/date.t (original)
+++ rt/branches/3.999-DANGEROUS/t/api/date.t Mon Sep 24 00:16:53 2007
@@ -1,9 +1,8 @@
#!/usr/bin/perl
-use Test::More tests => 164;
-
+use RT::Test; use Test::More tests => 164;;
use warnings; use strict;
-use RT::Test;
+
use RT::Model::User;
use_ok('RT::Date');
Modified: rt/branches/3.999-DANGEROUS/t/api/emailparser.t
==============================================================================
--- rt/branches/3.999-DANGEROUS/t/api/emailparser.t (original)
+++ rt/branches/3.999-DANGEROUS/t/api/emailparser.t Mon Sep 24 00:16:53 2007
@@ -1,10 +1,10 @@
use strict;
use warnings;
-use Test::More;
+use RT::Test; use Test::More;
plan tests => 4;
use RT;
-use RT::Test;
+
{
Modified: rt/branches/3.999-DANGEROUS/t/api/group.t
==============================================================================
--- rt/branches/3.999-DANGEROUS/t/api/group.t (original)
+++ rt/branches/3.999-DANGEROUS/t/api/group.t Mon Sep 24 00:16:53 2007
@@ -1,10 +1,10 @@
use strict;
use warnings;
-use Test::More;
+use RT::Test; use Test::More;
plan tests => 38;
use RT;
-use RT::Test;
+
{
Modified: rt/branches/3.999-DANGEROUS/t/api/groups.t
==============================================================================
--- rt/branches/3.999-DANGEROUS/t/api/groups.t (original)
+++ rt/branches/3.999-DANGEROUS/t/api/groups.t Mon Sep 24 00:16:53 2007
@@ -1,10 +1,9 @@
use strict;
use warnings;
-use Test::More;
+use RT::Test; use Test::More;
plan tests => 28;
-use RT;
-use RT::Test;
+
{
Modified: rt/branches/3.999-DANGEROUS/t/api/i18n.t
==============================================================================
--- rt/branches/3.999-DANGEROUS/t/api/i18n.t (original)
+++ rt/branches/3.999-DANGEROUS/t/api/i18n.t Mon Sep 24 00:16:53 2007
@@ -1,10 +1,10 @@
use strict;
use warnings;
-use Test::More;
+use RT::Test; use Test::More;
plan tests => 9;
use RT;
-use RT::Test;
+
{
Modified: rt/branches/3.999-DANGEROUS/t/api/link.t
==============================================================================
--- rt/branches/3.999-DANGEROUS/t/api/link.t (original)
+++ rt/branches/3.999-DANGEROUS/t/api/link.t Mon Sep 24 00:16:53 2007
@@ -1,10 +1,10 @@
use strict;
use warnings;
-use Test::More;
+use RT::Test; use Test::More;
plan tests => 5;
use RT;
-use RT::Test;
+
{
Modified: rt/branches/3.999-DANGEROUS/t/api/queue.t
==============================================================================
--- rt/branches/3.999-DANGEROUS/t/api/queue.t (original)
+++ rt/branches/3.999-DANGEROUS/t/api/queue.t Mon Sep 24 00:16:53 2007
@@ -1,10 +1,10 @@
use strict;
use warnings;
-use Test::More;
+use RT::Test; use Test::More;
plan tests => 25;
use RT;
-use RT::Test;
+
{
Modified: rt/branches/3.999-DANGEROUS/t/api/record.t
==============================================================================
--- rt/branches/3.999-DANGEROUS/t/api/record.t (original)
+++ rt/branches/3.999-DANGEROUS/t/api/record.t Mon Sep 24 00:16:53 2007
@@ -1,10 +1,10 @@
use strict;
use warnings;
-use Test::More;
+use RT::Test; use Test::More;
plan tests => 22;
use RT;
-use RT::Test;
+
{
Modified: rt/branches/3.999-DANGEROUS/t/api/rights.t
==============================================================================
--- rt/branches/3.999-DANGEROUS/t/api/rights.t (original)
+++ rt/branches/3.999-DANGEROUS/t/api/rights.t Mon Sep 24 00:16:53 2007
@@ -47,9 +47,9 @@
#
# END BPS TAGGED BLOCK }}}
-use Test::More tests => 26;
+use RT::Test; use Test::More tests => 26;
use RT;
-use RT::Test;
+
use RT::I18N;
use strict;
Modified: rt/branches/3.999-DANGEROUS/t/api/rt.t
==============================================================================
--- rt/branches/3.999-DANGEROUS/t/api/rt.t (original)
+++ rt/branches/3.999-DANGEROUS/t/api/rt.t Mon Sep 24 00:16:53 2007
@@ -1,10 +1,10 @@
use strict;
use warnings;
-use Test::More;
+use RT::Test; use Test::More;
plan tests => 4;
use RT;
-use RT::Test;
+
{
Modified: rt/branches/3.999-DANGEROUS/t/api/scrip.t
==============================================================================
--- rt/branches/3.999-DANGEROUS/t/api/scrip.t (original)
+++ rt/branches/3.999-DANGEROUS/t/api/scrip.t Mon Sep 24 00:16:53 2007
@@ -1,10 +1,10 @@
use strict;
use warnings;
-use Test::More;
+use RT::Test; use Test::More;
plan tests => 7;
use RT;
-use RT::Test;
+
ok (require RT::Model::Scrip);
Modified: rt/branches/3.999-DANGEROUS/t/api/scrip_order.t
==============================================================================
--- rt/branches/3.999-DANGEROUS/t/api/scrip_order.t (original)
+++ rt/branches/3.999-DANGEROUS/t/api/scrip_order.t Mon Sep 24 00:16:53 2007
@@ -1,10 +1,10 @@
#!/usr/bin/perl -w
use strict;
-use Test::More tests => 7;
+use RT::Test; use Test::More tests => 7;
use RT;
-use RT::Test;
+
# {{{ test scrip ordering based on description
Modified: rt/branches/3.999-DANGEROUS/t/api/searchbuilder.t
==============================================================================
--- rt/branches/3.999-DANGEROUS/t/api/searchbuilder.t (original)
+++ rt/branches/3.999-DANGEROUS/t/api/searchbuilder.t Mon Sep 24 00:16:53 2007
@@ -1,10 +1,10 @@
use strict;
use warnings;
-use Test::More;
+use RT::Test; use Test::More;
plan tests => 11;
use RT;
-use RT::Test;
+
{
Modified: rt/branches/3.999-DANGEROUS/t/api/system.t
==============================================================================
--- rt/branches/3.999-DANGEROUS/t/api/system.t (original)
+++ rt/branches/3.999-DANGEROUS/t/api/system.t Mon Sep 24 00:16:53 2007
@@ -1,10 +1,10 @@
use strict;
use warnings;
-use Test::More;
+use RT::Test; use Test::More;
plan tests => 7;
use RT;
-use RT::Test;
+
{
Modified: rt/branches/3.999-DANGEROUS/t/api/template-insert.t
==============================================================================
--- rt/branches/3.999-DANGEROUS/t/api/template-insert.t (original)
+++ rt/branches/3.999-DANGEROUS/t/api/template-insert.t Mon Sep 24 00:16:53 2007
@@ -3,10 +3,10 @@
use warnings;
use strict;
-use Test::More tests => 7;
+use RT::Test; use Test::More tests => 7;
use RT;
-use RT::Test;
+
Modified: rt/branches/3.999-DANGEROUS/t/api/template.t
==============================================================================
--- rt/branches/3.999-DANGEROUS/t/api/template.t (original)
+++ rt/branches/3.999-DANGEROUS/t/api/template.t Mon Sep 24 00:16:53 2007
@@ -1,10 +1,10 @@
use strict;
use warnings;
-use Test::More;
+use RT::Test; use Test::More;
plan tests => 2;
use RT;
-use RT::Test;
+
{
Modified: rt/branches/3.999-DANGEROUS/t/api/ticket.t
==============================================================================
--- rt/branches/3.999-DANGEROUS/t/api/ticket.t (original)
+++ rt/branches/3.999-DANGEROUS/t/api/ticket.t Mon Sep 24 00:16:53 2007
@@ -1,11 +1,11 @@
use strict;
use warnings;
-use Test::More;
+use RT::Test; use Test::More;
plan tests => 88;
use Data::Dumper;
use RT;
-use RT::Test;
+
{
Modified: rt/branches/3.999-DANGEROUS/t/api/tickets.t
==============================================================================
--- rt/branches/3.999-DANGEROUS/t/api/tickets.t (original)
+++ rt/branches/3.999-DANGEROUS/t/api/tickets.t Mon Sep 24 00:16:53 2007
@@ -1,10 +1,10 @@
use strict;
use warnings;
-use Test::More;
+use RT::Test; use Test::More;
plan tests => 16;
use RT;
-use RT::Test;
+
{
Modified: rt/branches/3.999-DANGEROUS/t/api/tickets_overlay_sql.t
==============================================================================
--- rt/branches/3.999-DANGEROUS/t/api/tickets_overlay_sql.t (original)
+++ rt/branches/3.999-DANGEROUS/t/api/tickets_overlay_sql.t Mon Sep 24 00:16:53 2007
@@ -1,8 +1,8 @@
-use Test::More;
+use RT::Test; use Test::More;
plan tests => 7;
use RT;
-use RT::Test;
+
{
Modified: rt/branches/3.999-DANGEROUS/t/api/uri-fsck_com_rt.t
==============================================================================
--- rt/branches/3.999-DANGEROUS/t/api/uri-fsck_com_rt.t (original)
+++ rt/branches/3.999-DANGEROUS/t/api/uri-fsck_com_rt.t Mon Sep 24 00:16:53 2007
@@ -1,8 +1,8 @@
use strict;
use warnings;
-use Test::More tests => 8;
+use RT::Test; use Test::More tests => 8;
use RT;
-use RT::Test;
+
use_ok("RT::URI::fsck_com_rt");
my $uri = RT::URI::fsck_com_rt->new($RT::SystemUser);
Modified: rt/branches/3.999-DANGEROUS/t/api/uri-t.t
==============================================================================
--- rt/branches/3.999-DANGEROUS/t/api/uri-t.t (original)
+++ rt/branches/3.999-DANGEROUS/t/api/uri-t.t Mon Sep 24 00:16:53 2007
@@ -1,8 +1,8 @@
use strict;
use warnings;
-use Test::More tests => 6;
+use RT::Test; use Test::More tests => 6;
use RT;
-use RT::Test;
+
my $t1 = RT::Model::Ticket->new($RT::SystemUser);
my ($id,$trans,$msg) =$t1->create (Queue => 'general', Subject => 'Requestor test one', );
Modified: rt/branches/3.999-DANGEROUS/t/api/user.t
==============================================================================
--- rt/branches/3.999-DANGEROUS/t/api/user.t (original)
+++ rt/branches/3.999-DANGEROUS/t/api/user.t Mon Sep 24 00:16:53 2007
@@ -1,10 +1,10 @@
use strict;
use warnings;
-use Test::More;
+use RT::Test; use Test::More;
plan tests => 105;
use RT;
-use RT::Test;
+
{
Modified: rt/branches/3.999-DANGEROUS/t/api/users.t
==============================================================================
--- rt/branches/3.999-DANGEROUS/t/api/users.t (original)
+++ rt/branches/3.999-DANGEROUS/t/api/users.t Mon Sep 24 00:16:53 2007
@@ -1,10 +1,10 @@
use strict;
use warnings;
-use Test::More;
+use RT::Test; use Test::More;
plan tests => 11;
use RT;
-use RT::Test;
+
use_ok('RT::Model::UserCollection');
Modified: rt/branches/3.999-DANGEROUS/t/clicky.t
==============================================================================
--- rt/branches/3.999-DANGEROUS/t/clicky.t (original)
+++ rt/branches/3.999-DANGEROUS/t/clicky.t Mon Sep 24 00:16:53 2007
@@ -3,7 +3,7 @@
use strict;
use warnings;
-use Test::More;
+use RT::Test; use Test::More;
my %clicky = map { $_ => 1 } grep $_, RT->Config->Get('Active_MakeClicky');
@@ -13,7 +13,7 @@
plan skip_all => 'No active Make Clicky actions';
}
-use RT::Test;
+
my ($baseurl, $m) = RT::Test->started_ok;
use_ok('MIME::Entity');
Modified: rt/branches/3.999-DANGEROUS/t/cron.t
==============================================================================
--- rt/branches/3.999-DANGEROUS/t/cron.t (original)
+++ rt/branches/3.999-DANGEROUS/t/cron.t Mon Sep 24 00:16:53 2007
@@ -1,11 +1,10 @@
#!/usr/bin/perl -w
use strict;
-use Test::More;
+use RT::Test; use Test::More;
plan tests => 22;
use RT;
-use RT::Test;
### Set up some testing data. Test the testing data because why not?
Modified: rt/branches/3.999-DANGEROUS/t/delegation/cleanup_stalled.t
==============================================================================
--- rt/branches/3.999-DANGEROUS/t/delegation/cleanup_stalled.t (original)
+++ rt/branches/3.999-DANGEROUS/t/delegation/cleanup_stalled.t Mon Sep 24 00:16:53 2007
@@ -12,12 +12,12 @@
# The case where the "parent" delegated ACE is removed is handled in
# the embedded regression tests in lib/RT/ACE_Overlay.pm .
-use Test::More;
+use RT::Test; use Test::More;
plan tests => 98;
use RT;
-use RT::Test;
+
my ($u1, $u2, $g1, $g2, $g3, $pg1, $pg2, $ace, @groups, @users, @principals);
@groups = (\$g1, \$g2, \$g3, \$pg1, \$pg2);
Modified: rt/branches/3.999-DANGEROUS/t/delegation/revocation.t
==============================================================================
--- rt/branches/3.999-DANGEROUS/t/delegation/revocation.t (original)
+++ rt/branches/3.999-DANGEROUS/t/delegation/revocation.t Mon Sep 24 00:16:53 2007
@@ -2,12 +2,12 @@
use strict;
use warnings;
-use Test::More;
+use RT::Test; use Test::More;
plan tests => 22;
use RT;
-use RT::Test;
+
my ($u1, $g1, $pg1, $pg2, $ace, @groups, @users, @principals);
@groups = (\$g1, \$pg1, \$pg2);
Modified: rt/branches/3.999-DANGEROUS/t/mail/crypt-gnupg.t
==============================================================================
--- rt/branches/3.999-DANGEROUS/t/mail/crypt-gnupg.t (original)
+++ rt/branches/3.999-DANGEROUS/t/mail/crypt-gnupg.t Mon Sep 24 00:16:53 2007
@@ -2,11 +2,10 @@
use strict;
use warnings;
-use Test::More;
+use RT::Test; use Test::More;
eval 'use GnuPG::Interface; 1' or plan skip_all => 'GnuPG required.';
plan tests => 94;
-use RT::Test nodata => 1;
RT->Config->set( LogToScreen => 'debug' );
RT->Config->set( LogStackTraces => 'error' );
Modified: rt/branches/3.999-DANGEROUS/t/mail/gateway.t
==============================================================================
--- rt/branches/3.999-DANGEROUS/t/mail/gateway.t (original)
+++ rt/branches/3.999-DANGEROUS/t/mail/gateway.t Mon Sep 24 00:16:53 2007
@@ -56,7 +56,7 @@
use strict;
use warnings;
-use Test::More tests => 153;
+use RT::Test; use Test::More tests => 153;
use RT::Test config => 'set( $UnsafeEmailCommands, 1);';
my ($baseurl, $m) = RT::Test->started_ok;
Modified: rt/branches/3.999-DANGEROUS/t/mail/gnupg-bad.t
==============================================================================
--- rt/branches/3.999-DANGEROUS/t/mail/gnupg-bad.t (original)
+++ rt/branches/3.999-DANGEROUS/t/mail/gnupg-bad.t Mon Sep 24 00:16:53 2007
@@ -1,8 +1,8 @@
#!/usr/bin/perl
use strict;
use warnings;
-use Test::More tests => 6;
-use RT::Test;
+use RT::Test; use Test::More tests => 6;
+
use Cwd 'getcwd';
my $homedir = File::Spec->catdir( getcwd(), qw(lib t data crypt-gnupg) );
Modified: rt/branches/3.999-DANGEROUS/t/mail/gnupg-incoming.t
==============================================================================
--- rt/branches/3.999-DANGEROUS/t/mail/gnupg-incoming.t (original)
+++ rt/branches/3.999-DANGEROUS/t/mail/gnupg-incoming.t Mon Sep 24 00:16:53 2007
@@ -1,8 +1,8 @@
#!/usr/bin/perl
use strict;
-use Test::More tests => 46;
+use RT::Test; use Test::More tests => 46;
use File::Temp;
-use RT::Test;
+
use Cwd 'getcwd';
use String::ShellQuote 'shell_quote';
use IPC::Run3 'run3';
Modified: rt/branches/3.999-DANGEROUS/t/mail/gnupg-outcoming.t
==============================================================================
--- rt/branches/3.999-DANGEROUS/t/mail/gnupg-outcoming.t (original)
+++ rt/branches/3.999-DANGEROUS/t/mail/gnupg-outcoming.t Mon Sep 24 00:16:53 2007
@@ -2,8 +2,8 @@
use strict;
use warnings;
-use Test::More tests => 176;
-use RT::Test;
+use RT::Test; use Test::More tests => 176;
+
use Digest::MD5 qw(md5_hex);
Modified: rt/branches/3.999-DANGEROUS/t/mail/gnupg-realmail.t
==============================================================================
--- rt/branches/3.999-DANGEROUS/t/mail/gnupg-realmail.t (original)
+++ rt/branches/3.999-DANGEROUS/t/mail/gnupg-realmail.t Mon Sep 24 00:16:53 2007
@@ -2,8 +2,8 @@
use strict;
use warnings;
-use Test::More tests => 176;
-use RT::Test;
+use RT::Test; use Test::More tests => 176;
+
use Digest::MD5 qw(md5_hex);
Modified: rt/branches/3.999-DANGEROUS/t/mail/gnupg-reverification.t
==============================================================================
--- rt/branches/3.999-DANGEROUS/t/mail/gnupg-reverification.t (original)
+++ rt/branches/3.999-DANGEROUS/t/mail/gnupg-reverification.t Mon Sep 24 00:16:53 2007
@@ -2,8 +2,8 @@
use strict;
use warnings;
-use Test::More tests => 111;
-use RT::Test;
+use RT::Test; use Test::More tests => 111;
+
use File::Temp qw(tempdir);
my $homedir = tempdir( CLEANUP => 1 );
Modified: rt/branches/3.999-DANGEROUS/t/mail/mime_decoding.t
==============================================================================
--- rt/branches/3.999-DANGEROUS/t/mail/mime_decoding.t (original)
+++ rt/branches/3.999-DANGEROUS/t/mail/mime_decoding.t Mon Sep 24 00:16:53 2007
@@ -1,8 +1,7 @@
#!/usr/bin/perl
use strict;
use warnings;
-use Test::More tests => 5;
-use RT::Test nodata => 1;
+use RT::Test; use Test::More tests => 5;
use_ok('RT::I18N');
Modified: rt/branches/3.999-DANGEROUS/t/mail/sendmail.t
==============================================================================
--- rt/branches/3.999-DANGEROUS/t/mail/sendmail.t (original)
+++ rt/branches/3.999-DANGEROUS/t/mail/sendmail.t Mon Sep 24 00:16:53 2007
@@ -1,9 +1,9 @@
#!/usr/bin/perl -w
use strict;
-use Test::More tests => 143;
+use RT::Test; use Test::More tests => 143;
+
-use RT::Test;
use RT::EmailParser;
use RT::Model::TicketCollection;
Modified: rt/branches/3.999-DANGEROUS/t/mail/verp.t
==============================================================================
--- rt/branches/3.999-DANGEROUS/t/mail/verp.t (original)
+++ rt/branches/3.999-DANGEROUS/t/mail/verp.t Mon Sep 24 00:16:53 2007
@@ -1,7 +1,7 @@
#!/usr/bin/perl -w
use strict;
-use Test::More tests => 1;
+use RT::Test; use Test::More tests => 1;
TODO: {
todo_skip "No tests written for VERP yet", 1;
Modified: rt/branches/3.999-DANGEROUS/t/rtname.t
==============================================================================
--- rt/branches/3.999-DANGEROUS/t/rtname.t (original)
+++ rt/branches/3.999-DANGEROUS/t/rtname.t Mon Sep 24 00:16:53 2007
@@ -1,9 +1,8 @@
#!/usr/bin/perl
use strict;
use warnings;
-use Test::More tests => 9;
+use RT::Test; use Test::More tests => 9;
-use RT::Test nodata => 1;
use RT::Interface::Email;
Modified: rt/branches/3.999-DANGEROUS/t/savedsearch.t
==============================================================================
--- rt/branches/3.999-DANGEROUS/t/savedsearch.t (original)
+++ rt/branches/3.999-DANGEROUS/t/savedsearch.t Mon Sep 24 00:16:53 2007
@@ -1,7 +1,7 @@
use strict;
use warnings;
use RT;
-use Test::More tests => 26;
+use RT::Test; use Test::More tests => 26;
use RT::Model::User;
use RT::Model::Group;
use RT::Model::Ticket;
@@ -9,7 +9,7 @@
use_ok('RT::SavedSearch');
use_ok('RT::SavedSearches');
-use RT::Test;
+
# Set up some infrastructure. These calls are tested elsewhere.
Modified: rt/branches/3.999-DANGEROUS/t/shredder/00load.t
==============================================================================
--- rt/branches/3.999-DANGEROUS/t/shredder/00load.t (original)
+++ rt/branches/3.999-DANGEROUS/t/shredder/00load.t Mon Sep 24 00:16:53 2007
@@ -1,6 +1,6 @@
use strict;
use warnings;
-use Test::More tests => 11;
+use RT::Test; use Test::More tests => 11;
BEGIN { require "t/shredder/utils.pl" }
Modified: rt/branches/3.999-DANGEROUS/t/shredder/00skeleton.t
==============================================================================
--- rt/branches/3.999-DANGEROUS/t/shredder/00skeleton.t (original)
+++ rt/branches/3.999-DANGEROUS/t/shredder/00skeleton.t Mon Sep 24 00:16:53 2007
@@ -3,7 +3,7 @@
use strict;
use warnings;
-use Test::More;
+use RT::Test; use Test::More;
use Test::Deep;
BEGIN { require "t/shredder/utils.pl"; }
init_db();
Modified: rt/branches/3.999-DANGEROUS/t/shredder/01basics.t
==============================================================================
--- rt/branches/3.999-DANGEROUS/t/shredder/01basics.t (original)
+++ rt/branches/3.999-DANGEROUS/t/shredder/01basics.t Mon Sep 24 00:16:53 2007
@@ -3,7 +3,7 @@
use strict;
use warnings;
-use Test::More;
+use RT::Test; use Test::More;
use Test::Deep;
BEGIN { require "t/shredder/utils.pl"; }
init_db();
Modified: rt/branches/3.999-DANGEROUS/t/shredder/01ticket.t
==============================================================================
--- rt/branches/3.999-DANGEROUS/t/shredder/01ticket.t (original)
+++ rt/branches/3.999-DANGEROUS/t/shredder/01ticket.t Mon Sep 24 00:16:53 2007
@@ -3,7 +3,7 @@
use strict;
use warnings;
-use Test::More;
+use RT::Test; use Test::More;
use Test::Deep;
plan tests => 15;
Modified: rt/branches/3.999-DANGEROUS/t/shredder/02group_member.t
==============================================================================
--- rt/branches/3.999-DANGEROUS/t/shredder/02group_member.t (original)
+++ rt/branches/3.999-DANGEROUS/t/shredder/02group_member.t Mon Sep 24 00:16:53 2007
@@ -3,7 +3,7 @@
use strict;
use warnings;
-use Test::More;
+use RT::Test; use Test::More;
use Test::Deep;
BEGIN { require "t/shredder/utils.pl"; }
init_db();
Modified: rt/branches/3.999-DANGEROUS/t/shredder/02queue.t
==============================================================================
--- rt/branches/3.999-DANGEROUS/t/shredder/02queue.t (original)
+++ rt/branches/3.999-DANGEROUS/t/shredder/02queue.t Mon Sep 24 00:16:53 2007
@@ -3,7 +3,7 @@
use strict;
use warnings;
-use Test::More;
+use RT::Test; use Test::More;
use Test::Deep;
BEGIN { require "t/shredder/utils.pl"; }
init_db();
Modified: rt/branches/3.999-DANGEROUS/t/shredder/02template.t
==============================================================================
--- rt/branches/3.999-DANGEROUS/t/shredder/02template.t (original)
+++ rt/branches/3.999-DANGEROUS/t/shredder/02template.t Mon Sep 24 00:16:53 2007
@@ -3,7 +3,7 @@
use strict;
use warnings;
-use Test::More;
+use RT::Test; use Test::More;
use Test::Deep;
BEGIN { require "t/shredder/utils.pl"; }
init_db();
Modified: rt/branches/3.999-DANGEROUS/t/shredder/02user.t
==============================================================================
--- rt/branches/3.999-DANGEROUS/t/shredder/02user.t (original)
+++ rt/branches/3.999-DANGEROUS/t/shredder/02user.t Mon Sep 24 00:16:53 2007
@@ -3,7 +3,7 @@
use strict;
use warnings;
-use Test::More;
+use RT::Test; use Test::More;
use Test::Deep;
BEGIN { require "t/shredder/utils.pl"; }
init_db();
Modified: rt/branches/3.999-DANGEROUS/t/shredder/03plugin.t
==============================================================================
--- rt/branches/3.999-DANGEROUS/t/shredder/03plugin.t (original)
+++ rt/branches/3.999-DANGEROUS/t/shredder/03plugin.t Mon Sep 24 00:16:53 2007
@@ -3,7 +3,7 @@
use strict;
use warnings;
-use Test::More;
+use RT::Test; use Test::More;
use Test::Deep;
BEGIN { require "t/shredder/utils.pl"; }
Modified: rt/branches/3.999-DANGEROUS/t/shredder/03plugin_summary.t
==============================================================================
--- rt/branches/3.999-DANGEROUS/t/shredder/03plugin_summary.t (original)
+++ rt/branches/3.999-DANGEROUS/t/shredder/03plugin_summary.t Mon Sep 24 00:16:53 2007
@@ -3,7 +3,7 @@
use strict;
use warnings;
-use Test::More;
+use RT::Test; use Test::More;
use Test::Deep;
BEGIN { require "t/shredder/utils.pl"; }
Modified: rt/branches/3.999-DANGEROUS/t/shredder/03plugin_tickets.t
==============================================================================
--- rt/branches/3.999-DANGEROUS/t/shredder/03plugin_tickets.t (original)
+++ rt/branches/3.999-DANGEROUS/t/shredder/03plugin_tickets.t Mon Sep 24 00:16:53 2007
@@ -3,7 +3,7 @@
use strict;
use warnings;
-use Test::More;
+use RT::Test; use Test::More;
use Test::Deep;
BEGIN { require "t/shredder/utils.pl"; }
Modified: rt/branches/3.999-DANGEROUS/t/shredder/03plugin_users.t
==============================================================================
--- rt/branches/3.999-DANGEROUS/t/shredder/03plugin_users.t (original)
+++ rt/branches/3.999-DANGEROUS/t/shredder/03plugin_users.t Mon Sep 24 00:16:53 2007
@@ -3,7 +3,7 @@
use strict;
use warnings;
-use Test::More;
+use RT::Test; use Test::More;
use Test::Deep;
BEGIN { require "t/shredder/utils.pl"; }
Modified: rt/branches/3.999-DANGEROUS/t/shredder/utils.pl
==============================================================================
--- rt/branches/3.999-DANGEROUS/t/shredder/utils.pl (original)
+++ rt/branches/3.999-DANGEROUS/t/shredder/utils.pl Mon Sep 24 00:16:53 2007
@@ -273,9 +273,6 @@
my( $orig, $dest ) = @_;
Jifty->handle->dbh->disconnect;
# DIRTY HACK: undef Handles to force reconnect
- Jifty->handle = undef;
- %Jifty::DBI::DBIHandle = ();
- $Jifty::DBI::PrevHandle = undef;
File::Copy::copy( $orig, $dest ) or die "Couldn't copy '$orig' => '$dest': $!";
RT::connect_to_database();
Modified: rt/branches/3.999-DANGEROUS/t/ticket/batch-upload-csv.t
==============================================================================
--- rt/branches/3.999-DANGEROUS/t/ticket/batch-upload-csv.t (original)
+++ rt/branches/3.999-DANGEROUS/t/ticket/batch-upload-csv.t Mon Sep 24 00:16:53 2007
@@ -1,9 +1,9 @@
#!/usr/bin/perl -w
use strict; use warnings;
-use Test::More tests => 12;
+use RT::Test; use Test::More tests => 12;
use_ok('RT');
-use RT::Test;
+
use_ok('RT::ScripAction::CreateTickets');
Modified: rt/branches/3.999-DANGEROUS/t/ticket/deffered_owner.t
==============================================================================
--- rt/branches/3.999-DANGEROUS/t/ticket/deffered_owner.t (original)
+++ rt/branches/3.999-DANGEROUS/t/ticket/deffered_owner.t Mon Sep 24 00:16:53 2007
@@ -1,11 +1,11 @@
-use Test::More tests => '17';
+use RT::Test; use Test::More tests => '17';
use strict;
use warnings;
use_ok('RT');
use_ok('RT::Model::Ticket');
-use RT::Test;
+
my $tester = RT::Test->load_or_create_user(
Modified: rt/branches/3.999-DANGEROUS/t/ticket/link_search.t
==============================================================================
--- rt/branches/3.999-DANGEROUS/t/ticket/link_search.t (original)
+++ rt/branches/3.999-DANGEROUS/t/ticket/link_search.t Mon Sep 24 00:16:53 2007
@@ -1,11 +1,11 @@
#!/usr/bin/perl -w
-use Test::More tests => 63;
+use RT::Test; use Test::More tests => 63;
use strict;
use RT;
# Load the config file
-use RT::Test;
+
#Connect to the database and get RT::SystemUser and RT::Nobody loaded
Modified: rt/branches/3.999-DANGEROUS/t/ticket/linking.t
==============================================================================
--- rt/branches/3.999-DANGEROUS/t/ticket/linking.t (original)
+++ rt/branches/3.999-DANGEROUS/t/ticket/linking.t Mon Sep 24 00:16:53 2007
@@ -1,4 +1,4 @@
-use Test::More tests => '89';
+use RT::Test; use Test::More tests => '89';
use strict;
use warnings;
@@ -10,7 +10,7 @@
use_ok('RT::Model::Template');
use_ok('RT::Model::ScripCollection');
use_ok('RT::Model::Scrip');
-use RT::Test;
+
use File::Temp qw/tempfile/;
Modified: rt/branches/3.999-DANGEROUS/t/ticket/merge.t
==============================================================================
--- rt/branches/3.999-DANGEROUS/t/ticket/merge.t (original)
+++ rt/branches/3.999-DANGEROUS/t/ticket/merge.t Mon Sep 24 00:16:53 2007
@@ -3,10 +3,10 @@
use strict;
use warnings;
-use Test::More tests => '17';
+use RT::Test; use Test::More tests => '17';
use RT;
-use RT::Test;
+
# validate that when merging two tickets, the comments from both tickets
Modified: rt/branches/3.999-DANGEROUS/t/ticket/pawsort.t
==============================================================================
--- rt/branches/3.999-DANGEROUS/t/ticket/pawsort.t (original)
+++ rt/branches/3.999-DANGEROUS/t/ticket/pawsort.t Mon Sep 24 00:16:53 2007
@@ -1,9 +1,9 @@
#!/usr/bin/perl
-use Test::More;
+use RT::Test; use Test::More;
plan tests => 7;
use RT;
-use RT::Test;
+
use strict;
Modified: rt/branches/3.999-DANGEROUS/t/ticket/quicksearch.t
==============================================================================
--- rt/branches/3.999-DANGEROUS/t/ticket/quicksearch.t (original)
+++ rt/branches/3.999-DANGEROUS/t/ticket/quicksearch.t Mon Sep 24 00:16:53 2007
@@ -4,10 +4,10 @@
use strict;
use warnings;
-use Test::More;
+use RT::Test; use Test::More;
plan tests => 10;
use_ok('RT');
-use RT::Test;
+
my $q = RT::Model::Queue->new($RT::SystemUser);
Modified: rt/branches/3.999-DANGEROUS/t/ticket/requestor-order.t
==============================================================================
--- rt/branches/3.999-DANGEROUS/t/ticket/requestor-order.t (original)
+++ rt/branches/3.999-DANGEROUS/t/ticket/requestor-order.t Mon Sep 24 00:16:53 2007
@@ -1,10 +1,10 @@
#!/usr/bin/perl -w
use strict; use warnings;
-use Test::More;
+use RT::Test; use Test::More;
plan tests => 58;
use_ok('RT');
-use RT::Test;
+
use RT::Model::Ticket;
Modified: rt/branches/3.999-DANGEROUS/t/ticket/search.t
==============================================================================
--- rt/branches/3.999-DANGEROUS/t/ticket/search.t (original)
+++ rt/branches/3.999-DANGEROUS/t/ticket/search.t Mon Sep 24 00:16:53 2007
@@ -6,8 +6,8 @@
use strict;
use warnings;
-use Test::More tests => 43;
-use RT::Test;
+use RT::Test; use Test::More tests => 43;
+
# setup the queue
Modified: rt/branches/3.999-DANGEROUS/t/ticket/search_by_txn.t
==============================================================================
--- rt/branches/3.999-DANGEROUS/t/ticket/search_by_txn.t (original)
+++ rt/branches/3.999-DANGEROUS/t/ticket/search_by_txn.t Mon Sep 24 00:16:53 2007
@@ -3,11 +3,11 @@
use warnings;
use strict;
-use Test::More tests => 10;
+use RT::Test; use Test::More tests => 10;
BEGIN{ $ENV{'TZ'} = 'GMT'};
-use RT::Test;
+
my $SUBJECT = "Search test - ".$$;
Modified: rt/branches/3.999-DANGEROUS/t/ticket/search_by_watcher.t
==============================================================================
--- rt/branches/3.999-DANGEROUS/t/ticket/search_by_watcher.t (original)
+++ rt/branches/3.999-DANGEROUS/t/ticket/search_by_watcher.t Mon Sep 24 00:16:53 2007
@@ -3,8 +3,8 @@
use strict;
use warnings;
-use Test::More tests => 78;
-use RT::Test;
+use RT::Test; use Test::More tests => 78;
+
use RT::Model::Ticket;
my $q = RT::Model::Queue->new( $RT::SystemUser );
Modified: rt/branches/3.999-DANGEROUS/t/ticket/sort_by_cf.t
==============================================================================
--- rt/branches/3.999-DANGEROUS/t/ticket/sort_by_cf.t (original)
+++ rt/branches/3.999-DANGEROUS/t/ticket/sort_by_cf.t Mon Sep 24 00:16:53 2007
@@ -1,7 +1,7 @@
#!/usr/bin/perl
-use Test::More tests => 21;
-use RT::Test;
+use RT::Test; use Test::More tests => 21;
+
RT::Init();
use strict;
Modified: rt/branches/3.999-DANGEROUS/t/web/attachments.t
==============================================================================
--- rt/branches/3.999-DANGEROUS/t/web/attachments.t (original)
+++ rt/branches/3.999-DANGEROUS/t/web/attachments.t Mon Sep 24 00:16:53 2007
@@ -1,8 +1,8 @@
#!/usr/bin/perl -w
use strict;
-use Test::More tests => 14;
-use RT::Test;
+use RT::Test; use Test::More tests => 14;
+
use constant LogoFile => $RT::MasonComponentRoot .'/NoAuth/images/bplogo.gif';
use constant FaviconFile => $RT::MasonComponentRoot .'/NoAuth/images/favicon.png';
Modified: rt/branches/3.999-DANGEROUS/t/web/basic.t
==============================================================================
--- rt/branches/3.999-DANGEROUS/t/web/basic.t (original)
+++ rt/branches/3.999-DANGEROUS/t/web/basic.t Mon Sep 24 00:16:53 2007
@@ -1,13 +1,13 @@
#!/usr/bin/perl
use strict;
-use Test::More tests => 20;
+use RT::Test; use Test::More tests => 20;
use HTTP::Request::Common;
use HTTP::Cookies;
use LWP;
use Encode;
-use RT::Test;
+
my ($baseurl, $agent) = RT::Test->started_ok;
$agent->cookie_jar( HTTP::Cookies->new );
@@ -35,7 +35,6 @@
ok( $agent->{'content'} =~ /Logout/i, "Found a logout link");
-
$agent->get($url."Ticket/Create.html?Queue=1");
is ($agent->{'status'}, 200, "Loaded Create.html");
$agent->form_number(3);
Modified: rt/branches/3.999-DANGEROUS/t/web/cf_access.t
==============================================================================
--- rt/branches/3.999-DANGEROUS/t/web/cf_access.t (original)
+++ rt/branches/3.999-DANGEROUS/t/web/cf_access.t Mon Sep 24 00:16:53 2007
@@ -1,8 +1,8 @@
#!/usr/bin/perl -w
use strict;
-use Test::More tests => 26;
-use RT::Test;
+use RT::Test; use Test::More tests => 26;
+
my ($baseurl, $m) = RT::Test->started_ok;
use constant ImageFile => $RT::MasonComponentRoot .'/NoAuth/images/bplogo.gif';
Modified: rt/branches/3.999-DANGEROUS/t/web/cf_select_one.t
==============================================================================
--- rt/branches/3.999-DANGEROUS/t/web/cf_select_one.t (original)
+++ rt/branches/3.999-DANGEROUS/t/web/cf_select_one.t Mon Sep 24 00:16:53 2007
@@ -3,8 +3,8 @@
use strict;
use warnings;
-use Test::More tests => 41;
-use RT::Test;
+use RT::Test; use Test::More tests => 41;
+
my ($baseurl, $m) = RT::Test->started_ok;
ok $m->login, 'logged in as root';
Modified: rt/branches/3.999-DANGEROUS/t/web/command_line.t
==============================================================================
--- rt/branches/3.999-DANGEROUS/t/web/command_line.t (original)
+++ rt/branches/3.999-DANGEROUS/t/web/command_line.t Mon Sep 24 00:16:53 2007
@@ -2,9 +2,9 @@
use strict;
use Test::Expect;
-#use Test::More qw/no_plan/;
-use Test::More tests => 217;
-use RT::Test;
+#use RT::Test; use Test::More qw/no_plan/;
+use RT::Test; use Test::More tests => 217;
+
my ($baseurl, $m) = RT::Test->started_ok;
use RT::Model::User;
use RT::Model::Queue;
Modified: rt/branches/3.999-DANGEROUS/t/web/compilation_errors.t
==============================================================================
--- rt/branches/3.999-DANGEROUS/t/web/compilation_errors.t (original)
+++ rt/branches/3.999-DANGEROUS/t/web/compilation_errors.t Mon Sep 24 00:16:53 2007
@@ -1,7 +1,7 @@
#!/usr/bin/perl
use strict;
-use Test::More;
+use RT::Test; use Test::More;
plan tests => 387;
use HTTP::Request::Common;
use HTTP::Cookies;
@@ -10,7 +10,7 @@
my $cookie_jar = HTTP::Cookies->new;
-use RT::Test;
+
my ($baseurl, $agent) = RT::Test->started_ok;
# give the agent a place to stash the cookies
Modified: rt/branches/3.999-DANGEROUS/t/web/crypt-gnupg.t
==============================================================================
--- rt/branches/3.999-DANGEROUS/t/web/crypt-gnupg.t (original)
+++ rt/branches/3.999-DANGEROUS/t/web/crypt-gnupg.t Mon Sep 24 00:16:53 2007
@@ -1,8 +1,8 @@
#!/usr/bin/perl -w
use strict;
-use Test::More tests => 80;
-use RT::Test;
+use RT::Test; use Test::More tests => 80;
+
use RT::ScripAction::SendEmail;
eval 'use GnuPG::Interface; 1' or plan skip_all => 'GnuPG required.';
Modified: rt/branches/3.999-DANGEROUS/t/web/custom_frontpage.t
==============================================================================
--- rt/branches/3.999-DANGEROUS/t/web/custom_frontpage.t (original)
+++ rt/branches/3.999-DANGEROUS/t/web/custom_frontpage.t Mon Sep 24 00:16:53 2007
@@ -1,8 +1,8 @@
#!/usr/bin/perl -w
use strict;
-use Test::More tests => 7;
-use RT::Test;
+use RT::Test; use Test::More tests => 7;
+
my ($baseurl, $m) = RT::Test->started_ok;
my $url = $m->rt_base_url;
Modified: rt/branches/3.999-DANGEROUS/t/web/custom_search.t
==============================================================================
--- rt/branches/3.999-DANGEROUS/t/web/custom_search.t (original)
+++ rt/branches/3.999-DANGEROUS/t/web/custom_search.t Mon Sep 24 00:16:53 2007
@@ -1,8 +1,8 @@
#!/usr/bin/perl -w
use strict;
-use Test::More tests => 10;
-use RT::Test;
+use RT::Test; use Test::More tests => 10;
+
my ($baseurl, $m) = RT::Test->started_ok;
my $url = $m->rt_base_url;
Modified: rt/branches/3.999-DANGEROUS/t/web/query_builder.t
==============================================================================
--- rt/branches/3.999-DANGEROUS/t/web/query_builder.t (original)
+++ rt/branches/3.999-DANGEROUS/t/web/query_builder.t Mon Sep 24 00:16:53 2007
@@ -1,12 +1,12 @@
#!/usr/bin/perl
use strict;
-use Test::More tests => 42;
+use RT::Test; use Test::More tests => 42;
use HTTP::Request::Common;
use HTTP::Cookies;
use LWP;
use Encode;
-use RT::Test;
+
my $cookie_jar = HTTP::Cookies->new;
my ($baseurl, $agent) = RT::Test->started_ok;
Modified: rt/branches/3.999-DANGEROUS/t/web/rights.t
==============================================================================
--- rt/branches/3.999-DANGEROUS/t/web/rights.t (original)
+++ rt/branches/3.999-DANGEROUS/t/web/rights.t Mon Sep 24 00:16:53 2007
@@ -2,8 +2,8 @@
use strict;
use warnings;
-use Test::More tests => 14;
-use RT::Test;
+use RT::Test; use Test::More tests => 14;
+
my ($baseurl, $m) = RT::Test->started_ok;
ok $m->login, "logged in";
Modified: rt/branches/3.999-DANGEROUS/t/web/rights1.t
==============================================================================
--- rt/branches/3.999-DANGEROUS/t/web/rights1.t (original)
+++ rt/branches/3.999-DANGEROUS/t/web/rights1.t Mon Sep 24 00:16:53 2007
@@ -2,8 +2,8 @@
use strict;
use HTTP::Cookies;
-use Test::More tests => 37;
-use RT::Test;
+use RT::Test; use Test::More tests => 37;
+
my ($baseurl, $agent) = RT::Test->started_ok;
# Create a user with basically no rights, to start.
Modified: rt/branches/3.999-DANGEROUS/t/web/ticket_owner.t
==============================================================================
--- rt/branches/3.999-DANGEROUS/t/web/ticket_owner.t (original)
+++ rt/branches/3.999-DANGEROUS/t/web/ticket_owner.t Mon Sep 24 00:16:53 2007
@@ -3,8 +3,8 @@
use strict;
use warnings;
-use Test::More tests => 91;
-use RT::Test;
+use RT::Test; use Test::More tests => 91;
+
my $queue = RT::Test->load_or_create_queue( Name => 'Regression' );
ok $queue && $queue->id, 'loaded or created queue';
Modified: rt/branches/3.999-DANGEROUS/t/web/ticket_seen.t
==============================================================================
--- rt/branches/3.999-DANGEROUS/t/web/ticket_seen.t (original)
+++ rt/branches/3.999-DANGEROUS/t/web/ticket_seen.t Mon Sep 24 00:16:53 2007
@@ -3,8 +3,8 @@
use strict;
use warnings;
-use Test::More tests => 16;
-use RT::Test;
+use RT::Test; use Test::More tests => 16;
+
my $queue = RT::Test->load_or_create_queue( Name => 'Regression' );
ok $queue && $queue->id, 'loaded or created queue';
More information about the Rt-commit
mailing list