diff options
author | Harald Musum <musum@yahooinc.com> | 2022-11-29 07:10:55 +0100 |
---|---|---|
committer | Harald Musum <musum@yahooinc.com> | 2022-11-29 07:10:55 +0100 |
commit | 861eb23054780cbeb69a77e219017385c6e1cc21 (patch) | |
tree | da21ff0e2eb784becb4c22f770774a6d58b97eec /filedistribution/src/test | |
parent | d999546d8bf525a77779d4d6784b5ba563c8ec6f (diff) |
Split out filedistribution client into its own module
Diffstat (limited to 'filedistribution/src/test')
-rw-r--r-- | filedistribution/src/test/java/com/yahoo/vespa/filedistribution/status/FileDistributionStatusClientTest.java | 59 |
1 files changed, 0 insertions, 59 deletions
diff --git a/filedistribution/src/test/java/com/yahoo/vespa/filedistribution/status/FileDistributionStatusClientTest.java b/filedistribution/src/test/java/com/yahoo/vespa/filedistribution/status/FileDistributionStatusClientTest.java deleted file mode 100644 index a724838e7c7..00000000000 --- a/filedistribution/src/test/java/com/yahoo/vespa/filedistribution/status/FileDistributionStatusClientTest.java +++ /dev/null @@ -1,59 +0,0 @@ -// Copyright Yahoo. Licensed under the terms of the Apache 2.0 license. See LICENSE in the project root. - -package com.yahoo.vespa.filedistribution.status; - -import org.junit.Test; - -import static com.yahoo.vespa.filedistribution.status.FileDistributionStatusClient.CommandLineArguments; -import static org.junit.Assert.assertEquals; - -public class FileDistributionStatusClientTest { - - private static final CommandLineArguments arguments = createArguments("--tenant", "foo", "--application", "bar"); - private final FileDistributionStatusClient client = new FileDistributionStatusClient(arguments); - - @Test - public void finishedForAllHosts() { - String output = client.parseAndGenerateOutput("{\"status\":\"FINISHED\"}"); - assertEquals("File distribution finished", output); - } - - @Test - public void unknownForAllHosts() { - String output = client.parseAndGenerateOutput("{\"status\":\"UNKNOWN\", \"message\":\"Something went wrong\"}"); - assertEquals("File distribution status unknown: Something went wrong", output); - } - - @Test - public void manyHostsVariousStates() { - String statusForTwoHosts = createStatusForTwoHosts(); - System.out.println(statusForTwoHosts); - String output = client.parseAndGenerateOutput(statusForTwoHosts); - assertEquals("File distribution in progress:\nlocalhost1: IN_PROGRESS (1 of 2 finished)\nlocalhost2: UNKNOWN (Connection timed out)", output); - } - - private static CommandLineArguments createArguments(String... args) { - return CommandLineArguments.build(args); - } - - private String createStatusForTwoHosts() { - return "{\"status\":\"IN_PROGRESS\"," + - "\"hosts\":[" + createInProgressStatusForHost("localhost1") + "," + createUnknownStatusForHost("localhost2") + "]" + - "}"; - } - - private String createInProgressStatusForHost(String hostname) { - return "{\"hostname\":\"" + hostname + "\"," + - "\"status\":\"IN_PROGRESS\"," + - "\"message\":\"\"," + - "\"fileReferences\":[" + - "{\"1234\":0.2}, {\"abcd\":1.0}]}"; - } - - private String createUnknownStatusForHost(String hostname) { - return "{\"hostname\":\"" + hostname + "\"," + - "\"status\":\"UNKNOWN\"," + - "\"message\":\"Connection timed out\"}"; - } - -} |