summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorBjørn Christian Seime <bjorncs@verizonmedia.com>2020-08-18 13:25:58 +0200
committerBjørn Christian Seime <bjorncs@verizonmedia.com>2020-08-18 13:25:58 +0200
commit8373e8d51ff3019e94f82211df16efae23080fe6 (patch)
tree53ac7b52576b0f5bf6bd927753d952cd72696fcd
parent40b8fd053051bd0f462ca7d400f0407c7961969f (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.
-rw-r--r--config-model/src/main/java/com/yahoo/vespa/model/container/http/AccessControl.java14
-rw-r--r--config-model/src/test/java/com/yahoo/vespa/model/container/xml/AccessControlTest.java10
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