defaultTable
.recordBuilder()
.recordType(recordType.getName())
.field(linkField.getName(),
new Link(defaultTable
.recordBuilder()
.id(recordId)
.recordType(recordType.getName())
.field(recordField.getName(),
defaultTable
.recordBuilder()
.recordType(recordType.getName())
.field(stringField.getName(), "bordeaux")
.build())
.create()
.getId()))
.create();
commitIndex();
verifyResultCount("+cfd_case1:bordeaux", 1);
// perform update
log.debug("Begin test V611");
defaultTable
.recordBuilder()
.id(recordId)
.field(recordField.getName(),
defaultTable
.recordBuilder()
.recordType(recordType.getName())
.field(stringField.getName(), "bordooo")
.build())
.update();
commitIndex();
verifyResultCount("+cfd_case1:bordooo", 1);
verifyResultCount("+cfd_case1:bordeaux", 0);
}
//
// Case 2: link field => record field => link field => string field
//
{
log.debug("Begin test V620");
RecordId recordId1 = idGenerator.newRecordId();
RecordId recordId2 = idGenerator.newRecordId();
defaultTable
.recordBuilder()
.recordType(recordType.getName())
.field(linkField.getName(),
new Link(defaultTable
.recordBuilder()
.id(recordId1)
.recordType(recordType.getName())
.field(recordField.getName(),
defaultTable
.recordBuilder()
.recordType(recordType.getName())
.field(linkField.getName(),
new Link(defaultTable
.recordBuilder()
.id(recordId2)
.recordType(recordType.getName())
.field(stringField.getName(), "beaujolais")
.create()
.getId()))
.build())
.create()
.getId()))
.create();
commitIndex();
verifyResultCount("+cfd_case2:beaujolais", 1);
// perform update
log.debug("Begin test V621");
defaultTable
.recordBuilder()
.id(recordId2)
.field(stringField.getName(), "booojolais")
.update();
commitIndex();
verifyResultCount("+cfd_case2:booojolais", 1);
verifyResultCount("+cfd_case2:beaujolais", 0);
}
//
// Case 3: record field => link field => string field
//
{
log.debug("Begin test V630");
RecordId recordId = idGenerator.newRecordId();
defaultTable
.recordBuilder()
.recordType(recordType.getName())
.field(record2Field.getName(),
defaultTable
.recordBuilder()
.recordType(recordType.getName())
.field(linkField.getName(),
new Link(defaultTable
.recordBuilder()
.id(recordId)
.recordType(recordType.getName())
.field(stringField.getName(), "bourgogne")
.create()
.getId()))
.build())
.create();
commitIndex();
verifyResultCount("+cfd_case3:bourgogne", 1);
// perform an update
log.debug("Begin test V631");
defaultTable
.recordBuilder()
.id(recordId)
.field(stringField.getName(), "boerhonje")
.update();
commitIndex();
verifyResultCount("+cfd_case3:boerhonje", 1);
verifyResultCount("+cfd_case3:bourgogne", 0);
}
//
// Case 4: link field => list<record> field => link field => string field
//
{
log.debug("Begin test V640");
RecordId recordId1 = idGenerator.newRecordId();
RecordId recordId2 = idGenerator.newRecordId();
RecordId recordId3 = idGenerator.newRecordId();
RecordId recordId4 = idGenerator.newRecordId();
defaultTable
.recordBuilder()
.recordType(recordType.getName())
.id(recordId1)
.field(linkField.getName(),
new Link(defaultTable
.recordBuilder()
.id(recordId2)
.recordType(recordType.getName())
.field(recordListField.getName(),
Arrays.asList(
defaultTable
.recordBuilder()
.id(recordId3)
.recordType(recordType.getName())
.field(linkField.getName(),
new Link(defaultTable
.recordBuilder()
.id(recordId3)
.recordType(recordType.getName())
.field(stringField.getName(), "champagne")
.create()
.getId()))
.build(),
defaultTable
.recordBuilder()
.id(recordId4)
.recordType(recordType.getName())
.field(linkField.getName(),
new Link(defaultTable
.recordBuilder()
.id(recordId4)
.recordType(recordType.getName())
.field(stringField.getName(), "languedoc")
.create()
.getId()))
.build()
))
.create()
.getId()))
.create();
commitIndex();
verifyResultCount("+cfd_case4:champagne", 1);
verifyResultCount("+cfd_case4:languedoc", 1);
// perform an update
log.debug("Begin test V640");
defaultTable
.recordBuilder()
.id(recordId3)
.field(stringField.getName(), "sampanje")
.update();
commitIndex();
verifyResultCount("+cfd_case4:sampanje", 1);
verifyResultCount("+cfd_case4:languedoc", 1);
verifyResultCount("+cfd_case4:champagne", 0);
// perform another update */
log.debug("Begin test V641");
defaultTable
.recordBuilder()
.id(recordId2)
.recordType(recordType.getName())
.field(recordListField.getName(),
Arrays.asList(defaultTable
.recordBuilder()
.recordType(recordType.getName())
.field(linkField.getName(), new Link(recordId3))
.build()))
.update();
commitIndex();
verifyResultCount("+cfd_case4:sampanje", 1);
verifyResultCount("+cfd_case4:languedoc", 0);
}
//
// Case 5: link field => record field => record field => string field
//
{
log.debug("Begin test V650");
RecordId recordId1 = idGenerator.newRecordId();
RecordId recordId2 = idGenerator.newRecordId();
defaultTable
.recordBuilder()
.id(recordId1)
.recordType(recordType.getName())
.field(linkField.getName(),
new Link(defaultTable
.recordBuilder()
.id(recordId2)
.recordType(recordType.getName())
.field(recordField.getName(),
defaultTable