Source

httpinets / src / httptest.erl

Full commit
%% @author author <author@example.com>
%% @copyright YYYY author.

%% @doc TEMPLATE.

-module(httptest).
-author('author <author@example.com>').
-export([start/0, start_link/0, stop/0]).

ensure_started(App) ->
    case application:start(App) of
	ok ->
	    ok;
	{error, {already_started, App}} ->
	    ok
    end.

%% @spec start_link() -> {ok,Pid::pid()}
%% @doc Starts the app for inclusion in a supervisor tree
start_link() ->
    httptest_deps:ensure(),
    ensure_started(crypto),
    ensure_started(webmachine),
    httptest_sup:start_link().

%% @spec start() -> ok
%% @doc Start the httptest server.
start() ->
    httptest_deps:ensure(),
    ensure_started(crypto),
    ensure_started(webmachine),
    application:start(httptest).

%% @spec stop() -> ok
%% @doc Stop the httptest server.
stop() ->
    Res = application:stop(httptest),
    application:stop(webmachine),
    application:stop(crypto),
    Res.