Package org.apache.hadoop.hbase.stargate.client

Examples of org.apache.hadoop.hbase.stargate.client.Response


    assertEquals(response.getCode(), 200);
  }

  public void testSingleCellGetJSON() throws IOException, JAXBException {
    final String path = "/" + TABLE + "/" + ROW_4 + "/" + COLUMN_1;
    Response response = client.put(path, MIMETYPE_BINARY,
      Bytes.toBytes(VALUE_4));
    assertEquals(response.getCode(), 200);
    Thread.yield();
    response = client.get(path, MIMETYPE_JSON);
    assertEquals(response.getCode(), 200);
    response = deleteRow(TABLE, ROW_4);
    assertEquals(response.getCode(), 200);
  }
View Full Code Here


  }

  public void testURLEncodedKey() throws IOException, JAXBException {
    String encodedKey = URLEncoder.encode("http://www.google.com/",
      HConstants.UTF8_ENCODING);
    Response response;
    response = putValueXML(TABLE, encodedKey, COLUMN_1, VALUE_1);
    assertEquals(response.getCode(), 200);
    response = putValuePB(TABLE, encodedKey, COLUMN_2, VALUE_2);
    assertEquals(response.getCode(), 200);
    checkValuePB(TABLE, encodedKey, COLUMN_1, VALUE_1);
    checkValueXML(TABLE, encodedKey, COLUMN_2, VALUE_2);
  }
View Full Code Here

    rowModel.addCell(new CellModel(Bytes.toBytes(COLUMN_1), Bytes.toBytes(VALUE_3)));
    rowModel.addCell(new CellModel(Bytes.toBytes(COLUMN_2), Bytes.toBytes(VALUE_4)));
    cellSetModel.addRow(rowModel);
    StringWriter writer = new StringWriter();
    marshaller.marshal(cellSetModel, writer);
    Response response = client.put(path, MIMETYPE_XML,
      Bytes.toBytes(writer.toString()));
    Thread.yield();

    // make sure the fake row was not actually created
    response = client.get(path, MIMETYPE_XML);
    assertEquals(response.getCode(), 404);

    // check that all of the values were created
    checkValueXML(TABLE, ROW_1, COLUMN_1, VALUE_1);
    checkValueXML(TABLE, ROW_1, COLUMN_2, VALUE_2);
    checkValueXML(TABLE, ROW_2, COLUMN_1, VALUE_3);
    checkValueXML(TABLE, ROW_2, COLUMN_2, VALUE_4);

    response = deleteRow(TABLE, ROW_1);
    assertEquals(response.getCode(), 200);   
    response = deleteRow(TABLE, ROW_2);
    assertEquals(response.getCode(), 200);
  }
View Full Code Here

    cellSetModel.addRow(rowModel);
    rowModel = new RowModel(ROW_2);
    rowModel.addCell(new CellModel(Bytes.toBytes(COLUMN_1), Bytes.toBytes(VALUE_3)));
    rowModel.addCell(new CellModel(Bytes.toBytes(COLUMN_2), Bytes.toBytes(VALUE_4)));
    cellSetModel.addRow(rowModel);
    Response response = client.put(path, MIMETYPE_PROTOBUF,
      cellSetModel.createProtobufOutput());
    Thread.yield();

    // make sure the fake row was not actually created
    response = client.get(path, MIMETYPE_PROTOBUF);
    assertEquals(response.getCode(), 404);

    // check that all of the values were created
    checkValuePB(TABLE, ROW_1, COLUMN_1, VALUE_1);
    checkValuePB(TABLE, ROW_1, COLUMN_2, VALUE_2);
    checkValuePB(TABLE, ROW_2, COLUMN_1, VALUE_3);
    checkValuePB(TABLE, ROW_2, COLUMN_2, VALUE_4);

    response = deleteRow(TABLE, ROW_1);
    assertEquals(response.getCode(), 200);   
    response = deleteRow(TABLE, ROW_2);
    assertEquals(response.getCode(), 200);
  }
View Full Code Here

    Response response = client.get("/version", MIMETYPE_JSON);
    assertTrue(response.getCode() == 200);
  }

  public void testGetStargateVersionPB() throws IOException {
    Response response = client.get("/version", MIMETYPE_PROTOBUF);
    assertTrue(response.getCode() == 200);
    VersionModel model = new VersionModel();
    model.getObjectFromMessage(response.getBody());
    validate(model);
    LOG.info("success retrieving Stargate version as protobuf");
  }
View Full Code Here

    validate(model);
    LOG.info("success retrieving Stargate version as protobuf");
  }

  public void testGetStorageClusterVersionText() throws IOException {
    Response response = client.get("/version/cluster", MIMETYPE_PLAIN);
    assertTrue(response.getCode() == 200);
  }
View Full Code Here

    assertTrue(response.getCode() == 200);
  }

  public void testGetStorageClusterVersionXML() throws IOException,
      JAXBException {
    Response response = client.get("/version/cluster", MIMETYPE_XML);
    assertTrue(response.getCode() == 200);
    StorageClusterVersionModel clusterVersionModel =
      (StorageClusterVersionModel)
        context.createUnmarshaller().unmarshal(
          new ByteArrayInputStream(response.getBody()));
    assertNotNull(clusterVersionModel);
    assertNotNull(clusterVersionModel.getVersion());
    LOG.info("success retrieving storage cluster version as XML");
  }
View Full Code Here

    assertNotNull(clusterVersionModel.getVersion());
    LOG.info("success retrieving storage cluster version as XML");
  }

  public void testGetStorageClusterVersionJSON() throws IOException {
    Response response = client.get("/version/cluster", MIMETYPE_JSON);
    assertTrue(response.getCode() == 200);
  }
View Full Code Here

TOP

Related Classes of org.apache.hadoop.hbase.stargate.client.Response

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.