accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From e..@apache.org
Subject svn commit: r1434921 [7/7] - in /accumulo/trunk: ./ conf/examples/1GB/native-standalone/ conf/examples/1GB/standalone/ conf/examples/2GB/native-standalone/ conf/examples/2GB/standalone/ conf/examples/3GB/native-standalone/ conf/examples/3GB/standalone/...
Date Thu, 17 Jan 2013 21:22:36 GMT
Added: accumulo/trunk/proxy/src/main/java/org/apache/accumulo/proxy/thrift/UserPass.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/proxy/src/main/java/org/apache/accumulo/proxy/thrift/UserPass.java?rev=1434921&view=auto
==============================================================================
--- accumulo/trunk/proxy/src/main/java/org/apache/accumulo/proxy/thrift/UserPass.java (added)
+++ accumulo/trunk/proxy/src/main/java/org/apache/accumulo/proxy/thrift/UserPass.java Thu Jan 17 21:22:35 2013
@@ -0,0 +1,513 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+/**
+ * Autogenerated by Thrift Compiler (0.9.0)
+ *
+ * DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING
+ *  @generated
+ */
+package org.apache.accumulo.proxy.thrift;
+
+import org.apache.thrift.scheme.IScheme;
+import org.apache.thrift.scheme.SchemeFactory;
+import org.apache.thrift.scheme.StandardScheme;
+
+import org.apache.thrift.scheme.TupleScheme;
+import org.apache.thrift.protocol.TTupleProtocol;
+import org.apache.thrift.protocol.TProtocolException;
+import org.apache.thrift.EncodingUtils;
+import org.apache.thrift.TException;
+import java.util.List;
+import java.util.ArrayList;
+import java.util.Map;
+import java.util.HashMap;
+import java.util.EnumMap;
+import java.util.Set;
+import java.util.HashSet;
+import java.util.EnumSet;
+import java.util.Collections;
+import java.util.BitSet;
+import java.nio.ByteBuffer;
+import java.util.Arrays;
+import org.slf4j.Logger;
+import org.slf4j.LoggerFactory;
+
+@SuppressWarnings("all") public class UserPass implements org.apache.thrift.TBase<UserPass, UserPass._Fields>, java.io.Serializable, Cloneable {
+  private static final org.apache.thrift.protocol.TStruct STRUCT_DESC = new org.apache.thrift.protocol.TStruct("UserPass");
+
+  private static final org.apache.thrift.protocol.TField USERNAME_FIELD_DESC = new org.apache.thrift.protocol.TField("username", org.apache.thrift.protocol.TType.STRING, (short)1);
+  private static final org.apache.thrift.protocol.TField PASSWORD_FIELD_DESC = new org.apache.thrift.protocol.TField("password", org.apache.thrift.protocol.TType.STRING, (short)2);
+
+  private static final Map<Class<? extends IScheme>, SchemeFactory> schemes = new HashMap<Class<? extends IScheme>, SchemeFactory>();
+  static {
+    schemes.put(StandardScheme.class, new UserPassStandardSchemeFactory());
+    schemes.put(TupleScheme.class, new UserPassTupleSchemeFactory());
+  }
+
+  public String username; // required
+  public ByteBuffer password; // 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 {
+    USERNAME((short)1, "username"),
+    PASSWORD((short)2, "password");
+
+    private static final Map<String, _Fields> byName = new HashMap<String, _Fields>();
+
+    static {
+      for (_Fields field : EnumSet.allOf(_Fields.class)) {
+        byName.put(field.getFieldName(), field);
+      }
+    }
+
+    /**
+     * Find the _Fields constant that matches fieldId, or null if its not found.
+     */
+    public static _Fields findByThriftId(int fieldId) {
+      switch(fieldId) {
+        case 1: // USERNAME
+          return USERNAME;
+        case 2: // PASSWORD
+          return PASSWORD;
+        default:
+          return null;
+      }
+    }
+
+    /**
+     * Find the _Fields constant that matches fieldId, throwing an exception
+     * if it is not found.
+     */
+    public static _Fields findByThriftIdOrThrow(int fieldId) {
+      _Fields fields = findByThriftId(fieldId);
+      if (fields == null) throw new IllegalArgumentException("Field " + fieldId + " doesn't exist!");
+      return fields;
+    }
+
+    /**
+     * Find the _Fields constant that matches name, or null if its not found.
+     */
+    public static _Fields findByName(String name) {
+      return byName.get(name);
+    }
+
+    private final short _thriftId;
+    private final String _fieldName;
+
+    _Fields(short thriftId, String fieldName) {
+      _thriftId = thriftId;
+      _fieldName = fieldName;
+    }
+
+    public short getThriftFieldId() {
+      return _thriftId;
+    }
+
+    public String getFieldName() {
+      return _fieldName;
+    }
+  }
+
+  // isset id assignments
+  public static final Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> metaDataMap;
+  static {
+    Map<_Fields, org.apache.thrift.meta_data.FieldMetaData> tmpMap = new EnumMap<_Fields, org.apache.thrift.meta_data.FieldMetaData>(_Fields.class);
+    tmpMap.put(_Fields.USERNAME, new org.apache.thrift.meta_data.FieldMetaData("username", org.apache.thrift.TFieldRequirementType.DEFAULT, 
+        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING)));
+    tmpMap.put(_Fields.PASSWORD, new org.apache.thrift.meta_data.FieldMetaData("password", org.apache.thrift.TFieldRequirementType.DEFAULT, 
+        new org.apache.thrift.meta_data.FieldValueMetaData(org.apache.thrift.protocol.TType.STRING        , true)));
+    metaDataMap = Collections.unmodifiableMap(tmpMap);
+    org.apache.thrift.meta_data.FieldMetaData.addStructMetaDataMap(UserPass.class, metaDataMap);
+  }
+
+  public UserPass() {
+  }
+
+  public UserPass(
+    String username,
+    ByteBuffer password)
+  {
+    this();
+    this.username = username;
+    this.password = password;
+  }
+
+  /**
+   * Performs a deep copy on <i>other</i>.
+   */
+  public UserPass(UserPass other) {
+    if (other.isSetUsername()) {
+      this.username = other.username;
+    }
+    if (other.isSetPassword()) {
+      this.password = org.apache.thrift.TBaseHelper.copyBinary(other.password);
+;
+    }
+  }
+
+  public UserPass deepCopy() {
+    return new UserPass(this);
+  }
+
+  @Override
+  public void clear() {
+    this.username = null;
+    this.password = null;
+  }
+
+  public String getUsername() {
+    return this.username;
+  }
+
+  public UserPass setUsername(String username) {
+    this.username = username;
+    return this;
+  }
+
+  public void unsetUsername() {
+    this.username = null;
+  }
+
+  /** Returns true if field username is set (has been assigned a value) and false otherwise */
+  public boolean isSetUsername() {
+    return this.username != null;
+  }
+
+  public void setUsernameIsSet(boolean value) {
+    if (!value) {
+      this.username = null;
+    }
+  }
+
+  public byte[] getPassword() {
+    setPassword(org.apache.thrift.TBaseHelper.rightSize(password));
+    return password == null ? null : password.array();
+  }
+
+  public ByteBuffer bufferForPassword() {
+    return password;
+  }
+
+  public UserPass setPassword(byte[] password) {
+    setPassword(password == null ? (ByteBuffer)null : ByteBuffer.wrap(password));
+    return this;
+  }
+
+  public UserPass setPassword(ByteBuffer password) {
+    this.password = password;
+    return this;
+  }
+
+  public void unsetPassword() {
+    this.password = null;
+  }
+
+  /** Returns true if field password is set (has been assigned a value) and false otherwise */
+  public boolean isSetPassword() {
+    return this.password != null;
+  }
+
+  public void setPasswordIsSet(boolean value) {
+    if (!value) {
+      this.password = null;
+    }
+  }
+
+  public void setFieldValue(_Fields field, Object value) {
+    switch (field) {
+    case USERNAME:
+      if (value == null) {
+        unsetUsername();
+      } else {
+        setUsername((String)value);
+      }
+      break;
+
+    case PASSWORD:
+      if (value == null) {
+        unsetPassword();
+      } else {
+        setPassword((ByteBuffer)value);
+      }
+      break;
+
+    }
+  }
+
+  public Object getFieldValue(_Fields field) {
+    switch (field) {
+    case USERNAME:
+      return getUsername();
+
+    case PASSWORD:
+      return getPassword();
+
+    }
+    throw new IllegalStateException();
+  }
+
+  /** Returns true if field corresponding to fieldID is set (has been assigned a value) and false otherwise */
+  public boolean isSet(_Fields field) {
+    if (field == null) {
+      throw new IllegalArgumentException();
+    }
+
+    switch (field) {
+    case USERNAME:
+      return isSetUsername();
+    case PASSWORD:
+      return isSetPassword();
+    }
+    throw new IllegalStateException();
+  }
+
+  @Override
+  public boolean equals(Object that) {
+    if (that == null)
+      return false;
+    if (that instanceof UserPass)
+      return this.equals((UserPass)that);
+    return false;
+  }
+
+  public boolean equals(UserPass that) {
+    if (that == null)
+      return false;
+
+    boolean this_present_username = true && this.isSetUsername();
+    boolean that_present_username = true && that.isSetUsername();
+    if (this_present_username || that_present_username) {
+      if (!(this_present_username && that_present_username))
+        return false;
+      if (!this.username.equals(that.username))
+        return false;
+    }
+
+    boolean this_present_password = true && this.isSetPassword();
+    boolean that_present_password = true && that.isSetPassword();
+    if (this_present_password || that_present_password) {
+      if (!(this_present_password && that_present_password))
+        return false;
+      if (!this.password.equals(that.password))
+        return false;
+    }
+
+    return true;
+  }
+
+  @Override
+  public int hashCode() {
+    return 0;
+  }
+
+  public int compareTo(UserPass other) {
+    if (!getClass().equals(other.getClass())) {
+      return getClass().getName().compareTo(other.getClass().getName());
+    }
+
+    int lastComparison = 0;
+    UserPass typedOther = (UserPass)other;
+
+    lastComparison = Boolean.valueOf(isSetUsername()).compareTo(typedOther.isSetUsername());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    if (isSetUsername()) {
+      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.username, typedOther.username);
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+    }
+    lastComparison = Boolean.valueOf(isSetPassword()).compareTo(typedOther.isSetPassword());
+    if (lastComparison != 0) {
+      return lastComparison;
+    }
+    if (isSetPassword()) {
+      lastComparison = org.apache.thrift.TBaseHelper.compareTo(this.password, typedOther.password);
+      if (lastComparison != 0) {
+        return lastComparison;
+      }
+    }
+    return 0;
+  }
+
+  public _Fields fieldForId(int fieldId) {
+    return _Fields.findByThriftId(fieldId);
+  }
+
+  public void read(org.apache.thrift.protocol.TProtocol iprot) throws org.apache.thrift.TException {
+    schemes.get(iprot.getScheme()).getScheme().read(iprot, this);
+  }
+
+  public void write(org.apache.thrift.protocol.TProtocol oprot) throws org.apache.thrift.TException {
+    schemes.get(oprot.getScheme()).getScheme().write(oprot, this);
+  }
+
+  @Override
+  public String toString() {
+    StringBuilder sb = new StringBuilder("UserPass(");
+    boolean first = true;
+
+    sb.append("username:");
+    if (this.username == null) {
+      sb.append("null");
+    } else {
+      sb.append(this.username);
+    }
+    first = false;
+    if (!first) sb.append(", ");
+    sb.append("password:");
+    if (this.password == null) {
+      sb.append("null");
+    } else {
+      org.apache.thrift.TBaseHelper.toString(this.password, sb);
+    }
+    first = false;
+    sb.append(")");
+    return sb.toString();
+  }
+
+  public void validate() throws org.apache.thrift.TException {
+    // check for required fields
+    // check for sub-struct validity
+  }
+
+  private void writeObject(java.io.ObjectOutputStream out) throws java.io.IOException {
+    try {
+      write(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(out)));
+    } catch (org.apache.thrift.TException te) {
+      throw new java.io.IOException(te);
+    }
+  }
+
+  private void readObject(java.io.ObjectInputStream in) throws java.io.IOException, ClassNotFoundException {
+    try {
+      read(new org.apache.thrift.protocol.TCompactProtocol(new org.apache.thrift.transport.TIOStreamTransport(in)));
+    } catch (org.apache.thrift.TException te) {
+      throw new java.io.IOException(te);
+    }
+  }
+
+  private static class UserPassStandardSchemeFactory implements SchemeFactory {
+    public UserPassStandardScheme getScheme() {
+      return new UserPassStandardScheme();
+    }
+  }
+
+  private static class UserPassStandardScheme extends StandardScheme<UserPass> {
+
+    public void read(org.apache.thrift.protocol.TProtocol iprot, UserPass struct) throws org.apache.thrift.TException {
+      org.apache.thrift.protocol.TField schemeField;
+      iprot.readStructBegin();
+      while (true)
+      {
+        schemeField = iprot.readFieldBegin();
+        if (schemeField.type == org.apache.thrift.protocol.TType.STOP) { 
+          break;
+        }
+        switch (schemeField.id) {
+          case 1: // USERNAME
+            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+              struct.username = iprot.readString();
+              struct.setUsernameIsSet(true);
+            } else { 
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+            }
+            break;
+          case 2: // PASSWORD
+            if (schemeField.type == org.apache.thrift.protocol.TType.STRING) {
+              struct.password = iprot.readBinary();
+              struct.setPasswordIsSet(true);
+            } else { 
+              org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+            }
+            break;
+          default:
+            org.apache.thrift.protocol.TProtocolUtil.skip(iprot, schemeField.type);
+        }
+        iprot.readFieldEnd();
+      }
+      iprot.readStructEnd();
+
+      // check for required fields of primitive type, which can't be checked in the validate method
+      struct.validate();
+    }
+
+    public void write(org.apache.thrift.protocol.TProtocol oprot, UserPass struct) throws org.apache.thrift.TException {
+      struct.validate();
+
+      oprot.writeStructBegin(STRUCT_DESC);
+      if (struct.username != null) {
+        oprot.writeFieldBegin(USERNAME_FIELD_DESC);
+        oprot.writeString(struct.username);
+        oprot.writeFieldEnd();
+      }
+      if (struct.password != null) {
+        oprot.writeFieldBegin(PASSWORD_FIELD_DESC);
+        oprot.writeBinary(struct.password);
+        oprot.writeFieldEnd();
+      }
+      oprot.writeFieldStop();
+      oprot.writeStructEnd();
+    }
+
+  }
+
+  private static class UserPassTupleSchemeFactory implements SchemeFactory {
+    public UserPassTupleScheme getScheme() {
+      return new UserPassTupleScheme();
+    }
+  }
+
+  private static class UserPassTupleScheme extends TupleScheme<UserPass> {
+
+    @Override
+    public void write(org.apache.thrift.protocol.TProtocol prot, UserPass struct) throws org.apache.thrift.TException {
+      TTupleProtocol oprot = (TTupleProtocol) prot;
+      BitSet optionals = new BitSet();
+      if (struct.isSetUsername()) {
+        optionals.set(0);
+      }
+      if (struct.isSetPassword()) {
+        optionals.set(1);
+      }
+      oprot.writeBitSet(optionals, 2);
+      if (struct.isSetUsername()) {
+        oprot.writeString(struct.username);
+      }
+      if (struct.isSetPassword()) {
+        oprot.writeBinary(struct.password);
+      }
+    }
+
+    @Override
+    public void read(org.apache.thrift.protocol.TProtocol prot, UserPass struct) throws org.apache.thrift.TException {
+      TTupleProtocol iprot = (TTupleProtocol) prot;
+      BitSet incoming = iprot.readBitSet(2);
+      if (incoming.get(0)) {
+        struct.username = iprot.readString();
+        struct.setUsernameIsSet(true);
+      }
+      if (incoming.get(1)) {
+        struct.password = iprot.readBinary();
+        struct.setPasswordIsSet(true);
+      }
+    }
+  }
+
+}
+

