Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

minor

  • Loading branch information...
commit 5e216b1c8950ba72492ef74c9922618cddeff15b 1 parent 866391c
@fwbrasil authored
View
4 activate-tests/src/test/scala/net/fwbrasil/activate/ActivateTest.scala
@@ -38,7 +38,7 @@ trait ActivateTest extends SpecificationWithJUnit with Serializable {
mysqlContext,
h2Context,
derbyContext,
- hsqldbContext // oracleContext
+ hsqldbContext //oracleContext
)
ret.foreach(_.stop)
ret
@@ -136,7 +136,7 @@ trait ActivateTest extends SpecificationWithJUnit with Serializable {
def activateTest[A](f: (StepExecutor) => A) = runningFlag.synchronized {
for (ctx <- contexts) {
import ctx._
- ActivateContext.clearContextCache
+ ActivateContext.contextCache.clear
start
runMigration
def clear = transactional {
View
164 activate-tests/src/test/scala/net/fwbrasil/activate/coordinator/MultiVMSpecs.scala
@@ -1,82 +1,82 @@
-package net.fwbrasil.activate.coordinator
-
-import net.fwbrasil.activate.storage.relational.PooledJdbcRelationalStorage
-import net.fwbrasil.activate.storage.relational.idiom.postgresqlDialect
-import net.fwbrasil.activate.ActivateContext
-import net.fwbrasil.activate.migration.Migration
-
-object coordinatorTestContext extends ActivateContext {
- val storage = new PooledJdbcRelationalStorage {
- val jdbcDriver = "org.postgresql.Driver"
- val user = "postgres"
- val password = ""
- val url = "jdbc:postgresql://127.0.0.1/activate_test"
- val dialect = postgresqlDialect
- }
-}
-
-import coordinatorTestContext._
-
-class CreateTables extends Migration {
-
- val timestamp = 1l
-
- def up = {
- createTableForAllEntities.ifNotExists
- }
-}
-
-class SomeEntity(var integer: Int) extends Entity
-
-case class Runner(entityId: String, numOfVMs: Int, numOfThreads: Int, numOfTransactions: Int) {
- def run = {
- val tasks =
- for (i <- 0 until numOfVMs)
- yield fork(false)
- tasks.map(_.execute)
- tasks.map(_.join)
- }
- def fork(server: Boolean) = {
- val option =
- if (server)
- "-Dactivate.coordinator.server=true"
- else
- "-Dactivate.coordinator.serverHost=localhost"
- JvmFork.fork(128, 1024, Some(option)) {
- runThreads
- }
- }
- def runThreads = {
- val threads =
- for (i <- 0 until numOfThreads)
- yield new Thread {
- override def run =
- for (i <- 0 until numOfTransactions)
- transactional {
- byId[SomeEntity](entityId).get.integer += 1
- }
- }
- threads.map(_.start)
- threads.map(_.join)
- }
-}
-
-object Teste extends App {
-
- val numOfVMs = 2
- val numOfThreads = 2
- val numOfTransactions = 100
-
- val entityId =
- transactional {
- new SomeEntity(0).id
- }
-
- Runner(entityId, numOfVMs, numOfThreads, numOfTransactions).run
-
- val i = transactional {
- byId[SomeEntity](entityId).get.integer
- }
- println(i)
- require(i == numOfVMs * numOfThreads * numOfTransactions)
-}
+//package net.fwbrasil.activate.coordinator
+//
+//import net.fwbrasil.activate.storage.relational.PooledJdbcRelationalStorage
+//import net.fwbrasil.activate.storage.relational.idiom.postgresqlDialect
+//import net.fwbrasil.activate.ActivateContext
+//import net.fwbrasil.activate.migration.Migration
+//
+//object coordinatorTestContext extends ActivateContext {
+// val storage = new PooledJdbcRelationalStorage {
+// val jdbcDriver = "org.postgresql.Driver"
+// val user = "postgres"
+// val password = ""
+// val url = "jdbc:postgresql://127.0.0.1/activate_test"
+// val dialect = postgresqlDialect
+// }
+//}
+//
+//import coordinatorTestContext._
+//
+//class CreateTables extends Migration {
+//
+// val timestamp = 1l
+//
+// def up = {
+// createTableForAllEntities.ifNotExists
+// }
+//}
+//
+//class SomeEntity(var integer: Int) extends Entity
+//
+//case class Runner(entityId: String, numOfVMs: Int, numOfThreads: Int, numOfTransactions: Int) {
+// def run = {
+// val tasks =
+// for (i <- 0 until numOfVMs)
+// yield fork(false)
+// tasks.map(_.execute)
+// tasks.map(_.join)
+// }
+// def fork(server: Boolean) = {
+// val option =
+// if (server)
+// "-Dactivate.coordinator.server=true"
+// else
+// "-Dactivate.coordinator.serverHost=localhost"
+// JvmFork.fork(128, 1024, Some(option)) {
+// runThreads
+// }
+// }
+// def runThreads = {
+// val threads =
+// for (i <- 0 until numOfThreads)
+// yield new Thread {
+// override def run =
+// for (i <- 0 until numOfTransactions)
+// transactional {
+// byId[SomeEntity](entityId).get.integer += 1
+// }
+// }
+// threads.map(_.start)
+// threads.map(_.join)
+// }
+//}
+//
+//object Teste extends App {
+//
+// val numOfVMs = 2
+// val numOfThreads = 2
+// val numOfTransactions = 100
+//
+// val entityId =
+// transactional {
+// new SomeEntity(0).id
+// }
+//
+// Runner(entityId, numOfVMs, numOfThreads, numOfTransactions).run
+//
+// val i = transactional {
+// byId[SomeEntity](entityId).get.integer
+// }
+// println(i)
+// require(i == numOfVMs * numOfThreads * numOfTransactions)
+//}
View
4 activate-tests/src/test/scala/net/fwbrasil/activate/migration/MigrationTest.scala
@@ -40,9 +40,7 @@ class MigrationTest extends ActivateTest {
}
if (ctx.storage.isInstanceOf[PooledJdbcRelationalStorage])
ctx.storage.asInstanceOf[PooledJdbcRelationalStorage].dataSource.hardReset
- ActivateContext.clearContextCache
- Migration.migrationsCache.clear
- Migration.storageVersionCache.clear
+ ActivateContext.clearContextCaches
}
clear
Please sign in to comment.
Something went wrong with that request. Please try again.