Package com.spotify.helios.common.protocol

Examples of com.spotify.helios.common.protocol.VersionResponse


  @Override
  int run(final Namespace options, final HeliosClient client, final PrintStream out,
          final boolean json, final BufferedReader stdin)
      throws ExecutionException, InterruptedException {

    final VersionResponse response = client.version().get();

    if (json) {
      out.println(Json.asPrettyStringUnchecked(response));
    } else {
      out.println(String.format("Client Version: %s%nMaster Version: %s",
                                response.getClientVersion(), response.getMasterVersion()));
    }
    return 0;
  }
View Full Code Here


            final String masterVersion =
                reply == null ? "Unable to connect to master" :
                reply.status == HTTP_OK ? Json.read(reply.payload, String.class) :
                "Master replied with error code " + reply.status;

            return immediateFuture(new VersionResponse(Version.POM_VERSION, masterVersion));
          }
        });
  }
View Full Code Here

  }

  @Test
  public void testJsonVersion() throws Exception {
    startDefaultMaster();
    final VersionResponse version = getVersion("version", "--json", "-z", masterEndpoint());
    assertEquals("wrong client version", POM_VERSION, version.getClientVersion());
    assertEquals("wrong master version", POM_VERSION, version.getMasterVersion());
  }
View Full Code Here

  @Test
  public void testVersionWithFailedConnection() throws Exception {
    startDefaultMaster();
    // If we fail to connect to master, we should still get the correct client version, and a nice
    // error message instead of master version. Specify bogus endpoint to make this happen.
    final VersionResponse version = getVersion("version", "--json", "-z", "-1");
    assertEquals("wrong client version", POM_VERSION, version.getClientVersion());
    assertEquals("wrong master version", "Unable to connect to master",
                 version.getMasterVersion());
  }
View Full Code Here

  @Test
  public void testVersionWithServerError() throws Exception {
    startDefaultMaster();
    // If master returns with an error, we should still get the correct client version, and a
    // nice error message instead of master version. Specify bogus path to make this happen.
    final VersionResponse version =
        getVersion("version", "--json", "-z", masterEndpoint() + "/badPath");
    assertEquals("wrong client version", POM_VERSION, version.getClientVersion());
    assertEquals("wrong master version", "Master replied with error code 404",
                 version.getMasterVersion());
  }
View Full Code Here

TOP

Related Classes of com.spotify.helios.common.protocol.VersionResponse

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.