Search in sources :

Example 1 with GetReports

use of org.activityinfo.legacy.shared.command.GetReports in project activityinfo by bedatadriven.

the class GetReportsTest method performanceTest.

@OnDataSet("/dbunit/get-report-performance-tests.db.xml")
// AI-1223
@Test
public void performanceTest() {
    // initial performance: 1838ms - sql fetch, 1962ms - time for client (+serialization/deserialization)
    // after performance tuning: 229ms - sql fetch, 273 ms - time for client (+serialization/deserialization)
    setUser(1);
    Stopwatch started = Stopwatch.createStarted();
    ReportsResult result = execute(new GetReports());
    assertNotNull(result);
    assertEquals(1, result.getData().get(0).getId());
    assertEquals("Report 1", result.getData().get(0).getTitle());
    assertEquals("Alex", result.getData().get(0).getOwnerName());
    long elapsed = started.elapsed(TimeUnit.MILLISECONDS);
    // must be less then one second
    assertTrue("GetReports takes " + elapsed + "ms.", elapsed < 1000);
}
Also used : GetReports(org.activityinfo.legacy.shared.command.GetReports) Stopwatch(com.google.common.base.Stopwatch) ReportsResult(org.activityinfo.legacy.shared.command.result.ReportsResult) OnDataSet(org.activityinfo.server.database.OnDataSet) Test(org.junit.Test)

Example 2 with GetReports

use of org.activityinfo.legacy.shared.command.GetReports in project activityinfo by bedatadriven.

the class GetReportsTest method selectByUser2.

@Test
public void selectByUser2() {
    setUser(2);
    ReportsResult result = execute(new GetReports());
    assertNotNull(result);
    assertThat(result.getData().size(), equalTo(1));
    assertEquals(2, result.getData().get(0).getId());
    assertEquals("Report 1", result.getData().get(0).getTitle());
    assertEquals("Bavon", result.getData().get(0).getOwnerName());
}
Also used : GetReports(org.activityinfo.legacy.shared.command.GetReports) ReportsResult(org.activityinfo.legacy.shared.command.result.ReportsResult) Test(org.junit.Test)

Example 3 with GetReports

use of org.activityinfo.legacy.shared.command.GetReports in project activityinfo by bedatadriven.

the class GetReportsTest method selectByUser1.

@Test
public void selectByUser1() {
    setUser(1);
    ReportsResult result = execute(new GetReports());
    assertNotNull(result);
    assertTrue(result.getData().size() == 2);
    assertEquals(1, result.getData().get(0).getId());
    assertEquals("Report 1", result.getData().get(0).getTitle());
    assertEquals("Alex", result.getData().get(0).getOwnerName());
    assertEquals(3, result.getData().get(1).getId());
    assertEquals("Report 3", result.getData().get(1).getTitle());
    assertEquals("Alex", result.getData().get(1).getOwnerName());
    assertEquals(Integer.valueOf(1), result.getData().get(1).getDay());
    assertEquals(EmailDelivery.NONE, result.getData().get(1).getEmailDelivery());
}
Also used : GetReports(org.activityinfo.legacy.shared.command.GetReports) ReportsResult(org.activityinfo.legacy.shared.command.result.ReportsResult) Test(org.junit.Test)

Aggregations

GetReports (org.activityinfo.legacy.shared.command.GetReports)3 ReportsResult (org.activityinfo.legacy.shared.command.result.ReportsResult)3 Test (org.junit.Test)3 Stopwatch (com.google.common.base.Stopwatch)1 OnDataSet (org.activityinfo.server.database.OnDataSet)1