Java 类org.apache.hadoop.hbase.rest.model.TestTableSchemaModel 实例源码

项目:ditb    文件:TestSchemaResource.java   
@BeforeClass
public static void setUpBeforeClass() throws Exception {
  conf = TEST_UTIL.getConfiguration();
  TEST_UTIL.startMiniCluster();
  REST_TEST_UTIL.startServletContainer(conf);
  client = new Client(new Cluster().add("localhost",
    REST_TEST_UTIL.getServletPort()));
  testTableSchemaModel = new TestTableSchemaModel();
  context = JAXBContext.newInstance(
    ColumnSchemaModel.class,
    TableSchemaModel.class);
}
项目:LCIndex-HBase-0.94.16    文件:TestSchemaResource.java   
@Test
public void testTableCreateAndDeleteXML() throws IOException, JAXBException {
  String schemaPath = "/" + TABLE1 + "/schema";
  TableSchemaModel model;
  Response response;

  HBaseAdmin admin = TEST_UTIL.getHBaseAdmin();
  assertFalse(admin.tableExists(TABLE1));

  // create the table
  model = TestTableSchemaModel.buildTestModel(TABLE1);
  TestTableSchemaModel.checkModel(model, TABLE1);
  response = client.put(schemaPath, Constants.MIMETYPE_XML, toXML(model));
  assertEquals(response.getCode(), 201);

  // recall the same put operation but in read-only mode
  conf.set("hbase.rest.readonly", "true");
  response = client.put(schemaPath, Constants.MIMETYPE_XML, toXML(model));
  assertEquals(response.getCode(), 403);

  // retrieve the schema and validate it
  response = client.get(schemaPath, Constants.MIMETYPE_XML);
  assertEquals(response.getCode(), 200);
  assertEquals(Constants.MIMETYPE_XML, response.getHeader("content-type"));
  model = fromXML(response.getBody());
  TestTableSchemaModel.checkModel(model, TABLE1);

  // test delete schema operation is forbidden in read-only mode
  response = client.delete(schemaPath);
  assertEquals(response.getCode(), 403);

  // return read-only setting back to default
  conf.set("hbase.rest.readonly", "false");

  // delete the table and make sure HBase concurs
  response = client.delete(schemaPath);
  assertEquals(response.getCode(), 200);
  assertFalse(admin.tableExists(TABLE1));
}
项目:HIndex    文件:TestSchemaResource.java   
@BeforeClass
public static void setUpBeforeClass() throws Exception {
  conf = TEST_UTIL.getConfiguration();
  TEST_UTIL.startMiniCluster();
  REST_TEST_UTIL.startServletContainer(conf);
  client = new Client(new Cluster().add("localhost",
    REST_TEST_UTIL.getServletPort()));
  testTableSchemaModel = new TestTableSchemaModel();
  context = JAXBContext.newInstance(
    ColumnSchemaModel.class,
    TableSchemaModel.class);
}
项目:IRIndex    文件:TestSchemaResource.java   
@Test
public void testTableCreateAndDeleteXML() throws IOException, JAXBException {
  String schemaPath = "/" + TABLE1 + "/schema";
  TableSchemaModel model;
  Response response;

  HBaseAdmin admin = TEST_UTIL.getHBaseAdmin();
  assertFalse(admin.tableExists(TABLE1));

  // create the table
  model = TestTableSchemaModel.buildTestModel(TABLE1);
  TestTableSchemaModel.checkModel(model, TABLE1);
  response = client.put(schemaPath, Constants.MIMETYPE_XML, toXML(model));
  assertEquals(response.getCode(), 201);

  // recall the same put operation but in read-only mode
  conf.set("hbase.rest.readonly", "true");
  response = client.put(schemaPath, Constants.MIMETYPE_XML, toXML(model));
  assertEquals(response.getCode(), 403);

  // retrieve the schema and validate it
  response = client.get(schemaPath, Constants.MIMETYPE_XML);
  assertEquals(response.getCode(), 200);
  assertEquals(Constants.MIMETYPE_XML, response.getHeader("content-type"));
  model = fromXML(response.getBody());
  TestTableSchemaModel.checkModel(model, TABLE1);

  // test delete schema operation is forbidden in read-only mode
  response = client.delete(schemaPath);
  assertEquals(response.getCode(), 403);

  // return read-only setting back to default
  conf.set("hbase.rest.readonly", "false");

  // delete the table and make sure HBase concurs
  response = client.delete(schemaPath);
  assertEquals(response.getCode(), 200);
  assertFalse(admin.tableExists(TABLE1));
}
项目:hbase    文件:TestSchemaResource.java   
@BeforeClass
public static void setUpBeforeClass() throws Exception {
  conf = TEST_UTIL.getConfiguration();
  conf.setBoolean(RESTServer.REST_CSRF_ENABLED_KEY, csrfEnabled);
  extraHdr = new BasicHeader(RESTServer.REST_CSRF_CUSTOM_HEADER_DEFAULT, "");
  TEST_UTIL.startMiniCluster();
  REST_TEST_UTIL.startServletContainer(conf);
  client = new Client(new Cluster().add("localhost",
    REST_TEST_UTIL.getServletPort()));
  testTableSchemaModel = new TestTableSchemaModel();
  context = JAXBContext.newInstance(
    ColumnSchemaModel.class,
    TableSchemaModel.class);
}
项目:PyroDB    文件:TestSchemaResource.java   
@BeforeClass
public static void setUpBeforeClass() throws Exception {
  conf = TEST_UTIL.getConfiguration();
  TEST_UTIL.startMiniCluster();
  REST_TEST_UTIL.startServletContainer(conf);
  client = new Client(new Cluster().add("localhost",
    REST_TEST_UTIL.getServletPort()));
  testTableSchemaModel = new TestTableSchemaModel();
  context = JAXBContext.newInstance(
    ColumnSchemaModel.class,
    TableSchemaModel.class);
}
项目:c5    文件:TestSchemaResource.java   
@BeforeClass
public static void setUpBeforeClass() throws Exception {
  conf = TEST_UTIL.getConfiguration();
  TEST_UTIL.startMiniCluster();
  REST_TEST_UTIL.startServletContainer(conf);
  client = new Client(new Cluster().add("localhost",
    REST_TEST_UTIL.getServletPort()));
  testTableSchemaModel = new TestTableSchemaModel();
  context = JAXBContext.newInstance(
    ColumnSchemaModel.class,
    TableSchemaModel.class);
}
项目:HBase-Research    文件:TestSchemaResource.java   
@Test
public void testTableCreateAndDeleteXML() throws IOException, JAXBException {
  String schemaPath = "/" + TABLE1 + "/schema";
  TableSchemaModel model;
  Response response;

  HBaseAdmin admin = TEST_UTIL.getHBaseAdmin();
  assertFalse(admin.tableExists(TABLE1));

  // create the table
  model = TestTableSchemaModel.buildTestModel(TABLE1);
  TestTableSchemaModel.checkModel(model, TABLE1);
  response = client.put(schemaPath, Constants.MIMETYPE_XML, toXML(model));
  assertEquals(response.getCode(), 201);

  // recall the same put operation but in read-only mode
  conf.set("hbase.rest.readonly", "true");
  response = client.put(schemaPath, Constants.MIMETYPE_XML, toXML(model));
  assertEquals(response.getCode(), 403);

  // retrieve the schema and validate it
  response = client.get(schemaPath, Constants.MIMETYPE_XML);
  assertEquals(response.getCode(), 200);
  assertEquals(Constants.MIMETYPE_XML, response.getHeader("content-type"));
  model = fromXML(response.getBody());
  TestTableSchemaModel.checkModel(model, TABLE1);

  // delete the table
  client.delete(schemaPath);

  // make sure HBase concurs
  assertFalse(admin.tableExists(TABLE1));

  // return read-only setting back to default
  conf.set("hbase.rest.readonly", "false");
}
项目:hbase-0.94.8-qod    文件:TestSchemaResource.java   
@Test
public void testTableCreateAndDeleteXML() throws IOException, JAXBException {
  String schemaPath = "/" + TABLE1 + "/schema";
  TableSchemaModel model;
  Response response;

  HBaseAdmin admin = TEST_UTIL.getHBaseAdmin();
  assertFalse(admin.tableExists(TABLE1));

  // create the table
  model = TestTableSchemaModel.buildTestModel(TABLE1);
  TestTableSchemaModel.checkModel(model, TABLE1);
  response = client.put(schemaPath, Constants.MIMETYPE_XML, toXML(model));
  assertEquals(response.getCode(), 201);

  // recall the same put operation but in read-only mode
  conf.set("hbase.rest.readonly", "true");
  response = client.put(schemaPath, Constants.MIMETYPE_XML, toXML(model));
  assertEquals(response.getCode(), 403);

  // retrieve the schema and validate it
  response = client.get(schemaPath, Constants.MIMETYPE_XML);
  assertEquals(response.getCode(), 200);
  assertEquals(Constants.MIMETYPE_XML, response.getHeader("content-type"));
  model = fromXML(response.getBody());
  TestTableSchemaModel.checkModel(model, TABLE1);

  // delete the table
  client.delete(schemaPath);

  // make sure HBase concurs
  assertFalse(admin.tableExists(TABLE1));

  // return read-only setting back to default
  conf.set("hbase.rest.readonly", "false");
}
项目:hbase-0.94.8-qod    文件:TestSchemaResource.java   
@Test
public void testTableCreateAndDeleteXML() throws IOException, JAXBException {
  String schemaPath = "/" + TABLE1 + "/schema";
  TableSchemaModel model;
  Response response;

  HBaseAdmin admin = TEST_UTIL.getHBaseAdmin();
  assertFalse(admin.tableExists(TABLE1));

  // create the table
  model = TestTableSchemaModel.buildTestModel(TABLE1);
  TestTableSchemaModel.checkModel(model, TABLE1);
  response = client.put(schemaPath, Constants.MIMETYPE_XML, toXML(model));
  assertEquals(response.getCode(), 201);

  // recall the same put operation but in read-only mode
  conf.set("hbase.rest.readonly", "true");
  response = client.put(schemaPath, Constants.MIMETYPE_XML, toXML(model));
  assertEquals(response.getCode(), 403);

  // retrieve the schema and validate it
  response = client.get(schemaPath, Constants.MIMETYPE_XML);
  assertEquals(response.getCode(), 200);
  assertEquals(Constants.MIMETYPE_XML, response.getHeader("content-type"));
  model = fromXML(response.getBody());
  TestTableSchemaModel.checkModel(model, TABLE1);

  // delete the table
  client.delete(schemaPath);

  // make sure HBase concurs
  assertFalse(admin.tableExists(TABLE1));

  // return read-only setting back to default
  conf.set("hbase.rest.readonly", "false");
}
项目:DominoHBase    文件:TestSchemaResource.java   
@Test
public void testTableCreateAndDeleteXML() throws IOException, JAXBException {
  String schemaPath = "/" + TABLE1 + "/schema";
  TableSchemaModel model;
  Response response;

  HBaseAdmin admin = TEST_UTIL.getHBaseAdmin();
  assertFalse(admin.tableExists(TABLE1));

  // create the table
  model = TestTableSchemaModel.buildTestModel(TABLE1);
  TestTableSchemaModel.checkModel(model, TABLE1);
  response = client.put(schemaPath, Constants.MIMETYPE_XML, toXML(model));
  assertEquals(response.getCode(), 201);

  // recall the same put operation but in read-only mode
  conf.set("hbase.rest.readonly", "true");
  response = client.put(schemaPath, Constants.MIMETYPE_XML, toXML(model));
  assertEquals(response.getCode(), 403);

  // retrieve the schema and validate it
  response = client.get(schemaPath, Constants.MIMETYPE_XML);
  assertEquals(response.getCode(), 200);
  assertEquals(Constants.MIMETYPE_XML, response.getHeader("content-type"));
  model = fromXML(response.getBody());
  TestTableSchemaModel.checkModel(model, TABLE1);

  // delete the table
  client.delete(schemaPath);

  // make sure HBase concurs
  assertFalse(admin.tableExists(TABLE1));

  // return read-only setting back to default
  conf.set("hbase.rest.readonly", "false");
}
项目:hindex    文件:TestSchemaResource.java   
@Test
public void testTableCreateAndDeleteXML() throws IOException, JAXBException {
  String schemaPath = "/" + TABLE1 + "/schema";
  TableSchemaModel model;
  Response response;

  HBaseAdmin admin = TEST_UTIL.getHBaseAdmin();
  assertFalse(admin.tableExists(TABLE1));

  // create the table
  model = TestTableSchemaModel.buildTestModel(TABLE1);
  TestTableSchemaModel.checkModel(model, TABLE1);
  response = client.put(schemaPath, Constants.MIMETYPE_XML, toXML(model));
  assertEquals(response.getCode(), 201);

  // recall the same put operation but in read-only mode
  conf.set("hbase.rest.readonly", "true");
  response = client.put(schemaPath, Constants.MIMETYPE_XML, toXML(model));
  assertEquals(response.getCode(), 403);

  // retrieve the schema and validate it
  response = client.get(schemaPath, Constants.MIMETYPE_XML);
  assertEquals(response.getCode(), 200);
  assertEquals(Constants.MIMETYPE_XML, response.getHeader("content-type"));
  model = fromXML(response.getBody());
  TestTableSchemaModel.checkModel(model, TABLE1);

  // delete the table
  client.delete(schemaPath);

  // make sure HBase concurs
  assertFalse(admin.tableExists(TABLE1));

  // return read-only setting back to default
  conf.set("hbase.rest.readonly", "false");
}