Repository: hbase
Updated Branches:
  refs/heads/branch-1 608bb9e30 -> 052a6f070


http://git-wip-us.apache.org/repos/asf/hbase/blob/052a6f07/hbase-server/src/test/java/org/apache/hadoop/hbase/rest/model/TestScannerModel.java
----------------------------------------------------------------------
diff --git 
a/hbase-server/src/test/java/org/apache/hadoop/hbase/rest/model/TestScannerModel.java
 
b/hbase-server/src/test/java/org/apache/hadoop/hbase/rest/model/TestScannerModel.java
deleted file mode 100644
index 988872e..0000000
--- 
a/hbase-server/src/test/java/org/apache/hadoop/hbase/rest/model/TestScannerModel.java
+++ /dev/null
@@ -1,109 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.hadoop.hbase.rest.model;
-
-import org.apache.hadoop.hbase.SmallTests;
-import org.apache.hadoop.hbase.util.Bytes;
-import org.junit.experimental.categories.Category;
-
-@Category(SmallTests.class)
-public class TestScannerModel extends TestModelBase<ScannerModel> {
-  private static final String PRIVATE = "private";
-  private static final String PUBLIC = "public";
-  private static final byte[] START_ROW = Bytes.toBytes("abracadabra");
-  private static final byte[] END_ROW = Bytes.toBytes("zzyzx");
-  private static final byte[] COLUMN1 = Bytes.toBytes("column1");
-  private static final byte[] COLUMN2 = Bytes.toBytes("column2:foo");
-  private static final long START_TIME = 1245219839331L;
-  private static final long END_TIME = 1245393318192L;
-  private static final int CACHING = 1000;
-  private static final int BATCH = 100;
-  private static final boolean CACHE_BLOCKS = false;
-
-  public TestScannerModel() throws Exception {
-    super(ScannerModel.class);
-    AS_XML = "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>"
-        + "<Scanner batch=\"100\" cacheBlocks=\"false\" caching=\"1000\" 
endRow=\"enp5eng=\" "
-        + "endTime=\"1245393318192\" maxVersions=\"2147483647\" 
startRow=\"YWJyYWNhZGFicmE=\" "
-        + "startTime=\"1245219839331\">"
-        + "<column>Y29sdW1uMQ==</column><column>Y29sdW1uMjpmb28=</column>"
-        + "<labels>private</labels><labels>public</labels>"
-        + "</Scanner>";
-
-    AS_JSON = 
"{\"batch\":100,\"caching\":1000,\"cacheBlocks\":false,\"endRow\":\"enp5eng=\","
-        + 
"\"endTime\":1245393318192,\"maxVersions\":2147483647,\"startRow\":\"YWJyYWNhZGFicmE=\","
-        + 
"\"startTime\":1245219839331,\"column\":[\"Y29sdW1uMQ==\",\"Y29sdW1uMjpmb28=\"],"
-        +"\"labels\":[\"private\",\"public\"]"
-        +"}";
-
-    AS_PB = 
"CgthYnJhY2FkYWJyYRIFenp5engaB2NvbHVtbjEaC2NvbHVtbjI6Zm9vIGQo47qL554kMLDi57mf"
-        + "JDj/////B0joB1IHcHJpdmF0ZVIGcHVibGljWAA=";
-  }
-
-  protected ScannerModel buildTestModel() {
-    ScannerModel model = new ScannerModel();
-    model.setStartRow(START_ROW);
-    model.setEndRow(END_ROW);
-    model.addColumn(COLUMN1);
-    model.addColumn(COLUMN2);
-    model.setStartTime(START_TIME);
-    model.setEndTime(END_TIME);
-    model.setBatch(BATCH);
-    model.setCaching(CACHING);
-    model.addLabel(PRIVATE);
-    model.addLabel(PUBLIC);
-    model.setCacheBlocks(CACHE_BLOCKS);
-    return model;
-  }
-
-  protected void checkModel(ScannerModel model) {
-    assertTrue(Bytes.equals(model.getStartRow(), START_ROW));
-    assertTrue(Bytes.equals(model.getEndRow(), END_ROW));
-    boolean foundCol1 = false, foundCol2 = false;
-    for (byte[] column : model.getColumns()) {
-      if (Bytes.equals(column, COLUMN1)) {
-        foundCol1 = true;
-      } else if (Bytes.equals(column, COLUMN2)) {
-        foundCol2 = true;
-      }
-    }
-    assertTrue(foundCol1);
-    assertTrue(foundCol2);
-    assertEquals(model.getStartTime(), START_TIME);
-    assertEquals(model.getEndTime(), END_TIME);
-    assertEquals(model.getBatch(), BATCH);
-    assertEquals(model.getCaching(), CACHING);
-    assertEquals(model.getCacheBlocks(), CACHE_BLOCKS);
-    boolean foundLabel1 = false;
-    boolean foundLabel2 = false;
-    if (model.getLabels() != null && model.getLabels().size() > 0) {
-      for (String label : model.getLabels()) {
-        if (label.equals(PRIVATE)) {
-          foundLabel1 = true;
-        } else if (label.equals(PUBLIC)) {
-          foundLabel2 = true;
-        }
-      }
-      assertTrue(foundLabel1);
-      assertTrue(foundLabel2);
-    }
-  }
-
-}

