Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Fixed up deamon so thrift starts. Cause we love thrift. #177

Merged
merged 1 commit into from

2 participants

edwardcapriolo Nate McCall
edwardcapriolo
Collaborator

No description provided.

Nate McCall zznate merged commit 179d983 into from
Nate McCall zznate deleted the branch
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
This page is out of date. Refresh to see the latest.
33 src/main/java/org/usergrid/vx/client/thrift/FramedConnWrapper.java
View
@@ -0,0 +1,33 @@
+package org.usergrid.vx.client.thrift;
+
+import org.apache.cassandra.thrift.Cassandra;
+import org.apache.thrift.protocol.*;
+import org.apache.thrift.transport.*;
+
+public class FramedConnWrapper {
+
+ private TTransport transport;
+ private TProtocol proto;
+ private TSocket socket;
+
+ public FramedConnWrapper(String host, int port) {
+ socket = new TSocket(host, port);
+ transport = new TFramedTransport(socket);
+ proto = new TBinaryProtocol(transport);
+ }
+
+ public void open() throws Exception {
+ transport.open();
+ }
+
+ public void close() throws Exception {
+ transport.close();
+ socket.close();
+ }
+
+ public Cassandra.Client getClient() {
+ Cassandra.Client client = new Cassandra.Client(proto);
+ return client;
+ }
+}
+
7 src/main/java/org/usergrid/vx/server/IntravertDeamon.java
View
@@ -15,14 +15,15 @@
*/
package org.usergrid.vx.server;
-import com.google.common.base.CharMatcher;
-import com.google.common.base.Preconditions;
import org.apache.cassandra.service.CassandraDaemon;
+import org.apache.cassandra.thrift.ThriftServer;
import org.apache.commons.lang.StringUtils;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import java.io.IOException;
+import java.net.InetAddress;
+import java.net.UnknownHostException;
public class IntravertDeamon extends CassandraDaemon {
@@ -57,11 +58,13 @@ public void init(String[] arguments) throws IOException {
@Override
public void start() {
+ super.start();
intravertServer.start();
}
@Override
public void stop() {
+ super.stop();
logger.info("Stopping IntravertDeamon");
intravertServer.stop();
}
4 src/test/java/org/usergrid/vx/experimental/CassandraRunner.java
View
@@ -185,8 +185,8 @@ private void startCassandra() {
System.setProperty("log4j.defaultInitOverride","true");
System.setProperty("log4j.configuration", "log4j.properties");
System.setProperty("cassandra.ring_delay_ms","1000");
- System.setProperty("cassandra.start_rpc","true");
- System.setProperty("cassandra.start_native_transport","true");
+ System.setProperty("cassandra.start_rpc","true");
+ System.setProperty("cassandra.start_native_transport","true");
executor.execute(new Runnable() {
public void run() {
2  src/test/java/org/usergrid/vx/experimental/PerfTestingITest.java
View
@@ -20,6 +20,7 @@
import java.util.ArrayList;
import java.util.List;
+import org.apache.cassandra.thrift.Cassandra;
import org.codehaus.jackson.JsonGenerationException;
import org.codehaus.jackson.map.JsonMappingException;
import org.codehaus.jackson.map.ObjectMapper;
@@ -28,6 +29,7 @@
import org.junit.runner.RunWith;
import org.usergrid.vx.client.IntraClient2;
import org.usergrid.vx.client.IntraClient2.Transport;
+import org.usergrid.vx.client.thrift.FramedConnWrapper;
import org.vertx.java.core.Vertx;
/* unless testing performance chances this should like be ignored */
25 src/test/java/org/usergrid/vx/experimental/ThriftITest.java
View
@@ -0,0 +1,25 @@
+package org.usergrid.vx.experimental;
+
+import junit.framework.Assert;
+
+import org.apache.cassandra.thrift.Cassandra;
+import org.junit.Test;
+import org.junit.runner.RunWith;
+import org.usergrid.vx.client.thrift.FramedConnWrapper;
+
+@RunWith(CassandraRunner.class)
+@RequiresKeyspace(ksName = "myks")
+@RequiresColumnFamily(ksName = "myks", cfName = "mycf")
+public class ThriftITest {
+
+ @Test
+ @RequiresColumnFamily(ksName = "myks", cfName = "mycf")
+ public void aThriftSanityTest() throws Exception {
+ Thread.sleep(1000);
+ FramedConnWrapper wrap = new FramedConnWrapper("localhost",9160);
+ wrap.open();
+ Cassandra.Client c = wrap.getClient();
+ Assert.assertTrue( c.describe_keyspaces().size() > 1 );
+ wrap.close();
+ }
+}
Something went wrong with that request. Please try again.