use of com.yahoo.messagebus.test.SimpleProtocol in project vespa by vespa-engine.
the class ProtocolRepositoryTestCase method requireThatPolicyCanBeNull.
@Test
public void requireThatPolicyCanBeNull() {
ProtocolRepository repo = new ProtocolRepository();
SimpleProtocol protocol = new SimpleProtocol();
repo.putProtocol(protocol);
assertNull(repo.getRoutingPolicy(SimpleProtocol.NAME, "Custom", null));
}
use of com.yahoo.messagebus.test.SimpleProtocol in project vespa by vespa-engine.
the class ProtocolRepositoryTestCase method requireThatCreatePolicyExceptionIsCaught.
@Test
public void requireThatCreatePolicyExceptionIsCaught() {
ProtocolRepository repo = new ProtocolRepository();
SimpleProtocol protocol = new SimpleProtocol();
protocol.addPolicyFactory("Custom", new SimpleProtocol.PolicyFactory() {
@Override
public RoutingPolicy create(String param) {
throw new RuntimeException();
}
});
repo.putProtocol(protocol);
assertNull(repo.getRoutingPolicy(SimpleProtocol.NAME, "Custom", null));
}
use of com.yahoo.messagebus.test.SimpleProtocol in project vespa by vespa-engine.
the class ProtocolRepositoryTestCase method requireThatPolicyCanBeCreated.
@Test
public void requireThatPolicyCanBeCreated() {
ProtocolRepository repo = new ProtocolRepository();
SimpleProtocol protocol = new SimpleProtocol();
protocol.addPolicyFactory("Custom", new MyFactory());
repo.putProtocol(protocol);
assertNotNull(repo.getRoutingPolicy(SimpleProtocol.NAME, "Custom", null));
}
use of com.yahoo.messagebus.test.SimpleProtocol in project vespa by vespa-engine.
the class ProtocolRepositoryTestCase method requireThatPolicyIsCached.
@Test
public void requireThatPolicyIsCached() {
ProtocolRepository repo = new ProtocolRepository();
SimpleProtocol protocol = new SimpleProtocol();
protocol.addPolicyFactory("Custom", new MyFactory());
repo.putProtocol(protocol);
RoutingPolicy prev = repo.getRoutingPolicy(SimpleProtocol.NAME, "Custom", null);
assertNotNull(prev);
RoutingPolicy next = repo.getRoutingPolicy(SimpleProtocol.NAME, "Custom", null);
assertNotNull(next);
assertSame(prev, next);
}
Aggregations