blob: c2faeb899c9771e58d6c96623109cfa8f9305c38 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
|
// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root.
package com.yahoo.search.query.profile.compiled;
import com.yahoo.search.query.profile.config.QueryProfilesConfig;
import org.junit.jupiter.api.Test;
import java.util.concurrent.Executors;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertTrue;
/**
* @author gjoranv
*/
public class CompiledQueryProfileRegistryTest {
@Test
void registry_can_be_created_from_config() {
var config = new QueryProfilesConfig.Builder()
.queryprofile(new QueryProfilesConfig.Queryprofile.Builder()
.id("profile1")
.property(new QueryProfilesConfig.Queryprofile.Property.Builder()
.name("hits")
.value("5")))
.build();
var executor = Executors.newCachedThreadPool();
var registry = new CompiledQueryProfileRegistry(config, executor);
assertTrue(executor.shutdownNow().isEmpty());
var profile1 = registry.findQueryProfile("profile1");
assertEquals("5", profile1.get("hits"));
}
}
|