use of com.yahoo.document.DocumentPut in project vespa by vespa-engine.
the class EntryTestCase method testEquals.
public void testEquals() {
DocumentTypeManager manager = new DocumentTypeManager();
DocumentTypeManagerConfigurer.configure(manager, "file:src/test/files/documentmanager.cfg");
DocumentType bmType = manager.getDocumentType("benchmark");
DocumentPut put1 = new DocumentPut(bmType, "userdoc:foo:99999999:1");
DocumentPut put2 = new DocumentPut(bmType, "userdoc:foo:99999999:2");
Entry entry1 = Entry.create(put1);
Entry entry2 = Entry.create(put1);
assert (entry1.equals(entry2));
Entry entry3 = Entry.create(put2);
assert (!entry1.equals(entry3));
}
use of com.yahoo.document.DocumentPut in project vespa by vespa-engine.
the class EntryTestCase method testHashCode.
public void testHashCode() {
DocumentTypeManager manager = new DocumentTypeManager();
DocumentTypeManagerConfigurer.configure(manager, "file:src/test/files/documentmanager.cfg");
DocumentType bmType = manager.getDocumentType("benchmark");
DocumentPut put1 = new DocumentPut(bmType, "userdoc:foo:99999999:1");
DocumentPut put2 = new DocumentPut(bmType, "userdoc:foo:99999999:2");
Entry entry1 = Entry.create(put1);
Entry entry2 = Entry.create(put1);
assert (entry1.hashCode() == entry2.hashCode());
Entry entry3 = Entry.create(put2);
assert (entry1.hashCode() != entry3.hashCode());
}
use of com.yahoo.document.DocumentPut in project vespa by vespa-engine.
the class DynamicEntry method getTimestamp.
@Override
public long getTimestamp() {
if (op instanceof DocumentPut) {
DocumentPut put = (DocumentPut) op;
final Long lastModified = put.getDocument().getLastModified();
if (lastModified != null) {
return lastModified;
}
}
return 0L;
}
use of com.yahoo.document.DocumentPut in project vespa by vespa-engine.
the class DocumentOperationMessageV3 method newPutMessage.
static DocumentOperationMessageV3 newPutMessage(VespaXMLFeedReader.Operation op, String operationId) {
DocumentPut put = new DocumentPut(op.getDocument());
put.setCondition(op.getCondition());
Message msg = new PutDocumentMessage(put);
String id = (operationId == null) ? put.getId().toString() : operationId;
return new DocumentOperationMessageV3(id, msg);
}
use of com.yahoo.document.DocumentPut in project vespa by vespa-engine.
the class Feeder method newPutMessage.
private Tuple2<String, Message> newPutMessage(Operation op, String operationId) {
DocumentPut put = new DocumentPut(op.getDocument());
put.setCondition(op.getCondition());
Message msg = new PutDocumentMessage(put);
String id = (operationId == null) ? put.getId().toString() : operationId;
return new Tuple2<>(id, msg);
}
Aggregations