Skip to content

Commit

Permalink
Making progress with fixing mochiweb errors
Browse files Browse the repository at this point in the history
  • Loading branch information
choptastic committed Jan 12, 2015
1 parent 2cd9ff5 commit cba23eb
Show file tree
Hide file tree
Showing 7 changed files with 87 additions and 95 deletions.
7 changes: 4 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -49,8 +49,7 @@ run:

##### COMMON TEST

test: test_cowboy test_inets test_webmachine test_yaws
#test: test_cowboy test_inets test_mochiweb test_webmachine test_yaws
test: test_cowboy test_inets test_mochiweb test_webmachine test_yaws

test_cowboy:
(make test_core BACKEND=cowboy)
Expand All @@ -67,8 +66,10 @@ test_webmachine:
test_yaws:
(make test_core BACKEND=yaws)

clean_test:
(rm rebar.test.*.config)

test_core: clean
test_core: clean clean_test
(escript rebar_deps/merge_deps.escript rebar.test.config rebar_deps/$(BACKEND).deps rebar.test.$(BACKEND).config)
(cd test; sed "s/BACKEND/$(BACKEND)/" < app.config.src > app.config)
./rebar --config "rebar.test.$(BACKEND).config" get-deps
Expand Down
19 changes: 0 additions & 19 deletions data/inets_get_request_data

This file was deleted.

25 changes: 0 additions & 25 deletions data/inets_post_request_data

This file was deleted.

26 changes: 0 additions & 26 deletions data/mochiweb_get_request_data

This file was deleted.

19 changes: 0 additions & 19 deletions data/yaws_get_request_data

This file was deleted.

82 changes: 82 additions & 0 deletions test/app.config
Original file line number Diff line number Diff line change
@@ -0,0 +1,82 @@
%% vim: ts=4 sw=4 et ft=erlang
%% This .src file will have instances of mochiweb replaced with each backend upon testing
[
{simple_bridge, [

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% STANDARD SETTINGS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

{server_name, bridge_test_mochiweb},
%% You can call this whatever you want. Name it after your application
%% is probably best

{handler, simple_bridge_test_handler},
%% the name of the simple_bridge handler module, which is expected to
%% export run/1, ws_init/1, ws_message/1, ws_info/1, and terminate/1

{backend, mochiweb}, %% This will be updated for each test
%% cowboy | inets | mochiweb | webmachine | yaws
%% It's not necessary to specify this in the confiugration unless you
%% want to start simple_bridge with application:start(simple_bridge) or
%% simple_bridge:start/0

{address, "127.0.0.1"},
%% IP address to bind, either in tuple format or string

{port, 8000},
%% Port to bind

{document_root, "../../test/static"},
%% The path on the local machine to handle static files

{static_paths, ["static/"]},
%% The list of paths to be automatically translated to static paths by
%% simple_bridge

%% {anchor, AnchorModule}
%% If not provided or set to undefined, will use
%% mochiweb_simple_bridge_anchor. This is the backend-specific module
%% for handling the requests from your chosen backend.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% FILE UPLOAD SETTINGS
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

{max_post_size, 100},
%% No multipart request greater than above will be accepted. Units are
%% MB

{max_file_size, 100},
%% No single uploaded file will be accepted greater than the above.
%% Units are MB.

{max_file_in_memory_size, 0},
%% If a file is less than the above, then instead of writing the file
%% to disk, it'll be retained in memory and can be retrieved by
%% sb_uploaded_file:data/1. See the README for more info.

{scratch_dir, "./scratch"}
%% This is the location of the temp directory where uploaded files will
%% be placed.

%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
%% mochiweb-SPECIFIC DISPATCH TABLES:
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

%% {webmachine_dispatch, DispatchTable},
%% Webmachine dispatch table override (ignores static_paths above)

%% {webmachine_dispatch_function, {Module, Function}}
%% A Module:Function() that when evaluated will return a dispatch table
%% for Webmachine, again ignores the static_paths above

%% {cowboy_dispatch, DispatchTable}
%% Cowboy dispatch table override (ignores static_paths)

%% {cowboy_dispatch_function, {Module, Function}}
%% A Module:Function() that when evaluated will return a dispatch tavle
%% for Cowboy, again ignoring the static_paths above
]}
].

4 changes: 1 addition & 3 deletions test/simple_bridge_SUITE.erl
Original file line number Diff line number Diff line change
Expand Up @@ -32,9 +32,7 @@ groups() ->
init_per_group(main, Config) ->
io:format("CWD: ~p~n", [file:get_cwd()]),
inets:start(),
%% using 'undefined' will load it from the app.config
simple_bridge:start(undefined, simple_bridge_test_handler),
timer:sleep(10000),
application:start(simple_bridge),
Config.

end_per_group(main, Config) ->
Expand Down

0 comments on commit cba23eb

Please sign in to comment.