Permalink
Browse files

make this plugin a simple library instead of a PlayProject. Manipulat…

…ion of the project structure. Next => try to use this lib in a play project...
  • Loading branch information...
1 parent 7d0674f commit 58b470477fffbfafa5ac1875f949098479250b0e @andypetrella committed Apr 11, 2012
View
8 README
@@ -1,16 +1,12 @@
========================
-HOW TO USE THIS TEMPLATE
+HOW TO BUILD THIS PLUGIN
========================
* install sbt 0.11.2 if you do not have it already. You can get it from here: https://github.com/harrah/xsbt/wiki/Getting-Started-Setup
-* execute 'sbt' and then `help play` for play specific commands
-
* execute `sbt` and then `compile` to build the project
-* execute `sbt` and then 'run' to run the built-in development server
-
-* onece the development server is running, documentation is available at http://localhost:9000/@documentation
+* execute `sbt` and then 'publish-local' to publish in your local repository
@@ -1,16 +0,0 @@
-package controllers
-
-import play.api._
-import play.api.mvc._
-
-object Application extends Controller {
-
- def index = Action {
- Ok(views.html.index("Your new application is ready."))
- }
-
- def index2 = Action {
- Ok(views.html.index("Your new application is ready... 2"))
- }
-
-}
@@ -1,7 +0,0 @@
-@(message: String)
-
-@main("Welcome to Play 2.0") {
-
- @play20.welcome(message)
-
-}
View
@@ -1,15 +0,0 @@
-@(title: String)(content: Html)
-
-<!DOCTYPE html>
-
-<html>
- <head>
- <title>@title</title>
- <link rel="stylesheet" media="screen" href="@routes.Assets.at("stylesheets/main.css")">
- <link rel="shortcut icon" type="image/png" href="@routes.Assets.at("images/favicon.png")">
- <script src="@routes.Assets.at("javascripts/jquery-1.7.1.min.js")" type="text/javascript"></script>
- </head>
- <body>
- @content
- </body>
-</html>
View
@@ -1,23 +0,0 @@
-#Disable DBPlugin
-dbplugin=disabled
-
-#Disable DB evolutions
-evolutionplugin=disabled
-
-#Disable Eh Cache
-ehcacheplugin=disabled
-
-
-# Logger
-# ~~~~~
-# You can also configure logback (http://logback.qos.ch/), by providing a logger.xml file in the conf directory .
-
-# Root logger:
-logger.root=ERROR
-
-# Logger used by the framework:
-logger.play=INFO
-
-# Logger provided to your application:
-logger.application=DEBUG
-
View
@@ -1,10 +0,0 @@
-# Routes
-# This file defines all application routes (Higher priority routes first)
-# ~~~~
-
-# Home page
-GET / controllers.Application.index
-GET /2 controllers.Application.index2
-
-# Map static resources from the /public folder to the /assets URL path
-GET /assets/*file controllers.Assets.at(path="/public", file)
View
@@ -1,44 +1,49 @@
import sbt._
import Keys._
-import PlayProject._
-object ApplicationBuild extends Build {
+object MinimalBuild extends Build {
val appName = "gatling-play2-plugin"
- val appVersion = "1.0"
+ val buildVersion = "1.0-SNAPSHOT"
+
+ lazy val typesafeSnapshot = "Typesafe Snapshots Repository" at "http://repo.typesafe.com/typesafe/snapshots/"
+ lazy val typesafe = "Typesafe Repository" at "http://repo.typesafe.com/typesafe/releases/"
/* OFFICIAL GATLING REPO */
val gatlingReleasesRepo = "Gatling Releases Repo" at "http://repository.excilys.com/content/repositories/releases"
val gatling3PartyRepo = "Gatling Third-Party Repo" at "http://repository.excilys.com/content/repositories/thirdparty"
- /* LOCAL MAVEN REPO for My Forked Gatling */
- val mavenLocal = "Local Maven Repository" at "file:///"+ Path.userHome+"/.m2/repository"
+ /* GATLING DEPS */
+ val gatlingVersionNumber = "1.1.2"
+ val gatlingApp = "com.excilys.ebi.gatling" % "gatling-app" % gatlingVersionNumber
+ val gatlingRecorder = "com.excilys.ebi.gatling" % "gatling-recorder" % gatlingVersionNumber
+ val gatlingCharts = "com.excilys.ebi.gatling" % "gatling-charts" % gatlingVersionNumber
+ val gatlingHighcharts = "com.excilys.ebi.gatling.highcharts" % "gatling-charts-highcharts" % gatlingVersionNumber
- /* GATLING DEPS */
- val gatlingVersionNumber = "1.1" //FUTURE version that should have Akka 2.0 support !
- val gatlingSnapshotVersionNumber = "1.1.0-SNAPSHOT" //My version of the 1.1.0-SNAPSHOT that has rough Akka 2.0 support
- val gatlingApp = "com.excilys.ebi.gatling" % "gatling-app" % gatlingSnapshotVersionNumber
- val gatlingRecorder = "com.excilys.ebi.gatling" % "gatling-recorder" % gatlingSnapshotVersionNumber
- val gatlingCharts = "com.excilys.ebi.gatling" % "gatling-charts" % gatlingSnapshotVersionNumber
- val gatlingHighcharts = "com.excilys.ebi.gatling.highcharts" % "gatling-charts-highcharts" % gatlingSnapshotVersionNumber
-
-
- val appDependencies = Seq(
- gatlingApp,
- gatlingRecorder,
- gatlingCharts,
- gatlingHighcharts
- )
+ val specs2 = "org.specs2" %% "specs2" % "1.8.2" % "test" withSources
+
+ val libDependencies = Seq(
+ "play" %% "play" % "2.0",
- val main = PlayProject(appName, appVersion, appDependencies, mainLang = SCALA).settings(
- resolvers ++= Seq(
- gatlingReleasesRepo,
- gatling3PartyRepo,
+ gatlingApp,
+ gatlingRecorder,
+ gatlingCharts,
+ gatlingHighcharts,
- mavenLocal
- )
+ specs2,
+
+ "play" %% "play-test" % "2.0"
)
+
+
+ lazy val root = Project(id = appName, base = file("."), settings = Project.defaultSettings).settings(
+ version := buildVersion,
+ organization := "be.nextlab",
+ resolvers ++= Seq(typesafe, typesafeSnapshot, gatlingReleasesRepo, gatling3PartyRepo),
+ javacOptions += "-Xlint:unchecked",
+ libraryDependencies ++= libDependencies
+ )
}
View
Deleted file not rendered

