gora-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "ASF GitHub Bot (JIRA)" <j...@apache.org>
Subject [jira] [Commented] (GORA-497) Migrate CassandraThrift to CQL
Date Fri, 28 Jul 2017 07:22:00 GMT

    [ https://issues.apache.org/jira/browse/GORA-497?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel&focusedCommentId=16104575#comment-16104575
] 

ASF GitHub Bot commented on GORA-497:
-------------------------------------

Github user djkevincr commented on a diff in the pull request:

    https://github.com/apache/gora/pull/110#discussion_r130027402
  
    --- Diff: gora-cassandra-cql/src/test/java/org/apache/gora/cassandra/GoraCassandraTestDriver.java
---
    @@ -0,0 +1,190 @@
    +/*
    + *  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.
    + */
    +
    +/**
    + * @author lewismc
    + *
    + */
    +
    +package org.apache.gora.cassandra;
    +
    +import com.google.common.util.concurrent.ThreadFactoryBuilder;
    +import org.apache.cassandra.io.util.FileUtils;
    +import org.apache.cassandra.service.CassandraDaemon;
    +import org.apache.gora.GoraTestDriver;
    +import org.apache.gora.cassandra.store.CassandraStore;
    +import org.apache.gora.persistency.Persistent;
    +import org.apache.gora.store.DataStore;
    +import org.apache.gora.store.DataStoreFactory;
    +import org.apache.gora.util.GoraException;
    +import org.slf4j.Logger;
    +import org.slf4j.LoggerFactory;
    +
    +import java.io.File;
    +import java.util.Properties;
    +import java.util.concurrent.Callable;
    +import java.util.concurrent.ExecutionException;
    +import java.util.concurrent.ExecutorService;
    +import java.util.concurrent.Executors;
    +import java.util.concurrent.Future;
    +
    +// Logging imports
    +
    +/**
    + * Helper class for third party tests using gora-cassandra backend. 
    + * @see GoraTestDriver for test specifics.
    + * This driver is the base for all test cases that require an embedded Cassandra
    + * server. In this case we draw on Hector's @see EmbeddedServerHelper.
    + * It starts (setUp) and stops (tearDown) embedded Cassandra server.
    + *
    + */
    +
    +public class GoraCassandraTestDriver extends GoraTestDriver {
    +  private static Logger log = LoggerFactory.getLogger(GoraCassandraTestDriver.class);
    +  
    +  private static String baseDirectory = "target/test";
    +
    +  private CassandraDaemon cassandraDaemon;
    +
    +  private Thread cassandraThread;
    +
    +  private Properties properties;
    +
    +  public void setParameters(Properties parameters) {
    +    this.properties = parameters;
    +  }
    +
    +  @Override
    +  public <K, T extends Persistent> DataStore<K, T> createDataStore(Class<K>
keyClass, Class<T> persistentClass) throws GoraException {
    +    return DataStoreFactory.createDataStore(CassandraStore.class, keyClass, persistentClass
, conf, properties, null);
    +  }
    +
    +  /**
    +   * @return temporary base directory of running cassandra instance
    +   */
    +  public String getBaseDirectory() {
    +    return baseDirectory;
    +  }
    +
    +  public GoraCassandraTestDriver() {
    +    super(CassandraStore.class);
    +  }
    +	
    +  /**
    +   * Starts embedded Cassandra server.
    +   *
    +   * @throws Exception
    +   * 	if an error occurs
    +   */
    +  @Override
    +  public void setUpClass(){
    +    log.info("Starting embedded Cassandra Server...");
    +    try {
    +      cleanupDirectoriesFailover();
    +      FileUtils.createDirectory(baseDirectory);
    +      System.setProperty("log4j.configuration", "log4j-server.properties");
    +      System.setProperty("cassandra.config", "cassandra.yaml");
    +      
    +      cassandraDaemon = new CassandraDaemon();
    +      cassandraDaemon.completeSetup();
    +      cassandraDaemon.applyConfig();
    +      cassandraDaemon.init(null);
    +      cassandraThread = new Thread(new Runnable() {
    +
    +        public void run() {
    +          try {
    +            cassandraDaemon.start();
    +          } catch (Exception e) {
    +            log.error("Embedded casandra server run failed!", e);
    +          }
    +        }
    +      });
    +	
    +      cassandraThread.setDaemon(true);
    +      cassandraThread.start();
    +    } catch (Exception e) {
    +      log.error("Embedded casandra server start failed!", e);
    +
    +      // cleanup
    +      tearDownClass();
    +    }
    +  }
    +
    +
    +  /**
    +   * Stops embedded Cassandra server.
    +   *
    +   * @throws Exception
    +   * 	if an error occurs
    +   */
    +  @Override
    +  public void tearDownClass(){
    --- End diff --
    
    Seems this is not formatted properly - tearDownClass() {


> Migrate CassandraThrift to CQL 
> -------------------------------
>
>                 Key: GORA-497
>                 URL: https://issues.apache.org/jira/browse/GORA-497
>             Project: Apache Gora
>          Issue Type: Improvement
>          Components: gora-cassandra
>            Reporter: Madhawa Gunasekara
>            Assignee: Madhawa Gunasekara
>              Labels: gsoc2017
>             Fix For: 0.8
>
>




--
This message was sent by Atlassian JIRA
(v6.4.14#64029)

Mime
View raw message