use of com.predic8.membrane.core.Router 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.Router 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.Router in project service-proxy by membrane.
the class HostnameTest method setUp.
@Override
@Before
public void setUp() throws Exception {
router = new Router();
h1 = new Hostname(router);
h1.setPattern("localhost");
ip = new Ip(router);
ip.setPattern("127.0.0.1");
}
use of com.predic8.membrane.core.Router 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();
}
use of com.predic8.membrane.core.Router in project service-proxy by membrane.
the class MethodTest method setUp.
@Before
public void setUp() throws Exception {
Rule rule = new ServiceProxy(new ServiceProxyKey("localhost", "*", ".*", 4000), "oio.de", 80);
router = new HttpRouter();
router.getRuleManager().addProxyAndOpenPortIfNew(rule);
router.init();
}
Aggregations