[Jifty-commit] jifty branch, plack, updated. 493ab18293c0f72bd35870c0b29ae9254cf341ff
Jifty commits
jifty-commit at lists.jifty.org
Sun Jan 10 07:57:00 EST 2010
The branch, plack has been updated
via 493ab18293c0f72bd35870c0b29ae9254cf341ff (commit)
via 744673bcca98e6c8b24b0bb95869715d4b9f00d5 (commit)
via 2a760d3780f8692d70f2cdb3303d21c596648368 (commit)
via b05b1fba1e9bc0f833fd24505d048f98ff997fb1 (commit)
via da3a61aafcfe9f6c302fd305a768b38f585ef2f4 (commit)
from d0c380a6a4e5b5a338b95207b814b32246a85974 (commit)
Summary of changes:
Makefile.PL | 1 -
lib/Jifty.pm | 2 +-
lib/Jifty/Everything.pm | 5 -
lib/Jifty/Handler.pm | 11 ++
lib/Jifty/Plugin/Config/View.pm | 2 +-
lib/Jifty/Plugin/TestServerWarnings.pm | 3 +-
lib/Jifty/Script/Server.pm | 4 +-
lib/Jifty/Server.pm | 177 --------------------
lib/Jifty/Server/Fork.pm | 28 ---
lib/Jifty/Server/Fork/NetServer.pm | 70 --------
lib/Jifty/Server/Prefork.pm | 29 ----
lib/Jifty/Server/Prefork/NetServer.pm | 70 --------
lib/Jifty/Test.pm | 54 +++----
lib/Jifty/Test/WWW/Declare.pm | 5 +-
lib/Jifty/Test/WWW/Mechanize.pm | 12 +-
lib/Jifty/TestServer.pm | 55 ++++---
lib/Jifty/TestServer/Apache.pm | 103 ------------
lib/Jifty/TestServer/Plack.pm | 14 --
t/08-client.t | 9 +-
t/TestApp-Dispatcher/t/00-basic.t | 2 +-
t/TestApp-Dispatcher/t/on.t | 2 +-
t/TestApp-Dispatcher/t/under.t | 2 +-
t/TestApp-Mason/t/content.t | 2 +-
t/TestApp-Mason/t/index_vs_dhandler.t | 2 +-
t/TestApp-Plugin-PasswordAuth/t/01-tokengen.t | 2 +-
t/TestApp-Plugin-PasswordAuth/t/11-current_user.t | 2 +-
t/TestApp-Plugin-PasswordAuth/t/12-i18n.t | 2 +-
t/TestApp-Plugin-PasswordAuth/t/12-signup.t | 2 +-
t/TestApp-Plugin-REST/t/02-basic-use.t | 2 +-
t/TestApp-Plugin-REST/t/03-format.t | 2 +-
t/TestApp-Plugin-SetupWizard/t/001-basic.t | 2 +-
t/TestApp-Regions/t/01-region.t | 2 +-
t/TestApp-Template-Declare/t/td.t | 2 +-
t/TestApp/t/02-dispatch-http.t | 2 +-
t/TestApp/t/02-dispatch-https.t | 4 +-
.../t/02-dispatch-show-rule-in-wrong-ruleset.t | 2 +-
t/TestApp/t/02-dispatch.t | 2 +-
t/TestApp/t/03-static.t | 2 +-
t/TestApp/t/05-actions-before-redirect.pm | 2 +-
t/TestApp/t/05-editactions-Cachable.t | 2 +-
t/TestApp/t/05-editactions-Record.t | 2 +-
t/TestApp/t/06-validation.t | 2 +-
t/TestApp/t/07-sandboxing.t | 9 +-
t/TestApp/t/09-redirect.t | 2 +-
t/TestApp/t/11-current_user.t | 2 +-
t/TestApp/t/13-page-regions.t | 2 +-
t/TestApp/t/14-template-paths.t | 2 +-
t/TestApp/t/15-template-subclass.t | 2 +-
t/TestApp/t/16-template-region.t | 2 +-
t/TestApp/t/17-template-region-internal-redirect.t | 2 +-
t/TestApp/t/18-test-www-declare.t | 4 +-
t/TestApp/t/20-error-pages.t | 2 +
t/TestApp/t/21-js-arguments.t | 2 +-
t/TestApp/t/crud.t | 2 +-
t/TestApp/t/i18n-standalone.t | 2 +-
55 files changed, 122 insertions(+), 615 deletions(-)
delete mode 100644 lib/Jifty/Server.pm
delete mode 100644 lib/Jifty/Server/Fork.pm
delete mode 100644 lib/Jifty/Server/Fork/NetServer.pm
delete mode 100644 lib/Jifty/Server/Prefork.pm
delete mode 100644 lib/Jifty/Server/Prefork/NetServer.pm
delete mode 100644 lib/Jifty/TestServer/Apache.pm
delete mode 100644 lib/Jifty/TestServer/Plack.pm
- Log -----------------------------------------------------------------
commit da3a61aafcfe9f6c302fd305a768b38f585ef2f4
Author: Chia-liang Kao <clkao at clkao.org>
Date: Fri Jan 8 21:14:19 2010 +0800
Jifty::Handler->psgi_app.
diff --git a/lib/Jifty/Handler.pm b/lib/Jifty/Handler.pm
index c161a4d..725dff5 100644
--- a/lib/Jifty/Handler.pm
+++ b/lib/Jifty/Handler.pm
@@ -111,6 +111,17 @@ sub view {
return $self->_view_handlers->{$class};
}
+=head2 psgi_app
+
+Returns a closure for L<PSGI> application.
+
+=cut
+
+sub psgi_app {
+ my $self = shift;
+ return sub { $self->handle_request(@_) };
+}
+
=head2 handle_request
When your server processs (be it Jifty-internal, FastCGI or anything
diff --git a/lib/Jifty/Script/Server.pm b/lib/Jifty/Script/Server.pm
index 8b75f25..5e9806f 100755
--- a/lib/Jifty/Script/Server.pm
+++ b/lib/Jifty/Script/Server.pm
@@ -197,10 +197,8 @@ sub _run_server {
my %args = ( port => $port );
$args{$_} = $self->{$_} for grep defined $self->{$_}, qw/host user group/;
- my $app = sub { Jifty->handler->handle_request(@_) };
-
$Jifty::SERVER = Plack::Loader->load('Standalone', %args);
- $Jifty::SERVER->run($app);
+ $Jifty::SERVER->run(Jifty->handler->psgi_app);
}
sub _stop {
commit b05b1fba1e9bc0f833fd24505d048f98ff997fb1
Author: Chia-liang Kao <clkao at clkao.org>
Date: Fri Jan 8 21:15:51 2010 +0800
Remove Jifty::Server::*
diff --git a/lib/Jifty/Server/Fork.pm b/lib/Jifty/Server/Fork.pm
deleted file mode 100644
index e0c53bb..0000000
--- a/lib/Jifty/Server/Fork.pm
+++ /dev/null
@@ -1,28 +0,0 @@
-package Jifty::Server::Fork;
-use Net::Server::Fork ();
-use base 'Jifty::Server';
-
-=head1 NAME
-
-Jifty::Server::Fork - Jifty::Server that supports multiple connections
-
-=head1 SYNOPSIS
-
-In your F<etc/config.yml>:
-
- framework:
- Web:
- ServerClass: Jifty::Server::Fork
-
-=head1 METHODS
-
-=head2 net_server
-
-This module depends on the L<Net::Server::Fork> module, which is part of
-the L<Net::Server> CPAN distribution.
-
-=cut
-
-sub net_server { 'Jifty::Server::Fork::NetServer' }
-
-1;
diff --git a/lib/Jifty/Server/Fork/NetServer.pm b/lib/Jifty/Server/Fork/NetServer.pm
deleted file mode 100644
index 2a10ac3..0000000
--- a/lib/Jifty/Server/Fork/NetServer.pm
+++ /dev/null
@@ -1,70 +0,0 @@
-package Jifty::Server::Fork::NetServer;
-
-use base 'Net::Server::Fork';
-
-=head1 NAME
-
-Jifty::Server::Fork::NetServer - Sets up children for Jifty::Server::Fork
-
-=head1 METHODS
-
-=head2 new
-
-Store the created L<Net::Server::Fork> object away after creating it.
-
-=cut
-
-sub new {
- my $class = shift;
- my $self = $class->SUPER::new(@_);
- $Jifty::SERVER->{net_server} = $self;
- return $self;
-}
-
-=head2 pre_loop_hook
-
-Tear down the database connection before falling into the accept loop,
-so that there is no shared database connection for children to
-inherit.
-
-=cut
-
-sub pre_loop_hook {
- Jifty->handle(undef);
-}
-
-=head2 post_accept_hook
-
-After forking every connection, resetup the database connections.
-
-=cut
-
-sub post_accept_hook {
- Jifty->setup_database_connection;
-}
-
-=head2 log
-
-Log messages should use Jifty's L<Log::Log4perl> infrastructure, not
-STDERR.
-
-=cut
-
-sub log {
- my $self = shift;
- my ($level, $msg) = @_;
- chomp $msg;
- my @levels = (
- $Log::Log4perl::FATAL,
- $Log::Log4perl::WARN,
- $Log::Log4perl::INFO,
- $Log::Log4perl::DEBUG,
- $Log::Log4perl::TRACE,
- $Log::Log4perl::TRACE,
- );
- $Log::Log4perl::caller_depth++;
- Log::Log4perl->get_logger(ref $self)->log($levels[$level],$msg);
- $Log::Log4perl::caller_depth--;
-}
-
-1;
diff --git a/lib/Jifty/Server/Prefork.pm b/lib/Jifty/Server/Prefork.pm
deleted file mode 100644
index 0b847fe..0000000
--- a/lib/Jifty/Server/Prefork.pm
+++ /dev/null
@@ -1,29 +0,0 @@
-package Jifty::Server::Prefork;
-use Net::Server::PreFork ();
-use base 'Jifty::Server';
-
-=head1 NAME
-
-Jifty::Server::Prefork - Jifty::Server that supports multiple connections
-
-=head1 SYNOPSIS
-
-In your F<etc/config.yml>:
-
- framework:
- Web:
- ServerClass: Jifty::Server::Prefork
-
-=head1 METHODS
-
-=head2 net_server
-
-This module depends on the L<Net::Server::PreFork> module, which is part of
-the L<Net::Server> CPAN distribution.
-
-=cut
-
-sub net_server { 'Jifty::Server::Prefork::NetServer' }
-
-
-1;
diff --git a/lib/Jifty/Server/Prefork/NetServer.pm b/lib/Jifty/Server/Prefork/NetServer.pm
deleted file mode 100644
index a53e992..0000000
--- a/lib/Jifty/Server/Prefork/NetServer.pm
+++ /dev/null
@@ -1,70 +0,0 @@
-package Jifty::Server::Prefork::NetServer;
-
-use base 'Net::Server::PreFork';
-
-=head1 NAME
-
-Jifty::Server::Prefork::NetServer - Sets up children for Jifty::Server::Prefork
-
-=head1 METHODS
-
-=head2 new
-
-Store the created L<Net::Server::PreFork> object away after creating it.
-
-=cut
-
-sub new {
- my $class = shift;
- my $self = $class->SUPER::new(@_);
- $Jifty::SERVER->{net_server} = $self;
- return $self;
-}
-
-=head2 pre_loop_hook
-
-Tear down the database connection before falling into the accept loop,
-so that there is no shared database connection for children to
-inherit.
-
-=cut
-
-sub pre_loop_hook {
- Jifty->handle(undef);
-}
-
-=head2 child_init_hook
-
-Sets up the database connection when spawning a new child.
-
-=cut
-
-sub child_init_hook {
- Jifty->setup_database_connection;
-}
-
-=head2 log
-
-Log messages should use Jifty's L<Log::Log4perl> infrastructure, not
-STDERR.
-
-=cut
-
-sub log {
- my $self = shift;
- my ($level, $msg) = @_;
- chomp $msg;
- my @levels = (
- $Log::Log4perl::FATAL,
- $Log::Log4perl::WARN,
- $Log::Log4perl::INFO,
- $Log::Log4perl::DEBUG,
- $Log::Log4perl::TRACE,
- $Log::Log4perl::TRACE,
- );
- $Log::Log4perl::caller_depth++;
- Log::Log4perl->get_logger(ref $self)->log($levels[$level],$msg);
- $Log::Log4perl::caller_depth--;
-}
-
-1;
commit 2a760d3780f8692d70f2cdb3303d21c596648368
Author: Chia-liang Kao <clkao at clkao.org>
Date: Fri Jan 8 21:16:59 2010 +0800
at end of test, only check TestServerWarnings if the test server has TD view enabled.
diff --git a/lib/Jifty/Test.pm b/lib/Jifty/Test.pm
index f16b122..702bdfa 100644
--- a/lib/Jifty/Test.pm
+++ b/lib/Jifty/Test.pm
@@ -658,7 +658,9 @@ sub _ending {
return if $Test->{Original_Pid} != $$;
my $should_die = 0;
- if ($Jifty::SERVER && (my $plugin = Jifty->find_plugin("Jifty::Plugin::TestServerWarnings"))) {
+ if ($Jifty::SERVER &&
+ (my $plugin = Jifty->find_plugin("Jifty::Plugin::TestServerWarnings")) &&
+ grep { $_ eq 'Jifty::View::Declare::Handler' } Jifty->handler->view_handlers) { # testserverwarnings plugin requires TD handler to work properly.
my @warnings = $plugin->decoded_warnings( 'http://localhost:'.$Jifty::SERVER->port );
$Test->diag("Uncaught warning: $_") for @warnings;
commit 744673bcca98e6c8b24b0bb95869715d4b9f00d5
Author: Chia-liang Kao <clkao at clkao.org>
Date: Sun Jan 10 20:19:34 2010 +0800
Let Jifty::Test->import do plan() for us.
diff --git a/lib/Jifty/Test/WWW/Declare.pm b/lib/Jifty/Test/WWW/Declare.pm
index e8cdaca..fd32d2e 100644
--- a/lib/Jifty/Test/WWW/Declare.pm
+++ b/lib/Jifty/Test/WWW/Declare.pm
@@ -14,11 +14,8 @@ sub import
{
my $class = shift;
- # examine the plan
- Test::More->import(@_);
-
# set up database and other things
- Jifty::Test->setup(\@_);
+ Jifty::Test->import(@_);
# export the DSL-ey functions
Test::WWW::Declare->export_to_level(2);
commit 493ab18293c0f72bd35870c0b29ae9254cf341ff
Author: Chia-liang Kao <clkao at clkao.org>
Date: Sun Jan 10 20:56:08 2010 +0800
Make Jifty test work with psgi inline and forked test server.
diff --git a/Makefile.PL b/Makefile.PL
index ea6dc1a..02a69b5 100644
--- a/Makefile.PL
+++ b/Makefile.PL
@@ -118,7 +118,6 @@ feature 'Development of a jifty application' =>
recommends('DBD::SQLite' => 1.11),
recommends('Test::Base' => 0.44), # Test::Base::Filter
recommends('Module::Install::Admin' => '0.50'),
- recommends('Test::HTTP::Server::Simple' => '0.10'),
recommends('Test::HTML::Lint' => 0),
recommends('Test::MockModule' => '0.05'),
recommends('Test::MockObject' => '1.07'),
diff --git a/lib/Jifty.pm b/lib/Jifty.pm
index c835cb8..9df681b 100644
--- a/lib/Jifty.pm
+++ b/lib/Jifty.pm
@@ -538,7 +538,7 @@ sub background {
} else {
close STDOUT;
close STDIN;
- $Jifty::SERVER->close_client_sockets if $Jifty::SERVER;
+ # XXX: make $Jifty::SERVER close client sockets if exists
Jifty->handle->dbh->{InactiveDestroy} = 1;
Jifty->setup_database_connection();
$sub->();
diff --git a/lib/Jifty/Everything.pm b/lib/Jifty/Everything.pm
index 8ad1ae5..6918c1a 100644
--- a/lib/Jifty/Everything.pm
+++ b/lib/Jifty/Everything.pm
@@ -69,11 +69,6 @@ use Jifty::Result ();
use Jifty::Response ();
use Jifty::CurrentUser ();
-# We can _not_ load Server.pm unless we're in a Server context because
-# HTTP::Server::Simple::Mason bastardizes HTML::Mason::FakeApache::send_http_header
-# with hook::lexwrap
-#use Jifty::Server;
-
use Jifty::Web ();
use Jifty::Web::Session ();
use Jifty::Web::PageRegion ();
diff --git a/lib/Jifty/Plugin/Config/View.pm b/lib/Jifty/Plugin/Config/View.pm
index 3aafd37..d82c82b 100644
--- a/lib/Jifty/Plugin/Config/View.pm
+++ b/lib/Jifty/Plugin/Config/View.pm
@@ -102,7 +102,7 @@ EOF
};
Jifty->handler->buffer->flush_output();
- $Jifty::SERVER->restart;
+ # XXX: hook into plack::loader to restart server
};
1;
diff --git a/lib/Jifty/Plugin/TestServerWarnings.pm b/lib/Jifty/Plugin/TestServerWarnings.pm
index bf39182..d170350 100644
--- a/lib/Jifty/Plugin/TestServerWarnings.pm
+++ b/lib/Jifty/Plugin/TestServerWarnings.pm
@@ -125,7 +125,8 @@ sub decoded_warnings {
my $base = shift;
my $Test = Jifty::Test->builder;
- if ($Test->{Original_Pid} == $$) {
+
+ if ($Jifty::SERVER && $Jifty::SERVER->isa('Jifty::TestServer::Inline')) {
return splice @{ $self->{'stashed_warnings'} };
}
diff --git a/lib/Jifty/Server.pm b/lib/Jifty/Server.pm
deleted file mode 100644
index 29f894b..0000000
--- a/lib/Jifty/Server.pm
+++ /dev/null
@@ -1,177 +0,0 @@
-use warnings;
-use strict;
-
-package Jifty::Server;
-
-=head1 NAME
-
-Jifty::Server - Stand-alone server implementation for Jifty
-
-=head1 SYNOPSIS
-
- use Jifty::Server;
- my $server = Jifty::Server->new();
- $server->run();
-
-=head1 DESCRIPTION
-
-C<Jifty::Server> is a subclass of L<HTTP::Server::Simple> which
-creates a handy standalone web server for a lightweight Jifty application.
-
-=cut
-
-
-use base qw/HTTP::Server::Simple::CGI Jifty::Object/;
-use File::Spec;
-use Log::Log4perl;
-use HTTP::Server::Simple;
-use HTTP::Server::Simple::Recorder;
-
-=head1 METHODS
-
-=head2 new
-
-Creates a new C<Jifty::Server> object.
-
-=cut
-
-sub new {
- my $class = shift;
- my $self = {};
- bless $self, $class;
- $self->setup_jifty(@_);
- $self->recording_on if $ENV{'JIFTY_RECORD'};
-
- return ($self);
-}
-
-=head2 setup_jifty
-
-Sets up the Jifty singleton. This is called automatically by L</new>.
-
-=cut
-
-sub setup_jifty {
- my $self = shift;
- my %args = (
- port => undef,
- @_
- );
-
- Jifty->config->framework('Web')->{'Port'} = $args{port} if $args{port};
- $self->port( Jifty->config->framework('Web')->{'Port'} || 8888 );
-}
-
-=head2 handle_request CGI
-
-Calls L<Jifty::Handler/handle_request> with the CGI object. If
-running tests, send test warnings on specific requests.
-
-=cut
-
-sub handle_request {
- my $self = shift;
- my $cgi = shift;
-
- Jifty->handler->handle_request( cgi => $cgi );
-}
-
-=head2 print_banner
-
-Overrives L<HTML::Server::Simple::Mason>'s print_banner to use the
-logging framework to record the server's startup
-
-=cut
-
-sub print_banner {
- my $self = shift;
- $self->log->info("You can connect to your server at ", Jifty::Web->url);
-}
-
-=head2 recorder_prefix
-
-Returns the filename prefix used if L<HTTP::Server::Simple::Recorder> support is being used.
-
-=cut
-
-sub recorder_prefix {
- # XXX TODO FIXME get from config
- Jifty::Util->absolute_path("log/recorded/jifty-recorded.$$")
-}
-
-=head2 recording_on
-
-Sets this server to use L<HTTP::Server::Simple::Recorder>.
-
-(See also the C<JIFTY_RECORD> environment variable and the C<-r> switch to C<standalone_server>.)
-
-=cut
-
-sub recording_on {
- my $class = shift;
- our @ISA;
- unshift @ISA, "HTTP::Server::Simple::Recorder" unless $class->isa('HTTP::Server::Simple::Recorder');
-}
-
-=head2 after_setup_listener
-
-If C<$ENV{JIFTY_SERVER_SIGREADY}> is set, send the signal to the
-parent when the server is ready for requests.
-
-=cut
-
-sub after_setup_listener {
- my $self = shift;
-
- my $sig = $ENV{JIFTY_SERVER_SIGREADY} or return;
- kill $sig => getppid();
-}
-
-=head2 restart
-
-Sets up the arguments needed for restarting the server using C<jifty server>.
-
-=cut
-
-sub restart {
- my $self = shift;
- local @ARGV = ( 'server', '--restart' );
- $self->SUPER::restart;
-}
-
-=head2 close_client_sockets
-
-Closes all active client connections.
-
-=cut
-
-sub close_client_sockets {
- my $self = shift;
- close STDOUT;
- close STDIN;
- if ($self->{net_server}) {
- close $self->{net_server}{server}{client};
- } else {
- close $self->{_stdio_handle};
- }
-}
-
-=head2 started_ok
-
-After starting, ensure we have a different database socket from the
-server.
-
-=cut
-
-sub started_ok {
- my $self = shift;
- my $ret = $self->SUPER::started_ok(@_);
- if ($ret) {
- Jifty->handle->dbh->{InactiveDestroy} = 1;
- Jifty->setup_database_connection;
- }
- return $ret;
-}
-
-1;
-
diff --git a/lib/Jifty/Test.pm b/lib/Jifty/Test.pm
index 702bdfa..d832cb5 100644
--- a/lib/Jifty/Test.pm
+++ b/lib/Jifty/Test.pm
@@ -14,10 +14,6 @@ use Hash::Merge;
use Digest::MD5 qw/md5_hex/;
use Cwd qw/abs_path cwd/;
-# this is required here because we want Test::HTTP::Server::Simple's
-# END to be at the very last, later than Jifty::Test's
-use Test::HTTP::Server::Simple;
-
=head1 NAME
Jifty::Test - Jifty's test module
@@ -194,6 +190,19 @@ sub setup {
$args ||= [];
my %args = @{$args} % 2 ? (@{$args}, 1) : @{$args};
+ my $server = $ENV{JIFTY_TEST_SERVER} ||= 'Inline';
+
+ if ($server eq 'Inline') {
+ require Jifty::Test::WWW::Mechanize;
+ require Test::WWW::Mechanize::PSGI;
+ unshift @Jifty::Test::WWW::Mechanize::ISA, 'Test::WWW::Mechanize::PSGI';
+ }
+
+ if ($args{actual_server}) {
+ $class->builder->plan(skip_all => "This test requires an actual test server to run. Run with JIFTY_TEST_SERVER=Standalone instead")
+ if $ENV{JIFTY_TEST_SERVER} eq 'Inline';
+ }
+
# Spit out a plan (if we got one) *before* we load modules, in
# case of compilation errors
unless ($class->builder->has_plan) {
@@ -203,7 +212,6 @@ sub setup {
# Require the things we need
require Jifty::YAML;
- require Jifty::Server;
require Jifty::Script::Schema;
$class->builder->{no_handle} = $args{no_handle};
@@ -448,36 +456,22 @@ sub _testfile_to_dbname {
=head2 make_server
-Creates a new L<Jifty::Server> which C<ISA> L<Jifty::TestServer> and
-returns it.
+Creates a new L<Jifty::TestServer> depending on the value of
+$ENV{JIFTY_TEST_SERVER}. If the environment variable is unset or
+C<Inline>, we run tests using PSGI inline wihtout spawning an actual
+server. Otherwise, we fork off a Plack::Server to run tests against.
=cut
sub make_server {
my $class = shift;
+ use Jifty::TestServer;
- # XXX: Jifty::TestServer is not a Jifty::Server, it is actually
- # server controller that invokes bin/jifty server. kill the
- # unshift here once we fix all the tests expecting it to be
- # jifty::server.
- if ($ENV{JIFTY_TESTSERVER_PROFILE} ||
- $ENV{JIFTY_TESTSERVER_COVERAGE} ||
- $ENV{JIFTY_TESTSERVER_DBIPROF} ||
- $^O eq 'MSWin32') {
- require Jifty::TestServer;
- unshift @Jifty::Server::ISA, 'Jifty::TestServer';
- } elsif ($ENV{JIFTY_APACHETEST}) {
- require Jifty::TestServer::Apache;
- unshift @Jifty::Server::ISA, 'Jifty::TestServer::Apache';
- }
- else {
- require Jifty::TestServer::Plack;
- unshift @Jifty::Server::ISA, 'Jifty::TestServer::Plack';
- }
+ my $server_class = $ENV{JIFTY_TEST_SERVER} eq 'Inline'
+ ? 'Jifty::TestServer::Inline' : 'Jifty::TestServer';
+ Jifty::Util->require($server_class) or die $!;
- my $server = Jifty::Server->new;
- $Jifty::SERVER = $server;
- return $server;
+ $Jifty::SERVER = $server_class->new;
}
=head2 web
diff --git a/lib/Jifty/Test/WWW/Mechanize.pm b/lib/Jifty/Test/WWW/Mechanize.pm
index ffce267..8a2a47b 100644
--- a/lib/Jifty/Test/WWW/Mechanize.pm
+++ b/lib/Jifty/Test/WWW/Mechanize.pm
@@ -2,7 +2,7 @@ use strict;
use warnings;
package Jifty::Test::WWW::Mechanize;
-use base qw/Test::WWW::Mechanize::PSGI/;
+use base qw/Test::WWW::Mechanize/;
delete $ENV{'http_proxy'}; # Otherwise Test::WWW::Mechanize tries to go through your HTTP proxy
@@ -37,11 +37,15 @@ bot a cookie jar.
=cut
+my $plack_server_pid;
+
sub new {
- my $class = shift;
- my $app = sub { Jifty->handler->handle_request(@_) };
+ my ($class, @args) = @_;
+
+ push @args, app => Jifty->handler->psgi_app
+ if $class->isa('Test::WWW::Mechanize::PSGI');
- my $self = $class->SUPER::new(@_, app => $app);
+ my $self = $class->SUPER::new(@args);
$self->cookie_jar(HTTP::Cookies->new);
return $self;
diff --git a/lib/Jifty/TestServer.pm b/lib/Jifty/TestServer.pm
index a3fdee8..17d165a 100644
--- a/lib/Jifty/TestServer.pm
+++ b/lib/Jifty/TestServer.pm
@@ -1,10 +1,14 @@
package Jifty::TestServer;
+use Any::Moose;
use strict;
use warnings;
use File::Spec;
use Test::Builder;
use Test::Script::Run 'get_perl_cmd';
+use Plack::Loader;
+
+has port => (is => "rw", isa => "Int");
=head1 NAME
@@ -21,6 +25,12 @@ return the URL.
=cut
+sub BUILD {
+ my $self = shift;
+ Jifty->config->framework('Web')->{'Port'} = $self->port if $self->port;
+ $self->port( Jifty->config->framework('Web')->{'Port'} || 8888 );
+}
+
sub started_ok {
my $self = shift;
my $text = shift;
@@ -45,12 +55,23 @@ sub started_ok {
exit(0);
}
+ $self->{plack_server} = Plack::Loader->load
+ ($ENV{JIFTY_TEST_SERVER},
+ port => $self->port,
+ server_ready => sub {
+ kill 'USR1' => getppid();
+ });
+ $Jifty::SERVER = $self;
+
if (my $pid = fork()) {
- # We are expecting a USR1 from the child Jifty::Server
- # after it's ready to listen.
- $SIG{USR1} = sub { };
+ # We are expecting a USR1 from the child process after it's
+ # ready to listen.
+ my $handled;
+ $SIG{USR1} = sub { $handled = 1};
sleep 15;
- $self->{started} = 1;
+ Test::More::diag "did not get expected USR1 for test server readiness"
+ unless $handled;
+ $self->{cleanup} = [sub { kill TERM => $pid }];
my $Tester = Test::Builder->new;
$Tester->ok(1, $text);
# XXX: pull from jifty::config maybe
@@ -66,28 +87,14 @@ sub started_ok {
or die "Can't start a new session: $!";
}
- my @extra;
- if (my $profile_file = $ENV{JIFTY_TESTSERVER_PROFILE}) {
- push @extra, '-d:DProf';
- $ENV{"PERL_DPROF_OUT_FILE_NAME"} = $profile_file;
- }
- if ($ENV{JIFTY_TESTSERVER_NAMED_ACCESSOR}) {
- push @extra, '-MClass::Accessor::Named';
- }
- if (my $coverage = $ENV{JIFTY_TESTSERVER_COVERAGE}) {
- push @extra, '-MDevel::Cover'.($coverage =~ m/,/ ? "=$coverage" : '');
- }
-
- exec(get_perl_cmd(), @extra, '-MJifty::Util', '-MJifty::Script',
- '-e', 'Jifty::Script->dispatch', 'server', '--quiet',
- '--sigready', 'USR1',
- $ENV{JIFTY_TESTSERVER_DBIPROF} ? ('--dbiprof') : (),
- );
+ $self->{plack_server}->run(Jifty->handler->psgi_app);
+ exit;
}
-sub DESTROY {
- return unless $_[0]->{started};
- exec(get_perl_cmd('jifty'), 'server', '--stop');
+sub DEMOLISH {
+ $_->() for @{$_[0]->{cleanup}}
}
+__PACKAGE__->meta->make_immutable;
+no Any::Moose;
1;
diff --git a/lib/Jifty/TestServer/Apache.pm b/lib/Jifty/TestServer/Apache.pm
deleted file mode 100644
index 5e60b3a..0000000
--- a/lib/Jifty/TestServer/Apache.pm
+++ /dev/null
@@ -1,103 +0,0 @@
-package Jifty::TestServer::Apache;
-
-use strict;
-use warnings;
-use File::Spec;
-use Test::Builder;
-
-# explicitly ignore ClassLoader objects in @INC,
-# which'd be ignored in the end, though.
-my $INC = [grep { defined } map { File::Spec->rel2abs($_) } grep { !ref } @INC ];
-
-=head1 NAME
-
-Jifty::TestServer::Apache - Starting and stopping an apache server for tests
-
-=head1 DESCRIPTION
-
-=head1 METHOD
-
-=head2 started_ok
-
-Like started_ok in C<Test::HTTP::Server::Simple>, start the server and
-return the URL.
-
-=cut
-
-sub started_ok {
- my $self = shift;
- my $text = shift;
- $text = 'started server' unless defined $text;
-
- $self->{pidfile} = File::Temp->new;
- close $self->{pidfile};
- $self->{pidfile} .= "";
- my $ipc = File::Temp::tempdir( CLEANUP => 1 );
- my $errorlog = File::Temp->new;
- my $config = File::Temp->new;
-
- my $PATH = Jifty::Util->absolute_path("bin/jifty");
- my $STATIC = Jifty::Util->absolute_path(Jifty->config->framework('Web')->{StaticRoot});
-
- print $config <<"CONFIG";
-ServerName 127.0.0.1
-Port @{[$self->port]}
-User @{[scalar getpwuid($<)]}
-Group @{[scalar getgrgid($()]}
-MinSpareServers 1
-StartServers 1
-PidFile @{[$self->{pidfile}]}
-ErrorLog $errorlog
-<Location />
- Options FollowSymLinks ExecCGI
-</Location>
-FastCgiIpcDir $ipc
-FastCgiServer $PATH -initial-env JIFTY_COMMAND=fastcgi -idle-timeout 300 -processes 1 -initial-env PERL5LIB=@{[join(":",@{$INC})]}
-ScriptAlias / $PATH/
-Alias /static/ $STATIC/
-CONFIG
- close $config;
-
- if (fork()) {
- my $pid;
- for (1..15) {
- last if $pid = $self->pids;
- sleep 1;
- }
- my $Tester = Test::Builder->new;
- if ($pid) {
- $self->{started} = 1;
- $Tester->ok(1, $text);
- return "http://localhost:".$self->port;
- } else {
- $Tester->ok(0, $text);
- return "";
- }
- }
-
- exec($ENV{JIFTY_APACHETEST}, "-f", $config);
-}
-
-=head2 pids
-
-Returns the process ID of the Apache server.
-
-=cut
-
-sub pids {
- my $self = shift;
- return unless -e $self->{pidfile};
- my $pid = do {local @ARGV = ($self->{pidfile}); scalar <>};
- chomp $pid;
- return ($pid);
-}
-
-sub DESTROY {
- return unless $_[0]->{started};
- my($pid) = $_[0]->pids;
- kill(15, $pid) if $pid;
- 1 while ($_ = wait()) >= 0;
- sleep 1 while kill(0, $pid);
-}
-
-1;
diff --git a/lib/Jifty/TestServer/Plack.pm b/lib/Jifty/TestServer/Plack.pm
deleted file mode 100644
index 850a5b1..0000000
--- a/lib/Jifty/TestServer/Plack.pm
+++ /dev/null
@@ -1,14 +0,0 @@
-package Jifty::TestServer::Plack;
-use strict;
-use warnings;
-use base 'Test::HTTP::Server::Simple';
-use Test::More;
-
-sub started_ok {
- my $self = shift;
- my $port = $self->port;
- ok(1, "plack test server ok");
- return "http://localhost:$port";
-}
-
-1;
diff --git a/t/08-client.t b/t/08-client.t
index 48ac6af..b803091 100644
--- a/t/08-client.t
+++ b/t/08-client.t
@@ -1,17 +1,12 @@
use warnings;
use strict;
-use Jifty::Test tests => 4;
+use Jifty::Test tests => 4, actual_server => 1;
use_ok ('Jifty::Client');
my $server=Jifty::Test->make_server;
-isa_ok($server, 'Jifty::Server');
-
-if ($server->isa('Jifty::TestServer::Plack')) {
- Jifty::Test->builder->todo_skip("This test is not using the test framework, and requires a server to connect to. This doesn't work yet") for 1..2;
- exit 0;
-}
+isa_ok($server, 'Jifty::TestServer');
my $URL = $server->started_ok;
diff --git a/t/TestApp-Dispatcher/t/00-basic.t b/t/TestApp-Dispatcher/t/00-basic.t
index 68a24e6..871f275 100644
--- a/t/TestApp-Dispatcher/t/00-basic.t
+++ b/t/TestApp-Dispatcher/t/00-basic.t
@@ -9,7 +9,7 @@ use Jifty::Test::WWW::Mechanize;
my $server = Jifty::Test->make_server;
ok($server, 'got a server');
-isa_ok($server, 'Jifty::Server');
+isa_ok($server, 'Jifty::TestServer');
my $url = $server->started_ok;
my $mech = Jifty::Test::WWW::Mechanize->new();
diff --git a/t/TestApp-Dispatcher/t/on.t b/t/TestApp-Dispatcher/t/on.t
index de8487a..69315ec 100644
--- a/t/TestApp-Dispatcher/t/on.t
+++ b/t/TestApp-Dispatcher/t/on.t
@@ -9,7 +9,7 @@ use Jifty::Test::WWW::Mechanize;
my $server = Jifty::Test->make_server;
ok($server, 'got a server');
-isa_ok($server, 'Jifty::Server');
+isa_ok($server, 'Jifty::TestServer');
my $url = $server->started_ok;
my $mech = Jifty::Test::WWW::Mechanize->new();
diff --git a/t/TestApp-Dispatcher/t/under.t b/t/TestApp-Dispatcher/t/under.t
index dc695c8..351e219 100644
--- a/t/TestApp-Dispatcher/t/under.t
+++ b/t/TestApp-Dispatcher/t/under.t
@@ -8,7 +8,7 @@ use Jifty::Test::WWW::Mechanize;
my $server = Jifty::Test->make_server;
ok($server, 'got a server');
-isa_ok($server, 'Jifty::Server');
+isa_ok($server, 'Jifty::TestServer');
my $url = $server->started_ok;
my $mech = Jifty::Test::WWW::Mechanize->new();
diff --git a/t/TestApp-Mason/t/content.t b/t/TestApp-Mason/t/content.t
index b25327b..bb35f93 100644
--- a/t/TestApp-Mason/t/content.t
+++ b/t/TestApp-Mason/t/content.t
@@ -6,7 +6,7 @@ use Jifty::Test::Dist;
use Jifty::Test::WWW::Mechanize;
my $server = Jifty::Test->make_server;
-isa_ok($server, 'Jifty::Server');
+isa_ok($server, 'Jifty::TestServer');
my $URL = $server->started_ok;
my $mech = Jifty::Test::WWW::Mechanize->new;
$mech->get_ok($URL . '/outer');
diff --git a/t/TestApp-Mason/t/index_vs_dhandler.t b/t/TestApp-Mason/t/index_vs_dhandler.t
index 021b4e1..7f3af18 100644
--- a/t/TestApp-Mason/t/index_vs_dhandler.t
+++ b/t/TestApp-Mason/t/index_vs_dhandler.t
@@ -6,7 +6,7 @@ use Jifty::Test::Dist;
use Jifty::Test::WWW::Mechanize;
my $server = Jifty::Test->make_server;
-isa_ok($server, 'Jifty::Server');
+isa_ok($server, 'Jifty::TestServer');
my $URL = $server->started_ok;
my $mech = Jifty::Test::WWW::Mechanize->new;
$mech->get_ok($URL . '/foo');
diff --git a/t/TestApp-Plugin-PasswordAuth/t/01-tokengen.t b/t/TestApp-Plugin-PasswordAuth/t/01-tokengen.t
index 35cfa29..7f031a6 100644
--- a/t/TestApp-Plugin-PasswordAuth/t/01-tokengen.t
+++ b/t/TestApp-Plugin-PasswordAuth/t/01-tokengen.t
@@ -14,7 +14,7 @@ use Jifty::Test::WWW::Mechanize;
my $server = Jifty::Test->make_server;
-isa_ok($server, 'Jifty::Server');
+isa_ok($server, 'Jifty::TestServer');
my $URL = $server->started_ok;
my $mech = Jifty::Test::WWW::Mechanize->new();
diff --git a/t/TestApp-Plugin-PasswordAuth/t/11-current_user.t b/t/TestApp-Plugin-PasswordAuth/t/11-current_user.t
index b6d0623..1dd392a 100644
--- a/t/TestApp-Plugin-PasswordAuth/t/11-current_user.t
+++ b/t/TestApp-Plugin-PasswordAuth/t/11-current_user.t
@@ -40,7 +40,7 @@ is($bob->user_object->mygroup, 'admin', "The CurrentUser group is admin");
ok($bob->is_superuser, "CurrentUser is a superuser");
#my $server = Jifty::Test->make_server;
-#isa_ok($server, 'Jifty::Server');
+#isa_ok($server, 'Jifty::TestServer');
#my $URL = $server->started_ok;
#my $mech = Jifty::Test::WWW::Mechanize->new();
diff --git a/t/TestApp-Plugin-PasswordAuth/t/12-i18n.t b/t/TestApp-Plugin-PasswordAuth/t/12-i18n.t
index d2afec5..4c1fa1a 100644
--- a/t/TestApp-Plugin-PasswordAuth/t/12-i18n.t
+++ b/t/TestApp-Plugin-PasswordAuth/t/12-i18n.t
@@ -17,7 +17,7 @@ use LWP::UserAgent;
my $server = Jifty::Test->make_server;
-isa_ok($server, 'Jifty::Server');
+isa_ok($server, 'Jifty::TestServer');
my $URL = $server->started_ok;
my $mech = Jifty::Test::WWW::Mechanize->new();
diff --git a/t/TestApp-Plugin-PasswordAuth/t/12-signup.t b/t/TestApp-Plugin-PasswordAuth/t/12-signup.t
index 4575949..14e8457 100644
--- a/t/TestApp-Plugin-PasswordAuth/t/12-signup.t
+++ b/t/TestApp-Plugin-PasswordAuth/t/12-signup.t
@@ -14,7 +14,7 @@ use Jifty::Test::WWW::Mechanize;
my $server = Jifty::Test->make_server;
-isa_ok($server, 'Jifty::Server');
+isa_ok($server, 'Jifty::TestServer');
my $URL = $server->started_ok;
my $mech = Jifty::Test::WWW::Mechanize->new();
diff --git a/t/TestApp-Plugin-REST/t/02-basic-use.t b/t/TestApp-Plugin-REST/t/02-basic-use.t
index d40bfb4..5ac2e0e 100644
--- a/t/TestApp-Plugin-REST/t/02-basic-use.t
+++ b/t/TestApp-Plugin-REST/t/02-basic-use.t
@@ -14,7 +14,7 @@ use Jifty::Test::WWW::Mechanize;
my $server = Jifty::Test->make_server;
-isa_ok($server, 'Jifty::Server');
+isa_ok($server, 'Jifty::TestServer');
my $URL = $server->started_ok;
my $mech = Jifty::Test::WWW::Mechanize->new();
diff --git a/t/TestApp-Plugin-REST/t/03-format.t b/t/TestApp-Plugin-REST/t/03-format.t
index 50e440c..f6525f8 100644
--- a/t/TestApp-Plugin-REST/t/03-format.t
+++ b/t/TestApp-Plugin-REST/t/03-format.t
@@ -6,7 +6,7 @@ use Jifty::Test::Dist tests => 102;
use Jifty::Test::WWW::Mechanize;
my $server = Jifty::Test->make_server;
-isa_ok($server, 'Jifty::Server');
+isa_ok($server, 'Jifty::TestServer');
my $URL = $server->started_ok;
my $mech = Jifty::Test::WWW::Mechanize->new();
diff --git a/t/TestApp-Plugin-SetupWizard/t/001-basic.t b/t/TestApp-Plugin-SetupWizard/t/001-basic.t
index cee9446..f9ccad1 100644
--- a/t/TestApp-Plugin-SetupWizard/t/001-basic.t
+++ b/t/TestApp-Plugin-SetupWizard/t/001-basic.t
@@ -4,7 +4,7 @@ use TestApp::Plugin::SetupWizard::Test tests => 14;
my $server = Jifty::Test->make_server;
-isa_ok($server, 'Jifty::Server');
+isa_ok($server, 'Jifty::TestServer');
my $URL = $server->started_ok;
my $mech = Jifty::Test::WWW::Mechanize->new();
diff --git a/t/TestApp-Regions/t/01-region.t b/t/TestApp-Regions/t/01-region.t
index d7267ed..1d5ed2b 100644
--- a/t/TestApp-Regions/t/01-region.t
+++ b/t/TestApp-Regions/t/01-region.t
@@ -5,7 +5,7 @@ use Jifty::Test::Dist tests => 5;
use Jifty::Test::WWW::Mechanize;
my $server = Jifty::Test->make_server;
-isa_ok($server, 'Jifty::Server');
+isa_ok($server, 'Jifty::TestServer');
my $URL = $server->started_ok;
my $mech = Jifty::Test::WWW::Mechanize->new;
diff --git a/t/TestApp-Template-Declare/t/td.t b/t/TestApp-Template-Declare/t/td.t
index 2dc4953..482f6ce 100644
--- a/t/TestApp-Template-Declare/t/td.t
+++ b/t/TestApp-Template-Declare/t/td.t
@@ -7,7 +7,7 @@ use Jifty::Test::WWW::Mechanize;
plan tests => 9;
my $server = Jifty::Test->make_server;
-isa_ok( $server, 'Jifty::Server' );
+isa_ok( $server, 'Jifty::TestServer' );
my $URL = $server->started_ok;
my $mech = Jifty::Test::WWW::Mechanize->new;
diff --git a/t/TestApp/t/02-dispatch-http.t b/t/TestApp/t/02-dispatch-http.t
index 60bbb46..0ea01cf 100644
--- a/t/TestApp/t/02-dispatch-http.t
+++ b/t/TestApp/t/02-dispatch-http.t
@@ -10,7 +10,7 @@ use Jifty::Test::WWW::Mechanize;
my $server = Jifty::Test->make_server;
-isa_ok($server, 'Jifty::Server');
+isa_ok($server, 'Jifty::TestServer');
my $URL = $server->started_ok;
my $mech = Jifty::Test::WWW::Mechanize->new();
diff --git a/t/TestApp/t/02-dispatch-https.t b/t/TestApp/t/02-dispatch-https.t
index 1b61305..f3d1522 100644
--- a/t/TestApp/t/02-dispatch-https.t
+++ b/t/TestApp/t/02-dispatch-https.t
@@ -9,11 +9,11 @@ use Jifty::Test::WWW::Mechanize;
my $server = Jifty::Test->make_server;
-isa_ok($server, 'Jifty::Server');
+isa_ok($server, 'Jifty::TestServer');
my $URL = $server->started_ok;
my $mech = Jifty::Test::WWW::Mechanize->new();
-$URL =~ s/http:/https:/;
+#$URL =~ s/http:/https:/;
$mech->get_ok("$URL/dispatch/protocol", "Got /dispatch/protocol");
$mech->content_contains("HTTPS");
diff --git a/t/TestApp/t/02-dispatch-show-rule-in-wrong-ruleset.t b/t/TestApp/t/02-dispatch-show-rule-in-wrong-ruleset.t
index 52932e4..e702dea 100644
--- a/t/TestApp/t/02-dispatch-show-rule-in-wrong-ruleset.t
+++ b/t/TestApp/t/02-dispatch-show-rule-in-wrong-ruleset.t
@@ -7,7 +7,7 @@ use Jifty::Test::WWW::Mechanize;
my $server = Jifty::Test->make_server;
-isa_ok($server, 'Jifty::Server');
+isa_ok($server, 'Jifty::TestServer');
my $URL = $server->started_ok;
my $mech = Jifty::Test::WWW::Mechanize->new();
diff --git a/t/TestApp/t/02-dispatch.t b/t/TestApp/t/02-dispatch.t
index c4a0414..10df8ef 100644
--- a/t/TestApp/t/02-dispatch.t
+++ b/t/TestApp/t/02-dispatch.t
@@ -7,7 +7,7 @@ use Jifty::Test::WWW::Mechanize;
my $server = Jifty::Test->make_server;
-isa_ok($server, 'Jifty::Server');
+isa_ok($server, 'Jifty::TestServer');
my $URL = $server->started_ok;
my $mech = Jifty::Test::WWW::Mechanize->new();
diff --git a/t/TestApp/t/03-static.t b/t/TestApp/t/03-static.t
index 3b2eb5c..87a861a 100644
--- a/t/TestApp/t/03-static.t
+++ b/t/TestApp/t/03-static.t
@@ -7,7 +7,7 @@ use Jifty::Test::WWW::Mechanize;
my $server = Jifty::Test->make_server;
-isa_ok($server, 'Jifty::Server');
+isa_ok($server, 'Jifty::TestServer');
my $URL = $server->started_ok;
my $mech = Jifty::Test::WWW::Mechanize->new();
diff --git a/t/TestApp/t/05-actions-before-redirect.pm b/t/TestApp/t/05-actions-before-redirect.pm
index 97c7978..b15a989 100644
--- a/t/TestApp/t/05-actions-before-redirect.pm
+++ b/t/TestApp/t/05-actions-before-redirect.pm
@@ -17,7 +17,7 @@ use Jifty::Test::WWW::Mechanize;
my $server = Jifty::Test->make_server;
-isa_ok($server, 'Jifty::Server');
+isa_ok($server, 'Jifty::TestServer');
my $URL = $server->started_ok;
my $mech = Jifty::Test::WWW::Mechanize->new();
diff --git a/t/TestApp/t/05-editactions-Cachable.t b/t/TestApp/t/05-editactions-Cachable.t
index c933604..f80eb16 100644
--- a/t/TestApp/t/05-editactions-Cachable.t
+++ b/t/TestApp/t/05-editactions-Cachable.t
@@ -22,7 +22,7 @@ ok($id, "User create returned success");
my $server = Jifty::Test->make_server;
-isa_ok($server, 'Jifty::Server');
+isa_ok($server, 'Jifty::TestServer');
my $URL = $server->started_ok;
my $mech = Jifty::Test::WWW::Mechanize->new();
diff --git a/t/TestApp/t/05-editactions-Record.t b/t/TestApp/t/05-editactions-Record.t
index 1fe3983..cc9c153 100644
--- a/t/TestApp/t/05-editactions-Record.t
+++ b/t/TestApp/t/05-editactions-Record.t
@@ -22,7 +22,7 @@ is($o->tasty, 1, "User is tasty");
my $server = Jifty::Test->make_server;
-isa_ok($server, 'Jifty::Server');
+isa_ok($server, 'Jifty::TestServer');
my $URL = $server->started_ok;
my $mech = Jifty::Test::WWW::Mechanize->new();
diff --git a/t/TestApp/t/06-validation.t b/t/TestApp/t/06-validation.t
index fa09a80..0496ecf 100644
--- a/t/TestApp/t/06-validation.t
+++ b/t/TestApp/t/06-validation.t
@@ -7,7 +7,7 @@ use Jifty::Test::WWW::Mechanize;
my $server = Jifty::Test->make_server;
-isa_ok($server, 'Jifty::Server');
+isa_ok($server, 'Jifty::TestServer');
my $URL = $server->started_ok;
my $mech = Jifty::Test::WWW::Mechanize->new();
diff --git a/t/TestApp/t/07-sandboxing.t b/t/TestApp/t/07-sandboxing.t
index d28d10c..e8cd1ad 100644
--- a/t/TestApp/t/07-sandboxing.t
+++ b/t/TestApp/t/07-sandboxing.t
@@ -2,19 +2,14 @@
use warnings;
use strict;
-use Jifty::Test::Dist tests => 125;
+use Jifty::Test::Dist tests => 125, actual_server => 1;
use Jifty::Test::WWW::Mechanize;
use Net::HTTP;
use URI;
my $server = Jifty::Test->make_server;
-isa_ok($server, 'Jifty::Server');
-
-if ($server->isa('Jifty::TestServer::Plack')) {
- Jifty::Test->builder->todo_skip("This test is not using the test framework, and requires a server to connect to. This doesn't work yet") for 1..124;
- exit 0;
-}
+isa_ok($server, 'Jifty::TestServer');
my $uri = URI->new($server->started_ok);
my $plugin = Jifty->find_plugin("Jifty::Plugin::TestServerWarnings");
diff --git a/t/TestApp/t/09-redirect.t b/t/TestApp/t/09-redirect.t
index 6c7f20e..74aac9c 100644
--- a/t/TestApp/t/09-redirect.t
+++ b/t/TestApp/t/09-redirect.t
@@ -15,7 +15,7 @@ use Jifty::Test::WWW::Mechanize;
my $server = Jifty::Test->make_server;
-isa_ok($server, 'Jifty::Server');
+isa_ok($server, 'Jifty::TestServer');
my $URL = $server->started_ok;
my $mech = Jifty::Test::WWW::Mechanize->new();
diff --git a/t/TestApp/t/11-current_user.t b/t/TestApp/t/11-current_user.t
index bd12980..98af941 100644
--- a/t/TestApp/t/11-current_user.t
+++ b/t/TestApp/t/11-current_user.t
@@ -69,7 +69,7 @@ my $dt = Jifty::DateTime->from_epoch(epoch => time);
is($now->time_zone->name, 'America/Anchorage', "from_epoch correctly gets the user's timezone");
my $server = Jifty::Test->make_server;
-isa_ok($server, 'Jifty::Server');
+isa_ok($server, 'Jifty::TestServer');
my $URL = $server->started_ok;
my $mech = Jifty::Test::WWW::Mechanize->new();
diff --git a/t/TestApp/t/13-page-regions.t b/t/TestApp/t/13-page-regions.t
index 7227f3a..f61cdf2 100644
--- a/t/TestApp/t/13-page-regions.t
+++ b/t/TestApp/t/13-page-regions.t
@@ -7,7 +7,7 @@ use Jifty::Test::WWW::Mechanize;
my $server = Jifty::Test->make_server;
-isa_ok($server, 'Jifty::Server');
+isa_ok($server, 'Jifty::TestServer');
my $URL = $server->started_ok;
diff --git a/t/TestApp/t/14-template-paths.t b/t/TestApp/t/14-template-paths.t
index 9ed366d..26ae51b 100644
--- a/t/TestApp/t/14-template-paths.t
+++ b/t/TestApp/t/14-template-paths.t
@@ -43,7 +43,7 @@ my @tests = (
plan tests => 2 + scalar(@tests) * 2;
my $server = Jifty::Test->make_server;
-isa_ok( $server, 'Jifty::Server' );
+isa_ok( $server, 'Jifty::TestServer' );
my $URL = $server->started_ok;
my $mech = Jifty::Test::WWW::Mechanize->new;
diff --git a/t/TestApp/t/15-template-subclass.t b/t/TestApp/t/15-template-subclass.t
index 565c1cb..8efa53a 100644
--- a/t/TestApp/t/15-template-subclass.t
+++ b/t/TestApp/t/15-template-subclass.t
@@ -62,7 +62,7 @@ new Region('$_[0]',{},'$_[1]',null,null);
plan tests => 2 + scalar(@tests) * 2;
my $server = Jifty::Test->make_server;
-isa_ok( $server, 'Jifty::Server' );
+isa_ok( $server, 'Jifty::TestServer' );
my $URL = $server->started_ok;
diff --git a/t/TestApp/t/16-template-region.t b/t/TestApp/t/16-template-region.t
index 7c6984b..aad9943 100644
--- a/t/TestApp/t/16-template-region.t
+++ b/t/TestApp/t/16-template-region.t
@@ -20,7 +20,7 @@ new Region('special',{'id':3},'/foo/item',null,null);
plan tests => 2 + scalar(@tests) * 2;
my $server = Jifty::Test->make_server;
-isa_ok( $server, 'Jifty::Server' );
+isa_ok( $server, 'Jifty::TestServer' );
my $URL = $server->started_ok;
use Test::LongString;
diff --git a/t/TestApp/t/17-template-region-internal-redirect.t b/t/TestApp/t/17-template-region-internal-redirect.t
index a39f752..e88f5c0 100644
--- a/t/TestApp/t/17-template-region-internal-redirect.t
+++ b/t/TestApp/t/17-template-region-internal-redirect.t
@@ -6,7 +6,7 @@ use Jifty::Test::Dist tests => 7;
use Jifty::Test::WWW::Mechanize;
my $server = Jifty::Test->make_server;
-isa_ok( $server, 'Jifty::Server' );
+isa_ok( $server, 'Jifty::TestServer' );
my $URL = $server->started_ok;
diff --git a/t/TestApp/t/18-test-www-declare.t b/t/TestApp/t/18-test-www-declare.t
index 17687e2..7e76273 100644
--- a/t/TestApp/t/18-test-www-declare.t
+++ b/t/TestApp/t/18-test-www-declare.t
@@ -9,11 +9,9 @@ BEGIN {
unless (eval { require Test::WWW::Declare }) {
plan skip_all => "Test::WWW::Declare isn't installed";
}
- plan skip_all => "This test is not using the test framework, and requires a server to connect to. This doesn't work yet";
-
}
-use Jifty::Test::WWW::Declare tests => 2;
+use Jifty::Test::WWW::Declare tests => 2, actual_server => 1;
# this is a duplication of t/TestApp/t/17-template-region-internal-redirect.t
# if the user sees failures here, then he either saw failures in t/17 OR
diff --git a/t/TestApp/t/20-error-pages.t b/t/TestApp/t/20-error-pages.t
index 5efeafb..9efd026 100644
--- a/t/TestApp/t/20-error-pages.t
+++ b/t/TestApp/t/20-error-pages.t
@@ -13,6 +13,8 @@ use Jifty::Test::Dist tests => 1 + 2 * 29;
use Jifty::Test::WWW::Mechanize;
my $URL = Jifty::Test->make_server->started_ok;
+#my $URL = $s->started_ok;
+diag $URL;
my $mech = Jifty::Test::WWW::Mechanize->new;
for my $path ("", "/td") {
diff --git a/t/TestApp/t/21-js-arguments.t b/t/TestApp/t/21-js-arguments.t
index dea072b..1447442 100644
--- a/t/TestApp/t/21-js-arguments.t
+++ b/t/TestApp/t/21-js-arguments.t
@@ -15,7 +15,7 @@ use Jifty::Test::WWW::Mechanize;
my $server = Jifty::Test->make_server;
-isa_ok($server, 'Jifty::Server');
+isa_ok($server, 'Jifty::TestServer');
my $URL = $server->started_ok;
my $mech = Jifty::Test::WWW::Mechanize->new();
diff --git a/t/TestApp/t/crud.t b/t/TestApp/t/crud.t
index e5bf794..cf13fc3 100644
--- a/t/TestApp/t/crud.t
+++ b/t/TestApp/t/crud.t
@@ -6,7 +6,7 @@ use Jifty::Test::Dist tests => 3;
use Jifty::Test::WWW::Mechanize;
my $server = Jifty::Test->make_server;
-isa_ok($server, 'Jifty::Server');
+isa_ok($server, 'Jifty::TestServer');
my $url = $server->started_ok;
diff --git a/t/TestApp/t/i18n-standalone.t b/t/TestApp/t/i18n-standalone.t
index 69d4dec..abea51c 100644
--- a/t/TestApp/t/i18n-standalone.t
+++ b/t/TestApp/t/i18n-standalone.t
@@ -12,7 +12,7 @@ use utf8;
use LWP::UserAgent;
my $server = Jifty::Test->make_server;
-isa_ok($server, 'Jifty::Server');
+isa_ok($server, 'Jifty::TestServer');
my $base = URI->new($server->started_ok);
-----------------------------------------------------------------------
More information about the Jifty-commit
mailing list