accumulo-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From ktur...@apache.org
Subject svn commit: r1438668 - in /accumulo/trunk/proxy: ./ src/main/java/org/apache/accumulo/proxy/ src/test/java/org/apache/accumulo/proxy/
Date Fri, 25 Jan 2013 19:51:44 GMT
Author: kturner
Date: Fri Jan 25 19:51:44 2013
New Revision: 1438668

URL: http://svn.apache.org/viewvc?rev=1438668&view=rev
Log:
ACCUMULO-991 committing patch from Jim Klucar

Modified:
    accumulo/trunk/proxy/proxy.properties
    accumulo/trunk/proxy/src/main/java/org/apache/accumulo/proxy/Proxy.java
    accumulo/trunk/proxy/src/test/java/org/apache/accumulo/proxy/SimpleTest.java
    accumulo/trunk/proxy/src/test/java/org/apache/accumulo/proxy/TestProxyInstanceOperations.java
    accumulo/trunk/proxy/src/test/java/org/apache/accumulo/proxy/TestProxyReadWrite.java
    accumulo/trunk/proxy/src/test/java/org/apache/accumulo/proxy/TestProxySecurityOperations.java
    accumulo/trunk/proxy/src/test/java/org/apache/accumulo/proxy/TestProxyTableOperations.java

Modified: accumulo/trunk/proxy/proxy.properties
URL: http://svn.apache.org/viewvc/accumulo/trunk/proxy/proxy.properties?rev=1438668&r1=1438667&r2=1438668&view=diff
==============================================================================
--- accumulo/trunk/proxy/proxy.properties (original)
+++ accumulo/trunk/proxy/proxy.properties Fri Jan 25 19:51:44 2013
@@ -2,6 +2,8 @@ accumulo.proxy.apis=org.apache.accumulo.
 
 org.apache.accumulo.proxy.ProxyServer.useMockInstance=false
 org.apache.accumulo.proxy.thrift.AccumuloProxy.implementor=org.apache.accumulo.proxy.ProxyServer
+org.apache.accumulo.proxy.thrift.AccumuloProxy.protocolFactory=org.apache.thrift.protocol.TCompactProtocol$Factory
+org.apache.accumulo.proxy.thrift.AccumuloProxy.transportFactory=org.apache.thrift.transport.TFramedTransport$Factory
 org.apache.accumulo.proxy.thrift.AccumuloProxy.port=42424
 
 org.apache.accumulo.proxy.ProxyServer.instancename=test

Modified: accumulo/trunk/proxy/src/main/java/org/apache/accumulo/proxy/Proxy.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/proxy/src/main/java/org/apache/accumulo/proxy/Proxy.java?rev=1438668&r1=1438667&r2=1438668&view=diff
==============================================================================
--- accumulo/trunk/proxy/src/main/java/org/apache/accumulo/proxy/Proxy.java (original)
+++ accumulo/trunk/proxy/src/main/java/org/apache/accumulo/proxy/Proxy.java Fri Jan 25 19:51:44
2013
@@ -24,11 +24,11 @@ import java.util.Properties;
 
 import org.apache.accumulo.core.cli.Help;
 import org.apache.thrift.TProcessor;
-import org.apache.thrift.protocol.TCompactProtocol;
+import org.apache.thrift.protocol.TProtocolFactory;
 import org.apache.thrift.server.THsHaServer;
 import org.apache.thrift.server.TServer;
-import org.apache.thrift.transport.TFramedTransport;
 import org.apache.thrift.transport.TNonblockingServerSocket;
+import org.apache.thrift.transport.TTransportFactory;
 
 import com.beust.jcommander.IStringConverter;
 import com.beust.jcommander.Parameter;
@@ -83,15 +83,20 @@ public class Proxy {
       
       Class<?> implementor = Class.forName(opts.prop.getProperty(api + ".implementor"));
       
+      Class<? extends TProtocolFactory> protoFactoryClass = Class.forName(opts.prop.getProperty(api
+ ".protocolFactory")).asSubclass(TProtocolFactory.class);
+      Class<? extends TTransportFactory> transportFactoryClass = Class.forName(opts.prop.getProperty(api
+ ".transportFactory")).asSubclass(
+          TTransportFactory.class);
+
       int port = Integer.parseInt(opts.prop.getProperty(api + ".port"));
-      TServer server = createProxyServer(apiclass, implementor, port, opts.prop);
+      TServer server = createProxyServer(apiclass, implementor, port, protoFactoryClass,
transportFactoryClass, opts.prop);
       server.serve();
     }
   }
   
