use of com.revolsys.swing.map.layer.record.LayerRecord in project com.revolsys.open by revolsys.
the class RecordStoreLayerTest method testModifiyRecordDeleteCancelChanges.
@Test
public void testModifiyRecordDeleteCancelChanges() {
final LayerRecord testRecord = testNewRecord();
this.layer.saveChanges();
assertRecordCounts(0, 1, 0, 0);
testRecord.setValue("NAME", CHANGED_NAME);
assertRecordState(testRecord, RecordState.MODIFIED);
// Delete the record and verify that it's deleted
this.layer.deleteRecord(testRecord);
assertRecordCounts(0, 1, 0, 1);
assertGetRecords(0);
assertRecordState(testRecord, RecordState.DELETED);
assertRecordValue(testRecord, "NAME", DEFAULT_NAME);
// Cancel the changes and verify that it hasn't been deleted.
this.layer.cancelChanges();
assertRecordCounts(0, 1, 0, 0);
final List<LayerRecord> records = assertGetRecords(1);
final LayerRecord actualRecord = assertRecordAtIndex(1, records, 0, testRecord, IdentifierProxyLayerRecord.class);
assertRecordState(testRecord, RecordState.PERSISTED);
assertRecordState(actualRecord, RecordState.PERSISTED);
assertRecordValue(testRecord, "NAME", DEFAULT_NAME);
assertRecordValue(actualRecord, "NAME", DEFAULT_NAME);
}
use of com.revolsys.swing.map.layer.record.LayerRecord in project com.revolsys.open by revolsys.
the class RecordStoreLayerTest method newTestRecord.
public LayerRecord newTestRecord(final String name, final int count, final Point point) {
final Map<String, Object> newValues = Maps.<String, Object>buildLinkedHash().add("NAME", name).add("COUNT", count).add("GEOMETRY", point);
final LayerRecord testRecord = this.layer.newLayerRecord(newValues);
return testRecord;
}
use of com.revolsys.swing.map.layer.record.LayerRecord in project com.revolsys.open by revolsys.
the class RecordStoreLayerTest method testDeleteRecordSaveChanges.
@Test
public void testDeleteRecordSaveChanges() {
final LayerRecord testRecord = testNewRecord();
this.layer.saveChanges();
assertRecordCounts(0, 1, 0, 0);
// Delete the record and verify that it's deleted
this.layer.deleteRecord(testRecord);
assertRecordCounts(0, 1, 0, 1);
assertGetRecords(0);
assertRecordState(testRecord, RecordState.DELETED);
// Cancel the changes and verify that it hasn't been deleted.
this.layer.saveChanges();
assertRecordCounts(0, 0, 0, 0);
assertGetRecords(0);
assertRecordState(testRecord, RecordState.DELETED);
}
use of com.revolsys.swing.map.layer.record.LayerRecord in project com.revolsys.open by revolsys.
the class RecordStoreLayerTest method testDeleteRecordCancelChanges.
@Test
public void testDeleteRecordCancelChanges() {
final LayerRecord testRecord = testNewRecord();
this.layer.saveChanges();
assertRecordCounts(0, 1, 0, 0);
// Delete the record and verify that it's deleted
this.layer.deleteRecord(testRecord);
assertRecordCounts(0, 1, 0, 1);
assertGetRecords(0);
assertRecordState(testRecord, RecordState.DELETED);
// Cancel the changes and verify that it hasn't been deleted.
this.layer.cancelChanges();
assertRecordCounts(0, 1, 0, 0);
final List<LayerRecord> records = assertGetRecords(1);
final LayerRecord actualRecord = assertRecordAtIndex(1, records, 0, testRecord, IdentifierProxyLayerRecord.class);
assertRecordState(testRecord, RecordState.PERSISTED);
assertRecordState(actualRecord, RecordState.PERSISTED);
}
use of com.revolsys.swing.map.layer.record.LayerRecord in project com.revolsys.open by revolsys.
the class RecordStoreLayerTest method assertRecordAtIndex.
public LayerRecord assertRecordAtIndex(final int count, final List<LayerRecord> records, final int index, final LayerRecord expectedRecord, final Class<?> expectedClass) {
final LayerRecord actualRecord = assertRecordAtIndex(count, records, index, expectedRecord);
Assert.assertEquals("Class", expectedClass, actualRecord.getClass());
return actualRecord;
}
Aggregations