{"action":"created","comment":{"url":"https://api.github.com/repos/geotrellis/geotrellis/pulls/comments/32029565","id":32029565,"diff_hunk":"@@ -1,24 +1,52 @@\n package geotrellis.spark.io.cassandra\n \n+import com.datastax.driver.core.Session\n import com.datastax.spark.connector.cql._\n import org.apache.spark.SparkContext\n+import org.apache.spark.Logging\n \n import java.net.InetAddress\n \n-object EmbeddedCassandra {\n+object EmbeddedCassandra extends Logging {\n \n-  val deleteKeyspaceCql = \"DROP KEYSPACE IF EXISTS test\"\n-  val createKeyspaceCql = \"CREATE KEYSPACE IF NOT EXISTS test WITH REPLICATION = { 'class': 'SimpleStrategy', 'replication_factor': 1 }\"\n+  val GtCassandraTestKeyspace = \"test\"\n+\n+  val deleteKeyspaceCql = s\"DROP KEYSPACE IF EXISTS ${GtCassandraTestKeyspace}\"\n+  val createKeyspaceCql = s\"CREATE KEYSPACE IF NOT EXISTS ${GtCassandraTestKeyspace} WITH REPLICATION = { 'class': 'SimpleStrategy', 'replication_factor': 1 }\"\n   \n   // Recreate the keyspace with each session, and prevent premature closure of session.\n-  def withSession(host: String, keySpace: String)(f: CassandraSession => Unit)(implicit sc: SparkContext): Unit = {\n+  def withSession(host: String, rpcPort: Int, nativePort: Int, keySpace: String)(f: CassandraSession => Unit)(implicit sc: SparkContext): Unit = {\n     val sparkConf = sc.getConf\n-    val hadoopConf = sc.hadoopConfiguration\n     sparkConf.set(\"spark.cassandra.connection.host\", host)\n+      .set(\"spark.cassandra.connection.rpc.port\", rpcPort.toString)\n+      .set(\"spark.cassandra.connection.native.port\", nativePort.toString)\n+    // https://github.com/datastax/spark-cassandra-connector/blob/master/doc/1_connecting.md\n+    // val sc = new SparkContext(\"spark://127.0.0.1\", \"test\", sparkConf)\n+    println(s\"set config in EmbeddedCassandra ${GtCassandraTestKeyspace} host ${host} rpc ${rpcPort.toString} native ${nativePort.toString}\")\n+\n+    val testValue = sparkConf.get(\"spark.cassandra.connection.host\")\n+    println(s\"get sparkConf in EmbeddedCassandra ${testValue} host \")\n+\n+    val hadoopConf = sc.hadoopConfiguration\n     val connector = CassandraConnector(sparkConf)\n     val session = new CassandraSession(connector, keySpace)\n     session.execute(deleteKeyspaceCql)\n     session.execute(createKeyspaceCql)\n-    f(session)\n+\n+    try {\n+      f(session)\n+    } finally {\n+      logInfo(\"finally in EmbeddedCassandraSession\")\n+    }\n   }\n }\n+//\n+//object EmbeddedCassandraSession {\n+//  implicit def cassandraSessionToDataStaxSession(session: EmbeddedCassandraSession): Session =\n+//    session.session\n+//}\n+//\n+//class EmbeddedCassandraSession( connector: CassandraConnector,  val keySpace: String ) {\n+//  private val session: Session = connector.openSession()\n+//  def close() = session.close\n+//}","path":"spark/src/test/scala/geotrellis/spark/io/cassandra/EmbeddedCassandraConnector.scala","position":58,"original_position":58,"commit_id":"9c4ef7f4cea786004035faf315a9e4319ab0cd0b","original_commit_id":"9c4ef7f4cea786004035faf315a9e4319ab0cd0b","user":{"login":"lossyrob","id":2320142,"avatar_url":"https://avatars.githubusercontent.com/u/2320142?v=3","gravatar_id":"","url":"https://api.github.com/users/lossyrob","html_url":"https://github.com/lossyrob","followers_url":"https://api.github.com/users/lossyrob/followers","following_url":"https://api.github.com/users/lossyrob/following{/other_user}","gists_url":"https://api.github.com/users/lossyrob/gists{/gist_id}","starred_url":"https://api.github.com/users/lossyrob/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/lossyrob/subscriptions","organizations_url":"https://api.github.com/users/lossyrob/orgs","repos_url":"https://api.github.com/users/lossyrob/repos","events_url":"https://api.github.com/users/lossyrob/events{/privacy}","received_events_url":"https://api.github.com/users/lossyrob/received_events","type":"User","site_admin":false},"body":"rmv commented ouf code","created_at":"2015-06-09T15:58:18Z","updated_at":"2015-06-09T15:58:18Z","html_url":"https://github.com/geotrellis/geotrellis/pull/1107#discussion_r32029565","pull_request_url":"https://api.github.com/repos/geotrellis/geotrellis/pulls/1107","_links":{"self":{"href":"https://api.github.com/repos/geotrellis/geotrellis/pulls/comments/32029565"},"html":{"href":"https://github.com/geotrellis/geotrellis/pull/1107#discussion_r32029565"},"pull_request":{"href":"https://api.github.com/repos/geotrellis/geotrellis/pulls/1107"}}},"pull_request":{"url":"https://api.github.com/repos/geotrellis/geotrellis/pulls/1107","id":37213152,"html_url":"https://github.com/geotrellis/geotrellis/pull/1107","diff_url":"https://github.com/geotrellis/geotrellis/pull/1107.diff","patch_url":"https://github.com/geotrellis/geotrellis/pull/1107.patch","issue_url":"https://api.github.com/repos/geotrellis/geotrellis/issues/1107","number":1107,"state":"open","locked":false,"title":"Cassandra Unit Tests GO","user":{"login":"allixender","id":4483885,"avatar_url":"https://avatars.githubusercontent.com/u/4483885?v=3","gravatar_id":"","url":"https://api.github.com/users/allixender","html_url":"https://github.com/allixender","followers_url":"https://api.github.com/users/allixender/followers","following_url":"https://api.github.com/users/allixender/following{/other_user}","gists_url":"https://api.github.com/users/allixender/gists{/gist_id}","starred_url":"https://api.github.com/users/allixender/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/allixender/subscriptions","organizations_url":"https://api.github.com/users/allixender/orgs","repos_url":"https://api.github.com/users/allixender/repos","events_url":"https://api.github.com/users/allixender/events{/privacy}","received_events_url":"https://api.github.com/users/allixender/received_events","type":"User","site_admin":false},"body":"Fixes #1097 \r\n\r\n- updated spark cassandra connector and cassandra java driver versions to latest stable in Version.scala\r\n- fixed cassandra config yaml (another-cassandra.yaml) for embedded Cassandra instance\r\n- fixed SparkContext needing cassandra connection properties at creation in OnlyIfCanRunSpark.scala\r\n- fixed \"LayerNotFoundError expected but RuntimeError found\", wasn't thrown in CassandraRasterCatalogSpec.scala tests, found Sys.error instead of throws Exception in CassandraAttributeStore.scala, replaced with LayerNotForundError from package.scala\r\n\r\nALL CASSANDRA UNIT TESTS COMPLETE SUCCESSFULLY\r\n\r\n**JAVA INFO**\r\nSeems that with (Open)JDK 7_80 CassandraRasterCatalogSpec.scala test fails occasionally with OutOfMemory / PermGenSpace, (MaxPermSize=384m come from somewhere), but with JDK 8 PermGenSpace has been removed and will complete.\r\n\r\nBe aware that if the tests abort because of such an exception, the cassandra instance will not be properly shut down and block the ports!","created_at":"2015-06-09T01:53:59Z","updated_at":"2015-06-09T15:58:18Z","closed_at":null,"merged_at":null,"merge_commit_sha":"37a242075d71e8b0fa0c6587a2787579b135950f","assignee":null,"milestone":null,"commits_url":"https://api.github.com/repos/geotrellis/geotrellis/pulls/1107/commits","review_comments_url":"https://api.github.com/repos/geotrellis/geotrellis/pulls/1107/comments","review_comment_url":"https://api.github.com/repos/geotrellis/geotrellis/pulls/comments{/number}","comments_url":"https://api.github.com/repos/geotrellis/geotrellis/issues/1107/comments","statuses_url":"https://api.github.com/repos/geotrellis/geotrellis/statuses/9c4ef7f4cea786004035faf315a9e4319ab0cd0b","head":{"label":"allixender:feature/cassandra-gsoc2015","ref":"feature/cassandra-gsoc2015","sha":"9c4ef7f4cea786004035faf315a9e4319ab0cd0b","user":{"login":"allixender","id":4483885,"avatar_url":"https://avatars.githubusercontent.com/u/4483885?v=3","gravatar_id":"","url":"https://api.github.com/users/allixender","html_url":"https://github.com/allixender","followers_url":"https://api.github.com/users/allixender/followers","following_url":"https://api.github.com/users/allixender/following{/other_user}","gists_url":"https://api.github.com/users/allixender/gists{/gist_id}","starred_url":"https://api.github.com/users/allixender/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/allixender/subscriptions","organizations_url":"https://api.github.com/users/allixender/orgs","repos_url":"https://api.github.com/users/allixender/repos","events_url":"https://api.github.com/users/allixender/events{/privacy}","received_events_url":"https://api.github.com/users/allixender/received_events","type":"User","site_admin":false},"repo":{"id":36781026,"name":"geotrellis","full_name":"allixender/geotrellis","owner":{"login":"allixender","id":4483885,"avatar_url":"https://avatars.githubusercontent.com/u/4483885?v=3","gravatar_id":"","url":"https://api.github.com/users/allixender","html_url":"https://github.com/allixender","followers_url":"https://api.github.com/users/allixender/followers","following_url":"https://api.github.com/users/allixender/following{/other_user}","gists_url":"https://api.github.com/users/allixender/gists{/gist_id}","starred_url":"https://api.github.com/users/allixender/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/allixender/subscriptions","organizations_url":"https://api.github.com/users/allixender/orgs","repos_url":"https://api.github.com/users/allixender/repos","events_url":"https://api.github.com/users/allixender/events{/privacy}","received_events_url":"https://api.github.com/users/allixender/received_events","type":"User","site_admin":false},"private":false,"html_url":"https://github.com/allixender/geotrellis","description":"GeoTrellis is a geographic data processing engine for high performance applications.","fork":true,"url":"https://api.github.com/repos/allixender/geotrellis","forks_url":"https://api.github.com/repos/allixender/geotrellis/forks","keys_url":"https://api.github.com/repos/allixender/geotrellis/keys{/key_id}","collaborators_url":"https://api.github.com/repos/allixender/geotrellis/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/allixender/geotrellis/teams","hooks_url":"https://api.github.com/repos/allixender/geotrellis/hooks","issue_events_url":"https://api.github.com/repos/allixender/geotrellis/issues/events{/number}","events_url":"https://api.github.com/repos/allixender/geotrellis/events","assignees_url":"https://api.github.com/repos/allixender/geotrellis/assignees{/user}","branches_url":"https://api.github.com/repos/allixender/geotrellis/branches{/branch}","tags_url":"https://api.github.com/repos/allixender/geotrellis/tags","blobs_url":"https://api.github.com/repos/allixender/geotrellis/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/allixender/geotrellis/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/allixender/geotrellis/git/refs{/sha}","trees_url":"https://api.github.com/repos/allixender/geotrellis/git/trees{/sha}","statuses_url":"https://api.github.com/repos/allixender/geotrellis/statuses/{sha}","languages_url":"https://api.github.com/repos/allixender/geotrellis/languages","stargazers_url":"https://api.github.com/repos/allixender/geotrellis/stargazers","contributors_url":"https://api.github.com/repos/allixender/geotrellis/contributors","subscribers_url":"https://api.github.com/repos/allixender/geotrellis/subscribers","subscription_url":"https://api.github.com/repos/allixender/geotrellis/subscription","commits_url":"https://api.github.com/repos/allixender/geotrellis/commits{/sha}","git_commits_url":"https://api.github.com/repos/allixender/geotrellis/git/commits{/sha}","comments_url":"https://api.github.com/repos/allixender/geotrellis/comments{/number}","issue_comment_url":"https://api.github.com/repos/allixender/geotrellis/issues/comments{/number}","contents_url":"https://api.github.com/repos/allixender/geotrellis/contents/{+path}","compare_url":"https://api.github.com/repos/allixender/geotrellis/compare/{base}...{head}","merges_url":"https://api.github.com/repos/allixender/geotrellis/merges","archive_url":"https://api.github.com/repos/allixender/geotrellis/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/allixender/geotrellis/downloads","issues_url":"https://api.github.com/repos/allixender/geotrellis/issues{/number}","pulls_url":"https://api.github.com/repos/allixender/geotrellis/pulls{/number}","milestones_url":"https://api.github.com/repos/allixender/geotrellis/milestones{/number}","notifications_url":"https://api.github.com/repos/allixender/geotrellis/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/allixender/geotrellis/labels{/name}","releases_url":"https://api.github.com/repos/allixender/geotrellis/releases{/id}","created_at":"2015-06-03T05:01:09Z","updated_at":"2015-06-03T05:01:24Z","pushed_at":"2015-06-09T01:49:53Z","git_url":"git://github.com/allixender/geotrellis.git","ssh_url":"git@github.com:allixender/geotrellis.git","clone_url":"https://github.com/allixender/geotrellis.git","svn_url":"https://github.com/allixender/geotrellis","homepage":"http://geotrellis.io","size":195653,"stargazers_count":0,"watchers_count":0,"language":"Scala","has_issues":false,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":0,"mirror_url":null,"open_issues_count":0,"forks":0,"open_issues":0,"watchers":0,"default_branch":"master"}},"base":{"label":"geotrellis:feature/cassandra","ref":"feature/cassandra","sha":"c7199f4032f7c42bb6aa4558e4fb9748260d6c43","user":{"login":"geotrellis","id":3129444,"avatar_url":"https://avatars.githubusercontent.com/u/3129444?v=3","gravatar_id":"","url":"https://api.github.com/users/geotrellis","html_url":"https://github.com/geotrellis","followers_url":"https://api.github.com/users/geotrellis/followers","following_url":"https://api.github.com/users/geotrellis/following{/other_user}","gists_url":"https://api.github.com/users/geotrellis/gists{/gist_id}","starred_url":"https://api.github.com/users/geotrellis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/geotrellis/subscriptions","organizations_url":"https://api.github.com/users/geotrellis/orgs","repos_url":"https://api.github.com/users/geotrellis/repos","events_url":"https://api.github.com/users/geotrellis/events{/privacy}","received_events_url":"https://api.github.com/users/geotrellis/received_events","type":"Organization","site_admin":false},"repo":{"id":3040675,"name":"geotrellis","full_name":"geotrellis/geotrellis","owner":{"login":"geotrellis","id":3129444,"avatar_url":"https://avatars.githubusercontent.com/u/3129444?v=3","gravatar_id":"","url":"https://api.github.com/users/geotrellis","html_url":"https://github.com/geotrellis","followers_url":"https://api.github.com/users/geotrellis/followers","following_url":"https://api.github.com/users/geotrellis/following{/other_user}","gists_url":"https://api.github.com/users/geotrellis/gists{/gist_id}","starred_url":"https://api.github.com/users/geotrellis/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/geotrellis/subscriptions","organizations_url":"https://api.github.com/users/geotrellis/orgs","repos_url":"https://api.github.com/users/geotrellis/repos","events_url":"https://api.github.com/users/geotrellis/events{/privacy}","received_events_url":"https://api.github.com/users/geotrellis/received_events","type":"Organization","site_admin":false},"private":false,"html_url":"https://github.com/geotrellis/geotrellis","description":"GeoTrellis is a geographic data processing engine for high performance applications.","fork":false,"url":"https://api.github.com/repos/geotrellis/geotrellis","forks_url":"https://api.github.com/repos/geotrellis/geotrellis/forks","keys_url":"https://api.github.com/repos/geotrellis/geotrellis/keys{/key_id}","collaborators_url":"https://api.github.com/repos/geotrellis/geotrellis/collaborators{/collaborator}","teams_url":"https://api.github.com/repos/geotrellis/geotrellis/teams","hooks_url":"https://api.github.com/repos/geotrellis/geotrellis/hooks","issue_events_url":"https://api.github.com/repos/geotrellis/geotrellis/issues/events{/number}","events_url":"https://api.github.com/repos/geotrellis/geotrellis/events","assignees_url":"https://api.github.com/repos/geotrellis/geotrellis/assignees{/user}","branches_url":"https://api.github.com/repos/geotrellis/geotrellis/branches{/branch}","tags_url":"https://api.github.com/repos/geotrellis/geotrellis/tags","blobs_url":"https://api.github.com/repos/geotrellis/geotrellis/git/blobs{/sha}","git_tags_url":"https://api.github.com/repos/geotrellis/geotrellis/git/tags{/sha}","git_refs_url":"https://api.github.com/repos/geotrellis/geotrellis/git/refs{/sha}","trees_url":"https://api.github.com/repos/geotrellis/geotrellis/git/trees{/sha}","statuses_url":"https://api.github.com/repos/geotrellis/geotrellis/statuses/{sha}","languages_url":"https://api.github.com/repos/geotrellis/geotrellis/languages","stargazers_url":"https://api.github.com/repos/geotrellis/geotrellis/stargazers","contributors_url":"https://api.github.com/repos/geotrellis/geotrellis/contributors","subscribers_url":"https://api.github.com/repos/geotrellis/geotrellis/subscribers","subscription_url":"https://api.github.com/repos/geotrellis/geotrellis/subscription","commits_url":"https://api.github.com/repos/geotrellis/geotrellis/commits{/sha}","git_commits_url":"https://api.github.com/repos/geotrellis/geotrellis/git/commits{/sha}","comments_url":"https://api.github.com/repos/geotrellis/geotrellis/comments{/number}","issue_comment_url":"https://api.github.com/repos/geotrellis/geotrellis/issues/comments{/number}","contents_url":"https://api.github.com/repos/geotrellis/geotrellis/contents/{+path}","compare_url":"https://api.github.com/repos/geotrellis/geotrellis/compare/{base}...{head}","merges_url":"https://api.github.com/repos/geotrellis/geotrellis/merges","archive_url":"https://api.github.com/repos/geotrellis/geotrellis/{archive_format}{/ref}","downloads_url":"https://api.github.com/repos/geotrellis/geotrellis/downloads","issues_url":"https://api.github.com/repos/geotrellis/geotrellis/issues{/number}","pulls_url":"https://api.github.com/repos/geotrellis/geotrellis/pulls{/number}","milestones_url":"https://api.github.com/repos/geotrellis/geotrellis/milestones{/number}","notifications_url":"https://api.github.com/repos/geotrellis/geotrellis/notifications{?since,all,participating}","labels_url":"https://api.github.com/repos/geotrellis/geotrellis/labels{/name}","releases_url":"https://api.github.com/repos/geotrellis/geotrellis/releases{/id}","created_at":"2011-12-23T14:56:54Z","updated_at":"2015-06-02T13:24:27Z","pushed_at":"2015-06-09T01:53:59Z","git_url":"git://github.com/geotrellis/geotrellis.git","ssh_url":"git@github.com:geotrellis/geotrellis.git","clone_url":"https://github.com/geotrellis/geotrellis.git","svn_url":"https://github.com/geotrellis/geotrellis","homepage":"http://geotrellis.io","size":243277,"stargazers_count":316,"watchers_count":316,"language":"Scala","has_issues":true,"has_downloads":true,"has_wiki":true,"has_pages":true,"forks_count":84,"mirror_url":null,"open_issues_count":77,"forks":84,"open_issues":77,"watchers":316,"default_branch":"master"}},"_links":{"self":{"href":"https://api.github.com/repos/geotrellis/geotrellis/pulls/1107"},"html":{"href":"https://github.com/geotrellis/geotrellis/pull/1107"},"issue":{"href":"https://api.github.com/repos/geotrellis/geotrellis/issues/1107"},"comments":{"href":"https://api.github.com/repos/geotrellis/geotrellis/issues/1107/comments"},"review_comments":{"href":"https://api.github.com/repos/geotrellis/geotrellis/pulls/1107/comments"},"review_comment":{"href":"https://api.github.com/repos/geotrellis/geotrellis/pulls/comments{/number}"},"commits":{"href":"https://api.github.com/repos/geotrellis/geotrellis/pulls/1107/commits"},"statuses":{"href":"https://api.github.com/repos/geotrellis/geotrellis/statuses/9c4ef7f4cea786004035faf315a9e4319ab0cd0b"}}}}