Search in sources :

Example 31 with GetSchema

use of org.activityinfo.shared.command.GetSchema 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 GetSchema

use of org.activityinfo.shared.command.GetSchema 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 GetSchema

use of org.activityinfo.shared.command.GetSchema 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 GetSchema

use of org.activityinfo.shared.command.GetSchema 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 GetSchema

use of org.activityinfo.shared.command.GetSchema 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

GetSchema (org.activityinfo.shared.command.GetSchema)65 SchemaDTO (org.activityinfo.shared.dto.SchemaDTO)56 Test (org.junit.Test)42 ActivityDTO (org.activityinfo.shared.dto.ActivityDTO)15 UserDatabaseDTO (org.activityinfo.shared.dto.UserDatabaseDTO)10 AsyncCallback (com.google.gwt.user.client.rpc.AsyncCallback)9 CreateResult (org.activityinfo.shared.command.result.CreateResult)8 CreateEntity (org.activityinfo.shared.command.CreateEntity)5 Filter (org.activityinfo.shared.command.Filter)5 HashMap (java.util.HashMap)4 MaskingAsyncMonitor (org.activityinfo.client.dispatch.monitor.MaskingAsyncMonitor)4 Delete (org.activityinfo.shared.command.Delete)4 UpdateEntity (org.activityinfo.shared.command.UpdateEntity)4 OnDataSet (org.activityinfo.server.database.OnDataSet)3 BatchCommand (org.activityinfo.shared.command.BatchCommand)3 ArrayList (java.util.ArrayList)2 Date (java.util.Date)2 HashSet (java.util.HashSet)2 Produces (javax.ws.rs.Produces)2 WebApplicationException (javax.ws.rs.WebApplicationException)2