http://git-wip-us.apache.org/repos/asf/hbase/blob/052a6f07/hbase-server/src/test/java/org/apache/hadoop/hbase/rest/model/TestStorageClusterStatusModel.java
----------------------------------------------------------------------
diff --git 
a/hbase-server/src/test/java/org/apache/hadoop/hbase/rest/model/TestStorageClusterStatusModel.java
 
b/hbase-server/src/test/java/org/apache/hadoop/hbase/rest/model/TestStorageClusterStatusModel.java
deleted file mode 100644
index 0f852ca..0000000
--- 
a/hbase-server/src/test/java/org/apache/hadoop/hbase/rest/model/TestStorageClusterStatusModel.java
+++ /dev/null
@@ -1,145 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.hadoop.hbase.rest.model;
-
-import java.util.Iterator;
-
-import org.apache.hadoop.hbase.SmallTests;
-import org.apache.hadoop.hbase.TableName;
-import org.apache.hadoop.hbase.util.Base64;
-import org.apache.hadoop.hbase.util.Bytes;
-
-import org.junit.experimental.categories.Category;
-
-@Category(SmallTests.class)
-public class TestStorageClusterStatusModel extends 
TestModelBase<StorageClusterStatusModel> {
-
-  public TestStorageClusterStatusModel() throws Exception {
-    super(StorageClusterStatusModel.class);
-
-    AS_XML =
-      "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>" +
-      "<ClusterStatus averageLoad=\"1.0\" regions=\"2\" requests=\"0\">" +
-      "<DeadNodes/><LiveNodes>" +
-      "<Node heapSizeMB=\"128\" maxHeapSizeMB=\"1024\" name=\"test1\" 
requests=\"0\" startCode=\"1245219839331\">" +
-      "<Region currentCompactedKVs=\"1\" memstoreSizeMB=\"0\" 
name=\"aGJhc2U6cm9vdCwsMA==\" readRequestsCount=\"1\" " +
-      "rootIndexSizeKB=\"1\" storefileIndexSizeMB=\"0\" storefileSizeMB=\"0\" 
storefiles=\"1\" stores=\"1\" " +
-      "totalCompactingKVs=\"1\" totalStaticBloomSizeKB=\"1\" 
totalStaticIndexSizeKB=\"1\" writeRequestsCount=\"2\"/>" +
-      "</Node>" +
-      "<Node heapSizeMB=\"512\" maxHeapSizeMB=\"1024\" name=\"test2\" 
requests=\"0\" startCode=\"1245239331198\">" +
-      "<Region currentCompactedKVs=\"1\" memstoreSizeMB=\"0\" 
name=\"aGJhc2U6bWV0YSwsMTI0NjAwMDA0MzcyNA==\" " +
-      "readRequestsCount=\"1\" rootIndexSizeKB=\"1\" 
storefileIndexSizeMB=\"0\" storefileSizeMB=\"0\" " +
-      "storefiles=\"1\" stores=\"1\" totalCompactingKVs=\"1\" 
totalStaticBloomSizeKB=\"1\" " +
-      "totalStaticIndexSizeKB=\"1\" 
writeRequestsCount=\"2\"/></Node></LiveNodes></ClusterStatus>";
-
-    AS_PB =
-      
"Cj8KBXRlc3QxEOO6i+eeJBgAIIABKIAIMicKDWhiYXNlOnJvb3QsLDAQARgBIAAoADAAOAFAAkgB" +
-      
"UAFYAWABaAEKSwoFdGVzdDIQ/pKx8J4kGAAggAQogAgyMwoZaGJhc2U6bWV0YSwsMTI0NjAwMDA0" +
-      "MzcyNBABGAEgACgAMAA4AUACSAFQAVgBYAFoARgCIAApAAAAAAAA8D8=";
-
-
-    //Using jackson will break json backward compatibilty for this 
representation
-    //but the original one was broken as it would only print one Node element
-    //so the format itself was broken
-    AS_JSON =
-      
"{\"regions\":2,\"requests\":0,\"averageLoad\":1.0,\"LiveNodes\":[{\"name\":\"test1\","
 +
-          
"\"Region\":[{\"name\":\"aGJhc2U6cm9vdCwsMA==\",\"stores\":1,\"storefiles\":1," 
+
-          
"\"storefileSizeMB\":0,\"memstoreSizeMB\":0,\"storefileIndexSizeMB\":0," +
-          
"\"readRequestsCount\":1,\"writeRequestsCount\":2,\"rootIndexSizeKB\":1," +
-          
"\"totalStaticIndexSizeKB\":1,\"totalStaticBloomSizeKB\":1,\"totalCompactingKVs\":1,"
 +
-          
"\"currentCompactedKVs\":1}],\"requests\":0,\"startCode\":1245219839331," +
-          "\"heapSizeMB\":128,\"maxHeapSizeMB\":1024},{\"name\":\"test2\"," +
-          
"\"Region\":[{\"name\":\"aGJhc2U6bWV0YSwsMTI0NjAwMDA0MzcyNA==\",\"stores\":1," +
-          
"\"storefiles\":1,\"storefileSizeMB\":0,\"memstoreSizeMB\":0,\"storefileIndexSizeMB\":0,"
 +
-          
"\"readRequestsCount\":1,\"writeRequestsCount\":2,\"rootIndexSizeKB\":1," +
-          
"\"totalStaticIndexSizeKB\":1,\"totalStaticBloomSizeKB\":1,\"totalCompactingKVs\":1,"
 +
-          
"\"currentCompactedKVs\":1}],\"requests\":0,\"startCode\":1245239331198," +
-          "\"heapSizeMB\":512,\"maxHeapSizeMB\":1024}],\"DeadNodes\":[]}";
-  }
-
-  protected StorageClusterStatusModel buildTestModel() {
-    StorageClusterStatusModel model = new StorageClusterStatusModel();
-    model.setRegions(2);
-    model.setRequests(0);
-    model.setAverageLoad(1.0);
-    model.addLiveNode("test1", 1245219839331L, 128, 1024)
-      .addRegion(Bytes.toBytes("hbase:root,,0"), 1, 1, 0, 0, 0, 1, 2, 1, 1, 1, 
1, 1);
-    model.addLiveNode("test2", 1245239331198L, 512, 1024)
-      .addRegion(Bytes.toBytes(TableName.META_TABLE_NAME+",,1246000043724"),1, 
1, 0, 0, 0,
-          1, 2, 1, 1, 1, 1, 1);
-    return model;
-  }
-
-  protected void checkModel(StorageClusterStatusModel model) {
-    assertEquals(model.getRegions(), 2);
-    assertEquals(model.getRequests(), 0);
-    assertEquals(model.getAverageLoad(), 1.0);
-    Iterator<StorageClusterStatusModel.Node> nodes =
-      model.getLiveNodes().iterator();
-    StorageClusterStatusModel.Node node = nodes.next();
-    assertEquals(node.getName(), "test1");
-    assertEquals(node.getStartCode(), 1245219839331L);
-    assertEquals(node.getHeapSizeMB(), 128);
-    assertEquals(node.getMaxHeapSizeMB(), 1024);
-    Iterator<StorageClusterStatusModel.Node.Region> regions = 
-      node.getRegions().iterator();
-    StorageClusterStatusModel.Node.Region region = regions.next();
-    assertTrue(Bytes.toString(region.getName()).equals(
-        "hbase:root,,0"));
-    assertEquals(region.getStores(), 1);
-    assertEquals(region.getStorefiles(), 1);
-    assertEquals(region.getStorefileSizeMB(), 0);
-    assertEquals(region.getMemstoreSizeMB(), 0);
-    assertEquals(region.getStorefileIndexSizeMB(), 0);
-    assertEquals(region.getReadRequestsCount(), 1);
-    assertEquals(region.getWriteRequestsCount(), 2);
-    assertEquals(region.getRootIndexSizeKB(), 1);
-    assertEquals(region.getTotalStaticIndexSizeKB(), 1);
-    assertEquals(region.getTotalStaticBloomSizeKB(), 1);
-    assertEquals(region.getTotalCompactingKVs(), 1);
-    assertEquals(region.getCurrentCompactedKVs(), 1);
-    assertFalse(regions.hasNext());
-    node = nodes.next();
-    assertEquals(node.getName(), "test2");
-    assertEquals(node.getStartCode(), 1245239331198L);
-    assertEquals(node.getHeapSizeMB(), 512);
-    assertEquals(node.getMaxHeapSizeMB(), 1024);
-    regions = node.getRegions().iterator();
-    region = regions.next();
-    assertEquals(Bytes.toString(region.getName()),
-        TableName.META_TABLE_NAME+",,1246000043724");
-    assertEquals(region.getStores(), 1);
-    assertEquals(region.getStorefiles(), 1);
-    assertEquals(region.getStorefileSizeMB(), 0);
-    assertEquals(region.getMemstoreSizeMB(), 0);
-    assertEquals(region.getStorefileIndexSizeMB(), 0);
-    assertEquals(region.getReadRequestsCount(), 1);
-    assertEquals(region.getWriteRequestsCount(), 2);
-    assertEquals(region.getRootIndexSizeKB(), 1);
-    assertEquals(region.getTotalStaticIndexSizeKB(), 1);
-    assertEquals(region.getTotalStaticBloomSizeKB(), 1);
-    assertEquals(region.getTotalCompactingKVs(), 1);
-    assertEquals(region.getCurrentCompactedKVs(), 1);
-    
-    assertFalse(regions.hasNext());
-    assertFalse(nodes.hasNext());
-  }
-}
-

