Skip to content

Commit

Permalink
Some tests.
Browse files Browse the repository at this point in the history
  • Loading branch information
dboissin authored and Damien BOISSIN committed Jul 27, 2011
1 parent 8f2fd80 commit 76f5ff2
Showing 1 changed file with 30 additions and 3 deletions.
33 changes: 30 additions & 3 deletions src/main/scala/poc/schema/BootStrap.scala
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import org.squeryl.PrimitiveTypeMode._
import poc.model.Cashier
import poc.model.Timetable
import java.sql.Timestamp
import poc.model.WorkingTimeRange

object BootStrap {

Expand All @@ -26,10 +27,36 @@ object BootStrap {
create
printDdl

cashiers.insert(new Cashier("Blip"))
cashiers.insert(new Cashier("Blop"))
val t = new Timetable(new Timestamp(System.currentTimeMillis), 1L)
val t2 = new Timetable(new Timestamp(System.currentTimeMillis+500000), 1L)
val blip = new Cashier("Blip")
cashiers.insert(blip)
println("blipId : " + blip.id)
blip.timetables.associate(t)
blip.timetables.associate(t2)

timetables.insert(new Timetable(new Timestamp(System.currentTimeMillis), 1L))
val c = cashiers.lookup(1L)
val titi = c.get.timetables.foldLeft(">>> ")((tmp, res) => tmp + res.id + ", " )
println (titi)

val blop = new Cashier("Blop")
println ("before insert => blopId : " + blop.id)
cashiers.insert(blop)
println ("after insert => blopId : " + blop.id)


val wtr = new WorkingTimeRange(new Timestamp(System.currentTimeMillis), new Timestamp(System.currentTimeMillis + 60000))
workingTimeRanges.insert(wtr)

//timetables.insert(t)
val t3 = timetables.where(t => t.id === 2L).single

t3.workingTimeRanges.associate(wtr)
t3.workingTimeRanges.dissociateAll
t3.workingTimeRanges.associate(wtr)
// schedules.associate(t, wtr)

//timetables.insert(new Timetable(new Timestamp(System.currentTimeMillis), 1L))
val queried = cashiers.where(cashier => cashier.id === 2L).single
println(queried.id + " -- " + queried.name)

Expand Down

0 comments on commit 76f5ff2

Please sign in to comment.