use of com.yahoo.processing.request.Properties in project vespa by vespa-engine.
the class SearchChainResolverTestCase method resolve.
private SearchChainInvocationSpec resolve(String sourceSpecification, String providerSpecification) throws UnresolvedSearchChainException {
Properties sourceToProviderMap = emptySourceToProviderMap();
sourceToProviderMap.set("source." + sourceSpecification + ".provider", providerSpecification);
return resolve(sourceSpecification, sourceToProviderMap);
}
use of com.yahoo.processing.request.Properties in project vespa by vespa-engine.
the class QueryProfileTestCase method testCloning.
/**
* Tests cloning, with wrappers used in production in place
*/
public void testCloning() {
QueryProfile classProfile = new QueryProfile("test");
classProfile.set("a", "aValue", (QueryProfileRegistry) null);
classProfile.set("b", 3, (QueryProfileRegistry) null);
Properties properties = new QueryProfileProperties(classProfile.compile(null));
Properties propertiesClone = properties.clone();
assertEquals("aValue", propertiesClone.get("a"));
assertEquals(3, propertiesClone.get("b"));
properties.set("a", "aNewValue");
assertEquals("aNewValue", properties.get("a"));
assertEquals("aValue", propertiesClone.get("a"));
}
use of com.yahoo.processing.request.Properties in project vespa by vespa-engine.
the class QueryProfileSubstitutionTestCase method testNoOverridingOfPropertiesSetAtRuntime.
public void testNoOverridingOfPropertiesSetAtRuntime() {
QueryProfile p = new QueryProfile("test");
p.set("message", "Hello %{world}!", (QueryProfileRegistry) null);
p.set("world", "world", (QueryProfileRegistry) null);
p.freeze();
Properties runtime = new QueryProfileProperties(p.compile(null));
runtime.set("runtimeMessage", "Hello %{world}!");
assertEquals("Hello world!", runtime.get("message"));
assertEquals("Hello %{world}!", runtime.get("runtimeMessage"));
}
use of com.yahoo.processing.request.Properties in project vespa by vespa-engine.
the class QueryProfileSubstitutionTestCase method testButPropertiesSetAtRuntimeAreUsedInSubstitutions.
public void testButPropertiesSetAtRuntimeAreUsedInSubstitutions() {
QueryProfile p = new QueryProfile("test");
p.set("message", "Hello %{world}!", (QueryProfileRegistry) null);
p.set("world", "world", (QueryProfileRegistry) null);
Properties runtime = new QueryProfileProperties(p.compile(null));
runtime.set("world", "Earth");
assertEquals("Hello Earth!", runtime.get("message"));
}
use of com.yahoo.processing.request.Properties in project vespa by vespa-engine.
the class RequestTestCase method testProperties.
@Test
public void testProperties() {
Properties p = new PropertyMap();
p.set("a", "a1");
Request r = new Request(p);
r.properties().set("b", "b1");
assertEquals(2, r.properties().listProperties().size());
assertEquals("a1", r.properties().get("a"));
assertEquals("b1", r.properties().get("b"));
assertEquals("b1", r.properties().get("b", "default"));
assertEquals("default", r.properties().get("c", "default"));
assertNull(r.properties().get("c"));
assertEquals("b1", r.properties().get(new CompoundName("b")));
assertEquals("b1", r.properties().get(new CompoundName("b"), "default"));
assertEquals("default", r.properties().get(new CompoundName("c"), "default"));
assertNull(r.properties().get(new CompoundName("c")));
assertEquals("b1", r.properties().getString("b"));
assertEquals("b1", r.properties().getString("b", "default"));
assertEquals("default", r.properties().getString("c", "default"));
assertEquals(null, r.properties().getString("c"));
assertEquals("b1", r.properties().getString(new CompoundName("b")));
assertEquals("b1", r.properties().getString(new CompoundName("b"), "default"));
assertEquals("default", r.properties().getString(new CompoundName("c"), "default"));
assertEquals(null, r.properties().getString(new CompoundName("c")));
r.properties().set("i", 7);
assertEquals(7, (int) r.properties().getInteger("i"));
assertEquals(7, (int) r.properties().getInteger("i", 3));
assertEquals(3, (int) r.properties().getInteger("n", 3));
assertNull(r.properties().getInteger("n"));
assertEquals(7, (int) r.properties().getInteger(new CompoundName("i")));
assertEquals(7, (int) r.properties().getInteger(new CompoundName("i"), 3));
assertEquals(3, (int) r.properties().getInteger(new CompoundName("n"), 3));
assertNull(r.properties().getInteger("n"));
r.properties().set(new CompoundName("l"), 7);
assertEquals(7, (long) r.properties().getLong("l"));
assertEquals(7, (long) r.properties().getLong("l", 3l));
assertEquals(3, (long) r.properties().getLong("m", 3l));
assertNull(r.properties().getInteger("m"));
assertEquals(7, (long) r.properties().getLong(new CompoundName("l")));
assertEquals(7, (long) r.properties().getLong(new CompoundName("l"), 3l));
assertEquals(3, (long) r.properties().getLong(new CompoundName("m"), 3l));
assertNull(r.properties().getInteger("m"));
r.properties().set("d", 7.3);
assertEquals(7.3, r.properties().getDouble("d"));
assertEquals(7.3, r.properties().getDouble("d", 3.4d));
assertEquals(3.4, r.properties().getDouble("f", 3.4d));
assertNull(r.properties().getDouble("f"));
assertEquals(7.3, r.properties().getDouble(new CompoundName("d")));
assertEquals(7.3, r.properties().getDouble(new CompoundName("d"), 3.4d));
assertEquals(3.4, r.properties().getDouble(new CompoundName("f"), 3.4d));
assertNull(r.properties().getDouble("f"));
r.properties().set("o", true);
assertEquals(true, r.properties().getBoolean("o"));
assertEquals(true, r.properties().getBoolean("o", true));
assertEquals(true, r.properties().getBoolean("g", true));
assertEquals(false, r.properties().getBoolean("g"));
assertEquals(true, r.properties().getBoolean(new CompoundName("o")));
assertEquals(true, r.properties().getBoolean(new CompoundName("o"), true));
assertEquals(true, r.properties().getBoolean(new CompoundName("g"), true));
assertEquals(false, r.properties().getBoolean("g"));
r.properties().set(new CompoundName("x.y"), "x1.y1");
r.properties().set("x.z", "x1.z1");
assertEquals(8, r.properties().listProperties().size());
assertEquals(0, r.properties().listProperties("a").size());
assertEquals(0, r.properties().listProperties(new CompoundName("a")).size());
assertEquals(0, r.properties().listProperties(new CompoundName("none")).size());
assertEquals(2, r.properties().listProperties(new CompoundName("x")).size());
assertEquals(2, r.properties().listProperties("x").size());
}
Aggregations