http://git-wip-us.apache.org/repos/asf/hbase/blob/052a6f07/hbase-server/src/test/java/org/apache/hadoop/hbase/rest/model/TestStorageClusterVersionModel.java
----------------------------------------------------------------------
diff --git 
a/hbase-server/src/test/java/org/apache/hadoop/hbase/rest/model/TestStorageClusterVersionModel.java
 
b/hbase-server/src/test/java/org/apache/hadoop/hbase/rest/model/TestStorageClusterVersionModel.java
deleted file mode 100644
index bd4fa1f..0000000
--- 
a/hbase-server/src/test/java/org/apache/hadoop/hbase/rest/model/TestStorageClusterVersionModel.java
+++ /dev/null
@@ -1,60 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.hadoop.hbase.rest.model;
-
-import java.io.StringReader;
-import java.io.StringWriter;
-
-import javax.xml.bind.JAXBContext;
-import javax.xml.bind.JAXBException;
-
-import junit.framework.TestCase;
-import org.apache.hadoop.hbase.SmallTests;
-import org.junit.experimental.categories.Category;
-
-@Category(SmallTests.class)
-public class TestStorageClusterVersionModel extends 
TestModelBase<StorageClusterVersionModel> {
-  private static final String VERSION = "0.0.1-testing";
-
-  public TestStorageClusterVersionModel() throws Exception {
-    super(StorageClusterVersionModel.class);
-    AS_XML =
-      "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>"+
-      "<ClusterVersion>" + VERSION + "</ClusterVersion>";
-
-    AS_JSON = "\"0.0.1-testing\"";
-  }
-
-  protected StorageClusterVersionModel buildTestModel() {
-    StorageClusterVersionModel model = new StorageClusterVersionModel();
-    model.setVersion(VERSION);
-    return model;
-  }
-
-  protected void checkModel(StorageClusterVersionModel model) {
-    assertEquals(model.getVersion(), VERSION);
-  }
-
-  @Override
-  public void testFromPB() throws Exception {
-    //ignore test no pb
-  }
-}
-

