use of com.yahoo.vespa.model.VespaModel in project vespa by vespa-engine.
the class IndexedTest method requireMultipleDocumentTypes.
@Test
public void requireMultipleDocumentTypes() {
VespaModelCreatorWithMockPkg creator = getIndexedVespaModelCreator();
VespaModel model = creator.create();
DeployState deployState = creator.deployState;
IndexedSearchCluster cluster = model.getContentClusters().get("test").getSearch().getIndexed();
assertEquals(3, cluster.getDocumentDbs().size());
NewDocumentType type1 = deployState.getDocumentModel().getDocumentManager().getDocumentType("type1");
NewDocumentType type2 = deployState.getDocumentModel().getDocumentManager().getDocumentType("type2");
NewDocumentType type3 = deployState.getDocumentModel().getDocumentManager().getDocumentType("type3");
assertNotNull(type1);
assertNotNull(type2);
assertNotNull(type3);
}
use of com.yahoo.vespa.model.VespaModel in project vespa by vespa-engine.
the class IndexedTest method requireThatIndexingDocprocGetsConfigIdBasedOnDistributionKey.
@Test
public void requireThatIndexingDocprocGetsConfigIdBasedOnDistributionKey() {
VespaModel model = getIndexedVespaModel();
ContainerCluster cluster = model.getContainerClusters().get("cluster.test.indexing");
assertEquals("docproc/cluster.test.indexing/3", cluster.getContainers().get(0).getConfigId());
}
use of com.yahoo.vespa.model.VespaModel in project vespa by vespa-engine.
the class IndexedTest method requireProtonStreamingOnly.
@Test
public void requireProtonStreamingOnly() {
VespaModel model = getStreamingVespaModel();
HostResource h = model.getHostSystem().getHosts().get(0);
String[] expectedServices = { "logserver", "configserver", "adminserver", "slobrok", "logd", "configproxy", "config-sentinel", "qrserver", "storagenode", "searchnode", "distributor", "transactionlogserver" };
// TODO DomContentBuilderTest.assertServices(h, expectedServices);
ContentCluster s = model.getContentClusters().get("test");
assertFalse(s.getSearch().hasIndexedCluster());
StorServerConfig.Builder builder = new StorServerConfig.Builder();
s.getStorageNodes().getConfig(builder);
s.getStorageNodes().getChildren().get("3").getConfig(builder);
}
use of com.yahoo.vespa.model.VespaModel in project vespa by vespa-engine.
the class GenericServicesModelTest method test_generic_services_parsing.
@Test
public void test_generic_services_parsing() throws IOException, SAXException {
final String hosts = "<hosts>" + "<host name=\"localhost\">" + " <alias>mockhost</alias>" + " </host> " + "</hosts>";
String services = "<services version=\"1.0\">" + "<service id=\"me\" name=\"foo\" command=\"/bin/bar\" version=\"1.0\">" + "<node hostalias=\"mockhost\" />" + "</service>" + "</services>";
VespaModel model = new VespaModel(new MockApplicationPackage.Builder().withHosts(hosts).withServices(services).build());
GenericServicesModel gsModel = (GenericServicesModel) model.configModelRepo().get("me");
assertThat(gsModel.serviceClusters().size(), is(1));
assertThat(gsModel.serviceClusters().get(0).getName(), is("foo"));
assertThat(gsModel.serviceClusters().get(0).services().size(), is(1));
}
use of com.yahoo.vespa.model.VespaModel in project vespa by vespa-engine.
the class RoutingTestCase method assertApplication.
/**
* Tests whether or not the given application produces the expected output. When creating new tests, create an
* application directory containing the necessary setup files, and call this method with a TRUE create flag.
*
* @param application The application directory.
*/
private static void assertApplication(File application) throws IOException {
assertTrue(application.isDirectory());
String applicationName = application.getName();
Map<String, File> files = new HashMap<>();
for (File file : application.listFiles(new ContentFilter())) {
files.put(file.getName(), file);
}
String path = null;
try {
path = application.getCanonicalPath();
} catch (IOException e) {
fail("Could not resolve path for application '" + applicationName + "'.");
}
VespaModelCreatorWithFilePkg creator = new VespaModelCreatorWithFilePkg(path);
VespaModel model = creator.create();
List<String> errors = model.getRouting().getErrors();
if (errors.isEmpty()) {
if (files.containsKey("errors.txt")) {
if (WRITE_FILES) {
files.remove("errors.txt").delete();
} else {
fail("Route verification did not fail.");
}
}
MessagebusConfig.Builder mBusB = new MessagebusConfig.Builder();
model.getConfig(mBusB, "");
MessagebusConfig mBus = new MessagebusConfig(mBusB);
assertConfigFileContains(application, files, "messagebus.cfg", mBus);
DocumentrouteselectorpolicyConfig.Builder drB = new DocumentrouteselectorpolicyConfig.Builder();
model.getConfig(drB, "");
DocumentrouteselectorpolicyConfig dr = new DocumentrouteselectorpolicyConfig(drB);
assertConfigFileContains(application, files, "documentrouteselectorpolicy.cfg", dr);
} else {
StringBuilder msg = new StringBuilder();
for (String error : errors) {
msg.append(error).append("\n");
}
assertFileContains(application, files, "errors.txt", msg.toString());
}
}
Aggregations