@@ -0,0 +1,2586 @@
+package enmasse.discovery;%0A%0Aimport enmasse.config.service.amqp.AMQPServer;%0Aimport enmasse.config.service.model.ResourceDatabase;%0Aimport enmasse.config.service.model.Subscriber;%0Aimport io.vertx.core.Vertx;%0Aimport org.apache.qpid.proton.amqp.messaging.AmqpSequence;%0Aimport org.apache.qpid.proton.message.Message;%0Aimport org.junit.After;%0Aimport org.junit.Before;%0Aimport org.junit.Test;%0A%0Aimport java.io.IOException;%0Aimport java.util.*;%0Aimport java.util.concurrent.CompletableFuture;%0Aimport java.util.concurrent.ExecutionException;%0Aimport java.util.concurrent.TimeUnit;%0Aimport java.util.concurrent.TimeoutException;%0A%0Aimport static org.hamcrest.CoreMatchers.is;%0Aimport static org.junit.Assert.assertThat;%0A%0Apublic class DiscoveryTest %7B%0A%0A    private Vertx vertx;%0A%0A    @Before%0A    public void setup() %7B%0A        vertx = Vertx.vertx();%0A    %7D%0A%0A    @After%0A    public void teardown() %7B%0A        vertx.close();%0A    %7D%0A%0A    @Test%0A    public void testDiscovery() throws InterruptedException, IOException, TimeoutException, ExecutionException %7B%0A        Map%3CString, String%3E expectedFilter = Collections.singletonMap(%22my%22, %22key%22);%0A        CompletableFuture%3CSet%3CHost%3E%3E changedHosts = new CompletableFuture%3C%3E();%0A%0A        AMQPServer testServer = new AMQPServer(%220.0.0.0%22, 0, (address, map, subscriber) -%3E %7B%0A            assertThat(address, is(%22podsense%22));%0A            assertThat(map, is(expectedFilter));%0A%0A            Message message = Message.Factory.create();%0A            Map%3CString, Object%3E responseMap = new LinkedHashMap%3C%3E();%0A            Map%3CInteger, String%3E portMap = Collections.singletonMap(1234, %22http%22);%0A            responseMap.put(%22ip%22, %2210.0.0.1%22);%0A            responseMap.put(%22ports%22, portMap);%0A            AmqpSequence seq = new AmqpSequence(Collections.singletonList(responseMap));%0A            message.setBody(seq);%0A%0A            subscriber.resourcesUpdated(message);%0A            return true;%0A        %7D);%0A%0A        vertx.deployVerticle(testServer);%0A        DiscoveryClient client = new DiscoveryClient(new Endpoint(%22127.0.0.1%22, waitForPort(testServer)), expectedFilter);%0A        client.addListener(changedHosts::complete);%0A        vertx.deployVerticle(client);%0A%0A        Set%3CHost%3E actual = changedHosts.get(1, TimeUnit.MINUTES);%0A        assertThat(actual.size(), is(1));%0A        Host actualHost = actual.iterator().next();%0A        assertThat(actualHost.getHostname(), is(%2210.0.0.1%22));%0A    %7D%0A%0A%0A    private int waitForPort(AMQPServer testServer) throws InterruptedException %7B%0A        while (testServer.port() == 0) %7B%0A            Thread.sleep(1000);%0A        %7D%0A        return testServer.port();%0A    %7D%0A%7D%0A

Add missing test class