Large diffs are not rendered by default.

Oops, something went wrong.
No changes.
@@ -1,20 +1,22 @@
-package gatling
+package be.nextlab.play.gatling
+/**
+ *
+ * User: noootsab
+ * Date: 11/04/12
+ * Time: 23:24
+ */
import java.io.File
+
+import play.api._
import play.api.Play._
import play.Plugin
-import play.api.{Application, Play}
-import com.excilys.ebi.gatling.core.config.GatlingConfiguration
+
import scalax.io
import io.Codec
import scalax.file.Path
-/**
- *
- * User: noootsab
- * Date: 12/03/12
- * Time: 22:24
- */
+import com.excilys.ebi.gatling.core.config.GatlingConfiguration
class Gatling(app: Application) extends Plugin {
@@ -26,10 +28,9 @@ class Gatling(app: Application) extends Plugin {
val gatlingPath: String = "target/gatling/"
+ app.getFile(gatlingPath).mkdirs()
- Play.getFile(gatlingPath).mkdirs()
-
- val gatlingFile = Path(Play.getFile(gatlingPath + "gatling.conf"))
+ val gatlingFile = Path(app.getFile(gatlingPath + "gatling.conf"))
if (!gatlingFile.exists) {
gatlingFile.createFile(true, false)
gatlingFile.write(
@@ -65,10 +66,10 @@ class Gatling(app: Application) extends Plugin {
}
- def mkDirsIfNotExists(dir:String):File = Play.getExistingFile(gatlingPath + dir) match {
+ def mkDirsIfNotExists(dir:String):File = app.getExistingFile(gatlingPath + dir) match {
case Some(x) => x
case None => {
- val d = Play.getFile(gatlingPath + dir)
+ val d = app.getFile(gatlingPath + dir)
d.mkdirs()
d
}
@@ -1,45 +1,22 @@
-package stress
+package be.nextlab.play.gatling
-import org.specs2.mutable.Specification
-
-import play.api._
-import play.api.Play._
-import play.api.test._
-import play.api.test.Helpers._
-
-import org.joda.time.DateTime
-import java.io.File
-import Play._
-import com.excilys.ebi.gatling.core.result.message.RunRecord
-import org.joda.time.DateTime._
-import com.excilys.ebi.gatling.core.runner.Runner
-import com.excilys.ebi.gatling.core.config.GatlingConfiguration
import com.excilys.ebi.gatling.charts.report.ReportsGenerator
import com.excilys.ebi.gatling.charts.config.ChartsFiles._
import com.excilys.ebi.gatling.core.scenario.configuration.Simulation
+import com.excilys.ebi.gatling.core.result.message.RunRecord
+import org.joda.time.DateTime._
+import com.excilys.ebi.gatling.core.runner.Runner
/**
*
* User: noootsab
- * Date: 12/03/12
- * Time: 22:28
+ * Date: 11/04/12
+ * Time: 23:59
*/
-class TestStress extends Specification {
-
- "stress test the server" in {
- val baseUrl = "http://localhost:3333"
- running(TestServer(3333, FakeApplication(
- additionalPlugins = Seq("gatling.Gatling")
- ))) {
-
- SampleSimulations.simulations(baseUrl) foreach gatling
-
- }
- }
-
+object Util {
- private def generateReports(runUuid: String) {
+ def generateReports(runUuid: String) {
println("Generating reports...")
val start = System.currentTimeMillis
if (ReportsGenerator.generateFor(runUuid)) {
@@ -50,7 +27,7 @@ class TestStress extends Specification {
}
}
- def gatling(s:Simulation) {
+ def gatling(s: Simulation) {
val runInfo = new RunRecord(now, "run-test", "test")
new Runner(runInfo, s()).run
generateReports(runInfo.runUuid)
@@ -12,8 +12,8 @@ object SampleSimulations {
def simulations(baseUrl:String):Seq[GSimulation] = Seq(
- new SimpleSimulation(baseUrl, controllers.routes.Application.index().url),
- new SimpleSimulation(baseUrl, controllers.routes.Application.index2().url)
+ //what might be done in play app : new SimpleSimulation(baseUrl, controllers.routes.Application.index().url),
+ new SimpleSimulation(baseUrl, "")
)
@@ -0,0 +1,30 @@
+package stress
+
+import org.specs2.mutable.Specification
+
+import play.api.test._
+import play.api.test.Helpers._
+
+import be.nextlab.play.gatling.Util
+
+/**
+ *
+ * User: noootsab
+ * Date: 12/03/12
+ * Time: 22:28
+ */
+
+class TestStress extends Specification {
+
+ "stress test the server" in {
+ val baseUrl = "http://localhost:3333"
+ running(TestServer(3333, FakeApplication(
+ additionalPlugins = Seq("gatling.Gatling")
+ ))) {
+
+ SampleSimulations.simulations(baseUrl) foreach Util.gatling
+
+ }
+ }
+
+}

0 comments on commit 58b4704

Please sign in to comment.