Search in sources :

Example 11 with Rule

use of io.fabric8.service.jclouds.firewall.Rule in project fabric8 by jboss-fuse.

the class JsonRuleBaseReaderTest method parseWithGlobalDomainPath.

@Test
public void parseWithGlobalDomainPath() throws Exception {
    final InputStream in = JsonRuleBaseBuilder.newRuleBase().globalCookieDomain(".global.com").rule("/foo/{path}", "https://foo.com/cheese/{path}").rule("/foo2/{path}", "https://foo2.com/cheese/{path}", null, "overriddenDomain").inputStream();
    final Map<String, HttpProxyRule> rules = JsonRuleBaseReader.parseJson(in);
    assertThat(rules.get("/foo/{path}").getCookieDomain(), equalTo(".global.com"));
    assertThat(rules.get("/foo2/{path}").getCookieDomain(), equalTo("overriddenDomain"));
}
Also used : ByteArrayInputStream(java.io.ByteArrayInputStream) InputStream(java.io.InputStream) HttpProxyRule(io.fabric8.gateway.model.HttpProxyRule) Test(org.junit.Test)

Example 12 with Rule

use of io.fabric8.service.jclouds.firewall.Rule in project fabric8 by jboss-fuse.

the class JsonRuleBaseReaderTest method parseWithCookiePathAndCookieDomain.

@Test
public void parseWithCookiePathAndCookieDomain() throws Exception {
    final InputStream in = JsonRuleBaseBuilder.newRuleBase().rule("/foo/{path}", "https://foo.com/cheese/{path}", "/cookiePath", ".domain.com").inputStream();
    final Map<String, HttpProxyRule> rules = JsonRuleBaseReader.parseJson(in);
    final HttpProxyRule httpProxyRule = rules.get("/foo/{path}");
    assertThat(httpProxyRule.getCookiePath(), equalTo("/cookiePath"));
    assertThat(httpProxyRule.getCookieDomain(), equalTo(".domain.com"));
}
Also used : ByteArrayInputStream(java.io.ByteArrayInputStream) InputStream(java.io.InputStream) HttpProxyRule(io.fabric8.gateway.model.HttpProxyRule) Test(org.junit.Test)

Example 13 with Rule

use of io.fabric8.service.jclouds.firewall.Rule in project fabric8 by jboss-fuse.

the class MappingConfigurationTest method assertMapping.

protected void assertMapping(String path, String service) {
    Map<String, MappedServices> mappingRules = httpGateway.getMappedServices();
    assertTrue("Should have some mapping rules", mappingRules.size() > 0);
    MappedServices mappedServices = mappingRules.get(path);
    assertNotNull("Could not find mapping rule for path " + path, mappedServices);
    Collection<String> serviceUrls = mappedServices.getServiceUrls();
    assertTrue("Could not find service " + service + " in services " + serviceUrls, serviceUrls.contains(service));
}
Also used : MappedServices(io.fabric8.gateway.handlers.http.MappedServices)

Aggregations

HttpProxyRule (io.fabric8.gateway.model.HttpProxyRule)6 ByteArrayInputStream (java.io.ByteArrayInputStream)5 InputStream (java.io.InputStream)5 Test (org.junit.Test)4 IOException (java.io.IOException)3 JsonNode (com.fasterxml.jackson.databind.JsonNode)2 MappedServices (io.fabric8.gateway.handlers.http.MappedServices)2 HTTPIngressPath (io.fabric8.kubernetes.api.model.extensions.HTTPIngressPath)2 HTTPIngressRuleValue (io.fabric8.kubernetes.api.model.extensions.HTTPIngressRuleValue)2 Ingress (io.fabric8.kubernetes.api.model.extensions.Ingress)2 IngressBackend (io.fabric8.kubernetes.api.model.extensions.IngressBackend)2 IngressRule (io.fabric8.kubernetes.api.model.extensions.IngressRule)2 IngressSpec (io.fabric8.kubernetes.api.model.extensions.IngressSpec)2 FirewallManager (io.fabric8.service.jclouds.firewall.FirewallManager)2 Rule (io.fabric8.service.jclouds.firewall.Rule)2 SimplePathTemplate (io.fabric8.zookeeper.internal.SimplePathTemplate)2 HashMap (java.util.HashMap)2 JsonProcessingException (com.fasterxml.jackson.core.JsonProcessingException)1 ArrayNode (com.fasterxml.jackson.databind.node.ArrayNode)1 ObjectNode (com.fasterxml.jackson.databind.node.ObjectNode)1