Browse Source

Merge pull request #1208 from TechEmpower/fix-scruffy-test

Fix sbt and database issues with scruffy
Mike Smith 10 years ago
parent
commit
c6f43277cd

+ 0 - 1
frameworks/Scala/plain/setup.py

@@ -12,7 +12,6 @@ def start(args, logfile, errfile):
     subprocess.check_call("./sbt assembly && rm -rf target/scala-2.10/cache", shell=True, cwd="plain", stderr=errfile, stdout=logfile)
 
   subprocess.Popen("java -jar target/scala-2.10/plain-benchmark-assembly-1.0.1.jar", cwd="plain", shell=True, stderr=errfile, stdout=logfile)
-  time.sleep(10)
   return 0
 
 def stop(logfile, errfile):

+ 1 - 1
frameworks/Scala/scruffy/install.sh

@@ -1,3 +1,3 @@
 #!/bin/bash
 
-fw_depends java
+fw_depends java sbt

+ 4 - 4
frameworks/Scala/scruffy/setup.py

@@ -1,21 +1,21 @@
-
+import setup_util
 import subprocess
 import sys
 import time
 import os
 
 def start(args, logfile, errfile):
+  setup_util.replace_text('scruffy/src/main/scala/scruffy/examples/Test2Endpoint.scala', 'database_host', args.database_host)
   if os.name == 'nt':
     subprocess.check_call('"..\\sbt\\sbt.bat" assembly', shell=True, cwd="scruffy", stderr=errfile, stdout=logfile)
   else:
-    subprocess.check_call("../sbt/sbt assembly", shell=True, cwd="scruffy", stderr=errfile, stdout=logfile)
+    subprocess.check_call(args.iroot + "/sbt/bin/sbt assembly", shell=True, cwd="scruffy", stderr=errfile, stdout=logfile)
     
-  subprocess.Popen("java -jar target/scala-2.11/scruffy-benchmark-assembly-1.0.1.jar -Dhostname" + args.database_host,
+  subprocess.Popen("java -jar target/scala-2.11/scruffy-benchmark-assembly-1.0.1.jar -Dhostname=" + args.database_host,
                     cwd="scruffy",
                     shell=True,
                     stderr=errfile,
                     stdout=logfile)
-  time.sleep(5)
   return 0
 
 def stop(logfile, errfile):

+ 1 - 1
frameworks/Scala/scruffy/src/main/scala/scruffy/examples/Main.scala

@@ -8,7 +8,7 @@ object Main extends App {
   val port = 8080
   val scruffy = new Scruffy(ScruffyConfiguration.port(port).compression(false).requestLogging(false))
   scruffy.mount(new Test1Endpoint)
-  scruffy.mount(new Test2Endpoint(Option(System.getProperty("hostname")).getOrElse("localhost")))
+  scruffy.mount(new Test2Endpoint)
   scruffy.mount(new Test6Endpoint)
   println("Starting Scruffy...")
   val lifecycle = scruffy.start()

+ 2 - 2
frameworks/Scala/scruffy/src/main/scala/scruffy/examples/Test2Endpoint.scala

@@ -4,8 +4,8 @@ import com.mongodb.casbah.Imports._
 import com.sksamuel.scruffy.EndpointProvider
 
 /** @author Stephen Samuel */
-class Test2Endpoint(hostname: String) extends EndpointProvider {
-
+class Test2Endpoint() extends EndpointProvider {
+  val hostname = "database_host"
   val connection = MongoConnection(hostname, 27017)
   val collection = connection.getDB("hello_world").getCollection("world")