diff options
author | Bjørn Christian Seime <bjorncs@verizonmedia.com> | 2020-08-18 13:25:58 +0200 |
---|---|---|
committer | Bjørn Christian Seime <bjorncs@verizonmedia.com> | 2020-08-27 10:46:16 +0200 |
commit | 365c8e48f41f4d5693acd238c6e3a175dd76e42a (patch) | |
tree | 6bf9f6fdb559b6d4ab8c2aa4450d12232f4fc5e9 /config-model | |
parent | 507a729c1a824ff76e19161fab7db797a690e76d (diff) |
Delegate configuration of noop filter to amender
The open-source model cannot configure the the noop filter, otherwise unit tests using application framework will fail when 'access-control' is in services.xml.
Diffstat (limited to 'config-model')
-rw-r--r-- | config-model/src/main/java/com/yahoo/vespa/model/container/http/AccessControl.java | 14 | ||||
-rw-r--r-- | config-model/src/test/java/com/yahoo/vespa/model/container/xml/AccessControlTest.java | 10 |
2 files changed, 1 insertions, 23 deletions
diff --git a/config-model/src/main/java/com/yahoo/vespa/model/container/http/AccessControl.java b/config-model/src/main/java/com/yahoo/vespa/model/container/http/AccessControl.java index 506964bcc33..d3688172a7f 100644 --- a/config-model/src/main/java/com/yahoo/vespa/model/container/http/AccessControl.java +++ b/config-model/src/main/java/com/yahoo/vespa/model/container/http/AccessControl.java @@ -3,9 +3,6 @@ package com.yahoo.vespa.model.container.http; import com.yahoo.component.ComponentId; import com.yahoo.component.ComponentSpecification; -import com.yahoo.component.chain.dependencies.Dependencies; -import com.yahoo.component.chain.model.ChainedComponentModel; -import com.yahoo.container.bundle.BundleInstantiationSpecification; import com.yahoo.vespa.model.container.ApplicationContainerCluster; import com.yahoo.vespa.model.container.ContainerCluster; import com.yahoo.vespa.model.container.component.BindingPattern; @@ -117,16 +114,7 @@ public class AccessControl { } private void addAccessControlExcludedChain(Http http) { - Chain<Filter> chain = createChain(ACCESS_CONTROL_EXCLUDED_CHAIN_ID); - chain.addInnerComponent( - new Filter( - new ChainedComponentModel( - new BundleInstantiationSpecification( - new ComponentSpecification("com.yahoo.jdisc.http.filter.security.misc.NoopFilter"), - null, - new ComponentSpecification("jdisc-security-filters")), - Dependencies.emptyDependencies()))); - http.getFilterChains().add(chain); + http.getFilterChains().add(createChain(ACCESS_CONTROL_EXCLUDED_CHAIN_ID)); for (BindingPattern excludedBinding : excludedBindings) { http.getBindings().add(createAccessControlExcludedBinding(excludedBinding)); } diff --git a/config-model/src/test/java/com/yahoo/vespa/model/container/xml/AccessControlTest.java b/config-model/src/test/java/com/yahoo/vespa/model/container/xml/AccessControlTest.java index f2a924c5f8d..18bad25c7c7 100644 --- a/config-model/src/test/java/com/yahoo/vespa/model/container/xml/AccessControlTest.java +++ b/config-model/src/test/java/com/yahoo/vespa/model/container/xml/AccessControlTest.java @@ -7,14 +7,11 @@ import com.yahoo.config.model.deploy.DeployState; import com.yahoo.config.model.deploy.TestProperties; import com.yahoo.config.provision.AthenzDomain; import com.yahoo.vespa.model.container.ApplicationContainer; -import com.yahoo.vespa.model.container.component.chain.Chain; import com.yahoo.vespa.model.container.http.AccessControl; -import com.yahoo.vespa.model.container.http.Filter; import com.yahoo.vespa.model.container.http.FilterChains; import com.yahoo.vespa.model.container.http.Http; import org.junit.Test; -import java.util.Collection; import java.util.Optional; import java.util.Set; import java.util.stream.Collectors; @@ -25,7 +22,6 @@ import static org.hamcrest.CoreMatchers.is; import static org.hamcrest.Matchers.containsInAnyOrder; import static org.hamcrest.Matchers.equalTo; import static org.hamcrest.Matchers.hasItems; -import static org.hamcrest.Matchers.hasSize; import static org.hamcrest.Matchers.not; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; @@ -52,12 +48,6 @@ public class AccessControlTest extends ContainerModelBuilderTestBase { FilterChains filterChains = http.getFilterChains(); assertTrue(filterChains.hasChain(AccessControl.ACCESS_CONTROL_CHAIN_ID)); assertTrue(filterChains.hasChain(AccessControl.ACCESS_CONTROL_EXCLUDED_CHAIN_ID)); - - Chain<Filter> excludedChain = filterChains.allChains().getComponent(AccessControl.ACCESS_CONTROL_EXCLUDED_CHAIN_ID); - Collection<Filter> innerComponents = excludedChain.getInnerComponents(); - assertThat(innerComponents, hasSize(1)); - String accessControlExcludedChain = innerComponents.iterator().next().getClassId().stringValue(); - assertEquals("com.yahoo.jdisc.http.filter.security.misc.NoopFilter", accessControlExcludedChain); } @Test |