Search in sources :

Example 1 with Fs4Config

use of com.yahoo.container.search.Fs4Config in project vespa by vespa-engine.

the class FastSearcherTestCase method testPing.

@Test
public void testPing() throws IOException, InterruptedException {
    Logger.getLogger(FastSearcher.class.getName()).setLevel(Level.ALL);
    BackendTestCase.MockServer server = new BackendTestCase.MockServer();
    FS4ResourcePool listeners = new FS4ResourcePool(new Fs4Config(new Fs4Config.Builder()));
    Backend backend = listeners.getBackend(server.host.getHostString(), server.host.getPort());
    FastSearcher fastSearcher = new FastSearcher(backend, new FS4ResourcePool(1), new MockDispatcher(Collections.emptyList()), new SummaryParameters(null), new ClusterParams("testhittype"), new CacheParams(0, 0.0d), documentdbInfoConfig);
    server.dispatch.packetData = BackendTestCase.PONG;
    server.dispatch.setNoChannel();
    Chain<Searcher> chain = new Chain<>(fastSearcher);
    Execution e = new Execution(chain, Execution.Context.createContextStub());
    Pong pong = e.ping(new Ping());
    assertTrue(pong.getPongPacket().isPresent());
    assertEquals(127, pong.getPongPacket().get().getDocstamp());
    backend.shutdown();
    server.dispatch.socket.close();
    server.dispatch.connection.close();
    server.worker.join();
    pong.setPingInfo("blbl");
    assertEquals("Result of pinging using blbl", pong.toString());
}
Also used : Chain(com.yahoo.component.chain.Chain) Searcher(com.yahoo.search.Searcher) Fs4Config(com.yahoo.container.search.Fs4Config) MockBackend(com.yahoo.prelude.fastsearch.test.fs4mock.MockBackend) Execution(com.yahoo.search.searchchain.Execution) Ping(com.yahoo.prelude.Ping) Pong(com.yahoo.prelude.Pong) Test(org.junit.Test)

Example 2 with Fs4Config

use of com.yahoo.container.search.Fs4Config in project vespa by vespa-engine.

the class ClusterSearcherTestCase method createSearcher.

private static ClusterSearcher createSearcher(Double maxQueryTimeout, Double maxQueryCacheTimeout) {
    ComponentId id = new ComponentId("test-id");
    QrSearchersConfig qrsCfg = new QrSearchersConfig(new QrSearchersConfig.Builder().searchcluster(new QrSearchersConfig.Searchcluster.Builder().name("test-cluster")));
    ClusterConfig.Builder clusterCfgBld = new ClusterConfig.Builder().clusterName("test-cluster");
    if (maxQueryTimeout != null) {
        clusterCfgBld.maxQueryTimeout(maxQueryTimeout);
    }
    if (maxQueryCacheTimeout != null) {
        clusterCfgBld.maxQueryCacheTimeout(maxQueryCacheTimeout);
    }
    ClusterConfig clusterCfg = new ClusterConfig(clusterCfgBld);
    DocumentdbInfoConfig documentDbCfg = new DocumentdbInfoConfig(new DocumentdbInfoConfig.Builder().documentdb(new DocumentdbInfoConfig.Documentdb.Builder().name("type1")));
    LegacyEmulationConfig emulationCfg = new LegacyEmulationConfig(new LegacyEmulationConfig.Builder());
    QrMonitorConfig monitorCfg = new QrMonitorConfig(new QrMonitorConfig.Builder());
    Statistics statistics = Statistics.nullImplementation;
    Fs4Config fs4Cfg = new Fs4Config(new Fs4Config.Builder());
    FS4ResourcePool fs4ResourcePool = new FS4ResourcePool(fs4Cfg);
    ClusterSearcher searcher = new ClusterSearcher(id, qrsCfg, clusterCfg, documentDbCfg, emulationCfg, monitorCfg, new DispatchConfig(new DispatchConfig.Builder()), createClusterInfoConfig(), statistics, fs4ResourcePool, new VipStatus());
    return searcher;
}
Also used : DispatchConfig(com.yahoo.vespa.config.search.DispatchConfig) QrSearchersConfig(com.yahoo.container.QrSearchersConfig) VipStatus(com.yahoo.container.handler.VipStatus) Fs4Config(com.yahoo.container.search.Fs4Config) Statistics(com.yahoo.statistics.Statistics) FS4ResourcePool(com.yahoo.prelude.fastsearch.FS4ResourcePool) DocumentdbInfoConfig(com.yahoo.prelude.fastsearch.DocumentdbInfoConfig) LegacyEmulationConfig(com.yahoo.container.search.LegacyEmulationConfig) ComponentId(com.yahoo.component.ComponentId) ClusterConfig(com.yahoo.search.config.ClusterConfig)

Example 3 with Fs4Config

use of com.yahoo.container.search.Fs4Config in project vespa by vespa-engine.

the class BackendTestCase method setUp.

@Before
public void setUp() throws Exception {
    logger = Logger.getLogger(Backend.class.getName());
    initUseParent = logger.getUseParentHandlers();
    logger.setUseParentHandlers(false);
    listeners = new FS4ResourcePool(new Fs4Config(new Fs4Config.Builder()));
    server = new MockServer();
    backend = listeners.getBackend(server.host.getHostString(), server.host.getPort());
}
Also used : FS4ResourcePool(com.yahoo.prelude.fastsearch.FS4ResourcePool) Fs4Config(com.yahoo.container.search.Fs4Config) Before(org.junit.Before)

Aggregations

Fs4Config (com.yahoo.container.search.Fs4Config)3 FS4ResourcePool (com.yahoo.prelude.fastsearch.FS4ResourcePool)2 ComponentId (com.yahoo.component.ComponentId)1 Chain (com.yahoo.component.chain.Chain)1 QrSearchersConfig (com.yahoo.container.QrSearchersConfig)1 VipStatus (com.yahoo.container.handler.VipStatus)1 LegacyEmulationConfig (com.yahoo.container.search.LegacyEmulationConfig)1 Ping (com.yahoo.prelude.Ping)1 Pong (com.yahoo.prelude.Pong)1 DocumentdbInfoConfig (com.yahoo.prelude.fastsearch.DocumentdbInfoConfig)1 MockBackend (com.yahoo.prelude.fastsearch.test.fs4mock.MockBackend)1 Searcher (com.yahoo.search.Searcher)1 ClusterConfig (com.yahoo.search.config.ClusterConfig)1 Execution (com.yahoo.search.searchchain.Execution)1 Statistics (com.yahoo.statistics.Statistics)1 DispatchConfig (com.yahoo.vespa.config.search.DispatchConfig)1 Before (org.junit.Before)1 Test (org.junit.Test)1