Propchange: accumulo/trunk/proxy/src/main/java/org/apache/accumulo/proxy/thrift/UserPass.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: accumulo/trunk/proxy/src/main/scripts/generate-thrift.sh
URL: http://svn.apache.org/viewvc/accumulo/trunk/proxy/src/main/scripts/generate-thrift.sh?rev=1434921&view=auto
==============================================================================
--- accumulo/trunk/proxy/src/main/scripts/generate-thrift.sh (added)
+++ accumulo/trunk/proxy/src/main/scripts/generate-thrift.sh Thu Jan 17 21:22:35 2013
@@ -0,0 +1,110 @@
+#! /usr/bin/env bash
+
+# Licensed to the Apache Software Foundation (ASF) under one or more
+# contributor license agreements.  See the NOTICE file distributed with
+# this work for additional information regarding copyright ownership.
+# The ASF licenses this file to You under the Apache License, Version 2.0
+# (the "License"); you may not use this file except in compliance with
+# the License.  You may obtain a copy of the License at
+#
+#     http://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+
+# This script will regenerate the thrift code for Accumulo's RPC mechanisms.
+
+# NOTES:
+#   To support this script being called by other modules, only edit the right side.
+#   In other scripts, set the variables that diverge from the defaults below, then call this script.
+#   PACKAGES_TO_GENERATE should be an array, and each element should be the portion of the dot-separated Java package
+#     name following the BASE_OUTPUT_PACKAGE
+#   Leave the BUILD_DIR and FINAL_DIR alone for Maven builds.
+#   INCLUDED_MODULES should be an array that includes other Maven modules with src/main/thrift directories
+#   Use INCLUDED_MODULES=(-) in calling scripts that require no other modules
+# ========================================================================================================================
+[ -z $REQUIRED_THRIFT_VERSION ] && REQUIRED_THRIFT_VERSION='0.9'
+[ -z $INCLUDED_MODULES ]        && INCLUDED_MODULES=
+[ -z $BASE_OUTPUT_PACKAGE ]     && BASE_OUTPUT_PACKAGE='org.apache.accumulo'
+[ -z $PACKAGES_TO_GENERATE ]    && PACKAGES_TO_GENERATE=(proxy)
+[ -z $BUILD_DIR ]               && BUILD_DIR='target'
+[ -z $FINAL_DIR ]               && FINAL_DIR='src/main/java'
+# ========================================================================================================================
+
+fail() {
+  echo $@
+  exit 1
+}
+
+# Test to see if we have thrift installed
+VERSION=$(thrift -version 2>/dev/null | grep -F "${REQUIRED_THRIFT_VERSION}" |  wc -l)
+if [ "$VERSION" -ne 1 ] ; then 
+  # Nope: bail
+  echo "****************************************************"
+  echo "*** thrift is not available"
+  echo "***   expecting 'thrift -version' to return ${REQUIRED_THRIFT_VERSION}"
+  echo "*** generated code will not be updated"
+  echo "****************************************************"
+  exit 0
+fi
+
+# Include thrift sources from additional modules
+THRIFT_ARGS=''
+for i in "${INCLUDED_MODULES[@]}"; do
+  if [ ${i} != '-' ]; then
+    test -d ${i} || fail missing required included module ${i}
+    THRIFT_ARGS="${THRIFT_ARGS} -I ${i}/src/main/thrift"
+  fi
+done
+
+# Ensure output directories are created
+THRIFT_ARGS="${THRIFT_ARGS} -o $BUILD_DIR"
+mkdir -p $BUILD_DIR
+rm -rf $BUILD_DIR/gen-java
+for f in src/main/thrift/*.thrift; do
+  thrift ${THRIFT_ARGS} --gen java $f || fail unable to generate java thrift classes
+  thrift ${THRIFT_ARGS} --gen py $f || fail unable to generate python thrift classes
+  thrift ${THRIFT_ARGS} --gen rb $f || fail unable to generate ruby thrift classes
+  thrift ${THRIFT_ARGS} --gen cpp $f || fail unable to generate cpp thrift classes
+done
+
+# For all generated thrift code, suppress all warnings and add the LICENSE header
+find $BUILD_DIR/gen-java -name '*.java' -print0 | xargs -0 sed -i.orig -e 's/public class /@SuppressWarnings("all") public class /'
+find $BUILD_DIR/gen-java -name '*.java' -print0 | xargs -0 sed -i.orig -e 's/public enum /@SuppressWarnings("all") public enum /'
+for f in $(find $BUILD_DIR/gen-java -name '*.java'); do
+  cat - $f >${f}-with-license <<EOF
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+EOF
+done
+
+# For every generated java file, compare it with the version-controlled one, and copy the ones that have changed into place
+for d in "${PACKAGES_TO_GENERATE[@]}"; do
+  SDIR="${BUILD_DIR}/gen-java/${BASE_OUTPUT_PACKAGE//.//}/${d//.//}/thrift"
+  DDIR="${FINAL_DIR}/${BASE_OUTPUT_PACKAGE//.//}/${d//.//}/thrift"
+  mkdir -p "$DDIR"
+  for f in "$SDIR"/*.java; do
+    DEST="$DDIR/`basename $f`"
+    if ! cmp -s "${f}-with-license" "${DEST}" ; then
+      echo cp -f "${f}-with-license" "${DEST}" 
+      cp -f "${f}-with-license" "${DEST}" || fail unable to copy files to java workspace
+    fi
+  done
+done

Propchange: accumulo/trunk/proxy/src/main/scripts/generate-thrift.sh
------------------------------------------------------------------------------
    svn:eol-style = native

Propchange: accumulo/trunk/proxy/src/main/scripts/generate-thrift.sh
------------------------------------------------------------------------------
    svn:executable = *

Added: accumulo/trunk/proxy/src/main/thrift/proxy.thrift
URL: http://svn.apache.org/viewvc/accumulo/trunk/proxy/src/main/thrift/proxy.thrift?rev=1434921&view=auto
==============================================================================
--- accumulo/trunk/proxy/src/main/thrift/proxy.thrift (added)
+++ accumulo/trunk/proxy/src/main/thrift/proxy.thrift Thu Jan 17 21:22:35 2013
@@ -0,0 +1,230 @@
+/*
+* Licensed to the Apache Software Foundation (ASF) under one or more
+* contributor license agreements.  See the NOTICE file distributed with
+* this work for additional information regarding copyright ownership.
+* The ASF licenses this file to You under the Apache License, Version 2.0
+* (the "License"); you may not use this file except in compliance with
+* the License.  You may obtain a copy of the License at
+*
+*     http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+namespace java org.apache.accumulo.proxy.thrift
+
+struct PKey {
+	1:binary row;
+	2:binary colFamily;
+	3:binary colQualifier;
+	4:binary colVisibility;
+	5:optional i64 timestamp
+}
+
+struct PColumn {
+	1:binary colFamily;
+	2:binary colQualifier;
+	3:optional binary colVisibility;
+	4:optional i64 timestamp;
+}
+
+struct PColumnUpdate {
+	1:binary colFamily;
+	2:binary colQualifier;
+	3:optional binary colVisibility;
+	4:optional i64 timestamp;
+	5:binary value;
+}
+
+struct PKeyValue {
+	1:PKey key,
+	2:binary value
+}
+
+struct PScanResult {
+	1:list<PKeyValue> results,
+	2:bool more
+}
+
+// Ranges by default assume that start is inclusive and that stop is exclusive.
+// To make an inclusive stop value, (resp. exclusive start value), use the successor of the key
+// desired. To obtain a successor key, append a binary 0 to the most-specific value that is defined in the key.
+// (See the method org.apache.accumulo.core.data.Key.followingKey(PartialKey part) )
+
+struct PRange {
+        1:PKey start,
+        2:PKey stop,
+}
+
+struct UserPass
+{
+  1:string username;
+  2:binary password;
+}
+
+struct PIteratorSetting {
+  1: i32 priority;
+  2: string name;
+  3: string iteratorClass;
+  4: map<string,string> properties;
+}
+
+struct KeyValueAndPeek{
+    1:PKeyValue keyValue;
+    2:bool hasNext;
+}
+
+enum PTablePermission {
+  READ = 2,
+  WRITE = 3,
+  BULK_IMPORT = 4,
+  ALTER_TABLE = 5,
+  GRANT = 6,
+  DROP_TABLE = 7,
+}
+
+enum PSystemPermission {
+  GRANT = 0,
+  CREATE_TABLE = 1,
+  DROP_TABLE = 2,
+  ALTER_TABLE = 3,
+  CREATE_USER = 4,
+  DROP_USER = 5,
+  ALTER_USER = 6,
+  SYSTEM = 7,
+}
+
+
+exception NoMoreEntriesException
+{
+  1:string msg;
+}
+
+exception AccumuloException
+{
+  1:string msg;
+}
+exception AccumuloSecurityException
+{
+  1:string msg;
+}
+exception TableNotFoundException
+{
+  1:string msg;
+}
+
+exception TableExistsException
+{
+  1:string msg;
+}
+
+exception IOException
+{
+  1:string msg;
+}
+
+service AccumuloProxy
+{
+  bool ping (1:UserPass userpass);
+
+  //table operations
+
+  i32 tableOperations_addConstraint (1:UserPass userpass, 2:string tableName, 3:string constraintClassName) throws (1:AccumuloException ouch1, 2:AccumuloSecurityException ouch2, 3:TableNotFoundException ouch3);
+  void tableOperations_addSplits (1:UserPass userpass, 2:string tableName, 3:set<string> splits) throws (1:TableNotFoundException ouch1, 2:AccumuloException ouch2, 3:AccumuloSecurityException ouch3);
+  void tableOperations_clearLocatorCache (1:UserPass userpass, 2:string tableName) throws (1:TableNotFoundException ouch1);
+  void tableOperations_compact (1:UserPass userpass, 2:string tableName, 3:string startRow, 4:string endRow, 5:bool flush, 6:bool wait) throws (1:AccumuloSecurityException ouch1, 2:TableNotFoundException ouch2, 3:AccumuloException ouch3);
+  void tableOperations_create (1:UserPass userpass, 2:string tableName) throws (1:AccumuloException ouch1, 2:AccumuloSecurityException ouch2, 3:TableExistsException ouch3);
+  void tableOperations_delete (1:UserPass userpass, 2:string tableName) throws (1:AccumuloException ouch1, 2:AccumuloSecurityException ouch2, 3:TableNotFoundException ouch3);
+  void tableOperations_deleteRows (1:UserPass userpass, 2:string tableName, 3:string startRow, 4:string endRow) throws (1:AccumuloException ouch1, 2:AccumuloSecurityException ouch2, 3:TableNotFoundException ouch3);
+  bool tableOperations_exists (1:UserPass userpass, 2:string tableName);
+  void tableOperations_flush (1:UserPass userpass, 2:string tableName) throws (1:AccumuloException ouch1, 2:AccumuloSecurityException ouch2);
+  map<string,set<string>> tableOperations_getLocalityGroups (1:UserPass userpass, 2:string tableName) throws (1:AccumuloException ouch1, 2:TableNotFoundException ouch2);
+  string tableOperations_getMaxRow (1:UserPass userpass, 2:string tableName, 3:list<binary> auths, 4:string startRow, 5:bool startInclusive, 6:string endRow, 7:bool endInclusive) throws (1:TableNotFoundException ouch1, 2:AccumuloException ouch2, 3:AccumuloSecurityException ouch3);
+  map<string,string> tableOperations_getProperties (1:UserPass userpass, 2:string tableName) throws (1:AccumuloException ouch1, 2:TableNotFoundException ouch2);
+  list<string> tableOperations_getSplits (1:UserPass userpass, 2:string tableName, 3:i32 maxSplits) throws (1:TableNotFoundException ouch1);
+  set<string> tableOperations_list (1:UserPass userpass);
+  map<string,i32> tableOperations_listConstraints (1:UserPass userpass, 2:string tableName) throws (1:AccumuloException ouch1, 2:TableNotFoundException ouch2);
+  void tableOperations_merge (1:UserPass userpass, 2:string tableName, 3:string startRow, 4:string endRow) throws (1:AccumuloException ouch1, 2:AccumuloSecurityException ouch2, 3:TableNotFoundException ouch3);
+  void tableOperations_offline (1:UserPass userpass, 2:string tableName) throws (1:AccumuloSecurityException ouch1, 2:AccumuloException ouch2, 3:TableNotFoundException ouch3);
+  void tableOperations_online (1:UserPass userpass, 2:string tableName) throws (1:AccumuloSecurityException ouch1, 2:AccumuloException ouch2, 3:TableNotFoundException ouch3);
+  void tableOperations_removeConstraint (1:UserPass userpass, 2:string tableName, 3:i32 constraint) throws (1:AccumuloException ouch1, 2:AccumuloSecurityException ouch2);
+  void tableOperations_removeProperty (1:UserPass userpass, 2:string tableName, 3:string property) throws (1:AccumuloException ouch1, 2:AccumuloSecurityException ouch2);
+  void tableOperations_rename (1:UserPass userpass, 2:string oldTableName, 3:string newTableName) throws (1:AccumuloSecurityException ouch1, 2:TableNotFoundException ouch2, 3:AccumuloException ouch3, 4:TableExistsException ouch4);
+  void tableOperations_setLocalityGroups (1:UserPass userpass, 2:string tableName, 3:map<string,set<string>> groups) throws (1:AccumuloException ouch1, 2:AccumuloSecurityException ouch2, 3:TableNotFoundException ouch3);
+  void tableOperations_setProperty (1:UserPass userpass, 2:string tableName, 3:string property, 4:string value) throws (1:AccumuloException ouch1, 2:AccumuloSecurityException ouch2);
+  map<string,string> tableOperations_tableIdMap (1:UserPass userpass);
+
+  //instance operations
+  //list<E> instanceOperations_getActiveScans (1:UserPass userpass, 2:string tserver) throws (1:AccumuloException ouch1, 2:AccumuloSecurityException ouch2);
+  map<string,string> instanceOperations_getSiteConfiguration (1:UserPass userpass) throws (1:AccumuloException ouch1, 2:AccumuloSecurityException ouch2);
+  map<string,string> instanceOperations_getSystemConfiguration (1:UserPass userpass) throws (1:AccumuloException ouch1, 2:AccumuloSecurityException ouch2);
+  list<string> instanceOperations_getTabletServers (1:UserPass userpass);
+  void instanceOperations_removeProperty (1:UserPass userpass, 2:string property) throws (1:AccumuloException ouch1, 2:AccumuloSecurityException ouch2);
+  void instanceOperations_setProperty (1:UserPass userpass, 2:string property, 3:string value) throws (1:AccumuloException ouch1, 2:AccumuloSecurityException ouch2);
+  bool instanceOperations_testClassLoad (1:UserPass userpass, 2:string className, 3:string asTypeName) throws (1:AccumuloException ouch1, 2:AccumuloSecurityException ouch2);
+
+
+  //security operations
+  bool securityOperations_authenticateUser (1:UserPass userpass, 2:string user, 3:binary password) throws (1:AccumuloException ouch1, 2:AccumuloSecurityException ouch2);
+  void securityOperations_changeUserAuthorizations (1:UserPass userpass, 2:string user, 3:set<string> authorizations) throws (1:AccumuloException ouch1, 2:AccumuloSecurityException ouch2);
+  void securityOperations_changeUserPassword (1:UserPass userpass, 2:string user, 3:binary password) throws (1:AccumuloException ouch1, 2:AccumuloSecurityException ouch2);
+  void securityOperations_createUser (1:UserPass userpass, 2:string user, 3:binary password, 4:set<string> authorizations) throws (1:AccumuloException ouch1, 2:AccumuloSecurityException ouch2);
+  void securityOperations_dropUser (1:UserPass userpass, 2:string user) throws (1:AccumuloException ouch1, 2:AccumuloSecurityException ouch2);
+  list<binary> securityOperations_getUserAuthorizations (1:UserPass userpass, 2:string user) throws (1:AccumuloException ouch1, 2:AccumuloSecurityException ouch2);
+  void securityOperations_grantSystemPermission (1:UserPass userpass, 2:string user, 3:PSystemPermission perm) throws (1:AccumuloException ouch1, 2:AccumuloSecurityException ouch2);
+  void securityOperations_grantTablePermission (1:UserPass userpass, 2:string user, 3:string table, 4:PTablePermission perm) throws (1:AccumuloException ouch1, 2:AccumuloSecurityException ouch2);
+  bool securityOperations_hasSystemPermission (1:UserPass userpass, 2:string user, 3:PSystemPermission perm) throws (1:AccumuloException ouch1, 2:AccumuloSecurityException ouch2);
+  bool securityOperations_hasTablePermission (1:UserPass userpass, 2:string user, 3:string table, 4:PTablePermission perm) throws (1:AccumuloException ouch1, 2:AccumuloSecurityException ouch2);
+  set<string> securityOperations_listUsers (1:UserPass userpass) throws (1:AccumuloException ouch1, 2:AccumuloSecurityException ouch2);
+  void securityOperations_revokeSystemPermission (1:UserPass userpass, 2:string user, 3:PSystemPermission perm) throws (1:AccumuloException ouch1, 2:AccumuloSecurityException ouch2);
+  void securityOperations_revokeTablePermission (1:UserPass userpass, 2:string user, 3:string table, 4:PTablePermission perm) throws (1:AccumuloException ouch1, 2:AccumuloSecurityException ouch2);
+
+
+
+  //scanning
+
+  string createBatchScanner(1:UserPass userpass, 2:string tableName, 3:set<string> authorizations, 4:PIteratorSetting iteratorSetting, 5:list<PRange> range);
+  string createScanner(1:UserPass userpass, 2:string tableName, 3:set<string> authorizations, 4:PIteratorSetting iteratorSetting, 5:PRange range);
+
+  bool scanner_hasnext(1:string scanner);
+  KeyValueAndPeek scanner_next(1:string scanner);
+  PScanResult scanner_next_k(1:string scanner, 2:i32 k);
+  void close_scanner(1:string scanner);
+
+  //writing
+
+  //this method is guaranteed to perform an atomic update on all cells with the same row.
+  void updateAndFlush(1:UserPass userpass, 2:string tableName, 3:map<binary, list<PColumnUpdate>> cells, 4:map<binary, list<PColumn>> deletedCells);
+
+
+  //this method creates a persistent writer. use writer_update to perform updates with the returned cookie.
+  string createWriter(1:UserPass userpass, 2:string tableName);
+
+  //this method is guaranteed to perform an atomic update on all cells with the same row.
+  oneway void writer_update(1:string writer, 2:map<binary, list<PColumnUpdate>> cells, 3:map<binary, list<PColumn>> deletedCells);
+
+  void writer_flush(1:string writer)
+
+  void writer_close(1:string writer)
+
+  //  void tableOperations_attachIterator (1:UserPass userpass, 2:string arg2, 3:PIteratorSetting arg3) throws (1:AccumuloSecurityException ouch1, 2:AccumuloException ouch2, 3:TableNotFoundException ouch3);
+  //  void tableOperations_attachIterator (1:UserPass userpass, 2:string arg2, 3:PIteratorSetting arg3, 4:EnumSet<E> arg4) throws (1:AccumuloSecurityException ouch1, 2:AccumuloException ouch2, 3:TableNotFoundException ouch3);
+  //  void tableOperations_checkIteratorConflicts (1:UserPass userpass, 2:string arg2, 3:PIteratorSetting arg3, 4:EnumSet<E> arg4) throws (1:AccumuloException ouch1, 2:TableNotFoundException ouch2);
+  //  void tableOperations_clone (1:UserPass userpass, 2:string arg2, 3:string arg3, 4:bool arg4, 5:map<K,V> arg5, 6:set<E> arg6) throws (1:AccumuloException ouch1, 2:AccumuloSecurityException ouch2, 3:TableNotFoundException ouch3, 4:TableExistsException ouch4);
+  //  void tableOperations_compact (1:UserPass userpass, 2:string arg2, 3:string arg3, 4:string arg4, 5:list<E> arg5, 6:bool arg6, 7:bool arg7) throws (1:AccumuloSecurityException ouch1, 2:TableNotFoundException ouch2, 3:AccumuloException ouch3);
+  //  void tableOperations_create (1:UserPass userpass, 2:string arg2, 3:bool arg3) throws (1:AccumuloException ouch1, 2:AccumuloSecurityException ouch2, 3:TableExistsException ouch3);
+  //  void tableOperations_create (1:UserPass userpass, 2:string arg2, 3:bool arg3, 4:TimeType arg4) throws (1:AccumuloException ouch1, 2:AccumuloSecurityException ouch2, 3:TableExistsException ouch3);
+  //  void tableOperations_exportTable (1:UserPass userpass, 2:string arg2, 3:string arg3) throws (1:TableNotFoundException ouch1, 2:AccumuloException ouch2, 3:AccumuloSecurityException ouch3);
+  //  void tableOperations_flush (1:UserPass userpass, 2:string arg2, 3:string arg3, 4:string arg4, 5:bool arg5) throws (1:AccumuloException ouch1, 2:AccumuloSecurityException ouch2, 3:TableNotFoundException ouch3);
+  //  PIteratorSetting tableOperations_getIteratorSetting (1:UserPass userpass, 2:string arg2, 3:string arg3, 4:IteratorScope arg4) throws (1:AccumuloSecurityException ouch1, 2:AccumuloException ouch2, 3:TableNotFoundException ouch3);
+  //  list<E> tableOperations_getSplits (1:UserPass userpass, 2:string arg2) throws (1:TableNotFoundException ouch1);
+  //  map<K,V> tableOperations_listIterators (1:UserPass userpass, 2:string arg2) throws (1:AccumuloSecurityException ouch1, 2:AccumuloException ouch2, 3:TableNotFoundException ouch3);
+  //  void tableOperations_removeIterator (1:UserPass userpass, 2:string arg2, 3:string arg3, 4:EnumSet<E> arg4) throws (1:AccumuloSecurityException ouch1, 2:AccumuloException ouch2, 3:TableNotFoundException ouch3);
+  //  set<E> tableOperations_splitRangeByTablets (1:UserPass userpass, 2:string arg2, 3:Range arg3, 4:int arg4) throws (1:AccumuloException ouch1, 2:AccumuloSecurityException ouch2, 3:TableNotFoundException ouch3);
+  //  void tableOperations_importDirectory (1:UserPass userpass, 2:string arg2, 3:string arg3, 4:string arg4, 5:bool arg5) throws (1:TableNotFoundException ouch1, 2:IOException ouch2, 3:AccumuloException ouch3, 4:AccumuloSecurityException ouch4);
+  //  void tableOperations_importTable (1:UserPass userpass, 2:string arg2, 3:string arg3) throws (1:TableExistsException ouch1, 2:AccumuloException ouch2, 3:AccumuloSecurityException ouch3);
+
+}

Added: accumulo/trunk/proxy/src/test/java/org/apache/accumulo/TestProxyInstanceOperations.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/proxy/src/test/java/org/apache/accumulo/TestProxyInstanceOperations.java?rev=1434921&view=auto
==============================================================================
--- accumulo/trunk/proxy/src/test/java/org/apache/accumulo/TestProxyInstanceOperations.java (added)
+++ accumulo/trunk/proxy/src/test/java/org/apache/accumulo/TestProxyInstanceOperations.java Thu Jan 17 21:22:35 2013
@@ -0,0 +1,82 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.accumulo;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import java.nio.ByteBuffer;
+import java.util.Properties;
+
+import org.apache.accumulo.proxy.Proxy;
+import org.apache.accumulo.proxy.TestProxyClient;
+import org.apache.accumulo.proxy.thrift.UserPass;
+import org.apache.thrift.TException;
+import org.apache.thrift.server.TServer;
+import org.junit.AfterClass;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class TestProxyInstanceOperations {
+  protected static TServer proxy;
+  protected static Thread thread;
+  protected static TestProxyClient tpc;
+  protected static UserPass userpass;
+  protected static final int port = 10197;
+  
+  @BeforeClass
+  public static void setup() throws Exception {
+    Properties prop = new Properties();
+    prop.setProperty("org.apache.accumulo.proxy.ProxyServer.useMockInstance", "true");
+    
+    proxy = Proxy.createProxyServer(Class.forName("org.apache.accumulo.proxy.thrift.AccumuloProxy"),
+        Class.forName("org.apache.accumulo.proxy.ProxyServer"), port, prop);
+    thread = new Thread() {
+      @Override
+      public void run() {
+        proxy.serve();
+      }
+    };
+    thread.start();
+    tpc = new TestProxyClient("localhost", port);
+    userpass = new UserPass("root", ByteBuffer.wrap("".getBytes()));
+  }
+  
+  @AfterClass
+  public static void tearDown() throws InterruptedException {
+    proxy.stop();
+    thread.join();
+  }
+  
+  @Test
+  public void properties() throws TException {
+    tpc.proxy().instanceOperations_setProperty(userpass, "test.systemprop", "whistletips");
+    
+    assertEquals(tpc.proxy().instanceOperations_getSystemConfiguration(userpass).get("test.systemprop"), "whistletips");
+    tpc.proxy().instanceOperations_removeProperty(userpass, "test.systemprop");
+    assertNull(tpc.proxy().instanceOperations_getSystemConfiguration(userpass).get("test.systemprop"));
+    
+  }
+  
+  @Test
+  public void testClassLoad() throws TException {
+    assertTrue(tpc.proxy().instanceOperations_testClassLoad(userpass, "org.apache.accumulo.core.iterators.user.RegExFilter",
+        "org.apache.accumulo.core.iterators.Filter"));
+  }
+  
+}

Propchange: accumulo/trunk/proxy/src/test/java/org/apache/accumulo/TestProxyInstanceOperations.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: accumulo/trunk/proxy/src/test/java/org/apache/accumulo/TestProxyReadWrite.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/proxy/src/test/java/org/apache/accumulo/TestProxyReadWrite.java?rev=1434921&view=auto
==============================================================================
--- accumulo/trunk/proxy/src/test/java/org/apache/accumulo/TestProxyReadWrite.java (added)
+++ accumulo/trunk/proxy/src/test/java/org/apache/accumulo/TestProxyReadWrite.java Thu Jan 17 21:22:35 2013
@@ -0,0 +1,388 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.accumulo;
+
+import static org.junit.Assert.assertEquals;
+
+import java.nio.ByteBuffer;
+import java.util.ArrayList;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Set;
+
+import org.apache.accumulo.core.client.IteratorSetting;
+import org.apache.accumulo.core.iterators.user.RegExFilter;
+import org.apache.accumulo.proxy.Proxy;
+import org.apache.accumulo.proxy.TestProxyClient;
+import org.apache.accumulo.proxy.Util;
+import org.apache.accumulo.proxy.thrift.PColumnUpdate;
+import org.apache.accumulo.proxy.thrift.PIteratorSetting;
+import org.apache.accumulo.proxy.thrift.PKey;
+import org.apache.accumulo.proxy.thrift.PKeyValue;
+import org.apache.accumulo.proxy.thrift.PRange;
+import org.apache.accumulo.proxy.thrift.PScanResult;
+import org.apache.accumulo.proxy.thrift.UserPass;
+import org.apache.thrift.server.TServer;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class TestProxyReadWrite {
+  protected static TServer proxy;
+  protected static Thread thread;
+  protected static TestProxyClient tpc;
+  protected static UserPass userpass;
+  protected static final int port = 10194;
+  protected static final String testtable = "testtable";
+  
+  @BeforeClass
+  public static void setup() throws Exception {
+    Properties prop = new Properties();
+    prop.setProperty("org.apache.accumulo.proxy.ProxyServer.useMockInstance", "true");
+    
+    proxy = Proxy.createProxyServer(Class.forName("org.apache.accumulo.proxy.thrift.AccumuloProxy"),
+        Class.forName("org.apache.accumulo.proxy.ProxyServer"), port, prop);
+    thread = new Thread() {
+      @Override
+      public void run() {
+        proxy.serve();
+      }
+    };
+    thread.start();
+    tpc = new TestProxyClient("localhost", port);
+    userpass = new UserPass("root", ByteBuffer.wrap("".getBytes()));
+  }
+  
+  @AfterClass
+  public static void tearDown() throws InterruptedException {
+    proxy.stop();
+    thread.join();
+  }
+  
+  @Before
+  public void makeTestTable() throws Exception {
+    tpc.proxy().tableOperations_create(userpass, testtable);
+  }
+  
+  @After
+  public void deleteTestTable() throws Exception {
+    tpc.proxy().tableOperations_delete(userpass, testtable);
+  }
+  
+  private static void addMutation(Map<ByteBuffer,List<PColumnUpdate>> mutations, String row, String cf, String cq, String value) {
+    PColumnUpdate update = new PColumnUpdate(ByteBuffer.wrap(cf.getBytes()), ByteBuffer.wrap(cq.getBytes()), ByteBuffer.wrap(value.getBytes()));
+    mutations.put(ByteBuffer.wrap(row.getBytes()), Collections.singletonList(update));
+  }
+  
+  private static void addMutation(Map<ByteBuffer,List<PColumnUpdate>> mutations, String row, String cf, String cq, String vis, String value) {
+    PColumnUpdate update = new PColumnUpdate(ByteBuffer.wrap(cf.getBytes()), ByteBuffer.wrap(cq.getBytes()), ByteBuffer.wrap(value.getBytes()));
+    update.setColVisibility(vis.getBytes());
+    mutations.put(ByteBuffer.wrap(row.getBytes()), Collections.singletonList(update));
+  }
+  
+  /**
+   * Insert 100000 cells which have as the row [0..99999] (padded with zeros). Set a range so only the entries between -Inf...5 come back (there should be
+   * 50,000)
+   * 
+   * @throws Exception
+   */
+  @Test
+  public void readWriteBatchOneShotWithRange() throws Exception {
+    int maxInserts = 100000;
+    Map<ByteBuffer,List<PColumnUpdate>> mutations = new HashMap<ByteBuffer,List<PColumnUpdate>>();
+    String format = "%1$05d";
+    for (int i = 0; i < maxInserts; i++) {
+      addMutation(mutations, String.format(format, i), "cf" + i, "cq" + i, Util.randString(10));
+      
+      if (i % 1000 == 0 || i == maxInserts - 1) {
+        tpc.proxy().updateAndFlush(userpass, testtable, mutations, null);
+        mutations.clear();
+      }
+    }
+    
+    PKey stop = new PKey();
+    stop.setRow("5".getBytes());
+    List<PRange> pranges = new ArrayList<PRange>();
+    pranges.add(new PRange(null, stop));
+    String cookie = tpc.proxy().createBatchScanner(userpass, testtable, null, null, pranges);
+    
+    int i = 0;
+    boolean hasNext = true;
+    
+    int k = 1000;
+    while (hasNext) {
+      PScanResult kvList = tpc.proxy().scanner_next_k(cookie, k);
+      i += kvList.getResultsSize();
+      hasNext = kvList.isMore();
+    }
+    assertEquals(i, 50000);
+  }
+  
+  /**
+   * Insert 100000 cells which have as the row [0..99999] (padded with zeros). Filter the results so only the even numbers come back.
+   * 
+   * @throws Exception
+   */
+  @Test
+  public void readWriteBatchOneShotWithFilterIterator() throws Exception {
+    int maxInserts = 10000;
+    Map<ByteBuffer,List<PColumnUpdate>> mutations = new HashMap<ByteBuffer,List<PColumnUpdate>>();
+    String format = "%1$05d";
+    for (int i = 0; i < maxInserts; i++) {
+      addMutation(mutations, String.format(format, i), "cf" + i, "cq" + i, Util.randString(10));
+      
+      if (i % 1000 == 0 || i == maxInserts - 1) {
+        tpc.proxy().updateAndFlush(userpass, testtable, mutations, null);
+        mutations.clear();
+      }
+      
+    }
+    
+    String regex = ".*[02468]";
+    
+    IteratorSetting is = new IteratorSetting(50, regex, RegExFilter.class);
+    RegExFilter.setRegexs(is, regex, null, null, null, false);
+    
+    PIteratorSetting pis = Util.iteratorSetting2ProxyIteratorSetting(is);
+    String cookie = tpc.proxy().createBatchScanner(userpass, testtable, null, pis, null);
+    
+    int i = 0;
+    boolean hasNext = true;
+    
+    int k = 1000;
+    while (hasNext) {
+      PScanResult kvList = tpc.proxy().scanner_next_k(cookie, k);
+      for (PKeyValue kv : kvList.getResults()) {
+        assertEquals(Integer.parseInt(new String(kv.getKey().getRow())), i);
+        
+        i += 2;
+      }
+      hasNext = kvList.isMore();
+    }
+  }
+  
+  @Test
+  public void readWriteOneShotWithRange() throws Exception {
+    int maxInserts = 100000;
+    Map<ByteBuffer,List<PColumnUpdate>> mutations = new HashMap<ByteBuffer,List<PColumnUpdate>>();
+    String format = "%1$05d";
+    for (int i = 0; i < maxInserts; i++) {
+      addMutation(mutations, String.format(format, i), "cf" + i, "cq" + i, Util.randString(10));
+      
+      if (i % 1000 == 0 || i == maxInserts - 1) {
+        tpc.proxy().updateAndFlush(userpass, testtable, mutations, null);
+        mutations.clear();
+      }
+    }
+    
+    PKey stop = new PKey();
+    stop.setRow("5".getBytes());
+    String cookie = tpc.proxy().createScanner(userpass, testtable, null, null, new PRange(null, stop));
+    
+    int i = 0;
+    boolean hasNext = true;
+    
+    int k = 1000;
+    while (hasNext) {
+      PScanResult kvList = tpc.proxy().scanner_next_k(cookie, k);
+      i += kvList.getResultsSize();
+      hasNext = kvList.isMore();
+    }
+    assertEquals(i, 50000);
+  }
+  
+  /**
+   * Insert 100000 cells which have as the row [0..99999] (padded with zeros). Filter the results so only the even numbers come back.
+   * 
+   * @throws Exception
+   */
+  @Test
+  public void readWriteOneShotWithFilterIterator() throws Exception {
+    int maxInserts = 10000;
+    Map<ByteBuffer,List<PColumnUpdate>> mutations = new HashMap<ByteBuffer,List<PColumnUpdate>>();
+    String format = "%1$05d";
+    for (int i = 0; i < maxInserts; i++) {
+      addMutation(mutations, String.format(format, i), "cf" + i, "cq" + i, Util.randString(10));
+      
+      if (i % 1000 == 0 || i == maxInserts - 1) {
+        
+        tpc.proxy().updateAndFlush(userpass, testtable, mutations, null);
+        mutations.clear();
+        
+      }
+      
+    }
+    
+    String regex = ".*[02468]";
+    
+    IteratorSetting is = new IteratorSetting(50, regex, RegExFilter.class);
+    RegExFilter.setRegexs(is, regex, null, null, null, false);
+    
+    PIteratorSetting pis = Util.iteratorSetting2ProxyIteratorSetting(is);
+    String cookie = tpc.proxy().createScanner(userpass, testtable, null, pis, null);
+    
+    int i = 0;
+    boolean hasNext = true;
+    
+    int k = 1000;
+    while (hasNext) {
+      PScanResult kvList = tpc.proxy().scanner_next_k(cookie, k);
+      for (PKeyValue kv : kvList.getResults()) {
+        assertEquals(Integer.parseInt(new String(kv.getKey().getRow())), i);
+        
+        i += 2;
+      }
+      hasNext = kvList.isMore();
+    }
+  }
+  
+  // @Test
+  // This test takes kind of a long time. Enable it if you think you may have memory issues.
+  public void manyWritesAndReads() throws Exception {
+    int maxInserts = 1000000;
+    Map<ByteBuffer,List<PColumnUpdate>> mutations = new HashMap<ByteBuffer,List<PColumnUpdate>>();
+    String format = "%1$06d";
+    String writer = tpc.proxy().createWriter(userpass, testtable);
+    for (int i = 0; i < maxInserts; i++) {
+      addMutation(mutations, String.format(format, i), "cf" + i, "cq" + i, Util.randString(10));
+      
+      if (i % 1000 == 0 || i == maxInserts - 1) {
+        
+        tpc.proxy().writer_update(writer, mutations, null);
+        mutations.clear();
+        
+      }
+      
+    }
+    
+    tpc.proxy().writer_flush(writer);
+    tpc.proxy().writer_close(writer);
+    
+    String cookie = tpc.proxy().createBatchScanner(userpass, testtable, null, null, null);
+    
+    int i = 0;
+    boolean hasNext = true;
+    
+    int k = 1000;
+    while (hasNext) {
+      PScanResult kvList = tpc.proxy().scanner_next_k(cookie, k);
+      for (PKeyValue kv : kvList.getResults()) {
+        assertEquals(Integer.parseInt(new String(kv.getKey().getRow())), i);
+        i++;
+      }
+      hasNext = kvList.isMore();
+      if (hasNext)
+        assertEquals(k, kvList.getResults().size());
+    }
+    assertEquals(maxInserts, i);
+  }
+  
+  @Test
+  public void asynchReadWrite() throws Exception {
+    int maxInserts = 10000;
+    Map<ByteBuffer,List<PColumnUpdate>> mutations = new HashMap<ByteBuffer,List<PColumnUpdate>>();
+    String format = "%1$05d";
+    String writer = tpc.proxy().createWriter(userpass, testtable);
+    for (int i = 0; i < maxInserts; i++) {
+      addMutation(mutations, String.format(format, i), "cf" + i, "cq" + i, Util.randString(10));
+      
+      if (i % 1000 == 0 || i == maxInserts - 1) {
+        tpc.proxy().writer_update(writer, mutations, null);
+        mutations.clear();
+      }
+    }
+    
+    tpc.proxy().writer_flush(writer);
+    tpc.proxy().writer_close(writer);
+    
+    String regex = ".*[02468]";
+    
+    IteratorSetting is = new IteratorSetting(50, regex, RegExFilter.class);
+    RegExFilter.setRegexs(is, regex, null, null, null, false);
+    
+    PIteratorSetting pis = Util.iteratorSetting2ProxyIteratorSetting(is);
+    String cookie = tpc.proxy().createBatchScanner(userpass, testtable, null, pis, null);
+    
+    int i = 0;
+    boolean hasNext = true;
+    
+    int k = 1000;
+    int numRead = 0;
+    while (hasNext) {
+      PScanResult kvList = tpc.proxy().scanner_next_k(cookie, k);
+      for (PKeyValue kv : kvList.getResults()) {
+        assertEquals(i, Integer.parseInt(new String(kv.getKey().getRow())));
+        numRead++;
+        i += 2;
+      }
+      hasNext = kvList.isMore();
+    }
+    assertEquals(maxInserts / 2, numRead);
+  }
+  
+  @Test
+  public void testVisibility() throws Exception {
+    
+    Set<String> auths = new HashSet<String>();
+    auths.add("even");
+    tpc.proxy().securityOperations_changeUserAuthorizations(userpass, "root", auths);
+    
+    int maxInserts = 10000;
+    Map<ByteBuffer,List<PColumnUpdate>> mutations = new HashMap<ByteBuffer,List<PColumnUpdate>>();
+    String format = "%1$05d";
+    String writer = tpc.proxy().createWriter(userpass, testtable);
+    for (int i = 0; i < maxInserts; i++) {
+      if (i % 2 == 0)
+        addMutation(mutations, String.format(format, i), "cf" + i, "cq" + i, "even", Util.randString(10));
+      else
+        addMutation(mutations, String.format(format, i), "cf" + i, "cq" + i, "odd", Util.randString(10));
+      
+      if (i % 1000 == 0 || i == maxInserts - 1) {
+        tpc.proxy().writer_update(writer, mutations, null);
+        mutations.clear();
+      }
+    }
+    
+    tpc.proxy().writer_flush(writer);
+    tpc.proxy().writer_close(writer);
+    String cookie = tpc.proxy().createBatchScanner(userpass, testtable, auths, null, null);
+    
+    int i = 0;
+    boolean hasNext = true;
+    
+    int k = 1000;
+    int numRead = 0;
+    while (hasNext) {
+      PScanResult kvList = tpc.proxy().scanner_next_k(cookie, k);
+      for (PKeyValue kv : kvList.getResults()) {
+        assertEquals(Integer.parseInt(new String(kv.getKey().getRow())), i);
+        i += 2;
+        numRead++;
+      }
+      hasNext = kvList.isMore();
+      
+    }
+    assertEquals(maxInserts / 2, numRead);
+  }
+  
+}

