diff options
author | Harald Musum <musum@oath.com> | 2017-11-10 09:54:17 +0100 |
---|---|---|
committer | Harald Musum <musum@oath.com> | 2017-11-10 09:54:17 +0100 |
commit | fa70a069485201ac99c4fe70a05f064d48e7d09f (patch) | |
tree | 989330e03fbb83bfe0c79cdd4ce1249facf9d3a0 /config-proxy/src/test | |
parent | 9afa9689b8ebaae095e0fd9a2b91df812eb82f9f (diff) |
Split out file distribution RPC methods into its own class
Diffstat (limited to 'config-proxy/src/test')
2 files changed, 14 insertions, 6 deletions
diff --git a/config-proxy/src/test/java/com/yahoo/vespa/config/proxy/ConfigProxyRpcServerTest.java b/config-proxy/src/test/java/com/yahoo/vespa/config/proxy/ConfigProxyRpcServerTest.java index f9b334a6f87..4a9d2acb4c5 100644 --- a/config-proxy/src/test/java/com/yahoo/vespa/config/proxy/ConfigProxyRpcServerTest.java +++ b/config-proxy/src/test/java/com/yahoo/vespa/config/proxy/ConfigProxyRpcServerTest.java @@ -5,6 +5,8 @@ import com.yahoo.config.subscription.ConfigSourceSet; import com.yahoo.jrt.Request; import com.yahoo.jrt.Spec; import com.yahoo.jrt.StringValue; +import com.yahoo.jrt.Supervisor; +import com.yahoo.jrt.Transport; import com.yahoo.vespa.config.RawConfig; import org.junit.After; import org.junit.Before; @@ -28,7 +30,7 @@ public class ConfigProxyRpcServerTest { @Before public void setup() { proxyServer = ProxyServer.createTestServer(new ConfigSourceSet(address)); - rpcServer = new ConfigProxyRpcServer(proxyServer, null); + rpcServer = new ConfigProxyRpcServer(proxyServer, new Supervisor(new Transport()), null); } @After @@ -40,7 +42,7 @@ public class ConfigProxyRpcServerTest { public void basic() { ProxyServer proxy = ProxyServer.createTestServer(new MockConfigSource(new MockClientUpdater())); Spec spec = new Spec("localhost", 12345); - ConfigProxyRpcServer server = new ConfigProxyRpcServer(proxy, spec); + ConfigProxyRpcServer server = new ConfigProxyRpcServer(proxy, new Supervisor(new Transport()), spec); assertThat(server.getSpec(), is(spec)); } diff --git a/config-proxy/src/test/java/com/yahoo/vespa/config/proxy/filedistribution/FileDownloaderTest.java b/config-proxy/src/test/java/com/yahoo/vespa/config/proxy/filedistribution/FileDownloaderTest.java index 18d49e9a224..c44e19f9f03 100644 --- a/config-proxy/src/test/java/com/yahoo/vespa/config/proxy/filedistribution/FileDownloaderTest.java +++ b/config-proxy/src/test/java/com/yahoo/vespa/config/proxy/filedistribution/FileDownloaderTest.java @@ -5,6 +5,9 @@ import com.yahoo.io.IOUtils; import com.yahoo.jrt.Int32Value; import com.yahoo.jrt.Request; import com.yahoo.jrt.RequestWaiter; +import com.yahoo.jrt.StringValue; +import com.yahoo.jrt.Supervisor; +import com.yahoo.jrt.Transport; import com.yahoo.text.Utf8; import com.yahoo.vespa.config.Connection; import com.yahoo.vespa.config.ConnectionPool; @@ -18,9 +21,7 @@ import java.time.Duration; import java.util.Arrays; import java.util.LinkedHashSet; import java.util.List; -import java.util.Map; import java.util.Optional; -import java.util.Set; import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertFalse; @@ -38,6 +39,7 @@ public class FileDownloaderTest { File downloadDir = Files.createTempDirectory("filedistribution").toFile(); connection = new MockConnection(); fileDownloader = new FileDownloader(connection, downloadDir, Duration.ofMillis(3000)); + FileDistributionRpcServer rpcServer = new FileDistributionRpcServer(new Supervisor(new Transport()), fileDownloader); } catch (IOException e) { e.printStackTrace(); fail(e.getMessage()); @@ -204,8 +206,10 @@ public class FileDownloaderTest { @Override public void request(Request request) { - if (request.methodName().equals("filedistribution.serveFile")) + if (request.methodName().equals("filedistribution.serveFile")) { request.returnValues().add(new Int32Value(0)); + request.returnValues().add(new StringValue("OK")); + } } } @@ -213,8 +217,10 @@ public class FileDownloaderTest { @Override public void request(Request request) { - if (request.methodName().equals("filedistribution.serveFile")) + if (request.methodName().equals("filedistribution.serveFile")) { request.returnValues().add(new Int32Value(1)); + request.returnValues().add(new StringValue("Internal error")); + } } } |