Skip to content

Commit

Permalink
Merge d5edb0c into c4884b4
Browse files Browse the repository at this point in the history
  • Loading branch information
alexflav23 committed Jun 29, 2016
2 parents c4884b4 + d5edb0c commit 4021a0f
Show file tree
Hide file tree
Showing 90 changed files with 304 additions and 333 deletions.
99 changes: 39 additions & 60 deletions build.sbt
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ import net.virtualvoid.sbt.graph.Plugin.graphSettings

lazy val Versions = new {
val logback = "1.1.7"
val util = "0.16.0"
val util = "0.18.2"
val json4s = "3.3.0"
val datastax = "3.0.2"
val scalatest = "2.2.4"
Expand All @@ -49,13 +49,15 @@ lazy val Versions = new {
val scalameter = "0.6"
val spark = "1.2.0-alpha3"
val diesel = "0.3.0"
val scalacheck = "1.13.0"
val slf4j = "1.7.21"
val reactivestreams = "1.0.0"
val akka = "2.3.14"
val typesafeConfig = "1.2.1"
val jetty = "9.1.2.v20140210"
val dispatch = "0.11.0"
val cassandraUnit = "3.0.0.1"
val javaxServlet = "3.0.1"
}

val RunningUnderCi = Option(System.getenv("CI")).isDefined || Option(System.getenv("TRAVIS")).isDefined
Expand All @@ -64,7 +66,7 @@ val defaultConcurrency = 4

val liftVersion: String => String = {
s => CrossVersion.partialVersion(s) match {
case Some((major, minor)) if minor >= 11 => "3.0-M6"
case Some((major, minor)) if minor >= 11 => "3.0-RC3"
case _ => "3.0-M1"
}
}
Expand Down Expand Up @@ -121,14 +123,10 @@ val sharedSettings: Seq[Def.Setting[_]] = Defaults.coreDefaultSettings ++ Seq(
credentials ++= defaultCredentials,
crossScalaVersions := Seq("2.10.6", "2.11.8"),
resolvers ++= Seq(
"Typesafe repository snapshots" at "http://repo.typesafe.com/typesafe/snapshots/",
"Typesafe repository releases" at "http://repo.typesafe.com/typesafe/releases/",
"Sonatype repo" at "https://oss.sonatype.org/content/groups/scala-tools/",
"Sonatype releases" at "https://oss.sonatype.org/content/repositories/releases",
"Sonatype snapshots" at "https://oss.sonatype.org/content/repositories/snapshots",
"Sonatype staging" at "http://oss.sonatype.org/content/repositories/staging",
"Java.net Maven2 Repository" at "http://download.java.net/maven/2/",
"Twitter Repository" at "http://maven.twttr.com",
Resolver.typesafeRepo("releases"),
Resolver.sonatypeRepo("releases"),
Resolver.jcenterRepo,
Resolver.bintrayRepo("websudos", "oss-releases")
),
scalacOptions ++= Seq(
Expand All @@ -145,8 +143,8 @@ val sharedSettings: Seq[Def.Setting[_]] = Defaults.coreDefaultSettings ++ Seq(
),
logLevel in ThisBuild := Level.Info,
libraryDependencies ++= Seq(
"ch.qos.logback" % "logback-classic" % Versions.logback,
"org.slf4j" % "log4j-over-slf4j" % Versions.slf4j
"ch.qos.logback" % "logback-classic" % Versions.logback,
"org.slf4j" % "log4j-over-slf4j" % Versions.slf4j
) ++ scalaMacroDependencies(scalaVersion.value),
fork in Test := true,
javaOptions in ThisBuild ++= Seq(
Expand All @@ -167,8 +165,8 @@ val sharedSettings: Seq[Def.Setting[_]] = Defaults.coreDefaultSettings ++ Seq(
) ++ graphSettings ++
VersionManagement.newSettings ++
GitProject.gitSettings ++ {
println("Using Maven publishing.")
PublishTasks.mavenPublishingSettings
println("Using Bintray publishing.")
PublishTasks.bintrayPublishSettings
}


Expand All @@ -185,8 +183,7 @@ lazy val baseProjectList: Seq[ProjectReference] = Seq(
phantomConnectors,
phantomFinagle,
phantomReactiveStreams,
phantomThrift,
phantomZookeeper
phantomThrift
)

lazy val fullProjectList = baseProjectList ++
Expand Down Expand Up @@ -229,12 +226,12 @@ lazy val phantomDsl = (project in file("phantom-dsl")).configs(
"com.datastax.cassandra" % "cassandra-driver-core" % Versions.datastax,
"com.datastax.cassandra" % "cassandra-driver-extras" % Versions.datastax,
"org.slf4j" % "log4j-over-slf4j" % Versions.slf4j,
"org.scalacheck" %% "scalacheck" % "1.11.5" % "test",
"com.websudos" %% "util-lift" % Versions.util % "test",
"com.websudos" %% "util-testing" % Versions.util % "test",
"net.liftweb" %% "lift-json" % liftVersion(scalaVersion.value) % "test",
"com.storm-enroute" %% "scalameter" % Versions.scalameter % "test",
"ch.qos.logback" % "logback-classic" % Versions.logback % "test"
"org.scalacheck" %% "scalacheck" % Versions.scalacheck % Test,
"com.outworkers" %% "util-lift" % Versions.util % Test,
"com.outworkers" %% "util-testing" % Versions.util % Test,
"net.liftweb" %% "lift-json" % liftVersion(scalaVersion.value) % Test,
"com.storm-enroute" %% "scalameter" % Versions.scalameter % Test,
"ch.qos.logback" % "logback-classic" % Versions.logback % Test
)
).dependsOn(
phantomConnectors
Expand Down Expand Up @@ -262,7 +259,7 @@ lazy val phantomConnectors = (project in file("phantom-connectors"))
name := "phantom-connectors",
libraryDependencies ++= Seq(
"com.datastax.cassandra" % "cassandra-driver-core" % Versions.datastax,
"com.websudos" %% "util-testing" % Versions.util % "test"
"com.outworkers" %% "util-testing" % Versions.util % Test
)
)

Expand All @@ -272,8 +269,8 @@ lazy val phantomFinagle = (project in file("phantom-finagle"))
moduleName := "phantom-finagle",
libraryDependencies ++= Seq(
"com.twitter" %% "util-core" % Versions.twitterUtil,
"com.websudos" %% "util-testing" % Versions.util % "test",
"com.storm-enroute" %% "scalameter" % Versions.scalameter % "test"
"com.outworkers" %% "util-testing" % Versions.util % Test,
"com.storm-enroute" %% "scalameter" % Versions.scalameter % Test
)
).settings(
inConfig(PerformanceTest)(Defaults.testTasks) ++ sharedSettings: _*
Expand All @@ -286,11 +283,11 @@ lazy val phantomThrift = (project in file("phantom-thrift"))
name := "phantom-thrift",
moduleName := "phantom-thrift",
libraryDependencies ++= Seq(
"org.slf4j" % "slf4j-log4j12" % Versions.slf4j % "test",
"org.apache.thrift" % "libthrift" % Versions.thrift,
"com.twitter" %% "scrooge-core" % Versions.scrooge,
"com.twitter" %% "scrooge-serializer" % Versions.scrooge,
"com.websudos" %% "util-testing" % Versions.util % "test"
"org.slf4j" % "slf4j-log4j12" % Versions.slf4j % Test,
"com.outworkers" %% "util-testing" % Versions.util % Test
)
).settings(
sharedSettings: _*
Expand All @@ -306,19 +303,20 @@ lazy val phantomSbtPlugin = (project in file("phantom-sbt"))
name := "phantom-sbt",
moduleName := "phantom-sbt",
scalaVersion := "2.10.6",
unmanagedSourceDirectories in Compile ++= Seq(
(sourceDirectory in Compile).value / ("scala-2." + {
CrossVersion.partialVersion(scalaBinaryVersion.value) match {
case Some((major, minor)) if minor >= 11 => "11"
case _ => "10"
}
})),
publish := {
CrossVersion.partialVersion(scalaVersion.value).map {
case (2, scalaMajor) if scalaMajor >= 11 => false
case _ => true
}
},
publishMavenStyle := false,
excludeFilter := {
CrossVersion.partialVersion(scalaVersion.value) match {
case Some((2, scalaMajor)) if scalaMajor >= 11 => NothingFilter
case _ => AllPassFilter
}
},
sbtPlugin := true,
libraryDependencies ++= Seq(
"org.cassandraunit" % "cassandra-unit" % Versions.cassandraUnit excludeAll (
Expand All @@ -328,23 +326,6 @@ lazy val phantomSbtPlugin = (project in file("phantom-sbt"))
)
)

lazy val phantomZookeeper = (project in file("phantom-zookeeper"))
.settings(
name := "phantom-zookeeper",
moduleName := "phantom-zookeeper",
libraryDependencies ++= Seq(
"org.xerial.snappy" % "snappy-java" % "1.1.1.3",
"com.websudos" %% "util-testing" % Versions.util % "test",
"com.websudos" %% "util-zookeeper" % Versions.util excludeAll {
ExclusionRule("org.slf4j", "slf4j-jdk14")
}
)
).settings(
sharedSettings: _*
).dependsOn(
phantomConnectors
)

lazy val phantomReactiveStreams = (project in file("phantom-reactivestreams"))
.settings(
name := "phantom-reactivestreams",
Expand All @@ -355,9 +336,9 @@ lazy val phantomReactiveStreams = (project in file("phantom-reactivestreams"))
"com.typesafe" % "config" % Versions.typesafeConfig,
"org.reactivestreams" % "reactive-streams" % Versions.reactivestreams,
"com.typesafe.akka" %% s"akka-actor" % Versions.akka,
"com.websudos" %% "util-testing" % Versions.util % "test",
"org.reactivestreams" % "reactive-streams-tck" % Versions.reactivestreams % "test",
"com.storm-enroute" %% "scalameter" % Versions.scalameter % "test"
"com.outworkers" %% "util-testing" % Versions.util % Test,
"org.reactivestreams" % "reactive-streams-tck" % Versions.reactivestreams % Test,
"com.storm-enroute" %% "scalameter" % Versions.scalameter % Test
)
).settings(
sharedSettings: _*
Expand All @@ -370,16 +351,15 @@ lazy val phantomExample = (project in file("phantom-example"))
name := "phantom-example",
moduleName := "phantom-example",
libraryDependencies ++= Seq(
"com.websudos" %% "util-lift" % Versions.util % "test",
"com.websudos" %% "util-testing" % Versions.util % "test"
"com.outworkers" %% "util-lift" % Versions.util % Test,
"com.outworkers" %% "util-testing" % Versions.util % Test
)
).settings(
sharedSettings: _*
).dependsOn(
phantomDsl,
phantomReactiveStreams,
phantomThrift,
phantomZookeeper
phantomThrift
)

lazy val phantomContainerTests = (project in file("phantom-container-test"))
Expand All @@ -396,13 +376,12 @@ lazy val phantomContainerTests = (project in file("phantom-container-test"))
"net.liftweb" %% "lift-webkit" % liftVersion(scalaVersion.value),
"net.liftweb" %% "lift-json" % liftVersion(scalaVersion.value),
"net.databinder.dispatch" %% "dispatch-core" % Versions.dispatch,
"javax.servlet" % "javax.servlet-api" % "3.0.1",
"com.websudos" %% "util-testing" % Versions.util
"javax.servlet" % "javax.servlet-api" % Versions.javaxServlet,
"com.outworkers" %% "util-testing" % Versions.util
)
).settings(
sharedSettings: _*
).dependsOn(
phantomDsl,
phantomThrift,
phantomZookeeper
phantomThrift
)
25 changes: 12 additions & 13 deletions build/publish_develop.sh
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
#!/usr/bin/env bash
if [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_BRANCH" == "develop" ];
then
#if [ "$TRAVIS_PULL_REQUEST" == "false" ] && [ "$TRAVIS_BRANCH" == "develop" ];
#then

if [ "${TRAVIS_SCALA_VERSION}" == "2.11.8" ] && [ "${TRAVIS_JDK_VERSION}" == "oraclejdk8" ];
then
# if [ "${TRAVIS_SCALA_VERSION}" == "2.11.8" ] && [ "${TRAVIS_JDK_VERSION}" == "oraclejdk8" ];
# then

echo "Setting git user email to ci@outworkers.com"
git config user.email "ci@outworkers.com"
Expand Down Expand Up @@ -65,18 +65,17 @@ then
git commit -m "TravisCI: Bumping version [ci skip]"
git push "https://${github_token}@${GH_REF}" develop

echo "Publishing new version to Maven"
sbt +publishSigned
sbt sonatypeReleaseAll
echo "Publishing new version to bintray"
sbt +bintray:publish

git checkout master
git merge develop

git push "https://${github_token}@${GH_REF}" develop:master > /dev/null 2>&1

else
echo "Only publishing version for Scala 2.11.8 and Oracle JDK 8 to prevent multiple artifacts"
fi
else
echo "This is either a pull request or the branch is not develop, deployment not necessary"
fi
#else
# echo "Only publishing version for Scala 2.11.8 and Oracle JDK 8 to prevent multiple artifacts"
#fi
#else
# echo "This is either a pull request or the branch is not develop, deployment not necessary"
#fi
Original file line number Diff line number Diff line change
Expand Up @@ -18,14 +18,20 @@ package com.websudos.phantom.connectors
import com.datastax.driver.core.{Cluster, Session}

import scala.concurrent.blocking
import scala.util.control.NonFatal
import scala.util.{Failure, Success, Try}

/**
* The default SessionProvider implementation, which should be sufficient
* for the most use cases.
*
* This implementation caches `Session` instances per keySpace.
*/
class DefaultSessionProvider(val space: KeySpace, builder: ClusterBuilder) extends SessionProvider {
class DefaultSessionProvider(
val space: KeySpace,
builder: ClusterBuilder,
errorHandler: Throwable => Throwable = identity
) extends SessionProvider {

val cluster: Cluster = {
builder(Cluster.builder).withoutJMXReporting().withoutMetrics().build
Expand All @@ -47,8 +53,16 @@ class DefaultSessionProvider(val space: KeySpace, builder: ClusterBuilder) exten
* Creates a new Session for the specified keySpace.
*/
protected[this] def createSession(keySpace: String): Session = {
val session = cluster.connect
initKeySpace(session, keySpace)
Try {
val session = blocking {
cluster.connect
}

initKeySpace(session, keySpace)
} match {
case Success(value) => value
case Failure(NonFatal(err)) => throw errorHandler(err);
}
}

val session = createSession(space.name)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,8 @@ package com.websudos.phantom.connectors
import scala.collection.JavaConverters._
import com.datastax.driver.core.{ProtocolVersion, Session}

import scala.util.control.NoStackTrace

trait SessionAugmenter {

def session: Session
Expand Down Expand Up @@ -89,7 +91,6 @@ class KeySpaceDef(val name: String, clusterBuilder: ClusterBuilder) {
*/
lazy val session: Session = provider.session


def cassandraVersions: Set[VersionNumber] = {
session.getCluster.getMetadata.getAllHosts
.asScala.map(_.getCassandraVersion)
Expand All @@ -110,11 +111,14 @@ class KeySpaceDef(val name: String, clusterBuilder: ClusterBuilder) {
if (single.forall(item => versions.forall(item ==))) {
single
} else {
throw new Exception("Illegal single version comparison. You are connected to clusters of different versions")
throw new RuntimeException(
s"Illegal single version comparison. You are connected to clusters of different versions." +
s"Available versions are: ${versions.mkString(", ")}"
) with NoStackTrace
}
}
} else {
throw new Exception("Could not extract any versions from the cluster.")
throw new RuntimeException("Could not extract any versions from the cluster, versions were empty")
}
}

Expand All @@ -137,5 +141,4 @@ class KeySpaceDef(val name: String, clusterBuilder: ClusterBuilder) {

}


case class KeySpace(name: String)
case class KeySpace(name: String)
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@
package com.websudos.phantom

import org.joda.time.{DateTime, LocalDate}
import com.websudos.util.testing._
import com.outworkers.util.testing._

package object server {

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ import org.joda.time.format.DateTimeFormat
import org.json4s.{DefaultFormats, Formats}
import org.scalatest.concurrent.PatienceConfiguration

import com.websudos.util.testing._
import com.outworkers.util.testing._
import com.websudos.phantom.server.ScalatraBootstrap.{AAPL, AAPLOption, AppleOptionPrices, ApplePrices}
import com.websudos.phantom.server._
import dispatch.{Http, as, url}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -186,6 +186,6 @@ abstract class Query[
}
}

private[phantom] trait Batchable {
trait Batchable {
self: ExecutableStatement =>
}

0 comments on commit 4021a0f

Please sign in to comment.