http://git-wip-us.apache.org/repos/asf/hbase/blob/052a6f07/hbase-server/src/test/java/org/apache/hadoop/hbase/rest/model/TestTableInfoModel.java
----------------------------------------------------------------------
diff --git 
a/hbase-server/src/test/java/org/apache/hadoop/hbase/rest/model/TestTableInfoModel.java
 
b/hbase-server/src/test/java/org/apache/hadoop/hbase/rest/model/TestTableInfoModel.java
deleted file mode 100644
index dadb9ad..0000000
--- 
a/hbase-server/src/test/java/org/apache/hadoop/hbase/rest/model/TestTableInfoModel.java
+++ /dev/null
@@ -1,96 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.hadoop.hbase.rest.model;
-
-import java.io.IOException;
-import java.io.StringReader;
-import java.io.StringWriter;
-import java.util.Iterator;
-
-import javax.xml.bind.JAXBContext;
-import javax.xml.bind.JAXBException;
-
-import org.apache.hadoop.hbase.SmallTests;
-import org.apache.hadoop.hbase.util.Base64;
-import org.apache.hadoop.hbase.util.Bytes;
-
-import junit.framework.TestCase;
-import org.junit.experimental.categories.Category;
-
-@Category(SmallTests.class)
-public class TestTableInfoModel extends TestModelBase<TableInfoModel> {
-  private static final String TABLE = "testtable";
-  private static final byte[] START_KEY = Bytes.toBytes("abracadbra");
-  private static final byte[] END_KEY = Bytes.toBytes("zzyzx");
-  private static final long ID = 8731042424L;
-  private static final String LOCATION = "testhost:9876";
-
-  public TestTableInfoModel() throws Exception {
-    super(TableInfoModel.class);
-    AS_XML =
-      "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><TableInfo 
" +
-      "name=\"testtable\"><Region endKey=\"enp5eng=\" id=\"8731042424\" " +
-      "location=\"testhost:9876\" " +
-      
"name=\"testtable,abracadbra,8731042424.ad9860f031282c46ed431d7af8f94aca.\" " +
-      "startKey=\"YWJyYWNhZGJyYQ==\"/></TableInfo>";
-
-    AS_PB =
-      
"Cgl0ZXN0dGFibGUSSQofdGVzdHRhYmxlLGFicmFjYWRicmEsODczMTA0MjQyNBIKYWJyYWNhZGJy" +
-      "YRoFenp5engg+MSkwyAqDXRlc3Rob3N0Ojk4NzY=";
-
-    AS_JSON =
-      
"{\"name\":\"testtable\",\"Region\":[{\"endKey\":\"enp5eng=\",\"id\":8731042424,"
 +
-      "\"location\":\"testhost:9876\",\"" +
-      
"name\":\"testtable,abracadbra,8731042424.ad9860f031282c46ed431d7af8f94aca.\",\""
 +
-      "startKey\":\"YWJyYWNhZGJyYQ==\"}]}";
-  }
-
-  protected TableInfoModel buildTestModel() {
-    TableInfoModel model = new TableInfoModel();
-    model.setName(TABLE);
-    model.add(new TableRegionModel(TABLE, ID, START_KEY, END_KEY, LOCATION));
-    return model;
-  }
-
-  protected void checkModel(TableInfoModel model) {
-    assertEquals(model.getName(), TABLE);
-    Iterator<TableRegionModel> regions = model.getRegions().iterator();
-    TableRegionModel region = regions.next();
-    assertTrue(Bytes.equals(region.getStartKey(), START_KEY));
-    assertTrue(Bytes.equals(region.getEndKey(), END_KEY));
-    assertEquals(region.getId(), ID);
-    assertEquals(region.getLocation(), LOCATION);
-    assertFalse(regions.hasNext());
-  }
-
-  public void testBuildModel() throws Exception {
-    checkModel(buildTestModel());
-  }
-
-  public void testFromXML() throws Exception {
-    checkModel(fromXML(AS_XML));
-  }
-
-  public void testFromPB() throws Exception {
-    checkModel(fromPB(AS_PB));
-  }
-
-}
-

