/sigmah/src/test/java/org/sigmah/server/endpoint/gwtrpc/UpdateReportDefHandlerTest.java

http://sigma-h.googlecode.com/ · Java · 40 lines · 27 code · 9 blank · 4 comment · 0 complexity · d978ff542bc3ebcc44299ac18e00bcff MD5 · raw file

  1. /*
  2. * All Sigmah code is released under the GNU General Public License v3
  3. * See COPYRIGHT.txt and LICENSE.txt.
  4. */
  5. package org.sigmah.server.endpoint.gwtrpc;
  6. import junit.framework.Assert;
  7. import org.junit.Test;
  8. import org.junit.runner.RunWith;
  9. import org.sigmah.server.dao.OnDataSet;
  10. import org.sigmah.shared.command.GetReportTemplates;
  11. import org.sigmah.shared.command.UpdateReportDef;
  12. import org.sigmah.shared.command.result.ReportTemplateResult;
  13. import org.sigmah.shared.dto.ReportDefinitionDTO;
  14. import org.sigmah.shared.exception.CommandException;
  15. import org.sigmah.shared.report.model.ReportFrequency;
  16. import org.sigmah.test.InjectionSupport;
  17. @RunWith(InjectionSupport.class)
  18. @OnDataSet("/dbunit/schema1.db.xml")
  19. public class UpdateReportDefHandlerTest extends CommandTestCase {
  20. @Test
  21. public void testUpdate() throws CommandException {
  22. UpdateReportDef cmd = new UpdateReportDef();
  23. cmd.setId(1);
  24. cmd.setNewXml("<report frequency=\"Adhoc\"><title>My new title</title></report>");
  25. execute(cmd);
  26. ReportTemplateResult result = execute(new GetReportTemplates());
  27. ReportDefinitionDTO dto = result.getData().get(0);
  28. Assert.assertEquals("My new title", dto.getTitle());
  29. Assert.assertEquals(ReportFrequency.Adhoc, dto.getFrequency());
  30. }
  31. }