Add Catalyst::Test::MessageDriven for in-process testing of messaging apps.
[catagits/Catalyst-Engine-STOMP.git] / testapp / lib / StompTestApp / Controller / TestController.pm
CommitLineData
cb2c6d47 1package # Hide from PAUSE
2 StompTestApp::Controller::TestController;
0a663589 3use Moose;
cb2c6d47 4use namespace::autoclean;
0a663589 5
6BEGIN { extends 'Catalyst::Controller::MessageDriven' };
7
8sub testaction : Local {
bf8937b7 9 my ($self, $c, $request) = @_;
0a663589 10
11 # Reply with a minimal response message
12 my $response = { type => 'testaction_response' };
13 $c->stash->{response} = $response;
14}
15
bf8937b7 16sub badaction : Local {
17 my ($self, $c, $request) = @_;
18 die "oh noes";
19}
20
40e96678 21sub ping : Local {
22 my ($self, $c, $request) = @_;
23 if ($request->{type} eq 'ping') {
24 $c->stash->{response} = { status => 'PONG' };
25 return;
26 }
27 die "not a ping request?";
28}
29
0a663589 301;