Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -18,9 +18,7 @@
package org.apache.hadoop.hbase.client;

import java.io.IOException;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.hbase.HBaseTestingUtil;
import org.apache.hadoop.hdfs.DistributedFileSystem;
import org.jruby.embed.ScriptingContainer;
import org.junit.After;
import org.junit.Before;
Expand All @@ -30,14 +28,17 @@ public abstract class AbstractTestShell implements RubyShellTest {
protected final HBaseTestingUtil TEST_UTIL = new HBaseTestingUtil();
protected final ScriptingContainer jruby = new ScriptingContainer();

@Override
public HBaseTestingUtil getTEST_UTIL() {
return TEST_UTIL;
}

@Override
public ScriptingContainer getJRuby() {
return jruby;
}

@Override
public String getSuitePattern() {
return "**/*_test.rb";
}
Expand All @@ -47,20 +48,13 @@ public void setUp() throws Exception {
RubyShellTest.setUpConfig(this);

// Start mini cluster
// 3 datanodes needed for erasure coding checks
TEST_UTIL.startMiniCluster(3);
TEST_UTIL.startMiniCluster(1);

RubyShellTest.setUpJRubyRuntime(this);

RubyShellTest.doTestSetup(this);
}

protected void setupDFS() throws IOException {
DistributedFileSystem dfs =
(DistributedFileSystem) FileSystem.get(TEST_UTIL.getConfiguration());
dfs.enableErasureCodingPolicy("XOR-2-1-1024k");
}

@After
public void tearDown() throws Exception {
TEST_UTIL.shutdownMiniCluster();
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
/*
* 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.client;

import java.io.IOException;
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.hbase.HBaseClassTestRule;
import org.apache.hadoop.hbase.testclassification.ClientTests;
import org.apache.hadoop.hbase.testclassification.LargeTests;
import org.apache.hadoop.hdfs.DistributedFileSystem;
import org.junit.Before;
import org.junit.ClassRule;
import org.junit.experimental.categories.Category;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

@Category({ ClientTests.class, LargeTests.class })
public class TestAdminShell extends AbstractTestShell {
private static final Logger LOG = LoggerFactory.getLogger(TestAdminShell.class);

@ClassRule
public static final HBaseClassTestRule CLASS_RULE =
HBaseClassTestRule.forClass(TestAdminShell.class);

@Override
public String getIncludeList() {
return "admin_test.rb";
}

@Before
public void setUp() throws Exception {
RubyShellTest.setUpConfig(this);

// Start mini cluster
// 3 datanodes needed for erasure coding checks
TEST_UTIL.startMiniCluster(3);

setupDFS();

RubyShellTest.setUpJRubyRuntime(this);

RubyShellTest.doTestSetup(this);
}

protected void setupDFS() throws IOException {
DistributedFileSystem dfs =
(DistributedFileSystem) FileSystem.get(TEST_UTIL.getConfiguration());
dfs.enableErasureCodingPolicy("XOR-2-1-1024k");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import org.junit.experimental.categories.Category;

@Category({ ClientTests.class, LargeTests.class })
public class TestQuotasShell extends BaseTestShell {
public class TestQuotasShell extends AbstractTestShell {
@ClassRule
public static final HBaseClassTestRule CLASS_RULE =
HBaseClassTestRule.forClass(TestQuotasShell.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -32,11 +32,19 @@ public class TestRSGroupShell extends AbstractTestShell {
public static final HBaseClassTestRule CLASS_RULE =
HBaseClassTestRule.forClass(TestRSGroupShell.class);

@Override
@Before
public void setUp() throws Exception {
RubyShellTest.setUpConfig(this);
// enable rs group
RSGroupUtil.enableRSGroup(TEST_UTIL.getConfiguration());
super.setUp();

// Start mini cluster, need 3 nodes
TEST_UTIL.startMiniCluster(3);

RubyShellTest.setUpJRubyRuntime(this);

RubyShellTest.doTestSetup(this);
}

@Override
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import org.junit.experimental.categories.Category;

@Category({ ClientTests.class, LargeTests.class })
public class TestReplicationShell extends BaseTestShell {
public class TestReplicationShell extends AbstractTestShell {
@ClassRule
public static final HBaseClassTestRule CLASS_RULE =
HBaseClassTestRule.forClass(TestReplicationShell.class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import org.junit.experimental.categories.Category;

@Category({ ClientTests.class, LargeTests.class })
public class TestShell extends BaseTestShell {
public class TestShell extends AbstractTestShell {
@ClassRule
public static final HBaseClassTestRule CLASS_RULE = HBaseClassTestRule.forClass(TestShell.class);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,6 +31,7 @@ public class TestShellNoCluster extends AbstractTestShell {
public static final HBaseClassTestRule CLASS_RULE =
HBaseClassTestRule.forClass(TestShellNoCluster.class);

@Override
@Before
public void setUp() throws Exception {
RubyShellTest.setUpConfig(this);
Expand All @@ -42,6 +43,7 @@ public void setUp() throws Exception {
RubyShellTest.doTestSetup(this);
}

@Override
@After
public void tearDown() throws Exception {
// no cluster
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
import org.junit.experimental.categories.Category;

@Category({ ClientTests.class, MediumTests.class })
public class TestTableShell extends BaseTestShell {
public class TestTableShell extends AbstractTestShell {
@ClassRule
public static final HBaseClassTestRule CLASS_RULE =
HBaseClassTestRule.forClass(TestTableShell.class);
Expand Down