ACCUMULO-3871 rename base class for ITs so they do not end with "IT"
Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/ab5a867f Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/ab5a867f Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/ab5a867f Branch: refs/heads/master Commit: ab5a867f12f48a2f64f4caedec59d3c0f83a1766 Parents: 0788cb5 Author: Eric Newton <eric.new...@gmail.com> Authored: Thu Jun 4 13:18:27 2015 -0400 Committer: Eric Newton <eric.new...@gmail.com> Committed: Thu Jun 4 13:18:27 2015 -0400 ---------------------------------------------------------------------- .../harness/AccumuloClusterHarness.java | 338 +++++++++++++++++++ .../accumulo/harness/AccumuloClusterIT.java | 338 ------------------- .../org/apache/accumulo/harness/AccumuloIT.java | 104 ------ .../apache/accumulo/harness/AccumuloITBase.java | 104 ++++++ .../accumulo/harness/MiniClusterHarness.java | 14 +- .../accumulo/harness/SharedMiniClusterBase.java | 185 ++++++++++ .../accumulo/harness/SharedMiniClusterIT.java | 185 ---------- .../conf/AccumuloClusterConfiguration.java | 2 +- .../AccumuloClusterPropertyConfiguration.java | 2 +- .../conf/AccumuloMiniClusterConfiguration.java | 8 +- .../StandaloneAccumuloClusterConfiguration.java | 2 +- .../test/ArbitraryTablePropertiesIT.java | 4 +- .../accumulo/test/AssignmentThreadsIT.java | 4 +- .../apache/accumulo/test/AuditMessageIT.java | 4 +- .../test/BadDeleteMarkersCreatedIT.java | 4 +- .../apache/accumulo/test/BalanceFasterIT.java | 4 +- .../org/apache/accumulo/test/BalanceIT.java | 4 +- .../test/BalanceWithOfflineTableIT.java | 4 +- .../org/apache/accumulo/test/BatchWriterIT.java | 4 +- .../accumulo/test/BulkImportVolumeIT.java | 4 +- .../org/apache/accumulo/test/CleanWalIT.java | 4 +- .../accumulo/test/ConditionalWriterIT.java | 4 +- .../test/ConfigurableMajorCompactionIT.java | 4 +- .../test/CreateTableWithNewTableConfigIT.java | 4 +- .../org/apache/accumulo/test/DumpConfigIT.java | 4 +- .../org/apache/accumulo/test/ExistingMacIT.java | 4 +- .../org/apache/accumulo/test/FileArchiveIT.java | 4 +- .../accumulo/test/GarbageCollectWALIT.java | 4 +- .../apache/accumulo/test/ImportExportIT.java | 4 +- .../accumulo/test/InterruptibleScannersIT.java | 4 +- .../accumulo/test/KeyValueEqualityIT.java | 4 +- .../apache/accumulo/test/LargeSplitRowIT.java | 4 +- .../test/MasterRepairsDualAssignmentIT.java | 4 +- .../accumulo/test/MetaConstraintRetryIT.java | 4 +- .../apache/accumulo/test/MetaGetsReadersIT.java | 4 +- .../org/apache/accumulo/test/MetaSplitIT.java | 4 +- .../MissingWalHeaderCompletesRecoveryIT.java | 4 +- .../accumulo/test/MultiTableBatchWriterIT.java | 4 +- .../accumulo/test/MultiTableRecoveryIT.java | 4 +- .../org/apache/accumulo/test/NamespacesIT.java | 4 +- .../test/RecoveryCompactionsAreFlushesIT.java | 4 +- .../test/RewriteTabletDirectoriesIT.java | 4 +- .../apache/accumulo/test/ScanIteratorIT.java | 4 +- .../org/apache/accumulo/test/ShellConfigIT.java | 4 +- .../org/apache/accumulo/test/ShellServerIT.java | 4 +- .../accumulo/test/SplitCancelsMajCIT.java | 4 +- .../apache/accumulo/test/SplitRecoveryIT.java | 4 +- .../test/TableConfigurationUpdateIT.java | 4 +- .../apache/accumulo/test/TableOperationsIT.java | 4 +- .../accumulo/test/TabletServerGivesUpIT.java | 4 +- .../org/apache/accumulo/test/TotalQueuedIT.java | 4 +- .../test/TracerRecoversAfterOfflineTableIT.java | 4 +- .../accumulo/test/TransportCachingIT.java | 4 +- .../org/apache/accumulo/test/UnusedWALIT.java | 4 +- .../accumulo/test/UserCompactionStrategyIT.java | 4 +- .../java/org/apache/accumulo/test/UsersIT.java | 4 +- .../accumulo/test/VerifySerialRecoveryIT.java | 4 +- .../apache/accumulo/test/VolumeChooserIT.java | 4 +- .../java/org/apache/accumulo/test/VolumeIT.java | 4 +- .../apache/accumulo/test/WaitForBalanceIT.java | 4 +- .../test/functional/AccumuloInputFormatIT.java | 4 +- .../accumulo/test/functional/AddSplitIT.java | 4 +- .../test/functional/BackupMasterIT.java | 2 +- .../test/functional/BadIteratorMincIT.java | 4 +- .../functional/BalanceAfterCommsFailureIT.java | 2 +- .../BalanceInPresenceOfOfflineTableIT.java | 4 +- .../test/functional/BatchScanSplitIT.java | 4 +- .../test/functional/BatchWriterFlushIT.java | 4 +- .../test/functional/BigRootTabletIT.java | 4 +- .../accumulo/test/functional/BinaryIT.java | 4 +- .../test/functional/BinaryStressIT.java | 4 +- .../accumulo/test/functional/BloomFilterIT.java | 4 +- .../accumulo/test/functional/BulkFileIT.java | 4 +- .../apache/accumulo/test/functional/BulkIT.java | 4 +- .../functional/BulkSplitOptimizationIT.java | 4 +- .../test/functional/ChaoticBalancerIT.java | 4 +- .../accumulo/test/functional/ClassLoaderIT.java | 4 +- .../accumulo/test/functional/CleanTmpIT.java | 2 +- .../accumulo/test/functional/CleanUpIT.java | 6 +- .../accumulo/test/functional/CloneTestIT.java | 4 +- .../accumulo/test/functional/CombinerIT.java | 4 +- .../accumulo/test/functional/CompactionIT.java | 4 +- .../accumulo/test/functional/ConcurrencyIT.java | 4 +- .../functional/ConfigurableCompactionIT.java | 2 +- .../test/functional/ConfigurableMacBase.java | 182 ++++++++++ .../test/functional/ConfigurableMacIT.java | 182 ---------- .../accumulo/test/functional/ConstraintIT.java | 4 +- .../test/functional/CreateAndUseIT.java | 4 +- .../test/functional/CreateManyScannersIT.java | 4 +- .../accumulo/test/functional/CredentialsIT.java | 4 +- .../test/functional/DeleteEverythingIT.java | 4 +- .../accumulo/test/functional/DeleteIT.java | 4 +- .../accumulo/test/functional/DeleteRowsIT.java | 4 +- .../test/functional/DeleteRowsSplitIT.java | 4 +- .../functional/DeleteTableDuringSplitIT.java | 4 +- .../functional/DeletedTablesDontFlushIT.java | 4 +- .../accumulo/test/functional/DurabilityIT.java | 2 +- .../test/functional/DynamicThreadPoolsIT.java | 4 +- .../accumulo/test/functional/ExamplesIT.java | 4 +- .../test/functional/FateStarvationIT.java | 4 +- .../test/functional/GarbageCollectorIT.java | 2 +- .../test/functional/HalfDeadTServerIT.java | 2 +- .../accumulo/test/functional/KerberosIT.java | 4 +- .../test/functional/KerberosProxyIT.java | 4 +- .../accumulo/test/functional/LargeRowIT.java | 4 +- .../test/functional/LateLastContactIT.java | 2 +- .../accumulo/test/functional/LogicalTimeIT.java | 4 +- .../accumulo/test/functional/MapReduceIT.java | 2 +- .../test/functional/MasterAssignmentIT.java | 4 +- .../test/functional/MasterFailoverIT.java | 4 +- .../accumulo/test/functional/MaxOpenIT.java | 4 +- .../accumulo/test/functional/MergeIT.java | 4 +- .../accumulo/test/functional/MetadataIT.java | 4 +- .../test/functional/MetadataMaxFilesIT.java | 2 +- .../test/functional/MetadataSplitIT.java | 2 +- .../test/functional/MonitorLoggingIT.java | 2 +- .../accumulo/test/functional/MonitorSslIT.java | 2 +- .../accumulo/test/functional/PermissionsIT.java | 4 +- .../accumulo/test/functional/ReadWriteIT.java | 4 +- .../functional/RecoveryWithEmptyRFileIT.java | 2 +- .../test/functional/RegexGroupBalanceIT.java | 2 +- .../accumulo/test/functional/RenameIT.java | 4 +- .../accumulo/test/functional/RestartIT.java | 4 +- .../test/functional/RestartStressIT.java | 4 +- .../accumulo/test/functional/RowDeleteIT.java | 4 +- .../accumulo/test/functional/ScanIdIT.java | 4 +- .../test/functional/ScanIteratorIT.java | 4 +- .../accumulo/test/functional/ScanRangeIT.java | 4 +- .../test/functional/ScanSessionTimeOutIT.java | 4 +- .../accumulo/test/functional/ScannerIT.java | 4 +- .../test/functional/ServerSideErrorIT.java | 4 +- .../test/functional/SessionDurabilityIT.java | 2 +- .../accumulo/test/functional/ShutdownIT.java | 2 +- .../functional/SimpleBalancerFairnessIT.java | 2 +- .../accumulo/test/functional/SimpleMacIT.java | 25 -- .../test/functional/SparseColumnFamilyIT.java | 4 +- .../accumulo/test/functional/SplitIT.java | 4 +- .../test/functional/SplitRecoveryIT.java | 2 +- .../apache/accumulo/test/functional/SslIT.java | 2 +- .../accumulo/test/functional/StartIT.java | 4 +- .../accumulo/test/functional/TableIT.java | 4 +- .../accumulo/test/functional/TabletIT.java | 4 +- .../functional/TabletStateChangeIteratorIT.java | 4 +- .../accumulo/test/functional/TimeoutIT.java | 4 +- .../accumulo/test/functional/VisibilityIT.java | 4 +- .../accumulo/test/functional/WALSunnyDayIT.java | 2 +- .../test/functional/WatchTheWatchCountIT.java | 2 +- .../test/functional/WriteAheadLogIT.java | 4 +- .../accumulo/test/functional/WriteLotsIT.java | 4 +- .../accumulo/test/functional/ZooCacheIT.java | 2 +- .../test/functional/ZookeeperRestartIT.java | 2 +- .../test/performance/RollWALPerformanceIT.java | 4 +- .../performance/metadata/FastBulkImportIT.java | 4 +- .../accumulo/test/proxy/ProxyDurabilityIT.java | 4 +- .../accumulo/test/proxy/SimpleProxyBase.java | 30 +- .../test/replication/CyclicReplicationIT.java | 4 +- ...bageCollectorCommunicatesWithTServersIT.java | 6 +- .../test/replication/KerberosReplicationIT.java | 4 +- .../replication/MultiInstanceReplicationIT.java | 4 +- .../replication/MultiTserverReplicationIT.java | 4 +- .../test/replication/ReplicationIT.java | 4 +- .../replication/ReplicationRandomWalkIT.java | 4 +- .../test/replication/StatusCombinerMacIT.java | 4 +- .../UnorderedWorkAssignerReplicationIT.java | 4 +- ...UnusedWalDoesntCloseReplicationStatusIT.java | 4 +- .../server/security/SystemCredentialsIT.java | 4 +- 166 files changed, 1118 insertions(+), 1143 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/accumulo/blob/ab5a867f/test/src/test/java/org/apache/accumulo/harness/AccumuloClusterHarness.java ---------------------------------------------------------------------- diff --git a/test/src/test/java/org/apache/accumulo/harness/AccumuloClusterHarness.java b/test/src/test/java/org/apache/accumulo/harness/AccumuloClusterHarness.java new file mode 100644 index 0000000..30058db --- /dev/null +++ b/test/src/test/java/org/apache/accumulo/harness/AccumuloClusterHarness.java @@ -0,0 +1,338 @@ +/* + * 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.accumulo.harness; + +import static java.nio.charset.StandardCharsets.UTF_8; +import static org.junit.Assert.fail; + +import java.io.IOException; + +import org.apache.accumulo.cluster.AccumuloCluster; +import org.apache.accumulo.cluster.ClusterControl; +import org.apache.accumulo.cluster.ClusterUser; +import org.apache.accumulo.cluster.ClusterUsers; +import org.apache.accumulo.cluster.standalone.StandaloneAccumuloCluster; +import org.apache.accumulo.core.client.ClientConfiguration; +import org.apache.accumulo.core.client.ClientConfiguration.ClientProperty; +import org.apache.accumulo.core.client.Connector; +import org.apache.accumulo.core.client.admin.SecurityOperations; +import org.apache.accumulo.core.client.admin.TableOperations; +import org.apache.accumulo.core.client.security.tokens.AuthenticationToken; +import org.apache.accumulo.core.client.security.tokens.KerberosToken; +import org.apache.accumulo.core.client.security.tokens.PasswordToken; +import org.apache.accumulo.core.conf.Property; +import org.apache.accumulo.core.security.TablePermission; +import org.apache.accumulo.harness.conf.AccumuloClusterConfiguration; +import org.apache.accumulo.harness.conf.AccumuloClusterPropertyConfiguration; +import org.apache.accumulo.harness.conf.AccumuloMiniClusterConfiguration; +import org.apache.accumulo.harness.conf.StandaloneAccumuloClusterConfiguration; +import org.apache.accumulo.minicluster.impl.MiniAccumuloClusterImpl; +import org.apache.accumulo.minicluster.impl.MiniAccumuloConfigImpl; +import org.apache.hadoop.conf.Configuration; +import org.apache.hadoop.fs.FileSystem; +import org.apache.hadoop.fs.Path; +import org.apache.hadoop.security.UserGroupInformation; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Assume; +import org.junit.Before; +import org.junit.BeforeClass; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +import com.google.common.base.Preconditions; + +/** + * General Integration-Test base class that provides access to an Accumulo instance for testing. This instance could be MAC or a standalone instance. + */ +public abstract class AccumuloClusterHarness extends AccumuloITBase implements MiniClusterConfigurationCallback, ClusterUsers { + private static final Logger log = LoggerFactory.getLogger(AccumuloClusterHarness.class); + private static final String TRUE = Boolean.toString(true); + + public static enum ClusterType { + MINI, STANDALONE; + + public boolean isDynamic() { + return this == MINI; + } + } + + private static boolean initialized = false; + + protected static AccumuloCluster cluster; + protected static ClusterType type; + protected static AccumuloClusterPropertyConfiguration clusterConf; + protected static TestingKdc krb; + + @BeforeClass + public static void setUp() throws Exception { + clusterConf = AccumuloClusterPropertyConfiguration.get(); + type = clusterConf.getClusterType(); + + if (ClusterType.MINI == type && TRUE.equals(System.getProperty(MiniClusterHarness.USE_KERBEROS_FOR_IT_OPTION))) { + krb = new TestingKdc(); + krb.start(); + log.info("MiniKdc started"); + } + + initialized = true; + } + + @AfterClass + public static void tearDownKdc() throws Exception { + if (null != krb) { + krb.stop(); + } + } + + /** + * The {@link TestingKdc} used for this {@link AccumuloCluster}. Might be null. + */ + public static TestingKdc getKdc() { + return krb; + } + + @Before + public void setupCluster() throws Exception { + // Before we try to instantiate the cluster, check to see if the test even wants to run against this type of cluster + Assume.assumeTrue(canRunTest(type)); + + switch (type) { + case MINI: + MiniClusterHarness miniClusterHarness = new MiniClusterHarness(); + // Intrinsically performs the callback to let tests alter MiniAccumuloConfig and core-site.xml + MiniAccumuloClusterImpl impl = miniClusterHarness.create(this, getAdminToken(), krb); + cluster = impl; + // MAC makes a ClientConf for us, just set it + ((AccumuloMiniClusterConfiguration) clusterConf).setClientConf(impl.getClientConfig()); + // Login as the "root" user + if (null != krb) { + ClusterUser rootUser = krb.getRootUser(); + // Log in the 'client' user + UserGroupInformation.loginUserFromKeytab(rootUser.getPrincipal(), rootUser.getKeytab().getAbsolutePath()); + } + break; + case STANDALONE: + StandaloneAccumuloClusterConfiguration conf = (StandaloneAccumuloClusterConfiguration) clusterConf; + ClientConfiguration clientConf = conf.getClientConf(); + StandaloneAccumuloCluster standaloneCluster = new StandaloneAccumuloCluster(conf.getInstance(), clientConf, conf.getTmpDirectory(), conf.getUsers(), + conf.getAccumuloServerUser()); + // If these are provided in the configuration, pass them into the cluster + standaloneCluster.setAccumuloHome(conf.getAccumuloHome()); + standaloneCluster.setClientAccumuloConfDir(conf.getClientAccumuloConfDir()); + standaloneCluster.setServerAccumuloConfDir(conf.getServerAccumuloConfDir()); + standaloneCluster.setHadoopConfDir(conf.getHadoopConfDir()); + + // For SASL, we need to get the Hadoop configuration files as well otherwise UGI will log in as SIMPLE instead of KERBEROS + Configuration hadoopConfiguration = standaloneCluster.getHadoopConfiguration(); + if (clientConf.getBoolean(ClientProperty.INSTANCE_RPC_SASL_ENABLED.getKey(), false)) { + UserGroupInformation.setConfiguration(hadoopConfiguration); + // Login as the admin user to start the tests + UserGroupInformation.loginUserFromKeytab(conf.getAdminPrincipal(), conf.getAdminKeytab().getAbsolutePath()); + } + + // Set the implementation + cluster = standaloneCluster; + break; + default: + throw new RuntimeException("Unhandled type"); + } + + if (type.isDynamic()) { + cluster.start(); + } else { + log.info("Removing tables which appear to be from a previous test run"); + cleanupTables(); + log.info("Removing users which appear to be from a previous test run"); + cleanupUsers(); + } + + switch (type) { + case MINI: + if (null != krb) { + final String traceTable = Property.TRACE_TABLE.getDefaultValue(); + final ClusterUser systemUser = krb.getAccumuloServerUser(), rootUser = krb.getRootUser(); + + // Login as the trace user + UserGroupInformation.loginUserFromKeytab(systemUser.getPrincipal(), systemUser.getKeytab().getAbsolutePath()); + + // Open a connector as the system user (ensures the user will exist for us to assign permissions to) + Connector conn = cluster.getConnector(systemUser.getPrincipal(), new KerberosToken(systemUser.getPrincipal(), systemUser.getKeytab(), true)); + + // Then, log back in as the "root" user and do the grant + UserGroupInformation.loginUserFromKeytab(rootUser.getPrincipal(), rootUser.getKeytab().getAbsolutePath()); + conn = getConnector(); + + // Create the trace table + conn.tableOperations().create(traceTable); + + // Trace user (which is the same kerberos principal as the system user, but using a normal KerberosToken) needs + // to have the ability to read, write and alter the trace table + conn.securityOperations().grantTablePermission(systemUser.getPrincipal(), traceTable, TablePermission.READ); + conn.securityOperations().grantTablePermission(systemUser.getPrincipal(), traceTable, TablePermission.WRITE); + conn.securityOperations().grantTablePermission(systemUser.getPrincipal(), traceTable, TablePermission.ALTER_TABLE); + } + break; + default: + // do nothing + } + } + + public void cleanupTables() throws Exception { + final String tablePrefix = this.getClass().getSimpleName() + "_"; + final TableOperations tops = getConnector().tableOperations(); + for (String table : tops.list()) { + if (table.startsWith(tablePrefix)) { + log.debug("Removing table {}", table); + tops.delete(table); + } + } + } + + public void cleanupUsers() throws Exception { + final String userPrefix = this.getClass().getSimpleName(); + final SecurityOperations secOps = getConnector().securityOperations(); + for (String user : secOps.listLocalUsers()) { + if (user.startsWith(userPrefix)) { + log.info("Dropping local user {}", user); + secOps.dropLocalUser(user); + } + } + } + + @After + public void teardownCluster() throws Exception { + if (null != cluster) { + if (type.isDynamic()) { + cluster.stop(); + } else { + log.info("Removing tables which appear to be from the current test"); + cleanupTables(); + log.info("Removing users which appear to be from the current test"); + cleanupUsers(); + } + } + } + + public static AccumuloCluster getCluster() { + Preconditions.checkState(initialized); + return cluster; + } + + public static ClusterControl getClusterControl() { + Preconditions.checkState(initialized); + return cluster.getClusterControl(); + } + + public static ClusterType getClusterType() { + Preconditions.checkState(initialized); + return type; + } + + public static String getAdminPrincipal() { + Preconditions.checkState(initialized); + return clusterConf.getAdminPrincipal(); + } + + public static AuthenticationToken getAdminToken() { + Preconditions.checkState(initialized); + return clusterConf.getAdminToken(); + } + + @Override + public ClusterUser getAdminUser() { + switch (type) { + case MINI: + if (null == krb) { + PasswordToken passwordToken = (PasswordToken) getAdminToken(); + return new ClusterUser(getAdminPrincipal(), new String(passwordToken.getPassword(), UTF_8)); + } + return krb.getRootUser(); + case STANDALONE: + return new ClusterUser(getAdminPrincipal(), ((StandaloneAccumuloClusterConfiguration) clusterConf).getAdminKeytab()); + default: + throw new RuntimeException("Unknown cluster type"); + } + } + + @Override + public ClusterUser getUser(int offset) { + switch (type) { + case MINI: + if (null != krb) { + // Defer to the TestingKdc when kerberos is on so we can get the keytab instead of a password + return krb.getClientPrincipal(offset); + } else { + // Come up with a mostly unique name + String principal = getClass().getSimpleName() + "_" + testName.getMethodName() + "_" + offset; + // Username and password are the same + return new ClusterUser(principal, principal); + } + case STANDALONE: + return ((StandaloneAccumuloCluster) cluster).getUser(offset); + default: + throw new RuntimeException("Unknown cluster type"); + } + } + + public static FileSystem getFileSystem() throws IOException { + Preconditions.checkState(initialized); + return cluster.getFileSystem(); + } + + public static AccumuloClusterConfiguration getClusterConfiguration() { + Preconditions.checkState(initialized); + return clusterConf; + } + + public Connector getConnector() { + try { + String princ = getAdminPrincipal(); + AuthenticationToken token = getAdminToken(); + log.debug("Creating connector as {} with {}", princ, token); + return cluster.getConnector(princ, token); + } catch (Exception e) { + log.error("Could not connect to Accumulo", e); + fail("Could not connect to Accumulo: " + e.getMessage()); + + throw new RuntimeException("Could not connect to Accumulo", e); + } + } + + // TODO Really don't want this here. Will ultimately need to abstract configuration method away from MAConfig + // and change over to something more generic + @Override + public void configureMiniCluster(MiniAccumuloConfigImpl cfg, Configuration hadoopCoreSite) {} + + /** + * A test may not be capable of running against a given AccumuloCluster. Implementations can override this method to advertise that they cannot (or perhaps do + * not) want to run the test. + */ + public boolean canRunTest(ClusterType type) { + return true; + } + + /** + * Tries to give a reasonable directory which can be used to create temporary files for the test. Makes a basic attempt to create the directory if it does not + * already exist. + * + * @return A directory which can be expected to exist on the Cluster's FileSystem + */ + public Path getUsableDir() throws IllegalArgumentException, IOException { + return cluster.getTemporaryPath(); + } +} http://git-wip-us.apache.org/repos/asf/accumulo/blob/ab5a867f/test/src/test/java/org/apache/accumulo/harness/AccumuloClusterIT.java ---------------------------------------------------------------------- diff --git a/test/src/test/java/org/apache/accumulo/harness/AccumuloClusterIT.java b/test/src/test/java/org/apache/accumulo/harness/AccumuloClusterIT.java deleted file mode 100644 index 16460ed..0000000 --- a/test/src/test/java/org/apache/accumulo/harness/AccumuloClusterIT.java +++ /dev/null @@ -1,338 +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.accumulo.harness; - -import static java.nio.charset.StandardCharsets.UTF_8; -import static org.junit.Assert.fail; - -import java.io.IOException; - -import org.apache.accumulo.cluster.AccumuloCluster; -import org.apache.accumulo.cluster.ClusterControl; -import org.apache.accumulo.cluster.ClusterUser; -import org.apache.accumulo.cluster.ClusterUsers; -import org.apache.accumulo.cluster.standalone.StandaloneAccumuloCluster; -import org.apache.accumulo.core.client.ClientConfiguration; -import org.apache.accumulo.core.client.ClientConfiguration.ClientProperty; -import org.apache.accumulo.core.client.Connector; -import org.apache.accumulo.core.client.admin.SecurityOperations; -import org.apache.accumulo.core.client.admin.TableOperations; -import org.apache.accumulo.core.client.security.tokens.AuthenticationToken; -import org.apache.accumulo.core.client.security.tokens.KerberosToken; -import org.apache.accumulo.core.client.security.tokens.PasswordToken; -import org.apache.accumulo.core.conf.Property; -import org.apache.accumulo.core.security.TablePermission; -import org.apache.accumulo.harness.conf.AccumuloClusterConfiguration; -import org.apache.accumulo.harness.conf.AccumuloClusterPropertyConfiguration; -import org.apache.accumulo.harness.conf.AccumuloMiniClusterConfiguration; -import org.apache.accumulo.harness.conf.StandaloneAccumuloClusterConfiguration; -import org.apache.accumulo.minicluster.impl.MiniAccumuloClusterImpl; -import org.apache.accumulo.minicluster.impl.MiniAccumuloConfigImpl; -import org.apache.hadoop.conf.Configuration; -import org.apache.hadoop.fs.FileSystem; -import org.apache.hadoop.fs.Path; -import org.apache.hadoop.security.UserGroupInformation; -import org.junit.After; -import org.junit.AfterClass; -import org.junit.Assume; -import org.junit.Before; -import org.junit.BeforeClass; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -import com.google.common.base.Preconditions; - -/** - * General Integration-Test base class that provides access to an Accumulo instance for testing. This instance could be MAC or a standalone instance. - */ -public abstract class AccumuloClusterIT extends AccumuloIT implements MiniClusterConfigurationCallback, ClusterUsers { - private static final Logger log = LoggerFactory.getLogger(AccumuloClusterIT.class); - private static final String TRUE = Boolean.toString(true); - - public static enum ClusterType { - MINI, STANDALONE; - - public boolean isDynamic() { - return this == MINI; - } - } - - private static boolean initialized = false; - - protected static AccumuloCluster cluster; - protected static ClusterType type; - protected static AccumuloClusterPropertyConfiguration clusterConf; - protected static TestingKdc krb; - - @BeforeClass - public static void setUp() throws Exception { - clusterConf = AccumuloClusterPropertyConfiguration.get(); - type = clusterConf.getClusterType(); - - if (ClusterType.MINI == type && TRUE.equals(System.getProperty(MiniClusterHarness.USE_KERBEROS_FOR_IT_OPTION))) { - krb = new TestingKdc(); - krb.start(); - log.info("MiniKdc started"); - } - - initialized = true; - } - - @AfterClass - public static void tearDownKdc() throws Exception { - if (null != krb) { - krb.stop(); - } - } - - /** - * The {@link TestingKdc} used for this {@link AccumuloCluster}. Might be null. - */ - public static TestingKdc getKdc() { - return krb; - } - - @Before - public void setupCluster() throws Exception { - // Before we try to instantiate the cluster, check to see if the test even wants to run against this type of cluster - Assume.assumeTrue(canRunTest(type)); - - switch (type) { - case MINI: - MiniClusterHarness miniClusterHarness = new MiniClusterHarness(); - // Intrinsically performs the callback to let tests alter MiniAccumuloConfig and core-site.xml - MiniAccumuloClusterImpl impl = miniClusterHarness.create(this, getAdminToken(), krb); - cluster = impl; - // MAC makes a ClientConf for us, just set it - ((AccumuloMiniClusterConfiguration) clusterConf).setClientConf(impl.getClientConfig()); - // Login as the "root" user - if (null != krb) { - ClusterUser rootUser = krb.getRootUser(); - // Log in the 'client' user - UserGroupInformation.loginUserFromKeytab(rootUser.getPrincipal(), rootUser.getKeytab().getAbsolutePath()); - } - break; - case STANDALONE: - StandaloneAccumuloClusterConfiguration conf = (StandaloneAccumuloClusterConfiguration) clusterConf; - ClientConfiguration clientConf = conf.getClientConf(); - StandaloneAccumuloCluster standaloneCluster = new StandaloneAccumuloCluster(conf.getInstance(), clientConf, conf.getTmpDirectory(), conf.getUsers(), - conf.getAccumuloServerUser()); - // If these are provided in the configuration, pass them into the cluster - standaloneCluster.setAccumuloHome(conf.getAccumuloHome()); - standaloneCluster.setClientAccumuloConfDir(conf.getClientAccumuloConfDir()); - standaloneCluster.setServerAccumuloConfDir(conf.getServerAccumuloConfDir()); - standaloneCluster.setHadoopConfDir(conf.getHadoopConfDir()); - - // For SASL, we need to get the Hadoop configuration files as well otherwise UGI will log in as SIMPLE instead of KERBEROS - Configuration hadoopConfiguration = standaloneCluster.getHadoopConfiguration(); - if (clientConf.getBoolean(ClientProperty.INSTANCE_RPC_SASL_ENABLED.getKey(), false)) { - UserGroupInformation.setConfiguration(hadoopConfiguration); - // Login as the admin user to start the tests - UserGroupInformation.loginUserFromKeytab(conf.getAdminPrincipal(), conf.getAdminKeytab().getAbsolutePath()); - } - - // Set the implementation - cluster = standaloneCluster; - break; - default: - throw new RuntimeException("Unhandled type"); - } - - if (type.isDynamic()) { - cluster.start(); - } else { - log.info("Removing tables which appear to be from a previous test run"); - cleanupTables(); - log.info("Removing users which appear to be from a previous test run"); - cleanupUsers(); - } - - switch (type) { - case MINI: - if (null != krb) { - final String traceTable = Property.TRACE_TABLE.getDefaultValue(); - final ClusterUser systemUser = krb.getAccumuloServerUser(), rootUser = krb.getRootUser(); - - // Login as the trace user - UserGroupInformation.loginUserFromKeytab(systemUser.getPrincipal(), systemUser.getKeytab().getAbsolutePath()); - - // Open a connector as the system user (ensures the user will exist for us to assign permissions to) - Connector conn = cluster.getConnector(systemUser.getPrincipal(), new KerberosToken(systemUser.getPrincipal(), systemUser.getKeytab(), true)); - - // Then, log back in as the "root" user and do the grant - UserGroupInformation.loginUserFromKeytab(rootUser.getPrincipal(), rootUser.getKeytab().getAbsolutePath()); - conn = getConnector(); - - // Create the trace table - conn.tableOperations().create(traceTable); - - // Trace user (which is the same kerberos principal as the system user, but using a normal KerberosToken) needs - // to have the ability to read, write and alter the trace table - conn.securityOperations().grantTablePermission(systemUser.getPrincipal(), traceTable, TablePermission.READ); - conn.securityOperations().grantTablePermission(systemUser.getPrincipal(), traceTable, TablePermission.WRITE); - conn.securityOperations().grantTablePermission(systemUser.getPrincipal(), traceTable, TablePermission.ALTER_TABLE); - } - break; - default: - // do nothing - } - } - - public void cleanupTables() throws Exception { - final String tablePrefix = this.getClass().getSimpleName() + "_"; - final TableOperations tops = getConnector().tableOperations(); - for (String table : tops.list()) { - if (table.startsWith(tablePrefix)) { - log.debug("Removing table {}", table); - tops.delete(table); - } - } - } - - public void cleanupUsers() throws Exception { - final String userPrefix = this.getClass().getSimpleName(); - final SecurityOperations secOps = getConnector().securityOperations(); - for (String user : secOps.listLocalUsers()) { - if (user.startsWith(userPrefix)) { - log.info("Dropping local user {}", user); - secOps.dropLocalUser(user); - } - } - } - - @After - public void teardownCluster() throws Exception { - if (null != cluster) { - if (type.isDynamic()) { - cluster.stop(); - } else { - log.info("Removing tables which appear to be from the current test"); - cleanupTables(); - log.info("Removing users which appear to be from the current test"); - cleanupUsers(); - } - } - } - - public static AccumuloCluster getCluster() { - Preconditions.checkState(initialized); - return cluster; - } - - public static ClusterControl getClusterControl() { - Preconditions.checkState(initialized); - return cluster.getClusterControl(); - } - - public static ClusterType getClusterType() { - Preconditions.checkState(initialized); - return type; - } - - public static String getAdminPrincipal() { - Preconditions.checkState(initialized); - return clusterConf.getAdminPrincipal(); - } - - public static AuthenticationToken getAdminToken() { - Preconditions.checkState(initialized); - return clusterConf.getAdminToken(); - } - - @Override - public ClusterUser getAdminUser() { - switch (type) { - case MINI: - if (null == krb) { - PasswordToken passwordToken = (PasswordToken) getAdminToken(); - return new ClusterUser(getAdminPrincipal(), new String(passwordToken.getPassword(), UTF_8)); - } - return krb.getRootUser(); - case STANDALONE: - return new ClusterUser(getAdminPrincipal(), ((StandaloneAccumuloClusterConfiguration) clusterConf).getAdminKeytab()); - default: - throw new RuntimeException("Unknown cluster type"); - } - } - - @Override - public ClusterUser getUser(int offset) { - switch (type) { - case MINI: - if (null != krb) { - // Defer to the TestingKdc when kerberos is on so we can get the keytab instead of a password - return krb.getClientPrincipal(offset); - } else { - // Come up with a mostly unique name - String principal = getClass().getSimpleName() + "_" + testName.getMethodName() + "_" + offset; - // Username and password are the same - return new ClusterUser(principal, principal); - } - case STANDALONE: - return ((StandaloneAccumuloCluster) cluster).getUser(offset); - default: - throw new RuntimeException("Unknown cluster type"); - } - } - - public static FileSystem getFileSystem() throws IOException { - Preconditions.checkState(initialized); - return cluster.getFileSystem(); - } - - public static AccumuloClusterConfiguration getClusterConfiguration() { - Preconditions.checkState(initialized); - return clusterConf; - } - - public Connector getConnector() { - try { - String princ = getAdminPrincipal(); - AuthenticationToken token = getAdminToken(); - log.debug("Creating connector as {} with {}", princ, token); - return cluster.getConnector(princ, token); - } catch (Exception e) { - log.error("Could not connect to Accumulo", e); - fail("Could not connect to Accumulo: " + e.getMessage()); - - throw new RuntimeException("Could not connect to Accumulo", e); - } - } - - // TODO Really don't want this here. Will ultimately need to abstract configuration method away from MAConfig - // and change over to something more generic - @Override - public void configureMiniCluster(MiniAccumuloConfigImpl cfg, Configuration hadoopCoreSite) {} - - /** - * A test may not be capable of running against a given AccumuloCluster. Implementations can override this method to advertise that they cannot (or perhaps do - * not) want to run the test. - */ - public boolean canRunTest(ClusterType type) { - return true; - } - - /** - * Tries to give a reasonable directory which can be used to create temporary files for the test. Makes a basic attempt to create the directory if it does not - * already exist. - * - * @return A directory which can be expected to exist on the Cluster's FileSystem - */ - public Path getUsableDir() throws IllegalArgumentException, IOException { - return cluster.getTemporaryPath(); - } -} http://git-wip-us.apache.org/repos/asf/accumulo/blob/ab5a867f/test/src/test/java/org/apache/accumulo/harness/AccumuloIT.java ---------------------------------------------------------------------- diff --git a/test/src/test/java/org/apache/accumulo/harness/AccumuloIT.java b/test/src/test/java/org/apache/accumulo/harness/AccumuloIT.java deleted file mode 100644 index 03ee44c..0000000 --- a/test/src/test/java/org/apache/accumulo/harness/AccumuloIT.java +++ /dev/null @@ -1,104 +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.accumulo.harness; - -import static org.junit.Assert.assertTrue; - -import java.io.File; - -import org.apache.commons.io.FileUtils; -import org.junit.Rule; -import org.junit.rules.TestName; -import org.junit.rules.Timeout; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * Methods, setup and/or infrastructure which are common to any Accumulo integration test. - */ -public class AccumuloIT { - private static final Logger log = LoggerFactory.getLogger(AccumuloIT.class); - - @Rule - public TestName testName = new TestName(); - - public String[] getUniqueNames(int num) { - String[] names = new String[num]; - for (int i = 0; i < num; i++) - names[i] = this.getClass().getSimpleName() + "_" + testName.getMethodName() + i; - return names; - } - - /** - * Determines an appropriate directory name for holding generated ssl files for a test. The directory returned will have the same name as the provided - * directory, but with the suffix "-ssl" appended. This new directory is not created here, but is expected to be created as needed. - * - * @param baseDir - * the original directory, which the new directory will be created next to; it should exist - * @return the new directory (is not created) - */ - public static File getSslDir(File baseDir) { - assertTrue(baseDir.exists() && baseDir.isDirectory()); - return new File(baseDir.getParentFile(), baseDir.getName() + "-ssl"); - } - - public static File createTestDir(String name) { - File baseDir = new File(System.getProperty("user.dir") + "/target/mini-tests"); - assertTrue(baseDir.mkdirs() || baseDir.isDirectory()); - if (name == null) - return baseDir; - File testDir = new File(baseDir, name); - FileUtils.deleteQuietly(testDir); - assertTrue(testDir.mkdir()); - return testDir; - } - - /** - * If a given IT test has a method that takes longer than a class-set default timeout, declare it failed. - * - * Note that this provides a upper bound on test times, even in the presence of Test annotations with a timeout. That is, the Test annotatation can make the - * timing tighter but will not be able to allow a timeout that takes longer. - * - * Defaults to no timeout and can be changed via two mechanisms - * - * 1) A given IT class can override the defaultTimeoutSeconds method if test methods in that class should have a timeout. 2) The system property - * "timeout.factor" is used as a multiplier for the class provided default - * - * Note that if either of these values is '0' tests will run with no timeout. The default class level timeout is set to 0. - * - */ - @Rule - public Timeout testsShouldTimeout() { - int waitLonger = 0; - try { - String timeoutString = System.getProperty("timeout.factor"); - if (timeoutString != null && !timeoutString.isEmpty()) { - waitLonger = Integer.parseInt(timeoutString); - } - } catch (NumberFormatException exception) { - log.warn("Could not parse timeout.factor, defaulting to no timeout."); - } - return new Timeout(waitLonger * defaultTimeoutSeconds() * 1000); - } - - /** - * time to wait per-method before declaring a timeout, in seconds. - */ - protected int defaultTimeoutSeconds() { - return 0; - } -} http://git-wip-us.apache.org/repos/asf/accumulo/blob/ab5a867f/test/src/test/java/org/apache/accumulo/harness/AccumuloITBase.java ---------------------------------------------------------------------- diff --git a/test/src/test/java/org/apache/accumulo/harness/AccumuloITBase.java b/test/src/test/java/org/apache/accumulo/harness/AccumuloITBase.java new file mode 100644 index 0000000..8e2f6e0 --- /dev/null +++ b/test/src/test/java/org/apache/accumulo/harness/AccumuloITBase.java @@ -0,0 +1,104 @@ +/* + * 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.accumulo.harness; + +import static org.junit.Assert.assertTrue; + +import java.io.File; + +import org.apache.commons.io.FileUtils; +import org.junit.Rule; +import org.junit.rules.TestName; +import org.junit.rules.Timeout; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * Methods, setup and/or infrastructure which are common to any Accumulo integration test. + */ +public class AccumuloITBase { + private static final Logger log = LoggerFactory.getLogger(AccumuloITBase.class); + + @Rule + public TestName testName = new TestName(); + + public String[] getUniqueNames(int num) { + String[] names = new String[num]; + for (int i = 0; i < num; i++) + names[i] = this.getClass().getSimpleName() + "_" + testName.getMethodName() + i; + return names; + } + + /** + * Determines an appropriate directory name for holding generated ssl files for a test. The directory returned will have the same name as the provided + * directory, but with the suffix "-ssl" appended. This new directory is not created here, but is expected to be created as needed. + * + * @param baseDir + * the original directory, which the new directory will be created next to; it should exist + * @return the new directory (is not created) + */ + public static File getSslDir(File baseDir) { + assertTrue(baseDir.exists() && baseDir.isDirectory()); + return new File(baseDir.getParentFile(), baseDir.getName() + "-ssl"); + } + + public static File createTestDir(String name) { + File baseDir = new File(System.getProperty("user.dir") + "/target/mini-tests"); + assertTrue(baseDir.mkdirs() || baseDir.isDirectory()); + if (name == null) + return baseDir; + File testDir = new File(baseDir, name); + FileUtils.deleteQuietly(testDir); + assertTrue(testDir.mkdir()); + return testDir; + } + + /** + * If a given IT test has a method that takes longer than a class-set default timeout, declare it failed. + * + * Note that this provides a upper bound on test times, even in the presence of Test annotations with a timeout. That is, the Test annotatation can make the + * timing tighter but will not be able to allow a timeout that takes longer. + * + * Defaults to no timeout and can be changed via two mechanisms + * + * 1) A given IT class can override the defaultTimeoutSeconds method if test methods in that class should have a timeout. 2) The system property + * "timeout.factor" is used as a multiplier for the class provided default + * + * Note that if either of these values is '0' tests will run with no timeout. The default class level timeout is set to 0. + * + */ + @Rule + public Timeout testsShouldTimeout() { + int waitLonger = 0; + try { + String timeoutString = System.getProperty("timeout.factor"); + if (timeoutString != null && !timeoutString.isEmpty()) { + waitLonger = Integer.parseInt(timeoutString); + } + } catch (NumberFormatException exception) { + log.warn("Could not parse timeout.factor, defaulting to no timeout."); + } + return new Timeout(waitLonger * defaultTimeoutSeconds() * 1000); + } + + /** + * time to wait per-method before declaring a timeout, in seconds. + */ + protected int defaultTimeoutSeconds() { + return 0; + } +} http://git-wip-us.apache.org/repos/asf/accumulo/blob/ab5a867f/test/src/test/java/org/apache/accumulo/harness/MiniClusterHarness.java ---------------------------------------------------------------------- diff --git a/test/src/test/java/org/apache/accumulo/harness/MiniClusterHarness.java b/test/src/test/java/org/apache/accumulo/harness/MiniClusterHarness.java index 5d32cb1..d923593 100644 --- a/test/src/test/java/org/apache/accumulo/harness/MiniClusterHarness.java +++ b/test/src/test/java/org/apache/accumulo/harness/MiniClusterHarness.java @@ -72,24 +72,24 @@ public class MiniClusterHarness { return create(MiniClusterHarness.class.getName(), Long.toString(COUNTER.incrementAndGet()), token, kdc); } - public MiniAccumuloClusterImpl create(AccumuloIT testBase, AuthenticationToken token) throws Exception { + public MiniAccumuloClusterImpl create(AccumuloITBase testBase, AuthenticationToken token) throws Exception { return create(testBase.getClass().getName(), testBase.testName.getMethodName(), token); } - public MiniAccumuloClusterImpl create(AccumuloIT testBase, AuthenticationToken token, TestingKdc kdc) throws Exception { + public MiniAccumuloClusterImpl create(AccumuloITBase testBase, AuthenticationToken token, TestingKdc kdc) throws Exception { return create(testBase, token, kdc, MiniClusterConfigurationCallback.NO_CALLBACK); } - public MiniAccumuloClusterImpl create(AccumuloIT testBase, AuthenticationToken token, TestingKdc kdc, MiniClusterConfigurationCallback configCallback) + public MiniAccumuloClusterImpl create(AccumuloITBase testBase, AuthenticationToken token, TestingKdc kdc, MiniClusterConfigurationCallback configCallback) throws Exception { return create(testBase.getClass().getName(), testBase.testName.getMethodName(), token, configCallback, kdc); } - public MiniAccumuloClusterImpl create(AccumuloClusterIT testBase, AuthenticationToken token, TestingKdc kdc) throws Exception { + public MiniAccumuloClusterImpl create(AccumuloClusterHarness testBase, AuthenticationToken token, TestingKdc kdc) throws Exception { return create(testBase.getClass().getName(), testBase.testName.getMethodName(), token, testBase, kdc); } - public MiniAccumuloClusterImpl create(AccumuloClusterIT testBase, AuthenticationToken token, MiniClusterConfigurationCallback callback) throws Exception { + public MiniAccumuloClusterImpl create(AccumuloClusterHarness testBase, AuthenticationToken token, MiniClusterConfigurationCallback callback) throws Exception { return create(testBase.getClass().getName(), testBase.testName.getMethodName(), token, callback); } @@ -118,7 +118,7 @@ public class MiniClusterHarness { rootPasswd = UUID.randomUUID().toString(); } - File baseDir = AccumuloClusterIT.createTestDir(testClassName + "_" + testMethodName); + File baseDir = AccumuloClusterHarness.createTestDir(testClassName + "_" + testMethodName); MiniAccumuloConfigImpl cfg = new MiniAccumuloConfigImpl(baseDir, rootPasswd); // Enable native maps by default @@ -128,7 +128,7 @@ public class MiniClusterHarness { Configuration coreSite = new Configuration(false); // Setup SSL and credential providers if the properties request such - configureForEnvironment(cfg, getClass(), AccumuloClusterIT.getSslDir(baseDir), coreSite, kdc); + configureForEnvironment(cfg, getClass(), AccumuloClusterHarness.getSslDir(baseDir), coreSite, kdc); // Invoke the callback for tests to configure MAC before it starts configCallback.configureMiniCluster(cfg, coreSite); http://git-wip-us.apache.org/repos/asf/accumulo/blob/ab5a867f/test/src/test/java/org/apache/accumulo/harness/SharedMiniClusterBase.java ---------------------------------------------------------------------- diff --git a/test/src/test/java/org/apache/accumulo/harness/SharedMiniClusterBase.java b/test/src/test/java/org/apache/accumulo/harness/SharedMiniClusterBase.java new file mode 100644 index 0000000..433e035 --- /dev/null +++ b/test/src/test/java/org/apache/accumulo/harness/SharedMiniClusterBase.java @@ -0,0 +1,185 @@ +/* + * 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.accumulo.harness; + +import static org.junit.Assert.assertTrue; + +import java.io.File; +import java.io.IOException; +import java.util.Random; + +import org.apache.accumulo.cluster.ClusterUser; +import org.apache.accumulo.cluster.ClusterUsers; +import org.apache.accumulo.core.client.Connector; +import org.apache.accumulo.core.client.security.tokens.AuthenticationToken; +import org.apache.accumulo.core.client.security.tokens.KerberosToken; +import org.apache.accumulo.core.client.security.tokens.PasswordToken; +import org.apache.accumulo.core.conf.Property; +import org.apache.accumulo.core.security.TablePermission; +import org.apache.accumulo.minicluster.impl.MiniAccumuloClusterImpl; +import org.apache.hadoop.conf.Configuration; +import org.apache.hadoop.fs.CommonConfigurationKeysPublic; +import org.apache.hadoop.security.UserGroupInformation; +import org.junit.AfterClass; +import org.junit.BeforeClass; +import org.slf4j.Logger; +import org.slf4j.LoggerFactory; + +/** + * Convenience class which starts a single MAC instance for a test to leverage. + * + * There isn't a good way to build this off of the {@link AccumuloClusterHarness} (as would be the logical place) because we need to start the MiniAccumuloCluster in + * a static BeforeClass-annotated method. Because it is static and invoked before any other BeforeClass methods in the implementation, the actual test classes + * can't expose any information to tell the base class that it is to perform the one-MAC-per-class semantics. + */ +public abstract class SharedMiniClusterBase extends AccumuloITBase implements ClusterUsers { + private static final Logger log = LoggerFactory.getLogger(SharedMiniClusterBase.class); + public static final String TRUE = Boolean.toString(true); + + private static String principal = "root"; + private static String rootPassword; + private static AuthenticationToken token; + private static MiniAccumuloClusterImpl cluster; + private static TestingKdc krb; + + @BeforeClass + public static void startMiniCluster() throws Exception { + File baseDir = new File(System.getProperty("user.dir") + "/target/mini-tests"); + assertTrue(baseDir.mkdirs() || baseDir.isDirectory()); + + // Make a shared MAC instance instead of spinning up one per test method + MiniClusterHarness harness = new MiniClusterHarness(); + + if (TRUE.equals(System.getProperty(MiniClusterHarness.USE_KERBEROS_FOR_IT_OPTION))) { + krb = new TestingKdc(); + krb.start(); + // Enabled krb auth + Configuration conf = new Configuration(false); + conf.set(CommonConfigurationKeysPublic.HADOOP_SECURITY_AUTHENTICATION, "kerberos"); + UserGroupInformation.setConfiguration(conf); + // Login as the client + ClusterUser rootUser = krb.getRootUser(); + // Get the krb token + principal = rootUser.getPrincipal(); + token = new KerberosToken(principal, rootUser.getKeytab(), true); + } else { + rootPassword = "rootPasswordShared1"; + token = new PasswordToken(rootPassword); + } + + cluster = harness.create(SharedMiniClusterBase.class.getName(), System.currentTimeMillis() + "_" + new Random().nextInt(Short.MAX_VALUE), token, krb); + cluster.start(); + + if (null != krb) { + final String traceTable = Property.TRACE_TABLE.getDefaultValue(); + final ClusterUser systemUser = krb.getAccumuloServerUser(), rootUser = krb.getRootUser(); + // Login as the trace user + // Open a connector as the system user (ensures the user will exist for us to assign permissions to) + Connector conn = cluster.getConnector(systemUser.getPrincipal(), new KerberosToken(systemUser.getPrincipal(), systemUser.getKeytab(), true)); + + // Then, log back in as the "root" user and do the grant + UserGroupInformation.loginUserFromKeytab(rootUser.getPrincipal(), rootUser.getKeytab().getAbsolutePath()); + conn = cluster.getConnector(principal, token); + + // Create the trace table + conn.tableOperations().create(traceTable); + + // Trace user (which is the same kerberos principal as the system user, but using a normal KerberosToken) needs + // to have the ability to read, write and alter the trace table + conn.securityOperations().grantTablePermission(systemUser.getPrincipal(), traceTable, TablePermission.READ); + conn.securityOperations().grantTablePermission(systemUser.getPrincipal(), traceTable, TablePermission.WRITE); + conn.securityOperations().grantTablePermission(systemUser.getPrincipal(), traceTable, TablePermission.ALTER_TABLE); + } + } + + @AfterClass + public static void stopMiniCluster() throws Exception { + if (null != cluster) { + try { + cluster.stop(); + } catch (Exception e) { + log.error("Failed to stop minicluster", e); + } + } + if (null != krb) { + try { + krb.stop(); + } catch (Exception e) { + log.error("Failed to stop KDC", e); + } + } + } + + public static String getRootPassword() { + return rootPassword; + } + + public static AuthenticationToken getToken() { + if (token instanceof KerberosToken) { + try { + UserGroupInformation.loginUserFromKeytab(getPrincipal(), krb.getRootUser().getKeytab().getAbsolutePath()); + } catch (IOException e) { + throw new RuntimeException("Failed to login", e); + } + } + return token; + } + + public static String getPrincipal() { + return principal; + } + + public static MiniAccumuloClusterImpl getCluster() { + return cluster; + } + + public static File getMiniClusterDir() { + return cluster.getConfig().getDir(); + } + + public static Connector getConnector() { + try { + return getCluster().getConnector(principal, getToken()); + } catch (Exception e) { + throw new RuntimeException(e); + } + } + + public static TestingKdc getKdc() { + return krb; + } + + @Override + public ClusterUser getAdminUser() { + if (null == krb) { + return new ClusterUser(getPrincipal(), getRootPassword()); + } else { + return krb.getRootUser(); + } + } + + @Override + public ClusterUser getUser(int offset) { + if (null == krb) { + String user = SharedMiniClusterBase.class.getName() + "_" + testName.getMethodName() + "_" + offset; + // Password is the username + return new ClusterUser(user, user); + } else { + return krb.getClientPrincipal(offset); + } + } +} http://git-wip-us.apache.org/repos/asf/accumulo/blob/ab5a867f/test/src/test/java/org/apache/accumulo/harness/SharedMiniClusterIT.java ---------------------------------------------------------------------- diff --git a/test/src/test/java/org/apache/accumulo/harness/SharedMiniClusterIT.java b/test/src/test/java/org/apache/accumulo/harness/SharedMiniClusterIT.java deleted file mode 100644 index 4a2501f..0000000 --- a/test/src/test/java/org/apache/accumulo/harness/SharedMiniClusterIT.java +++ /dev/null @@ -1,185 +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.accumulo.harness; - -import static org.junit.Assert.assertTrue; - -import java.io.File; -import java.io.IOException; -import java.util.Random; - -import org.apache.accumulo.cluster.ClusterUser; -import org.apache.accumulo.cluster.ClusterUsers; -import org.apache.accumulo.core.client.Connector; -import org.apache.accumulo.core.client.security.tokens.AuthenticationToken; -import org.apache.accumulo.core.client.security.tokens.KerberosToken; -import org.apache.accumulo.core.client.security.tokens.PasswordToken; -import org.apache.accumulo.core.conf.Property; -import org.apache.accumulo.core.security.TablePermission; -import org.apache.accumulo.minicluster.impl.MiniAccumuloClusterImpl; -import org.apache.hadoop.conf.Configuration; -import org.apache.hadoop.fs.CommonConfigurationKeysPublic; -import org.apache.hadoop.security.UserGroupInformation; -import org.junit.AfterClass; -import org.junit.BeforeClass; -import org.slf4j.Logger; -import org.slf4j.LoggerFactory; - -/** - * Convenience class which starts a single MAC instance for a test to leverage. - * - * There isn't a good way to build this off of the {@link AccumuloClusterIT} (as would be the logical place) because we need to start the MiniAccumuloCluster in - * a static BeforeClass-annotated method. Because it is static and invoked before any other BeforeClass methods in the implementation, the actual test classes - * can't expose any information to tell the base class that it is to perform the one-MAC-per-class semantics. - */ -public abstract class SharedMiniClusterIT extends AccumuloIT implements ClusterUsers { - private static final Logger log = LoggerFactory.getLogger(SharedMiniClusterIT.class); - public static final String TRUE = Boolean.toString(true); - - private static String principal = "root"; - private static String rootPassword; - private static AuthenticationToken token; - private static MiniAccumuloClusterImpl cluster; - private static TestingKdc krb; - - @BeforeClass - public static void startMiniCluster() throws Exception { - File baseDir = new File(System.getProperty("user.dir") + "/target/mini-tests"); - assertTrue(baseDir.mkdirs() || baseDir.isDirectory()); - - // Make a shared MAC instance instead of spinning up one per test method - MiniClusterHarness harness = new MiniClusterHarness(); - - if (TRUE.equals(System.getProperty(MiniClusterHarness.USE_KERBEROS_FOR_IT_OPTION))) { - krb = new TestingKdc(); - krb.start(); - // Enabled krb auth - Configuration conf = new Configuration(false); - conf.set(CommonConfigurationKeysPublic.HADOOP_SECURITY_AUTHENTICATION, "kerberos"); - UserGroupInformation.setConfiguration(conf); - // Login as the client - ClusterUser rootUser = krb.getRootUser(); - // Get the krb token - principal = rootUser.getPrincipal(); - token = new KerberosToken(principal, rootUser.getKeytab(), true); - } else { - rootPassword = "rootPasswordShared1"; - token = new PasswordToken(rootPassword); - } - - cluster = harness.create(SharedMiniClusterIT.class.getName(), System.currentTimeMillis() + "_" + new Random().nextInt(Short.MAX_VALUE), token, krb); - cluster.start(); - - if (null != krb) { - final String traceTable = Property.TRACE_TABLE.getDefaultValue(); - final ClusterUser systemUser = krb.getAccumuloServerUser(), rootUser = krb.getRootUser(); - // Login as the trace user - // Open a connector as the system user (ensures the user will exist for us to assign permissions to) - Connector conn = cluster.getConnector(systemUser.getPrincipal(), new KerberosToken(systemUser.getPrincipal(), systemUser.getKeytab(), true)); - - // Then, log back in as the "root" user and do the grant - UserGroupInformation.loginUserFromKeytab(rootUser.getPrincipal(), rootUser.getKeytab().getAbsolutePath()); - conn = cluster.getConnector(principal, token); - - // Create the trace table - conn.tableOperations().create(traceTable); - - // Trace user (which is the same kerberos principal as the system user, but using a normal KerberosToken) needs - // to have the ability to read, write and alter the trace table - conn.securityOperations().grantTablePermission(systemUser.getPrincipal(), traceTable, TablePermission.READ); - conn.securityOperations().grantTablePermission(systemUser.getPrincipal(), traceTable, TablePermission.WRITE); - conn.securityOperations().grantTablePermission(systemUser.getPrincipal(), traceTable, TablePermission.ALTER_TABLE); - } - } - - @AfterClass - public static void stopMiniCluster() throws Exception { - if (null != cluster) { - try { - cluster.stop(); - } catch (Exception e) { - log.error("Failed to stop minicluster", e); - } - } - if (null != krb) { - try { - krb.stop(); - } catch (Exception e) { - log.error("Failed to stop KDC", e); - } - } - } - - public static String getRootPassword() { - return rootPassword; - } - - public static AuthenticationToken getToken() { - if (token instanceof KerberosToken) { - try { - UserGroupInformation.loginUserFromKeytab(getPrincipal(), krb.getRootUser().getKeytab().getAbsolutePath()); - } catch (IOException e) { - throw new RuntimeException("Failed to login", e); - } - } - return token; - } - - public static String getPrincipal() { - return principal; - } - - public static MiniAccumuloClusterImpl getCluster() { - return cluster; - } - - public static File getMiniClusterDir() { - return cluster.getConfig().getDir(); - } - - public static Connector getConnector() { - try { - return getCluster().getConnector(principal, getToken()); - } catch (Exception e) { - throw new RuntimeException(e); - } - } - - public static TestingKdc getKdc() { - return krb; - } - - @Override - public ClusterUser getAdminUser() { - if (null == krb) { - return new ClusterUser(getPrincipal(), getRootPassword()); - } else { - return krb.getRootUser(); - } - } - - @Override - public ClusterUser getUser(int offset) { - if (null == krb) { - String user = SharedMiniClusterIT.class.getName() + "_" + testName.getMethodName() + "_" + offset; - // Password is the username - return new ClusterUser(user, user); - } else { - return krb.getClientPrincipal(offset); - } - } -} http://git-wip-us.apache.org/repos/asf/accumulo/blob/ab5a867f/test/src/test/java/org/apache/accumulo/harness/conf/AccumuloClusterConfiguration.java ---------------------------------------------------------------------- diff --git a/test/src/test/java/org/apache/accumulo/harness/conf/AccumuloClusterConfiguration.java b/test/src/test/java/org/apache/accumulo/harness/conf/AccumuloClusterConfiguration.java index 3ce83b8..31ed94a 100644 --- a/test/src/test/java/org/apache/accumulo/harness/conf/AccumuloClusterConfiguration.java +++ b/test/src/test/java/org/apache/accumulo/harness/conf/AccumuloClusterConfiguration.java @@ -18,7 +18,7 @@ package org.apache.accumulo.harness.conf; import org.apache.accumulo.core.client.ClientConfiguration; import org.apache.accumulo.core.client.security.tokens.AuthenticationToken; -import org.apache.accumulo.harness.AccumuloClusterIT.ClusterType; +import org.apache.accumulo.harness.AccumuloClusterHarness.ClusterType; /** * Base functionality that must be provided as configuration to the test http://git-wip-us.apache.org/repos/asf/accumulo/blob/ab5a867f/test/src/test/java/org/apache/accumulo/harness/conf/AccumuloClusterPropertyConfiguration.java ---------------------------------------------------------------------- diff --git a/test/src/test/java/org/apache/accumulo/harness/conf/AccumuloClusterPropertyConfiguration.java b/test/src/test/java/org/apache/accumulo/harness/conf/AccumuloClusterPropertyConfiguration.java index 8661d39..2300da3 100644 --- a/test/src/test/java/org/apache/accumulo/harness/conf/AccumuloClusterPropertyConfiguration.java +++ b/test/src/test/java/org/apache/accumulo/harness/conf/AccumuloClusterPropertyConfiguration.java @@ -25,7 +25,7 @@ import java.util.Map; import java.util.Map.Entry; import java.util.Properties; -import org.apache.accumulo.harness.AccumuloClusterIT.ClusterType; +import org.apache.accumulo.harness.AccumuloClusterHarness.ClusterType; import org.slf4j.Logger; import org.slf4j.LoggerFactory; http://git-wip-us.apache.org/repos/asf/accumulo/blob/ab5a867f/test/src/test/java/org/apache/accumulo/harness/conf/AccumuloMiniClusterConfiguration.java ---------------------------------------------------------------------- diff --git a/test/src/test/java/org/apache/accumulo/harness/conf/AccumuloMiniClusterConfiguration.java b/test/src/test/java/org/apache/accumulo/harness/conf/AccumuloMiniClusterConfiguration.java index cb43556..4d233a5 100644 --- a/test/src/test/java/org/apache/accumulo/harness/conf/AccumuloMiniClusterConfiguration.java +++ b/test/src/test/java/org/apache/accumulo/harness/conf/AccumuloMiniClusterConfiguration.java @@ -24,8 +24,8 @@ import org.apache.accumulo.core.client.ClientConfiguration; import org.apache.accumulo.core.client.security.tokens.AuthenticationToken; import org.apache.accumulo.core.client.security.tokens.KerberosToken; import org.apache.accumulo.core.client.security.tokens.PasswordToken; -import org.apache.accumulo.harness.AccumuloClusterIT; -import org.apache.accumulo.harness.AccumuloClusterIT.ClusterType; +import org.apache.accumulo.harness.AccumuloClusterHarness; +import org.apache.accumulo.harness.AccumuloClusterHarness.ClusterType; import org.apache.accumulo.harness.MiniClusterHarness; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.CommonConfigurationKeysPublic; @@ -65,7 +65,7 @@ public class AccumuloMiniClusterConfiguration extends AccumuloClusterPropertyCon @Override public String getAdminPrincipal() { if (saslEnabled) { - return AccumuloClusterIT.getKdc().getRootUser().getPrincipal(); + return AccumuloClusterHarness.getKdc().getRootUser().getPrincipal(); } else { String principal = conf.get(ACCUMULO_MINI_PRINCIPAL_KEY); if (null == principal) { @@ -84,7 +84,7 @@ public class AccumuloMiniClusterConfiguration extends AccumuloClusterPropertyCon conf.set(CommonConfigurationKeysPublic.HADOOP_SECURITY_AUTHENTICATION, "kerberos"); UserGroupInformation.setConfiguration(conf); - ClusterUser rootUser = AccumuloClusterIT.getKdc().getRootUser(); + ClusterUser rootUser = AccumuloClusterHarness.getKdc().getRootUser(); try { return new KerberosToken(rootUser.getPrincipal(), rootUser.getKeytab(), true); } catch (IOException e) { http://git-wip-us.apache.org/repos/asf/accumulo/blob/ab5a867f/test/src/test/java/org/apache/accumulo/harness/conf/StandaloneAccumuloClusterConfiguration.java ---------------------------------------------------------------------- diff --git a/test/src/test/java/org/apache/accumulo/harness/conf/StandaloneAccumuloClusterConfiguration.java b/test/src/test/java/org/apache/accumulo/harness/conf/StandaloneAccumuloClusterConfiguration.java index 4cf145b..ba9dcef 100644 --- a/test/src/test/java/org/apache/accumulo/harness/conf/StandaloneAccumuloClusterConfiguration.java +++ b/test/src/test/java/org/apache/accumulo/harness/conf/StandaloneAccumuloClusterConfiguration.java @@ -34,7 +34,7 @@ import org.apache.accumulo.core.client.ZooKeeperInstance; import org.apache.accumulo.core.client.security.tokens.AuthenticationToken; import org.apache.accumulo.core.client.security.tokens.KerberosToken; import org.apache.accumulo.core.client.security.tokens.PasswordToken; -import org.apache.accumulo.harness.AccumuloClusterIT.ClusterType; +import org.apache.accumulo.harness.AccumuloClusterHarness.ClusterType; import org.apache.commons.configuration.ConfigurationException; import org.apache.hadoop.fs.Path; import org.slf4j.Logger; http://git-wip-us.apache.org/repos/asf/accumulo/blob/ab5a867f/test/src/test/java/org/apache/accumulo/test/ArbitraryTablePropertiesIT.java ---------------------------------------------------------------------- diff --git a/test/src/test/java/org/apache/accumulo/test/ArbitraryTablePropertiesIT.java b/test/src/test/java/org/apache/accumulo/test/ArbitraryTablePropertiesIT.java index 8ed0e2a..213ab59 100644 --- a/test/src/test/java/org/apache/accumulo/test/ArbitraryTablePropertiesIT.java +++ b/test/src/test/java/org/apache/accumulo/test/ArbitraryTablePropertiesIT.java @@ -25,13 +25,13 @@ import org.apache.accumulo.core.client.security.tokens.AuthenticationToken; import org.apache.accumulo.core.client.security.tokens.PasswordToken; import org.apache.accumulo.core.conf.Property; import org.apache.accumulo.core.security.TablePermission; -import org.apache.accumulo.harness.SharedMiniClusterIT; +import org.apache.accumulo.harness.SharedMiniClusterBase; import org.junit.Assert; import org.junit.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public class ArbitraryTablePropertiesIT extends SharedMiniClusterIT { +public class ArbitraryTablePropertiesIT extends SharedMiniClusterBase { private static final Logger log = LoggerFactory.getLogger(ArbitraryTablePropertiesIT.class); @Override http://git-wip-us.apache.org/repos/asf/accumulo/blob/ab5a867f/test/src/test/java/org/apache/accumulo/test/AssignmentThreadsIT.java ---------------------------------------------------------------------- diff --git a/test/src/test/java/org/apache/accumulo/test/AssignmentThreadsIT.java b/test/src/test/java/org/apache/accumulo/test/AssignmentThreadsIT.java index fd7ea6c..c9a83a6 100644 --- a/test/src/test/java/org/apache/accumulo/test/AssignmentThreadsIT.java +++ b/test/src/test/java/org/apache/accumulo/test/AssignmentThreadsIT.java @@ -26,13 +26,13 @@ import org.apache.accumulo.core.client.Connector; import org.apache.accumulo.core.conf.Property; import org.apache.accumulo.core.util.UtilWaitThread; import org.apache.accumulo.minicluster.impl.MiniAccumuloConfigImpl; -import org.apache.accumulo.test.functional.ConfigurableMacIT; +import org.apache.accumulo.test.functional.ConfigurableMacBase; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.io.Text; import org.junit.Test; // ACCUMULO-1177 -public class AssignmentThreadsIT extends ConfigurableMacIT { +public class AssignmentThreadsIT extends ConfigurableMacBase { @Override public void configure(MiniAccumuloConfigImpl cfg, Configuration hadoopCoreSite) { http://git-wip-us.apache.org/repos/asf/accumulo/blob/ab5a867f/test/src/test/java/org/apache/accumulo/test/AuditMessageIT.java ---------------------------------------------------------------------- diff --git a/test/src/test/java/org/apache/accumulo/test/AuditMessageIT.java b/test/src/test/java/org/apache/accumulo/test/AuditMessageIT.java index 14361a6..1eb2373 100644 --- a/test/src/test/java/org/apache/accumulo/test/AuditMessageIT.java +++ b/test/src/test/java/org/apache/accumulo/test/AuditMessageIT.java @@ -50,7 +50,7 @@ import org.apache.accumulo.core.security.TablePermission; import org.apache.accumulo.minicluster.impl.MiniAccumuloClusterImpl; import org.apache.accumulo.minicluster.impl.MiniAccumuloConfigImpl; import org.apache.accumulo.server.security.AuditedSecurityOperation; -import org.apache.accumulo.test.functional.ConfigurableMacIT; +import org.apache.accumulo.test.functional.ConfigurableMacBase; import org.apache.commons.io.FileUtils; import org.apache.commons.io.LineIterator; import org.apache.hadoop.io.Text; @@ -64,7 +64,7 @@ import org.junit.Test; * MiniAccumuloClusterTest sets up the log4j stuff differently to an installed instance, instead piping everything through stdout and writing to a set location * so we have to find the logs and grep the bits we need out. */ -public class AuditMessageIT extends ConfigurableMacIT { +public class AuditMessageIT extends ConfigurableMacBase { private static final String AUDIT_USER_1 = "AuditUser1"; private static final String AUDIT_USER_2 = "AuditUser2"; http://git-wip-us.apache.org/repos/asf/accumulo/blob/ab5a867f/test/src/test/java/org/apache/accumulo/test/BadDeleteMarkersCreatedIT.java ---------------------------------------------------------------------- diff --git a/test/src/test/java/org/apache/accumulo/test/BadDeleteMarkersCreatedIT.java b/test/src/test/java/org/apache/accumulo/test/BadDeleteMarkersCreatedIT.java index 0dcdf42..5b0b84d 100644 --- a/test/src/test/java/org/apache/accumulo/test/BadDeleteMarkersCreatedIT.java +++ b/test/src/test/java/org/apache/accumulo/test/BadDeleteMarkersCreatedIT.java @@ -36,7 +36,7 @@ import org.apache.accumulo.core.util.UtilWaitThread; import org.apache.accumulo.core.zookeeper.ZooUtil; import org.apache.accumulo.fate.zookeeper.ZooCache; import org.apache.accumulo.fate.zookeeper.ZooLock; -import org.apache.accumulo.harness.AccumuloClusterIT; +import org.apache.accumulo.harness.AccumuloClusterHarness; import org.apache.accumulo.minicluster.ServerType; import org.apache.accumulo.minicluster.impl.MiniAccumuloConfigImpl; import org.apache.hadoop.conf.Configuration; @@ -49,7 +49,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; // Accumulo3047 -public class BadDeleteMarkersCreatedIT extends AccumuloClusterIT { +public class BadDeleteMarkersCreatedIT extends AccumuloClusterHarness { private static final Logger log = LoggerFactory.getLogger(BadDeleteMarkersCreatedIT.class); @Override http://git-wip-us.apache.org/repos/asf/accumulo/blob/ab5a867f/test/src/test/java/org/apache/accumulo/test/BalanceFasterIT.java ---------------------------------------------------------------------- diff --git a/test/src/test/java/org/apache/accumulo/test/BalanceFasterIT.java b/test/src/test/java/org/apache/accumulo/test/BalanceFasterIT.java index 2cc5d34..bf9f5f0 100644 --- a/test/src/test/java/org/apache/accumulo/test/BalanceFasterIT.java +++ b/test/src/test/java/org/apache/accumulo/test/BalanceFasterIT.java @@ -34,13 +34,13 @@ import org.apache.accumulo.core.metadata.schema.MetadataSchema; import org.apache.accumulo.core.security.Authorizations; import org.apache.accumulo.core.util.UtilWaitThread; import org.apache.accumulo.minicluster.impl.MiniAccumuloConfigImpl; -import org.apache.accumulo.test.functional.ConfigurableMacIT; +import org.apache.accumulo.test.functional.ConfigurableMacBase; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.io.Text; import org.junit.Test; // ACCUMULO-2952 -public class BalanceFasterIT extends ConfigurableMacIT { +public class BalanceFasterIT extends ConfigurableMacBase { @Override public void configure(MiniAccumuloConfigImpl cfg, Configuration hadoopCoreSite) { http://git-wip-us.apache.org/repos/asf/accumulo/blob/ab5a867f/test/src/test/java/org/apache/accumulo/test/BalanceIT.java ---------------------------------------------------------------------- diff --git a/test/src/test/java/org/apache/accumulo/test/BalanceIT.java b/test/src/test/java/org/apache/accumulo/test/BalanceIT.java index 8703f18..605ac94 100644 --- a/test/src/test/java/org/apache/accumulo/test/BalanceIT.java +++ b/test/src/test/java/org/apache/accumulo/test/BalanceIT.java @@ -20,13 +20,13 @@ import java.util.SortedSet; import java.util.TreeSet; import org.apache.accumulo.core.client.Connector; -import org.apache.accumulo.harness.AccumuloClusterIT; +import org.apache.accumulo.harness.AccumuloClusterHarness; import org.apache.hadoop.io.Text; import org.junit.Test; import org.slf4j.Logger; import org.slf4j.LoggerFactory; -public class BalanceIT extends AccumuloClusterIT { +public class BalanceIT extends AccumuloClusterHarness { private static final Logger log = LoggerFactory.getLogger(BalanceIT.class); @Override http://git-wip-us.apache.org/repos/asf/accumulo/blob/ab5a867f/test/src/test/java/org/apache/accumulo/test/BalanceWithOfflineTableIT.java ---------------------------------------------------------------------- diff --git a/test/src/test/java/org/apache/accumulo/test/BalanceWithOfflineTableIT.java b/test/src/test/java/org/apache/accumulo/test/BalanceWithOfflineTableIT.java index 2d79dd8..9acefc4 100644 --- a/test/src/test/java/org/apache/accumulo/test/BalanceWithOfflineTableIT.java +++ b/test/src/test/java/org/apache/accumulo/test/BalanceWithOfflineTableIT.java @@ -25,13 +25,13 @@ import java.util.concurrent.TimeUnit; import org.apache.accumulo.core.client.Connector; import org.apache.accumulo.core.util.SimpleThreadPool; import org.apache.accumulo.minicluster.impl.MiniAccumuloConfigImpl; -import org.apache.accumulo.test.functional.ConfigurableMacIT; +import org.apache.accumulo.test.functional.ConfigurableMacBase; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.io.Text; import org.junit.Test; // ACCUMULO-3692 -public class BalanceWithOfflineTableIT extends ConfigurableMacIT { +public class BalanceWithOfflineTableIT extends ConfigurableMacBase { @Override protected int defaultTimeoutSeconds() { http://git-wip-us.apache.org/repos/asf/accumulo/blob/ab5a867f/test/src/test/java/org/apache/accumulo/test/BatchWriterIT.java ---------------------------------------------------------------------- diff --git a/test/src/test/java/org/apache/accumulo/test/BatchWriterIT.java b/test/src/test/java/org/apache/accumulo/test/BatchWriterIT.java index b1fe900..11fc595 100644 --- a/test/src/test/java/org/apache/accumulo/test/BatchWriterIT.java +++ b/test/src/test/java/org/apache/accumulo/test/BatchWriterIT.java @@ -21,10 +21,10 @@ import org.apache.accumulo.core.client.BatchWriterConfig; import org.apache.accumulo.core.client.Connector; import org.apache.accumulo.core.data.Mutation; import org.apache.accumulo.core.data.Value; -import org.apache.accumulo.harness.AccumuloClusterIT; +import org.apache.accumulo.harness.AccumuloClusterHarness; import org.junit.Test; -public class BatchWriterIT extends AccumuloClusterIT { +public class BatchWriterIT extends AccumuloClusterHarness { @Override public int defaultTimeoutSeconds() { http://git-wip-us.apache.org/repos/asf/accumulo/blob/ab5a867f/test/src/test/java/org/apache/accumulo/test/BulkImportVolumeIT.java ---------------------------------------------------------------------- diff --git a/test/src/test/java/org/apache/accumulo/test/BulkImportVolumeIT.java b/test/src/test/java/org/apache/accumulo/test/BulkImportVolumeIT.java index cc8fcc9..ce60893 100644 --- a/test/src/test/java/org/apache/accumulo/test/BulkImportVolumeIT.java +++ b/test/src/test/java/org/apache/accumulo/test/BulkImportVolumeIT.java @@ -23,7 +23,7 @@ import java.io.File; import org.apache.accumulo.core.client.admin.TableOperations; import org.apache.accumulo.core.conf.Property; -import org.apache.accumulo.harness.AccumuloClusterIT; +import org.apache.accumulo.harness.AccumuloClusterHarness; import org.apache.accumulo.minicluster.impl.MiniAccumuloConfigImpl; import org.apache.hadoop.conf.Configuration; import org.apache.hadoop.fs.FileSystem; @@ -35,7 +35,7 @@ import org.slf4j.Logger; import org.slf4j.LoggerFactory; // ACCUMULO-118/ACCUMULO-2504 -public class BulkImportVolumeIT extends AccumuloClusterIT { +public class BulkImportVolumeIT extends AccumuloClusterHarness { private static final Logger log = LoggerFactory.getLogger(BulkImportVolumeIT.class); File volDirBase = null; http://git-wip-us.apache.org/repos/asf/accumulo/blob/ab5a867f/test/src/test/java/org/apache/accumulo/test/CleanWalIT.java ---------------------------------------------------------------------- diff --git a/test/src/test/java/org/apache/accumulo/test/CleanWalIT.java b/test/src/test/java/org/apache/accumulo/test/CleanWalIT.java index 3f9e1cc..2474b3e 100644 --- a/test/src/test/java/org/apache/accumulo/test/CleanWalIT.java +++ b/test/src/test/java/org/apache/accumulo/test/CleanWalIT.java @@ -34,7 +34,7 @@ import org.apache.accumulo.core.metadata.RootTable; import org.apache.accumulo.core.metadata.schema.MetadataSchema; import org.apache.accumulo.core.security.Authorizations; import org.apache.accumulo.core.util.UtilWaitThread; -import org.apache.accumulo.harness.AccumuloClusterIT; +import org.apache.accumulo.harness.AccumuloClusterHarness; import org.apache.accumulo.minicluster.ServerType; import org.apache.accumulo.minicluster.impl.MiniAccumuloConfigImpl; import org.apache.hadoop.conf.Configuration; @@ -47,7 +47,7 @@ import org.slf4j.LoggerFactory; import com.google.common.collect.Iterators; -public class CleanWalIT extends AccumuloClusterIT { +public class CleanWalIT extends AccumuloClusterHarness { private static final Logger log = LoggerFactory.getLogger(CleanWalIT.class); @Override http://git-wip-us.apache.org/repos/asf/accumulo/blob/ab5a867f/test/src/test/java/org/apache/accumulo/test/ConditionalWriterIT.java ---------------------------------------------------------------------- diff --git a/test/src/test/java/org/apache/accumulo/test/ConditionalWriterIT.java b/test/src/test/java/org/apache/accumulo/test/ConditionalWriterIT.java index 65be396..74d3593 100644 --- a/test/src/test/java/org/apache/accumulo/test/ConditionalWriterIT.java +++ b/test/src/test/java/org/apache/accumulo/test/ConditionalWriterIT.java @@ -81,7 +81,7 @@ import org.apache.accumulo.core.trace.Trace; import org.apache.accumulo.core.util.FastFormat; import org.apache.accumulo.core.util.UtilWaitThread; import org.apache.accumulo.examples.simple.constraints.AlphaNumKeyConstraint; -import org.apache.accumulo.harness.AccumuloClusterIT; +import org.apache.accumulo.harness.AccumuloClusterHarness; import org.apache.accumulo.minicluster.impl.MiniAccumuloClusterImpl; import org.apache.accumulo.test.functional.BadIterator; import org.apache.accumulo.test.functional.SlowIterator; @@ -101,7 +101,7 @@ import com.google.common.collect.Iterables; /** * */ -public class ConditionalWriterIT extends AccumuloClusterIT { +public class ConditionalWriterIT extends AccumuloClusterHarness { private static final Logger log = LoggerFactory.getLogger(ConditionalWriterIT.class); @Override http://git-wip-us.apache.org/repos/asf/accumulo/blob/ab5a867f/test/src/test/java/org/apache/accumulo/test/ConfigurableMajorCompactionIT.java ---------------------------------------------------------------------- diff --git a/test/src/test/java/org/apache/accumulo/test/ConfigurableMajorCompactionIT.java b/test/src/test/java/org/apache/accumulo/test/ConfigurableMajorCompactionIT.java index 2a13aed..bc45dda 100644 --- a/test/src/test/java/org/apache/accumulo/test/ConfigurableMajorCompactionIT.java +++ b/test/src/test/java/org/apache/accumulo/test/ConfigurableMajorCompactionIT.java @@ -34,7 +34,7 @@ import org.apache.accumulo.core.metadata.schema.MetadataSchema; import org.apache.accumulo.core.security.Authorizations; import org.apache.accumulo.fate.util.UtilWaitThread; import org.apache.accumulo.minicluster.impl.MiniAccumuloConfigImpl; -import org.apache.accumulo.test.functional.ConfigurableMacIT; +import org.apache.accumulo.test.functional.ConfigurableMacBase; import org.apache.accumulo.tserver.compaction.CompactionPlan; import org.apache.accumulo.tserver.compaction.CompactionStrategy; import org.apache.accumulo.tserver.compaction.MajorCompactionRequest; @@ -44,7 +44,7 @@ import org.junit.Test; import com.google.common.collect.Iterators; -public class ConfigurableMajorCompactionIT extends ConfigurableMacIT { +public class ConfigurableMajorCompactionIT extends ConfigurableMacBase { @Override public int defaultTimeoutSeconds() {