fix(gateway-platforms-vertx3) Fixes to conform to test specification.
MODIFY
gateway/platforms/vertx3/vertx3-common/src/main/java/io/apiman/gateway/platforms/vertx3/common/config/VertxEngineConfig.java
gateway/platforms/vertx3/vertx3-common/src/main/java/io/apiman/gateway/platforms/vertx3/common/config/VertxEngineConfig.java
@@ -19,6 +19,7 @@ import io.apiman.common.logging.IDelegateFactory;
import io.apiman.common.util.SimpleStringUtils;
import io.apiman.common.util.crypt.IDataEncrypter;
import io.apiman.gateway.engine.EngineConfigTuple;
+import io.apiman.gateway.engine.GatewayConfigProperties;
import io.apiman.gateway.engine.IComponent;
import io.apiman.gateway.engine.IConnectorFactory;
import io.apiman.gateway.engine.IEngineConfig;
@@ -37,6 +38,8 @@ import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
+import org.apache.commons.lang3.StringUtils;
+
/**
* Engine configuration, read simplistically from Vert'x JSON config.
*
@@ -154,6 +157,17 @@ public class VertxEngineConfig implements IEngineConfig {
return toFlatStringMap(getConfig(config, GATEWAY_METRICS_PREFIX));
}
+ @Override
+ public Class<? extends IDelegateFactory> getLoggerFactoryClass(IPluginRegistry pluginRegistry) {
+ return loadConfigClass(getClassname(config, GatewayConfigProperties.LOGGER_FACTORY_CLASS), // Problem with prefix
+ IDelegateFactory.class);
+ }
+
+ @Override
+ public Map<String, String> getLoggerFactoryConfig() {
+ return null;
+ }
+
@Override
public <T extends IComponent> Class<T> getComponentClass(Class<T> componentType, IPluginRegistry pluginRegistry) {
String className = config.getJsonObject(GATEWAY_COMPONENT_PREFIX).
@@ -172,16 +186,6 @@ public class VertxEngineConfig implements IEngineConfig {
return toFlatStringMap(componentConfig);
}
- @Override
- public Class<? extends IDelegateFactory> getLoggerFactoryClass(IPluginRegistry pluginRegistry) {
- return VertxLoggerDelegate.class;
- }
-
- @Override
- public Map<String, String> getLoggerFactoryConfig() {
- return null;
- }
-
/**
* @see io.apiman.gateway.engine.IEngineConfig#getGatewayInitializers(io.apiman.gateway.engine.IPluginRegistry)
*/
@@ -255,7 +259,19 @@ public class VertxEngineConfig implements IEngineConfig {
}
protected String getClassname(JsonObject obj, String prefix) {
- return obj.getJsonObject(prefix).getString(GATEWAY_CLASS);
+ String clazzName = System.getProperty(prefix);
+
+ // Something of a hack because the constants may assume apiman-gateway prefix, which isn't in the vert.x JSON.
+
+ String strippedPrefix = StringUtils.substringAfter(prefix, "apiman-gateway.");
+
+ String filteredPrefix = strippedPrefix.isEmpty() ? prefix : strippedPrefix;
+
+
+ if (clazzName == null)
+ return obj.getJsonObject(filteredPrefix).getString(GATEWAY_CLASS);
+
+ return clazzName;
}
protected JsonObject getConfig(JsonObject obj, String prefix) {

MODIFY
gateway/platforms/vertx3/vertx3/src/main/java/io/apiman/gateway/platforms/vertx3/http/HttpPolicyAdapter.java
gateway/platforms/vertx3/vertx3/src/main/java/io/apiman/gateway/platforms/vertx3/http/HttpPolicyAdapter.java
@@ -121,7 +121,7 @@ public class HttpPolicyAdapter {
errorResponse.setResponseCode(HttpResponseStatus.INTERNAL_SERVER_ERROR.code());
errorResponse.setMessage(error.getMessage());
errorResponse.setTrace(error);
-
+ response.setChunked(true);
response.write(Json.encode(errorResponse));
response.end();
}

MODIFY
gateway/test/src/test/resources/test-configs/vertx3-mem.json
gateway/test/src/test/resources/test-configs/vertx3-mem.json
{
"factory" : "io.apiman.gateway.test.junit.vertx3.Vertx3GatewayTestServerFactory",
"config" : "vertx3/conf-mem.json",
- "resetter" : "io.apiman.gateway.test.junit.vertx3.EsResetter"
+ "resetter" : "io.apiman.gateway.test.junit.vertx3.NoOpResetter"
}

MODIFY
gateway/test/src/test/resources/vertx3/conf-es.json
gateway/test/src/test/resources/vertx3/conf-es.json
}
},
+ "encrypter": {
+ "class": "io.apiman.gateway.engine.impl.DefaultDataEncrypter",
+ "config": {}
+ },
+
"plugin-registry": {
"class": "io.apiman.gateway.platforms.vertx3.engine.VertxPluginRegistry",
"config": {}
}
},
+ "logger-factory": {
+ "class": "io.apiman.gateway.platforms.vertx3.common.config.VertxLoggerDelegate",
+ "config": {}
+ },
+
"policy-factory": {
"class": "io.apiman.gateway.engine.policy.PolicyFactoryImpl",
"config": {}
// Port - The port a given verticle listens on (where relevant)
// Count - Number of given verticle type launched
"verticles": {
- "http": { "port": 8082, "count": 1 },
- "https": { "port": 8443, "count": 1 },
- "api": { "port": 8081, "count": 1 },
- "policy": { "port": -1, "count": 1 }
+ "http": {
+ "port": 8082,
+ "count": 1
+ },
+ "https": {
+ "port": 8443,
+ "count": 1
+ },
+ "api": {
+ "port": 8081,
+ "count": 1
+ }
},
// SSL configuration to the gateway's *front end* (i.e. client <-> gateway).
-// "ssl": {
-// "keystore": {
-// "path": "/the/keystore/path/here.jks",
-// "password": "password-here"
-// },
-// "truststore": {
-// "path": "/the/truststore/path/here.jks",
-// "password": "password-here"
-// }
-// },
+ "ssl": {
+ "keystore": {
+ "path": "/Users/msavy/apiman/apiman/gateway/platforms/servlet/src/test/resources/io/apiman/gateway/platforms/servlet/auth/basic/service_ks.jks",
+ "password": "password"
+ },
+ "truststore": {
+ "path": "/Users/msavy/apiman/apiman/gateway/platforms/servlet/src/test/resources/io/apiman/gateway/platforms/servlet/auth/basic/service_ks.jks",
+ "password": "password"
+ }
+ },
// API authentication; presently just BASIC auth.
"auth": {
},
// When reporting a API's endpoint, prefer secure (i.e. https)
- "preferSecure": true
+ "preferSecure": false
}