Propchange: accumulo/trunk/proxy/src/test/java/org/apache/accumulo/TestProxyReadWrite.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: accumulo/trunk/proxy/src/test/java/org/apache/accumulo/TestProxySecurityOperations.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/proxy/src/test/java/org/apache/accumulo/TestProxySecurityOperations.java?rev=1434921&view=auto
==============================================================================
--- accumulo/trunk/proxy/src/test/java/org/apache/accumulo/TestProxySecurityOperations.java (added)
+++ accumulo/trunk/proxy/src/test/java/org/apache/accumulo/TestProxySecurityOperations.java Thu Jan 17 21:22:35 2013
@@ -0,0 +1,142 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.accumulo;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertTrue;
+
+import java.nio.ByteBuffer;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Properties;
+
+import org.apache.accumulo.proxy.Proxy;
+import org.apache.accumulo.proxy.TestProxyClient;
+import org.apache.accumulo.proxy.thrift.PSystemPermission;
+import org.apache.accumulo.proxy.thrift.PTablePermission;
+import org.apache.accumulo.proxy.thrift.UserPass;
+import org.apache.thrift.TException;
+import org.apache.thrift.server.TServer;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class TestProxySecurityOperations {
+  protected static TServer proxy;
+  protected static Thread thread;
+  protected static TestProxyClient tpc;
+  protected static UserPass userpass;
+  protected static final int port = 10196;
+  protected static final String testtable = "testtable";
+  protected static final String testuser = "VonJines";
+  protected static final ByteBuffer testpw = ByteBuffer.wrap("fiveones".getBytes());
+  
+  @BeforeClass
+  public static void setup() throws Exception {
+    Properties prop = new Properties();
+    prop.setProperty("org.apache.accumulo.proxy.ProxyServer.useMockInstance", "true");
+    
+    proxy = Proxy.createProxyServer(Class.forName("org.apache.accumulo.proxy.thrift.AccumuloProxy"),
+        Class.forName("org.apache.accumulo.proxy.ProxyServer"), port, prop);
+    thread = new Thread() {
+      @Override
+      public void run() {
+        proxy.serve();
+      }
+    };
+    thread.start();
+    
+    tpc = new TestProxyClient("localhost", port);
+    userpass = new UserPass("root", ByteBuffer.wrap("".getBytes()));
+  }
+  
+  @AfterClass
+  public static void tearDown() throws InterruptedException {
+    proxy.stop();
+    thread.join();
+  }
+  
+  @Before
+  public void makeTestTableAndUser() throws Exception {
+    tpc.proxy().tableOperations_create(userpass, testtable);
+    tpc.proxy().securityOperations_createUser(userpass, testuser, testpw, new HashSet<String>());
+  }
+  
+  @After
+  public void deleteTestTable() throws Exception {
+    tpc.proxy().tableOperations_delete(userpass, testtable);
+    tpc.proxy().securityOperations_dropUser(userpass, testuser);
+  }
+  
+  @Test
+  public void create() throws TException {
+    tpc.proxy().securityOperations_createUser(userpass, testuser + "2", testpw, new HashSet<String>());
+    assertTrue(tpc.proxy().securityOperations_listUsers(userpass).contains(testuser + "2"));
+    tpc.proxy().securityOperations_dropUser(userpass, testuser + "2");
+    assertTrue(!tpc.proxy().securityOperations_listUsers(userpass).contains(testuser + "2"));
+  }
+  
+  @Test
+  public void authenticate() throws TException {
+    assertTrue(tpc.proxy().securityOperations_authenticateUser(userpass, testuser, testpw));
+    assertFalse(tpc.proxy().securityOperations_authenticateUser(userpass, "EvilUser", testpw));
+    
+    tpc.proxy().securityOperations_changeUserPassword(userpass, testuser, ByteBuffer.wrap("newpass".getBytes()));
+    assertFalse(tpc.proxy().securityOperations_authenticateUser(userpass, testuser, testpw));
+    assertTrue(tpc.proxy().securityOperations_authenticateUser(userpass, testuser, ByteBuffer.wrap("newpass".getBytes())));
+    
+  }
+  
+  @Test
+  public void tablePermissions() throws TException {
+    tpc.proxy().securityOperations_grantTablePermission(userpass, testuser, testtable, PTablePermission.ALTER_TABLE);
+    assertTrue(tpc.proxy().securityOperations_hasTablePermission(userpass, testuser, testtable, PTablePermission.ALTER_TABLE));
+    
+    tpc.proxy().securityOperations_revokeTablePermission(userpass, testuser, testtable, PTablePermission.ALTER_TABLE);
+    assertFalse(tpc.proxy().securityOperations_hasTablePermission(userpass, testuser, testtable, PTablePermission.ALTER_TABLE));
+    
+  }
+  
+  @Test
+  public void systemPermissions() throws TException {
+    tpc.proxy().securityOperations_grantSystemPermission(userpass, testuser, PSystemPermission.ALTER_USER);
+    assertTrue(tpc.proxy().securityOperations_hasSystemPermission(userpass, testuser, PSystemPermission.ALTER_USER));
+    
+    tpc.proxy().securityOperations_revokeSystemPermission(userpass, testuser, PSystemPermission.ALTER_USER);
+    assertFalse(tpc.proxy().securityOperations_hasSystemPermission(userpass, testuser, PSystemPermission.ALTER_USER));
+    
+  }
+  
+  @Test
+  public void auths() throws TException {
+    HashSet<String> newauths = new HashSet<String>();
+    newauths.add("BBR");
+    newauths.add("Barney");
+    tpc.proxy().securityOperations_changeUserAuthorizations(userpass, testuser, newauths);
+    List<ByteBuffer> actualauths = tpc.proxy().securityOperations_getUserAuthorizations(userpass, testuser);
+    assertEquals(actualauths.size(), newauths.size());
+    
+    for (ByteBuffer auth : actualauths) {
+      System.out.println(auth);
+      assertTrue(newauths.contains(new String(auth.array())));
+    }
+  }
+  
+}

