Search in sources :

Example 6 with Delete

use of org.activityinfo.shared.command.Delete in project activityinfo by bedatadriven.

the class DeleteTest method testDeleteSite.

@Test
public void testDeleteSite() throws CommandException {
    PagingResult<SiteDTO> sites = execute(GetSites.byId(3));
    execute(new Delete(sites.getData().get(0)));
    sites = execute(GetSites.byId(3));
    Assert.assertEquals(0, sites.getData().size());
    sites = execute(new GetSites());
    Assert.assertNull(getById(sites.getData(), 3));
}
Also used : Delete(org.activityinfo.shared.command.Delete) GetSites(org.activityinfo.shared.command.GetSites) SiteDTO(org.activityinfo.shared.dto.SiteDTO) Test(org.junit.Test)

Example 7 with Delete

use of org.activityinfo.shared.command.Delete in project activityinfo by bedatadriven.

the class DeleteTest method testDeleteAttribute.

@Test
public void testDeleteAttribute() throws CommandException {
    SchemaDTO schema = execute(new GetSchema());
    execute(new Delete(schema.getActivityById(1).getAttributeById(1)));
    schema = execute(new GetSchema());
    Assert.assertNull(schema.getActivityById(1).getAttributeById(1));
}
Also used : Delete(org.activityinfo.shared.command.Delete) SchemaDTO(org.activityinfo.shared.dto.SchemaDTO) GetSchema(org.activityinfo.shared.command.GetSchema) Test(org.junit.Test)

Example 8 with Delete

use of org.activityinfo.shared.command.Delete in project activityinfo by bedatadriven.

the class DeleteTest method testDeleteActivity.

@Test
public void testDeleteActivity() throws CommandException {
    SchemaDTO schema = execute(new GetSchema());
    execute(new Delete(schema.getActivityById(1)));
    execute(new Delete("Activity", 4));
    schema = execute(new GetSchema());
    Assert.assertNull("delete by entity reference", schema.getActivityById(1));
    Assert.assertNull("delete by id", schema.getActivityById(4));
}
Also used : Delete(org.activityinfo.shared.command.Delete) SchemaDTO(org.activityinfo.shared.dto.SchemaDTO) GetSchema(org.activityinfo.shared.command.GetSchema) Test(org.junit.Test)

Example 9 with Delete

use of org.activityinfo.shared.command.Delete in project activityinfo by bedatadriven.

the class LocalSchemaChangeTest method deleteActivity.

@Test
public void deleteActivity() {
    synchronizeFirstTime();
    SchemaDTO schema = executeLocally(new GetSchema());
    assertThat(schema.getActivityById(2), is(not(nullValue())));
    executeRemotely(new Delete("Activity", 2));
    synchronize();
    schema = executeLocally(new GetSchema());
    assertThat(schema.getActivityById(2), is(nullValue()));
}
Also used : Delete(org.activityinfo.shared.command.Delete) SchemaDTO(org.activityinfo.shared.dto.SchemaDTO) GetSchema(org.activityinfo.shared.command.GetSchema) Test(org.junit.Test)

Aggregations

Delete (org.activityinfo.shared.command.Delete)9 Test (org.junit.Test)8 SchemaDTO (org.activityinfo.shared.dto.SchemaDTO)5 GetSchema (org.activityinfo.shared.command.GetSchema)4 SiteDTO (org.activityinfo.shared.dto.SiteDTO)3 VoidResult (org.activityinfo.shared.command.result.VoidResult)2 Date (java.util.Date)1 MockEventBus (org.activityinfo.client.MockEventBus)1 DispatcherStub (org.activityinfo.client.dispatch.DispatcherStub)1 UIConstants (org.activityinfo.client.i18n.UIConstants)1 StateManagerStub (org.activityinfo.client.mock.StateManagerStub)1 ConfirmCallback (org.activityinfo.client.page.common.grid.ConfirmCallback)1 OnDataSet (org.activityinfo.server.database.OnDataSet)1 AddTarget (org.activityinfo.shared.command.AddTarget)1 GetSites (org.activityinfo.shared.command.GetSites)1 GetTargets (org.activityinfo.shared.command.GetTargets)1 UpdateSite (org.activityinfo.shared.command.UpdateSite)1 CreateResult (org.activityinfo.shared.command.result.CreateResult)1 SiteResult (org.activityinfo.shared.command.result.SiteResult)1 LockedPeriodDTO (org.activityinfo.shared.dto.LockedPeriodDTO)1