Repository: accumulo Updated Branches: refs/heads/metrics2 019e0b9bd -> bb67cda91 (forced update)
ACCUMULO-3167 Remove some unused classes. Mostly got rid of some slider stuff until it's actually implemented. Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/7e1b9035 Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/7e1b9035 Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/7e1b9035 Branch: refs/heads/metrics2 Commit: 7e1b9035e163c49cd874dee408bba3a10da88844 Parents: 7289bce Author: Josh Elser <[email protected]> Authored: Tue Nov 18 23:26:52 2014 -0500 Committer: Josh Elser <[email protected]> Committed: Mon Nov 24 18:07:52 2014 -0500 ---------------------------------------------------------------------- .../accumulo/cluster/AccumuloCluster.java | 1 + .../accumulo/cluster/AccumuloClusters.java | 43 ----- .../apache/accumulo/cluster/AccumuloConfig.java | 156 ------------------- .../apache/accumulo/cluster/package-info.java | 27 ---- .../impl/MiniAccumuloConfigImpl.java | 27 +--- .../accumulo/cluster/AccumuloClustersTest.java | 63 -------- .../accumulo/harness/AccumuloClusterIT.java | 6 +- .../AccumuloClusterPropertyConfiguration.java | 6 - 8 files changed, 5 insertions(+), 324 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/accumulo/blob/7e1b9035/minicluster/src/main/java/org/apache/accumulo/cluster/AccumuloCluster.java ---------------------------------------------------------------------- diff --git a/minicluster/src/main/java/org/apache/accumulo/cluster/AccumuloCluster.java b/minicluster/src/main/java/org/apache/accumulo/cluster/AccumuloCluster.java index 6d08c71..d647835 100644 --- a/minicluster/src/main/java/org/apache/accumulo/cluster/AccumuloCluster.java +++ b/minicluster/src/main/java/org/apache/accumulo/cluster/AccumuloCluster.java @@ -16,6 +16,7 @@ */ package org.apache.accumulo.cluster; +import org.apache.accumulo.cluster.ClusterControl; import org.apache.accumulo.core.client.AccumuloException; import org.apache.accumulo.core.client.AccumuloSecurityException; import org.apache.accumulo.core.client.ClientConfiguration; http://git-wip-us.apache.org/repos/asf/accumulo/blob/7e1b9035/minicluster/src/main/java/org/apache/accumulo/cluster/AccumuloClusters.java ---------------------------------------------------------------------- diff --git a/minicluster/src/main/java/org/apache/accumulo/cluster/AccumuloClusters.java b/minicluster/src/main/java/org/apache/accumulo/cluster/AccumuloClusters.java deleted file mode 100644 index 50cb9db..0000000 --- a/minicluster/src/main/java/org/apache/accumulo/cluster/AccumuloClusters.java +++ /dev/null @@ -1,43 +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.cluster; - -import java.io.IOException; - -import org.apache.accumulo.minicluster.MiniAccumuloCluster; -import org.apache.accumulo.minicluster.MiniAccumuloConfig; - -/** - * Facilitates programmatic creation of an {@link AccumuloCluster} - * - * (Experimental, not guaranteed to stay backwards compatible) - * - * @since 1.6.0 - */ -public class AccumuloClusters { - - private AccumuloClusters() {} - - public static AccumuloCluster create(AccumuloConfig cfg) throws IOException { - return cfg.build(); - } - - public static MiniAccumuloCluster createMiniCluster(MiniAccumuloConfig cfg) throws IOException { - return new MiniAccumuloCluster(cfg); - } - -} http://git-wip-us.apache.org/repos/asf/accumulo/blob/7e1b9035/minicluster/src/main/java/org/apache/accumulo/cluster/AccumuloConfig.java ---------------------------------------------------------------------- diff --git a/minicluster/src/main/java/org/apache/accumulo/cluster/AccumuloConfig.java b/minicluster/src/main/java/org/apache/accumulo/cluster/AccumuloConfig.java deleted file mode 100644 index 0df2348..0000000 --- a/minicluster/src/main/java/org/apache/accumulo/cluster/AccumuloConfig.java +++ /dev/null @@ -1,156 +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.cluster; - -import java.io.IOException; -import java.util.Map; - -import org.apache.accumulo.minicluster.MemoryUnit; -import org.apache.accumulo.minicluster.ServerType; - -/** - * Configuration class for an {@link AccumuloCluster} - * - * (Experimental, not guaranteed to stay backwards compatible) - * - * @since 1.6.0 - */ -public interface AccumuloConfig { - - /** - * Calling this method is optional. If not set, it defaults to two. - * - * @param numTservers - * the number of tablet servers that mini accumulo cluster should start - */ - public AccumuloConfig setNumTservers(int numTservers); - - /** - * Calling this method is optional. If not set, defaults to 'miniInstance' - */ - public AccumuloConfig setInstanceName(String instanceName); - - /** - * Calling this method is optional. If not set, it defaults to an empty map. - * - * @param siteConfig - * key/values that you normally put in accumulo-site.xml can be put here. - */ - public AccumuloConfig setSiteConfig(Map<String,String> siteConfig); - - /** - * Calling this method is optional. A random port is generated by default - * - * @param zooKeeperPort - * A valid (and unused) port to use for the zookeeper - */ - public AccumuloConfig setZooKeeperPort(int zooKeeperPort); - - /** - * Configure the time to wait for ZooKeeper to startup. - * Calling this method is optional. The default is 20000 milliseconds - * - * @param zooKeeperStartupTime - * Time to wait for ZooKeeper to startup, in milliseconds - * - * @since 1.6.1 - */ - public AccumuloConfig setZooKeeperStartupTime(long zooKeeperStartupTime); - - /** - * Sets the amount of memory to use in the master process. Calling this method is optional. Default memory is 128M - * - * @param serverType - * the type of server to apply the memory settings - * @param memory - * amount of memory to set - * - * @param memoryUnit - * the units for which to apply with the memory size - */ - public AccumuloConfig setMemory(ServerType serverType, long memory, MemoryUnit memoryUnit); - - /** - * Sets the default memory size to use. This value is also used when a ServerType has not been configured explicitly. Calling this method is optional. Default - * memory is 128M - * - * @param memory - * amount of memory to set - * - * @param memoryUnit - * the units for which to apply with the memory size - */ - public AccumuloConfig setDefaultMemory(long memory, MemoryUnit memoryUnit); - - /** - * @return a copy of the site config - */ - public Map<String,String> getSiteConfig(); - - /** - * @return The configured ZooKeeper port - */ - public int getZooKeeperPort(); - - /** - * @return name of configured instance - */ - public String getInstanceName(); - - /** - * @param serverType - * get configuration for this server type - * - * @return memory configured in bytes, returns default if this server type is not configured - */ - public long getMemory(ServerType serverType); - - /** - * @return memory configured in bytes - */ - public long getDefaultMemory(); - - /** - * @return the root password of this cluster configuration - */ - public String getRootPassword(); - - /** - * @return the number of tservers configured for this cluster - */ - public int getNumTservers(); - - /** - * @return the paths to use for loading native libraries - */ - public String[] getNativeLibPaths(); - - /** - * Sets the path for processes to use for loading native libraries - * - * @param nativePathItems - * the nativePathItems to set - */ - public AccumuloConfig setNativeLibPaths(String... nativePathItems); - - /** - * Build the appropriate {@link AccumuloCluster} from this configuration - * - * @return An {@link AccumuloCluster} - */ - public AccumuloCluster build() throws IOException; -} http://git-wip-us.apache.org/repos/asf/accumulo/blob/7e1b9035/minicluster/src/main/java/org/apache/accumulo/cluster/package-info.java ---------------------------------------------------------------------- diff --git a/minicluster/src/main/java/org/apache/accumulo/cluster/package-info.java b/minicluster/src/main/java/org/apache/accumulo/cluster/package-info.java deleted file mode 100644 index f1b649d..0000000 --- a/minicluster/src/main/java/org/apache/accumulo/cluster/package-info.java +++ /dev/null @@ -1,27 +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. - */ - -/** - * This package contains a set of "experimental" changes to the MiniAccumuloCluster class. - * - * The intent is to decouple the notion of the MiniCluster from the implementation which - * will allow for various Accumulo testing implementations that all adhere to the same interface. - * - * Presently, this interface can be used to create an MiniAccumuloCluster, but the API is not - * guaranteed to make non-breaking changes going forward. - */ -package org.apache.accumulo.cluster; http://git-wip-us.apache.org/repos/asf/accumulo/blob/7e1b9035/minicluster/src/main/java/org/apache/accumulo/minicluster/impl/MiniAccumuloConfigImpl.java ---------------------------------------------------------------------- diff --git a/minicluster/src/main/java/org/apache/accumulo/minicluster/impl/MiniAccumuloConfigImpl.java b/minicluster/src/main/java/org/apache/accumulo/minicluster/impl/MiniAccumuloConfigImpl.java index 6639afa..b8651ef 100644 --- a/minicluster/src/main/java/org/apache/accumulo/minicluster/impl/MiniAccumuloConfigImpl.java +++ b/minicluster/src/main/java/org/apache/accumulo/minicluster/impl/MiniAccumuloConfigImpl.java @@ -24,7 +24,6 @@ import java.util.Iterator; import java.util.Map; import java.util.Map.Entry; -import org.apache.accumulo.cluster.AccumuloConfig; import org.apache.accumulo.core.conf.CredentialProviderFactoryShim; import org.apache.accumulo.core.conf.DefaultConfiguration; import org.apache.accumulo.core.conf.Property; @@ -39,7 +38,7 @@ import org.apache.log4j.Logger; * * @since 1.6.0 */ -public class MiniAccumuloConfigImpl implements AccumuloConfig { +public class MiniAccumuloConfigImpl { private static final Logger log = Logger.getLogger(MiniAccumuloConfigImpl.class); private static final String DEFAULT_INSTANCE_SECRET = "DONTTELL"; @@ -234,7 +233,6 @@ public class MiniAccumuloConfigImpl implements AccumuloConfig { * @param numTservers * the number of tablet servers that mini accumulo cluster should start */ - @Override public MiniAccumuloConfigImpl setNumTservers(int numTservers) { if (numTservers < 1) throw new IllegalArgumentException("Must have at least one tablet server"); @@ -247,7 +245,6 @@ public class MiniAccumuloConfigImpl implements AccumuloConfig { * * @since 1.6.0 */ - @Override public MiniAccumuloConfigImpl setInstanceName(String instanceName) { this.instanceName = instanceName; return this; @@ -259,7 +256,6 @@ public class MiniAccumuloConfigImpl implements AccumuloConfig { * @param siteConfig * key/values that you normally put in accumulo-site.xml can be put here. */ - @Override public MiniAccumuloConfigImpl setSiteConfig(Map<String,String> siteConfig) { if (existingInstance != null && existingInstance.booleanValue()) throw new UnsupportedOperationException("Cannot set set config info when using an existing instance."); @@ -283,7 +279,6 @@ public class MiniAccumuloConfigImpl implements AccumuloConfig { * * @since 1.6.0 */ - @Override public MiniAccumuloConfigImpl setZooKeeperPort(int zooKeeperPort) { if (existingInstance != null && existingInstance.booleanValue()) throw new UnsupportedOperationException("Cannot set zookeeper info when using an existing instance."); @@ -296,15 +291,13 @@ public class MiniAccumuloConfigImpl implements AccumuloConfig { } /** - * <<<<<<< HEAD Configure the time to wait for ZooKeeper to startup. Calling this method is optional. The default is 20000 milliseconds ======= Configure the - * time to wait for ZooKeeper to startup. Calling this method is optional. The default is 20000 milliseconds >>>>>>> ACCUMULO-2984 + * Configure the time to wait for ZooKeeper to startup. Calling this method is optional. The default is 20000 milliseconds * * @param zooKeeperStartupTime * Time to wait for ZooKeeper to startup, in milliseconds * * @since 1.6.1 */ - @Override public MiniAccumuloConfigImpl setZooKeeperStartupTime(long zooKeeperStartupTime) { if (existingInstance != null && existingInstance.booleanValue()) throw new UnsupportedOperationException("Cannot set zookeeper info when using an existing instance."); @@ -328,7 +321,6 @@ public class MiniAccumuloConfigImpl implements AccumuloConfig { * * @since 1.6.0 */ - @Override public MiniAccumuloConfigImpl setMemory(ServerType serverType, long memory, MemoryUnit memoryUnit) { this.memoryConfig.put(serverType, memoryUnit.toBytes(memory)); return this; @@ -346,7 +338,6 @@ public class MiniAccumuloConfigImpl implements AccumuloConfig { * * @since 1.6.0 */ - @Override public MiniAccumuloConfigImpl setDefaultMemory(long memory, MemoryUnit memoryUnit) { this.defaultMemorySize = memoryUnit.toBytes(memory); return this; @@ -355,7 +346,6 @@ public class MiniAccumuloConfigImpl implements AccumuloConfig { /** * @return a copy of the site config */ - @Override public Map<String,String> getSiteConfig() { return new HashMap<String,String>(siteConfig); } @@ -369,7 +359,6 @@ public class MiniAccumuloConfigImpl implements AccumuloConfig { * * @since 1.6.0 */ - @Override public String getInstanceName() { return instanceName; } @@ -379,7 +368,6 @@ public class MiniAccumuloConfigImpl implements AccumuloConfig { * * @since 1.6.0 */ - @Override public int getZooKeeperPort() { return zooKeeperPort; } @@ -428,7 +416,6 @@ public class MiniAccumuloConfigImpl implements AccumuloConfig { * * @since 1.6.0 */ - @Override public long getMemory(ServerType serverType) { return memoryConfig.containsKey(serverType) ? memoryConfig.get(serverType) : defaultMemorySize; } @@ -438,7 +425,6 @@ public class MiniAccumuloConfigImpl implements AccumuloConfig { * * @since 1.6.0 */ - @Override public long getDefaultMemory() { return defaultMemorySize; } @@ -462,7 +448,6 @@ public class MiniAccumuloConfigImpl implements AccumuloConfig { /** * @return the root password of this cluster configuration */ - @Override public String getRootPassword() { return rootPassword; } @@ -470,7 +455,6 @@ public class MiniAccumuloConfigImpl implements AccumuloConfig { /** * @return the number of tservers configured for this cluster */ - @Override public int getNumTservers() { return numTservers; } @@ -558,7 +542,6 @@ public class MiniAccumuloConfigImpl implements AccumuloConfig { * * @since 1.6.0 */ - @Override public String[] getNativeLibPaths() { return this.nativePathItems == null ? new String[0] : this.nativePathItems; } @@ -570,7 +553,6 @@ public class MiniAccumuloConfigImpl implements AccumuloConfig { * the nativePathItems to set * @since 1.6.0 */ - @Override public MiniAccumuloConfigImpl setNativeLibPaths(String... nativePathItems) { this.nativePathItems = nativePathItems; return this; @@ -600,11 +582,6 @@ public class MiniAccumuloConfigImpl implements AccumuloConfig { this.useCredentialProvider = useCredentialProvider; } - @Override - public MiniAccumuloClusterImpl build() throws IOException { - return new MiniAccumuloClusterImpl(this); - } - /** * Informs MAC that it's running against an existing accumulo instance. It is assumed that it's already initialized and hdfs/zookeeper are already running. * http://git-wip-us.apache.org/repos/asf/accumulo/blob/7e1b9035/minicluster/src/test/java/org/apache/accumulo/cluster/AccumuloClustersTest.java ---------------------------------------------------------------------- diff --git a/minicluster/src/test/java/org/apache/accumulo/cluster/AccumuloClustersTest.java b/minicluster/src/test/java/org/apache/accumulo/cluster/AccumuloClustersTest.java deleted file mode 100644 index e368240..0000000 --- a/minicluster/src/test/java/org/apache/accumulo/cluster/AccumuloClustersTest.java +++ /dev/null @@ -1,63 +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.cluster; - -import static org.easymock.EasyMock.createMock; -import static org.easymock.EasyMock.expect; -import static org.easymock.EasyMock.replay; - -import java.io.File; -import java.io.IOException; - -import org.apache.accumulo.cluster.AccumuloClusters; -import org.apache.accumulo.minicluster.MiniAccumuloCluster; -import org.apache.accumulo.minicluster.MiniAccumuloConfig; -import org.apache.accumulo.minicluster.impl.MiniAccumuloClusterImpl; -import org.apache.accumulo.minicluster.impl.MiniAccumuloConfigImpl; -import org.apache.commons.io.FileUtils; -import org.junit.Assert; -import org.junit.Test; - -import com.google.common.io.Files; - -public class AccumuloClustersTest { - - @Test - public void testReturnType() throws IOException { - MiniAccumuloConfigImpl cfg = createMock(MiniAccumuloConfigImpl.class); - MiniAccumuloClusterImpl cluster = createMock(MiniAccumuloClusterImpl.class); - - expect(cfg.build()).andReturn(cluster); - replay(cfg); - cfg.build(); - } - - @Test - public void testFactoryReturn() throws IOException { - File dir = Files.createTempDir(); - try { - MiniAccumuloConfig cfg = new MiniAccumuloConfig(dir, "foo"); - Assert.assertEquals(MiniAccumuloCluster.class, AccumuloClusters.createMiniCluster(cfg).getClass()); - Assert.assertTrue(FileUtils.deleteQuietly(dir)); - Assert.assertTrue(dir.mkdirs()); - MiniAccumuloConfigImpl cfgImpl = new MiniAccumuloConfigImpl(dir, "foo"); - Assert.assertEquals(MiniAccumuloClusterImpl.class, AccumuloClusters.create(cfgImpl).getClass()); - } finally { - FileUtils.deleteQuietly(dir); - } - } -} http://git-wip-us.apache.org/repos/asf/accumulo/blob/7e1b9035/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 index 8ef6548..1638647 100644 --- a/test/src/test/java/org/apache/accumulo/harness/AccumuloClusterIT.java +++ b/test/src/test/java/org/apache/accumulo/harness/AccumuloClusterIT.java @@ -50,7 +50,7 @@ public abstract class AccumuloClusterIT extends AccumuloIT implements MiniCluste private static final Logger log = LoggerFactory.getLogger(AccumuloClusterIT.class); public static enum ClusterType { - MINI, STANDALONE, SLIDER + MINI, STANDALONE } private static boolean initialized = false; @@ -85,8 +85,6 @@ public abstract class AccumuloClusterIT extends AccumuloIT implements MiniCluste AccumuloStandaloneClusterConfiguration conf = (AccumuloStandaloneClusterConfiguration) clusterConf; cluster = new StandaloneAccumuloCluster(conf.getInstance()); break; - case SLIDER: - throw new UnsupportedOperationException("Running against Slider is not yet supported"); default: throw new RuntimeException("Unhandled type"); } @@ -148,7 +146,7 @@ public abstract class AccumuloClusterIT extends AccumuloIT implements MiniCluste } public boolean isDynamicCluster() { - return ClusterType.MINI == type || ClusterType.SLIDER == type; + return ClusterType.MINI == type; } public static String getPrincipal() { http://git-wip-us.apache.org/repos/asf/accumulo/blob/7e1b9035/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 a82767d..3bcee98 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 @@ -43,7 +43,6 @@ public abstract class AccumuloClusterPropertyConfiguration implements AccumuloCl public static final String ACCUMULO_MINI_PREFIX = "accumulo.it.cluster.mini."; public static final String ACCUMULO_STANDALONE_PREFIX = "accumulo.it.cluster.standalone."; - public static final String ACCUMULO_SLIDER_PREFIX = "accumulo.it.cluster.slider"; protected ClusterType clusterType; @@ -105,8 +104,6 @@ public abstract class AccumuloClusterPropertyConfiguration implements AccumuloCl return new AccumuloMiniClusterConfiguration(); case STANDALONE: return new AccumuloStandaloneClusterConfiguration(); - case SLIDER: - throw new UnsupportedOperationException("Not yet implemented"); default: throw new RuntimeException("Clusters other than MiniAccumuloCluster are not yet implemented"); } @@ -123,9 +120,6 @@ public abstract class AccumuloClusterPropertyConfiguration implements AccumuloCl case STANDALONE: prefix = ACCUMULO_STANDALONE_PREFIX; break; - case SLIDER: - prefix = ACCUMULO_SLIDER_PREFIX; - break; default: throw new IllegalArgumentException("Unknown ClusterType: " + type); }
