refactor(gateway-test) Remove some unnecessary vars and layout issue.
MODIFY
gateway/test/src/test/java/io/apiman/gateway/test/junit/vertx3/ApiToFileRegistry.java
gateway/test/src/test/java/io/apiman/gateway/test/junit/vertx3/ApiToFileRegistry.java
@@ -45,10 +45,7 @@ public class ApiToFileRegistry extends InMemoryRegistry {
private File file;
private JsonArray clients = new JsonArray();
private JsonArray apis = new JsonArray();
- private JsonObject root = new JsonObject(); private void linkRoot() {
- root.put("clients", clients);
- root.put("apis", apis);
- }
+ private JsonObject root = new JsonObject();
private Map<Client, JsonObject> clientMap = new LinkedHashMap<>();
private Map<Api, JsonObject> apiMap = new LinkedHashMap<>();
private EventBus eb;
@@ -62,6 +59,11 @@ public class ApiToFileRegistry extends InMemoryRegistry {
createResetListener();
}
+ private void linkRoot() {
+ root.put("clients", clients);
+ root.put("apis", apis);
+ }
+
private void createResetListener() {
eb.consumer(ApiToFileRegistry.class.getCanonicalName(), msg -> {
if (msg.headers().get("action").equals("reset")) {

MODIFY
gateway/test/src/test/java/io/apiman/gateway/test/junit/vertx3/Vertx3GatewayFileRegistryServer.java
gateway/test/src/test/java/io/apiman/gateway/test/junit/vertx3/Vertx3GatewayFileRegistryServer.java
@@ -24,7 +24,6 @@ import io.vertx.core.DeploymentOptions;
import io.vertx.core.Vertx;
import io.vertx.core.VertxOptions;
import io.vertx.core.eventbus.DeliveryOptions;
-import io.vertx.core.eventbus.MessageConsumer;
import io.vertx.core.json.JsonObject;
import java.io.File;
@@ -55,8 +54,6 @@ public class Vertx3GatewayFileRegistryServer implements IGatewayTestServer {
private JsonObject vertxConf;
private Vertx secondVx;
private JsonObject pushEmulatorConfig;
- private MessageConsumer<Object> resetConsumer;
- private MessageConsumer<Object> rewriteConsumer;
private CountDownLatch rewriteCdl = new CountDownLatch(1);
private CountDownLatch resetCdl = new CountDownLatch(1);
@@ -77,8 +74,8 @@ public class Vertx3GatewayFileRegistryServer implements IGatewayTestServer {
secondVx.deployVerticle(ApiVerticle.class.getCanonicalName(),
new DeploymentOptions().setConfig(pushEmulatorConfig));
- resetConsumer = secondVx.eventBus().consumer("reset").handler(reset -> resetCdl.countDown());
- rewriteConsumer = secondVx.eventBus().consumer("rewrite").handler(rewritten -> rewriteCdl.countDown());
+ secondVx.eventBus().consumer("reset").handler(reset -> resetCdl.countDown());
+ secondVx.eventBus().consumer("rewrite").handler(rewritten -> rewriteCdl.countDown());
}
private JsonObject loadJsonObjectFromResources(JsonNode nodeConfig, String name) {

refactor(gateway-test) Remove some unnecessary vars and layout issue.