use of com.predic8.membrane.core.rules.ServiceProxyKey in project service-proxy by membrane.
the class LoadBalancingWithClusterManagerTest method startLB.
private void startLB() throws Exception {
LoadBalancingInterceptor lbi = new LoadBalancingInterceptor();
lbi.setName("Default");
XMLElementSessionIdExtractor extractor = new XMLElementSessionIdExtractor();
extractor.setLocalName("session");
extractor.setNamespace("http://predic8.com/session/");
lbi.setSessionIdExtractor(extractor);
ServiceProxy lbiRule = new ServiceProxy(new ServiceProxyKey("localhost", "*", ".*", 3017), "thomas-bayer.com", 80);
lbiRule.getInterceptors().add(lbi);
ClusterNotificationInterceptor cni = new ClusterNotificationInterceptor();
ServiceProxy cniRule = new ServiceProxy(new ServiceProxyKey("localhost", "*", ".*", 3012), "thomas-bayer.com", 80);
cniRule.getInterceptors().add(cni);
lb = new HttpRouter();
lb.getRuleManager().addProxyAndOpenPortIfNew(lbiRule);
lb.getRuleManager().addProxyAndOpenPortIfNew(cniRule);
lb.init();
}
use of com.predic8.membrane.core.rules.ServiceProxyKey in project service-proxy by membrane.
the class LoadBalancingWithClusterManagerTest method startNode.
private DummyWebServiceInterceptor startNode(HttpRouter node, int port) throws Exception {
DummyWebServiceInterceptor service1 = new DummyWebServiceInterceptor();
node.addUserFeatureInterceptor(service1);
node.getRuleManager().addProxyAndOpenPortIfNew(new ServiceProxy(new ServiceProxyKey("localhost", "POST", ".*", port), "thomas-bayer.com", 80));
node.init();
return service1;
}
use of com.predic8.membrane.core.rules.ServiceProxyKey in project service-proxy by membrane.
the class RegExReplaceInterceptorTest method testReplace.
@Test
public void testReplace() throws Exception {
router = Router.init("src/test/resources/regex-monitor-beans.xml");
Rule serverRule = new ServiceProxy(new ServiceProxyKey("localhost", "*", ".*", 3009), "www.predic8.de", 80);
router.getRuleManager().addProxyAndOpenPortIfNew(serverRule);
router.init();
try {
HttpClient client = new HttpClient();
GetMethod method = new GetMethod("http://localhost:3009");
method.setRequestHeader(Header.CONTENT_TYPE, MimeType.TEXT_XML_UTF8);
method.setRequestHeader(Header.SOAP_ACTION, "");
assertEquals(200, client.executeMethod(method));
assertTrue(new String(method.getResponseBody()).contains("Membrane RegEx Replacement Is Cool"));
} finally {
router.shutdown();
}
}
use of com.predic8.membrane.core.rules.ServiceProxyKey in project service-proxy by membrane.
the class AccessControlInterceptorTest method setUp.
@Before
public void setUp() throws Exception {
router = new HttpRouter();
interceptor = new AccessControlInterceptor();
interceptor.setFile("classpath:/acl/acl.xml");
Rule rule4000 = new ServiceProxy(new ServiceProxyKey("localhost", "*", ".*", 4000), "oio.de", 80);
router = new HttpRouter();
router.getRuleManager().addProxyAndOpenPortIfNew(rule4000);
router.addUserFeatureInterceptor(interceptor);
router.init();
}
use of com.predic8.membrane.core.rules.ServiceProxyKey in project service-proxy by membrane.
the class LimitInterceptorTest method before.
@BeforeClass
public static void before() throws Exception {
router = new HttpRouter();
ServiceProxy sp2 = new ServiceProxy(new ServiceProxyKey("*", "*", ".*", 3026), "", -1);
LimitInterceptor wi = new LimitInterceptor();
wi.setMaxBodyLength(10);
wi.setFlow(Flow.Set.REQUEST);
sp2.getInterceptors().add(wi);
WebServerInterceptor wi2 = new WebServerInterceptor();
wi2.setDocBase("classpath:");
wi2.init();
sp2.getInterceptors().add(wi2);
router.getRuleManager().addProxyAndOpenPortIfNew(sp2);
router.init();
}
Aggregations