HBASE-12197 Move rest to it's on module
Summary: Move hbase-rest to it's own module. copy test resources from hbase-server into hbase-rest's test resources. Test Plan: Unit tests pass of hbase-rest module. Differential Revision: https://reviews.facebook.net/D24657
This commit is contained in:
parent
fcf583eb19
commit
6ddb2f1965
|
@ -101,6 +101,16 @@
|
||||||
<artifactId>hbase-shell</artifactId>
|
<artifactId>hbase-shell</artifactId>
|
||||||
<version>${project.version}</version>
|
<version>${project.version}</version>
|
||||||
</dependency>
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.hbase</groupId>
|
||||||
|
<artifactId>hbase-thrift</artifactId>
|
||||||
|
<version>${project.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.hbase</groupId>
|
||||||
|
<artifactId>hbase-rest</artifactId>
|
||||||
|
<version>${project.version}</version>
|
||||||
|
</dependency>
|
||||||
<dependency>
|
<dependency>
|
||||||
<groupId>org.apache.hbase</groupId>
|
<groupId>org.apache.hbase</groupId>
|
||||||
<artifactId>hbase-testing-util</artifactId>
|
<artifactId>hbase-testing-util</artifactId>
|
||||||
|
|
|
@ -0,0 +1,296 @@
|
||||||
|
<?xml version="1.0"?>
|
||||||
|
<project xmlns="http://maven.apache.org/POM/4.0.0"
|
||||||
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
|
||||||
|
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
|
||||||
|
<!--
|
||||||
|
/**
|
||||||
|
* 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.
|
||||||
|
*/
|
||||||
|
-->
|
||||||
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<parent>
|
||||||
|
<artifactId>hbase</artifactId>
|
||||||
|
<groupId>org.apache.hbase</groupId>
|
||||||
|
<version>2.0.0-SNAPSHOT</version>
|
||||||
|
<relativePath>..</relativePath>
|
||||||
|
</parent>
|
||||||
|
<artifactId>hbase-rest</artifactId>
|
||||||
|
<name>HBase - Rest</name>
|
||||||
|
<description>HBase Rest Server</description>
|
||||||
|
|
||||||
|
<build>
|
||||||
|
<!-- Makes sure the resources get added before they are processed
|
||||||
|
by placing this first -->
|
||||||
|
<resources>
|
||||||
|
<!-- Add the build webabpps to the classpth -->
|
||||||
|
<resource>
|
||||||
|
<directory>${project.build.directory}</directory>
|
||||||
|
<includes>
|
||||||
|
<include>hbase-webapps/**</include>
|
||||||
|
</includes>
|
||||||
|
</resource>
|
||||||
|
</resources>
|
||||||
|
<testResources>
|
||||||
|
<testResource>
|
||||||
|
<directory>src/test/resources</directory>
|
||||||
|
<includes>
|
||||||
|
<include>**/**</include>
|
||||||
|
</includes>
|
||||||
|
</testResource>
|
||||||
|
</testResources>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-site-plugin</artifactId>
|
||||||
|
<configuration>
|
||||||
|
<skip>true</skip>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<!--Make it so assembly:single does nothing in here-->
|
||||||
|
<artifactId>maven-assembly-plugin</artifactId>
|
||||||
|
<version>${maven.assembly.version}</version>
|
||||||
|
<configuration>
|
||||||
|
<skipAssembly>true</skipAssembly>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
<!-- Make a jar and put the sources in the jar -->
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.maven.plugins</groupId>
|
||||||
|
<artifactId>maven-source-plugin</artifactId>
|
||||||
|
</plugin>
|
||||||
|
|
||||||
|
<!-- General ant tasks, bound to different build phases -->
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-antrun-plugin</artifactId>
|
||||||
|
<executions>
|
||||||
|
<!-- Generate web app sources -->
|
||||||
|
<execution>
|
||||||
|
<id>generate</id>
|
||||||
|
<phase>generate-sources</phase>
|
||||||
|
<configuration>
|
||||||
|
<target>
|
||||||
|
<property name="build.webapps" location="${project.build.directory}/hbase-webapps"/>
|
||||||
|
<property name="src.webapps"
|
||||||
|
location="${basedir}/src/main/resources/hbase-webapps"/>
|
||||||
|
<property name="generated.sources"
|
||||||
|
location="${project.build.directory}/generated-sources"/>
|
||||||
|
<mkdir dir="${build.webapps}"/>
|
||||||
|
<copy todir="${build.webapps}">
|
||||||
|
<fileset dir="${src.webapps}">
|
||||||
|
<exclude name="**/*.jsp"/>
|
||||||
|
<exclude name="**/.*"/>
|
||||||
|
<exclude name="**/*~"/>
|
||||||
|
</fileset>
|
||||||
|
</copy>
|
||||||
|
<!--The compile.classpath is passed in by maven -->
|
||||||
|
<taskdef classname="org.apache.jasper.JspC" name="jspcompiler"
|
||||||
|
classpathref="maven.compile.classpath"/>
|
||||||
|
<mkdir dir="${build.webapps}/rest/WEB-INF"/>
|
||||||
|
<jspcompiler uriroot="${src.webapps}/rest" outputdir="${generated.sources}/java"
|
||||||
|
package="org.apache.hadoop.hbase.generated.rest"
|
||||||
|
webxml="${build.webapps}/rest/WEB-INF/web.xml"/>
|
||||||
|
</target>
|
||||||
|
</configuration>
|
||||||
|
<goals>
|
||||||
|
<goal>run</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.codehaus.mojo</groupId>
|
||||||
|
<artifactId>build-helper-maven-plugin</artifactId>
|
||||||
|
<executions>
|
||||||
|
<!-- Add the generated sources -->
|
||||||
|
<execution>
|
||||||
|
<id>jspcSource-packageInfo-source</id>
|
||||||
|
<phase>generate-sources</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>add-source</goal>
|
||||||
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<sources>
|
||||||
|
<source>${project.build.directory}/generated-sources/java</source>
|
||||||
|
</sources>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
<!-- Testing plugins -->
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-surefire-plugin</artifactId>
|
||||||
|
<configuration>
|
||||||
|
<properties>
|
||||||
|
<property>
|
||||||
|
<name>listener</name>
|
||||||
|
<value>org.apache.hadoop.hbase.ServerResourceCheckerJUnitListener</value>
|
||||||
|
</property>
|
||||||
|
</properties>
|
||||||
|
<systemPropertyVariables>
|
||||||
|
<test.build.webapps>target/test-classes/webapps</test.build.webapps>
|
||||||
|
</systemPropertyVariables>
|
||||||
|
</configuration>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
|
||||||
|
<dependencies>
|
||||||
|
<!-- Intra-project dependencies -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.hbase</groupId>
|
||||||
|
<artifactId>hbase-common</artifactId>
|
||||||
|
<type>jar</type>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.hbase</groupId>
|
||||||
|
<artifactId>hbase-annotations</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.hbase</groupId>
|
||||||
|
<artifactId>hbase-client</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.hbase</groupId>
|
||||||
|
<artifactId>hbase-server</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.hbase</groupId>
|
||||||
|
<artifactId>hbase-hadoop-compat</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.hbase</groupId>
|
||||||
|
<artifactId>${compat.module}</artifactId>
|
||||||
|
<version>${project.version}</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.hbase</groupId>
|
||||||
|
<artifactId>hbase-server</artifactId>
|
||||||
|
<type>test-jar</type>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.hbase</groupId>
|
||||||
|
<artifactId>hbase-testing-util</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.hbase</groupId>
|
||||||
|
<artifactId>hbase-annotations</artifactId>
|
||||||
|
<type>test-jar</type>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.mortbay.jetty</groupId>
|
||||||
|
<artifactId>jsp-2.1</artifactId>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>tomcat</groupId>
|
||||||
|
<artifactId>jasper-compiler</artifactId>
|
||||||
|
<scope>compile</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>tomcat</groupId>
|
||||||
|
<artifactId>jasper-runtime</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<!-- REST dependencies -->
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.google.protobuf</groupId>
|
||||||
|
<artifactId>protobuf-java</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.sun.jersey</groupId>
|
||||||
|
<artifactId>jersey-core</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.sun.jersey</groupId>
|
||||||
|
<artifactId>jersey-json</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.sun.jersey</groupId>
|
||||||
|
<artifactId>jersey-server</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>javax.xml.bind</groupId>
|
||||||
|
<artifactId>jaxb-api</artifactId>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
<profiles>
|
||||||
|
<!-- Skip the tests in this module -->
|
||||||
|
<profile>
|
||||||
|
<id>skipRestTets</id>
|
||||||
|
<activation>
|
||||||
|
<property>
|
||||||
|
<name>skipRestTests</name>
|
||||||
|
</property>
|
||||||
|
</activation>
|
||||||
|
<properties>
|
||||||
|
<surefire.skipFirstPart>true</surefire.skipFirstPart>
|
||||||
|
<surefire.skipSecondPart>true</surefire.skipSecondPart>
|
||||||
|
</properties>
|
||||||
|
</profile>
|
||||||
|
<profile>
|
||||||
|
<id>compile-protobuf</id>
|
||||||
|
<activation>
|
||||||
|
<property>
|
||||||
|
<name>compile-protobuf</name>
|
||||||
|
</property>
|
||||||
|
</activation>
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<groupId>org.apache.hadoop</groupId>
|
||||||
|
<artifactId>hadoop-maven-plugins</artifactId>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<id>compile-protoc</id>
|
||||||
|
<phase>generate-sources</phase>
|
||||||
|
<goals>
|
||||||
|
<goal>protoc</goal>
|
||||||
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<imports>
|
||||||
|
<param>${basedir}/src/main/resources/org/apache/hadoop/hbase/rest/protobuf
|
||||||
|
</param>
|
||||||
|
</imports>
|
||||||
|
<source>
|
||||||
|
<!-- These should be under src/main/protobuf -->
|
||||||
|
<directory>${basedir}/src/main/resources/org/apache/hadoop/hbase/rest/protobuf
|
||||||
|
</directory>
|
||||||
|
<includes>
|
||||||
|
<include>CellMessage.proto</include>
|
||||||
|
<include>CellSetMessage.proto</include>
|
||||||
|
<include>ColumnSchemaMessage.proto</include>
|
||||||
|
<include>ScannerMessage.proto</include>
|
||||||
|
<include>StorageClusterStatusMessage.proto</include>
|
||||||
|
<include>TableInfoMessage.proto</include>
|
||||||
|
<include>TableListMessage.proto</include>
|
||||||
|
<include>TableSchemaMessage.proto</include>
|
||||||
|
<include>VersionMessage.proto</include>
|
||||||
|
</includes>
|
||||||
|
</source>
|
||||||
|
<output>${basedir}/src/main/java/</output>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
</profile>
|
||||||
|
</profiles>
|
||||||
|
</project>
|
|
@ -100,4 +100,11 @@ public class Cluster {
|
||||||
sb.append(port);
|
sb.append(port);
|
||||||
return remove(sb.toString());
|
return remove(sb.toString());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@Override public String toString() {
|
||||||
|
return "Cluster{" +
|
||||||
|
"nodes=" + nodes +
|
||||||
|
", lastHost='" + lastHost + '\'' +
|
||||||
|
'}';
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -24,8 +24,13 @@ import java.io.IOException;
|
||||||
import javax.xml.bind.JAXBContext;
|
import javax.xml.bind.JAXBContext;
|
||||||
import javax.xml.bind.JAXBException;
|
import javax.xml.bind.JAXBException;
|
||||||
|
|
||||||
|
import org.apache.commons.logging.Log;
|
||||||
|
import org.apache.commons.logging.LogFactory;
|
||||||
|
import org.apache.hadoop.conf.Configuration;
|
||||||
import org.apache.hadoop.hbase.HBaseTestingUtility;
|
import org.apache.hadoop.hbase.HBaseTestingUtility;
|
||||||
import org.apache.hadoop.hbase.TableName;
|
import org.apache.hadoop.hbase.TableName;
|
||||||
|
import org.apache.hadoop.hbase.Waiter;
|
||||||
|
import org.apache.hadoop.hbase.client.HBaseAdmin;
|
||||||
import org.apache.hadoop.hbase.rest.client.Client;
|
import org.apache.hadoop.hbase.rest.client.Client;
|
||||||
import org.apache.hadoop.hbase.rest.client.Cluster;
|
import org.apache.hadoop.hbase.rest.client.Cluster;
|
||||||
import org.apache.hadoop.hbase.rest.client.Response;
|
import org.apache.hadoop.hbase.rest.client.Response;
|
||||||
|
@ -43,14 +48,17 @@ import org.junit.experimental.categories.Category;
|
||||||
|
|
||||||
@Category({RestTests.class, MediumTests.class})
|
@Category({RestTests.class, MediumTests.class})
|
||||||
public class TestStatusResource {
|
public class TestStatusResource {
|
||||||
private static final byte[] META_REGION_NAME = Bytes.toBytes(TableName.META_TABLE_NAME+",,1");
|
public static Log LOG = LogFactory.getLog(TestStatusResource.class);
|
||||||
|
|
||||||
|
private static final byte[] META_REGION_NAME = Bytes.toBytes(TableName.META_TABLE_NAME + ",,1");
|
||||||
|
|
||||||
private static final HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility();
|
private static final HBaseTestingUtility TEST_UTIL = new HBaseTestingUtility();
|
||||||
private static final HBaseRESTTestingUtility REST_TEST_UTIL =
|
private static final HBaseRESTTestingUtility REST_TEST_UTIL =
|
||||||
new HBaseRESTTestingUtility();
|
new HBaseRESTTestingUtility();
|
||||||
private static Client client;
|
private static Client client;
|
||||||
private static JAXBContext context;
|
private static JAXBContext context;
|
||||||
|
private static Configuration conf;
|
||||||
|
|
||||||
private static void validate(StorageClusterStatusModel model) {
|
private static void validate(StorageClusterStatusModel model) {
|
||||||
assertNotNull(model);
|
assertNotNull(model);
|
||||||
assertTrue(model.getRegions() + ">= 1", model.getRegions() >= 1);
|
assertTrue(model.getRegions() + ">= 1", model.getRegions() >= 1);
|
||||||
|
@ -75,11 +83,21 @@ public class TestStatusResource {
|
||||||
|
|
||||||
@BeforeClass
|
@BeforeClass
|
||||||
public static void setUpBeforeClass() throws Exception {
|
public static void setUpBeforeClass() throws Exception {
|
||||||
TEST_UTIL.startMiniCluster();
|
conf = TEST_UTIL.getConfiguration();
|
||||||
REST_TEST_UTIL.startServletContainer(TEST_UTIL.getConfiguration());
|
TEST_UTIL.startMiniCluster(1, 1);
|
||||||
client = new Client(new Cluster().add("localhost",
|
TEST_UTIL.createTable(Bytes.toBytes("TestStatusResource"), Bytes.toBytes("D"));
|
||||||
REST_TEST_UTIL.getServletPort()));
|
TEST_UTIL.createTable(Bytes.toBytes("TestStatusResource2"), Bytes.toBytes("D"));
|
||||||
|
REST_TEST_UTIL.startServletContainer(conf);
|
||||||
|
Cluster cluster = new Cluster();
|
||||||
|
cluster.add("localhost", REST_TEST_UTIL.getServletPort());
|
||||||
|
client = new Client(cluster);
|
||||||
context = JAXBContext.newInstance(StorageClusterStatusModel.class);
|
context = JAXBContext.newInstance(StorageClusterStatusModel.class);
|
||||||
|
TEST_UTIL.waitFor(6000, new Waiter.Predicate<IOException>() {
|
||||||
|
@Override
|
||||||
|
public boolean evaluate() throws IOException {
|
||||||
|
return TEST_UTIL.getMiniHBaseCluster().getClusterStatus().getAverageLoad() > 0;
|
||||||
|
}
|
||||||
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
@AfterClass
|
@AfterClass
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue