예제 #1
0
  @Override
  public Response installCluster(
      final String clusterName,
      final String hadoopClusterName,
      final String server,
      final String namenode,
      final String clients) {
    Preconditions.checkNotNull(clusterName);
    Preconditions.checkNotNull(hadoopClusterName);
    Preconditions.checkNotNull(server);
    Preconditions.checkNotNull(clients);

    Set<String> uuidSet = Sets.newHashSet();
    HiveConfig config = new HiveConfig();
    config.setClusterName(validateInput(clusterName, true));
    config.setHadoopClusterName(hadoopClusterName);
    config.setServer(server);
    config.setNamenode(namenode);

    List<String> hosts = JsonUtil.fromJson(clients, new TypeToken<List<String>>() {}.getType());

    for (String node : hosts) {
      uuidSet.add(node);
    }

    config.setClients(uuidSet);

    UUID uuid = hiveManager.installCluster(config);
    OperationState state = waitUntilOperationFinish(uuid);
    return createResponse(uuid, state);
  }
예제 #2
0
  @Test
  public void testGetProductOperation() throws Exception {

    Response response = restService.getTrackerOperation(SOURCE, OPERATION_ID.toString());

    TrackerOperationView pov =
        JsonUtil.fromJson(response.getEntity().toString(), TrackerOperationViewImpl.class);

    assertEquals(Response.Status.OK.getStatusCode(), response.getStatus());
    assertNotNull(pov);
  }
예제 #3
0
  @Test
  public void testGetProductOperations() throws Exception {
    SimpleDateFormat df = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
    Type listPOVType = new TypeToken<List<TrackerOperationViewImpl>>() {}.getType();

    Response response =
        restService.getTrackerOperations(SOURCE, df.format(new Date()), df.format(new Date()), 1);
    List<TrackerOperationView> pov =
        JsonUtil.fromJson(response.getEntity().toString(), listPOVType);

    assertEquals(Response.Status.OK.getStatusCode(), response.getStatus());
    assertTrue(!pov.isEmpty());
  }