Search in sources :

Example 1 with HttpBuilder

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));
}
Also used : Element(org.w3c.dom.Element) HttpBuilder(com.yahoo.vespa.model.container.http.xml.HttpBuilder) Http(com.yahoo.vespa.model.container.http.Http) Test(org.junit.Test) DomBuilderTest(com.yahoo.config.model.builder.xml.test.DomBuilderTest)

Example 2 with HttpBuilder

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);
}
Also used : Element(org.w3c.dom.Element) HttpBuilder(com.yahoo.vespa.model.container.http.xml.HttpBuilder) Http(com.yahoo.vespa.model.container.http.Http) Test(org.junit.Test) DomBuilderTest(com.yahoo.config.model.builder.xml.test.DomBuilderTest)

Example 3 with HttpBuilder

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());
}
Also used : Element(org.w3c.dom.Element) HttpBuilder(com.yahoo.vespa.model.container.http.xml.HttpBuilder) Http(com.yahoo.vespa.model.container.http.Http) AccessControl(com.yahoo.vespa.model.container.http.AccessControl) Test(org.junit.Test) DomBuilderTest(com.yahoo.config.model.builder.xml.test.DomBuilderTest)

Example 4 with HttpBuilder

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;
}
Also used : HttpBuilder(com.yahoo.vespa.model.container.http.xml.HttpBuilder)

Example 5 with HttpBuilder

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);
}
Also used : Element(org.w3c.dom.Element) HttpBuilder(com.yahoo.vespa.model.container.http.xml.HttpBuilder) Http(com.yahoo.vespa.model.container.http.Http) Test(org.junit.Test) DomBuilderTest(com.yahoo.config.model.builder.xml.test.DomBuilderTest)

Aggregations

HttpBuilder (com.yahoo.vespa.model.container.http.xml.HttpBuilder)5 DomBuilderTest (com.yahoo.config.model.builder.xml.test.DomBuilderTest)4 Http (com.yahoo.vespa.model.container.http.Http)4 Test (org.junit.Test)4 Element (org.w3c.dom.Element)4 AccessControl (com.yahoo.vespa.model.container.http.AccessControl)1