You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@accumulo.apache.org by kt...@apache.org on 2013/04/18 20:30:31 UTC
svn commit: r1469516 - in /accumulo/trunk: ./ assemble/ core/ examples/
fate/src/main/java/org/apache/accumulo/fate/
fate/src/main/java/org/apache/accumulo/fate/zookeeper/
proxy/src/main/java/org/apache/accumulo/proxy/
proxy/src/main/java/org/apache/ac...
Author: kturner
Date: Thu Apr 18 18:30:30 2013
New Revision: 1469516
URL: http://svn.apache.org/r1469516
Log:
ACCUMULO-1199 mode some more methods in proxy throw table not found exception. cleaned up proxy formatting. made proxy throw more specific exceptions.
Modified:
accumulo/trunk/ (props changed)
accumulo/trunk/assemble/ (props changed)
accumulo/trunk/core/ (props changed)
accumulo/trunk/examples/ (props changed)
accumulo/trunk/fate/src/main/java/org/apache/accumulo/fate/ZooStore.java (props changed)
accumulo/trunk/fate/src/main/java/org/apache/accumulo/fate/zookeeper/ZooSession.java (props changed)
accumulo/trunk/pom.xml (props changed)
accumulo/trunk/proxy/src/main/java/org/apache/accumulo/proxy/ProxyServer.java
accumulo/trunk/proxy/src/main/java/org/apache/accumulo/proxy/thrift/AccumuloProxy.java
accumulo/trunk/proxy/src/main/thrift/proxy.thrift
accumulo/trunk/proxy/src/test/java/org/apache/accumulo/proxy/SimpleTest.java
accumulo/trunk/server/ (props changed)
accumulo/trunk/src/ (props changed)
Propchange: accumulo/trunk/
------------------------------------------------------------------------------
Merged /accumulo/branches/1.5:r1469503
Propchange: accumulo/trunk/assemble/
------------------------------------------------------------------------------
Merged /accumulo/branches/1.5/assemble:r1469503
Propchange: accumulo/trunk/core/
------------------------------------------------------------------------------
Merged /accumulo/branches/1.5/core:r1469503
Propchange: accumulo/trunk/examples/
------------------------------------------------------------------------------
Merged /accumulo/branches/1.5/examples:r1469503
Propchange: accumulo/trunk/fate/src/main/java/org/apache/accumulo/fate/ZooStore.java
------------------------------------------------------------------------------
Merged /accumulo/branches/1.5/fate/src/main/java/org/apache/accumulo/fate/ZooStore.java:r1469503
Propchange: accumulo/trunk/fate/src/main/java/org/apache/accumulo/fate/zookeeper/ZooSession.java
------------------------------------------------------------------------------
Merged /accumulo/branches/1.5/fate/src/main/java/org/apache/accumulo/fate/zookeeper/ZooSession.java:r1469503
Propchange: accumulo/trunk/pom.xml
------------------------------------------------------------------------------
Merged /accumulo/branches/1.5/pom.xml:r1469503
Modified: accumulo/trunk/proxy/src/main/java/org/apache/accumulo/proxy/ProxyServer.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/proxy/src/main/java/org/apache/accumulo/proxy/ProxyServer.java?rev=1469516&r1=1469515&r2=1469516&view=diff
==============================================================================
--- accumulo/trunk/proxy/src/main/java/org/apache/accumulo/proxy/ProxyServer.java (original)
+++ accumulo/trunk/proxy/src/main/java/org/apache/accumulo/proxy/ProxyServer.java Thu Apr 18 18:30:30 2013
@@ -50,6 +50,8 @@ import org.apache.accumulo.core.client.Z
import org.apache.accumulo.core.client.admin.ActiveCompaction;
import org.apache.accumulo.core.client.admin.ActiveScan;
import org.apache.accumulo.core.client.admin.TimeType;
+import org.apache.accumulo.core.client.impl.thrift.TableOperationExceptionType;
+import org.apache.accumulo.core.client.impl.thrift.ThriftTableOperationException;
import org.apache.accumulo.core.client.mock.MockInstance;
import org.apache.accumulo.core.client.security.SecurityErrorCode;
import org.apache.accumulo.core.client.security.tokens.AuthenticationToken;
@@ -144,7 +146,7 @@ public class ProxyServer implements Accu
protected Cache<UUID,BatchWriterPlusException> writerCache;
public ProxyServer(Properties props) {
-
+
String useMock = props.getProperty("org.apache.accumulo.proxy.ProxyServer.useMockInstance");
if (useMock != null && Boolean.parseBoolean(useMock))
instance = new MockInstance();
@@ -157,7 +159,7 @@ public class ProxyServer implements Accu
} catch (ClassNotFoundException e) {
throw new RuntimeException(e);
}
-
+
scannerCache = CacheBuilder.newBuilder().expireAfterAccess(10, TimeUnit.MINUTES).maximumSize(1000).removalListener(new CloseScanner()).build();
writerCache = CacheBuilder.newBuilder().expireAfterAccess(10, TimeUnit.MINUTES).maximumSize(1000).removalListener(new CloseWriter()).build();
@@ -175,21 +177,27 @@ public class ProxyServer implements Accu
try {
throw ex;
} catch (MutationsRejectedException e) {
- logger.debug(e,e);
- return new org.apache.accumulo.proxy.thrift.MutationsRejectedException(e.toString());
+ logger.debug(e, e);
+ return new org.apache.accumulo.proxy.thrift.MutationsRejectedException(e.toString());
} catch (AccumuloException e) {
- logger.debug(e,e);
+ if (e.getCause() instanceof ThriftTableOperationException) {
+ ThriftTableOperationException ttoe = (ThriftTableOperationException) e.getCause();
+ if (ttoe.type == TableOperationExceptionType.NOTFOUND) {
+ return new org.apache.accumulo.proxy.thrift.TableNotFoundException(e.toString());
+ }
+ }
+ logger.debug(e, e);
return new org.apache.accumulo.proxy.thrift.AccumuloException(e.toString());
} catch (AccumuloSecurityException e) {
- logger.debug(e,e);
+ logger.debug(e, e);
if (e.getSecurityErrorCode().equals(SecurityErrorCode.TABLE_DOESNT_EXIST))
return new org.apache.accumulo.proxy.thrift.TableNotFoundException(e.toString());
return new org.apache.accumulo.proxy.thrift.AccumuloSecurityException(e.toString());
} catch (TableNotFoundException e) {
- logger.debug(e,e);
+ logger.debug(e, e);
return new org.apache.accumulo.proxy.thrift.TableNotFoundException(e.toString());
} catch (TableExistsException e) {
- logger.debug(e,e);
+ logger.debug(e, e);
return new org.apache.accumulo.proxy.thrift.TableExistsException(e.toString());
} catch (RuntimeException e) {
if (e.getCause() != null) {
@@ -628,7 +636,7 @@ public class ProxyServer implements Accu
}
@Override
- public boolean authenticateUser(ByteBuffer login, String principal, Map<String, String> properties) throws TException {
+ public boolean authenticateUser(ByteBuffer login, String principal, Map<String,String> properties) throws TException {
try {
return getConnector(login).securityOperations().authenticateUser(principal, getToken(principal, properties));
} catch (Exception e) {
@@ -840,7 +848,7 @@ public class ProxyServer implements Accu
}
}
scanner.setRanges(ranges);
-
+
if (opts.columns != null) {
for (ScanColumn col : opts.columns) {
if (col.isSetColQualifier())
@@ -850,7 +858,7 @@ public class ProxyServer implements Accu
}
}
}
-
+
UUID uuid = UUID.randomUUID();
ScannerPlusIterator spi = new ScannerPlusIterator();
@@ -1235,7 +1243,7 @@ public class ProxyServer implements Accu
}
}
- private AuthenticationToken getToken(String principal, Map<String, String> properties) throws AccumuloSecurityException, AccumuloException {
+ private AuthenticationToken getToken(String principal, Map<String,String> properties) throws AccumuloSecurityException, AccumuloException {
Properties props = new Properties();
props.putAll(properties);
AuthenticationToken token;
Modified: accumulo/trunk/proxy/src/main/java/org/apache/accumulo/proxy/thrift/AccumuloProxy.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/proxy/src/main/java/org/apache/accumulo/proxy/thrift/AccumuloProxy.java?rev=1469516&r1=1469515&r2=1469516&view=diff
==============================================================================
--- accumulo/trunk/proxy/src/main/java/org/apache/accumulo/proxy/thrift/AccumuloProxy.java (original)
+++ accumulo/trunk/proxy/src/main/java/org/apache/accumulo/proxy/thrift/AccumuloProxy.java Thu Apr 18 18:30:30 2013
@@ -104,17 +104,17 @@ import org.slf4j.LoggerFactory;
public void onlineTable(ByteBuffer login, String tableName) throws AccumuloException, AccumuloSecurityException, TableNotFoundException, org.apache.thrift.TException;
- public void removeConstraint(ByteBuffer login, String tableName, int constraint) throws AccumuloException, AccumuloSecurityException, org.apache.thrift.TException;
+ public void removeConstraint(ByteBuffer login, String tableName, int constraint) throws AccumuloException, AccumuloSecurityException, TableNotFoundException, org.apache.thrift.TException;
public void removeIterator(ByteBuffer login, String tableName, String iterName, Set<IteratorScope> scopes) throws AccumuloException, AccumuloSecurityException, TableNotFoundException, org.apache.thrift.TException;
- public void removeTableProperty(ByteBuffer login, String tableName, String property) throws AccumuloException, AccumuloSecurityException, org.apache.thrift.TException;
+ public void removeTableProperty(ByteBuffer login, String tableName, String property) throws AccumuloException, AccumuloSecurityException, TableNotFoundException, org.apache.thrift.TException;
public void renameTable(ByteBuffer login, String oldTableName, String newTableName) throws AccumuloException, AccumuloSecurityException, TableNotFoundException, TableExistsException, org.apache.thrift.TException;
public void setLocalityGroups(ByteBuffer login, String tableName, Map<String,Set<String>> groups) throws AccumuloException, AccumuloSecurityException, TableNotFoundException, org.apache.thrift.TException;
- public void setTableProperty(ByteBuffer login, String tableName, String property, String value) throws AccumuloException, AccumuloSecurityException, org.apache.thrift.TException;
+ public void setTableProperty(ByteBuffer login, String tableName, String property, String value) throws AccumuloException, AccumuloSecurityException, TableNotFoundException, org.apache.thrift.TException;
public Set<Range> splitRangeByTablets(ByteBuffer login, String tableName, Range range, int maxSplits) throws AccumuloException, AccumuloSecurityException, TableNotFoundException, org.apache.thrift.TException;
@@ -1206,7 +1206,7 @@ import org.slf4j.LoggerFactory;
return;
}
- public void removeConstraint(ByteBuffer login, String tableName, int constraint) throws AccumuloException, AccumuloSecurityException, org.apache.thrift.TException
+ public void removeConstraint(ByteBuffer login, String tableName, int constraint) throws AccumuloException, AccumuloSecurityException, TableNotFoundException, org.apache.thrift.TException
{
send_removeConstraint(login, tableName, constraint);
recv_removeConstraint();
@@ -1221,7 +1221,7 @@ import org.slf4j.LoggerFactory;
sendBase("removeConstraint", args);
}
- public void recv_removeConstraint() throws AccumuloException, AccumuloSecurityException, org.apache.thrift.TException
+ public void recv_removeConstraint() throws AccumuloException, AccumuloSecurityException, TableNotFoundException, org.apache.thrift.TException
{
removeConstraint_result result = new removeConstraint_result();
receiveBase(result, "removeConstraint");
@@ -1231,6 +1231,9 @@ import org.slf4j.LoggerFactory;
if (result.ouch2 != null) {
throw result.ouch2;
}
+ if (result.ouch3 != null) {
+ throw result.ouch3;
+ }
return;
}
@@ -1266,7 +1269,7 @@ import org.slf4j.LoggerFactory;
return;
}
- public void removeTableProperty(ByteBuffer login, String tableName, String property) throws AccumuloException, AccumuloSecurityException, org.apache.thrift.TException
+ public void removeTableProperty(ByteBuffer login, String tableName, String property) throws AccumuloException, AccumuloSecurityException, TableNotFoundException, org.apache.thrift.TException
{
send_removeTableProperty(login, tableName, property);
recv_removeTableProperty();
@@ -1281,7 +1284,7 @@ import org.slf4j.LoggerFactory;
sendBase("removeTableProperty", args);
}
- public void recv_removeTableProperty() throws AccumuloException, AccumuloSecurityException, org.apache.thrift.TException
+ public void recv_removeTableProperty() throws AccumuloException, AccumuloSecurityException, TableNotFoundException, org.apache.thrift.TException
{
removeTableProperty_result result = new removeTableProperty_result();
receiveBase(result, "removeTableProperty");
@@ -1291,6 +1294,9 @@ import org.slf4j.LoggerFactory;
if (result.ouch2 != null) {
throw result.ouch2;
}
+ if (result.ouch3 != null) {
+ throw result.ouch3;
+ }
return;
}
@@ -1359,7 +1365,7 @@ import org.slf4j.LoggerFactory;
return;
}
- public void setTableProperty(ByteBuffer login, String tableName, String property, String value) throws AccumuloException, AccumuloSecurityException, org.apache.thrift.TException
+ public void setTableProperty(ByteBuffer login, String tableName, String property, String value) throws AccumuloException, AccumuloSecurityException, TableNotFoundException, org.apache.thrift.TException
{
send_setTableProperty(login, tableName, property, value);
recv_setTableProperty();
@@ -1375,7 +1381,7 @@ import org.slf4j.LoggerFactory;
sendBase("setTableProperty", args);
}
- public void recv_setTableProperty() throws AccumuloException, AccumuloSecurityException, org.apache.thrift.TException
+ public void recv_setTableProperty() throws AccumuloException, AccumuloSecurityException, TableNotFoundException, org.apache.thrift.TException
{
setTableProperty_result result = new setTableProperty_result();
receiveBase(result, "setTableProperty");
@@ -1385,6 +1391,9 @@ import org.slf4j.LoggerFactory;
if (result.ouch2 != null) {
throw result.ouch2;
}
+ if (result.ouch3 != null) {
+ throw result.ouch3;
+ }
return;
}
@@ -3575,7 +3584,7 @@ import org.slf4j.LoggerFactory;
prot.writeMessageEnd();
}
- public void getResult() throws AccumuloException, AccumuloSecurityException, org.apache.thrift.TException {
+ public void getResult() throws AccumuloException, AccumuloSecurityException, TableNotFoundException, org.apache.thrift.TException {
if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
throw new IllegalStateException("Method call not finished!");
}
@@ -3654,7 +3663,7 @@ import org.slf4j.LoggerFactory;
prot.writeMessageEnd();
}
- public void getResult() throws AccumuloException, AccumuloSecurityException, org.apache.thrift.TException {
+ public void getResult() throws AccumuloException, AccumuloSecurityException, TableNotFoundException, org.apache.thrift.TException {
if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
throw new IllegalStateException("Method call not finished!");
}
@@ -3771,7 +3780,7 @@ import org.slf4j.LoggerFactory;
prot.writeMessageEnd();
}
- public void getResult() throws AccumuloException, AccumuloSecurityException, org.apache.thrift.TException {
+ public void getResult() throws AccumuloException, AccumuloSecurityException, TableNotFoundException, org.apache.thrift.TException {
if (getState() != org.apache.thrift.async.TAsyncMethodCall.State.RESPONSE_READ) {
throw new IllegalStateException("Method call not finished!");
}
@@ -5983,6 +5992,8 @@ import org.slf4j.LoggerFactory;
result.ouch1 = ouch1;
} catch (AccumuloSecurityException ouch2) {
result.ouch2 = ouch2;
+ } catch (TableNotFoundException ouch3) {
+ result.ouch3 = ouch3;
}
return result;
}
@@ -6037,6 +6048,8 @@ import org.slf4j.LoggerFactory;
result.ouch1 = ouch1;
} catch (AccumuloSecurityException ouch2) {
result.ouch2 = ouch2;
+ } catch (TableNotFoundException ouch3) {
+ result.ouch3 = ouch3;
}
return result;
}
@@ -6121,6 +6134,8 @@ import org.slf4j.LoggerFactory;
result.ouch1 = ouch1;
} catch (AccumuloSecurityException ouch2) {
result.ouch2 = ouch2;
+ } catch (TableNotFoundException ouch3) {
+ result.ouch3 = ouch3;
}
return result;
}
@@ -39944,6 +39959,7 @@ import org.slf4j.LoggerFactory;
private static final org.apache.thrift.protocol.TField OUCH1_FIELD_DESC = new org.apache.thrift.protocol.TField("ouch1", org.apache.thrift.protocol.TType.STRUCT, (short)1);
private static final org.apache.thrift.protocol.TField OUCH2_FIELD_DESC = new org.apache.thrift.protocol.TField("ouch2", org.apache.thrift.protocol.TType.STRUCT, (short)2);
+ private static final org.apache.thrift.protocol.TField OUCH3_FIELD_DESC = new org.apache.thrift.protocol.TField("ouch3", org.apache.thrift.protocol.TType.STRUCT, (short)3);
private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
static {
@@ -39953,11 +39969,13 @@ import org.slf4j.LoggerFactory;
public AccumuloException ouch1; // required
public AccumuloSecurityException ouch2; // required
+ public TableNotFoundException ouch3; // required
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
@SuppressWarnings("all") public enum _Fields implements org.apache.thrift.TFieldIdEnum {
OUCH1((short)1, "ouch1"),
- OUCH2((short)2, "ouch2");
+ OUCH2((short)2, "ouch2"),
+ OUCH3((short)3, "ouch3");
private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
@@ -39976,6 +39994,8 @@ import org.slf4j.LoggerFactory;
return OUCH1;
case 2: // OUCH2
return OUCH2;
+ case 3: // OUCH3
+ return OUCH3;
default:
return null;
}
@@ -40023,6 +40043,8 @@ import org.slf4j.LoggerFactory;
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT)));
tmpMap.put(_Fields.OUCH2, new org.apache.thrift.meta_data.FieldMetaData("ouch2", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT)));
+ tmpMap.put(_Fields.OUCH3, new org.apache.thrift.meta_data.FieldMetaData("ouch3", org.apache.thrift.TFieldRequirementType.DEFAULT,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT)));
metaDataMap = Collections.unmodifiableMap(tmpMap);
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(removeConstraint_result.class, metaDataMap);
}
@@ -40032,11 +40054,13 @@ import org.slf4j.LoggerFactory;
public removeConstraint_result(
AccumuloException ouch1,
- AccumuloSecurityException ouch2)
+ AccumuloSecurityException ouch2,
+ TableNotFoundException ouch3)
{
this();
this.ouch1 = ouch1;
this.ouch2 = ouch2;
+ this.ouch3 = ouch3;
}
/**
@@ -40049,6 +40073,9 @@ import org.slf4j.LoggerFactory;
if (other.isSetOuch2()) {
this.ouch2 = new AccumuloSecurityException(other.ouch2);
}
+ if (other.isSetOuch3()) {
+ this.ouch3 = new TableNotFoundException(other.ouch3);
+ }
}
public removeConstraint_result deepCopy() {
@@ -40059,6 +40086,7 @@ import org.slf4j.LoggerFactory;
public void clear() {
this.ouch1 = null;
this.ouch2 = null;
+ this.ouch3 = null;
}
public AccumuloException getOuch1() {
@@ -40109,6 +40137,30 @@ import org.slf4j.LoggerFactory;
}
}
+ public TableNotFoundException getOuch3() {
+ return this.ouch3;
+ }
+
+ public removeConstraint_result setOuch3(TableNotFoundException ouch3) {
+ this.ouch3 = ouch3;
+ return this;
+ }
+
+ public void unsetOuch3() {
+ this.ouch3 = null;
+ }
+
+ /** Returns true if field ouch3 is set (has been assigned a value) and false otherwise */
+ public boolean isSetOuch3() {
+ return this.ouch3 != null;
+ }
+
+ public void setOuch3IsSet(boolean value) {
+ if (!value) {
+ this.ouch3 = null;
+ }
+ }
+
public void setFieldValue(_Fields field, Object value) {
switch (field) {
case OUCH1:
@@ -40127,6 +40179,14 @@ import org.slf4j.LoggerFactory;
}
break;
+ case OUCH3:
+ if (value == null) {
+ unsetOuch3();
+ } else {
+ setOuch3((TableNotFoundException)value);
+ }
+ break;
+
}
}
@@ -40138,6 +40198,9 @@ import org.slf4j.LoggerFactory;
case OUCH2:
return getOuch2();
+ case OUCH3:
+ return getOuch3();
+
}
throw new IllegalStateException();
}
@@ -40153,6 +40216,8 @@ import org.slf4j.LoggerFactory;
return isSetOuch1();
case OUCH2:
return isSetOuch2();
+ case OUCH3:
+ return isSetOuch3();
}
throw new IllegalStateException();
}
@@ -40188,6 +40253,15 @@ import org.slf4j.LoggerFactory;
return false;
}
+ boolean this_present_ouch3 = true && this.isSetOuch3();
+ boolean that_present_ouch3 = true && that.isSetOuch3();
+ if (this_present_ouch3 || that_present_ouch3) {
+ if (!(this_present_ouch3 && that_present_ouch3))
+ return false;
+ if (!this.ouch3.equals(that.ouch3))
+ return false;
+ }
+
return true;
}
@@ -40224,6 +40298,16 @@ import org.slf4j.LoggerFactory;
return lastComparison;
}
}
+ lastComparison = Boolean.valueOf(isSetOuch3()).compareTo(typedOther.isSetOuch3());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetOuch3()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.ouch3, typedOther.ouch3);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
return 0;
}
@@ -40259,6 +40343,14 @@ import org.slf4j.LoggerFactory;
sb.append(this.ouch2);
}
first = false;
+ if (!first) sb.append(", ");
+ sb.append("ouch3:");
+ if (this.ouch3 == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.ouch3);
+ }
+ first = false;
sb.append(")");
return sb.toString();
}
@@ -40320,6 +40412,15 @@ import org.slf4j.LoggerFactory;
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
+ case 3: // OUCH3
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
+ struct.ouch3 = new TableNotFoundException();
+ struct.ouch3.read(iprot);
+ struct.setOuch3IsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
default:
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
@@ -40345,6 +40446,11 @@ import org.slf4j.LoggerFactory;
struct.ouch2.write(oprot);
oprot.writeFieldEnd();
}
+ if (struct.ouch3 != null) {
+ oprot.writeFieldBegin(OUCH3_FIELD_DESC);
+ struct.ouch3.write(oprot);
+ oprot.writeFieldEnd();
+ }
oprot.writeFieldStop();
oprot.writeStructEnd();
}
@@ -40369,19 +40475,25 @@ import org.slf4j.LoggerFactory;
if (struct.isSetOuch2()) {
optionals.set(1);
}
- oprot.writeBitSet(optionals, 2);
+ if (struct.isSetOuch3()) {
+ optionals.set(2);
+ }
+ oprot.writeBitSet(optionals, 3);
if (struct.isSetOuch1()) {
struct.ouch1.write(oprot);
}
if (struct.isSetOuch2()) {
struct.ouch2.write(oprot);
}
+ if (struct.isSetOuch3()) {
+ struct.ouch3.write(oprot);
+ }
}
@Override
public void read(org.apache.thrift.protocol.TProtocol prot, removeConstraint_result struct) throws org.apache.thrift.TException {
TTupleProtocol iprot = (TTupleProtocol) prot;
- BitSet incoming = iprot.readBitSet(2);
+ BitSet incoming = iprot.readBitSet(3);
if (incoming.get(0)) {
struct.ouch1 = new AccumuloException();
struct.ouch1.read(iprot);
@@ -40392,6 +40504,11 @@ import org.slf4j.LoggerFactory;
struct.ouch2.read(iprot);
struct.setOuch2IsSet(true);
}
+ if (incoming.get(2)) {
+ struct.ouch3 = new TableNotFoundException();
+ struct.ouch3.read(iprot);
+ struct.setOuch3IsSet(true);
+ }
}
}
@@ -42244,6 +42361,7 @@ import org.slf4j.LoggerFactory;
private static final org.apache.thrift.protocol.TField OUCH1_FIELD_DESC = new org.apache.thrift.protocol.TField("ouch1", org.apache.thrift.protocol.TType.STRUCT, (short)1);
private static final org.apache.thrift.protocol.TField OUCH2_FIELD_DESC = new org.apache.thrift.protocol.TField("ouch2", org.apache.thrift.protocol.TType.STRUCT, (short)2);
+ private static final org.apache.thrift.protocol.TField OUCH3_FIELD_DESC = new org.apache.thrift.protocol.TField("ouch3", org.apache.thrift.protocol.TType.STRUCT, (short)3);
private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
static {
@@ -42253,11 +42371,13 @@ import org.slf4j.LoggerFactory;
public AccumuloException ouch1; // required
public AccumuloSecurityException ouch2; // required
+ public TableNotFoundException ouch3; // required
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
@SuppressWarnings("all") public enum _Fields implements org.apache.thrift.TFieldIdEnum {
OUCH1((short)1, "ouch1"),
- OUCH2((short)2, "ouch2");
+ OUCH2((short)2, "ouch2"),
+ OUCH3((short)3, "ouch3");
private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
@@ -42276,6 +42396,8 @@ import org.slf4j.LoggerFactory;
return OUCH1;
case 2: // OUCH2
return OUCH2;
+ case 3: // OUCH3
+ return OUCH3;
default:
return null;
}
@@ -42323,6 +42445,8 @@ import org.slf4j.LoggerFactory;
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT)));
tmpMap.put(_Fields.OUCH2, new org.apache.thrift.meta_data.FieldMetaData("ouch2", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT)));
+ tmpMap.put(_Fields.OUCH3, new org.apache.thrift.meta_data.FieldMetaData("ouch3", org.apache.thrift.TFieldRequirementType.DEFAULT,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT)));
metaDataMap = Collections.unmodifiableMap(tmpMap);
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(removeTableProperty_result.class, metaDataMap);
}
@@ -42332,11 +42456,13 @@ import org.slf4j.LoggerFactory;
public removeTableProperty_result(
AccumuloException ouch1,
- AccumuloSecurityException ouch2)
+ AccumuloSecurityException ouch2,
+ TableNotFoundException ouch3)
{
this();
this.ouch1 = ouch1;
this.ouch2 = ouch2;
+ this.ouch3 = ouch3;
}
/**
@@ -42349,6 +42475,9 @@ import org.slf4j.LoggerFactory;
if (other.isSetOuch2()) {
this.ouch2 = new AccumuloSecurityException(other.ouch2);
}
+ if (other.isSetOuch3()) {
+ this.ouch3 = new TableNotFoundException(other.ouch3);
+ }
}
public removeTableProperty_result deepCopy() {
@@ -42359,6 +42488,7 @@ import org.slf4j.LoggerFactory;
public void clear() {
this.ouch1 = null;
this.ouch2 = null;
+ this.ouch3 = null;
}
public AccumuloException getOuch1() {
@@ -42409,6 +42539,30 @@ import org.slf4j.LoggerFactory;
}
}
+ public TableNotFoundException getOuch3() {
+ return this.ouch3;
+ }
+
+ public removeTableProperty_result setOuch3(TableNotFoundException ouch3) {
+ this.ouch3 = ouch3;
+ return this;
+ }
+
+ public void unsetOuch3() {
+ this.ouch3 = null;
+ }
+
+ /** Returns true if field ouch3 is set (has been assigned a value) and false otherwise */
+ public boolean isSetOuch3() {
+ return this.ouch3 != null;
+ }
+
+ public void setOuch3IsSet(boolean value) {
+ if (!value) {
+ this.ouch3 = null;
+ }
+ }
+
public void setFieldValue(_Fields field, Object value) {
switch (field) {
case OUCH1:
@@ -42427,6 +42581,14 @@ import org.slf4j.LoggerFactory;
}
break;
+ case OUCH3:
+ if (value == null) {
+ unsetOuch3();
+ } else {
+ setOuch3((TableNotFoundException)value);
+ }
+ break;
+
}
}
@@ -42438,6 +42600,9 @@ import org.slf4j.LoggerFactory;
case OUCH2:
return getOuch2();
+ case OUCH3:
+ return getOuch3();
+
}
throw new IllegalStateException();
}
@@ -42453,6 +42618,8 @@ import org.slf4j.LoggerFactory;
return isSetOuch1();
case OUCH2:
return isSetOuch2();
+ case OUCH3:
+ return isSetOuch3();
}
throw new IllegalStateException();
}
@@ -42488,6 +42655,15 @@ import org.slf4j.LoggerFactory;
return false;
}
+ boolean this_present_ouch3 = true && this.isSetOuch3();
+ boolean that_present_ouch3 = true && that.isSetOuch3();
+ if (this_present_ouch3 || that_present_ouch3) {
+ if (!(this_present_ouch3 && that_present_ouch3))
+ return false;
+ if (!this.ouch3.equals(that.ouch3))
+ return false;
+ }
+
return true;
}
@@ -42524,6 +42700,16 @@ import org.slf4j.LoggerFactory;
return lastComparison;
}
}
+ lastComparison = Boolean.valueOf(isSetOuch3()).compareTo(typedOther.isSetOuch3());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetOuch3()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.ouch3, typedOther.ouch3);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
return 0;
}
@@ -42559,6 +42745,14 @@ import org.slf4j.LoggerFactory;
sb.append(this.ouch2);
}
first = false;
+ if (!first) sb.append(", ");
+ sb.append("ouch3:");
+ if (this.ouch3 == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.ouch3);
+ }
+ first = false;
sb.append(")");
return sb.toString();
}
@@ -42620,6 +42814,15 @@ import org.slf4j.LoggerFactory;
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
+ case 3: // OUCH3
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
+ struct.ouch3 = new TableNotFoundException();
+ struct.ouch3.read(iprot);
+ struct.setOuch3IsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
default:
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
@@ -42645,6 +42848,11 @@ import org.slf4j.LoggerFactory;
struct.ouch2.write(oprot);
oprot.writeFieldEnd();
}
+ if (struct.ouch3 != null) {
+ oprot.writeFieldBegin(OUCH3_FIELD_DESC);
+ struct.ouch3.write(oprot);
+ oprot.writeFieldEnd();
+ }
oprot.writeFieldStop();
oprot.writeStructEnd();
}
@@ -42669,19 +42877,25 @@ import org.slf4j.LoggerFactory;
if (struct.isSetOuch2()) {
optionals.set(1);
}
- oprot.writeBitSet(optionals, 2);
+ if (struct.isSetOuch3()) {
+ optionals.set(2);
+ }
+ oprot.writeBitSet(optionals, 3);
if (struct.isSetOuch1()) {
struct.ouch1.write(oprot);
}
if (struct.isSetOuch2()) {
struct.ouch2.write(oprot);
}
+ if (struct.isSetOuch3()) {
+ struct.ouch3.write(oprot);
+ }
}
@Override
public void read(org.apache.thrift.protocol.TProtocol prot, removeTableProperty_result struct) throws org.apache.thrift.TException {
TTupleProtocol iprot = (TTupleProtocol) prot;
- BitSet incoming = iprot.readBitSet(2);
+ BitSet incoming = iprot.readBitSet(3);
if (incoming.get(0)) {
struct.ouch1 = new AccumuloException();
struct.ouch1.read(iprot);
@@ -42692,6 +42906,11 @@ import org.slf4j.LoggerFactory;
struct.ouch2.read(iprot);
struct.setOuch2IsSet(true);
}
+ if (incoming.get(2)) {
+ struct.ouch3 = new TableNotFoundException();
+ struct.ouch3.read(iprot);
+ struct.setOuch3IsSet(true);
+ }
}
}
@@ -45818,6 +46037,7 @@ import org.slf4j.LoggerFactory;
private static final org.apache.thrift.protocol.TField OUCH1_FIELD_DESC = new org.apache.thrift.protocol.TField("ouch1", org.apache.thrift.protocol.TType.STRUCT, (short)1);
private static final org.apache.thrift.protocol.TField OUCH2_FIELD_DESC = new org.apache.thrift.protocol.TField("ouch2", org.apache.thrift.protocol.TType.STRUCT, (short)2);
+ private static final org.apache.thrift.protocol.TField OUCH3_FIELD_DESC = new org.apache.thrift.protocol.TField("ouch3", org.apache.thrift.protocol.TType.STRUCT, (short)3);
private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
static {
@@ -45827,11 +46047,13 @@ import org.slf4j.LoggerFactory;
public AccumuloException ouch1; // required
public AccumuloSecurityException ouch2; // required
+ public TableNotFoundException ouch3; // required
/** The set of fields this struct contains, along with convenience methods for finding and manipulating them. */
@SuppressWarnings("all") public enum _Fields implements org.apache.thrift.TFieldIdEnum {
OUCH1((short)1, "ouch1"),
- OUCH2((short)2, "ouch2");
+ OUCH2((short)2, "ouch2"),
+ OUCH3((short)3, "ouch3");
private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
@@ -45850,6 +46072,8 @@ import org.slf4j.LoggerFactory;
return OUCH1;
case 2: // OUCH2
return OUCH2;
+ case 3: // OUCH3
+ return OUCH3;
default:
return null;
}
@@ -45897,6 +46121,8 @@ import org.slf4j.LoggerFactory;
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT)));
tmpMap.put(_Fields.OUCH2, new org.apache.thrift.meta_data.FieldMetaData("ouch2", org.apache.thrift.TFieldRequirementType.DEFAULT,
new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT)));
+ tmpMap.put(_Fields.OUCH3, new org.apache.thrift.meta_data.FieldMetaData("ouch3", org.apache.thrift.TFieldRequirementType.DEFAULT,
+ new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRUCT)));
metaDataMap = Collections.unmodifiableMap(tmpMap);
org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(setTableProperty_result.class, metaDataMap);
}
@@ -45906,11 +46132,13 @@ import org.slf4j.LoggerFactory;
public setTableProperty_result(
AccumuloException ouch1,
- AccumuloSecurityException ouch2)
+ AccumuloSecurityException ouch2,
+ TableNotFoundException ouch3)
{
this();
this.ouch1 = ouch1;
this.ouch2 = ouch2;
+ this.ouch3 = ouch3;
}
/**
@@ -45923,6 +46151,9 @@ import org.slf4j.LoggerFactory;
if (other.isSetOuch2()) {
this.ouch2 = new AccumuloSecurityException(other.ouch2);
}
+ if (other.isSetOuch3()) {
+ this.ouch3 = new TableNotFoundException(other.ouch3);
+ }
}
public setTableProperty_result deepCopy() {
@@ -45933,6 +46164,7 @@ import org.slf4j.LoggerFactory;
public void clear() {
this.ouch1 = null;
this.ouch2 = null;
+ this.ouch3 = null;
}
public AccumuloException getOuch1() {
@@ -45983,6 +46215,30 @@ import org.slf4j.LoggerFactory;
}
}
+ public TableNotFoundException getOuch3() {
+ return this.ouch3;
+ }
+
+ public setTableProperty_result setOuch3(TableNotFoundException ouch3) {
+ this.ouch3 = ouch3;
+ return this;
+ }
+
+ public void unsetOuch3() {
+ this.ouch3 = null;
+ }
+
+ /** Returns true if field ouch3 is set (has been assigned a value) and false otherwise */
+ public boolean isSetOuch3() {
+ return this.ouch3 != null;
+ }
+
+ public void setOuch3IsSet(boolean value) {
+ if (!value) {
+ this.ouch3 = null;
+ }
+ }
+
public void setFieldValue(_Fields field, Object value) {
switch (field) {
case OUCH1:
@@ -46001,6 +46257,14 @@ import org.slf4j.LoggerFactory;
}
break;
+ case OUCH3:
+ if (value == null) {
+ unsetOuch3();
+ } else {
+ setOuch3((TableNotFoundException)value);
+ }
+ break;
+
}
}
@@ -46012,6 +46276,9 @@ import org.slf4j.LoggerFactory;
case OUCH2:
return getOuch2();
+ case OUCH3:
+ return getOuch3();
+
}
throw new IllegalStateException();
}
@@ -46027,6 +46294,8 @@ import org.slf4j.LoggerFactory;
return isSetOuch1();
case OUCH2:
return isSetOuch2();
+ case OUCH3:
+ return isSetOuch3();
}
throw new IllegalStateException();
}
@@ -46062,6 +46331,15 @@ import org.slf4j.LoggerFactory;
return false;
}
+ boolean this_present_ouch3 = true && this.isSetOuch3();
+ boolean that_present_ouch3 = true && that.isSetOuch3();
+ if (this_present_ouch3 || that_present_ouch3) {
+ if (!(this_present_ouch3 && that_present_ouch3))
+ return false;
+ if (!this.ouch3.equals(that.ouch3))
+ return false;
+ }
+
return true;
}
@@ -46098,6 +46376,16 @@ import org.slf4j.LoggerFactory;
return lastComparison;
}
}
+ lastComparison = Boolean.valueOf(isSetOuch3()).compareTo(typedOther.isSetOuch3());
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ if (isSetOuch3()) {
+ lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.ouch3, typedOther.ouch3);
+ if (lastComparison != 0) {
+ return lastComparison;
+ }
+ }
return 0;
}
@@ -46133,6 +46421,14 @@ import org.slf4j.LoggerFactory;
sb.append(this.ouch2);
}
first = false;
+ if (!first) sb.append(", ");
+ sb.append("ouch3:");
+ if (this.ouch3 == null) {
+ sb.append("null");
+ } else {
+ sb.append(this.ouch3);
+ }
+ first = false;
sb.append(")");
return sb.toString();
}
@@ -46194,6 +46490,15 @@ import org.slf4j.LoggerFactory;
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
break;
+ case 3: // OUCH3
+ if (schemeField.type == org.apache.thrift.protocol.TType.STRUCT) {
+ struct.ouch3 = new TableNotFoundException();
+ struct.ouch3.read(iprot);
+ struct.setOuch3IsSet(true);
+ } else {
+ org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+ }
+ break;
default:
org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
}
@@ -46219,6 +46524,11 @@ import org.slf4j.LoggerFactory;
struct.ouch2.write(oprot);
oprot.writeFieldEnd();
}
+ if (struct.ouch3 != null) {
+ oprot.writeFieldBegin(OUCH3_FIELD_DESC);
+ struct.ouch3.write(oprot);
+ oprot.writeFieldEnd();
+ }
oprot.writeFieldStop();
oprot.writeStructEnd();
}
@@ -46243,19 +46553,25 @@ import org.slf4j.LoggerFactory;
if (struct.isSetOuch2()) {
optionals.set(1);
}
- oprot.writeBitSet(optionals, 2);
+ if (struct.isSetOuch3()) {
+ optionals.set(2);
+ }
+ oprot.writeBitSet(optionals, 3);
if (struct.isSetOuch1()) {
struct.ouch1.write(oprot);
}
if (struct.isSetOuch2()) {
struct.ouch2.write(oprot);
}
+ if (struct.isSetOuch3()) {
+ struct.ouch3.write(oprot);
+ }
}
@Override
public void read(org.apache.thrift.protocol.TProtocol prot, setTableProperty_result struct) throws org.apache.thrift.TException {
TTupleProtocol iprot = (TTupleProtocol) prot;
- BitSet incoming = iprot.readBitSet(2);
+ BitSet incoming = iprot.readBitSet(3);
if (incoming.get(0)) {
struct.ouch1 = new AccumuloException();
struct.ouch1.read(iprot);
@@ -46266,6 +46582,11 @@ import org.slf4j.LoggerFactory;
struct.ouch2.read(iprot);
struct.setOuch2IsSet(true);
}
+ if (incoming.get(2)) {
+ struct.ouch3 = new TableNotFoundException();
+ struct.ouch3.read(iprot);
+ struct.setOuch3IsSet(true);
+ }
}
}
Modified: accumulo/trunk/proxy/src/main/thrift/proxy.thrift
URL: http://svn.apache.org/viewvc/accumulo/trunk/proxy/src/main/thrift/proxy.thrift?rev=1469516&r1=1469515&r2=1469516&view=diff
==============================================================================
--- accumulo/trunk/proxy/src/main/thrift/proxy.thrift (original)
+++ accumulo/trunk/proxy/src/main/thrift/proxy.thrift Thu Apr 18 18:30:30 2013
@@ -276,14 +276,14 @@ service AccumuloProxy
void mergeTablets (1:binary login, 2:string tableName, 3:binary startRow, 4:binary endRow) throws (1:AccumuloException ouch1, 2:AccumuloSecurityException ouch2, 3:TableNotFoundException ouch3);
void offlineTable (1:binary login, 2:string tableName) throws (1:AccumuloException ouch1, 2:AccumuloSecurityException ouch2, 3:TableNotFoundException ouch3);
void onlineTable (1:binary login, 2:string tableName) throws (1:AccumuloException ouch1, 2:AccumuloSecurityException ouch2, 3:TableNotFoundException ouch3);
- void removeConstraint (1:binary login, 2:string tableName, 3:i32 constraint) throws (1:AccumuloException ouch1, 2:AccumuloSecurityException ouch2);
+ void removeConstraint (1:binary login, 2:string tableName, 3:i32 constraint) throws (1:AccumuloException ouch1, 2:AccumuloSecurityException ouch2, 3:TableNotFoundException ouch3);
void removeIterator (1:binary login, 2:string tableName, 3:string iterName,
4:set<IteratorScope> scopes)
throws (1:AccumuloException ouch1, 2:AccumuloSecurityException ouch2, 3:TableNotFoundException ouch3);
- void removeTableProperty (1:binary login, 2:string tableName, 3:string property) throws (1:AccumuloException ouch1, 2:AccumuloSecurityException ouch2);
+ void removeTableProperty (1:binary login, 2:string tableName, 3:string property) throws (1:AccumuloException ouch1, 2:AccumuloSecurityException ouch2, 3:TableNotFoundException ouch3);
void renameTable (1:binary login, 2:string oldTableName, 3:string newTableName) throws (1:AccumuloException ouch1, 2:AccumuloSecurityException ouch2, 3:TableNotFoundException ouch3, 4:TableExistsException ouch4);
void setLocalityGroups (1:binary login, 2:string tableName, 3:map<string,set<string>> groups) throws (1:AccumuloException ouch1, 2:AccumuloSecurityException ouch2, 3:TableNotFoundException ouch3);
- void setTableProperty (1:binary login, 2:string tableName, 3:string property, 4:string value) throws (1:AccumuloException ouch1, 2:AccumuloSecurityException ouch2);
+ void setTableProperty (1:binary login, 2:string tableName, 3:string property, 4:string value) throws (1:AccumuloException ouch1, 2:AccumuloSecurityException ouch2, 3:TableNotFoundException ouch3);
set<Range> splitRangeByTablets (1:binary login, 2:string tableName, 3:Range range, 4:i32 maxSplits) throws (1:AccumuloException ouch1, 2:AccumuloSecurityException ouch2, 3:TableNotFoundException ouch3);
bool tableExists (1:binary login, 2:string tableName);
map<string,string> tableIdMap (1:binary login);
Modified: accumulo/trunk/proxy/src/test/java/org/apache/accumulo/proxy/SimpleTest.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/proxy/src/test/java/org/apache/accumulo/proxy/SimpleTest.java?rev=1469516&r1=1469515&r2=1469516&view=diff
==============================================================================
--- accumulo/trunk/proxy/src/test/java/org/apache/accumulo/proxy/SimpleTest.java (original)
+++ accumulo/trunk/proxy/src/test/java/org/apache/accumulo/proxy/SimpleTest.java Thu Apr 18 18:30:30 2013
@@ -51,8 +51,8 @@ import org.apache.accumulo.core.iterator
import org.apache.accumulo.core.iterators.user.SummingCombiner;
import org.apache.accumulo.core.util.UtilWaitThread;
import org.apache.accumulo.examples.simple.constraints.NumericValueConstraint;
-import org.apache.accumulo.proxy.thrift.AccumuloException;
import org.apache.accumulo.proxy.thrift.AccumuloProxy.Client;
+import org.apache.accumulo.proxy.thrift.AccumuloSecurityException;
import org.apache.accumulo.proxy.thrift.ActiveCompaction;
import org.apache.accumulo.proxy.thrift.ActiveScan;
import org.apache.accumulo.proxy.thrift.BatchScanOptions;
@@ -83,7 +83,6 @@ import org.apache.hadoop.fs.FSDataInputS
import org.apache.hadoop.fs.FileSystem;
import org.apache.hadoop.fs.Path;
import org.apache.hadoop.io.Text;
-import org.apache.thrift.TException;
import org.apache.thrift.protocol.TProtocolFactory;
import org.apache.thrift.server.TServer;
import org.junit.AfterClass;
@@ -97,9 +96,9 @@ import org.junit.rules.TemporaryFolder;
public class SimpleTest {
public static TemporaryFolder folder = new TemporaryFolder();
-
+
public static final String TABLE_TEST = "test";
-
+
private static MiniAccumuloCluster accumulo;
private static String secret = "superSecret";
private static Random random = new Random();
@@ -109,11 +108,15 @@ public class SimpleTest {
private static org.apache.accumulo.proxy.thrift.AccumuloProxy.Client client;
private static String principal = "root";
@SuppressWarnings("serial")
- private static Map<String, String> properties = new TreeMap<String, String>() {{ put("password",secret);}};
+ private static Map<String,String> properties = new TreeMap<String,String>() {
+ {
+ put("password", secret);
+ }
+ };
private static ByteBuffer creds = null;
-
+
private static Class<? extends TProtocolFactory> protocolClass;
-
+
static Class<? extends TProtocolFactory> getRandomProtocol() {
List<Class<? extends TProtocolFactory>> protocolFactories = new ArrayList<Class<? extends TProtocolFactory>>();
protocolFactories.add(org.apache.thrift.protocol.TJSONProtocol.Factory.class);
@@ -124,13 +127,13 @@ public class SimpleTest {
Random rand = new Random();
return protocolFactories.get(rand.nextInt(protocolFactories.size()));
}
-
+
@BeforeClass
public static void setupMiniCluster() throws Exception {
folder.create();
accumulo = new MiniAccumuloCluster(folder.getRoot(), secret);
accumulo.start();
-
+
Properties props = new Properties();
props.put("org.apache.accumulo.proxy.ProxyServer.instancename", accumulo.getInstanceName());
props.put("org.apache.accumulo.proxy.ProxyServer.zookeepers", accumulo.getZooKeepers());
@@ -138,7 +141,7 @@ public class SimpleTest {
protocolClass = getRandomProtocol();
System.out.println(protocolClass.getName());
-
+
proxyPort = 40000 + random.nextInt(20000);
proxyServer = Proxy.createProxyServer(org.apache.accumulo.proxy.thrift.AccumuloProxy.class, org.apache.accumulo.proxy.ProxyServer.class, proxyPort,
protocolClass, props);
@@ -154,7 +157,6 @@ public class SimpleTest {
client = new TestProxyClient("localhost", proxyPort, protocolClass.newInstance()).proxy();
creds = client.login(principal, properties);
}
-
@Test(timeout = 10000)
public void tableNotFound() throws Exception {
@@ -162,183 +164,147 @@ public class SimpleTest {
try {
client.addConstraint(creds, doesNotExist, NumericValueConstraint.class.getName());
fail("exception not thrown");
- } catch (TableNotFoundException ex) {
- }
+ } catch (TableNotFoundException ex) {}
try {
- client.addSplits(creds, doesNotExist, Collections.<ByteBuffer>emptySet());
+ client.addSplits(creds, doesNotExist, Collections.<ByteBuffer> emptySet());
fail("exception not thrown");
- } catch (TableNotFoundException ex) {
- }
+ } catch (TableNotFoundException ex) {}
final IteratorSetting setting = new IteratorSetting(100, "slow", SlowIterator.class.getName(), Collections.singletonMap("sleepTime", "200"));
try {
client.attachIterator(creds, doesNotExist, setting, EnumSet.allOf(IteratorScope.class));
fail("exception not thrown");
- } catch (TableNotFoundException ex) {
- }
+ } catch (TableNotFoundException ex) {}
try {
client.cancelCompaction(creds, doesNotExist);
fail("exception not thrown");
- } catch (TableNotFoundException ex) {
- }
+ } catch (TableNotFoundException ex) {}
try {
client.checkIteratorConflicts(creds, doesNotExist, setting, EnumSet.allOf(IteratorScope.class));
fail("exception not thrown");
- } catch (TableNotFoundException ex) {
- }
+ } catch (TableNotFoundException ex) {}
try {
client.clearLocatorCache(creds, doesNotExist);
fail("exception not thrown");
- } catch (TableNotFoundException ex) {
- }
+ } catch (TableNotFoundException ex) {}
try {
client.cloneTable(creds, doesNotExist, TABLE_TEST, false, null, null);
fail("exception not thrown");
- } catch (TableNotFoundException ex) {
- }
+ } catch (TableNotFoundException ex) {}
try {
client.compactTable(creds, doesNotExist, null, null, null, true, false);
fail("exception not thrown");
- } catch (TableNotFoundException ex) {
- }
+ } catch (TableNotFoundException ex) {}
try {
client.createBatchScanner(creds, doesNotExist, new BatchScanOptions());
fail("exception not thrown");
- } catch (TableNotFoundException ex) {
- }
+ } catch (TableNotFoundException ex) {}
try {
client.createScanner(creds, doesNotExist, new ScanOptions());
fail("exception not thrown");
- } catch (TableNotFoundException ex) {
- }
+ } catch (TableNotFoundException ex) {}
try {
client.createWriter(creds, doesNotExist, new WriterOptions());
fail("exception not thrown");
- } catch (TableNotFoundException ex) {
- }
+ } catch (TableNotFoundException ex) {}
try {
client.deleteRows(creds, doesNotExist, null, null);
fail("exception not thrown");
- } catch (TableNotFoundException ex) {
- }
+ } catch (TableNotFoundException ex) {}
try {
client.deleteTable(creds, doesNotExist);
fail("exception not thrown");
- } catch (TableNotFoundException ex) {
- }
+ } catch (TableNotFoundException ex) {}
try {
client.exportTable(creds, doesNotExist, "/tmp");
fail("exception not thrown");
- } catch (TableNotFoundException ex) {
- }
+ } catch (TableNotFoundException ex) {}
try {
client.flushTable(creds, doesNotExist, null, null, false);
fail("exception not thrown");
- } catch (TableNotFoundException ex) {
- }
+ } catch (TableNotFoundException ex) {}
try {
client.getIteratorSetting(creds, doesNotExist, "foo", IteratorScope.SCAN);
fail("exception not thrown");
- } catch (TableNotFoundException ex) {
- }
+ } catch (TableNotFoundException ex) {}
try {
client.getLocalityGroups(creds, doesNotExist);
fail("exception not thrown");
- } catch (TableNotFoundException ex) {
- }
+ } catch (TableNotFoundException ex) {}
try {
- client.getMaxRow(creds, doesNotExist, Collections.<ByteBuffer>emptySet(), null, false, null, false);
+ client.getMaxRow(creds, doesNotExist, Collections.<ByteBuffer> emptySet(), null, false, null, false);
fail("exception not thrown");
- } catch (TableNotFoundException ex) {
- }
+ } catch (TableNotFoundException ex) {}
try {
client.getTableProperties(creds, doesNotExist);
fail("exception not thrown");
- } catch (TableNotFoundException ex) {
- }
+ } catch (TableNotFoundException ex) {}
try {
client.grantTablePermission(creds, "root", doesNotExist, TablePermission.WRITE);
fail("exception not thrown");
- } catch (TableNotFoundException ex) {
- }
+ } catch (TableNotFoundException ex) {}
try {
client.hasTablePermission(creds, "root", doesNotExist, TablePermission.WRITE);
fail("exception not thrown");
- } catch (TableNotFoundException ex) {
- }
+ } catch (TableNotFoundException ex) {}
try {
File newFolder = folder.newFolder();
client.importDirectory(creds, doesNotExist, "/tmp", newFolder.getAbsolutePath(), true);
fail("exception not thrown");
- } catch (TableNotFoundException ex) {
- }
+ } catch (TableNotFoundException ex) {}
try {
client.listConstraints(creds, doesNotExist);
fail("exception not thrown");
- } catch (TableNotFoundException ex) {
- }
+ } catch (TableNotFoundException ex) {}
try {
client.listSplits(creds, doesNotExist, 10000);
fail("exception not thrown");
- } catch (TableNotFoundException ex) {
- }
+ } catch (TableNotFoundException ex) {}
try {
client.mergeTablets(creds, doesNotExist, null, null);
fail("exception not thrown");
- } catch (TableNotFoundException ex) {
- }
+ } catch (TableNotFoundException ex) {}
try {
client.offlineTable(creds, doesNotExist);
fail("exception not thrown");
- } catch (TableNotFoundException ex) {
- }
+ } catch (TableNotFoundException ex) {}
try {
client.onlineTable(creds, doesNotExist);
fail("exception not thrown");
- } catch (TableNotFoundException ex) {
- }
+ } catch (TableNotFoundException ex) {}
try {
client.removeConstraint(creds, doesNotExist, 0);
fail("exception not thrown");
- } catch (AccumuloException ex) {
- }
+ } catch (TableNotFoundException ex) {}
try {
client.removeIterator(creds, doesNotExist, "name", EnumSet.allOf(IteratorScope.class));
fail("exception not thrown");
- } catch (TableNotFoundException ex) {
- }
+ } catch (TableNotFoundException ex) {}
try {
client.removeTableProperty(creds, doesNotExist, Property.TABLE_FILE_MAX.getKey());
fail("exception not thrown");
- } catch (AccumuloException ex) {
- }
+ } catch (TableNotFoundException ex) {}
try {
client.renameTable(creds, doesNotExist, "someTableName");
fail("exception not thrown");
- } catch (TableNotFoundException ex) {
- }
+ } catch (TableNotFoundException ex) {}
try {
client.revokeTablePermission(creds, "root", doesNotExist, TablePermission.ALTER_TABLE);
fail("exception not thrown");
- } catch (TableNotFoundException ex) {
- }
+ } catch (TableNotFoundException ex) {}
try {
client.setTableProperty(creds, doesNotExist, Property.TABLE_FILE_MAX.getKey(), "0");
fail("exception not thrown");
- } catch (AccumuloException ex) {
- }
+ } catch (TableNotFoundException ex) {}
try {
client.splitRangeByTablets(creds, doesNotExist, client.getRowRange(ByteBuffer.wrap("row".getBytes())), 10);
fail("exception not thrown");
- } catch (TableNotFoundException ex) {
- }
+ } catch (TableNotFoundException ex) {}
try {
client.updateAndFlush(creds, doesNotExist, new HashMap<ByteBuffer,List<ColumnUpdate>>());
fail("exception not thrown");
- } catch (TableNotFoundException ex) {
- }
+ } catch (TableNotFoundException ex) {}
}
-
@Test(timeout = 10000)
public void testInstanceOperations() throws Exception {
int tservers = 0;
@@ -359,7 +325,7 @@ public class SimpleTest {
for (int i = 0; i < 5; i++) {
cfg = client.getSystemConfiguration(creds);
if ("500M".equals(cfg.get("table.split.threshold")))
- break;
+ break;
UtilWaitThread.sleep(200);
}
assertEquals("500M", cfg.get("table.split.threshold"));
@@ -369,7 +335,7 @@ public class SimpleTest {
for (int i = 0; i < 5; i++) {
cfg = client.getSystemConfiguration(creds);
if (!"500M".equals(cfg.get("table.split.threshold")))
- break;
+ break;
UtilWaitThread.sleep(200);
}
assertNotEquals("500M", cfg.get("table.split.threshold"));
@@ -377,7 +343,7 @@ public class SimpleTest {
// try to load some classes via the proxy
assertTrue(client.testClassLoad(creds, DevNull.class.getName(), SortedKeyValueIterator.class.getName()));
assertFalse(client.testClassLoad(creds, "foo.bar", SortedKeyValueIterator.class.getName()));
-
+
// create a table that's very slow, so we can look for scans/compactions
client.createTable(creds, "slow", true, TimeType.MILLIS);
IteratorSetting setting = new IteratorSetting(100, "slow", SlowIterator.class.getName(), Collections.singletonMap("sleepTime", "200"));
@@ -405,13 +371,12 @@ public class SimpleTest {
t.start();
// look for the scan
List<ActiveScan> scans = Collections.emptyList();
- loop:
- for (int i = 0; i < 100; i++) {
- for (String tserver: client.getTabletServers(creds)) {
- scans = client.getActiveScans(creds, tserver);
- if (!scans.isEmpty())
- break loop;
- UtilWaitThread.sleep(10);
+ loop: for (int i = 0; i < 100; i++) {
+ for (String tserver : client.getTabletServers(creds)) {
+ scans = client.getActiveScans(creds, tserver);
+ if (!scans.isEmpty())
+ break loop;
+ UtilWaitThread.sleep(10);
}
}
t.join();
@@ -442,9 +407,8 @@ public class SimpleTest {
// try to catch it in the act
List<ActiveCompaction> compactions = Collections.emptyList();
- loop2:
- for (int i = 0; i < 100; i++) {
- for (String tserver: client.getTabletServers(creds)) {
+ loop2: for (int i = 0; i < 100; i++) {
+ for (String tserver : client.getTabletServers(creds)) {
compactions = client.getActiveCompactions(creds, tserver);
if (!compactions.isEmpty())
break loop2;
@@ -468,13 +432,13 @@ public class SimpleTest {
// check password
assertTrue(client.authenticateUser(creds, "root", s2pp(secret)));
assertFalse(client.authenticateUser(creds, "root", s2pp("")));
-
+
// create a user
client.createLocalUser(creds, "stooge", s2bb("password"));
// change auths
Set<String> users = client.listLocalUsers(creds);
assertEquals(new HashSet<String>(Arrays.asList("root", "stooge")), users);
- HashSet<ByteBuffer> auths = new HashSet<ByteBuffer>(Arrays.asList(s2bb("A"),s2bb("B")));
+ HashSet<ByteBuffer> auths = new HashSet<ByteBuffer>(Arrays.asList(s2bb("A"), s2bb("B")));
client.changeUserAuthorizations(creds, "stooge", auths);
List<ByteBuffer> update = client.getUserAuthorizations(creds, "stooge");
assertEquals(auths, new HashSet<ByteBuffer>(update));
@@ -485,12 +449,16 @@ public class SimpleTest {
// check permission failure
@SuppressWarnings("serial")
- ByteBuffer stooge = client.login("stooge", new TreeMap<String,String>() {{put("password",""); }});
+ ByteBuffer stooge = client.login("stooge", new TreeMap<String,String>() {
+ {
+ put("password", "");
+ }
+ });
try {
client.createTable(stooge, "fail", true, TimeType.MILLIS);
fail("should not create the table");
- } catch (TException ex) {
+ } catch (AccumuloSecurityException ex) {
assertFalse(client.listTables(creds).contains("fail"));
}
// grant permissions and test
@@ -506,7 +474,7 @@ public class SimpleTest {
try {
client.createTable(stooge, "fail", true, TimeType.MILLIS);
fail("should not create the table");
- } catch (TException ex) {
+ } catch (AccumuloSecurityException ex) {
assertFalse(client.listTables(creds).contains("fail"));
}
// create a table to test table permissions
@@ -516,8 +484,7 @@ public class SimpleTest {
String scanner = client.createScanner(stooge, TABLE_TEST, null);
client.nextK(scanner, 100);
fail("stooge should not read table test");
- } catch (TException ex) {
- }
+ } catch (AccumuloSecurityException ex) {}
// grant
assertFalse(client.hasTablePermission(creds, "stooge", TABLE_TEST, TablePermission.READ));
client.grantTablePermission(creds, "stooge", TABLE_TEST, TablePermission.READ);
@@ -532,8 +499,7 @@ public class SimpleTest {
scanner = client.createScanner(stooge, TABLE_TEST, null);
client.nextK(scanner, 100);
fail("stooge should not read table test");
- } catch (TException ex) {
- }
+ } catch (AccumuloSecurityException ex) {}
// delete user
client.dropLocalUser(creds, "stooge");
@@ -541,53 +507,53 @@ public class SimpleTest {
assertEquals(1, users.size());
}
-
+
@Test
public void testBatchWriter() throws Exception {
- if (client.tableExists(creds, TABLE_TEST))
- client.deleteTable(creds, TABLE_TEST);
-
- client.createTable(creds, TABLE_TEST, true, TimeType.MILLIS);
- client.addConstraint(creds, TABLE_TEST, NumericValueConstraint.class.getName());
-
- WriterOptions writerOptions = new WriterOptions();
- writerOptions.setLatencyMs(10000);
- writerOptions.setMaxMemory(2);
- writerOptions.setThreads(1);
- writerOptions.setTimeoutMs(100000);
-
- String batchWriter = client.createWriter(creds, TABLE_TEST, writerOptions);
- client.update(batchWriter, mutation("row1", "cf", "cq", "x"));
- client.update(batchWriter, mutation("row1", "cf", "cq", "x"));
- try {
- client.flush(batchWriter);
- fail("constraint did not fire");
- } catch (MutationsRejectedException ex) {}
- try {
- client.closeWriter(batchWriter);
- fail("constraint did not fire");
- } catch(MutationsRejectedException e) {}
-
- client.removeConstraint(creds, TABLE_TEST, 1);
-
- writerOptions = new WriterOptions();
- writerOptions.setLatencyMs(10000);
- writerOptions.setMaxMemory(3000);
- writerOptions.setThreads(1);
- writerOptions.setTimeoutMs(100000);
-
- batchWriter = client.createWriter(creds, TABLE_TEST, writerOptions);
-
- client.update(batchWriter, mutation("row1", "cf", "cq", "x"));
+ if (client.tableExists(creds, TABLE_TEST))
+ client.deleteTable(creds, TABLE_TEST);
+
+ client.createTable(creds, TABLE_TEST, true, TimeType.MILLIS);
+ client.addConstraint(creds, TABLE_TEST, NumericValueConstraint.class.getName());
+
+ WriterOptions writerOptions = new WriterOptions();
+ writerOptions.setLatencyMs(10000);
+ writerOptions.setMaxMemory(2);
+ writerOptions.setThreads(1);
+ writerOptions.setTimeoutMs(100000);
+
+ String batchWriter = client.createWriter(creds, TABLE_TEST, writerOptions);
+ client.update(batchWriter, mutation("row1", "cf", "cq", "x"));
+ client.update(batchWriter, mutation("row1", "cf", "cq", "x"));
+ try {
client.flush(batchWriter);
+ fail("constraint did not fire");
+ } catch (MutationsRejectedException ex) {}
+ try {
client.closeWriter(batchWriter);
-
- String scanner = client.createScanner(creds, TABLE_TEST, null);
- ScanResult more = client.nextK(scanner, 2);
- assertEquals(1, more.getResults().size());
- client.closeScanner(scanner);
-
- client.deleteTable(creds, TABLE_TEST);
+ fail("constraint did not fire");
+ } catch (MutationsRejectedException e) {}
+
+ client.removeConstraint(creds, TABLE_TEST, 1);
+
+ writerOptions = new WriterOptions();
+ writerOptions.setLatencyMs(10000);
+ writerOptions.setMaxMemory(3000);
+ writerOptions.setThreads(1);
+ writerOptions.setTimeoutMs(100000);
+
+ batchWriter = client.createWriter(creds, TABLE_TEST, writerOptions);
+
+ client.update(batchWriter, mutation("row1", "cf", "cq", "x"));
+ client.flush(batchWriter);
+ client.closeWriter(batchWriter);
+
+ String scanner = client.createScanner(creds, TABLE_TEST, null);
+ ScanResult more = client.nextK(scanner, 2);
+ assertEquals(1, more.getResults().size());
+ client.closeScanner(scanner);
+
+ client.deleteTable(creds, TABLE_TEST);
}
@Test
@@ -598,12 +564,12 @@ public class SimpleTest {
// constraints
client.addConstraint(creds, TABLE_TEST, NumericValueConstraint.class.getName());
client.updateAndFlush(creds, TABLE_TEST, mutation("row1", "cf", "cq", "123"));
-
+
try {
client.updateAndFlush(creds, TABLE_TEST, mutation("row1", "cf", "cq", "x"));
fail("constraint did not fire");
} catch (MutationsRejectedException ex) {}
-
+
client.removeConstraint(creds, TABLE_TEST, 1);
client.updateAndFlush(creds, TABLE_TEST, mutation("row1", "cf", "cq", "x"));
String scanner = client.createScanner(creds, TABLE_TEST, null);
@@ -626,7 +592,7 @@ public class SimpleTest {
// iterators
client.deleteTable(creds, TABLE_TEST);
client.createTable(creds, TABLE_TEST, true, TimeType.MILLIS);
- HashMap<String, String> options = new HashMap<String, String>();
+ HashMap<String,String> options = new HashMap<String,String>();
options.put("type", "STRING");
options.put("columns", "cf");
IteratorSetting setting = new IteratorSetting(10, TABLE_TEST, SummingCombiner.class.getName(), options);
@@ -641,12 +607,11 @@ public class SimpleTest {
try {
client.checkIteratorConflicts(creds, TABLE_TEST, setting, EnumSet.allOf(IteratorScope.class));
fail("checkIteratorConflicts did not throw and exception");
- } catch (Exception ex) {
- }
+ } catch (Exception ex) {}
client.deleteRows(creds, TABLE_TEST, null, null);
client.removeIterator(creds, TABLE_TEST, "test", EnumSet.allOf(IteratorScope.class));
for (int i = 0; i < 10; i++) {
- client.updateAndFlush(creds, TABLE_TEST, mutation("row"+i, "cf", "cq", ""+i));
+ client.updateAndFlush(creds, TABLE_TEST, mutation("row" + i, "cf", "cq", "" + i));
client.flushTable(creds, TABLE_TEST, null, null, true);
}
scanner = client.createScanner(creds, TABLE_TEST, null);
@@ -694,7 +659,7 @@ public class SimpleTest {
// Locality groups
client.createTable(creds, "test", true, TimeType.MILLIS);
- Map<String, Set<String>> groups = new HashMap<String, Set<String>>();
+ Map<String,Set<String>> groups = new HashMap<String,Set<String>>();
groups.put("group1", Collections.singleton("cf1"));
groups.put("group2", Collections.singleton("cf2"));
client.setLocalityGroups(creds, "test", groups);
@@ -705,7 +670,7 @@ public class SimpleTest {
Map<String,String> update = client.getTableProperties(creds, "test");
for (int i = 0; i < 5; i++) {
if (update.get("table.split.threshold").equals("500M"))
- break;
+ break;
UtilWaitThread.sleep(200);
}
assertEquals(update.get("table.split.threshold"), "500M");
@@ -758,27 +723,27 @@ public class SimpleTest {
}
return result;
}
-
+
private Map<ByteBuffer,List<ColumnUpdate>> mutation(String row, String cf, String cq, String value) {
ColumnUpdate upd = new ColumnUpdate(s2bb(cf), s2bb(cq));
upd.setValue(value.getBytes());
return Collections.singletonMap(s2bb(row), Collections.singletonList(upd));
}
-
+
private ByteBuffer s2bb(String cf) {
return ByteBuffer.wrap(cf.getBytes());
}
-
- private Map<String, String> s2pp(String cf) {
- Map<String, String> toRet = new TreeMap<String, String>();
+
+ private Map<String,String> s2pp(String cf) {
+ Map<String,String> toRet = new TreeMap<String,String>();
toRet.put("password", cf);
return toRet;
}
-
+
@AfterClass
public static void tearDownMiniCluster() throws Exception {
accumulo.stop();
- // folder.delete();
+ folder.delete();
}
}
Propchange: accumulo/trunk/server/
------------------------------------------------------------------------------
Merged /accumulo/branches/1.5/server:r1469503
Propchange: accumulo/trunk/src/
------------------------------------------------------------------------------
Merged /accumulo/branches/1.5/src:r1469503