http://git-wip-us.apache.org/repos/asf/hbase/blob/052a6f07/hbase-server/src/test/java/org/apache/hadoop/hbase/rest/model/TestTableListModel.java
----------------------------------------------------------------------
diff --git 
a/hbase-server/src/test/java/org/apache/hadoop/hbase/rest/model/TestTableListModel.java
 
b/hbase-server/src/test/java/org/apache/hadoop/hbase/rest/model/TestTableListModel.java
deleted file mode 100644
index 4cb9194..0000000
--- 
a/hbase-server/src/test/java/org/apache/hadoop/hbase/rest/model/TestTableListModel.java
+++ /dev/null
@@ -1,73 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.hadoop.hbase.rest.model;
-
-import java.io.IOException;
-import java.io.StringReader;
-import java.io.StringWriter;
-import java.util.Iterator;
-
-import javax.xml.bind.JAXBContext;
-import javax.xml.bind.JAXBException;
-
-import org.apache.hadoop.hbase.SmallTests;
-import org.apache.hadoop.hbase.util.Base64;
-
-import junit.framework.TestCase;
-import org.junit.experimental.categories.Category;
-
-@Category(SmallTests.class)
-public class TestTableListModel extends TestModelBase<TableListModel> {
-  private static final String TABLE1 = "table1";
-  private static final String TABLE2 = "table2";
-  private static final String TABLE3 = "table3";
-
-  public TestTableListModel() throws Exception {
-    super(TableListModel.class);
-    AS_XML =
-      "<?xml version=\"1.0\" encoding=\"UTF-8\" 
standalone=\"yes\"?><TableList><table " +
-          "name=\"table1\"/><table name=\"table2\"/><table 
name=\"table3\"/></TableList>";
-
-    AS_PB = "CgZ0YWJsZTEKBnRhYmxlMgoGdGFibGUz";
-
-    AS_JSON =
-      
"{\"table\":[{\"name\":\"table1\"},{\"name\":\"table2\"},{\"name\":\"table3\"}]}";
-  }
-
-  protected TableListModel buildTestModel() {
-    TableListModel model = new TableListModel();
-    model.add(new TableModel(TABLE1));
-    model.add(new TableModel(TABLE2));
-    model.add(new TableModel(TABLE3));
-    return model;
-  }
-
-  protected void checkModel(TableListModel model) {
-    Iterator<TableModel> tables = model.getTables().iterator();
-    TableModel table = tables.next();
-    assertEquals(table.getName(), TABLE1);
-    table = tables.next();
-    assertEquals(table.getName(), TABLE2);
-    table = tables.next();
-    assertEquals(table.getName(), TABLE3);
-    assertFalse(tables.hasNext());
-  }
-}
-

http://git-wip-us.apache.org/repos/asf/hbase/blob/052a6f07/hbase-server/src/test/java/org/apache/hadoop/hbase/rest/model/TestTableRegionModel.java
----------------------------------------------------------------------
diff --git 
a/hbase-server/src/test/java/org/apache/hadoop/hbase/rest/model/TestTableRegionModel.java
 
