Search in sources :

Example 1 with TFastFramedTransport

use of org.apache.thrift.transport.TFastFramedTransport in project coprhd-controller by CoprHD.

the class GeoDbSvcStartupTest method checkSchema.

@Test
public void checkSchema() throws Exception {
    // Check if snitch setup is OK
    NodeProbe cmd = new NodeProbe(HOST, JMX_PORT);
    String dc = cmd.getDataCenter();
    Assert.assertTrue("Unexpected DC name " + dc, "vdc1".equalsIgnoreCase(dc));
    // Check schema setup is OK
    TSocket socket = new TSocket(HOST, RPC_PORT);
    TTransport transport = new TFastFramedTransport(socket);
    transport.open();
    try {
        Cassandra.Client client = new Cassandra.Client(new TBinaryProtocol(transport, true, true));
        KsDef def = client.describe_keyspace(DbClientContext.GEO_KEYSPACE_NAME);
        String strategyClass = def.strategy_class;
        log.info("Current strategy class in geodb schema: " + strategyClass);
        Assert.assertTrue("Unexpected strategy class " + strategyClass, strategyClass.contains("NetworkTopologyStrategy"));
        Map<String, String> strategyOptions = def.getStrategy_options();
        Assert.assertTrue(strategyOptions.size() > 0);
    } finally {
        transport.close();
    }
}
Also used : TBinaryProtocol(org.apache.thrift.protocol.TBinaryProtocol) Cassandra(org.apache.cassandra.thrift.Cassandra) TFastFramedTransport(org.apache.thrift.transport.TFastFramedTransport) TTransport(org.apache.thrift.transport.TTransport) KsDef(org.apache.cassandra.thrift.KsDef) DbClient(com.emc.storageos.db.client.DbClient) CoordinatorClient(com.emc.storageos.coordinator.client.service.CoordinatorClient) NodeProbe(org.apache.cassandra.tools.NodeProbe) TSocket(org.apache.thrift.transport.TSocket) Test(org.junit.Test)

Aggregations

CoordinatorClient (com.emc.storageos.coordinator.client.service.CoordinatorClient)1 DbClient (com.emc.storageos.db.client.DbClient)1 Cassandra (org.apache.cassandra.thrift.Cassandra)1 KsDef (org.apache.cassandra.thrift.KsDef)1 NodeProbe (org.apache.cassandra.tools.NodeProbe)1 TBinaryProtocol (org.apache.thrift.protocol.TBinaryProtocol)1 TFastFramedTransport (org.apache.thrift.transport.TFastFramedTransport)1 TSocket (org.apache.thrift.transport.TSocket)1 TTransport (org.apache.thrift.transport.TTransport)1 Test (org.junit.Test)1