use of com.predic8.membrane.core.interceptor.Interceptor in project service-proxy by membrane.
the class ValidatorInterceptorTest method createSchemaValidatorInterceptor.
private ValidatorInterceptor createSchemaValidatorInterceptor(String schema) throws Exception {
ValidatorInterceptor interceptor = new ValidatorInterceptor();
interceptor.setResourceResolver(new ResolverMap());
interceptor.setSchema(schema);
interceptor.init();
return interceptor;
}
use of com.predic8.membrane.core.interceptor.Interceptor in project service-proxy by membrane.
the class HelpLinkExistenceTest method doit.
@Test
public void doit() throws Exception {
Set<Class<?>> classes = getElementClasses();
Assert.assertNotEquals(0, classes.size());
HttpClient hc = new HttpClient();
for (Class<?> clazz : classes) {
if (Interceptor.class.isAssignableFrom(clazz)) {
Interceptor i = (Interceptor) clazz.newInstance();
String helpId = i.getHelpId();
String url = "http://membrane-soa.org/service-proxy-doc/" + getVersion() + "/configuration/reference/" + helpId + ".htm";
Response r = hc.call(new Request.Builder().get(url).buildExchange()).getResponse();
try {
Assert.assertEquals(200, r.getStatusCode());
} catch (Throwable e) {
throw new RuntimeException(url, e);
}
}
}
}
use of com.predic8.membrane.core.interceptor.Interceptor in project service-proxy by membrane.
the class AccessControlInterceptorIntegrationTest method setInterceptor.
/*
* This test can only by run on a specific machine.
*/
/*@Test
public void testLocalhost() throws Exception {
setInterceptor(FILE_CLIENTS_FROM_LOCALHOST);
HttpClient client = new HttpClient();
HostConfiguration config = new HostConfiguration();
config.setLocalAddress(InetAddress.getByName("localhost"));
client.setHostConfiguration(config);
assertEquals(200, client.executeMethod(getBLZRequestMethod()));
}*/
/*
* This test can only by run on a specific machine.
*/
/*@Test
public void test192_168_2_Star() throws Exception {
setInterceptor(FILE_CLIENTS_FROM_192_168_2_STAR);
assertEquals(200, getClient(FIXED_IP).executeMethod(getBLZRequestMethod()));
}*/
private void setInterceptor(String fileName) throws Exception {
AccessControlInterceptor interceptor = new AccessControlInterceptor();
interceptor.setFile(fileName);
router.addUserFeatureInterceptor(interceptor);
router.init();
}
use of com.predic8.membrane.core.interceptor.Interceptor in project service-proxy by membrane.
the class XMLProtectionInterceptorTest method setUp.
@Before
public void setUp() throws Exception {
exc = new Exchange(null);
exc.setRequest(MessageUtil.getGetRequest("/axis2/services/BLZService"));
exc.setOriginalHostHeader("thomas-bayer.com:80");
interceptor = new XMLProtectionInterceptor();
}
use of com.predic8.membrane.core.interceptor.Interceptor in project service-proxy by membrane.
the class ProxyRuleTest method getInterceptors.
private List<Interceptor> getInterceptors() {
List<Interceptor> interceptors = new ArrayList<Interceptor>();
Interceptor balancer = new LoadBalancingInterceptor();
balancer.setId("roundRobinBalancer");
interceptors.add(balancer);
Interceptor acl = new AccessControlInterceptor();
acl.setId("accessControlInterceptor");
interceptors.add(acl);
return interceptors;
}
Aggregations