use of org.apache.helix.rest.server.filters.AuditLogFilter in project helix by apache.
the class AbstractTestClass method configure.
@Override
protected Application configure() {
// start zk
try {
if (_zkServer == null) {
_zkServer = TestHelper.startZkServer(ZK_ADDR);
Assert.assertTrue(_zkServer != null);
ZKClientPool.reset();
}
if (_zkServerTestNS == null) {
_zkServerTestNS = TestHelper.startZkServer(_zkAddrTestNS);
Assert.assertTrue(_zkServerTestNS != null);
ZKClientPool.reset();
}
} catch (Exception e) {
Assert.assertTrue(false, String.format("Failed to start ZK server: %s", e.toString()));
}
// Configure server context
ResourceConfig resourceConfig = new ResourceConfig();
resourceConfig.packages(AbstractResource.class.getPackage().getName());
ServerContext serverContext = new ServerContext(ZK_ADDR);
resourceConfig.property(ContextPropertyKeys.SERVER_CONTEXT.name(), serverContext);
resourceConfig.register(new AuditLogFilter(Arrays.<AuditLogger>asList(new MockAuditLogger())));
return resourceConfig;
}
use of org.apache.helix.rest.server.filters.AuditLogFilter in project helix by apache.
the class HelixRestServer method getResourceConfig.
private ResourceConfig getResourceConfig(HelixRestNamespace namespace, ServletType type) {
ResourceConfig cfg = new ResourceConfig();
cfg.packages(type.getServletPackageArray());
cfg.property(ContextPropertyKeys.SERVER_CONTEXT.name(), new ServerContext(namespace.getMetadataStoreAddress()));
if (type == ServletType.DEFAULT_SERVLET) {
cfg.property(ContextPropertyKeys.ALL_NAMESPACES.name(), _helixNamespaces);
} else {
cfg.property(ContextPropertyKeys.METADATA.name(), namespace);
}
cfg.register(new CORSFilter());
cfg.register(new AuditLogFilter(_auditLoggers));
return cfg;
}
Aggregations