PageRenderTime 120ms CodeModel.GetById 0ms RepoModel.GetById 0ms app.codeStats 0ms

/ucengine/src/tests/solr_tests.erl

http://github.com/AF83/ucengine
Erlang | 47 lines | 25 code | 5 blank | 17 comment | 0 complexity | acdb2a4157f162f3a32b7937c94aa5e1 MD5 | raw file
  1. %%
  2. %% U.C.Engine - Unified Collaboration Engine
  3. %% Copyright (C) 2011 af83
  4. %%
  5. %% This program is free software: you can redistribute it and/or modify
  6. %% it under the terms of the GNU Affero General Public License as published by
  7. %% the Free Software Foundation, either version 3 of the License, or
  8. %% (at your option) any later version.
  9. %%
  10. %% This program is distributed in the hope that it will be useful,
  11. %% but WITHOUT ANY WARRANTY; without even the implied warranty of
  12. %% MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  13. %% GNU Affero General Public License for more details.
  14. %%
  15. %% You should have received a copy of the GNU Affero General Public License
  16. %% along with this program. If not, see <http://www.gnu.org/licenses/>.
  17. %%
  18. -module(solr_tests).
  19. -include("uce.hrl").
  20. -include_lib("eunit/include/eunit.hrl").
  21. -export([test_add/1, test_search/1]).
  22. solr_test_() ->
  23. { setup
  24. , fun fixtures:setup/0
  25. , fun fixtures:teardown/1
  26. , fun([Domain, _, _]) ->
  27. [ ?_test(test_add(Domain))
  28. , ?_test(test_search(Domain))
  29. ]
  30. end
  31. }.
  32. test_add(Domain) ->
  33. {ok, created} = uce_event_solr_search:add(Domain, #uce_event{id=utils:random(),
  34. datetime=utils:now(),
  35. location="testmeeting",
  36. from="chuck_norris",
  37. type="test_solr_event",
  38. metadata=[{"text","This is a test event."}]}).
  39. test_search(Domain) ->
  40. timer:sleep(2000),
  41. ?assertMatch({ok, _NumTotal, [_]},
  42. uce_event_solr_search:list(Domain, "", ["This"], "", [], 0, infinity, "", 0, 1, asc)).