Search in sources :

Example 11 with Month

use of org.activityinfo.model.type.time.Month in project activityinfo by bedatadriven.

the class MonthlyReportsTest method testMonthCompare.

@Test
public void testMonthCompare() throws Exception {
    Month feb = new Month(2009, 2);
    Month maxMonth = new Month(2009, 2);
    Assert.assertEquals(0, maxMonth.compareTo(feb));
}
Also used : Month(org.activityinfo.model.type.time.Month) Test(org.junit.Test)

Example 12 with Month

use of org.activityinfo.model.type.time.Month in project activityinfo by bedatadriven.

the class MonthlyReportsTest method unauthorized.

@Test(expected = CommandException.class)
public void unauthorized() {
    // marlene: viewall, but not editall
    setUser(4);
    ArrayList<UpdateMonthlyReports.Change> changes = new ArrayList<UpdateMonthlyReports.Change>();
    changes.add(new UpdateMonthlyReports.Change(6, new Month(2009, 1), 45.0));
    changes.add(new UpdateMonthlyReports.Change(6, new Month(2009, 3), 22.0));
    execute(new UpdateMonthlyReports(6, changes));
}
Also used : Month(org.activityinfo.model.type.time.Month) UpdateMonthlyReports(org.activityinfo.legacy.shared.command.UpdateMonthlyReports) ArrayList(java.util.ArrayList) Test(org.junit.Test)

Example 13 with Month

use of org.activityinfo.model.type.time.Month in project activityinfo by bedatadriven.

the class MonthlyReportsTest method testGetReportsWhenEmpty.

@Test
public void testGetReportsWhenEmpty() throws Exception {
    GetMonthlyReports cmd = new GetMonthlyReports(7);
    cmd.setStartMonth(new Month(2009, 1));
    cmd.setEndMonth(new Month(2009, 2));
    MonthlyReportResult result = execute(cmd);
    Assert.assertEquals(1, result.getData().size());
}
Also used : Month(org.activityinfo.model.type.time.Month) GetMonthlyReports(org.activityinfo.legacy.shared.command.GetMonthlyReports) MonthlyReportResult(org.activityinfo.legacy.shared.command.result.MonthlyReportResult) Test(org.junit.Test)

Example 14 with Month

use of org.activityinfo.model.type.time.Month in project activityinfo by bedatadriven.

the class MonthlyReportsTest method authorizedByEditAll.

@Test
public void authorizedByEditAll() {
    // bavon: viewall AND editall
    setUser(2);
    ArrayList<UpdateMonthlyReports.Change> changes = new ArrayList<UpdateMonthlyReports.Change>();
    changes.add(new UpdateMonthlyReports.Change(6, new Month(2009, 1), 45.0));
    changes.add(new UpdateMonthlyReports.Change(6, new Month(2009, 3), 22.0));
    execute(new UpdateMonthlyReports(6, changes));
}
Also used : Month(org.activityinfo.model.type.time.Month) UpdateMonthlyReports(org.activityinfo.legacy.shared.command.UpdateMonthlyReports) ArrayList(java.util.ArrayList) Test(org.junit.Test)

Example 15 with Month

use of org.activityinfo.model.type.time.Month in project activityinfo by bedatadriven.

the class MonthlyReportsTest method authorizedByEdit.

@Test
public void authorizedByEdit() {
    // pacifique, only edit
    setUser(21);
    ArrayList<UpdateMonthlyReports.Change> changes = new ArrayList<UpdateMonthlyReports.Change>();
    changes.add(new UpdateMonthlyReports.Change(6, new Month(2009, 1), 45.0));
    execute(new UpdateMonthlyReports(6, changes));
}
Also used : Month(org.activityinfo.model.type.time.Month) UpdateMonthlyReports(org.activityinfo.legacy.shared.command.UpdateMonthlyReports) ArrayList(java.util.ArrayList) Test(org.junit.Test)

Aggregations

Month (org.activityinfo.model.type.time.Month)23 Test (org.junit.Test)9 MonthlyReportResult (org.activityinfo.legacy.shared.command.result.MonthlyReportResult)7 ArrayList (java.util.ArrayList)5 UpdateMonthlyReports (org.activityinfo.legacy.shared.command.UpdateMonthlyReports)5 GetMonthlyReports (org.activityinfo.legacy.shared.command.GetMonthlyReports)3 IndicatorRowDTO (org.activityinfo.legacy.shared.model.IndicatorRowDTO)3 SqlResultSet (com.bedatadriven.rebar.sql.client.SqlResultSet)2 SqlResultSetRow (com.bedatadriven.rebar.sql.client.SqlResultSetRow)2 DateWrapper (com.extjs.gxt.ui.client.util.DateWrapper)2 Calendar (java.util.Calendar)2 Date (java.util.Date)2 Change (org.activityinfo.legacy.shared.command.UpdateMonthlyReports.Change)2 IllegalAccessCommandException (org.activityinfo.legacy.shared.exception.IllegalAccessCommandException)2 OnDataSet (org.activityinfo.server.database.OnDataSet)2 Timed (org.activityinfo.server.util.monitoring.Timed)2 SqlResultCallback (com.bedatadriven.rebar.sql.client.SqlResultCallback)1 SqlTransaction (com.bedatadriven.rebar.sql.client.SqlTransaction)1 FieldEvent (com.extjs.gxt.ui.client.event.FieldEvent)1 LabelToolItem (com.extjs.gxt.ui.client.widget.toolbar.LabelToolItem)1