-  public static TServer createProxyServer(Class<?> api, Class<?> implementor,
final int port, Properties properties) throws Exception {
+  public static TServer createProxyServer(Class<?> api, Class<?> implementor,
final int port, Class<? extends TProtocolFactory> protoClass,
+      Class<? extends TTransportFactory> transportFactoryClass, Properties properties)
throws Exception {
     final TNonblockingServerSocket socket = new TNonblockingServerSocket(port);
-    
+
     // create the implementor
     Object impl = implementor.getConstructor(Properties.class).newInstance(properties);
     
@@ -104,8 +109,8 @@ public class Proxy {
     
     THsHaServer.Args args = new THsHaServer.Args(socket);
     args.processor(processor);
-    args.transportFactory(new TFramedTransport.Factory());
-    args.protocolFactory(new TCompactProtocol.Factory());
+    args.transportFactory(transportFactoryClass.newInstance());
+    args.protocolFactory(protoClass.newInstance());
     return new THsHaServer(args);
   }
   

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=1438668&r1=1438667&r2=1438668&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 Fri Jan 25
19:51:44 2013
@@ -60,7 +60,9 @@ 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.TCompactProtocol;
 import org.apache.thrift.server.TServer;
+import org.apache.thrift.transport.TFramedTransport;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.Test;
@@ -93,11 +95,8 @@ public class SimpleTest {
     props.put("org.apache.accumulo.proxy.ProxyServer.zookeepers", accumulo.getZookeepers());
     
     proxyPort = 40000 + random.nextInt(20000);
-    proxyServer = Proxy.createProxyServer(
-        org.apache.accumulo.proxy.thrift.AccumuloProxy.class,
-        org.apache.accumulo.proxy.ProxyServer.class, 
-        proxyPort, 
-        props);
+    proxyServer = Proxy.createProxyServer(org.apache.accumulo.proxy.thrift.AccumuloProxy.class,
org.apache.accumulo.proxy.ProxyServer.class, proxyPort,
+        TCompactProtocol.Factory.class, TFramedTransport.Factory.class, props);
     thread = new Thread() {
       @Override
       public void run() {

Modified: accumulo/trunk/proxy/src/test/java/org/apache/accumulo/proxy/TestProxyInstanceOperations.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/proxy/src/test/java/org/apache/accumulo/proxy/TestProxyInstanceOperations.java?rev=1438668&r1=1438667&r2=1438668&view=diff
==============================================================================
--- accumulo/trunk/proxy/src/test/java/org/apache/accumulo/proxy/TestProxyInstanceOperations.java
(original)
+++ accumulo/trunk/proxy/src/test/java/org/apache/accumulo/proxy/TestProxyInstanceOperations.java
Fri Jan 25 19:51:44 2013
@@ -23,11 +23,11 @@ import static org.junit.Assert.assertTru
 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.protocol.TCompactProtocol;
 import org.apache.thrift.server.TServer;
+import org.apache.thrift.transport.TFramedTransport;
 import org.junit.AfterClass;
 import org.junit.BeforeClass;
 import org.junit.Test;
@@ -44,8 +44,8 @@ public class TestProxyInstanceOperations
     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);
+    proxy = Proxy.createProxyServer(Class.forName("org.apache.accumulo.proxy.thrift.AccumuloProxy"),
Class.forName("org.apache.accumulo.proxy.ProxyServer"),
+        port, TCompactProtocol.Factory.class, TFramedTransport.Factory.class, prop);
     thread = new Thread() {
       @Override
       public void run() {
@@ -75,8 +75,7 @@ public class TestProxyInstanceOperations
   
   @Test
   public void testClassLoad() throws TException {
-    assertTrue(tpc.proxy().testClassLoad(userpass, "org.apache.accumulo.core.iterators.user.RegExFilter",
-        "org.apache.accumulo.core.iterators.Filter"));
+    assertTrue(tpc.proxy().testClassLoad(userpass, "org.apache.accumulo.core.iterators.user.RegExFilter",
"org.apache.accumulo.core.iterators.Filter"));
   }
   
 }

Modified: accumulo/trunk/proxy/src/test/java/org/apache/accumulo/proxy/TestProxyReadWrite.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/proxy/src/test/java/org/apache/accumulo/proxy/TestProxyReadWrite.java?rev=1438668&r1=1438667&r2=1438668&view=diff
==============================================================================
--- accumulo/trunk/proxy/src/test/java/org/apache/accumulo/proxy/TestProxyReadWrite.java (original)
+++ accumulo/trunk/proxy/src/test/java/org/apache/accumulo/proxy/TestProxyReadWrite.java Fri
Jan 25 19:51:44 2013
@@ -38,7 +38,9 @@ import org.apache.accumulo.proxy.thrift.
 import org.apache.accumulo.proxy.thrift.ScanResult;
 import org.apache.accumulo.proxy.thrift.TimeType;
 import org.apache.accumulo.proxy.thrift.UserPass;
+import org.apache.thrift.protocol.TCompactProtocol;
 import org.apache.thrift.server.TServer;
+import org.apache.thrift.transport.TFramedTransport;
 import org.junit.After;
 import org.junit.AfterClass;
 import org.junit.Before;
@@ -58,8 +60,8 @@ public class TestProxyReadWrite {
     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);
+    proxy = Proxy.createProxyServer(Class.forName("org.apache.accumulo.proxy.thrift.AccumuloProxy"),
Class.forName("org.apache.accumulo.proxy.ProxyServer"),
+        port, TCompactProtocol.Factory.class, TFramedTransport.Factory.class, prop);
     thread = new Thread() {
       @Override
       public void run() {

Modified: accumulo/trunk/proxy/src/test/java/org/apache/accumulo/proxy/TestProxySecurityOperations.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/proxy/src/test/java/org/apache/accumulo/proxy/TestProxySecurityOperations.java?rev=1438668&r1=1438667&r2=1438668&view=diff
==============================================================================
--- accumulo/trunk/proxy/src/test/java/org/apache/accumulo/proxy/TestProxySecurityOperations.java
(original)
+++ accumulo/trunk/proxy/src/test/java/org/apache/accumulo/proxy/TestProxySecurityOperations.java
Fri Jan 25 19:51:44 2013
@@ -25,14 +25,14 @@ 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.SystemPermission;
 import org.apache.accumulo.proxy.thrift.TablePermission;
 import org.apache.accumulo.proxy.thrift.TimeType;
 import org.apache.accumulo.proxy.thrift.UserPass;
 import org.apache.thrift.TException;
+import org.apache.thrift.protocol.TCompactProtocol;
 import org.apache.thrift.server.TServer;
+import org.apache.thrift.transport.TFramedTransport;
 import org.junit.After;
 import org.junit.AfterClass;
 import org.junit.Before;
@@ -54,8 +54,8 @@ public class TestProxySecurityOperations
     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);
+    proxy = Proxy.createProxyServer(Class.forName("org.apache.accumulo.proxy.thrift.AccumuloProxy"),
Class.forName("org.apache.accumulo.proxy.ProxyServer"),
+        port, TCompactProtocol.Factory.class, TFramedTransport.Factory.class, prop);
     thread = new Thread() {
       @Override
       public void run() {

Modified: accumulo/trunk/proxy/src/test/java/org/apache/accumulo/proxy/TestProxyTableOperations.java
URL: http://svn.apache.org/viewvc/accumulo/trunk/proxy/src/test/java/org/apache/accumulo/proxy/TestProxyTableOperations.java?rev=1438668&r1=1438667&r2=1438668&view=diff
==============================================================================
--- accumulo/trunk/proxy/src/test/java/org/apache/accumulo/proxy/TestProxyTableOperations.java
(original)
+++ accumulo/trunk/proxy/src/test/java/org/apache/accumulo/proxy/TestProxyTableOperations.java
Fri Jan 25 19:51:44 2013
@@ -30,13 +30,13 @@ 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.ColumnUpdate;
 import org.apache.accumulo.proxy.thrift.TimeType;
 import org.apache.accumulo.proxy.thrift.UserPass;
 import org.apache.thrift.TException;
+import org.apache.thrift.protocol.TCompactProtocol;
 import org.apache.thrift.server.TServer;
+import org.apache.thrift.transport.TFramedTransport;
 import org.junit.After;
 import org.junit.AfterClass;
 import org.junit.Before;
@@ -57,8 +57,8 @@ public class TestProxyTableOperations {
     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);
+    proxy = Proxy.createProxyServer(Class.forName("org.apache.accumulo.proxy.thrift.AccumuloProxy"),
Class.forName("org.apache.accumulo.proxy.ProxyServer"),
+        port, TCompactProtocol.Factory.class, TFramedTransport.Factory.class, prop);
     thread = new Thread() {
       @Override
       public void run() {



Mime
View raw message