Merge default into bug23568

This commit is contained in:
David Wragg 2011-01-07 12:08:52 +00:00
commit e0ef03ea82
12 changed files with 11 additions and 677 deletions

View File

@ -1,12 +1,8 @@
syntax: regexp
^build/
^dist/
.*\.beam
\.beam$
^ebin/rabbit_management.app
^deps/webmachine/webmachine
^deps/webmachine/ebin
^deps/webmachine/include
^cover/
^priv/www-cli/rabbitmqadmin
^tmp/
^deps.mk$

View File

@ -1,32 +1 @@
PACKAGE=rabbitmq-management
APPNAME=rabbit_management
DEPS=rabbitmq-mochiweb rabbitmq-server rabbitmq-erlang-client rabbitmq-management-agent
INTERNAL_DEPS=webmachine
RUNTIME_DEPS=webmachine
TEST_APPS=inets mochiweb rabbit_mochiweb webmachine rabbit_management_agent amqp_client rabbit_management
TEST_ARGS=-rabbit_mochiweb port 55672
START_RABBIT_IN_TESTS=true
TEST_COMMANDS=rabbit_mgmt_test_all:all_tests()
EXTRA_PACKAGE_DIRS=priv
WEB_DIR=priv/www
JAVASCRIPT_DIR=$(WEB_DIR)/js
TEMPLATES_DIR=$(JAVASCRIPT_DIR)/tmpl
EXTRA_TARGETS=$(wildcard $(TEMPLATES_DIR)/*.ejs) \
$(wildcard $(JAVASCRIPT_DIR)/*.js) \
$(wildcard $(WEB_DIR)/*.html) \
$(wildcard $(WEB_DIR)/css/*.css) \
$(wildcard $(WEB_DIR)/img/*.png) \
priv/www-cli/rabbitmqadmin \
include ../include.mk
priv/www-cli/rabbitmqadmin:
cp bin/rabbitmqadmin $@
test: cleantest
cleantest:
rm -rf tmp
include ../umbrella.mk

View File

@ -1,117 +0,0 @@
diff -r 0c4b60ac68b4 demo/ebin/webmachine_demo.app
--- a/demo/ebin/webmachine_demo.app Tue Jun 15 08:36:55 2010 -0400
+++ b/demo/ebin/webmachine_demo.app Sat Dec 18 21:20:46 2010 +0000
@@ -11,4 +11,4 @@
{registered, []},
{mod, {webmachine_demo_app, []}},
{env, []},
- {applications, [kernel, stdlib, crypto]}]}.
+ {applications, [kernel, stdlib]}]}.
diff -r 0c4b60ac68b4 demo/src/demo_fs_resource.erl
--- a/demo/src/demo_fs_resource.erl Tue Jun 15 08:36:55 2010 -0400
+++ b/demo/src/demo_fs_resource.erl Sat Dec 18 21:20:46 2010 +0000
@@ -143,7 +143,7 @@
{LMod, ReqData, Context#context{metadata=[{'last-modified',
httpd_util:rfc1123_date(LMod)}|Context#context.metadata]}}.
-hash_body(Body) -> mochihex:to_hex(binary_to_list(crypto:sha(Body))).
+hash_body(Body) -> mochihex:to_hex(binary_to_list(erlang:md5(Body))).
generate_etag(ReqData, Context) ->
case maybe_fetch_object(Context, wrq:disp_path(ReqData)) of
diff -r 0c4b60ac68b4 demo/src/webmachine_demo.erl
--- a/demo/src/webmachine_demo.erl Tue Jun 15 08:36:55 2010 -0400
+++ b/demo/src/webmachine_demo.erl Sat Dec 18 21:20:46 2010 +0000
@@ -14,7 +14,6 @@
%% @spec start() -> ok
%% @doc Start the webmachine_demo server.
start() ->
- ensure_started(crypto),
ensure_started(webmachine),
application:start(webmachine_demo).
@@ -23,5 +22,4 @@
stop() ->
Res = application:stop(webmachine_demo),
application:stop(webmachine),
- application:stop(crypto),
Res.
diff -r 0c4b60ac68b4 ebin/webmachine.app
--- a/ebin/webmachine.app Tue Jun 15 08:36:55 2010 -0400
+++ b/ebin/webmachine.app Sat Dec 18 21:20:46 2010 +0000
@@ -25,4 +25,4 @@
{env, [
{dispatch_list, []}
]},
- {applications, [kernel, stdlib, crypto]}]}.
+ {applications, [kernel, stdlib]}]}.
diff -r 0c4b60ac68b4 priv/templates/ebin/wmskel.app
--- a/priv/templates/ebin/wmskel.app Tue Jun 15 08:36:55 2010 -0400
+++ b/priv/templates/ebin/wmskel.app Sat Dec 18 21:20:46 2010 +0000
@@ -13,7 +13,6 @@
{applications, [
kernel,
stdlib,
- crypto,
mochiweb,
webmachine
]},
diff -r 0c4b60ac68b4 priv/templates/src/wmskel.erl
--- a/priv/templates/src/wmskel.erl Tue Jun 15 08:36:55 2010 -0400
+++ b/priv/templates/src/wmskel.erl Sat Dec 18 21:20:46 2010 +0000
@@ -18,7 +18,6 @@
%% @spec start_link() -> {ok,Pid::pid()}
%% @doc Starts the app for inclusion in a supervisor tree
start_link() ->
- ensure_started(crypto),
ensure_started(mochiweb),
application:set_env(webmachine, webmachine_logger_module,
webmachine_logger),
@@ -28,7 +27,6 @@
%% @spec start() -> ok
%% @doc Start the {{appid}} server.
start() ->
- ensure_started(crypto),
ensure_started(mochiweb),
application:set_env(webmachine, webmachine_logger_module,
webmachine_logger),
@@ -41,5 +39,4 @@
Res = application:stop({{appid}}),
application:stop(webmachine),
application:stop(mochiweb),
- application:stop(crypto),
Res.
diff -r 0c4b60ac68b4 scripts/run_tests.escript
--- a/scripts/run_tests.escript Tue Jun 15 08:36:55 2010 -0400
+++ b/scripts/run_tests.escript Sat Dec 18 21:20:46 2010 +0000
@@ -21,7 +21,6 @@
end,
proplists:get_value(modules, App)),
- crypto:start(),
start_cover(Modules),
eunit:test(Modules, [verbose]),
analyze_cover(Modules);
diff -r 0c4b60ac68b4 src/webmachine.erl
--- a/src/webmachine.erl Tue Jun 15 08:36:55 2010 -0400
+++ b/src/webmachine.erl Sat Dec 18 21:20:46 2010 +0000
@@ -28,7 +28,6 @@
%% @doc Start the webmachine server.
start() ->
webmachine_deps:ensure(),
- application:start(crypto),
application:start(webmachine).
%% @spec stop() -> ok
diff -r 0c4b60ac68b4 src/webmachine_request.erl
--- a/src/webmachine_request.erl Tue Jun 15 08:36:55 2010 -0400
+++ b/src/webmachine_request.erl Sat Dec 18 21:20:46 2010 +0000
@@ -560,7 +560,7 @@
{CT, _} ->
CT
end,
- Boundary = mochihex:to_hex(crypto:rand_bytes(8)),
+ Boundary = mochihex:to_hex(mochiweb_util:rand_bytes(8)),
HeaderList = [{"Content-Type",
["multipart/byteranges; ",
"boundary=", Boundary]}],

View File

@ -1,46 +0,0 @@
HG_UPSTREAM=http://bitbucket.org/justin/webmachine
REVISION=0c4b60ac68b4
EBIN_DIR=ebin
INCLUDE_DIR=include
LIB_PACKAGE=webmachine
LIB_PACKAGE_DIR=$(LIB_PACKAGE)
LIB_PACKAGE_NAME=$(LIB_PACKAGE).ez
CHECKOUT_DIR=$(LIB_PACKAGE_DIR)-hg
TARGETS=$(LIB_PACKAGE_NAME)
all: $(TARGETS)
clean:
rm -rf $(EBIN_DIR)
rm -rf $(INCLUDE_DIR)
rm -rf $(TARGETS)
make -C $(LIB_PACKAGE_DIR) clean
distclean: clean
rm -rf $(CHECKOUT_DIR) $(LIB_PACKAGE_DIR)
$(LIB_PACKAGE_DIR): $(CHECKOUT_DIR)
cp -r $< $@
$(CHECKOUT_DIR):
rm -rf $@-tmp
hg clone -r $(REVISION) $(HG_UPSTREAM) $@-tmp
cd $@-tmp && patch -p1 < ../unrebar.patch && patch -p1 < ../uneunit.patch && \
patch -p1 < ../10-crypto.patch && cd .. && mv $@-tmp $@
%.ez: $(LIB_PACKAGE_DIR)
$(MAKE) -C $(LIB_PACKAGE_DIR) clean all
rm -rf ebin include
cp -r $(LIB_PACKAGE_DIR)/ebin $(EBIN_DIR)
cp -r $(LIB_PACKAGE_DIR)/include $(INCLUDE_DIR)
rm -rf $(INCLUDE_DIR)/mochiweb
zip $(LIB_PACKAGE_NAME) $(LIB_PACKAGE_DIR)/
zip -r $(LIB_PACKAGE_NAME) $(LIB_PACKAGE_DIR)/$(EBIN_DIR)/
echo-revision:
@echo $(REVISION)

View File

@ -1,426 +0,0 @@
diff -r 0c4b60ac68b4 src/webmachine_dispatcher.erl
--- a/src/webmachine_dispatcher.erl Tue Jun 15 08:36:55 2010 -0400
+++ b/src/webmachine_dispatcher.erl Thu Sep 09 18:48:27 2010 +0100
@@ -22,7 +22,6 @@
-author('Bryan Fink <bryan@basho.com>').
-export([dispatch/2, dispatch/3]).
--include_lib("eunit/include/eunit.hrl").
-define(SEPARATOR, $\/).
-define(MATCH_ALL, '*').
@@ -203,194 +202,3 @@
calculate_app_root(N) when N > 1 ->
string:join(lists:duplicate(N, ".."), [?SEPARATOR]).
-%%
-%% TEST
-%%
-
-app_root_test() ->
- ?assertEqual(".", calculate_app_root(1)),
- ?assertEqual("../..", calculate_app_root(2)),
- ?assertEqual("../../..", calculate_app_root(3)),
- ?assertEqual("../../../..", calculate_app_root(4)).
-
-reconstitute_test() ->
- ?assertEqual("", reconstitute([])),
- ?assertEqual("foo", reconstitute(["foo"])),
- ?assertEqual("foo/bar", reconstitute(["foo","bar"])),
- ?assertEqual("foo/bar/baz", reconstitute(["foo","bar","baz"])).
-
-split_host_test() ->
- ?assertEqual(["foo","bar","baz"], split_host("foo.bar.baz")).
-
-split_host_port_test() ->
- ?assertEqual({[], 80}, split_host_port("")),
- ?assertEqual({["foo","bar","baz"], 80},
- split_host_port("foo.bar.baz:80")),
- ?assertEqual({["foo","bar","baz"], 1234},
- split_host_port("foo.bar.baz:1234")).
-
-%% port binding
-bind_port_simple_match_test() ->
- ?assertEqual({ok, []}, bind_port(80, 80, [])),
- ?assertEqual({ok, [{foo, bar}]},
- bind_port(1234, 1234, [{foo, bar}])).
-
-bind_port_matchall_test() ->
- ?assertEqual({ok, []}, bind_port('*', 80, [])),
- ?assertEqual({ok, [{foo, bar}]},
- bind_port('*', 1234, [{foo, bar}])).
-
-bind_port_match_test() ->
- ?assertEqual({ok, [{foo, 80}]}, bind_port(foo, 80, [])),
- {ok, WholeBinding} = bind_port(foo, 1234, [{bar, baz}]),
- ?assertEqual(2, length(WholeBinding)),
- ?assertEqual(1234, proplists:get_value(foo, WholeBinding)),
- ?assertEqual(baz, proplists:get_value(bar, WholeBinding)).
-
-ind_port_fail_test() ->
- ?assertEqual(fail, bind_port(80, 1234, [])).
-
-%% path binding
-
-bind_path_empty_test() ->
- ?assertEqual({ok, [], [], 0}, bind([], [], [], 0)),
- ?assertEqual({ok, [], [{x,"a"}], 1},
- bind([], [], [{x,"a"}], 1)).
-
-bind_path_matchall_test() ->
- ?assertEqual({ok, [], [], 1},
- bind(['*'], [], [], 1)),
- ?assertEqual({ok, ["a","b"], [], 2},
- bind(['*'], ["a","b"], [], 0)).
-
-bind_path_fail_longer_match_test() ->
- ?assertEqual(fail, bind(["x"], [], [], 0)),
- ?assertEqual(fail, bind([foo], [], [], 0)).
-
-bind_path_with_binding_test() ->
- ?assertEqual({ok, [], [{foo, "a"}], 1},
- bind([foo], ["a"], [], 0)),
- {ok, Rest, Bind, Depth} = bind([foo,'*'], ["a","b"], [{bar, baz}], 1),
- ?assertEqual(["b"], Rest),
- ?assertEqual(3, Depth),
- ?assertEqual(2, length(Bind)),
- ?assertEqual("a", proplists:get_value(foo, Bind)),
- ?assertEqual(baz, proplists:get_value(bar, Bind)).
-
-bind_path_string_match_test() ->
- ?assertEqual({ok, [], [], 1},
- bind(["a"], ["a"], [], 0)),
- ?assertEqual({ok, [], [{foo, bar}], 4},
- bind(["a","b","c"], ["a","b","c"], [{foo, bar}], 1)).
-
-bind_path_string_fail_test() ->
- ?assertEqual(fail, bind(["a"], ["b"], [], 0)),
- ?assertEqual(fail, bind(["a","b"], ["a","c"], [], 0)).
-
-try_path_matching_test() ->
- ?assertEqual({bar, baz, [], [], ".", ""},
- try_path_binding([{["foo"], bar, baz}], ["foo"], [], 0)),
- Dispatch = [{["a", x], foo, bar},
- {["b", y], baz, quux},
- {["b", y, '*'], baz2, quux2}],
- ?assertEqual({foo, bar, [], [{x, "c"}], "../..", []},
- try_path_binding(Dispatch, ["a","c"], [], 0)),
- ?assertEqual({baz, quux, [], [{y, "c"}], "../..", []},
- try_path_binding(Dispatch, ["b","c"], [], 0)),
- ?assertEqual({baz2, quux2, ["z"], [{y, "c"}], "../../..", "z"},
- try_path_binding(Dispatch, ["b","c","z"], [], 0)),
- ?assertEqual({baz2, quux2, ["z","v"], [{y, "c"}], "../../../..", "z/v"},
- try_path_binding(Dispatch, ["b","c","z","v"], [], 0)).
-
-try_path_failing_test() ->
- ?assertEqual({no_dispatch_match, ["a"]},
- try_path_binding([{["b"], x, y}], ["a"], [], 0)).
-
-%% host binding
-
-try_host_binding_nohosts_test() ->
- PathDispatches = [{["a"], foo, bar},
- {["b"], baz, quux}],
- ?assertEqual(try_host_binding([{{['*'],'*'},PathDispatches}],
- ["quux","baz"], 80, ["a"], 0),
- try_host_binding(PathDispatches,
- ["quux","baz"], 80, ["a"], 0)),
- ?assertEqual(try_host_binding([{{['*'],'*'},PathDispatches}],
- ["quux","baz"], 80, ["b"], 0),
- try_host_binding(PathDispatches,
- ["quux","baz"], 80, ["b"], 0)),
- ?assertEqual(try_host_binding([ {{['*'],'*'},[D]} || D <- PathDispatches],
- ["quux","baz"], 1234, ["a"], 0),
- try_host_binding(PathDispatches,
- ["quux","baz"], 1234, ["a"], 0)),
- ?assertEqual(try_host_binding([ {{['*'],'*'},[D]} || D <- PathDispatches],
- ["quux","baz"], 1234, ["b"], 0),
- try_host_binding(PathDispatches,
- ["quux","baz"], 1234, ["b"], 0)).
-
-try_host_binding_noport_test() ->
- Dispatch = [{["foo","bar"], [{["a"],x,y}]},
- {["baz","quux"],[{["b"],z,q}]},
- {[m,"quux"], [{["c"],r,s}]},
- {['*',"quux"], [{["d"],t,u}]}],
- ExplicitWildPort = [ {{H, '*'},P} || {H, P} <- Dispatch ],
- ?assertEqual(try_host_binding(ExplicitWildPort,
- ["bar","foo"], 80, ["a"], 0),
- try_host_binding(Dispatch,
- ["bar","foo"], 80, ["a"], 0)),
- ?assertEqual(try_host_binding(ExplicitWildPort,
- ["quux","baz"], 1234, ["b"], 0),
- try_host_binding(Dispatch,
- ["quux","baz"], 1234, ["b"], 0)),
- ?assertEqual(try_host_binding(ExplicitWildPort,
- ["quux","yes"], 81, ["c"], 0),
- try_host_binding(Dispatch,
- ["quux","yes"], 81, ["c"], 0)),
- ?assertEqual(try_host_binding(ExplicitWildPort,
- ["quux","no"], 82, ["d"], 0),
- try_host_binding(Dispatch,
- ["quux","no"], 82, ["d"], 0)).
-
-try_host_binding_fullmatch_test() ->
- Dispatch = [{{["foo","bar"],80},[{["a"],x,y}]},
- {{[foo,"bar"],80}, [{["b"],z,q}]},
- {{[foo,"bar"],baz}, [{["c"],r,s}]},
- {{['*',"bar"],'*'}, [{["d"],t,u}]}],
- ?assertEqual({x, y, [], 80, [], [], ".", ""},
- try_host_binding(Dispatch,
- ["bar","foo"], 80, ["a"], 0)),
- ?assertEqual({z, q, [], 80, [], [{foo,"baz"}], ".", ""},
- try_host_binding(Dispatch,
- ["bar","baz"], 80, ["b"], 0)),
- {Mod, Props, HostRemainder, Port, PathRemainder,
- PathBindings, AppRoot, StringPath}=
- try_host_binding(Dispatch, ["bar","quux"], 1234, ["c"], 0),
- ?assertEqual(r, Mod),
- ?assertEqual(s, Props),
- ?assertEqual("", HostRemainder),
- ?assertEqual(1234, Port),
- ?assertEqual([], PathRemainder),
- ?assertEqual(2, length(PathBindings)),
- ?assertEqual("quux", proplists:get_value(foo, PathBindings)),
- ?assertEqual(1234, proplists:get_value(baz, PathBindings)),
- ?assertEqual(".", AppRoot),
- ?assertEqual("", StringPath),
- ?assertEqual({t, u, ["quux","foo"], 80, [], [], ".", ""},
- try_host_binding(Dispatch, ["bar","quux","foo"],80,["d"],0)).
-
-try_host_binding_fail_test() ->
- ?assertEqual({no_dispatch_match, {["bar","foo"], 1234}, ["x","y","z"]},
- try_host_binding([], ["bar","foo"], 1234, ["x","y","z"], 0)).
-
-dispatch_test() ->
- ?assertEqual({x, y, [], 80, [], [], "../../..", ""},
- dispatch("a/b/c",[{["a","b","c"],x,y}])),
- ?assertEqual({x, y, [], 80, [], [], "../../..", ""},
- dispatch("foo.bar", "a/b/c",
- [{{["foo","bar"],80},[{["a","b","c"],x,y}]}])),
- ?assertEqual({x, y, [], 1234, [], [], "../../..", ""},
- dispatch("foo.bar:1234", "a/b/",
- [{{["foo","bar"],1234},[{["a","b"],x,y}]}])),
- ?assertEqual({no_dispatch_match, {["bar","baz"],8000}, ["q","r"]},
- dispatch("baz.bar:8000", "q/r",
- [{{["foo","bar"],80},[{["a","b","c"],x,y}]}])).
diff -r 0c4b60ac68b4 src/webmachine_multipart.erl
--- a/src/webmachine_multipart.erl Tue Jun 15 08:36:55 2010 -0400
+++ b/src/webmachine_multipart.erl Thu Sep 09 18:48:27 2010 +0100
@@ -21,7 +21,6 @@
-author('Andy Gross <andy@basho.com>').
-export([get_all_parts/2,stream_parts/2, find_boundary/1]).
--include_lib("eunit/include/eunit.hrl").
% @type incoming_req_body() = binary().
% The request body, in "multipart/form-data" (rfc2388) form,
@@ -143,31 +142,3 @@
{Body, done}
end.
-body_test() ->
- Body = <<"------------ae0gL6gL6Ij5KM7Ef1KM7ei4ae0cH2\r\nContent-Disposition: form-data; name=\"Filename\"\r\n\r\ntestfile.txt\r\n------------ae0gL6gL6Ij5KM7Ef1KM7ei4ae0cH2\r\nContent-Disposition: form-data; name=\"Filedata\"; filename=\"testfile.txt\"\r\nContent-Type: application/octet-stream\r\n\r\n%%% The contents of this file are a test,\n%%% do not be alarmed.\n\r\n------------ae0gL6gL6Ij5KM7Ef1KM7ei4ae0cH2\r\nContent-Disposition: form-data; name=\"Upload\"\r\n\r\nSubmit Query\r\n------------ae0gL6gL6Ij5KM7Ef1KM7ei4ae0cH2--">>,
- Boundary = "----------ae0gL6gL6Ij5KM7Ef1KM7ei4ae0cH2",
- ?assertEqual(
- [{"Filename",
- {[{<<"name">>,<<"Filename">>}],[]},
- <<"testfile.txt\r\n">>},
- {"Filedata",
- {[{<<"name">>,<<"Filedata">>},
- {<<"filename">>,<<"testfile.txt">>}],
- [{<<"Content-Type">>,<<"application/octet-stream">>}]},
- <<"%%% The contents of this file are a test,\n%%% do not be alarmed.\n\r\n">>},
- {"Upload",
- {[{<<"name">>,<<"Upload">>}],[]},
- <<"Submit Query\r\n">>}],
- get_all_parts(Body, Boundary)).
-
-body2_test() ->
- Body = <<"-----------------------------89205314411538515011004844897\r\nContent-Disposition: form-data; name=\"Filedata\"; filename=\"akamai.txt\"\r\nContent-Type: text/plain\r\n\r\nCAMBRIDGE, MA - February 18, 2009 - Akamai Technologies, Inc. (NASDAQ: AKAM), the leader in powering rich media, dynamic transactions and enterprise applications online, today announced that its Service & Support organization was awarded top honors for Innovation in Customer Service at the 3rd Annual Stevie Awards for Sales & Customer Service, an international competition recognizing excellence in disciplines that are crucial to business success.\n\n\"We have always set incredibly high standards with respect to the service and support we provide our customers,\" said Sanjay Singh, vice president of Global Service & Support at Akamai. \"Our support team provides highly responsive service around the clock to our global customer base and, as a result, has become an extension of our customers' online businesses. This prestigious award is validation of Akamai's commitment to customer service and technical support.\"\n\nAkamai Service & Support professionals are dedicated to working with customers on a daily basis to fine tune, optimize, and support their Internet initiatives. Akamai's winning submission highlighted the key pillars of its service and support offering, as well as the initiatives established to meet customer requirements for proactive communication, simplification, and faster response times.\n\n\"This year's honorees demonstrate that even in challenging economic times, it's possible for organizations to continue to shine in sales and customer service, the two most important functions in business: acquiring and keeping customers,\" said Michael Gallagher, president of the Stevie Awards.\n\nThe awards are presented by the Stevie Awards, which organizes several of the world's leading business awards shows, including the prestigious American Business Awards. Nicknamed the Stevies for the Greek word \"crowned,\" winners were announced during a gala banquet on Monday, February 9 at Caesars Palace in Las Vegas. Nominated customer service and sales executives from the U.S.A. and several other countries attended. More than 500 entries from companies of all sizes and in virtually every industry were submitted to this year's competition. There are 27 categories for customer service professionals, as well as 41 categories for sales professionals.\n\nDetails about the Stevie Awards for Sales & Customer Service and the list of honorees in all categories are available at www.stevieawards.com/sales. \n\r\n-----------------------------89205314411538515011004844897--\r\n">>,
- Boundary = "---------------------------89205314411538515011004844897",
- ?assertEqual(
- [{"Filedata",
- {[{<<"name">>,<<"Filedata">>},
- {<<"filename">>,<<"akamai.txt">>}],
- [{<<"Content-Type">>,<<"text/plain">>}]},
- <<"CAMBRIDGE, MA - February 18, 2009 - Akamai Technologies, Inc. (NASDAQ: AKAM), the leader in powering rich media, dynamic transactions and enterprise applications online, today announced that its Service & Support organization was awarded top honors for Innovation in Customer Service at the 3rd Annual Stevie Awards for Sales & Customer Service, an international competition recognizing excellence in disciplines that are crucial to business success.\n\n\"We have always set incredibly high standards with respect to the service and support we provide our customers,\" said Sanjay Singh, vice president of Global Service & Support at Akamai. \"Our support team provides highly responsive service around the clock to our global customer base and, as a result, has become an extension of our customers' online businesses. This prestigious award is validation of Akamai's commitment to customer service and technical support.\"\n\nAkamai Service & Support professionals are dedicated to working with customers on a daily basis to fine tune, optimize, and support their Internet initiatives. Akamai's winning submission highlighted the key pillars of its service and support offering, as well as the initiatives established to meet customer requirements for proactive communication, simplification, and faster response times.\n\n\"This year's honorees demonstrate that even in challenging economic times, it's possible for organizations to continue to shine in sales and customer service, the two most important functions in business: acquiring and keeping customers,\" said Michael Gallagher, president of the Stevie Awards.\n\nThe awards are presented by the Stevie Awards, which organizes several of the world's leading business awards shows, including the prestigious American Business Awards. Nicknamed the Stevies for the Greek word \"crowned,\" winners were announced during a gala banquet on Monday, February 9 at Caesars Palace in Las Vegas. Nominated customer service and sales executives from the U.S.A. and several other countries attended. More than 500 entries from companies of all sizes and in virtually every industry were submitted to this year's competition. There are 27 categories for customer service professionals, as well as 41 categories for sales professionals.\n\nDetails about the Stevie Awards for Sales & Customer Service and the list of honorees in all categories are available at www.stevieawards.com/sales. \n\r\n">>
- }],
- get_all_parts(Body,Boundary)).
diff -r 0c4b60ac68b4 src/webmachine_router.erl
--- a/src/webmachine_router.erl Tue Jun 15 08:36:55 2010 -0400
+++ b/src/webmachine_router.erl Thu Sep 09 18:48:27 2010 +0100
@@ -19,7 +19,6 @@
%% the table each time webmachine restarts.
-module(webmachine_router).
--include_lib("eunit/include/eunit.hrl").
-behaviour(gen_server).
@@ -148,42 +147,3 @@
ok = application:set_env(webmachine, dispatch_list, DispatchList),
ok.
-%% For unit tests only
-start() ->
- gen_server:start({local, ?SERVER}, ?MODULE, [], []).
-
-get_routes() ->
- gen_server:call(?SERVER, get_routes).
-
-%% Tests
-add_remove_route_test() ->
- application:set_env(webmachine, dispatch_list, []),
- {ok, Pid} = start(),
- PathSpec = {["foo"], foo, []},
- webmachine_router:add_route(PathSpec),
- [PathSpec] = get_routes(),
- webmachine_router:remove_route(PathSpec),
- [] = get_routes(),
- exit(Pid, kill).
-
-add_remove_resource_test() ->
- application:set_env(webmachine, dispatch_list, []),
- {ok, Pid} = start(),
- PathSpec1 = {["foo"], foo, []},
- PathSpec2 = {["bar"], foo, []},
- PathSpec3 = {["baz"], bar, []},
- webmachine_router:add_route(PathSpec1),
- webmachine_router:add_route(PathSpec2),
- webmachine_router:add_route(PathSpec3),
- webmachine_router:remove_resource(foo),
- [PathSpec3] = get_routes(),
- exit(Pid, kill).
-
-no_dupe_path_test() ->
- application:set_env(webmachine, dispatch_list, []),
- {ok, Pid} = start(),
- PathSpec = {["foo"], foo, []},
- webmachine_router:add_route(PathSpec),
- webmachine_router:add_route(PathSpec),
- [PathSpec] = get_routes(),
- exit(Pid, kill).
diff -r 0c4b60ac68b4 src/webmachine_util.erl
--- a/src/webmachine_util.erl Tue Jun 15 08:36:55 2010 -0400
+++ b/src/webmachine_util.erl Thu Sep 09 18:48:27 2010 +0100
@@ -27,8 +27,6 @@
-export([now_diff_milliseconds/2]).
-export([media_type_to_detail/1]).
--include_lib("eunit/include/eunit.hrl").
-
convert_request_date(Date) ->
try
case httpd_util:convert_request_date(Date) of
@@ -295,65 +293,3 @@
now_diff_milliseconds({M,S,U}, {M1,S1,U1}) ->
((M-M1)*1000000+(S-S1))*1000 + ((U-U1) div 1000).
-%%
-%% TEST
-%%
-
-choose_media_type_test() ->
- Provided = "text/html",
- ShouldMatch = ["*", "*/*", "text/*", "text/html"],
- WantNone = ["foo", "text/xml", "application/*", "foo/bar/baz"],
- [ ?assertEqual(Provided, choose_media_type([Provided], I))
- || I <- ShouldMatch ],
- [ ?assertEqual(none, choose_media_type([Provided], I))
- || I <- WantNone ].
-
-choose_media_type_qval_test() ->
- Provided = ["text/html", "image/jpeg"],
- HtmlMatch = ["image/jpeg;q=0.5, text/html",
- "text/html, image/jpeg; q=0.5",
- "text/*; q=0.8, image/*;q=0.7",
- "text/*;q=.8, image/*;q=.7"], %% strange FeedBurner format
- JpgMatch = ["image/*;q=1, text/html;q=0.9",
- "image/png, image/*;q=0.3"],
- [ ?assertEqual("text/html", choose_media_type(Provided, I))
- || I <- HtmlMatch ],
- [ ?assertEqual("image/jpeg", choose_media_type(Provided, I))
- || I <- JpgMatch ].
-
-convert_request_date_test() ->
- ?assertMatch({{_,_,_},{_,_,_}},
- convert_request_date("Wed, 30 Dec 2009 14:39:02 GMT")),
- ?assertMatch(bad_date,
- convert_request_date(<<"does not handle binaries">>)).
-
-compare_ims_dates_test() ->
- Late = {{2009,12,30},{14,39,02}},
- Early = {{2009,12,30},{13,39,02}},
- ?assertEqual(true, compare_ims_dates(Late, Early)),
- ?assertEqual(false, compare_ims_dates(Early, Late)).
-
-guess_mime_test() ->
- TextTypes = [".html",".css",".htc",".manifest",".txt"],
- AppTypes = [".xhtml",".xml",".js",".swf",".zip",".bz2",
- ".gz",".tar",".tgz"],
- ImgTypes = [".jpg",".jpeg",".gif",".png",".ico",".svg"],
- ?assertEqual([], [ T || T <- TextTypes,
- 1 /= string:str(guess_mime(T),"text/") ]),
- ?assertEqual([], [ T || T <- AppTypes,
- 1 /= string:str(guess_mime(T),"application/") ]),
- ?assertEqual([], [ T || T <- ImgTypes,
- 1 /= string:str(guess_mime(T),"image/") ]).
-
-unquote_header_test() ->
- ?assertEqual("hello", unquote_header("hello")),
- ?assertEqual("hello", unquote_header("\"hello\"")),
- ?assertEqual("hello", unquote_header("\"hello")),
- ?assertEqual("hello", unquote_header("\"\\h\\e\\l\\l\\o\"")).
-
-now_diff_milliseconds_test() ->
- Late = {10, 10, 10},
- Early1 = {10, 9, 9},
- Early2 = {9, 9, 9},
- ?assertEqual(1000, now_diff_milliseconds(Late, Early1)),
- ?assertEqual(1000001000, now_diff_milliseconds(Late, Early2)).
diff -r 0c4b60ac68b4 src/wrq.erl
--- a/src/wrq.erl Tue Jun 15 08:36:55 2010 -0400
+++ b/src/wrq.erl Thu Sep 09 18:48:27 2010 +0100
@@ -32,7 +32,6 @@
% @type reqdata(). The opaque data type used for req/resp data structures.
-include_lib("include/wm_reqdata.hrl").
-include_lib("include/wm_reqstate.hrl").
--include_lib("eunit/include/eunit.hrl").
create(Method,Version,RawPath,Headers) ->
@@ -210,33 +209,3 @@
make_wrq(Method, RawPath, Headers) ->
create(Method, {1,1}, RawPath, mochiweb_headers:from_list(Headers)).
-accessor_test() ->
- R0 = make_wrq('GET', "/foo?a=1&b=2", [{"Cookie", "foo=bar"}]),
- R = set_peer("127.0.0.1", R0),
- ?assertEqual('GET', method(R)),
- ?assertEqual({1,1}, version(R)),
- ?assertEqual("/foo", path(R)),
- ?assertEqual("/foo?a=1&b=2", raw_path(R)),
- ?assertEqual([{"a", "1"}, {"b", "2"}], req_qs(R)),
- ?assertEqual({"1", "2"}, {get_qs_value("a", R), get_qs_value("b", R)}),
- ?assertEqual("3", get_qs_value("c", "3", R)),
- ?assertEqual([{"foo", "bar"}], req_cookie(R)),
- ?assertEqual("bar", get_cookie_value("foo", R)),
- ?assertEqual("127.0.0.1", peer(R)).
-
-
-simple_dispatch_test() ->
- R0 = make_wrq('GET', "/foo?a=1&b=2", [{"Cookie", "foo=bar"}]),
- R1 = set_peer("127.0.0.1", R0),
- {_, _, HostTokens, Port, PathTokens, Bindings, AppRoot, StringPath} =
- webmachine_dispatcher:dispatch("127.0.0.1", "/foo",
- [{["foo"], foo_resource, []}]),
- R = load_dispatch_data(Bindings,
- HostTokens,
- Port,
- PathTokens,
- AppRoot,
- StringPath,
- R1),
- ?assertEqual(".", app_root(R)),
- ?assertEqual(80, port(R)).

View File

@ -1,50 +0,0 @@
diff -r 0c4b60ac68b4 Makefile
--- a/Makefile Tue Jun 15 08:36:55 2010 -0400
+++ b/Makefile Thu Sep 09 18:33:44 2010 +0100
@@ -1,23 +1,33 @@
ERL ?= erl
APP := webmachine
+EBIN_DIR=ebin
+SOURCE_DIR=src
+ERLC=erlc
+INCLUDE_DIR=include
+MOCHIWEB=../../../../rabbitmq-mochiweb/deps/mochiweb/mochiweb/
+ERLC_OPTS=-I include -pa $(MOCHIWEB)/ebin/ -o $(EBIN_DIR)
+INCLUDES=$(wildcard $(INCLUDE_DIR)/*.hrl)
+SOURCES=$(wildcard $(SOURCE_DIR)/*.erl)
+
+TARGETS=$(INCLUDE_DIR)/mochiweb/include/internal.hrl \
+ $(patsubst $(SOURCE_DIR)/%.erl, $(EBIN_DIR)/%.beam, $(SOURCES)) \
+ $(EBIN_DIR)/webmachine.app
+
.PHONY: deps
-all: deps
- @(./rebar compile)
+all: $(TARGETS)
-deps:
- @(./rebar get-deps)
+$(EBIN_DIR)/%.beam: $(SOURCE_DIR)/%.erl
+ @mkdir -p $(EBIN_DIR)
+ $(ERLC) $(ERLC_OPTS) -pa $(EBIN_DIR) $<
+
+$(INCLUDE_DIR)/mochiweb/include/internal.hrl:
+ mkdir -p $(INCLUDE_DIR)/mochiweb/include
+ cp $(MOCHIWEB)/src/internal.hrl $(INCLUDE_DIR)/mochiweb/include
clean:
- @(./rebar clean)
+ rm -f $(EBIN_DIR)/*.beam
+ rm -rf $(INCLUDE_DIR)/mochiweb
distclean: clean
- @(./rebar delete-deps)
-
-edoc:
- @$(ERL) -noshell -run edoc_run application '$(APP)' '"."' '[{preprocess, true},{includes, ["."]}]'
-
-test: all
- scripts/run_tests.escript ebin | tee test.log
-

8
deps/rabbitmq_management/package.mk vendored Normal file
View File

@ -0,0 +1,8 @@
RELEASABLE:=true
DEPS:=rabbitmq-mochiweb webmachine-wrapper rabbitmq-server rabbitmq-erlang-client rabbitmq-management-agent
TEST_COMMANDS:=rabbit_mgmt_test_all:all_tests()
EXTRA_PACKAGE_DIRS:=$(PACKAGE_DIR)/priv
EXTRA_TARGETS:=$(shell find $(EXTRA_PACKAGE_DIRS) -type f) $(PACKAGE_DIR)/priv/www-cli/rabbitmqadmin
$(PACKAGE_DIR)/priv/www-cli/rabbitmqadmin: $(PACKAGE_DIR)/bin/rabbitmqadmin
cp $< $@