use of com.yahoo.vespa.model.test.utils.VespaModelCreatorWithMockPkg 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.test.utils.VespaModelCreatorWithMockPkg in project vespa by vespa-engine.
the class DocumentDatabaseTestCase method assertAttributesConfigIndependentOfMode.
private void assertAttributesConfigIndependentOfMode(String mode, List<String> sds, List<String> documentDBConfigIds, Map<String, List<String>> expectedAttributesMap) {
VespaModel model = new VespaModelCreatorWithMockPkg(vespaHosts, createVespaServices(sds, mode), ApplicationPackageUtils.generateSearchDefinitions(sds)).create();
ContentSearchCluster contentSearchCluster = model.getContentClusters().get("test").getSearch();
ProtonConfig proton = getProtonCfg(contentSearchCluster);
assertEquals(sds.size(), proton.documentdb().size());
for (int i = 0; i < sds.size(); i++) {
assertEquals(sds.get(i), proton.documentdb(i).inputdoctypename());
assertEquals(documentDBConfigIds.get(i), proton.documentdb(i).configid());
List<String> expectedAttributes = expectedAttributesMap.get(sds.get(i));
if (expectedAttributes != null) {
AttributesConfig rac1 = model.getConfig(AttributesConfig.class, proton.documentdb(i).configid());
assertEquals(expectedAttributes.size(), rac1.attribute().size());
for (int j = 0; j < expectedAttributes.size(); j++) {
assertEquals(expectedAttributes.get(j), rac1.attribute(j).name());
}
}
}
}
use of com.yahoo.vespa.model.test.utils.VespaModelCreatorWithMockPkg in project vespa by vespa-engine.
the class DocumentDatabaseTestCase method requireThatRelevantConfigIsAvailableForClusterSearcher.
@Test
public void requireThatRelevantConfigIsAvailableForClusterSearcher() throws ParseException, IOException, SAXException {
final List<String> sds = Arrays.asList("type1", "type2");
VespaModel model = new VespaModelCreatorWithMockPkg(vespaHosts, createVespaServices(sds, "index"), ApplicationPackageUtils.generateSearchDefinitions(sds)).create();
String searcherId = "container/searchchains/chain/test/component/com.yahoo.prelude.cluster.ClusterSearcher";
{
// documentdb-info config
DocumentdbInfoConfig dcfg = model.getConfig(DocumentdbInfoConfig.class, searcherId);
assertEquals(2, dcfg.documentdb().size());
{
// type1
DocumentdbInfoConfig.Documentdb db = dcfg.documentdb(0);
assertEquals("type1", db.name());
assertEquals(6, db.rankprofile().size());
assertRankProfile(db, 0, "default", false, false);
assertRankProfile(db, 1, "unranked", false, false);
assertRankProfile(db, 2, "staticrank", false, false);
assertRankProfile(db, 3, "summaryfeatures", true, false);
assertRankProfile(db, 4, "inheritedsummaryfeatures", true, false);
assertRankProfile(db, 5, "rankfeatures", false, true);
assertEquals(2, db.summaryclass().size());
assertEquals("default", db.summaryclass(0).name());
assertEquals("attributeprefetch", db.summaryclass(1).name());
assertSummaryField(db, 0, 0, "f1", "longstring", true);
assertSummaryField(db, 0, 1, "f2", "integer", false);
}
{
// type2
DocumentdbInfoConfig.Documentdb db = dcfg.documentdb(1);
assertEquals("type2", db.name());
}
}
{
// attributes config
AttributesConfig acfg = model.getConfig(AttributesConfig.class, searcherId);
assertEquals(4, acfg.attribute().size());
assertEquals("f2", acfg.attribute(0).name());
assertEquals("f2_nfa", acfg.attribute(1).name());
assertEquals("f4", acfg.attribute(2).name());
assertEquals("f4_nfa", acfg.attribute(3).name());
}
}
use of com.yahoo.vespa.model.test.utils.VespaModelCreatorWithMockPkg in project vespa by vespa-engine.
the class VespaModelTester method createModel.
/**
* Creates a model using the hosts already added to this
*
* @param services the services xml string
* @param failOnOutOfCapacity whether we should get an exception when not enough hosts of the requested flavor
* is available or if we should just silently receive a smaller allocation
* @return the resulting model
*/
public VespaModel createModel(String services, boolean failOnOutOfCapacity, int startIndexForClusters, String... retiredHostNames) {
VespaModelCreatorWithMockPkg modelCreatorWithMockPkg = new VespaModelCreatorWithMockPkg(null, services, ApplicationPackageUtils.generateSearchDefinition("type1"));
ApplicationPackage appPkg = modelCreatorWithMockPkg.appPkg;
HostProvisioner provisioner = hosted ? new InMemoryProvisioner(hostsByFlavor, failOnOutOfCapacity, startIndexForClusters, retiredHostNames) : new SingleNodeProvisioner();
DeployProperties properties = new DeployProperties.Builder().hostedVespa(hosted).applicationId(applicationId).build();
DeployState deployState = new DeployState.Builder().applicationPackage(appPkg).modelHostProvisioner(provisioner).properties(properties).build(true);
return modelCreatorWithMockPkg.create(false, deployState, configModelRegistry);
}
use of com.yahoo.vespa.model.test.utils.VespaModelCreatorWithMockPkg in project vespa by vespa-engine.
the class ModelProvisioningTest method createNonProvisionedMultitenantModel.
private VespaModel createNonProvisionedMultitenantModel(String services) {
VespaModelCreatorWithMockPkg modelCreatorWithMockPkg = new VespaModelCreatorWithMockPkg(null, services, ApplicationPackageUtils.generateSearchDefinition("type1"));
ApplicationPackage appPkg = modelCreatorWithMockPkg.appPkg;
DeployState deployState = new DeployState.Builder().applicationPackage(appPkg).properties((new DeployProperties.Builder()).multitenant(true).build()).build(true);
return modelCreatorWithMockPkg.create(false, deployState);
}
Aggregations