use of com.yahoo.vespa.model.container.http.xml.HttpBuilder in project vespa by vespa-engine.
the class AccessControlTest method access_control_filter_chain_is_set_up.
@Test
public void access_control_filter_chain_is_set_up() throws Exception {
Element clusterElem = DomBuilderTest.parse(" <http>", " <filtering>", " <access-control domain='foo' />", " </filtering>", " </http>");
Http http = new HttpBuilder().build(root, clusterElem);
root.freezeModelTopology();
assertTrue(http.getFilterChains().hasChain(AccessControl.ACCESS_CONTROL_CHAIN_ID));
}
use of com.yahoo.vespa.model.container.http.xml.HttpBuilder in project vespa by vespa-engine.
the class AccessControlTest method read_is_disabled_and_write_is_enabled_by_default.
@Test
public void read_is_disabled_and_write_is_enabled_by_default() throws Exception {
Element clusterElem = DomBuilderTest.parse(" <http>", " <filtering>", " <access-control domain='foo' />", " </filtering>", " </http>");
Http http = new HttpBuilder().build(root, clusterElem);
root.freezeModelTopology();
assertFalse("Wrong default value for read.", http.getAccessControl().get().readEnabled);
assertTrue("Wrong default value for write.", http.getAccessControl().get().writeEnabled);
}
use of com.yahoo.vespa.model.container.http.xml.HttpBuilder in project vespa by vespa-engine.
the class AccessControlTest method properties_are_set_from_xml.
@Test
public void properties_are_set_from_xml() throws Exception {
Element clusterElem = DomBuilderTest.parse(" <http>", " <filtering>", " <access-control domain='my-domain'>", " <application>my-app</application>", " <vespa-domain>custom-vespa-domain</vespa-domain>", " </access-control>", " </filtering>", " </http>");
Http http = new HttpBuilder().build(root, clusterElem);
root.freezeModelTopology();
AccessControl accessControl = http.getAccessControl().get();
assertEquals("Wrong domain.", "my-domain", accessControl.domain);
assertEquals("Wrong application.", "my-app", accessControl.applicationId);
assertEquals("Wrong vespa-domain.", "custom-vespa-domain", accessControl.vespaDomain.get());
}
use of com.yahoo.vespa.model.container.http.xml.HttpBuilder in project vespa by vespa-engine.
the class FilterBindingsTest method buildHttp.
private Http buildHttp(Element xml) throws Exception {
Http http = new HttpBuilder().build(root, xml);
root.freezeModelTopology();
http.validate();
return http;
}
use of com.yahoo.vespa.model.container.http.xml.HttpBuilder in project vespa by vespa-engine.
the class AccessControlTest method read_and_write_can_be_overridden.
@Test
public void read_and_write_can_be_overridden() throws Exception {
Element clusterElem = DomBuilderTest.parse(" <http>", " <filtering>", " <access-control domain='foo' read='true' write='false'/>", " </filtering>", " </http>");
Http http = new HttpBuilder().build(root, clusterElem);
root.freezeModelTopology();
assertTrue("Given read value not honoured.", http.getAccessControl().get().readEnabled);
assertFalse("Given write value not honoured.", http.getAccessControl().get().writeEnabled);
}
Aggregations