MODIFY
gateway/test/src/test/resources/vertx3/conf-mem.json
gateway/test/src/test/resources/vertx3/conf-mem.json
}
},
+ "encrypter": {
+ "class": "io.apiman.gateway.engine.impl.DefaultDataEncrypter",
+ "config": {}
+ },
+
"plugin-registry": {
"class": "io.apiman.gateway.platforms.vertx3.engine.VertxPluginRegistry",
"config": {}
}
},
+ "logger-factory": {
+ "class": "io.apiman.gateway.platforms.vertx3.common.config.VertxLoggerDelegate",
+ "config": {}
+ },
+
"policy-factory": {
"class": "io.apiman.gateway.engine.policy.PolicyFactoryImpl",
"config": {}
// Port - The port a given verticle listens on (where relevant)
// Count - Number of given verticle type launched
"verticles": {
- "http": { "port": 8082, "count": 1 },
- "https": { "port": 8443, "count": 1 },
- "api": { "port": 8081, "count": 1 },
- "policy": { "port": -1, "count": 1 }
+ "http": {
+ "port": 8082,
+ "count": 1
+ },
+ "https": {
+ "port": 8443,
+ "count": 1
+ },
+ "api": {
+ "port": 8081,
+ "count": 1
+ }
},
// SSL configuration to the gateway's *front end* (i.e. client <-> gateway).
-// "ssl": {
-// "keystore": {
-// "path": "/the/keystore/path/here.jks",
-// "password": "password-here"
-// },
-// "truststore": {
-// "path": "/the/truststore/path/here.jks",
-// "password": "password-here"
-// }
-// },
+"ssl": {
+ "keystore": {
+ "path": "/Users/msavy/apiman/apiman/gateway/platforms/servlet/src/test/resources/io/apiman/gateway/platforms/servlet/auth/basic/service_ks.jks",
+ "password": "password"
+ },
+ "truststore": {
+ "path": "/Users/msavy/apiman/apiman/gateway/platforms/servlet/src/test/resources/io/apiman/gateway/platforms/servlet/auth/basic/service_ks.jks",
+ "password": "password"
+ }
+},
// API authentication; presently just BASIC auth.
"auth": {
},
// When reporting a API's endpoint, prefer secure (i.e. https)
- "preferSecure": true
+ "preferSecure": false
}

fix(gateway-platforms-vertx3) Fixes to conform to test specification.