Search in sources :

Example 31 with SchemaDTO

use of org.activityinfo.shared.dto.SchemaDTO in project activityinfo by bedatadriven.

the class GetSchemaTest method testLockedProjects.

@Test
public void testLockedProjects() {
    setUser(1);
    SchemaDTO schema = execute(new GetSchema());
    assertThat(schema.getProjectById(1).getLockedPeriods().size(), equalTo(1));
    LockedPeriodSet locks = new LockedPeriodSet(schema);
    assertTrue(locks.isProjectLocked(1, new LocalDate(2009, 1, 1)));
    assertTrue(locks.isProjectLocked(1, new LocalDate(2009, 1, 6)));
    assertTrue(locks.isProjectLocked(1, new LocalDate(2009, 1, 12)));
    assertFalse(locks.isProjectLocked(1, new LocalDate(2008, 1, 12)));
    assertFalse(locks.isProjectLocked(1, new LocalDate(2010, 1, 12)));
}
Also used : LockedPeriodSet(org.activityinfo.client.page.entry.LockedPeriodSet) SchemaDTO(org.activityinfo.shared.dto.SchemaDTO) GetSchema(org.activityinfo.shared.command.GetSchema) LocalDate(com.bedatadriven.rebar.time.calendar.LocalDate) Test(org.junit.Test)

Example 32 with SchemaDTO

use of org.activityinfo.shared.dto.SchemaDTO in project activityinfo by bedatadriven.

the class GetSchemaTest method toCSV.

@Test
public void toCSV() {
    SchemaDTO schema = execute(new GetSchema());
    SchemaCsvWriter writer = new SchemaCsvWriter();
    writer.write(schema.getDatabaseById(1));
    System.out.println(writer.toString());
}
Also used : SchemaCsvWriter(org.activityinfo.shared.dto.SchemaCsvWriter) SchemaDTO(org.activityinfo.shared.dto.SchemaDTO) GetSchema(org.activityinfo.shared.command.GetSchema) Test(org.junit.Test)

Example 33 with SchemaDTO

use of org.activityinfo.shared.dto.SchemaDTO in project activityinfo by bedatadriven.

the class LinkIndicatorTest method setUser.

@Before
public void setUser() {
    setUser(DATABASE_OWNER);
    /*
         * Initial data load
         */
    SchemaDTO schema = execute(new GetSchema());
    db = schema.getDatabaseById(1);
}
Also used : SchemaDTO(org.activityinfo.shared.dto.SchemaDTO) GetSchema(org.activityinfo.shared.command.GetSchema) Before(org.junit.Before)

Example 34 with SchemaDTO

use of org.activityinfo.shared.dto.SchemaDTO in project activityinfo by bedatadriven.

the class PartnerTest method testAddPartner.

@Test
public void testAddPartner() throws Exception {
    PartnerDTO newPartner = new PartnerDTO();
    newPartner.setName("Solidarites");
    CreateResult cr = execute(new AddPartner(PEAR_PLUS_DB_ID, newPartner));
    Assert.assertEquals(SOL_ID, cr.getNewId());
    SchemaDTO schema = execute(new GetSchema());
    PartnerDTO partner = schema.getDatabaseById(PEAR_PLUS_DB_ID).getPartnerById(SOL_ID);
    Assert.assertNotNull(partner);
    Assert.assertEquals(newPartner.getName(), partner.getName());
}
Also used : PartnerDTO(org.activityinfo.shared.dto.PartnerDTO) CreateResult(org.activityinfo.shared.command.result.CreateResult) DuplicateCreateResult(org.activityinfo.shared.command.result.DuplicateCreateResult) AddPartner(org.activityinfo.shared.command.AddPartner) SchemaDTO(org.activityinfo.shared.dto.SchemaDTO) GetSchema(org.activityinfo.shared.command.GetSchema) Test(org.junit.Test)

Example 35 with SchemaDTO

use of org.activityinfo.shared.dto.SchemaDTO in project activityinfo by bedatadriven.

the class TargetTest method setUser.

@Before
public void setUser() {
    setUser(DATABASE_OWNER);
    /*
         * Initial data load
         */
    SchemaDTO schema = execute(new GetSchema());
    db = schema.getDatabaseById(1);
}
Also used : SchemaDTO(org.activityinfo.shared.dto.SchemaDTO) GetSchema(org.activityinfo.shared.command.GetSchema) Before(org.junit.Before)

Aggregations

SchemaDTO (org.activityinfo.shared.dto.SchemaDTO)66 GetSchema (org.activityinfo.shared.command.GetSchema)56 Test (org.junit.Test)41 ActivityDTO (org.activityinfo.shared.dto.ActivityDTO)20 UserDatabaseDTO (org.activityinfo.shared.dto.UserDatabaseDTO)10 CreateResult (org.activityinfo.shared.command.result.CreateResult)9 AsyncCallback (com.google.gwt.user.client.rpc.AsyncCallback)8 MockEventBus (org.activityinfo.client.MockEventBus)6 HashMap (java.util.HashMap)5 DispatcherStub (org.activityinfo.client.dispatch.DispatcherStub)5 UIConstants (org.activityinfo.client.i18n.UIConstants)5 StateManagerStub (org.activityinfo.client.mock.StateManagerStub)5 OnDataSet (org.activityinfo.server.database.OnDataSet)5 Delete (org.activityinfo.shared.command.Delete)5 Filter (org.activityinfo.shared.command.Filter)5 UpdateEntity (org.activityinfo.shared.command.UpdateEntity)5 AttributeGroupDTO (org.activityinfo.shared.dto.AttributeGroupDTO)5 MaskingAsyncMonitor (org.activityinfo.client.dispatch.monitor.MaskingAsyncMonitor)4 CreateEntity (org.activityinfo.shared.command.CreateEntity)4 VoidResult (org.activityinfo.shared.command.result.VoidResult)4