Fixed the test of gateway that broke travisCI build
MODIFY
gateway/engine/core/src/main/java/io/apiman/gateway/engine/impl/ApiRequestExecutorImpl.java
gateway/engine/core/src/main/java/io/apiman/gateway/engine/impl/ApiRequestExecutorImpl.java
@@ -235,12 +235,12 @@ public class ApiRequestExecutorImpl implements IApiRequestExecutor {
});
//check if api disable key are enabled
- if (!api.isKeysStrippingDisabled()) {
-
+ if (api != null && !api.isKeysStrippingDisabled()) {
// Strip apikey
stripApiKey();
}
+
// Fill out some of the basic metrics structure.
requestMetric.setRequestStart(new Date());
requestMetric.setUrl(request.getUrl());
@@ -344,7 +344,7 @@ public class ApiRequestExecutorImpl implements IApiRequestExecutor {
// If no API Key provided - the api must be public. If an API Key *is* provided
// then we lookup the Contract and use that.
- if (request.getApiKey() == null || api.isKeysStrippingDisabled()) {
+ if (request.getApiKey() == null || (api != null && api.isKeysStrippingDisabled())) {
if (api == null) {
ApiNotFoundException error = new ApiNotFoundException(Messages.i18n.format("EngineImpl.ApiNotFound")); //$NON-NLS-1$

MODIFY
manager/api/es/src/test/java/io/apiman/manager/api/es/EsMarshallingTest.java
manager/api/es/src/test/java/io/apiman/manager/api/es/EsMarshallingTest.java
@@ -178,7 +178,7 @@ public class EsMarshallingTest {
public void testMarshallApiVersionBean() throws Exception {
ApiVersionBean bean = createBean(ApiVersionBean.class);
XContentBuilder builder = EsMarshalling.marshall(bean);
- Assert.assertEquals("{\"organizationId\":\"ID\",\"organizationName\":\"NAME\",\"apiId\":\"ID\",\"apiName\":\"NAME\",\"apiDescription\":\"DESCRIPTION\",\"version\":\"VERSION\",\"status\":\"Created\",\"createdBy\":\"CREATEDBY\",\"createdOn\":1,\"modifiedBy\":\"MODIFIEDBY\",\"modifiedOn\":1,\"publishedOn\":1,\"retiredOn\":1,\"publicAPI\":true,\"endpoint\":\"ENDPOINT\",\"endpointType\":\"rest\",\"endpointContentType\":\"json\",\"parsePayload\":true,\"definitionType\":\"None\",\"definitionUrl\":\"DEFINITIONURL\",\"gateways\":[{\"gatewayId\":\"GATEWAYID\"}],\"plans\":[{\"planId\":\"PLANID\",\"version\":\"VERSION\"}],\"endpointProperties\":{\"KEY-1\":\"VALUE-1\",\"KEY-2\":\"VALUE-2\"}}", builder.string());
+ Assert.assertEquals("{\"organizationId\":\"ID\",\"organizationName\":\"NAME\",\"apiId\":\"ID\",\"apiName\":\"NAME\",\"apiDescription\":\"DESCRIPTION\",\"version\":\"VERSION\",\"status\":\"Created\",\"createdBy\":\"CREATEDBY\",\"createdOn\":1,\"modifiedBy\":\"MODIFIEDBY\",\"modifiedOn\":1,\"publishedOn\":1,\"retiredOn\":1,\"publicAPI\":true,\"endpoint\":\"ENDPOINT\",\"endpointType\":\"rest\",\"endpointContentType\":\"json\",\"parsePayload\":true,\"disableKeysStrip\":true,\"definitionType\":\"None\",\"definitionUrl\":\"DEFINITIONURL\",\"gateways\":[{\"gatewayId\":\"GATEWAYID\"}],\"plans\":[{\"planId\":\"PLANID\",\"version\":\"VERSION\"}],\"endpointProperties\":{\"KEY-1\":\"VALUE-1\",\"KEY-2\":\"VALUE-2\"}}", builder.string());
}
/**

Fixed the test of gateway that broke travisCI build (#831)