Skip to content

Instantly share code, notes, and snippets.

@fwbrasil
Created September 4, 2012 12:23
Show Gist options
  • Save fwbrasil/3620725 to your computer and use it in GitHub Desktop.
Save fwbrasil/3620725 to your computer and use it in GitHub Desktop.
Nolan test...
09:15:54.571 [main] INFO nolan.MongoContext$ - Initializing context mongoContext
09:15:54.716 [main] DEBUG org.reflections.Reflections - going to scan these urls:
file:/Users/fwbrasil/workspace/activate/activate-core/target/scala-2.9.1/classes/
file:/Users/fwbrasil/workspace/activate/activate-tests/target/scala-2.9.1/test-classes/
09:15:55.772 [main] INFO org.reflections.Reflections - Reflections took 1051 ms to scan 2 urls, producing 121 keys and 6589 values
09:15:56.415 [main] INFO n.f.activate.cache.live.LiveCache - Initializing live cache for context mongoContext
09:15:57.820 [main] DEBUG org.reflections.Reflections - going to scan these urls:
file:/Users/fwbrasil/workspace/activate/activate-core/target/scala-2.9.1/classes/
file:/Users/fwbrasil/workspace/activate/activate-tests/target/scala-2.9.1/test-classes/
09:15:58.065 [main] INFO org.reflections.Reflections - Reflections took 245 ms to scan 2 urls, producing 37 keys and 758 values
Running
fwbrasil$ mongo
MongoDB shell version: 2.0.2
connecting to: test
> use nolan
switched to db nolan
> show collections
Person
StorageVersion
system.indexes
> db.Person.find()
{ "_id" : "327fd216-f68b-11e1-93c4-cdd76b9d4fa5-8e488775", "name" : "Nolan" }
>
package nolan
import net.fwbrasil.activate.ActivateContext
import net.fwbrasil.activate.migration.Migration
import net.fwbrasil.activate.storage.mongo.MongoStorage
object MongoContext extends ActivateContext {
def contextName = "mongoContext"
val storage = new MongoStorage {
override val authentication = Option(("activate_test", "activate_test"))
override val host = "localhost"
override val port = 27017
override val db = "nolan"
}
}
import MongoContext._
class Person(var name: String) extends Entity
class PersonMigration extends Migration {
val timestamp = 201209032130l
val name = "Migration"
val developers = List("nolan")
def up = {
println("Running")
table[Person].createTable(
_.column[String]("name"))
}
}
object Test extends App {
transactional {
val p = new Person("Nolan")
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment