You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by bi...@apache.org on 2012/01/10 16:57:00 UTC

svn commit: r1229610 - in /incubator/accumulo/trunk: ./ src/core/ src/core/src/main/java/org/apache/accumulo/core/client/admin/ src/core/src/main/java/org/apache/accumulo/core/client/mock/ src/core/src/test/java/org/apache/accumulo/core/client/admin/ s...

Author: billie
Date: Tue Jan 10 15:56:59 2012
New Revision: 1229610

URL: http://svn.apache.org/viewvc?rev=1229610&view=rev
Log:
ACCUMULO-217 employed more TableNotFound / TableExists Exceptions in TableOperations - merged to trunk

Added:
    incubator/accumulo/trunk/src/core/src/test/java/org/apache/accumulo/core/client/mock/MockTableOperationsTest.java
      - copied unchanged from r1229205, incubator/accumulo/branches/1.4/src/core/src/test/java/org/apache/accumulo/core/client/mock/MockTableOperationsTest.java
Modified:
    incubator/accumulo/trunk/   (props changed)
    incubator/accumulo/trunk/src/core/   (props changed)
    incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/client/admin/TableOperationsHelper.java
    incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/client/mock/MockTableOperations.java
    incubator/accumulo/trunk/src/core/src/test/java/org/apache/accumulo/core/client/admin/TableOperationsHelperTest.java
    incubator/accumulo/trunk/src/server/   (props changed)

Propchange: incubator/accumulo/trunk/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Jan 10 15:56:59 2012
@@ -1,3 +1,3 @@
 /incubator/accumulo/branches/1.3:1190280,1190413,1190420,1190427,1190500,1195622,1195625,1195629,1195635,1196044,1196054,1196057,1196071-1196072,1196106,1197066,1198935,1199383,1203683,1204625,1205547,1205880,1206169,1208031,1209124,1209526,1209532,1209539,1209541,1209587,1209657,1210518,1210571,1210596,1210598,1213424,1214320,1225006,1227215,1227231,1227611,1228195
 /incubator/accumulo/branches/1.3.5rc:1209938
-/incubator/accumulo/branches/1.4:1201902-1228245,1228308,1229220,1229248,1229357
+/incubator/accumulo/branches/1.4:1201902-1228245,1228308,1229205,1229220,1229248,1229357

Propchange: incubator/accumulo/trunk/src/core/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Jan 10 15:56:59 2012
@@ -1,3 +1,3 @@
 /incubator/accumulo/branches/1.3.5rc/src/core:1209938
 /incubator/accumulo/branches/1.3/src/core:1190280,1190413,1190420,1190427,1190500,1195622,1195625,1195629,1195635,1196044,1196054,1196057,1196071-1196072,1196106,1197066,1198935,1199383,1203683,1204625,1205547,1205880,1206169,1208031,1209124,1209526,1209532,1209539,1209541,1209587,1209657,1210518,1210571,1210596,1210598,1213424,1214320,1225006,1227215
-/incubator/accumulo/branches/1.4/src/core:1201902-1228245,1228308,1229220,1229248,1229357
+/incubator/accumulo/branches/1.4/src/core:1201902-1228245,1228308,1229205,1229220,1229248,1229357

Modified: incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/client/admin/TableOperationsHelper.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/client/admin/TableOperationsHelper.java?rev=1229610&r1=1229609&r2=1229610&view=diff
==============================================================================
--- incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/client/admin/TableOperationsHelper.java (original)
+++ incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/client/admin/TableOperationsHelper.java Tue Jan 10 15:56:59 2012
@@ -48,6 +48,8 @@ public abstract class TableOperationsHel
   @Override
   public void removeIterator(String tableName, String name, EnumSet<IteratorScope> scopes) throws AccumuloSecurityException, AccumuloException,
       TableNotFoundException {
+    if (!exists(tableName))
+      throw new TableNotFoundException(null, tableName, null);
     Map<String,String> copy = new TreeMap<String,String>();
     for (Entry<String,String> property : this.getProperties(tableName)) {
       copy.put(property.getKey(), property.getValue());
@@ -64,6 +66,8 @@ public abstract class TableOperationsHel
   @Override
   public IteratorSetting getIteratorSetting(String tableName, String name, IteratorScope scope) throws AccumuloSecurityException, AccumuloException,
       TableNotFoundException {
+    if (!exists(tableName))
+      throw new TableNotFoundException(null, tableName, null);
     int priority = -1;
     String classname = null;
     Map<String,String> settings = new HashMap<String,String>();
@@ -90,6 +94,8 @@ public abstract class TableOperationsHel
   
   @Override
   public Set<String> listIterators(String tableName) throws AccumuloSecurityException, AccumuloException, TableNotFoundException {
+    if (!exists(tableName))
+      throw new TableNotFoundException(null, tableName, null);
     Set<String> result = new HashSet<String>();
     Set<String> lifecycles = new HashSet<String>();
     for (IteratorScope scope : IteratorScope.values())
@@ -107,6 +113,8 @@ public abstract class TableOperationsHel
   
   @Override
   public void checkIteratorConflicts(String tableName, IteratorSetting setting) throws AccumuloException, TableNotFoundException {
+    if (!exists(tableName))
+      throw new TableNotFoundException(null, tableName, null);
     for (IteratorScope scope : setting.getScopes()) {
       String scopeStr = String.format("%s%s", Property.TABLE_ITERATOR_PREFIX, scope.name().toLowerCase());
       String nameStr = String.format("%s.%s", scopeStr, setting.getName());

Modified: incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/client/mock/MockTableOperations.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/client/mock/MockTableOperations.java?rev=1229610&r1=1229609&r2=1229610&view=diff
==============================================================================
--- incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/client/mock/MockTableOperations.java (original)
+++ incubator/accumulo/trunk/src/core/src/main/java/org/apache/accumulo/core/client/mock/MockTableOperations.java Tue Jan 10 15:56:59 2012
@@ -81,6 +81,8 @@ public class MockTableOperations extends
     if (!tableName.matches(Constants.VALID_TABLE_NAME_REGEX)) {
       throw new IllegalArgumentException();
     }
+    if (exists(tableName))
+      throw new TableExistsException(tableName, tableName, "");
     acu.createTable(username, tableName, versioningIter, timeType);
   }
   
@@ -90,30 +92,42 @@ public class MockTableOperations extends
   @Override
   public void addAggregators(String tableName, List<? extends PerColumnIteratorConfig> aggregators) throws AccumuloSecurityException, TableNotFoundException,
       AccumuloException {
+    if (!exists(tableName))
+      throw new TableNotFoundException(tableName, tableName, "");
     acu.addAggregators(tableName, aggregators);
   }
   
   @Override
-  public void addSplits(String tableName, SortedSet<Text> partitionKeys) throws TableNotFoundException, AccumuloException, AccumuloSecurityException {}
+  public void addSplits(String tableName, SortedSet<Text> partitionKeys) throws TableNotFoundException, AccumuloException, AccumuloSecurityException {
+    throw new NotImplementedException();
+  }
   
   @Override
-  public Collection<Text> getSplits(String tableName) {
+  public Collection<Text> getSplits(String tableName) throws TableNotFoundException {
+    if (!exists(tableName))
+      throw new TableNotFoundException(tableName, tableName, "");
     return Collections.emptyList();
   }
   
   @Override
-  public Collection<Text> getSplits(String tableName, int maxSplits) {
-    return Collections.emptyList();
+  public Collection<Text> getSplits(String tableName, int maxSplits) throws TableNotFoundException {
+    return getSplits(tableName);
   }
   
   @Override
   public void delete(String tableName) throws AccumuloException, AccumuloSecurityException, TableNotFoundException {
+    if (!exists(tableName))
+      throw new TableNotFoundException(tableName, tableName, "");
     acu.tables.remove(tableName);
   }
   
   @Override
   public void rename(String oldTableName, String newTableName) throws AccumuloSecurityException, TableNotFoundException, AccumuloException,
       TableExistsException {
+    if (!exists(oldTableName))
+      throw new TableNotFoundException(oldTableName, oldTableName, "");
+    if (exists(newTableName))
+      throw new TableExistsException(newTableName, newTableName, "");
     MockTable t = acu.tables.remove(oldTableName);
     acu.tables.put(newTableName, t);
   }
@@ -133,15 +147,19 @@ public class MockTableOperations extends
   
   @Override
   public Iterable<Entry<String,String>> getProperties(String tableName) throws TableNotFoundException {
+    if (!exists(tableName))
+      throw new TableNotFoundException(tableName, tableName, "");
     return acu.tables.get(tableName).settings.entrySet();
   }
   
   @Override
-  public void setLocalityGroups(String tableName, Map<String,Set<Text>> groups) throws AccumuloException, AccumuloSecurityException, TableNotFoundException {}
+  public void setLocalityGroups(String tableName, Map<String,Set<Text>> groups) throws AccumuloException, AccumuloSecurityException, TableNotFoundException {
+    throw new NotImplementedException();
+  }
   
   @Override
   public Map<String,Set<Text>> getLocalityGroups(String tableName) throws AccumuloException, TableNotFoundException {
-    return null;
+    throw new NotImplementedException();
   }
   
   @Override
@@ -163,13 +181,17 @@ public class MockTableOperations extends
   }
   
   @Override
-  public void offline(String tableName) throws AccumuloSecurityException, AccumuloException {}
+  public void offline(String tableName) throws AccumuloSecurityException, AccumuloException {
+    throw new NotImplementedException();
+  }
   
   @Override
   public void online(String tableName) throws AccumuloSecurityException, AccumuloException {}
   
   @Override
-  public void clearLocatorCache(String tableName) throws TableNotFoundException {}
+  public void clearLocatorCache(String tableName) throws TableNotFoundException {
+    throw new NotImplementedException();
+  }
   
   @Override
   public Map<String,String> tableIdMap() {

Modified: incubator/accumulo/trunk/src/core/src/test/java/org/apache/accumulo/core/client/admin/TableOperationsHelperTest.java
URL: http://svn.apache.org/viewvc/incubator/accumulo/trunk/src/core/src/test/java/org/apache/accumulo/core/client/admin/TableOperationsHelperTest.java?rev=1229610&r1=1229609&r2=1229610&view=diff
==============================================================================
--- incubator/accumulo/trunk/src/core/src/test/java/org/apache/accumulo/core/client/admin/TableOperationsHelperTest.java (original)
+++ incubator/accumulo/trunk/src/core/src/test/java/org/apache/accumulo/core/client/admin/TableOperationsHelperTest.java Tue Jan 10 15:56:59 2012
@@ -54,7 +54,7 @@ public class TableOperationsHelperTest {
     
     @Override
     public boolean exists(String tableName) {
-      return false;
+      return true;
     }
     
     @Override

Propchange: incubator/accumulo/trunk/src/server/
------------------------------------------------------------------------------
--- svn:mergeinfo (original)
+++ svn:mergeinfo Tue Jan 10 15:56:59 2012
@@ -1,3 +1,3 @@
 /incubator/accumulo/branches/1.3.5rc/src/server:1209938
 /incubator/accumulo/branches/1.3/src/server:1190280,1190413,1190420,1190427,1190500,1195622,1195625,1195629,1195635,1196044,1196054,1196057,1196071-1196072,1196106,1197066,1198935,1199383,1203683,1204625,1205547,1205880,1206169,1208031,1209124,1209526,1209532,1209539,1209541,1209587,1209657,1210518,1210571,1210596,1210598,1213424,1214320,1225006,1227215,1227231,1227611
-/incubator/accumulo/branches/1.4/src/server:1201902-1228245,1228308,1229220,1229248,1229357
+/incubator/accumulo/branches/1.4/src/server:1201902-1228245,1228308,1229205,1229220,1229248,1229357