Search in sources :

Example 1 with TuningDispatch

use of com.yahoo.vespa.model.content.TuningDispatch in project vespa by vespa-engine.

the class DomTuningDispatchBuilderTest method requireThatTuningDispatchPolicyRoundRobin.

@Test
public void requireThatTuningDispatchPolicyRoundRobin() throws Exception {
    TuningDispatch dispatch = newTuningDispatch("<content>" + "  <tuning>" + "    <dispatch>" + "      <dispatch-policy>round-robin</dispatch-policy>" + "    </dispatch>" + "  </tuning>" + "</content>");
    assertTrue(TuningDispatch.DispatchPolicy.ROUNDROBIN == dispatch.getDispatchPolicy());
}
Also used : TuningDispatch(com.yahoo.vespa.model.content.TuningDispatch) Test(org.junit.Test)

Example 2 with TuningDispatch

use of com.yahoo.vespa.model.content.TuningDispatch in project vespa by vespa-engine.

the class DomTuningDispatchBuilderTest method requireThatTuningDispatchPolicyRandom.

@Test
public void requireThatTuningDispatchPolicyRandom() throws Exception {
    TuningDispatch dispatch = newTuningDispatch("<content>" + "  <tuning>" + "    <dispatch>" + "      <dispatch-policy>random</dispatch-policy>" + "    </dispatch>" + "  </tuning>" + "</content>");
    assertTrue(TuningDispatch.DispatchPolicy.RANDOM == dispatch.getDispatchPolicy());
}
Also used : TuningDispatch(com.yahoo.vespa.model.content.TuningDispatch) Test(org.junit.Test)

Example 3 with TuningDispatch

use of com.yahoo.vespa.model.content.TuningDispatch in project vespa by vespa-engine.

the class DomTuningDispatchBuilder method build.

public static TuningDispatch build(ModelElement contentXml) {
    TuningDispatch.Builder builder = new TuningDispatch.Builder();
    ModelElement tuningElement = contentXml.getChild("tuning");
    if (tuningElement == null) {
        return builder.build();
    }
    ModelElement dispatchElement = tuningElement.getChild("dispatch");
    if (dispatchElement == null) {
        return builder.build();
    }
    builder.setMaxHitsPerPartition(dispatchElement.childAsInteger("max-hits-per-partition"));
    builder.setDispatchPolicy(dispatchElement.childAsString("dispatch-policy"));
    builder.setUseLocalNode(dispatchElement.childAsBoolean("use-local-node"));
    builder.setMinGroupCoverage(dispatchElement.childAsDouble("min-group-coverage"));
    builder.setMinActiveDocsCoverage(dispatchElement.childAsDouble("min-active-docs-coverage"));
    return builder.build();
}
Also used : ModelElement(com.yahoo.vespa.model.builder.xml.dom.ModelElement) TuningDispatch(com.yahoo.vespa.model.content.TuningDispatch)

Example 4 with TuningDispatch

use of com.yahoo.vespa.model.content.TuningDispatch in project vespa by vespa-engine.

the class DomTuningDispatchBuilderTest method requireThatEmptydispatchIsSafe.

@Test
public void requireThatEmptydispatchIsSafe() throws Exception {
    TuningDispatch dispatch = newTuningDispatch("<content>" + "  <tuning>" + "    <dispatch/>" + "  </tuning>" + "</content>");
    assertNull(dispatch.getMaxHitsPerPartition());
    assertNull(dispatch.getMinGroupCoverage());
    assertNull(dispatch.getMinActiveDocsCoverage());
    assertTrue(TuningDispatch.DispatchPolicy.ROUNDROBIN == dispatch.getDispatchPolicy());
}
Also used : TuningDispatch(com.yahoo.vespa.model.content.TuningDispatch) Test(org.junit.Test)

Example 5 with TuningDispatch

use of com.yahoo.vespa.model.content.TuningDispatch in project vespa by vespa-engine.

the class DomTuningDispatchBuilderTest method requireThatDefaultsAreNull.

@Test
public void requireThatDefaultsAreNull() throws Exception {
    TuningDispatch dispatch = newTuningDispatch("<content/>");
    assertNull(dispatch.getMaxHitsPerPartition());
}
Also used : TuningDispatch(com.yahoo.vespa.model.content.TuningDispatch) Test(org.junit.Test)

Aggregations

TuningDispatch (com.yahoo.vespa.model.content.TuningDispatch)7 Test (org.junit.Test)6 ModelElement (com.yahoo.vespa.model.builder.xml.dom.ModelElement)1