b/hbase-server/src/test/java/org/apache/hadoop/hbase/rest/model/TestTableRegionModel.java
deleted file mode 100644
index 5c4b1a9..0000000
--- 
a/hbase-server/src/test/java/org/apache/hadoop/hbase/rest/model/TestTableRegionModel.java
+++ /dev/null
@@ -1,93 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.hadoop.hbase.rest.model;
-
-import java.io.StringReader;
-import java.io.StringWriter;
-
-import javax.xml.bind.JAXBContext;
-import javax.xml.bind.JAXBException;
-
-import org.apache.hadoop.hbase.*;
-import org.apache.hadoop.hbase.util.Bytes;
-
-import junit.framework.TestCase;
-import org.junit.experimental.categories.Category;
-
-@Category(SmallTests.class)
-public class TestTableRegionModel extends TestModelBase<TableRegionModel> {
-  private static final String TABLE = "testtable";
-  private static final byte[] START_KEY = Bytes.toBytes("abracadbra");
-  private static final byte[] END_KEY = Bytes.toBytes("zzyzx");
-  private static final long ID = 8731042424L;
-  private static final String LOCATION = "testhost:9876";
-
-  public TestTableRegionModel() throws Exception {
-    super(TableRegionModel.class);
-
-    AS_XML =
-      "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><Region 
endKey=\"enp5eng=\" " +
-          "id=\"8731042424\" location=\"testhost:9876\" " +
-          
"name=\"testtable,abracadbra,8731042424.ad9860f031282c46ed431d7af8f94aca.\" " +
-          "startKey=\"YWJyYWNhZGJyYQ==\"/>";
-
-    AS_JSON =
-      
"{\"endKey\":\"enp5eng=\",\"id\":8731042424,\"location\":\"testhost:9876\"," +
-          
"\"name\":\"testtable,abracadbra,8731042424.ad9860f031282c46ed431d7af8f94aca.\",\""
 +
-          "startKey\":\"YWJyYWNhZGJyYQ==\"}";
-  }
-
-  protected TableRegionModel buildTestModel() {
-    TableRegionModel model =
-      new TableRegionModel(TABLE, ID, START_KEY, END_KEY, LOCATION);
-    return model;
-  }
-
-  protected void checkModel(TableRegionModel model) {
-    assertTrue(Bytes.equals(model.getStartKey(), START_KEY));
-    assertTrue(Bytes.equals(model.getEndKey(), END_KEY));
-    assertEquals(model.getId(), ID);
-    assertEquals(model.getLocation(), LOCATION);
-    assertEquals(model.getName(), 
-      TABLE + "," + Bytes.toString(START_KEY) + "," + Long.toString(ID) +
-      ".ad9860f031282c46ed431d7af8f94aca.");
-  }
-
-  public void testGetName() {
-    TableRegionModel model = buildTestModel();
-    String modelName = model.getName();
-    HRegionInfo hri = new HRegionInfo(TableName.valueOf(TABLE),
-      START_KEY, END_KEY, false, ID);
-    assertEquals(modelName, hri.getRegionNameAsString());
-  }
-
-  public void testSetName() {
-    TableRegionModel model = buildTestModel();
-    String name = model.getName();
-    model.setName(name);
-    assertEquals(name, model.getName());
-  }
-
-  @Override
-  public void testFromPB() throws Exception {
-    //no pb ignore
-  }
-}
-

http://git-wip-us.apache.org/repos/asf/hbase/blob/052a6f07/hbase-server/src/test/java/org/apache/hadoop/hbase/rest/model/TestTableSchemaModel.java
----------------------------------------------------------------------
diff --git 
a/hbase-server/src/test/java/org/apache/hadoop/hbase/rest/model/TestTableSchemaModel.java
 
