Return-Path: X-Original-To: archive-asf-public-internal@cust-asf2.ponee.io Delivered-To: archive-asf-public-internal@cust-asf2.ponee.io Received: from cust-asf.ponee.io (cust-asf.ponee.io [163.172.22.183]) by cust-asf2.ponee.io (Postfix) with ESMTP id A0613200CD3 for ; Fri, 28 Jul 2017 09:22:07 +0200 (CEST) Received: by cust-asf.ponee.io (Postfix) id 9F20C16C4E7; Fri, 28 Jul 2017 07:22:07 +0000 (UTC) Delivered-To: archive-asf-public@cust-asf.ponee.io Received: from mail.apache.org (hermes.apache.org [140.211.11.3]) by cust-asf.ponee.io (Postfix) with SMTP id C0ADF16C4E5 for ; Fri, 28 Jul 2017 09:22:06 +0200 (CEST) Received: (qmail 5889 invoked by uid 500); 28 Jul 2017 07:22:05 -0000 Mailing-List: contact dev-help@gora.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: dev@gora.apache.org Delivered-To: mailing list dev@gora.apache.org Received: (qmail 5878 invoked by uid 99); 28 Jul 2017 07:22:05 -0000 Received: from pnap-us-west-generic-nat.apache.org (HELO spamd4-us-west.apache.org) (209.188.14.142) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 28 Jul 2017 07:22:05 +0000 Received: from localhost (localhost [127.0.0.1]) by spamd4-us-west.apache.org (ASF Mail Server at spamd4-us-west.apache.org) with ESMTP id 6DA06C02CF for ; Fri, 28 Jul 2017 07:22:05 +0000 (UTC) X-Virus-Scanned: Debian amavisd-new at spamd4-us-west.apache.org X-Spam-Flag: NO X-Spam-Score: -100.002 X-Spam-Level: X-Spam-Status: No, score=-100.002 tagged_above=-999 required=6.31 tests=[RP_MATCHES_RCVD=-0.001, SPF_PASS=-0.001, USER_IN_WHITELIST=-100] autolearn=disabled Received: from mx1-lw-eu.apache.org ([10.40.0.8]) by localhost (spamd4-us-west.apache.org [10.40.0.11]) (amavisd-new, port 10024) with ESMTP id E8zDrWGpqOAx for ; Fri, 28 Jul 2017 07:22:03 +0000 (UTC) Received: from mailrelay1-us-west.apache.org (mailrelay1-us-west.apache.org [209.188.14.139]) by mx1-lw-eu.apache.org (ASF Mail Server at mx1-lw-eu.apache.org) with ESMTP id 23D215F522 for ; Fri, 28 Jul 2017 07:22:03 +0000 (UTC) Received: from jira-lw-us.apache.org (unknown [207.244.88.139]) by mailrelay1-us-west.apache.org (ASF Mail Server at mailrelay1-us-west.apache.org) with ESMTP id A886FE0D85 for ; Fri, 28 Jul 2017 07:22:01 +0000 (UTC) Received: from jira-lw-us.apache.org (localhost [127.0.0.1]) by jira-lw-us.apache.org (ASF Mail Server at jira-lw-us.apache.org) with ESMTP id 6CCD124D2D for ; Fri, 28 Jul 2017 07:22:00 +0000 (UTC) Date: Fri, 28 Jul 2017 07:22:00 +0000 (UTC) From: "ASF GitHub Bot (JIRA)" To: dev@gora.apache.org Message-ID: In-Reply-To: References: Subject: [jira] [Commented] (GORA-497) Migrate CassandraThrift to CQL MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: 7bit X-JIRA-FingerPrint: 30527f35849b9dde25b450d4833f0394 archived-at: Fri, 28 Jul 2017 07:22:07 -0000 [ 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 DataStore createDataStore(Class keyClass, Class 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)