use of com.yahoo.document.DocumentTypeManager in project vespa by vespa-engine.
the class StoragePolicyTestEnvironment method setUp.
@Override
public void setUp() throws Exception {
DocumentTypeManager manager = new DocumentTypeManager();
DocumentTypeManagerConfigurer.configure(manager, "file:./test/cfg/testdoc.cfg");
frame = new PolicyTestFrame(manager);
nodes = new TreeSet<>();
DocumentProtocol protocol = (DocumentProtocol) frame.getMessageBus().getProtocol((Utf8Array) DocumentProtocol.NAME);
policyFactory = new StoragePolicyTestFactory(nodes);
protocol.putRoutingPolicyFactory("storage", policyFactory);
frame.setMessage(createMessage("userdoc:ns:1:foo"));
frame.setHop(new HopSpec("test", "[storage:cluster=foo]"));
}
use of com.yahoo.document.DocumentTypeManager in project vespa by vespa-engine.
the class DeriverTestCase method testDeriveDocManager.
@Test
public void testDeriveDocManager() {
DocumentTypeManager dtm = new DocumentTypeManager(new DocumentmanagerConfig(Deriver.getDocumentManagerConfig(new ArrayList<String>() {
{
add("src/test/derived/deriver/child.sd");
add("src/test/derived/deriver/parent.sd");
add("src/test/derived/deriver/grandparent.sd");
}
})));
assertEquals(dtm.getDocumentType("child").getField("a").getDataType(), DataType.STRING);
}
use of com.yahoo.document.DocumentTypeManager 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.DocumentTypeManager 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.DocumentTypeManager in project vespa by vespa-engine.
the class VisitorSearcherTestCase method setUp.
@org.junit.Before
public void setUp() {
docMan = new DocumentTypeManager();
docType = new DocumentType("kittens");
docType.addHeaderField("name", DataType.STRING);
docType.addField("description", DataType.STRING);
docType.addField("image", DataType.RAW);
docType.addField("fluffiness", DataType.INT);
docType.addField("foo", DataType.RAW);
docMan.registerDocumentType(docType);
factory = new DocumentSessionFactory(docType);
}
Aggregations