b/hbase-server/src/test/java/org/apache/hadoop/hbase/rest/model/TestTableSchemaModel.java
deleted file mode 100644
index b725f7b..0000000
--- 
a/hbase-server/src/test/java/org/apache/hadoop/hbase/rest/model/TestTableSchemaModel.java
+++ /dev/null
@@ -1,117 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.hadoop.hbase.rest.model;
-
-import java.io.IOException;
-import java.io.StringReader;
-import java.io.StringWriter;
-import java.util.Iterator;
-
-import javax.xml.bind.JAXBContext;
-import javax.xml.bind.JAXBException;
-
-import org.apache.hadoop.hbase.SmallTests;
-import org.apache.hadoop.hbase.util.Base64;
-
-import org.apache.hadoop.hbase.rest.model.TableSchemaModel;
-
-import junit.framework.TestCase;
-import org.junit.experimental.categories.Category;
-
-@Category(SmallTests.class)
-public class TestTableSchemaModel extends TestModelBase<TableSchemaModel> {
-
-  public static final String TABLE_NAME = "testTable";
-  private static final boolean IS_META = false;
-  private static final boolean IS_ROOT = false;
-  private static final boolean READONLY = false;
-
-  TestColumnSchemaModel testColumnSchemaModel;
-
-  private JAXBContext context;
-
-  public TestTableSchemaModel() throws Exception {
-    super(TableSchemaModel.class);
-    testColumnSchemaModel = new TestColumnSchemaModel();
-
-    AS_XML =
-      "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?>" +
-      "<TableSchema name=\"testTable\" IS_META=\"false\" IS_ROOT=\"false\" 
READONLY=\"false\">" +
-      "<ColumnSchema name=\"testcolumn\" BLOCKSIZE=\"16384\" 
BLOOMFILTER=\"NONE\" " +
-      "BLOCKCACHE=\"true\" COMPRESSION=\"GZ\" VERSIONS=\"1\" TTL=\"86400\" 
IN_MEMORY=\"false\"/>" +
-      "</TableSchema>";
-
-    AS_PB =
-      
"Cgl0ZXN0VGFibGUSEAoHSVNfTUVUQRIFZmFsc2USEAoHSVNfUk9PVBIFZmFsc2USEQoIUkVBRE9O" +
-      
"TFkSBWZhbHNlGpcBCgp0ZXN0Y29sdW1uEhIKCUJMT0NLU0laRRIFMTYzODQSEwoLQkxPT01GSUxU" +
-      
"RVISBE5PTkUSEgoKQkxPQ0tDQUNIRRIEdHJ1ZRIRCgtDT01QUkVTU0lPThICR1oSDQoIVkVSU0lP" +
-      "TlMSATESDAoDVFRMEgU4NjQwMBISCglJTl9NRU1PUlkSBWZhbHNlGICjBSABKgJHWigA";
-
-    AS_JSON =
-      "{\"name\":\"testTable\",\"IS_META\":\"false\",\"IS_ROOT\":\"false\"," +
-      "\"READONLY\":\"false\",\"ColumnSchema\":[{\"name\":\"testcolumn\"," +
-      
"\"BLOCKSIZE\":\"16384\",\"BLOOMFILTER\":\"NONE\",\"BLOCKCACHE\":\"true\"," +
-      
"\"COMPRESSION\":\"GZ\",\"VERSIONS\":\"1\",\"TTL\":\"86400\",\"IN_MEMORY\":\"false\"}]}";
-  }
-
-  protected TableSchemaModel buildTestModel() {
-    return buildTestModel(TABLE_NAME);
-  }
-
-  public TableSchemaModel buildTestModel(String name) {
-    TableSchemaModel model = new TableSchemaModel();
-    model.setName(name);
-    model.__setIsMeta(IS_META);
-    model.__setIsRoot(IS_ROOT);
-    model.__setReadOnly(READONLY);
-    model.addColumnFamily(testColumnSchemaModel.buildTestModel());
-    return model;
-  }
-
-  protected void checkModel(TableSchemaModel model) {
-    checkModel(model, TABLE_NAME);
-  }
-
-  public void checkModel(TableSchemaModel model, String tableName) {
-    assertEquals(model.getName(), tableName);
-    assertEquals(model.__getIsMeta(), IS_META);
-    assertEquals(model.__getIsRoot(), IS_ROOT);
-    assertEquals(model.__getReadOnly(), READONLY);
-    Iterator<ColumnSchemaModel> families = model.getColumns().iterator();
-    assertTrue(families.hasNext());
-    ColumnSchemaModel family = families.next();
-    testColumnSchemaModel.checkModel(family);
-    assertFalse(families.hasNext());
-  }
-
-  public void testBuildModel() throws Exception {
-    checkModel(buildTestModel());
-  }
-
-  public void testFromXML() throws Exception {
-    checkModel(fromXML(AS_XML));
-  }
-
-  public void testFromPB() throws Exception {
-    checkModel(fromPB(AS_PB));
-  }
-
-}
-

http://git-wip-us.apache.org/repos/asf/hbase/blob/052a6f07/hbase-server/src/test/java/org/apache/hadoop/hbase/rest/model/TestVersionModel.java
----------------------------------------------------------------------
diff --git 
a/hbase-server/src/test/java/org/apache/hadoop/hbase/rest/model/TestVersionModel.java
 
