summaryrefslogtreecommitdiff
path: root/test/files
diff options
context:
space:
mode:
authorAdriaan Moors <adriaan.moors@typesafe.com>2012-12-14 10:28:22 -0800
committerAdriaan Moors <adriaan.moors@typesafe.com>2012-12-14 10:28:22 -0800
commite14917528e1c080a7f10785e21de36f3a7769718 (patch)
tree71ae6a0805b2922f26a2eb1411b546e38fc2eb3d /test/files
parent22ed6d493b676e28c324d77a1e31f39672f2a9e1 (diff)
parentd5ee322b733f106dba91c045790ad33f3ce4f1bc (diff)
downloadscala-e14917528e1c080a7f10785e21de36f3a7769718.tar.gz
scala-e14917528e1c080a7f10785e21de36f3a7769718.tar.bz2
scala-e14917528e1c080a7f10785e21de36f3a7769718.zip
Merge pull request #1765 from paulp/pr/remove-detach
Removing more of that which merits removal
Diffstat (limited to 'test/files')
-rw-r--r--test/files/detach-neg/det_bar.check4
-rw-r--r--test/files/detach-neg/det_bar.scala13
-rw-r--r--test/files/detach-run/actor-run.check5
-rw-r--r--test/files/detach-run/actor/Client.scala54
-rw-r--r--test/files/detach-run/actor/Server.scala27
-rw-r--r--test/files/detach-run/actor/ServerConsole.scala75
-rw-r--r--test/files/detach-run/actor/actor.flags1
-rw-r--r--test/files/detach-run/actor/actor.scala157
-rw-r--r--test/files/detach-run/actor/java.policy25
-rw-r--r--test/files/detach-run/basic-run.check5
-rw-r--r--test/files/detach-run/basic/Client.scala48
-rw-r--r--test/files/detach-run/basic/Server.scala22
-rw-r--r--test/files/detach-run/basic/ServerConsole.scala83
-rw-r--r--test/files/detach-run/basic/basic.flags1
-rw-r--r--test/files/detach-run/basic/basic.scala169
-rw-r--r--test/files/detach-run/basic/java.policy26
16 files changed, 0 insertions, 715 deletions
diff --git a/test/files/detach-neg/det_bar.check b/test/files/detach-neg/det_bar.check
deleted file mode 100644
index 70b47581a5..0000000000
--- a/test/files/detach-neg/det_bar.check
+++ /dev/null
@@ -1,4 +0,0 @@
-det_bar.scala:7: error: detach inapplicable for method bar
- detach(bar)
- ^
-one error found
diff --git a/test/files/detach-neg/det_bar.scala b/test/files/detach-neg/det_bar.scala
deleted file mode 100644
index 862afb1d6e..0000000000
--- a/test/files/detach-neg/det_bar.scala
+++ /dev/null
@@ -1,13 +0,0 @@
-import scala.remoting._
-class A(y: Int) {
- var z = 2
- var bar = (x: Int) => x + y + z
- def foo(x: Int): Int = x + y + z
- bar = (x: Int) => x * y
- detach(bar)
-}
-
-object test extends App {
- val a = new A(1)
- println(a.bar(2))
-}
diff --git a/test/files/detach-run/actor-run.check b/test/files/detach-run/actor-run.check
deleted file mode 100644
index 9448ddd5fe..0000000000
--- a/test/files/detach-run/actor-run.check
+++ /dev/null
@@ -1,5 +0,0 @@
-Server.main 8889
-Client.main 127.0.0.1 8889
-yInstVal = 10
-zLocVal = 1000
-result received: 11111
diff --git a/test/files/detach-run/actor/Client.scala b/test/files/detach-run/actor/Client.scala
deleted file mode 100644
index 12573e24d3..0000000000
--- a/test/files/detach-run/actor/Client.scala
+++ /dev/null
@@ -1,54 +0,0 @@
-/*
- * @author Stephane Micheloud
- */
-
-import scala.actors.Actor._, ClientHelper._
-import scala.actors.remote._, RemoteActor._
-import scala.remoting._, Debug._
-
-object Foo {
- def trace(msg: String) { info("[Foo.trace] "+msg)}
-}
-object Client {
- val yInstVal: Int = 10
- var yInstVar: Int = 99
- object Bar {
- def trace(msg: String) { info("[Bar.trace] "+msg) }
- }
- def main(args: Array[String]) {
- init(args)
- actor {
- val server = select(Node(host, port), 'Server)
- val zLocVal: Int = 1000
- var zLocVar: Int = 9998
- server ! detach(
- (x: Int) => {
- println("yInstVal = "+yInstVal)
- this.trace("yInstVar = "+yInstVar)
- Bar.trace("zLocVal = "+zLocVal)
- Foo.trace("zLocVar = "+zLocVar)
- zLocVar += 2
- System.out.println("zLocVal = "+zLocVal)
- Debug.info("zLocVar = "+zLocVar)
- x + yInstVal + yInstVar + zLocVal + zLocVar
- })
- react {
- case result: Int =>
- println("result received: " + result)
- Predef.exit(0)
- }
- }
- }
- private def trace(msg: String) { info("[Client.trace] "+msg) }
-}
-
-object ClientHelper {
- private var _host = "127.0.0.1"
- private var _port = 8888
- def host = _host
- def port = _port
- def init(args: Array[String]) {
- try { _host = args(0) } catch { case _ => }
- try { _port = args(1).toInt } catch { case _ => }
- }
-}
diff --git a/test/files/detach-run/actor/Server.scala b/test/files/detach-run/actor/Server.scala
deleted file mode 100644
index b56d22f744..0000000000
--- a/test/files/detach-run/actor/Server.scala
+++ /dev/null
@@ -1,27 +0,0 @@
-/*
- * @author Stephane Micheloud
- */
-
-import scala.actors.Actor._
-import scala.actors.remote.RemoteActor._
-
-object Server extends ServerConsole {
- private def computation(f: Int => Int): Int = {
- //some time-consuming task
- f(2)
- }
- def main(args: Array[String]) {
- actor {
- classLoader = serverClassLoader
- alive(args(0).toInt)
- register('Server, self)
- loopWhile(isRunning) {
- react {
- case f: (Int => Int) =>
- val result = computation(f)
- sender ! result
- }
- }
- }
- }
-}
diff --git a/test/files/detach-run/actor/ServerConsole.scala b/test/files/detach-run/actor/ServerConsole.scala
deleted file mode 100644
index 8ebd9d4c2e..0000000000
--- a/test/files/detach-run/actor/ServerConsole.scala
+++ /dev/null
@@ -1,75 +0,0 @@
-/*
- * @author Stephane Micheloud
- */
-
-import java.io.{BufferedReader, InputStreamReader}
-
-import scala.compat.Platform.currentTime
-import scala.remoting.Debug, Debug._
-
-trait ServerConsole extends Thread {
- private val startTime = currentTime
- actors.Debug.level = // e.g. 3 // info+warning+error
- try { System.getProperty("scala.actors.logLevel", "0").toInt }
- catch { case e => 0 }
-
- start()
-
- val serverClassLoader = {
- import java.rmi.server.RMIClassLoader
- val codebase = System.getProperty("java.rmi.server.codebase")
- info("[ServerConsole] codebase="+codebase)
- RMIClassLoader getClassLoader codebase
- }
-
- private var isTerminated = false
-
- def terminate() { isTerminated = false }
-
- def isRunning = !isTerminated
-
- override def run() {
- val in = new BufferedReader(new InputStreamReader(System.in))
- var quit = false
- while (!quit) {
- val args = getArgs(in)
- if (args contains "quit")
- quit = true
- if (args contains "cls") {
- println(ERASE_SCREEN)
- println(CURSOR_HOME)
- }
- if (args contains "warning")
- Debug.level = Level.WARNING
- if (args contains "info")
- Debug.level = Level.INFO
- if (args contains "silent")
- Debug.level = Level.SILENT
- }
- terminate()
- println("Server exited ("+mkTimeString(currentTime - startTime)+")")
- sys.exit(0)
- }
-
- protected def trace(msg: String) {
- Debug.info("[ServerConsole.trace] "+msg)
- }
-
- private def getArgs(in: BufferedReader): List[String] = {
- val input = try { in.readLine() } catch { case _ => null }
- if (input != null) (input.trim split "\\s+").toList else Nil
- }
-
- private def mkTimeString(time: Long): String = {
- def twoDigits(i: Long) = (if (i < 10) "0" else "")+i
- val sec = time / 1000
- val min = sec / 60
- val h = min / 60
- twoDigits(h) +":"+
- twoDigits(min - h * 60)+":"+
- twoDigits(sec - min * 60)
- }
-
- private val ERASE_SCREEN = "\033[2J"
- private val CURSOR_HOME = "\033[H"
-}
diff --git a/test/files/detach-run/actor/actor.flags b/test/files/detach-run/actor/actor.flags
deleted file mode 100644
index 55eed8bbcd..0000000000
--- a/test/files/detach-run/actor/actor.flags
+++ /dev/null
@@ -1 +0,0 @@
--Xpluginsdir ../../../../build/pack/misc/scala-devel/plugins -Xplugin-require:detach -P:detach:enable
diff --git a/test/files/detach-run/actor/actor.scala b/test/files/detach-run/actor/actor.scala
deleted file mode 100644
index 23a10d6982..0000000000
--- a/test/files/detach-run/actor/actor.scala
+++ /dev/null
@@ -1,157 +0,0 @@
-/*
- * @author Stephane Micheloud
- */
-
-object Test {
-
- val name = "actor"
- val host = "127.0.0.1"
- val port = 8889
-
- def main(args: Array[String]) {
- setenv()
- println("Server.main "+port)
- Server.main(Array(port.toString))
- println("Client.main "+host+" "+port)
- Client.main(Array(host, port.toString))
- Server.terminate()
- }
-
- private def setenv() {
- import Env._
-
- // Java properties for server & client
- System.setProperty("scala.actors.logLevel", actors_logLevel)
- System.setProperty("scala.remoting.logLevel", logLevel)
- System.setProperty("java.security.manager", "")
- System.setProperty("java.security.policy", policyFile)
- // Java properties for server only
- System.setProperty("java.rmi.server.codebase", deployUrl)
- System.setProperty("java.rmi.server.hostname", host)
- System.setProperty("java.rmi.server.useCodebaseOnly", "true")
-
- // application-specific classes to be deployed and accessed via URL
- // (i.e. detached closure, proxy interfaces and proxy stubs)
- val classNames = List(
- "$anonfun$main$1$proxy",
- "$anonfun$main$1$proxyImpl_Stub",
- "Bar$proxy",
- "Bar$proxyImpl_Stub",
- "Client$$anonfun$main$1$$anonfun$apply$1$detach",
- "Client$proxy",
- "Client$proxyImpl_Stub",
- "Foo$proxy",
- "Foo$proxyImpl_Stub")
-
- val proxyImplNames =
- for (n <- classNames; i = n lastIndexOf "_Stub"; if i > 0)
- yield n.substring(0, i)
-
- generatePolicyFile()
- generateRmiStubs(proxyImplNames)
- generateJarFile(classNames)
- }
-}
-
-object Env {
- import java.io._, java.util.jar._
-
- val actors_logLevel = "0"
- // = "3" // info+warning+error
- val logLevel = "silent"
- // = "info" // debug user code only
- // = "info,lib" // debug user & library code
-
- // we assume an Apache server is running locally for deployment
- private val sep = File.separator
- val docPath = System.getProperty("user.home")+sep+"public_html"
- val docRoot = "http://127.0.0.1/~"+System.getProperty("user.name")
-
- private val policyTmpl =
- System.getProperty("partest.cwd")+sep+Test.name+sep+"java.policy"
- val outPath = System.getProperty("partest.output")
- val libPath = System.getProperty("partest.lib")
- val policyFile = outPath+sep+"java.policy"
- val codebaseDir = outPath+sep+"-"
-
- assert((new File(docPath)).isDirectory,
- "Root directory \""+docPath+"\" not found")
- val deployJar = docPath+sep+Test.name+"_deploy.jar"
- val deployUrl = docRoot+"/"+Test.name+"_deploy.jar"
-
- def generatePolicyFile() {
- val in = new BufferedReader(new FileReader(policyTmpl))
- val out = new PrintWriter(new BufferedWriter(new FileWriter(policyFile)))
- var line = in.readLine()
- while (line != null) {
- val line1 = line.replaceAll("@PROJECT_LIB_BASE@", codebaseDir)
- out.println(line1)
- line = in.readLine()
- }
- in.close()
- out.close()
- }
-
- def generateRmiStubs(classNames: List[String]) {
- val options = List(
- "-v1.2",
- "-classpath "+libPath+File.pathSeparator+outPath,
- "-d "+outPath)
- rmic(options, classNames)
- //ls(outPath)
- }
-
- def generateJarFile(classNames: List[String]) {
- val out = new JarOutputStream(new FileOutputStream(deployJar))
- classNames foreach (name => try {
- val classFile = name+".class"
- val in = new FileInputStream(outPath+sep+classFile)
- out putNextEntry new JarEntry(classFile)
- val buf = new Array[Byte](512)
- var len = in read buf
- while (len != -1) {
- out.write(buf, 0, len)
- len = in read buf
- }
- in.close()
- } catch {
- case e: FileNotFoundException => println(e)
- })
- out.close()
- }
-
- private def ls(path: String) { exec("ls -al "+path) }
-
- private def rmic(options: List[String], classNames: List[String]) {
- val javaHome = scala.util.Properties.javaHome
- val jdkHome =
- if (javaHome endsWith "jre") javaHome.substring(0, javaHome.length-4)
- else javaHome
- val rmicExt = if (scala.util.Properties.isWin) ".exe" else ""
- val rmicCmd = jdkHome+sep+"bin"+sep+"rmic"+rmicExt
- val cmdLine = rmicCmd+options.mkString(" ", " ", "")+
- classNames.mkString(" "," ","")
- // println(cmdLine)
- exec(cmdLine)
- }
-
- private def exec(command: String) {
- val proc = Runtime.getRuntime exec command
- proc.waitFor()
- val out = new BufferedReader(new InputStreamReader(proc.getInputStream))
- var line = out.readLine()
- while (line != null) {
- println(line)
- line = out.readLine()
- }
- out.close()
- val err = new BufferedReader(new InputStreamReader(proc.getErrorStream))
- line = err.readLine()
- while (line != null) {
- println(line)
- line = err.readLine()
- }
- err.close()
- }
-}
-
diff --git a/test/files/detach-run/actor/java.policy b/test/files/detach-run/actor/java.policy
deleted file mode 100644
index b305f10b4c..0000000000
--- a/test/files/detach-run/actor/java.policy
+++ /dev/null
@@ -1,25 +0,0 @@
-// See http://java.sun.com/javase/6/docs/technotes/guides/security/permissions.html
-// See http://mindprod.com/jgloss/policyfile.html
-// The policy expands ${/} to the correct path or folder delimiter on your host platform.
-
-// Actions available with SocketPermission: accept, connect, listen, resolve
-// 1) The "resolve" action is implied when any of the other actions are present.
-// 2) The "listen" action is only meaningful when used with "localhost".
-
-grant {
- permission java.net.SocketPermission "*:80", "connect,accept,listen";
- permission java.net.SocketPermission "*:1024-", "connect,accept,listen";
- permission java.util.PropertyPermission "scala.remoting.logLevel", "read";
- permission java.util.PropertyPermission "scala.remoting.port", "read";
-};
-
-grant codeBase "@PROJECT_LIB_BASE@" {
- permission java.lang.RuntimePermission "getClassLoader";
- permission java.util.PropertyPermission "java.rmi.server.codebase", "read";
- permission java.util.PropertyPermission "java.rmi.server.hostname", "read";
- permission java.util.PropertyPermission "sun.rmi.dgc.server.gcInterval", "read,write";
-};
-
-//grant {
-// permission java.security.AllPermission;
-//};
diff --git a/test/files/detach-run/basic-run.check b/test/files/detach-run/basic-run.check
deleted file mode 100644
index 6463d97497..0000000000
--- a/test/files/detach-run/basic-run.check
+++ /dev/null
@@ -1,5 +0,0 @@
-Server.main 8889
-> Client.main 127.0.0.1 8889
-yInstVal = 10
-zLocVal = 1000
-result received: 11111
diff --git a/test/files/detach-run/basic/Client.scala b/test/files/detach-run/basic/Client.scala
deleted file mode 100644
index f8eddb041d..0000000000
--- a/test/files/detach-run/basic/Client.scala
+++ /dev/null
@@ -1,48 +0,0 @@
-/*
- * @author Stephane Micheloud
- */
-
-import java.net._, Thread._, ClientHelper._
-import scala.remoting._, Debug._
-
-object Foo {
- def trace(s: String) { info("[Foo.trace] "+s)}
-}
-object Client {
- val yInstVal: Int = 10
- var yInstVar: Int = 99
- object Bar {
- def trace(s: String) { info("[Bar.trace] "+s) }
- }
- def main(args: Array[String]) {
- init(args)
- val server = new Channel(host, port)
- val zLocVal: Int = 1000
- var zLocVar: Int = 9998
- server ! detach(
- (x: Int) => {
- println("yInstVal = "+yInstVal)
- this.trace("yInstVar = "+yInstVar)
- Bar.trace("zLocVal = "+zLocVal)
- Foo.trace("zLocVar = "+zLocVar)
- zLocVar += 2
- System.out.println("zLocVal = "+zLocVal)
- Debug.info("zLocVar = "+zLocVar)
- x + yInstVal + yInstVar + zLocVal + zLocVar
- })
- val result = server.receiveInt
- println("result received: " + result)
- }
- private def trace(s: String) { info("[Client.trace] "+s) }
-}
-
-object ClientHelper {
- private var _host = "127.0.0.1"
- private var _port = 8888
- def host = _host
- def port = _port
- def init(args: Array[String]) {
- try { _host = args(0) } catch { case _ => }
- try { _port = args(1).toInt } catch { case _ => }
- }
-}
diff --git a/test/files/detach-run/basic/Server.scala b/test/files/detach-run/basic/Server.scala
deleted file mode 100644
index f8aa02a4ba..0000000000
--- a/test/files/detach-run/basic/Server.scala
+++ /dev/null
@@ -1,22 +0,0 @@
-/*
- * @author Stephane Micheloud
- */
-
-import scala.remoting.ServerChannel
-
-object Server extends ServerConsole {
- private def computation(f: Int => Int): Int = {
- //some time-consuming task
- f(2)
- }
- def main(args: Array[String]) {
- val server = new ServerChannel(args(0).toInt)
- loop {
- val client = server.accept
- val f = client.receive[Int => Int]
- val result = computation(f)
- client ! result
- }
- server.close()
- }
-}
diff --git a/test/files/detach-run/basic/ServerConsole.scala b/test/files/detach-run/basic/ServerConsole.scala
deleted file mode 100644
index 65b81c0ca1..0000000000
--- a/test/files/detach-run/basic/ServerConsole.scala
+++ /dev/null
@@ -1,83 +0,0 @@
-/*
- * @author Stephane Micheloud
- */
-
-import java.io._
-
-import scala.compat.Platform.currentTime
-import scala.remoting.Debug, Debug._
-
-trait ServerConsole extends Thread {
- private val startTime = currentTime
-
- start()
-
- private var isTerminated = false
-
- def terminate() { isTerminated = true }
-
- protected def loop(block: => Unit) {
- while (!isTerminated) {
- try {
- block
- }
- catch {
- case e: ObjectStreamException =>
- trace("Object stream error ("+e.getMessage+")")
- case e: EOFException =>
- trace("Connection lost")
- case e: ClassNotFoundException =>
- trace("Class not found")
- case e =>
- trace("Server error: "+e)
- }
- }
- }
-
- override def run() {
- val in = new BufferedReader(new InputStreamReader(System.in))
- var quit = false
- while (!quit) {
- val args = getArgs(in)
- if (args contains "quit")
- quit = true
- if (args contains "cls") {
- println(ERASE_SCREEN)
- println(CURSOR_HOME)
- }
- if (args contains "warning")
- Debug.level = Level.WARNING
- if (args contains "info")
- Debug.level = Level.INFO
- if (args contains "silent")
- Debug.level = Level.SILENT
- }
- terminate()
- println("Server exited ("+mkTimeString(currentTime - startTime)+")")
- exit(0)
-
- }
-
- protected def trace(msg: String) {
- Debug.info("[ServerConsole.trace] "+msg)
- }
-
- private def getArgs(in: BufferedReader): List[String] = {
- print("> ")
- val input = try { in.readLine() } catch { case _ => null }
- if (input != null) (input.trim split "\\s+").toList else Nil
- }
-
- private def mkTimeString(time: Long): String = {
- def twoDigits(i: Long) = (if (i < 10) "0" else "")+i
- val sec = time / 1000
- val min = sec / 60
- val h = min / 60
- twoDigits(h) +":"+
- twoDigits(min - h * 60)+":"+
- twoDigits(sec - min * 60)
- }
-
- private val ERASE_SCREEN = "\033[2J"
- private val CURSOR_HOME = "\033[H"
-}
diff --git a/test/files/detach-run/basic/basic.flags b/test/files/detach-run/basic/basic.flags
deleted file mode 100644
index 55eed8bbcd..0000000000
--- a/test/files/detach-run/basic/basic.flags
+++ /dev/null
@@ -1 +0,0 @@
--Xpluginsdir ../../../../build/pack/misc/scala-devel/plugins -Xplugin-require:detach -P:detach:enable
diff --git a/test/files/detach-run/basic/basic.scala b/test/files/detach-run/basic/basic.scala
deleted file mode 100644
index 4d0fc2d933..0000000000
--- a/test/files/detach-run/basic/basic.scala
+++ /dev/null
@@ -1,169 +0,0 @@
-/*
- * @author Stephane Micheloud
- */
-
-object Test {
-
- val name = "basic"
- val host = "127.0.0.1"
- val port = 8889
-
- def main(args: Array[String]) {
- setenv()
- println("Server.main "+port)
- server.start()
- println("Client.main "+host+" "+port)
- client.start()
- server.terminate()
- }
-
- private var server = new ServerThread(port)
- private var client = new ClientThread(host, port)
-
- private class ServerThread(port: Int) extends Runnable {
- private var th = new Thread(this)
- def start() { th.start(); Thread.sleep(1000) }
- def run() { Server.main(Array(port.toString)) }
- def terminate() { Server.terminate(); sys.exit(0) }
- }
-
- private class ClientThread(host: String, port: Int) extends Runnable {
- private var th = new Thread(this)
- def start() { th.start(); th.join() }
- def run() { Client.main(Array(host, port.toString)) }
- }
-
- private def setenv() {
- import Env._
-
- // Java properties for server & client
- System.setProperty("scala.remoting.logLevel", logLevel)
- System.setProperty("java.security.manager", "")
- System.setProperty("java.security.policy", policyFile)
- // Java properties for server only
- System.setProperty("java.rmi.server.codebase", deployUrl)
- System.setProperty("java.rmi.server.hostname", host)
- System.setProperty("java.rmi.server.useCodebaseOnly", "true")
-
- // application-secific classes to be deployed and accessed via URL
- // (i.e. detached closure, proxy interfaces and proxy stubs)
- val classNames = List(
- "Bar$proxy",
- "Bar$proxyImpl_Stub",
- "Client$$anonfun$main$1$detach",
- "Client$proxy",
- "Client$proxyImpl_Stub",
- "Foo$proxy",
- "Foo$proxyImpl_Stub")
-
- val proxyImplNames =
- for (n <- classNames; i = n lastIndexOf "_Stub"; if i > 0)
- yield n.substring(0, i)
-
- generatePolicyFile()
- generateRmiStubs(proxyImplNames)
- generateJarFile(classNames)
- }
-}
-
-object Env {
- import java.io._, java.util.jar._
-
- val actors_logLevel = "0"
- // = "3" // info+warning+error
- val logLevel = "silent"
- // = "info" // debug user code only
- // = "info,lib" // debug user & library code
-
- // we assume an Apache server is running locally for deployment
- private val sep = File.separator
- val docPath = System.getProperty("user.home")+sep+"public_html"
- val docRoot = "http://127.0.0.1/~"+System.getProperty("user.name")
-
- private val policyTmpl =
- System.getProperty("partest.cwd")+sep+Test.name+sep+"java.policy"
- val outPath = System.getProperty("partest.output")
- val libPath = System.getProperty("partest.lib")
- val policyFile = outPath+sep+"java.policy"
- val codebaseDir = outPath+sep+"-"
-
- assert((new File(docPath)).isDirectory,
- "Root directory \""+docPath+"\" not found")
- val deployJar = docPath+sep+Test.name+"_deploy.jar"
- val deployUrl = docRoot+"/"+Test.name+"_deploy.jar"
-
- def generatePolicyFile() {
- val in = new BufferedReader(new FileReader(policyTmpl))
- val out = new PrintWriter(new BufferedWriter(new FileWriter(policyFile)))
- var line = in.readLine()
- while (line != null) {
- val line1 = line.replaceAll("@PROJECT_LIB_BASE@", codebaseDir)
- out.println(line1)
- line = in.readLine()
- }
- in.close()
- out.close()
- }
-
- def generateRmiStubs(classNames: List[String]) {
- val options = List(
- "-v1.2",
- "-classpath "+libPath+File.pathSeparator+outPath,
- "-d "+outPath)
- rmic(options, classNames)
- //ls(outPath)
- }
-
- def generateJarFile(classNames: List[String]) {
- val out = new JarOutputStream(new FileOutputStream(deployJar))
- classNames foreach (name => try {
- val classFile = name+".class"
- val in = new FileInputStream(outPath+sep+classFile)
- out putNextEntry new JarEntry(classFile)
- val buf = new Array[Byte](512)
- var len = in read buf
- while (len != -1) {
- out.write(buf, 0, len)
- len = in read buf
- }
- in.close()
- } catch {
- case e: FileNotFoundException => println(e)
- })
- out.close()
- }
-
- private def ls(path: String) { exec("ls -al "+path) }
-
- private def rmic(options: List[String], classNames: List[String]) {
- val javaHome = scala.util.Properties.javaHome
- val jdkHome =
- if (javaHome endsWith "jre") javaHome.substring(0, javaHome.length-4)
- else javaHome
- val rmicExt = if (scala.util.Properties.isWin) ".exe" else ""
- val rmicCmd = jdkHome+sep+"bin"+sep+"rmic"+rmicExt
- val cmdLine = rmicCmd+options.mkString(" ", " ", "")+
- classNames.mkString(" "," ","")
- // println(cmdLine)
- exec(cmdLine)
- }
-
- private def exec(command: String) {
- val proc = Runtime.getRuntime exec command
- proc.waitFor()
- val out = new BufferedReader(new InputStreamReader(proc.getInputStream))
- var line = out.readLine()
- while (line != null) {
- println(line)
- line = out.readLine()
- }
- out.close()
- val err = new BufferedReader(new InputStreamReader(proc.getErrorStream))
- line = err.readLine()
- while (line != null) {
- println(line)
- line = err.readLine()
- }
- err.close()
- }
-}
diff --git a/test/files/detach-run/basic/java.policy b/test/files/detach-run/basic/java.policy
deleted file mode 100644
index 92c1045c3d..0000000000
--- a/test/files/detach-run/basic/java.policy
+++ /dev/null
@@ -1,26 +0,0 @@
-// See http://java.sun.com/javase/6/docs/technotes/guides/security/permissions.html
-// See http://mindprod.com/jgloss/policyfile.html
-// The policy expands ${/} to the correct path or folder delimiter on your host platform.
-
-// Actions available with SocketPermission: accept, connect, listen, resolve
-// 1) The "resolve" action is implied when any of the other actions are present.
-// 2) The "listen" action is only meaningful when used with "localhost".
-
-grant {
- permission java.net.SocketPermission "*:80", "connect,accept,listen";
- permission java.net.SocketPermission "*:1024-", "connect,accept,listen";
- permission java.util.PropertyPermission "scala.remoting.logLevel", "read";
- permission java.util.PropertyPermission "scala.remoting.port", "read";
-};
-
-grant codeBase "@PROJECT_LIB_BASE@" {
- permission java.lang.RuntimePermission "getClassLoader";
- permission java.lang.RuntimePermission "createClassLoader";
- permission java.util.PropertyPermission "java.rmi.server.codebase", "read";
- permission java.util.PropertyPermission "java.rmi.server.hostname", "read";
- permission java.util.PropertyPermission "sun.rmi.dgc.server.gcInterval", "read,write";
-};
-
-//grant {
-// permission java.security.AllPermission;
-//};