/sigmah/src/test/java/org/sigmah/server/endpoint/gwtrpc/UpdateReportDefHandlerTest.java
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 6package org.sigmah.server.endpoint.gwtrpc; 7 8import junit.framework.Assert; 9import org.junit.Test; 10import org.junit.runner.RunWith; 11import org.sigmah.server.dao.OnDataSet; 12import org.sigmah.shared.command.GetReportTemplates; 13import org.sigmah.shared.command.UpdateReportDef; 14import org.sigmah.shared.command.result.ReportTemplateResult; 15import org.sigmah.shared.dto.ReportDefinitionDTO; 16import org.sigmah.shared.exception.CommandException; 17import org.sigmah.shared.report.model.ReportFrequency; 18import org.sigmah.test.InjectionSupport; 19 20@RunWith(InjectionSupport.class) 21@OnDataSet("/dbunit/schema1.db.xml") 22public class UpdateReportDefHandlerTest extends CommandTestCase { 23 24 @Test 25 public void testUpdate() throws CommandException { 26 27 UpdateReportDef cmd = new UpdateReportDef(); 28 cmd.setId(1); 29 cmd.setNewXml("<report frequency=\"Adhoc\"><title>My new title</title></report>"); 30 31 execute(cmd); 32 33 ReportTemplateResult result = execute(new GetReportTemplates()); 34 35 ReportDefinitionDTO dto = result.getData().get(0); 36 37 Assert.assertEquals("My new title", dto.getTitle()); 38 Assert.assertEquals(ReportFrequency.Adhoc, dto.getFrequency()); 39 } 40}