0

phantom-dslこのチュートリアルに従って、単体テストに使用してcassandraにスキーマを作成しようとしています:

http://outworkers.com/blog/post/phantom-tips-3-understanding-phantom-connectors

スキーマを自動生成しようとしたときに、この問題に遭遇しました

[ERROR] /home/.../test/BaseCassandraSpec.scala:54: error: not enough arguments for method autocreate: (keySpace: com.websudos.phantom.connectors.KeySpace)
com.websudos.phantom.builder.query.CreateQuery.Default[com.neruti.db.models.ConcreteUserModel,com.neruti.User].
[ERROR] Unspecified value parameter keySpace.
[ERROR] Await.result(database.userModel.autocreate().future(),10.seconds)

何かアドバイス?

現在使用中のバージョン1.29.6

BaseCassandraSpec

import com.neruti.User
import com.neruti.db.models._
import com.neruti.db.databases._
import com.neruti.db.services._
import com.neruti.db.Connector._    
import org.scalatest._
import org.scalatest.{BeforeAndAfterAll,FlatSpec,Matchers,ShouldMatchers}
import org.scalatest.concurrent.ScalaFutures
import org.scalamock.scalatest.MockFactory
import scala.concurrent.duration._
import scala.concurrent.{Await, Future}
import scala.concurrent.ExecutionContext.Implicits.global

 override protected def beforeAll(): Unit = {
    Await.result(database.userModel.autocreate().future(),10.seconds)
   } 

データベース

class UserDatabase (val connector: KeySpaceDef){
  object userModel extends ConcreteUserModel with connector.Connector
}

object ProductionDb extends UserDatabase(connector)

trait ProductionDatabaseProvider {
  def database: UserDatabase
}

trait ProductionDatabase extends ProductionDatabaseProvider {
  override val database = ProductionDb
}

object testDB extends UserDatabase(testConnector)

trait testDatabaseProvider {
  def database: UserDatabase
}

trait testDatabase extends testDatabaseProvider{
  override val database = testDB
}

コネクタ

package com.neruti.db

import com.neruti.db.models._

import com.websudos.phantom.database.Database
import com.websudos.phantom.connectors.ContactPoints
import com.websudos.phantom.dsl.KeySpaceDef

object Connector {



    // TODO: these key value pairs shld get from HOCON config file
      val host= Seq("127.0.0.1")
      val port = 9042
      val keySpace: String = "nrt_entities"
      //  val inet = InetAddress.getByName

      lazy val connector = ContactPoints(host,port).withClusterBuilder(
        _.withCredentials("dev", "nrtDev1989")
      ).keySpace(keySpace)

      //  embedded cassandra is not supported anymore.  Check phantom-sbt.
      //    lazy val testConnector: KeySpaceDef = ContactPoint.embedded.keySpace(keySpace)
      lazy val testConnector: KeySpaceDef = ContactPoints(host,port).noHeartbeat().keySpace(keySpace)
    }
4

1 に答える 1