Repository: accumulo Updated Branches: refs/heads/master a9207d537 -> f2d400119
ACCUMULO-4680 Replace Namespaces static Strings Project: http://git-wip-us.apache.org/repos/asf/accumulo/repo Commit: http://git-wip-us.apache.org/repos/asf/accumulo/commit/f2d40011 Tree: http://git-wip-us.apache.org/repos/asf/accumulo/tree/f2d40011 Diff: http://git-wip-us.apache.org/repos/asf/accumulo/diff/f2d40011 Branch: refs/heads/master Commit: f2d40011913fb1999ada362e00c332bc25afc122 Parents: a9207d5 Author: Mike Miller <mmil...@apache.org> Authored: Tue Aug 1 14:34:00 2017 -0400 Committer: Mike Miller <mmil...@apache.org> Committed: Tue Aug 1 14:34:00 2017 -0400 ---------------------------------------------------------------------- .../client/impl/NamespaceOperationsHelper.java | 4 +- .../client/impl/NamespaceOperationsImpl.java | 2 +- .../accumulo/core/client/impl/Namespaces.java | 11 +-- .../accumulo/core/client/impl/Tables.java | 10 +-- .../accumulo/core/client/mock/MockAccumulo.java | 6 +- .../accumulo/core/metadata/MetadataTable.java | 4 +- .../accumulo/core/metadata/RootTable.java | 4 +- .../core/replication/ReplicationTable.java | 4 +- .../core/client/mock/MockNamespacesTest.java | 6 +- .../org/apache/accumulo/proxy/ProxyServer.java | 6 +- .../server/conf/NamespaceConfiguration.java | 5 +- .../apache/accumulo/server/init/Initialize.java | 13 ++-- .../server/security/SecurityOperation.java | 3 +- .../server/security/handler/ZKPermHandler.java | 5 +- .../server/conf/NamespaceConfigurationTest.java | 6 +- .../HostRegexTableLoadBalancerTest.java | 6 +- .../java/org/apache/accumulo/master/Master.java | 21 +++-- .../accumulo/master/util/TableValidators.java | 6 +- .../shell/commands/DeleteTableCommand.java | 4 +- .../shell/commands/NamespacesCommand.java | 4 +- .../apache/accumulo/test/LargeSplitRowIT.java | 4 +- .../org/apache/accumulo/test/NamespacesIT.java | 80 ++++++++++---------- .../org/apache/accumulo/test/ShellServerIT.java | 6 +- .../test/TableConfigurationUpdateIT.java | 4 +- .../accumulo/test/proxy/SimpleProxyBase.java | 6 +- .../proxy/TestProxyNamespaceOperations.java | 6 +- 26 files changed, 112 insertions(+), 124 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/accumulo/blob/f2d40011/core/src/main/java/org/apache/accumulo/core/client/impl/NamespaceOperationsHelper.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/accumulo/core/client/impl/NamespaceOperationsHelper.java b/core/src/main/java/org/apache/accumulo/core/client/impl/NamespaceOperationsHelper.java index 9b3a358..16a971c 100644 --- a/core/src/main/java/org/apache/accumulo/core/client/impl/NamespaceOperationsHelper.java +++ b/core/src/main/java/org/apache/accumulo/core/client/impl/NamespaceOperationsHelper.java @@ -35,12 +35,12 @@ public abstract class NamespaceOperationsHelper implements NamespaceOperations { @Override public String systemNamespace() { - return Namespaces.ACCUMULO_NAMESPACE; + return Namespace.ACCUMULO; } @Override public String defaultNamespace() { - return Namespaces.DEFAULT_NAMESPACE; + return Namespace.DEFAULT; } @Override http://git-wip-us.apache.org/repos/asf/accumulo/blob/f2d40011/core/src/main/java/org/apache/accumulo/core/client/impl/NamespaceOperationsImpl.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/accumulo/core/client/impl/NamespaceOperationsImpl.java b/core/src/main/java/org/apache/accumulo/core/client/impl/NamespaceOperationsImpl.java index 960fa6f..bf21a17 100644 --- a/core/src/main/java/org/apache/accumulo/core/client/impl/NamespaceOperationsImpl.java +++ b/core/src/main/java/org/apache/accumulo/core/client/impl/NamespaceOperationsImpl.java @@ -128,7 +128,7 @@ public class NamespaceOperationsImpl extends NamespaceOperationsHelper { checkArgument(namespace != null, "namespace is null"); Namespace.ID namespaceId = Namespaces.getNamespaceId(context.getInstance(), namespace); - if (namespaceId.equals(Namespaces.ACCUMULO_NAMESPACE_ID) || namespaceId.equals(Namespaces.DEFAULT_NAMESPACE_ID)) { + if (namespaceId.equals(Namespace.ID.ACCUMULO) || namespaceId.equals(Namespace.ID.DEFAULT)) { Credentials credentials = context.getCredentials(); log.debug("{} attempted to delete the {} namespace", credentials.getPrincipal(), namespaceId); throw new AccumuloSecurityException(credentials.getPrincipal(), SecurityErrorCode.UNSUPPORTED_OPERATION); http://git-wip-us.apache.org/repos/asf/accumulo/blob/f2d40011/core/src/main/java/org/apache/accumulo/core/client/impl/Namespaces.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/accumulo/core/client/impl/Namespaces.java b/core/src/main/java/org/apache/accumulo/core/client/impl/Namespaces.java index ee19ac5..52cac59 100644 --- a/core/src/main/java/org/apache/accumulo/core/client/impl/Namespaces.java +++ b/core/src/main/java/org/apache/accumulo/core/client/impl/Namespaces.java @@ -57,7 +57,7 @@ public class Namespaces { public static final Validator<String> NOT_DEFAULT = new Validator<String>() { @Override public boolean test(String namespace) { - return !Namespaces.DEFAULT_NAMESPACE.equals(namespace); + return !Namespace.DEFAULT.equals(namespace); } @Override @@ -69,20 +69,15 @@ public class Namespaces { public static final Validator<String> NOT_ACCUMULO = new Validator<String>() { @Override public boolean test(String namespace) { - return !Namespaces.ACCUMULO_NAMESPACE.equals(namespace); + return !Namespace.ACCUMULO.equals(namespace); } @Override public String invalidMessage(String namespace) { - return "Namespace cannot be the reserved namespace, " + Namespaces.ACCUMULO_NAMESPACE; + return "Namespace cannot be the reserved namespace, " + Namespace.ACCUMULO; } }; - public static final Namespace.ID DEFAULT_NAMESPACE_ID = Namespace.ID.DEFAULT; - public static final String DEFAULT_NAMESPACE = Namespace.DEFAULT; - public static final Namespace.ID ACCUMULO_NAMESPACE_ID = Namespace.ID.ACCUMULO; - public static final String ACCUMULO_NAMESPACE = Namespace.ACCUMULO; - private static ZooCache getZooCache(Instance instance) { return new ZooCacheFactory().getZooCache(instance.getZooKeepers(), instance.getZooKeepersSessionTimeOut()); } http://git-wip-us.apache.org/repos/asf/accumulo/blob/f2d40011/core/src/main/java/org/apache/accumulo/core/client/impl/Tables.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/accumulo/core/client/impl/Tables.java b/core/src/main/java/org/apache/accumulo/core/client/impl/Tables.java index 5beec3a..8cf1233 100644 --- a/core/src/main/java/org/apache/accumulo/core/client/impl/Tables.java +++ b/core/src/main/java/org/apache/accumulo/core/client/impl/Tables.java @@ -178,19 +178,19 @@ public class Tables { } public static String qualified(String tableName) { - return qualified(tableName, Namespaces.DEFAULT_NAMESPACE); + return qualified(tableName, Namespace.DEFAULT); } public static String qualified(String tableName, String defaultNamespace) { Pair<String,String> qualifiedTableName = qualify(tableName, defaultNamespace); - if (Namespaces.DEFAULT_NAMESPACE.equals(qualifiedTableName.getFirst())) + if (Namespace.DEFAULT.equals(qualifiedTableName.getFirst())) return qualifiedTableName.getSecond(); else return qualifiedTableName.toString("", ".", ""); } public static Pair<String,String> qualify(String tableName) { - return qualify(tableName, Namespaces.DEFAULT_NAMESPACE); + return qualify(tableName, Namespace.DEFAULT); } public static Pair<String,String> qualify(String tableName, String defaultNamespace) { @@ -242,13 +242,13 @@ public class Tables { for (String tableId : tableIds) { byte[] tableName = zc.get(ZooUtil.getRoot(instance) + Constants.ZTABLES + "/" + tableId + Constants.ZTABLE_NAME); byte[] nId = zc.get(ZooUtil.getRoot(instance) + Constants.ZTABLES + "/" + tableId + Constants.ZTABLE_NAMESPACE); - String namespaceName = Namespaces.DEFAULT_NAMESPACE; + String namespaceName = Namespace.DEFAULT; // create fully qualified table name if (nId == null) { namespaceName = null; } else { Namespace.ID namespaceId = new Namespace.ID(new String(nId, UTF_8)); - if (!namespaceId.equals(Namespaces.DEFAULT_NAMESPACE_ID)) { + if (!namespaceId.equals(Namespace.ID.DEFAULT)) { try { namespaceName = namespaceIdToNameMap.get(namespaceId); if (namespaceName == null) { http://git-wip-us.apache.org/repos/asf/accumulo/blob/f2d40011/core/src/main/java/org/apache/accumulo/core/client/mock/MockAccumulo.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/accumulo/core/client/mock/MockAccumulo.java b/core/src/main/java/org/apache/accumulo/core/client/mock/MockAccumulo.java index f362add..6cf1fc9 100644 --- a/core/src/main/java/org/apache/accumulo/core/client/mock/MockAccumulo.java +++ b/core/src/main/java/org/apache/accumulo/core/client/mock/MockAccumulo.java @@ -26,7 +26,7 @@ import java.util.concurrent.atomic.AtomicInteger; import org.apache.accumulo.core.client.BatchScanner; import org.apache.accumulo.core.client.admin.TimeType; -import org.apache.accumulo.core.client.impl.Namespaces; +import org.apache.accumulo.core.client.impl.Namespace; import org.apache.accumulo.core.client.impl.Tables; import org.apache.accumulo.core.client.security.tokens.PasswordToken; import org.apache.accumulo.core.data.Mutation; @@ -57,8 +57,8 @@ public class MockAccumulo { MockUser root = new MockUser("root", new PasswordToken(new byte[0]), Authorizations.EMPTY); root.permissions.add(SystemPermission.SYSTEM); users.put(root.name, root); - namespaces.put(Namespaces.DEFAULT_NAMESPACE, new MockNamespace()); - namespaces.put(Namespaces.ACCUMULO_NAMESPACE, new MockNamespace()); + namespaces.put(Namespace.DEFAULT, new MockNamespace()); + namespaces.put(Namespace.ACCUMULO, new MockNamespace()); createTable("root", RootTable.NAME, true, TimeType.LOGICAL); createTable("root", MetadataTable.NAME, true, TimeType.LOGICAL); createTable("root", ReplicationTable.NAME, true, TimeType.LOGICAL); http://git-wip-us.apache.org/repos/asf/accumulo/blob/f2d40011/core/src/main/java/org/apache/accumulo/core/metadata/MetadataTable.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/accumulo/core/metadata/MetadataTable.java b/core/src/main/java/org/apache/accumulo/core/metadata/MetadataTable.java index fefa679..e07b50b 100644 --- a/core/src/main/java/org/apache/accumulo/core/metadata/MetadataTable.java +++ b/core/src/main/java/org/apache/accumulo/core/metadata/MetadataTable.java @@ -16,7 +16,7 @@ */ package org.apache.accumulo.core.metadata; -import org.apache.accumulo.core.client.impl.Namespaces; +import org.apache.accumulo.core.client.impl.Namespace; import org.apache.accumulo.core.client.impl.Table; public class MetadataTable { @@ -24,6 +24,6 @@ public class MetadataTable { public static final String OLD_NAME = "!METADATA"; public static final Table.ID ID = Table.ID.METADATA; - public static final String NAME = Namespaces.ACCUMULO_NAMESPACE + ".metadata"; + public static final String NAME = Namespace.ACCUMULO + ".metadata"; } http://git-wip-us.apache.org/repos/asf/accumulo/blob/f2d40011/core/src/main/java/org/apache/accumulo/core/metadata/RootTable.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/accumulo/core/metadata/RootTable.java b/core/src/main/java/org/apache/accumulo/core/metadata/RootTable.java index d2f0705..a1d4b52 100644 --- a/core/src/main/java/org/apache/accumulo/core/metadata/RootTable.java +++ b/core/src/main/java/org/apache/accumulo/core/metadata/RootTable.java @@ -16,7 +16,7 @@ */ package org.apache.accumulo.core.metadata; -import org.apache.accumulo.core.client.impl.Namespaces; +import org.apache.accumulo.core.client.impl.Namespace; import org.apache.accumulo.core.client.impl.Table; import org.apache.accumulo.core.data.impl.KeyExtent; @@ -26,7 +26,7 @@ import org.apache.accumulo.core.data.impl.KeyExtent; public class RootTable { public static final Table.ID ID = Table.ID.ROOT; - public static final String NAME = Namespaces.ACCUMULO_NAMESPACE + ".root"; + public static final String NAME = Namespace.ACCUMULO + ".root"; /** * DFS location relative to the Accumulo directory http://git-wip-us.apache.org/repos/asf/accumulo/blob/f2d40011/core/src/main/java/org/apache/accumulo/core/replication/ReplicationTable.java ---------------------------------------------------------------------- diff --git a/core/src/main/java/org/apache/accumulo/core/replication/ReplicationTable.java b/core/src/main/java/org/apache/accumulo/core/replication/ReplicationTable.java index 4eb2e2c..b5ad84b 100644 --- a/core/src/main/java/org/apache/accumulo/core/replication/ReplicationTable.java +++ b/core/src/main/java/org/apache/accumulo/core/replication/ReplicationTable.java @@ -29,7 +29,7 @@ import org.apache.accumulo.core.client.Connector; import org.apache.accumulo.core.client.Scanner; import org.apache.accumulo.core.client.TableNotFoundException; import org.apache.accumulo.core.client.TableOfflineException; -import org.apache.accumulo.core.client.impl.Namespaces; +import org.apache.accumulo.core.client.impl.Namespace; import org.apache.accumulo.core.client.impl.Table; import org.apache.accumulo.core.client.impl.Tables; import org.apache.accumulo.core.master.state.tables.TableState; @@ -47,7 +47,7 @@ public class ReplicationTable { private static final Logger log = LoggerFactory.getLogger(ReplicationTable.class); public static final Table.ID ID = new Table.ID("+rep"); - public static final String NAME = Namespaces.ACCUMULO_NAMESPACE + ".replication"; + public static final String NAME = Namespace.ACCUMULO + ".replication"; public static final String COMBINER_NAME = "statuscombiner"; http://git-wip-us.apache.org/repos/asf/accumulo/blob/f2d40011/core/src/test/java/org/apache/accumulo/core/client/mock/MockNamespacesTest.java ---------------------------------------------------------------------- diff --git a/core/src/test/java/org/apache/accumulo/core/client/mock/MockNamespacesTest.java b/core/src/test/java/org/apache/accumulo/core/client/mock/MockNamespacesTest.java index ca12838..760c674 100644 --- a/core/src/test/java/org/apache/accumulo/core/client/mock/MockNamespacesTest.java +++ b/core/src/test/java/org/apache/accumulo/core/client/mock/MockNamespacesTest.java @@ -37,7 +37,7 @@ import org.apache.accumulo.core.client.NamespaceNotFoundException; import org.apache.accumulo.core.client.Scanner; import org.apache.accumulo.core.client.TableNotFoundException; import org.apache.accumulo.core.client.admin.NamespaceOperations; -import org.apache.accumulo.core.client.impl.Namespaces; +import org.apache.accumulo.core.client.impl.Namespace; import org.apache.accumulo.core.client.security.tokens.PasswordToken; import org.apache.accumulo.core.conf.Property; import org.apache.accumulo.core.data.Key; @@ -72,7 +72,7 @@ public class MockNamespacesTest { public void testDefaultNamespace() throws Exception { String tableName = "test"; - assertTrue(conn.namespaceOperations().exists(Namespaces.DEFAULT_NAMESPACE)); + assertTrue(conn.namespaceOperations().exists(Namespace.DEFAULT)); conn.tableOperations().create(tableName); assertTrue(conn.tableOperations().exists(tableName)); } @@ -166,7 +166,7 @@ public class MockNamespacesTest { propVal = "13K"; String tableName = "some_table"; conn.tableOperations().create(tableName); - conn.namespaceOperations().setProperty(Namespaces.DEFAULT_NAMESPACE, propKey, propVal); + conn.namespaceOperations().setProperty(Namespace.DEFAULT, propKey, propVal); assertTrue(checkTableHasProp(conn, tableName, propKey, propVal)); http://git-wip-us.apache.org/repos/asf/accumulo/blob/f2d40011/proxy/src/main/java/org/apache/accumulo/proxy/ProxyServer.java ---------------------------------------------------------------------- diff --git a/proxy/src/main/java/org/apache/accumulo/proxy/ProxyServer.java b/proxy/src/main/java/org/apache/accumulo/proxy/ProxyServer.java index 56866c2..45ae8f5 100644 --- a/proxy/src/main/java/org/apache/accumulo/proxy/ProxyServer.java +++ b/proxy/src/main/java/org/apache/accumulo/proxy/ProxyServer.java @@ -64,7 +64,7 @@ import org.apache.accumulo.core.client.admin.CompactionConfig; import org.apache.accumulo.core.client.admin.NewTableConfiguration; import org.apache.accumulo.core.client.admin.TimeType; import org.apache.accumulo.core.client.impl.Credentials; -import org.apache.accumulo.core.client.impl.Namespaces; +import org.apache.accumulo.core.client.impl.Namespace; import org.apache.accumulo.core.client.impl.thrift.TableOperationExceptionType; import org.apache.accumulo.core.client.impl.thrift.ThriftTableOperationException; import org.apache.accumulo.core.client.security.SecurityErrorCode; @@ -1607,12 +1607,12 @@ public class ProxyServer implements AccumuloProxy.Iface { @Override public String systemNamespace() throws TException { - return Namespaces.ACCUMULO_NAMESPACE; + return Namespace.ACCUMULO; } @Override public String defaultNamespace() throws TException { - return Namespaces.DEFAULT_NAMESPACE; + return Namespace.DEFAULT; } @Override http://git-wip-us.apache.org/repos/asf/accumulo/blob/f2d40011/server/base/src/main/java/org/apache/accumulo/server/conf/NamespaceConfiguration.java ---------------------------------------------------------------------- diff --git a/server/base/src/main/java/org/apache/accumulo/server/conf/NamespaceConfiguration.java b/server/base/src/main/java/org/apache/accumulo/server/conf/NamespaceConfiguration.java index 63f6fa7..ed48d1f 100644 --- a/server/base/src/main/java/org/apache/accumulo/server/conf/NamespaceConfiguration.java +++ b/server/base/src/main/java/org/apache/accumulo/server/conf/NamespaceConfiguration.java @@ -22,7 +22,6 @@ import java.util.function.Predicate; import org.apache.accumulo.core.Constants; import org.apache.accumulo.core.client.Instance; import org.apache.accumulo.core.client.impl.Namespace; -import org.apache.accumulo.core.client.impl.Namespaces; import org.apache.accumulo.core.conf.AccumuloConfiguration; import org.apache.accumulo.core.conf.ConfigurationObserver; import org.apache.accumulo.core.conf.ObservableConfiguration; @@ -87,7 +86,7 @@ public class NamespaceConfiguration extends ObservableConfiguration { public String get(Property property) { String key = property.getKey(); AccumuloConfiguration getParent; - if (!(namespaceId.equals(Namespaces.ACCUMULO_NAMESPACE_ID) && isIteratorOrConstraint(key))) { + if (!(namespaceId.equals(Namespace.ID.ACCUMULO) && isIteratorOrConstraint(key))) { getParent = parent; } else { // ignore iterators from parent if system namespace @@ -101,7 +100,7 @@ public class NamespaceConfiguration extends ObservableConfiguration { Predicate<String> parentFilter = filter; // exclude system iterators/constraints from the system namespace // so they don't affect the metadata or root tables. - if (getNamespaceId().equals(Namespaces.ACCUMULO_NAMESPACE_ID)) + if (getNamespaceId().equals(Namespace.ID.ACCUMULO)) parentFilter = key -> isIteratorOrConstraint(key) ? false : filter.test(key); getPropCacheAccessor().getProperties(props, getPath(), filter, parent, parentFilter); http://git-wip-us.apache.org/repos/asf/accumulo/blob/f2d40011/server/base/src/main/java/org/apache/accumulo/server/init/Initialize.java ---------------------------------------------------------------------- diff --git a/server/base/src/main/java/org/apache/accumulo/server/init/Initialize.java b/server/base/src/main/java/org/apache/accumulo/server/init/Initialize.java index cdd2ccd..42117ba 100644 --- a/server/base/src/main/java/org/apache/accumulo/server/init/Initialize.java +++ b/server/base/src/main/java/org/apache/accumulo/server/init/Initialize.java @@ -41,7 +41,7 @@ import org.apache.accumulo.core.client.AccumuloSecurityException; import org.apache.accumulo.core.client.Instance; import org.apache.accumulo.core.client.IteratorSetting; import org.apache.accumulo.core.client.IteratorSetting.Column; -import org.apache.accumulo.core.client.impl.Namespaces; +import org.apache.accumulo.core.client.impl.Namespace; import org.apache.accumulo.core.client.impl.Table; import org.apache.accumulo.core.client.impl.thrift.ThriftSecurityException; import org.apache.accumulo.core.conf.AccumuloConfiguration; @@ -535,12 +535,11 @@ public class Initialize implements KeywordExecutable { zoo.putPersistentData(zkInstanceRoot, EMPTY_BYTE_ARRAY, NodeExistsPolicy.FAIL); zoo.putPersistentData(zkInstanceRoot + Constants.ZTABLES, Constants.ZTABLES_INITIAL_ID, NodeExistsPolicy.FAIL); zoo.putPersistentData(zkInstanceRoot + Constants.ZNAMESPACES, new byte[0], NodeExistsPolicy.FAIL); - TableManager.prepareNewNamespaceState(uuid, Namespaces.DEFAULT_NAMESPACE_ID, Namespaces.DEFAULT_NAMESPACE, NodeExistsPolicy.FAIL); - TableManager.prepareNewNamespaceState(uuid, Namespaces.ACCUMULO_NAMESPACE_ID, Namespaces.ACCUMULO_NAMESPACE, NodeExistsPolicy.FAIL); - TableManager.prepareNewTableState(uuid, RootTable.ID, Namespaces.ACCUMULO_NAMESPACE_ID, RootTable.NAME, TableState.ONLINE, NodeExistsPolicy.FAIL); - TableManager.prepareNewTableState(uuid, MetadataTable.ID, Namespaces.ACCUMULO_NAMESPACE_ID, MetadataTable.NAME, TableState.ONLINE, NodeExistsPolicy.FAIL); - TableManager.prepareNewTableState(uuid, ReplicationTable.ID, Namespaces.ACCUMULO_NAMESPACE_ID, ReplicationTable.NAME, TableState.OFFLINE, - NodeExistsPolicy.FAIL); + TableManager.prepareNewNamespaceState(uuid, Namespace.ID.DEFAULT, Namespace.DEFAULT, NodeExistsPolicy.FAIL); + TableManager.prepareNewNamespaceState(uuid, Namespace.ID.ACCUMULO, Namespace.ACCUMULO, NodeExistsPolicy.FAIL); + TableManager.prepareNewTableState(uuid, RootTable.ID, Namespace.ID.ACCUMULO, RootTable.NAME, TableState.ONLINE, NodeExistsPolicy.FAIL); + TableManager.prepareNewTableState(uuid, MetadataTable.ID, Namespace.ID.ACCUMULO, MetadataTable.NAME, TableState.ONLINE, NodeExistsPolicy.FAIL); + TableManager.prepareNewTableState(uuid, ReplicationTable.ID, Namespace.ID.ACCUMULO, ReplicationTable.NAME, TableState.OFFLINE, NodeExistsPolicy.FAIL); zoo.putPersistentData(zkInstanceRoot + Constants.ZTSERVERS, EMPTY_BYTE_ARRAY, NodeExistsPolicy.FAIL); zoo.putPersistentData(zkInstanceRoot + Constants.ZPROBLEMS, EMPTY_BYTE_ARRAY, NodeExistsPolicy.FAIL); zoo.putPersistentData(zkInstanceRoot + RootTable.ZROOT_TABLET, EMPTY_BYTE_ARRAY, NodeExistsPolicy.FAIL); http://git-wip-us.apache.org/repos/asf/accumulo/blob/f2d40011/server/base/src/main/java/org/apache/accumulo/server/security/SecurityOperation.java ---------------------------------------------------------------------- diff --git a/server/base/src/main/java/org/apache/accumulo/server/security/SecurityOperation.java b/server/base/src/main/java/org/apache/accumulo/server/security/SecurityOperation.java index c7ad65c..d3d98e3 100644 --- a/server/base/src/main/java/org/apache/accumulo/server/security/SecurityOperation.java +++ b/server/base/src/main/java/org/apache/accumulo/server/security/SecurityOperation.java @@ -29,7 +29,6 @@ import org.apache.accumulo.core.client.NamespaceNotFoundException; import org.apache.accumulo.core.client.TableNotFoundException; import org.apache.accumulo.core.client.impl.Credentials; import org.apache.accumulo.core.client.impl.Namespace; -import org.apache.accumulo.core.client.impl.Namespaces; import org.apache.accumulo.core.client.impl.Table; import org.apache.accumulo.core.client.impl.thrift.SecurityErrorCode; import org.apache.accumulo.core.client.impl.thrift.ThriftSecurityException; @@ -379,7 +378,7 @@ public class SecurityOperation { targetUserExists(user); - if (namespace.equals(Namespaces.ACCUMULO_NAMESPACE_ID) && permission.equals(NamespacePermission.READ)) + if (namespace.equals(Namespace.ID.ACCUMULO) && permission.equals(NamespacePermission.READ)) return true; try { http://git-wip-us.apache.org/repos/asf/accumulo/blob/f2d40011/server/base/src/main/java/org/apache/accumulo/server/security/handler/ZKPermHandler.java ---------------------------------------------------------------------- diff --git a/server/base/src/main/java/org/apache/accumulo/server/security/handler/ZKPermHandler.java b/server/base/src/main/java/org/apache/accumulo/server/security/handler/ZKPermHandler.java index 7ffd2f2..b9d0fa5 100644 --- a/server/base/src/main/java/org/apache/accumulo/server/security/handler/ZKPermHandler.java +++ b/server/base/src/main/java/org/apache/accumulo/server/security/handler/ZKPermHandler.java @@ -29,7 +29,6 @@ import org.apache.accumulo.core.client.AccumuloSecurityException; import org.apache.accumulo.core.client.NamespaceNotFoundException; import org.apache.accumulo.core.client.TableNotFoundException; import org.apache.accumulo.core.client.impl.Namespace; -import org.apache.accumulo.core.client.impl.Namespaces; import org.apache.accumulo.core.client.impl.Table; import org.apache.accumulo.core.client.impl.thrift.SecurityErrorCode; import org.apache.accumulo.core.metadata.MetadataTable; @@ -388,8 +387,8 @@ public class ZKPermHandler implements PermissionHandler { tablePerms.put(MetadataTable.ID, Collections.singleton(TablePermission.ALTER_TABLE)); // essentially the same but on the system namespace, the ALTER_TABLE permission is now redundant Map<Namespace.ID,Set<NamespacePermission>> namespacePerms = new HashMap<>(); - namespacePerms.put(Namespaces.ACCUMULO_NAMESPACE_ID, Collections.singleton(NamespacePermission.ALTER_NAMESPACE)); - namespacePerms.put(Namespaces.ACCUMULO_NAMESPACE_ID, Collections.singleton(NamespacePermission.ALTER_TABLE)); + namespacePerms.put(Namespace.ID.ACCUMULO, Collections.singleton(NamespacePermission.ALTER_NAMESPACE)); + namespacePerms.put(Namespace.ID.ACCUMULO, Collections.singleton(NamespacePermission.ALTER_TABLE)); try { // prep parent node of users with root username http://git-wip-us.apache.org/repos/asf/accumulo/blob/f2d40011/server/base/src/test/java/org/apache/accumulo/server/conf/NamespaceConfigurationTest.java ---------------------------------------------------------------------- diff --git a/server/base/src/test/java/org/apache/accumulo/server/conf/NamespaceConfigurationTest.java b/server/base/src/test/java/org/apache/accumulo/server/conf/NamespaceConfigurationTest.java index 6a24333..107b43f 100644 --- a/server/base/src/test/java/org/apache/accumulo/server/conf/NamespaceConfigurationTest.java +++ b/server/base/src/test/java/org/apache/accumulo/server/conf/NamespaceConfigurationTest.java @@ -37,7 +37,6 @@ import java.util.function.Predicate; import org.apache.accumulo.core.Constants; import org.apache.accumulo.core.client.Instance; import org.apache.accumulo.core.client.impl.Namespace; -import org.apache.accumulo.core.client.impl.Namespaces; import org.apache.accumulo.core.conf.AccumuloConfiguration; import org.apache.accumulo.core.conf.ConfigurationObserver; import org.apache.accumulo.core.conf.Property; @@ -105,11 +104,10 @@ public class NamespaceConfigurationTest { @Test public void testGet_SkipParentIfAccumuloNS() { - c = new NamespaceConfiguration(Namespaces.ACCUMULO_NAMESPACE_ID, instance, parent); + c = new NamespaceConfiguration(Namespace.ID.ACCUMULO, instance, parent); c.setZooCacheFactory(zcf); Property p = Property.INSTANCE_SECRET; - expect(zc.get(ZooUtil.getRoot(iid) + Constants.ZNAMESPACES + "/" + Namespaces.ACCUMULO_NAMESPACE_ID + Constants.ZNAMESPACE_CONF + "/" + p.getKey())) - .andReturn(null); + expect(zc.get(ZooUtil.getRoot(iid) + Constants.ZNAMESPACES + "/" + Namespace.ID.ACCUMULO + Constants.ZNAMESPACE_CONF + "/" + p.getKey())).andReturn(null); replay(zc); assertNull(c.get(Property.INSTANCE_SECRET)); } http://git-wip-us.apache.org/repos/asf/accumulo/blob/f2d40011/server/base/src/test/java/org/apache/accumulo/server/master/balancer/HostRegexTableLoadBalancerTest.java ---------------------------------------------------------------------- diff --git a/server/base/src/test/java/org/apache/accumulo/server/master/balancer/HostRegexTableLoadBalancerTest.java b/server/base/src/test/java/org/apache/accumulo/server/master/balancer/HostRegexTableLoadBalancerTest.java index 941021b..e19d05b 100644 --- a/server/base/src/test/java/org/apache/accumulo/server/master/balancer/HostRegexTableLoadBalancerTest.java +++ b/server/base/src/test/java/org/apache/accumulo/server/master/balancer/HostRegexTableLoadBalancerTest.java @@ -28,7 +28,7 @@ import java.util.SortedMap; import java.util.function.Predicate; import java.util.regex.Pattern; -import org.apache.accumulo.core.client.impl.Namespaces; +import org.apache.accumulo.core.client.impl.Namespace; import org.apache.accumulo.core.client.impl.Table; import org.apache.accumulo.core.conf.AccumuloConfiguration; import org.apache.accumulo.core.conf.ConfigurationCopy; @@ -166,7 +166,7 @@ public class HostRegexTableLoadBalancerTest extends BaseHostRegexTableLoadBalanc @Override public TableConfiguration getTableConfiguration(Table.ID tableId) { - NamespaceConfiguration defaultConf = new NamespaceConfiguration(Namespaces.DEFAULT_NAMESPACE_ID, this.instance, DefaultConfiguration.getInstance()); + NamespaceConfiguration defaultConf = new NamespaceConfiguration(Namespace.ID.DEFAULT, this.instance, DefaultConfiguration.getInstance()); return new TableConfiguration(instance, tableId, defaultConf) { HashMap<String,String> tableProperties = new HashMap<>(); { @@ -238,7 +238,7 @@ public class HostRegexTableLoadBalancerTest extends BaseHostRegexTableLoadBalanc @Override public TableConfiguration getTableConfiguration(Table.ID tableId) { - NamespaceConfiguration defaultConf = new NamespaceConfiguration(Namespaces.DEFAULT_NAMESPACE_ID, this.instance, DefaultConfiguration.getInstance()); + NamespaceConfiguration defaultConf = new NamespaceConfiguration(Namespace.ID.DEFAULT, this.instance, DefaultConfiguration.getInstance()); return new TableConfiguration(instance, tableId, defaultConf) { HashMap<String,String> tableProperties = new HashMap<>(); { http://git-wip-us.apache.org/repos/asf/accumulo/blob/f2d40011/server/master/src/main/java/org/apache/accumulo/master/Master.java ---------------------------------------------------------------------- diff --git a/server/master/src/main/java/org/apache/accumulo/master/Master.java b/server/master/src/main/java/org/apache/accumulo/master/Master.java index ae1dff0..0027918 100644 --- a/server/master/src/main/java/org/apache/accumulo/master/Master.java +++ b/server/master/src/main/java/org/apache/accumulo/master/Master.java @@ -390,9 +390,8 @@ public class Master extends AccumuloServerContext implements LiveTServerSet.List // create initial namespaces String namespaces = ZooUtil.getRoot(getInstance()) + Constants.ZNAMESPACES; zoo.putPersistentData(namespaces, new byte[0], NodeExistsPolicy.SKIP); - for (Pair<String,Namespace.ID> namespace : Iterables.concat( - Collections.singleton(new Pair<>(Namespaces.ACCUMULO_NAMESPACE, Namespaces.ACCUMULO_NAMESPACE_ID)), - Collections.singleton(new Pair<>(Namespaces.DEFAULT_NAMESPACE, Namespaces.DEFAULT_NAMESPACE_ID)))) { + for (Pair<String,Namespace.ID> namespace : Iterables.concat(Collections.singleton(new Pair<>(Namespace.ACCUMULO, Namespace.ID.ACCUMULO)), + Collections.singleton(new Pair<>(Namespace.DEFAULT, Namespace.ID.DEFAULT)))) { String ns = namespace.getFirst(); Namespace.ID id = namespace.getSecond(); log.debug("Upgrade creating namespace \"" + ns + "\" (ID: " + id + ")"); @@ -402,22 +401,22 @@ public class Master extends AccumuloServerContext implements LiveTServerSet.List // create replication table in zk log.debug("Upgrade creating table " + ReplicationTable.NAME + " (ID: " + ReplicationTable.ID + ")"); - TableManager.prepareNewTableState(getInstance().getInstanceID(), ReplicationTable.ID, Namespaces.ACCUMULO_NAMESPACE_ID, ReplicationTable.NAME, - TableState.OFFLINE, NodeExistsPolicy.SKIP); + TableManager.prepareNewTableState(getInstance().getInstanceID(), ReplicationTable.ID, Namespace.ID.ACCUMULO, ReplicationTable.NAME, TableState.OFFLINE, + NodeExistsPolicy.SKIP); // create root table log.debug("Upgrade creating table " + RootTable.NAME + " (ID: " + RootTable.ID + ")"); - TableManager.prepareNewTableState(getInstance().getInstanceID(), RootTable.ID, Namespaces.ACCUMULO_NAMESPACE_ID, RootTable.NAME, TableState.ONLINE, + TableManager.prepareNewTableState(getInstance().getInstanceID(), RootTable.ID, Namespace.ID.ACCUMULO, RootTable.NAME, TableState.ONLINE, NodeExistsPolicy.SKIP); Initialize.initSystemTablesConfig(); // ensure root user can flush root table - security.grantTablePermission(rpcCreds(), security.getRootUsername(), RootTable.ID, TablePermission.ALTER_TABLE, Namespaces.ACCUMULO_NAMESPACE_ID); + security.grantTablePermission(rpcCreds(), security.getRootUsername(), RootTable.ID, TablePermission.ALTER_TABLE, Namespace.ID.ACCUMULO); // put existing tables in the correct namespaces String tables = ZooUtil.getRoot(getInstance()) + Constants.ZTABLES; for (String tableId : zoo.getChildren(tables)) { - Namespace.ID targetNamespace = (MetadataTable.ID.canonicalID().equals(tableId) || RootTable.ID.canonicalID().equals(tableId)) ? Namespaces.ACCUMULO_NAMESPACE_ID - : Namespaces.DEFAULT_NAMESPACE_ID; + Namespace.ID targetNamespace = (MetadataTable.ID.canonicalID().equals(tableId) || RootTable.ID.canonicalID().equals(tableId)) ? Namespace.ID.ACCUMULO + : Namespace.ID.DEFAULT; log.debug("Upgrade moving table " + new String(zoo.getData(tables + "/" + tableId + Constants.ZTABLE_NAME, null), UTF_8) + " (ID: " + tableId + ") into namespace with ID " + targetNamespace); zoo.putPersistentData(tables + "/" + tableId + Constants.ZTABLE_NAMESPACE, targetNamespace.getUtf8(), NodeExistsPolicy.SKIP); @@ -436,9 +435,9 @@ public class Master extends AccumuloServerContext implements LiveTServerSet.List String users = ZooUtil.getRoot(getInstance()) + "/users"; for (String user : zoo.getChildren(users)) { zoo.putPersistentData(users + "/" + user + "/Namespaces", new byte[0], NodeExistsPolicy.SKIP); - perm.grantNamespacePermission(user, Namespaces.ACCUMULO_NAMESPACE_ID, NamespacePermission.READ); + perm.grantNamespacePermission(user, Namespace.ID.ACCUMULO, NamespacePermission.READ); } - perm.grantNamespacePermission("root", Namespaces.ACCUMULO_NAMESPACE_ID, NamespacePermission.ALTER_TABLE); + perm.grantNamespacePermission("root", Namespace.ID.ACCUMULO, NamespacePermission.ALTER_TABLE); // add the currlog location for root tablet current logs zoo.putPersistentData(ZooUtil.getRoot(getInstance()) + RootTable.ZROOT_TABLET_CURRENT_LOGS, new byte[0], NodeExistsPolicy.SKIP); http://git-wip-us.apache.org/repos/asf/accumulo/blob/f2d40011/server/master/src/main/java/org/apache/accumulo/master/util/TableValidators.java ---------------------------------------------------------------------- diff --git a/server/master/src/main/java/org/apache/accumulo/master/util/TableValidators.java b/server/master/src/main/java/org/apache/accumulo/master/util/TableValidators.java index 357ddfe..727960c 100644 --- a/server/master/src/main/java/org/apache/accumulo/master/util/TableValidators.java +++ b/server/master/src/main/java/org/apache/accumulo/master/util/TableValidators.java @@ -22,7 +22,7 @@ import static org.apache.accumulo.core.client.impl.Tables.qualify; import java.util.Arrays; import java.util.List; -import org.apache.accumulo.core.client.impl.Namespaces; +import org.apache.accumulo.core.client.impl.Namespace; import org.apache.accumulo.core.client.impl.Table; import org.apache.accumulo.core.metadata.MetadataTable; import org.apache.accumulo.core.metadata.RootTable; @@ -83,12 +83,12 @@ public class TableValidators { @Override public boolean test(String tableName) { - return !Namespaces.ACCUMULO_NAMESPACE.equals(qualify(tableName).getFirst()); + return !Namespace.ACCUMULO.equals(qualify(tableName).getFirst()); } @Override public String invalidMessage(String tableName) { - return "Table cannot be in the " + Namespaces.ACCUMULO_NAMESPACE + " namespace"; + return "Table cannot be in the " + Namespace.ACCUMULO + " namespace"; } }; http://git-wip-us.apache.org/repos/asf/accumulo/blob/f2d40011/shell/src/main/java/org/apache/accumulo/shell/commands/DeleteTableCommand.java ---------------------------------------------------------------------- diff --git a/shell/src/main/java/org/apache/accumulo/shell/commands/DeleteTableCommand.java b/shell/src/main/java/org/apache/accumulo/shell/commands/DeleteTableCommand.java index 55a457c..66c319f 100644 --- a/shell/src/main/java/org/apache/accumulo/shell/commands/DeleteTableCommand.java +++ b/shell/src/main/java/org/apache/accumulo/shell/commands/DeleteTableCommand.java @@ -19,7 +19,7 @@ package org.apache.accumulo.shell.commands; import java.util.Iterator; import java.util.Set; -import org.apache.accumulo.core.client.impl.Namespaces; +import org.apache.accumulo.core.client.impl.Namespace; import org.apache.accumulo.core.client.impl.Tables; import org.apache.accumulo.core.util.Pair; import org.apache.accumulo.shell.Shell; @@ -74,7 +74,7 @@ public class DeleteTableCommand extends TableOperation { while (tableNames.hasNext()) { String table = tableNames.next(); Pair<String,String> qualifiedName = Tables.qualify(table); - if (Namespaces.ACCUMULO_NAMESPACE.equals(qualifiedName.getFirst())) { + if (Namespace.ACCUMULO.equals(qualifiedName.getFirst())) { log.trace("Removing table from deletion set: {}", table); tableNames.remove(); } http://git-wip-us.apache.org/repos/asf/accumulo/blob/f2d40011/shell/src/main/java/org/apache/accumulo/shell/commands/NamespacesCommand.java ---------------------------------------------------------------------- diff --git a/shell/src/main/java/org/apache/accumulo/shell/commands/NamespacesCommand.java b/shell/src/main/java/org/apache/accumulo/shell/commands/NamespacesCommand.java index a7ae6a7..a6d970d 100644 --- a/shell/src/main/java/org/apache/accumulo/shell/commands/NamespacesCommand.java +++ b/shell/src/main/java/org/apache/accumulo/shell/commands/NamespacesCommand.java @@ -23,7 +23,7 @@ import java.util.TreeMap; import org.apache.accumulo.core.client.AccumuloException; import org.apache.accumulo.core.client.AccumuloSecurityException; -import org.apache.accumulo.core.client.impl.Namespaces; +import org.apache.accumulo.core.client.impl.Namespace; import org.apache.accumulo.shell.Shell; import org.apache.accumulo.shell.Shell.Command; import org.apache.commons.cli.CommandLine; @@ -43,7 +43,7 @@ public class NamespacesCommand extends Command { Iterator<String> it = Iterators.transform(namespaces.entrySet().iterator(), entry -> { String name = entry.getKey(); - if (Namespaces.DEFAULT_NAMESPACE.equals(name)) + if (Namespace.DEFAULT.equals(name)) name = DEFAULT_NAMESPACE_DISPLAY_NAME; String id = entry.getValue(); if (cl.hasOption(namespaceIdOption.getOpt())) http://git-wip-us.apache.org/repos/asf/accumulo/blob/f2d40011/test/src/main/java/org/apache/accumulo/test/LargeSplitRowIT.java ---------------------------------------------------------------------- diff --git a/test/src/main/java/org/apache/accumulo/test/LargeSplitRowIT.java b/test/src/main/java/org/apache/accumulo/test/LargeSplitRowIT.java index 73a2355..897ae6e 100644 --- a/test/src/main/java/org/apache/accumulo/test/LargeSplitRowIT.java +++ b/test/src/main/java/org/apache/accumulo/test/LargeSplitRowIT.java @@ -29,7 +29,7 @@ import org.apache.accumulo.core.client.BatchWriterConfig; import org.apache.accumulo.core.client.Connector; import org.apache.accumulo.core.client.Scanner; import org.apache.accumulo.core.client.impl.AccumuloServerException; -import org.apache.accumulo.core.client.impl.Namespaces; +import org.apache.accumulo.core.client.impl.Namespace; import org.apache.accumulo.core.conf.ConfigurationTypeHelper; import org.apache.accumulo.core.conf.Property; import org.apache.accumulo.core.data.Key; @@ -187,7 +187,7 @@ public class LargeSplitRowIT extends ConfigurableMacBase { while (iterator.hasNext()) { String curr = iterator.next(); - if (!curr.startsWith(Namespaces.ACCUMULO_NAMESPACE + ".")) { + if (!curr.startsWith(Namespace.ACCUMULO + ".")) { tableName = curr; } } http://git-wip-us.apache.org/repos/asf/accumulo/blob/f2d40011/test/src/main/java/org/apache/accumulo/test/NamespacesIT.java ---------------------------------------------------------------------- diff --git a/test/src/main/java/org/apache/accumulo/test/NamespacesIT.java b/test/src/main/java/org/apache/accumulo/test/NamespacesIT.java index c4879b4..89f1de2 100644 --- a/test/src/main/java/org/apache/accumulo/test/NamespacesIT.java +++ b/test/src/main/java/org/apache/accumulo/test/NamespacesIT.java @@ -54,7 +54,7 @@ import org.apache.accumulo.core.client.TableNotFoundException; import org.apache.accumulo.core.client.admin.NamespaceOperations; import org.apache.accumulo.core.client.admin.NewTableConfiguration; import org.apache.accumulo.core.client.admin.TableOperations; -import org.apache.accumulo.core.client.impl.Namespaces; +import org.apache.accumulo.core.client.impl.Namespace; import org.apache.accumulo.core.client.impl.Tables; import org.apache.accumulo.core.client.impl.thrift.TableOperation; import org.apache.accumulo.core.client.impl.thrift.TableOperationExceptionType; @@ -115,11 +115,11 @@ public class NamespacesIT extends AccumuloClusterHarness { } // clean up any added tables, namespaces, and users, after each test for (String t : c.tableOperations().list()) - if (!Tables.qualify(t).getFirst().equals(Namespaces.ACCUMULO_NAMESPACE)) + if (!Tables.qualify(t).getFirst().equals(Namespace.ACCUMULO)) c.tableOperations().delete(t); assertEquals(3, c.tableOperations().list().size()); for (String n : c.namespaceOperations().list()) - if (!n.equals(Namespaces.ACCUMULO_NAMESPACE) && !n.equals(Namespaces.DEFAULT_NAMESPACE)) + if (!n.equals(Namespace.ACCUMULO) && !n.equals(Namespace.DEFAULT)) c.namespaceOperations().delete(n); assertEquals(2, c.namespaceOperations().list().size()); for (String u : c.securityOperations().listLocalUsers()) @@ -130,14 +130,14 @@ public class NamespacesIT extends AccumuloClusterHarness { @Test public void checkReservedNamespaces() throws Exception { - assertEquals(c.namespaceOperations().defaultNamespace(), Namespaces.DEFAULT_NAMESPACE); - assertEquals(c.namespaceOperations().systemNamespace(), Namespaces.ACCUMULO_NAMESPACE); + assertEquals(c.namespaceOperations().defaultNamespace(), Namespace.DEFAULT); + assertEquals(c.namespaceOperations().systemNamespace(), Namespace.ACCUMULO); } @Test public void checkBuiltInNamespaces() throws Exception { - assertTrue(c.namespaceOperations().exists(Namespaces.DEFAULT_NAMESPACE)); - assertTrue(c.namespaceOperations().exists(Namespaces.ACCUMULO_NAMESPACE)); + assertTrue(c.namespaceOperations().exists(Namespace.DEFAULT)); + assertTrue(c.namespaceOperations().exists(Namespace.ACCUMULO)); } @Test @@ -149,19 +149,19 @@ public class NamespacesIT extends AccumuloClusterHarness { @Test(expected = AccumuloException.class) public void createTableInAccumuloNamespace() throws Exception { - String tableName = Namespaces.ACCUMULO_NAMESPACE + ".1"; + String tableName = Namespace.ACCUMULO + ".1"; assertFalse(c.tableOperations().exists(tableName)); c.tableOperations().create(tableName); // should fail } @Test(expected = AccumuloSecurityException.class) public void deleteDefaultNamespace() throws Exception { - c.namespaceOperations().delete(Namespaces.DEFAULT_NAMESPACE); // should fail + c.namespaceOperations().delete(Namespace.DEFAULT); // should fail } @Test(expected = AccumuloSecurityException.class) public void deleteAccumuloNamespace() throws Exception { - c.namespaceOperations().delete(Namespaces.ACCUMULO_NAMESPACE); // should fail + c.namespaceOperations().delete(Namespace.ACCUMULO); // should fail } @Test @@ -254,14 +254,14 @@ public class NamespacesIT extends AccumuloClusterHarness { // verify no property assertFalse(checkNamespaceHasProp(namespace, k, v)); assertFalse(checkTableHasProp(t1, k, v)); - assertFalse(checkNamespaceHasProp(Namespaces.DEFAULT_NAMESPACE, k, v)); + assertFalse(checkNamespaceHasProp(Namespace.DEFAULT, k, v)); assertFalse(checkTableHasProp(t0, k, v)); // set property and verify c.namespaceOperations().setProperty(namespace, k, v); assertTrue(checkNamespaceHasProp(namespace, k, v)); assertTrue(checkTableHasProp(t1, k, v)); - assertFalse(checkNamespaceHasProp(Namespaces.DEFAULT_NAMESPACE, k, v)); + assertFalse(checkNamespaceHasProp(Namespace.DEFAULT, k, v)); assertFalse(checkTableHasProp(t0, k, v)); // add a new table to namespace and verify @@ -271,7 +271,7 @@ public class NamespacesIT extends AccumuloClusterHarness { assertTrue(checkNamespaceHasProp(namespace, k, v)); assertTrue(checkTableHasProp(t1, k, v)); assertTrue(checkTableHasProp(t2, k, v)); - assertFalse(checkNamespaceHasProp(Namespaces.DEFAULT_NAMESPACE, k, v)); + assertFalse(checkNamespaceHasProp(Namespace.DEFAULT, k, v)); assertFalse(checkTableHasProp(t0, k, v)); // remove property and verify @@ -279,15 +279,15 @@ public class NamespacesIT extends AccumuloClusterHarness { assertFalse(checkNamespaceHasProp(namespace, k, v)); assertFalse(checkTableHasProp(t1, k, v)); assertFalse(checkTableHasProp(t2, k, v)); - assertFalse(checkNamespaceHasProp(Namespaces.DEFAULT_NAMESPACE, k, v)); + assertFalse(checkNamespaceHasProp(Namespace.DEFAULT, k, v)); assertFalse(checkTableHasProp(t0, k, v)); // set property on default namespace and verify - c.namespaceOperations().setProperty(Namespaces.DEFAULT_NAMESPACE, k, v); + c.namespaceOperations().setProperty(Namespace.DEFAULT, k, v); assertFalse(checkNamespaceHasProp(namespace, k, v)); assertFalse(checkTableHasProp(t1, k, v)); assertFalse(checkTableHasProp(t2, k, v)); - assertTrue(checkNamespaceHasProp(Namespaces.DEFAULT_NAMESPACE, k, v)); + assertTrue(checkNamespaceHasProp(Namespace.DEFAULT, k, v)); assertTrue(checkTableHasProp(t0, k, v)); // test that table properties override namespace properties @@ -865,10 +865,10 @@ public class NamespacesIT extends AccumuloClusterHarness { throws Exception { // nobody should have any of these properties yet assertFalse(c.instanceOperations().getSystemConfiguration().containsValue(v)); - assertFalse(checkNamespaceHasProp(Namespaces.ACCUMULO_NAMESPACE, k, v)); + assertFalse(checkNamespaceHasProp(Namespace.ACCUMULO, k, v)); assertFalse(checkTableHasProp(RootTable.NAME, k, v)); assertFalse(checkTableHasProp(MetadataTable.NAME, k, v)); - assertFalse(checkNamespaceHasProp(Namespaces.DEFAULT_NAMESPACE, k, v)); + assertFalse(checkNamespaceHasProp(Namespace.DEFAULT, k, v)); assertFalse(checkTableHasProp(defaultNamespaceTable, k, v)); assertFalse(checkNamespaceHasProp(namespace, k, v)); assertFalse(checkTableHasProp(namespaceTable, k, v)); @@ -878,10 +878,10 @@ public class NamespacesIT extends AccumuloClusterHarness { // doesn't take effect immediately, needs time to propagate to tserver's ZooKeeper cache sleepUninterruptibly(250, TimeUnit.MILLISECONDS); assertTrue(c.instanceOperations().getSystemConfiguration().containsValue(v)); - assertEquals(systemNamespaceShouldInherit, checkNamespaceHasProp(Namespaces.ACCUMULO_NAMESPACE, k, v)); + assertEquals(systemNamespaceShouldInherit, checkNamespaceHasProp(Namespace.ACCUMULO, k, v)); assertEquals(systemNamespaceShouldInherit, checkTableHasProp(RootTable.NAME, k, v)); assertEquals(systemNamespaceShouldInherit, checkTableHasProp(MetadataTable.NAME, k, v)); - assertTrue(checkNamespaceHasProp(Namespaces.DEFAULT_NAMESPACE, k, v)); + assertTrue(checkNamespaceHasProp(Namespace.DEFAULT, k, v)); assertTrue(checkTableHasProp(defaultNamespaceTable, k, v)); assertTrue(checkNamespaceHasProp(namespace, k, v)); assertTrue(checkTableHasProp(namespaceTable, k, v)); @@ -891,10 +891,10 @@ public class NamespacesIT extends AccumuloClusterHarness { // doesn't take effect immediately, needs time to propagate to tserver's ZooKeeper cache sleepUninterruptibly(250, TimeUnit.MILLISECONDS); assertFalse(c.instanceOperations().getSystemConfiguration().containsValue(v)); - assertFalse(checkNamespaceHasProp(Namespaces.ACCUMULO_NAMESPACE, k, v)); + assertFalse(checkNamespaceHasProp(Namespace.ACCUMULO, k, v)); assertFalse(checkTableHasProp(RootTable.NAME, k, v)); assertFalse(checkTableHasProp(MetadataTable.NAME, k, v)); - assertFalse(checkNamespaceHasProp(Namespaces.DEFAULT_NAMESPACE, k, v)); + assertFalse(checkNamespaceHasProp(Namespace.DEFAULT, k, v)); assertFalse(checkTableHasProp(defaultNamespaceTable, k, v)); assertFalse(checkNamespaceHasProp(namespace, k, v)); assertFalse(checkTableHasProp(namespaceTable, k, v)); @@ -906,11 +906,11 @@ public class NamespacesIT extends AccumuloClusterHarness { Map<String,String> map = c.namespaceOperations().namespaceIdMap(); assertEquals(2, namespaces.size()); assertEquals(2, map.size()); - assertTrue(namespaces.contains(Namespaces.ACCUMULO_NAMESPACE)); - assertTrue(namespaces.contains(Namespaces.DEFAULT_NAMESPACE)); + assertTrue(namespaces.contains(Namespace.ACCUMULO)); + assertTrue(namespaces.contains(Namespace.DEFAULT)); assertFalse(namespaces.contains(namespace)); - assertEquals(Namespaces.ACCUMULO_NAMESPACE_ID.canonicalID(), map.get(Namespaces.ACCUMULO_NAMESPACE)); - assertEquals(Namespaces.DEFAULT_NAMESPACE_ID.canonicalID(), map.get(Namespaces.DEFAULT_NAMESPACE)); + assertEquals(Namespace.ID.ACCUMULO.canonicalID(), map.get(Namespace.ACCUMULO)); + assertEquals(Namespace.ID.DEFAULT.canonicalID(), map.get(Namespace.DEFAULT)); assertNull(map.get(namespace)); c.namespaceOperations().create(namespace); @@ -918,11 +918,11 @@ public class NamespacesIT extends AccumuloClusterHarness { map = c.namespaceOperations().namespaceIdMap(); assertEquals(3, namespaces.size()); assertEquals(3, map.size()); - assertTrue(namespaces.contains(Namespaces.ACCUMULO_NAMESPACE)); - assertTrue(namespaces.contains(Namespaces.DEFAULT_NAMESPACE)); + assertTrue(namespaces.contains(Namespace.ACCUMULO)); + assertTrue(namespaces.contains(Namespace.DEFAULT)); assertTrue(namespaces.contains(namespace)); - assertEquals(Namespaces.ACCUMULO_NAMESPACE_ID.canonicalID(), map.get(Namespaces.ACCUMULO_NAMESPACE)); - assertEquals(Namespaces.DEFAULT_NAMESPACE_ID.canonicalID(), map.get(Namespaces.DEFAULT_NAMESPACE)); + assertEquals(Namespace.ID.ACCUMULO.canonicalID(), map.get(Namespace.ACCUMULO)); + assertEquals(Namespace.ID.DEFAULT.canonicalID(), map.get(Namespace.DEFAULT)); assertNotNull(map.get(namespace)); c.namespaceOperations().delete(namespace); @@ -930,18 +930,18 @@ public class NamespacesIT extends AccumuloClusterHarness { map = c.namespaceOperations().namespaceIdMap(); assertEquals(2, namespaces.size()); assertEquals(2, map.size()); - assertTrue(namespaces.contains(Namespaces.ACCUMULO_NAMESPACE)); - assertTrue(namespaces.contains(Namespaces.DEFAULT_NAMESPACE)); + assertTrue(namespaces.contains(Namespace.ACCUMULO)); + assertTrue(namespaces.contains(Namespace.DEFAULT)); assertFalse(namespaces.contains(namespace)); - assertEquals(Namespaces.ACCUMULO_NAMESPACE_ID.canonicalID(), map.get(Namespaces.ACCUMULO_NAMESPACE)); - assertEquals(Namespaces.DEFAULT_NAMESPACE_ID.canonicalID(), map.get(Namespaces.DEFAULT_NAMESPACE)); + assertEquals(Namespace.ID.ACCUMULO.canonicalID(), map.get(Namespace.ACCUMULO)); + assertEquals(Namespace.ID.DEFAULT.canonicalID(), map.get(Namespace.DEFAULT)); assertNull(map.get(namespace)); } @Test public void loadClass() throws Exception { - assertTrue(c.namespaceOperations().testClassLoad(Namespaces.DEFAULT_NAMESPACE, VersioningIterator.class.getName(), SortedKeyValueIterator.class.getName())); - assertFalse(c.namespaceOperations().testClassLoad(Namespaces.DEFAULT_NAMESPACE, "dummy", SortedKeyValueIterator.class.getName())); + assertTrue(c.namespaceOperations().testClassLoad(Namespace.DEFAULT, VersioningIterator.class.getName(), SortedKeyValueIterator.class.getName())); + assertFalse(c.namespaceOperations().testClassLoad(Namespace.DEFAULT, "dummy", SortedKeyValueIterator.class.getName())); try { c.namespaceOperations().testClassLoad(namespace, "dummy", "dummy"); fail(); @@ -1348,21 +1348,21 @@ public class NamespacesIT extends AccumuloClusterHarness { fail(); break; case 2: - ops.create(Namespaces.DEFAULT_NAMESPACE); + ops.create(Namespace.DEFAULT); fail(); break; case 3: - ops.create(Namespaces.ACCUMULO_NAMESPACE); + ops.create(Namespace.ACCUMULO); fail(); break; case 4: ops.create(namespace + i + "_1"); - ops.rename(namespace + i + "_1", Namespaces.DEFAULT_NAMESPACE); // should fail here + ops.rename(namespace + i + "_1", Namespace.DEFAULT); // should fail here fail(); break; case 5: ops.create(namespace + i + "_1"); - ops.rename(namespace + i + "_1", Namespaces.ACCUMULO_NAMESPACE); // should fail here + ops.rename(namespace + i + "_1", Namespace.ACCUMULO); // should fail here fail(); break; default: http://git-wip-us.apache.org/repos/asf/accumulo/blob/f2d40011/test/src/main/java/org/apache/accumulo/test/ShellServerIT.java ---------------------------------------------------------------------- diff --git a/test/src/main/java/org/apache/accumulo/test/ShellServerIT.java b/test/src/main/java/org/apache/accumulo/test/ShellServerIT.java index 3948fd9..dcb49dc 100644 --- a/test/src/main/java/org/apache/accumulo/test/ShellServerIT.java +++ b/test/src/main/java/org/apache/accumulo/test/ShellServerIT.java @@ -49,7 +49,7 @@ import org.apache.accumulo.core.client.IteratorSetting; import org.apache.accumulo.core.client.Scanner; import org.apache.accumulo.core.client.TableNotFoundException; import org.apache.accumulo.core.client.admin.TableOperations; -import org.apache.accumulo.core.client.impl.Namespaces; +import org.apache.accumulo.core.client.impl.Namespace; import org.apache.accumulo.core.client.sample.RowSampler; import org.apache.accumulo.core.client.security.tokens.AuthenticationToken; import org.apache.accumulo.core.client.security.tokens.KerberosToken; @@ -311,7 +311,7 @@ public class ShellServerIT extends SharedMiniClusterBase { public void deleteTables() throws Exception { Connector c = getConnector(); for (String table : c.tableOperations().list()) { - if (!table.startsWith(Namespaces.ACCUMULO_NAMESPACE + ".") && !table.equals("trace")) + if (!table.startsWith(Namespace.ACCUMULO + ".") && !table.equals("trace")) try { c.tableOperations().delete(table); } catch (TableNotFoundException e) { @@ -1643,7 +1643,7 @@ public class ShellServerIT extends SharedMiniClusterBase { @Test public void namespaces() throws Exception { ts.exec("namespaces", true, "\"\"", true); // default namespace, displayed as quoted empty string - ts.exec("namespaces", true, Namespaces.ACCUMULO_NAMESPACE, true); + ts.exec("namespaces", true, Namespace.ACCUMULO, true); ts.exec("createnamespace thing1", true); String namespaces = ts.exec("namespaces"); assertTrue(namespaces.contains("thing1")); http://git-wip-us.apache.org/repos/asf/accumulo/blob/f2d40011/test/src/main/java/org/apache/accumulo/test/TableConfigurationUpdateIT.java ---------------------------------------------------------------------- diff --git a/test/src/main/java/org/apache/accumulo/test/TableConfigurationUpdateIT.java b/test/src/main/java/org/apache/accumulo/test/TableConfigurationUpdateIT.java index dba0c5b..6f086b9 100644 --- a/test/src/main/java/org/apache/accumulo/test/TableConfigurationUpdateIT.java +++ b/test/src/main/java/org/apache/accumulo/test/TableConfigurationUpdateIT.java @@ -27,7 +27,7 @@ import java.util.concurrent.TimeUnit; import org.apache.accumulo.core.client.Connector; import org.apache.accumulo.core.client.Instance; -import org.apache.accumulo.core.client.impl.Namespaces; +import org.apache.accumulo.core.client.impl.Namespace; import org.apache.accumulo.core.conf.AccumuloConfiguration; import org.apache.accumulo.core.conf.DefaultConfiguration; import org.apache.accumulo.core.conf.Property; @@ -55,7 +55,7 @@ public class TableConfigurationUpdateIT extends AccumuloClusterHarness { String table = getUniqueNames(1)[0]; conn.tableOperations().create(table); - final NamespaceConfiguration defaultConf = new NamespaceConfiguration(Namespaces.DEFAULT_NAMESPACE_ID, inst, DefaultConfiguration.getInstance()); + final NamespaceConfiguration defaultConf = new NamespaceConfiguration(Namespace.ID.DEFAULT, inst, DefaultConfiguration.getInstance()); // Cache invalidates 25% of the time int randomMax = 4; http://git-wip-us.apache.org/repos/asf/accumulo/blob/f2d40011/test/src/main/java/org/apache/accumulo/test/proxy/SimpleProxyBase.java ---------------------------------------------------------------------- diff --git a/test/src/main/java/org/apache/accumulo/test/proxy/SimpleProxyBase.java b/test/src/main/java/org/apache/accumulo/test/proxy/SimpleProxyBase.java index 70d0c06..ec962d1 100644 --- a/test/src/main/java/org/apache/accumulo/test/proxy/SimpleProxyBase.java +++ b/test/src/main/java/org/apache/accumulo/test/proxy/SimpleProxyBase.java @@ -48,7 +48,7 @@ import org.apache.accumulo.cluster.ClusterUser; import org.apache.accumulo.core.client.ClientConfiguration; import org.apache.accumulo.core.client.Connector; import org.apache.accumulo.core.client.Instance; -import org.apache.accumulo.core.client.impl.Namespaces; +import org.apache.accumulo.core.client.impl.Namespace; import org.apache.accumulo.core.client.security.tokens.KerberosToken; import org.apache.accumulo.core.client.security.tokens.PasswordToken; import org.apache.accumulo.core.conf.DefaultConfiguration; @@ -2619,8 +2619,8 @@ public abstract class SimpleProxyBase extends SharedMiniClusterBase { @Test public void namespaceOperations() throws Exception { // default namespace and accumulo namespace - assertEquals("System namespace is wrong", client.systemNamespace(), Namespaces.ACCUMULO_NAMESPACE); - assertEquals("Default namespace is wrong", client.defaultNamespace(), Namespaces.DEFAULT_NAMESPACE); + assertEquals("System namespace is wrong", client.systemNamespace(), Namespace.ACCUMULO); + assertEquals("Default namespace is wrong", client.defaultNamespace(), Namespace.DEFAULT); // namespace existance and namespace listing assertTrue("Namespace created during setup should exist", client.namespaceExists(creds, namespaceName)); http://git-wip-us.apache.org/repos/asf/accumulo/blob/f2d40011/test/src/main/java/org/apache/accumulo/test/proxy/TestProxyNamespaceOperations.java ---------------------------------------------------------------------- diff --git a/test/src/main/java/org/apache/accumulo/test/proxy/TestProxyNamespaceOperations.java b/test/src/main/java/org/apache/accumulo/test/proxy/TestProxyNamespaceOperations.java index 301145d..5e76978 100644 --- a/test/src/main/java/org/apache/accumulo/test/proxy/TestProxyNamespaceOperations.java +++ b/test/src/main/java/org/apache/accumulo/test/proxy/TestProxyNamespaceOperations.java @@ -28,7 +28,7 @@ import java.util.HashSet; import java.util.Properties; import java.util.Set; -import org.apache.accumulo.core.client.impl.Namespaces; +import org.apache.accumulo.core.client.impl.Namespace; import org.apache.accumulo.core.client.security.tokens.PasswordToken; import org.apache.accumulo.proxy.Proxy; import org.apache.accumulo.proxy.thrift.AccumuloException; @@ -103,8 +103,8 @@ public class TestProxyNamespaceOperations { @Test public void systemDefault() throws TException { - assertEquals(tpc.proxy().systemNamespace(), Namespaces.ACCUMULO_NAMESPACE); - assertEquals(tpc.proxy().defaultNamespace(), Namespaces.DEFAULT_NAMESPACE); + assertEquals(tpc.proxy().systemNamespace(), Namespace.ACCUMULO); + assertEquals(tpc.proxy().defaultNamespace(), Namespace.DEFAULT); } @Test