forked from apache/hbase
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
HBASE-26167 Allow users to not start zookeeper and dfs cluster when u…
…sing TestingHBaseCluster (apache#4534) Co-authored-by: Duo Zhang <zhangduo@apache.org> Signed-off-by: Yu Li <liyu@apache.org>
- Loading branch information
Showing
7 changed files
with
393 additions
and
3 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
58 changes: 58 additions & 0 deletions
58
...test/java/org/apache/hadoop/hbase/testing/TestTestingHBaseClusterReplicationShareDfs.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
/* | ||
* 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.testing; | ||
|
||
import static org.junit.Assert.assertNotEquals; | ||
|
||
import org.apache.hadoop.hbase.HBaseClassTestRule; | ||
import org.apache.hadoop.hbase.HBaseTestingUtil; | ||
import org.apache.hadoop.hbase.HConstants; | ||
import org.apache.hadoop.hbase.testclassification.LargeTests; | ||
import org.apache.hadoop.hbase.testclassification.MiscTests; | ||
import org.junit.ClassRule; | ||
import org.junit.experimental.categories.Category; | ||
|
||
@Category({ MiscTests.class, LargeTests.class }) | ||
public class TestTestingHBaseClusterReplicationShareDfs | ||
extends TestingHBaseClusterReplicationTestBase { | ||
|
||
@ClassRule | ||
public static final HBaseClassTestRule CLASS_RULE = | ||
HBaseClassTestRule.forClass(TestTestingHBaseClusterReplicationShareDfs.class); | ||
|
||
private HBaseTestingUtil util = new HBaseTestingUtil(); | ||
|
||
@Override | ||
protected void startClusters() throws Exception { | ||
util.startMiniDFSCluster(1); | ||
String dfsUri = util.getDFSCluster().getFileSystem().getUri().toString(); | ||
sourceCluster = TestingHBaseCluster | ||
.create(TestingHBaseClusterOption.builder().useExternalDfs(dfsUri).build()); | ||
sourceCluster.start(); | ||
peerCluster = TestingHBaseCluster | ||
.create(TestingHBaseClusterOption.builder().useExternalDfs(dfsUri).build()); | ||
peerCluster.start(); | ||
assertNotEquals(sourceCluster.getConf().get(HConstants.HBASE_DIR), | ||
peerCluster.getConf().get(HConstants.HBASE_DIR)); | ||
} | ||
|
||
@Override | ||
protected void stopClusters() throws Exception { | ||
util.shutdownMiniDFSCluster(); | ||
} | ||
} |
58 changes: 58 additions & 0 deletions
58
.../test/java/org/apache/hadoop/hbase/testing/TestTestingHBaseClusterReplicationShareZk.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
/* | ||
* 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.testing; | ||
|
||
import static org.junit.Assert.assertNotEquals; | ||
|
||
import org.apache.hadoop.hbase.HBaseClassTestRule; | ||
import org.apache.hadoop.hbase.HBaseTestingUtil; | ||
import org.apache.hadoop.hbase.HConstants; | ||
import org.apache.hadoop.hbase.testclassification.LargeTests; | ||
import org.apache.hadoop.hbase.testclassification.MiscTests; | ||
import org.junit.ClassRule; | ||
import org.junit.experimental.categories.Category; | ||
|
||
@Category({ MiscTests.class, LargeTests.class }) | ||
public class TestTestingHBaseClusterReplicationShareZk | ||
extends TestingHBaseClusterReplicationTestBase { | ||
|
||
@ClassRule | ||
public static final HBaseClassTestRule CLASS_RULE = | ||
HBaseClassTestRule.forClass(TestTestingHBaseClusterReplicationShareZk.class); | ||
|
||
private HBaseTestingUtil util = new HBaseTestingUtil(); | ||
|
||
@Override | ||
protected void startClusters() throws Exception { | ||
util.startMiniZKCluster(); | ||
String zkConnectString = util.getZkCluster().getAddress().toString(); | ||
sourceCluster = TestingHBaseCluster | ||
.create(TestingHBaseClusterOption.builder().useExternalZooKeeper(zkConnectString).build()); | ||
sourceCluster.start(); | ||
peerCluster = TestingHBaseCluster | ||
.create(TestingHBaseClusterOption.builder().useExternalZooKeeper(zkConnectString).build()); | ||
peerCluster.start(); | ||
assertNotEquals(sourceCluster.getConf().get(HConstants.ZOOKEEPER_ZNODE_PARENT), | ||
peerCluster.getConf().get(HConstants.ZOOKEEPER_ZNODE_PARENT)); | ||
} | ||
|
||
@Override | ||
protected void stopClusters() throws Exception { | ||
util.shutdownMiniZKCluster(); | ||
} | ||
} |
63 changes: 63 additions & 0 deletions
63
...st/java/org/apache/hadoop/hbase/testing/TestTestingHBaseClusterReplicationShareZkDfs.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,63 @@ | ||
/* | ||
* 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.testing; | ||
|
||
import static org.junit.Assert.assertNotEquals; | ||
|
||
import org.apache.hadoop.hbase.HBaseClassTestRule; | ||
import org.apache.hadoop.hbase.HBaseTestingUtil; | ||
import org.apache.hadoop.hbase.HConstants; | ||
import org.apache.hadoop.hbase.testclassification.LargeTests; | ||
import org.apache.hadoop.hbase.testclassification.MiscTests; | ||
import org.junit.ClassRule; | ||
import org.junit.experimental.categories.Category; | ||
|
||
@Category({ MiscTests.class, LargeTests.class }) | ||
public class TestTestingHBaseClusterReplicationShareZkDfs | ||
extends TestingHBaseClusterReplicationTestBase { | ||
|
||
@ClassRule | ||
public static final HBaseClassTestRule CLASS_RULE = | ||
HBaseClassTestRule.forClass(TestTestingHBaseClusterReplicationShareZkDfs.class); | ||
|
||
private HBaseTestingUtil util = new HBaseTestingUtil(); | ||
|
||
@Override | ||
protected void startClusters() throws Exception { | ||
util.startMiniZKCluster(); | ||
util.startMiniDFSCluster(1); | ||
String zkConnectString = util.getZkCluster().getAddress().toString(); | ||
String dfsUri = util.getDFSCluster().getFileSystem().getUri().toString(); | ||
sourceCluster = TestingHBaseCluster.create(TestingHBaseClusterOption.builder() | ||
.useExternalZooKeeper(zkConnectString).useExternalDfs(dfsUri).build()); | ||
sourceCluster.start(); | ||
peerCluster = TestingHBaseCluster.create(TestingHBaseClusterOption.builder() | ||
.useExternalZooKeeper(zkConnectString).useExternalDfs(dfsUri).build()); | ||
peerCluster.start(); | ||
assertNotEquals(sourceCluster.getConf().get(HConstants.ZOOKEEPER_ZNODE_PARENT), | ||
peerCluster.getConf().get(HConstants.ZOOKEEPER_ZNODE_PARENT)); | ||
assertNotEquals(sourceCluster.getConf().get(HConstants.HBASE_DIR), | ||
peerCluster.getConf().get(HConstants.HBASE_DIR)); | ||
} | ||
|
||
@Override | ||
protected void stopClusters() throws Exception { | ||
util.shutdownMiniDFSCluster(); | ||
util.shutdownMiniZKCluster(); | ||
} | ||
} |
46 changes: 46 additions & 0 deletions
46
...t/java/org/apache/hadoop/hbase/testing/TestTestingHBaseClusterReplicationTwoClusters.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
/* | ||
* 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.testing; | ||
|
||
import org.apache.hadoop.hbase.HBaseClassTestRule; | ||
import org.apache.hadoop.hbase.testclassification.LargeTests; | ||
import org.apache.hadoop.hbase.testclassification.MiscTests; | ||
import org.junit.ClassRule; | ||
import org.junit.experimental.categories.Category; | ||
|
||
@Category({ MiscTests.class, LargeTests.class }) | ||
public class TestTestingHBaseClusterReplicationTwoClusters | ||
extends TestingHBaseClusterReplicationTestBase { | ||
|
||
@ClassRule | ||
public static final HBaseClassTestRule CLASS_RULE = | ||
HBaseClassTestRule.forClass(TestTestingHBaseClusterReplicationTwoClusters.class); | ||
|
||
@Override | ||
protected void startClusters() throws Exception { | ||
sourceCluster = TestingHBaseCluster.create(TestingHBaseClusterOption.builder().build()); | ||
sourceCluster.start(); | ||
peerCluster = TestingHBaseCluster.create(TestingHBaseClusterOption.builder().build()); | ||
peerCluster.start(); | ||
} | ||
|
||
@Override | ||
protected void stopClusters() throws Exception { | ||
} | ||
|
||
} |
Oops, something went wrong.