Propchange: accumulo/trunk/proxy/src/test/java/org/apache/accumulo/TestProxySecurityOperations.java
------------------------------------------------------------------------------
    svn:eol-style = native

Added: accumulo/trunk/proxy/src/test/java/org/apache/accumulo/TestProxyTableOperations.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/proxy/src/test/java/org/apache/accumulo/TestProxyTableOperations.java?rev=1434921&view=auto
==============================================================================
--- accumulo/trunk/proxy/src/test/java/org/apache/accumulo/TestProxyTableOperations.java (added)
+++ accumulo/trunk/proxy/src/test/java/org/apache/accumulo/TestProxyTableOperations.java Thu Jan 17 21:22:35 2013
@@ -0,0 +1,219 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ *
+ *     http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+package org.apache.accumulo;
+
+import static org.junit.Assert.assertEquals;
+import static org.junit.Assert.assertFalse;
+import static org.junit.Assert.assertNull;
+import static org.junit.Assert.assertTrue;
+
+import java.nio.ByteBuffer;
+import java.util.Collections;
+import java.util.HashMap;
+import java.util.HashSet;
+import java.util.List;
+import java.util.Map;
+import java.util.Properties;
+import java.util.Set;
+
+import org.apache.accumulo.proxy.Proxy;
+import org.apache.accumulo.proxy.TestProxyClient;
+import org.apache.accumulo.proxy.thrift.PColumnUpdate;
+import org.apache.accumulo.proxy.thrift.UserPass;
+import org.apache.thrift.TException;
+import org.apache.thrift.server.TServer;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.BeforeClass;
+import org.junit.Test;
+
+public class TestProxyTableOperations {
+  
+  protected static TServer proxy;
+  protected static Thread thread;
+  protected static TestProxyClient tpc;
+  protected static UserPass userpass;
+  protected static final int port = 10195;
+  protected static final String testtable = "testtable";
+  
+  @BeforeClass
+  public static void setup() throws Exception {
+    Properties prop = new Properties();
+    prop.setProperty("org.apache.accumulo.proxy.ProxyServer.useMockInstance", "true");
+    
+    proxy = Proxy.createProxyServer(Class.forName("org.apache.accumulo.proxy.thrift.AccumuloProxy"),
+        Class.forName("org.apache.accumulo.proxy.ProxyServer"), port, prop);
+    thread = new Thread() {
+      @Override
+      public void run() {
+        proxy.serve();
+      }
+    };
+    thread.start();
+    tpc = new TestProxyClient("localhost", port);
+    userpass = new UserPass("root", ByteBuffer.wrap("".getBytes()));
+  }
+  
+  @AfterClass
+  public static void tearDown() throws InterruptedException {
+    proxy.stop();
+    thread.join();
+  }
+  
+  @Before
+  public void makeTestTable() throws Exception {
+    tpc.proxy().tableOperations_create(userpass, testtable);
+  }
+  
+  @After
+  public void deleteTestTable() throws Exception {
+    tpc.proxy().tableOperations_delete(userpass, testtable);
+  }
+  
+  @Test
+  public void ping() throws Exception {
+    tpc.proxy().ping(userpass);
+  }
+  
+  @Test
+  public void createExistsDelete() throws TException {
+    assertFalse(tpc.proxy().tableOperations_exists(userpass, "testtable2"));
+    tpc.proxy().tableOperations_create(userpass, "testtable2");
+    assertTrue(tpc.proxy().tableOperations_exists(userpass, "testtable2"));
+    tpc.proxy().tableOperations_delete(userpass, "testtable2");
+    assertFalse(tpc.proxy().tableOperations_exists(userpass, "testtable2"));
+  }
+  
+  @Test
+  public void listRename() throws TException {
+    assertFalse(tpc.proxy().tableOperations_exists(userpass, "testtable2"));
+    tpc.proxy().tableOperations_rename(userpass, testtable, "testtable2");
+    assertTrue(tpc.proxy().tableOperations_exists(userpass, "testtable2"));
+    tpc.proxy().tableOperations_rename(userpass, "testtable2", testtable);
+    assertTrue(tpc.proxy().tableOperations_list(userpass).contains("testtable"));
+    
+  }
+  
+  // This test does not yet function because the backing Mock instance does not yet support merging
+  // TODO: add back in as a test when Mock is improved
+  // @Test
+  public void merge() throws TException {
+    Set<String> splits = new HashSet<String>();
+    splits.add("a");
+    splits.add("c");
+    splits.add("z");
+    tpc.proxy().tableOperations_addSplits(userpass, testtable, splits);
+    
+    tpc.proxy().tableOperations_merge(userpass, testtable, "b", "d");
+    
+    splits.remove("c");
+    
+    List<String> tableSplits = tpc.proxy().tableOperations_getSplits(userpass, testtable, 10);
+    
+    for (String split : tableSplits)
+      assertTrue(splits.contains(split));
+    assertTrue(tableSplits.size() == splits.size());
+    
+  }
+  
+  @Test
+  public void splits() throws TException {
+    Set<String> splits = new HashSet<String>();
+    splits.add("a");
+    splits.add("b");
+    splits.add("z");
+    tpc.proxy().tableOperations_addSplits(userpass, testtable, splits);
+    
+    List<String> tableSplits = tpc.proxy().tableOperations_getSplits(userpass, testtable, 10);
+    
+    for (String split : tableSplits)
+      assertTrue(splits.contains(split));
+    assertTrue(tableSplits.size() == splits.size());
+  }
+  
+  @Test
+  public void constraints() throws TException {
+    int cid = tpc.proxy().tableOperations_addConstraint(userpass, testtable, "org.apache.accumulo.TestConstraint");
+    Map<String,Integer> constraints = tpc.proxy().tableOperations_listConstraints(userpass, testtable);
+    assertEquals((int) constraints.get("org.apache.accumulo.TestConstraint"), cid);
+    tpc.proxy().tableOperations_removeConstraint(userpass, testtable, cid);
+    constraints = tpc.proxy().tableOperations_listConstraints(userpass, testtable);
+    assertNull(constraints.get("org.apache.accumulo.TestConstraint"));
+  }
+  
+  // This test does not yet function because the backing Mock instance does not yet support locality groups
+  // TODO: add back in as a test when Mock is improved
+  // @Test
+  public void localityGroups() throws TException {
+    Map<String,Set<String>> groups = new HashMap<String,Set<String>>();
+    Set<String> group1 = new HashSet<String>();
+    group1.add("cf1");
+    groups.put("group1", group1);
+    Set<String> group2 = new HashSet<String>();
+    group2.add("cf2");
+    group2.add("cf3");
+    groups.put("group2", group2);
+    tpc.proxy().tableOperations_setLocalityGroups(userpass, testtable, groups);
+    
+    Map<String,Set<String>> actualGroups = tpc.proxy().tableOperations_getLocalityGroups(userpass, testtable);
+    
+    assertEquals(groups.size(), actualGroups.size());
+    for (String groupName : groups.keySet()) {
+      assertTrue(actualGroups.containsKey(groupName));
+      assertEquals(groups.get(groupName).size(), actualGroups.get(groupName).size());
+      for (String cf : groups.get(groupName)) {
+        assertTrue(actualGroups.get(groupName).contains(cf));
+      }
+    }
+  }
+  
+  @Test
+  public void tableProperties() throws TException {
+    tpc.proxy().tableOperations_setProperty(userpass, testtable, "test.property1", "wharrrgarbl");
+    assertEquals(tpc.proxy().tableOperations_getProperties(userpass, testtable).get("test.property1"), "wharrrgarbl");
+    tpc.proxy().tableOperations_removeProperty(userpass, testtable, "test.property1");
+    assertNull(tpc.proxy().tableOperations_getProperties(userpass, testtable).get("test.property1"));
+  }
+  
+  private static void addMutation(Map<ByteBuffer,List<PColumnUpdate>> mutations, String row, String cf, String cq, String value) {
+    PColumnUpdate update = new PColumnUpdate(ByteBuffer.wrap(cf.getBytes()), ByteBuffer.wrap(cq.getBytes()), ByteBuffer.wrap(value.getBytes()));
+    mutations.put(ByteBuffer.wrap(row.getBytes()), Collections.singletonList(update));
+  }
+  
+  @Test
+  public void tableOperationsRowMethods() throws TException {
+    List<ByteBuffer> auths = tpc.proxy().securityOperations_getUserAuthorizations(userpass, "root");
+    // System.out.println(auths);
+    Map<ByteBuffer,List<PColumnUpdate>> mutations = new HashMap<ByteBuffer,List<PColumnUpdate>>();
+    for (int i = 0; i < 10; i++) {
+      addMutation(mutations, "" + i, "cf", "cq", "");
+    }
+    tpc.proxy().updateAndFlush(userpass, testtable, mutations, null);
+    
+    assertEquals(tpc.proxy().tableOperations_getMaxRow(userpass, testtable, auths, null, true, null, true), "9");
+    
+    // TODO: Uncomment when the Mock isn't broken
+    // tpc.proxy().tableOperations_deleteRows(userpass,testtable,"51","99");
+    // assertEquals(tpc.proxy().tableOperations_getMaxRow(userpass, testtable, auths, null, true, null, true),"5");
+    
+  }
+  
+  /*
+   * @Test(expected = TException.class) public void peekTest() { }
+   */
+}

Propchange: accumulo/trunk/proxy/src/test/java/org/apache/accumulo/TestProxyTableOperations.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: accumulo/trunk/start/src/main/java/org/apache/accumulo/start/Main.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/start/src/main/java/org/apache/accumulo/start/Main.java?rev=1434921&r1=1434920&r2=1434921&view=diff
==============================================================================
--- accumulo/trunk/start/src/main/java/org/apache/accumulo/start/Main.java (original)
+++ accumulo/trunk/start/src/main/java/org/apache/accumulo/start/Main.java Thu Jan 17 21:22:35 2013
@@ -60,6 +60,8 @@ public class Main {
         runTMP = cl.loadClass("org.apache.accumulo.server.monitor.Monitor");
       } else if (args[0].equals("tracer")) {
         runTMP = cl.loadClass("org.apache.accumulo.server.trace.TraceServer");
+      } else if (args[0].equals("proxy")) {
+        runTMP = cl.loadClass("org.apache.accumulo.proxy.Proxy");
       } else if (args[0].equals("classpath")) {
         vfsClassLoader.getMethod("printClassPath", new Class[] {}).invoke(vfsClassLoader, new Object[] {});
         return;



Mime
View raw message