b/hbase-server/src/test/java/org/apache/hadoop/hbase/rest/model/TestVersionModel.java
deleted file mode 100644
index 553bb35..0000000
--- 
a/hbase-server/src/test/java/org/apache/hadoop/hbase/rest/model/TestVersionModel.java
+++ /dev/null
@@ -1,80 +0,0 @@
-/*
- *
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements.  See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership.  The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License.  You may obtain a copy of the License at
- *
- *     http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.hadoop.hbase.rest.model;
-
-import java.io.IOException;
-import java.io.StringReader;
-import java.io.StringWriter;
-
-import javax.xml.bind.JAXBContext;
-import javax.xml.bind.JAXBException;
-
-import org.apache.hadoop.hbase.SmallTests;
-import org.apache.hadoop.hbase.util.Base64;
-
-import junit.framework.TestCase;
-import org.junit.experimental.categories.Category;
-
-@Category(SmallTests.class)
-public class TestVersionModel extends TestModelBase<VersionModel> {
-  private static final String REST_VERSION = "0.0.1";
-  private static final String OS_VERSION = 
-    "Linux 2.6.18-128.1.6.el5.centos.plusxen amd64";
-  private static final String JVM_VERSION =
-    "Sun Microsystems Inc. 1.6.0_13-11.3-b02";
-  private static final String JETTY_VERSION = "6.1.14";
-  private static final String JERSEY_VERSION = "1.1.0-ea";
-  
-  public TestVersionModel() throws Exception {
-    super(VersionModel.class);
-    AS_XML =
-      "<?xml version=\"1.0\" encoding=\"UTF-8\" standalone=\"yes\"?><Version 
JVM=\"Sun " +
-          "Microsystems Inc. 1.6.0_13-11.3-b02\" Jersey=\"1.1.0-ea\" " +
-          "OS=\"Linux 2.6.18-128.1.6.el5.centos.plusxen amd64\" REST=\"0.0.1\" 
Server=\"6.1.14\"/>";
-
-    AS_PB =
-      
"CgUwLjAuMRInU3VuIE1pY3Jvc3lzdGVtcyBJbmMuIDEuNi4wXzEzLTExLjMtYjAyGi1MaW51eCAy" +
-      
"LjYuMTgtMTI4LjEuNi5lbDUuY2VudG9zLnBsdXN4ZW4gYW1kNjQiBjYuMS4xNCoIMS4xLjAtZWE=";
-
-    AS_JSON =
-      "{\"JVM\":\"Sun Microsystems Inc. 
1.6.0_13-11.3-b02\",\"Jersey\":\"1.1.0-ea\"," +
-          "\"OS\":\"Linux 2.6.18-128.1.6.el5.centos.plusxen amd64\",\"" +
-          "REST\":\"0.0.1\",\"Server\":\"6.1.14\"}";
-  }
-
-  protected VersionModel buildTestModel() {
-    VersionModel model = new VersionModel();
-    model.setRESTVersion(REST_VERSION);
-    model.setOSVersion(OS_VERSION);
-    model.setJVMVersion(JVM_VERSION);
-    model.setServerVersion(JETTY_VERSION);
-    model.setJerseyVersion(JERSEY_VERSION);
-    return model;
-  }
-
-  protected void checkModel(VersionModel model) {
-    assertEquals(model.getRESTVersion(), REST_VERSION);
-    assertEquals(model.getOSVersion(), OS_VERSION);
-    assertEquals(model.getJVMVersion(), JVM_VERSION);
-    assertEquals(model.getServerVersion(), JETTY_VERSION);
-    assertEquals(model.getJerseyVersion(), JERSEY_VERSION);
-  }
-}
-

http://git-wip-us.apache.org/repos/asf/hbase/blob/052a6f07/pom.xml
----------------------------------------------------------------------
diff --git a/pom.xml b/pom.xml
index 3e93afa..0f707dd 100644
--- a/pom.xml
+++ b/pom.xml
@@ -51,6 +51,7 @@
   <modules>
     <module>hbase-server</module>
     <module>hbase-thrift</module>
+    <module>hbase-rest</module>
     <module>hbase-shell</module>
     <module>hbase-protocol</module>
     <module>hbase-client</module>
@@ -1115,12 +1116,24 @@
         <type>test-jar</type>
         <scope>test</scope>
       </dependency>
-        <dependency>
-            <groupId>org.apache.hbase</groupId>
-            <artifactId>hbase-testing-util</artifactId>
-            <version>${project.version}</version>
-            <scope>test</scope>
-        </dependency>
+      <dependency>
+        <artifactId>hbase-rest</artifactId>
+        <groupId>org.apache.hbase</groupId>
+        <version>${project.version}</version>
+      </dependency>
+      <dependency>
+        <artifactId>hbase-rest</artifactId>
+        <groupId>org.apache.hbase</groupId>
+        <version>${project.version}</version>
+        <type>test-jar</type>
+        <scope>test</scope>
+      </dependency>
+      <dependency>
+          <groupId>org.apache.hbase</groupId>
+          <artifactId>hbase-testing-util</artifactId>
+          <version>${project.version}</version>
+          <scope>test</scope>
+      </dependency>
       <dependency>
         <groupId>org.apache.hbase</groupId>
         <artifactId>hbase-prefix-tree</artifactId>

Reply via email to