Permalink
Browse files

Merge branch 'topic/sbt_upgrade'

Conflicts:
	project/build.properties
	project/build/ScalaJPA.scala
  • Loading branch information...
2 parents 9a3ca27 + 97db4dc commit e4e0c2f7c4e35ef52d4177a4ab36492e301ce165 @dchenbecker committed Apr 22, 2014
View
@@ -14,3 +14,5 @@ project/plugins/src_managed
*.ipr
*.iws
.idea/
+/z_local.sbt
+/TAGS
View
@@ -0,0 +1,106 @@
+import sbt._
+import Keys._
+import com.typesafe.sbt.pgp.PgpKeys._
+
+object ScalaJPABuild extends Build {
+ val fullSettings: Seq[Project.Setting[_]] = Seq(
+ name := "ScalaJPA",
+
+ organization := "org.scala-libs",
+
+ version := "1.5",
+
+ description := "This module provides some basic classes to simplify using JPA (Java Persistence) under Scala.",
+
+ crossScalaVersions := Seq("2.9.0", "2.9.0-1", "2.9.1", "2.9.2", "2.10.0", "2.11.0"),
+
+ // Only for RC releases
+ //scalaBinaryVersion <<= scalaVersion,
+
+ resolvers ++= Seq(
+ "Sonatype Release" at "https://oss.sonatype.org/content/repositories/releases/",
+ "Sonatype Snapshots" at "https://oss.sonatype.org/content/repositories/snapshots/",
+ "Jboss Public Repository" at "http://repository.jboss.org/nexus/content/groups/public-jboss/",
+ "Typesafe Repository" at "http://repo.typesafe.com/typesafe/releases/",
+ "Maven Repo 1" at "http://repo1.maven.org/maven2/",
+ "Guiceyfruit" at "http://guiceyfruit.googlecode.com/svn/repo/releases/",
+ "sbt-plugin-releases" at "http://scalasbt.artifactoryonline.com/scalasbt/sbt-plugin-releases/"
+ ),
+
+ libraryDependencies <++= (scalaVersion) { sv => {
+ val specsVersion = sv match {
+ case "2.9.0" => "1.5"
+ case "2.9.0-1" => "1.8.2"
+ case "2.10.0" => "1.13"
+ case "2.11.0" => "2.3.11"
+ case _ => "1.12.3"
+ }
+
+ Seq(
+ "javax.persistence" % "persistence-api" % "1.0" % "provided",
+ "geronimo-spec" % "geronimo-spec-jta" % "1.0-M1" % "provided",
+ "com.h2database" % "h2" % "1.3.152" % "test",
+ "org.hibernate" % "hibernate-entitymanager" % "3.4.0.GA" % "test",
+ "org.specs2" %% "specs2" % specsVersion % "test",
+ "ch.qos.logback" % "logback-classic" % "0.9.27" % "test"
+ )
+ }},
+
+ publishMavenStyle := true,
+
+ pomIncludeRepository := { _ => false },
+
+ publishTo <<= version { (v: String) =>
+ val nexus = "https://oss.sonatype.org/"
+ if (v.trim.endsWith("SNAPSHOT"))
+ Some("snapshots" at nexus + "content/repositories/snapshots")
+ else
+ Some("releases" at nexus + "service/local/staging/deploy/maven2")
+ },
+
+ credentials += Credentials(Path.userHome / ".ivy2" / "sonatype.credentials"),
+
+ publishArtifact in Test := false,
+
+ pomExtra :=
+ <xml:group>
+ <inceptionYear>2008</inceptionYear>
+
+ <url>https://github.com/dchenbecker/scalajpa</url>
+
+ <licenses>
+ <license>
+ <name>Apache License, ASL Version 2.0</name>
+ <url>http://www.apache.org/licenses/LICENSE-2.0</url>
+ <distribution>repo</distribution>
+ </license>
+ </licenses>
+
+ <developers>
+ <developer>
+ <id>dchenbecker</id>
+ <name>Derek Chen-Becker</name>
+ <timezone>-7</timezone>
+ <email>java [at] chen-becker.org</email>
+ <roles>
+ <role>BDFL</role>
+ </roles>
+ </developer>
+ </developers>
+
+ <issueManagement>
+ <system>GitHub</system>
+ <url>http://github.com/dchenbecker/scalajpa/issues</url>
+ </issueManagement>
+
+ <scm>
+ <connection>scm:git:git@github.com:dchenbecker/scalajpa.git</connection>
+ <url>http://github.com/dchenbecker/scalajpa/tree/master</url>
+ </scm>
+
+ </xml:group>
+
+ )
+
+ val scalajpa = Project(id = "ScalaJPA", base = file("."), settings = (Project.defaultSettings ++ fullSettings))
+}
View
@@ -1,8 +1 @@
-#Project properties
-#Fri Aug 13 15:25:13 MDT 2010
-project.organization=org.scala-libs
-project.name=ScalaJPA
-sbt.version=0.7.5
-project.version=2.0-SNAPSHOT
-build.scala.versions=2.8.0 2.8.1 2.9.0
-project.initialize=false
+sbt.version=0.13.2
@@ -1,101 +0,0 @@
-import sbt._
-
-class ScalaJPAProject(info : ProjectInfo) extends DefaultProject(info) with IdeaProject {
- // Repositories
- val jbossRepo = "Jboss Public Repository" at "http://repository.jboss.org/nexus/content/groups/public-jboss/"
- val scalaToolsSnapshots = "Scala Tools Nexus Snapshot" at "http://nexus.scala-tools.org/content/repositories/snapshots/"
- val scalaToolsReleases = "Scala Tools Nexus" at "http://nexus.scala-tools.org/content/repositories/releases/"
-
- // From Lift (thanks, Indrajit!)
- // Add all the Scala version specific variations here
- lazy val (scalazVersion, specsVersion, scalacheckVersion) = buildScalaVersion match {
- case "2.8.0" => ("5.0", "1.6.5", "1.7")
- case "2.8.1" => ("5.0", "1.6.7.2", "1.8")
- case _ => ("5.0", "1.6.8", "1.8")
- }
-
- // Dependencies
- val jpa = "javax.persistence" % "persistence-api" % "1.0" % "provided"
- val jta = "geronimo-spec" % "geronimo-spec-jta" % "1.0-M1" % "provided"
- val h2 = "com.h2database" % "h2" % "1.3.152" % "test"
- val hibernate = "org.hibernate" % "hibernate-entitymanager" % "3.4.0.GA" % "test"
- val specs = "org.scala-tools.testing" %% "specs" % specsVersion % "test"
- val logback = "ch.qos.logback" % "logback-classic" % "0.9.27" % "test"
-
- override def managedStyle = ManagedStyle.Maven
- val publishTo = scalaToolsSnapshots
- //val publishTo = scalaToolsReleases
-
- Credentials(Path.userHome / ".ivy2" / ".credentials", log)
-
- // The following extra settings were copied from the ScalaCheck project definition at
- // http://code.google.com/p/scalacheck/source/browse/tags/1.7/project/build/ScalaCheckProject.scala?r=495
-
- override def packageDocsJar = defaultJarPath("-javadoc.jar")
- override def packageSrcJar= defaultJarPath("-sources.jar")
-
- override def packageToPublishActions = super.packageToPublishActions ++ Seq(packageDocs, packageSrc)
-
- override def deliverScalaDependencies = Nil
-
- override def documentOptions = Nil
-
- val sourceArtifact = Artifact(artifactID, "src", "jar", Some("sources"), Nil, None)
- val docsArtifact = Artifact(artifactID, "docs", "jar", Some("javadoc"), Nil, None)
-
-
- // Insert extra info into the generated POM
- override def pomExtra =
- <xml:group>
- <inceptionYear>2008</inceptionYear>
- <name>Scala JPA Utility Framework</name>
-
- <description>
- This module provides some basic classes to simplify using JPA (Java
- Persistence) under Scala.
- </description>
-
- <url>http://scala-tools.org/mvnsites/scalajpa</url>
-
- <organization>
- <name>scala-tools.org</name>
- <url>http://scala-tools.org/mvnsites/scalajpa/</url>
- </organization>
-
- <licenses>
- <license>
- <name>Apache License, ASL Version 2.0</name>
- <url>http://www.apache.org/licenses/LICENSE-2.0</url>
- <distribution>repo</distribution>
- </license>
- </licenses>
-
- <developers>
- <developer>
- <id>dchenbecker</id>
- <name>Derek Chen-Becker</name>
- <timezone>-7</timezone>
- <email>java [at] chen-becker.org</email>
- <roles>
- <role>BDFL</role>
- </roles>
- </developer>
- </developers>
-
- <ciManagement>
- <system>hudson</system>
- <url>http://hudson.scala-tools.org/job/scalajpa/</url>
- </ciManagement>
-
- <issueManagement>
- <system>GitHub</system>
- <url>http://github.com/dchenbecker/scalajpa/issues</url>
- </issueManagement>
-
- <scm>
- <connection>scm:git://github.com/dchenbecker/scalajpa.git</connection>
- <url>http://github.com/dchenbecker/scalajpa/tree/master</url>
- </scm>
-
- </xml:group>
-}
View
@@ -0,0 +1 @@
+addSbtPlugin("com.typesafe.sbt" % "sbt-pgp" % "0.8.3")
@@ -1,6 +0,0 @@
-import sbt._
-class Plugins(info: ProjectInfo) extends PluginDefinition(info) {
- val sbtIdeaRepo = "sbt-idea-repo" at "http://mpeltonen.github.com/maven/"
- val sbtIdea = "com.github.mpeltonen" % "sbt-idea-plugin" % "0.4.0"
-}
-
@@ -16,7 +16,7 @@
package org.scala_libs.jpa
import javax.persistence._
-import scala.collection.JavaConversions
+import scala.collection.JavaConverters._
import java.util.{Date,Calendar}
/**
@@ -56,7 +56,7 @@ class ScalaQuery[A](val query: Query) {
/**
* Returns the results of the query as a Seq[A]
*/
- def getResultList() = JavaConversions.asBuffer[A](query.getResultList.asInstanceOf[java.util.List[A]])
+ def getResultList() = query.getResultList.asInstanceOf[java.util.List[A]].asScala
/**
* Returns a single result of the query as an Option. If more than one
@@ -17,7 +17,7 @@
package org.scala_libs.jpa
package test
-import org.specs.Specification
+import org.specs2.mutable.Specification
/**
* A simple EM defined in our test/resources
@@ -26,20 +26,18 @@ object ThreadEM extends LocalEMF("test") with ThreadLocalEM
class ScalaJPASpecs extends Specification {
"The 'test' LocalEMF instance" should {
- shareVariables()
-
+ sequential
val myInstance = new MyItem
myInstance.id = 42
myInstance.name = "Fred"
myInstance.description = "Some guy"
-
"Persist a new instance" in {
- ThreadEM.contains(myInstance) mustBe false
+ ThreadEM.contains(myInstance) mustEqual false
ThreadEM.persistAndFlush(myInstance)
- ThreadEM.contains(myInstance) mustBe true
+ ThreadEM.contains(myInstance) mustEqual true
}
"Retrieve an instance using a raw query" in {
@@ -57,11 +55,11 @@ class ScalaJPASpecs extends Specification {
}
"Remove an instance" in {
- ThreadEM.contains(myInstance) mustBe true
+ ThreadEM.contains(myInstance) mustEqual true
ThreadEM.removeAndFlush(myInstance)
- ThreadEM.contains(myInstance) mustBe false
+ ThreadEM.contains(myInstance) mustEqual false
}
}
-}
+}

0 comments on commit e4e0c2f

Please sign in to comment.