Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #4 from kwark/slick-3.2.0
Slick 3.2.0
- Loading branch information
Showing
18 changed files
with
155 additions
and
45 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,6 +1,7 @@ | ||
language: scala | ||
scala: | ||
- 2.11.8 | ||
- 2.12.1 | ||
script: sbt clean +test | ||
sudo: false | ||
jdk: | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 0 additions & 12 deletions
12
modules/akka-persistence-pg/src/main/scala/akka/persistence/pg/PgPostgresDriver.scala
This file was deleted.
Oops, something went wrong.
12 changes: 12 additions & 0 deletions
12
modules/akka-persistence-pg/src/main/scala/akka/persistence/pg/PgPostgresProfile.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
package akka.persistence.pg | ||
|
||
import slick.jdbc.PostgresProfile | ||
|
||
trait PgPostgresProfile extends PostgresProfile with AkkaPgJdbcTypes { | ||
|
||
override val api = new API with AkkaPgImplicits {} | ||
|
||
} | ||
|
||
class PgPostgresProfileImpl(override val pgjson: String) extends PgPostgresProfile | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
modules/akka-persistence-pg/src/test/resources/pg-persist-jndi.conf
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
include "pg-writestrategy-base.conf" | ||
pg-persistence { | ||
db { | ||
jndiName = "MyDS" | ||
maxConnections = 4 | ||
numThreads = 4 | ||
queueSize = 1000 | ||
} | ||
writestrategy = "akka.persistence.pg.journal.RowIdUpdatingStrategy" | ||
} | ||
|
||
|
82 changes: 82 additions & 0 deletions
82
modules/akka-persistence-pg/src/test/scala/akka/persistence/pg/PersistUsingJndiTest.scala
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,82 @@ | ||
package akka.persistence.pg | ||
|
||
import java.util.concurrent.TimeUnit | ||
import javax.naming.{Context, InitialContext} | ||
|
||
import akka.actor._ | ||
import akka.persistence.pg.TestActor.{Alter, GetState, TheState} | ||
import akka.persistence.pg.journal.JournalTable | ||
import akka.persistence.pg.util.{CreateTables, RecreateSchema} | ||
import akka.testkit.TestProbe | ||
import akka.util.Timeout | ||
import com.typesafe.config.{Config, ConfigFactory} | ||
import org.postgresql.ds.PGSimpleDataSource | ||
import org.scalatest._ | ||
import org.scalatest.concurrent.ScalaFutures | ||
import org.scalatest.time.{Milliseconds, Seconds, Span} | ||
|
||
import scala.language.postfixOps | ||
|
||
class PersistUsingJndiTest extends FunSuite | ||
with Matchers | ||
with BeforeAndAfterAll | ||
with JournalTable | ||
with CreateTables | ||
with RecreateSchema | ||
with PgConfig | ||
with WaitForEvents | ||
with ScalaFutures | ||
{ | ||
|
||
override implicit val patienceConfig = PatienceConfig(timeout = Span(3, Seconds), interval = Span(100, Milliseconds)) | ||
|
||
val config: Config = ConfigFactory.load("pg-persist-jndi.conf") | ||
implicit val system = ActorSystem("TestCluster", config) | ||
override lazy val pluginConfig: PluginConfig = PgExtension(system).pluginConfig | ||
|
||
import driver.api._ | ||
|
||
val testProbe = TestProbe() | ||
implicit val timeOut = Timeout(1, TimeUnit.MINUTES) | ||
|
||
test("generate events") { | ||
val test = system.actorOf(Props(new TestActor(testProbe.ref))) | ||
|
||
testProbe.send(test, Alter("foo")) | ||
testProbe.expectMsg("j") | ||
testProbe.send(test, GetState) | ||
testProbe.expectMsg(TheState(id = "foo")) | ||
|
||
testProbe.send(test, Alter("bar")) | ||
testProbe.expectMsg("j") | ||
testProbe.send(test, GetState) | ||
testProbe.expectMsg(TheState(id = "bar")) | ||
|
||
database.run(journals.size.result).futureValue shouldBe 2 | ||
} | ||
|
||
override def beforeAll() { | ||
System.setProperty(Context.INITIAL_CONTEXT_FACTORY, "tyrex.naming.MemoryContextFactory") | ||
System.setProperty(Context.PROVIDER_URL, "/") | ||
|
||
val simpleDataSource = new PGSimpleDataSource() | ||
simpleDataSource.setUrl(pluginConfig.dbConfig.getString("url")) | ||
simpleDataSource.setUser(pluginConfig.dbConfig.getString("user")) | ||
simpleDataSource.setPassword(pluginConfig.dbConfig.getString("password")) | ||
simpleDataSource.setPrepareThreshold(1) | ||
|
||
new InitialContext().rebind("MyDS", simpleDataSource) | ||
|
||
database.run(recreateSchema.andThen(createTables)).futureValue | ||
} | ||
|
||
override protected def afterAll(): Unit = { | ||
system.terminate() | ||
system.whenTerminated.futureValue | ||
() | ||
} | ||
|
||
|
||
} | ||
|
||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.