[Red5commits] [2104] created tag from trunk
jbauch
luke at codegent.com
Sun Jun 17 09:52:07 EDT 2007
created tag from trunk
Timestamp: 06/17/07 08:41:50 EST (less than one hour ago)
Change: 2104
Author: jbauch
Files (see diff or trac for details):
java/server/tags/0_6_2
Trac: http://mirror1.cvsdude.com/trac/osflash/red5/changeset/2104
Index: /java/server/tags/0_6_2/test/org/red5/server/service/TestEchoService.java
===================================================================
--- /java/server/tags/0_6_2/test/org/red5/server/service/TestEchoService.java (revision 1978)
+++ /java/server/tags/0_6_2/test/org/red5/server/service/TestEchoService.java (revision 1978)
@@ -0,0 +1,128 @@
+package org.red5.server.service;
+
+/*
+ * RED5 Open Source Flash Server - http://www.osflash.org/red5
+ *
+ * Copyright © 2006 by respective authors. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the
+ * terms of the GNU Lesser General Public License as published by the Free Software
+ * Foundation; either version 2.1 of the License, or (at your option) any later
+ * version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along
+ * with this library; if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * @author The Red5 Project (red5 at osflash.org)
+ * @author Chris Allen (mrchrisallen at gmail.com)
+ */
+
+import java.io.IOException;
+import java.io.StringReader;
+import java.text.ParseException;
+import java.text.SimpleDateFormat;
+import java.util.ArrayList;
+import java.util.Date;
+import java.util.HashMap;
+import java.util.List;
+import java.util.Map;
+
+import javax.xml.parsers.DocumentBuilder;
+import javax.xml.parsers.DocumentBuilderFactory;
+import javax.xml.parsers.ParserConfigurationException;
+
+import junit.framework.TestCase;
+
+import org.red5.samples.services.EchoService;
+import org.red5.samples.services.IEchoService;
+import org.w3c.dom.Document;
+import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
+
+public class TestEchoService extends TestCase {
+
+ private IEchoService echoService;
+
+ /** {@inheritDoc} */
+ @Override
+ protected void setUp() throws Exception {
+ super.setUp();
+ echoService = new EchoService();
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ echoService = null;
+ }
+
+ public void testEchoArray() {
+ Object[] startArray = { "first", "second", "third" };
+ Object[] resultArray = echoService.echoArray(startArray);
+ assertEquals(startArray[0], resultArray[0]);
+ assertEquals(startArray[1], resultArray[1]);
+ assertEquals(startArray[2], resultArray[2]);
+ }
+
+ public void testEchoBoolean() {
+ boolean b = true;
+ assertTrue(echoService.echoBoolean(b));
+ }
+
+ public void testEchoDate() throws ParseException {
+ SimpleDateFormat dateFormat = new SimpleDateFormat("MM-dd-yyyy");
+ Date startDate = dateFormat.parse("01-26-1974");
+ Date returnDate = echoService.echoDate(startDate);
+ assertEquals(startDate.getTime(), returnDate.getTime());
+ }
+
+ public void testEchoList() {
+ List startList = new ArrayList();
+ startList.add(0, "first");
+ startList.add(1, "second");
+ List resultList = echoService.echoList(startList);
+ assertEquals(startList.get(0), resultList.get(0));
+ assertEquals(startList.get(1), resultList.get(1));
+ }
+
+ public void testEchoNumber() {
+ double num = 100;
+ assertEquals(200, echoService.echoNumber(num), echoService
+ .echoNumber(num));
+ }
+
+ public void testEchoObject() {
+ String str = "entry one";
+ Date date = new Date();
+ Map startMap = new HashMap();
+ startMap.put("string", str);
+ startMap.put("date", date);
+ Map resultMap = echoService.echoObject(startMap);
+ assertEquals(startMap.get("string"), resultMap.get("string"));
+ assertEquals(startMap.get("date"), resultMap.get("date"));
+ }
+
+ public void testEchoString() {
+ String str = "This is a test.";
+ assertEquals("This is a test.", echoService.echoString(str));
+ }
+
+ public void testEchoXML() throws SAXException, IOException,
+ ParserConfigurationException {
+ DocumentBuilderFactory factory = DocumentBuilderFactory.newInstance();
+ DocumentBuilder builder = factory.newDocumentBuilder();
+ String xmlStr = "<root testAttribute=\"test value\">this is a test</root>";
+ StringReader reader = new StringReader(xmlStr);
+ InputSource source = new InputSource(reader);
+ Document xml = builder.parse(source);
+ Document resultXML = echoService.echoXML(xml);
+ assertEquals(xml.getFirstChild().getNodeValue(), resultXML
+ .getFirstChild().getNodeValue());
+ }
+}
Index: /java/server/tags/0_6_2/test/org/red5/server/service/testcontext.xml
===================================================================
--- /java/server/tags/0_6_2/test/org/red5/server/service/testcontext.xml (revision 1987)
+++ /java/server/tags/0_6_2/test/org/red5/server/service/testcontext.xml (revision 1987)
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<!DOCTYPE beans PUBLIC "-//SPRING//DTD BEAN//EN" "http://www.springframework.org/dtd/spring-beans.dtd">
+<beans>
+
+ <bean id="echoService" class="org.red5.samples.services.EchoService" init-method="startUp"/>
+ <bean id="serviceInvoker" class="org.red5.server.service.ServiceInvoker" />
+
+</beans>
Index: /java/server/tags/0_6_2/test/org/red5/server/service/ConversionUtilsTest.java
===================================================================
--- /java/server/tags/0_6_2/test/org/red5/server/service/ConversionUtilsTest.java (revision 1978)
+++ /java/server/tags/0_6_2/test/org/red5/server/service/ConversionUtilsTest.java (revision 1978)
@@ -0,0 +1,122 @@
+package org.red5.server.service;
+
+/*
+ * RED5 Open Source Flash Server - http://www.osflash.org/red5
+ *
+ * Copyright © 2006 by respective authors. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the
+ * terms of the GNU Lesser General Public License as published by the Free Software
+ * Foundation; either version 2.1 of the License, or (at your option) any later
+ * version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along
+ * with this library; if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * @author The Red5 Project (red5 at osflash.org)
+ * @author Luke Hubbard, Codegent Ltd (luke at codegent.com)
+ */
+
+import java.util.ArrayList;
+import java.util.Set;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+// TODO: Add more tests here.
+
+public class ConversionUtilsTest extends TestCase {
+
+ class TestJavaBean {
+
+ }
+
+ private static final Log log = LogFactory.getLog(ConversionUtilsTest.class);
+
+ public void testBasic() {
+ Object result = ConversionUtils.convert(new Integer(42), String.class);
+ if (!(result instanceof String)) {
+ Assert.fail("Should be a string");
+ }
+ String str = (String) result;
+ Assert.assertEquals("42", str);
+ }
+
+ public void testConvertListToStringArray() {
+ ArrayList source = new ArrayList();
+
+ source.add("Testing 1");
+ source.add("Testing 2");
+ source.add("Testing 3");
+
+ Class target = (new String[0]).getClass();
+
+ Object result = ConversionUtils.convert(source, target);
+ if (!(result.getClass().isArray() && result.getClass()
+ .getComponentType().equals(String.class))) {
+ Assert.fail("Should be String[]");
+ }
+ String[] results = (String[]) result;
+
+ Assert.assertEquals(results.length, source.size());
+ Assert.assertEquals(results[2], source.get(2));
+
+ }
+
+ public void testConvertObjectArrayToStringArray() {
+ Object[] source = new Object[3];
+
+ source[0] = new Integer(21);
+ source[1] = Boolean.FALSE;
+ source[2] = "Woot";
+
+ Class target = (new String[0]).getClass();
+
+ Object result = ConversionUtils.convert(source, target);
+ if (!(result.getClass().isArray() && result.getClass()
+ .getComponentType().equals(String.class))) {
+ Assert.fail("Should be String[]");
+ }
+ String[] results = (String[]) result;
+
+ Assert.assertEquals(results.length, source.length);
+ Assert.assertEquals(results[2], source[2]);
+
+ }
+
+ public void testConvertToSet() {
+ Object[] source = new Object[3];
+ source[0] = new Integer(21);
+ source[1] = Boolean.FALSE;
+ source[2] = "Woot";
+ Object result = ConversionUtils.convert(source, Set.class);
+ if (!(result instanceof Set)) {
+ Assert.fail("Should be a set");
+ }
+ Set results = (Set) result;
+ Assert.assertEquals(results.size(), source.length);
+
+ }
+
+ public void testNoOppConvert() {
+ TestJavaBean source = new TestJavaBean();
+ Object result = ConversionUtils.convert(source, TestJavaBean.class);
+ Assert.assertEquals(result, source);
+ }
+
+ public void testNullConvert() {
+ Object result = ConversionUtils.convert(null, TestJavaBean.class);
+ Assert.assertNull(result);
+ result = ConversionUtils.convert(new TestJavaBean(), null);
+ Assert.assertNull(result);
+ }
+
+}
Index: /java/server/tags/0_6_2/test/org/red5/server/service/ServiceInvokerTest.java
===================================================================
--- /java/server/tags/0_6_2/test/org/red5/server/service/ServiceInvokerTest.java (revision 1987)
+++ /java/server/tags/0_6_2/test/org/red5/server/service/ServiceInvokerTest.java (revision 1987)
@@ -0,0 +1,98 @@
+package org.red5.server.service;
+
+/*
+ * RED5 Open Source Flash Server - http://www.osflash.org/red5
+ *
+ * Copyright © 2006 by respective authors. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the
+ * terms of the GNU Lesser General Public License as published by the Free Software
+ * Foundation; either version 2.1 of the License, or (at your option) any later
+ * version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along
+ * with this library; if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * @author The Red5 Project (red5 at osflash.org)
+ * @author Luke Hubbard, Codegent Ltd (luke at codegent.com)
+ */
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.springframework.context.ApplicationContext;
+import org.springframework.context.support.ClassPathXmlApplicationContext;
+
+public class ServiceInvokerTest extends TestCase {
+
+ // TODO: Add more tests!
+ // we dont have to test all the echo methods, more test the call object works as expected
+ // the correct types of status are returned (method not found) etc.
+ // Also, we need to add tests which show the way the parameter conversion works.
+ // So have a few methods with the same name, and try with diff params, making sure right one gets called.
+
+ protected static Log log = LogFactory.getLog(ServiceInvokerTest.class
+ .getName());
+
+ protected ApplicationContext appCtx = null;
+
+ /** {@inheritDoc} */
+ @Override
+ protected void setUp() throws Exception {
+ // TODO Auto-generated method stub
+ super.setUp();
+ appCtx = new ClassPathXmlApplicationContext(
+ "org/red5/server/service/testcontext.xml");
+ }
+
+ /** {@inheritDoc} */
+ @Override
+ protected void tearDown() throws Exception {
+ // TODO Auto-generated method stub
+ super.tearDown();
+
+ }
+
+ public void testAppContextLoaded() {
+ Assert.assertNotNull(appCtx);
+ Assert.assertNotNull(appCtx.getBean("serviceInvoker"));
+ Assert.assertNotNull(appCtx.getBean("echoService"));
+ }
+
+ public void testExceptionStatus() {
+ Object[] params = new Object[] { "Woot this is cool" };
+ Call call = new Call("doesntExist", "echoString", params);
+ ServiceInvoker invoker = (ServiceInvoker) appCtx
+ .getBean(ServiceInvoker.SERVICE_NAME);
+ invoker.invoke(call, appCtx);
+ Assert.assertEquals(call.isSuccess(), false);
+ Assert.assertEquals(call.getStatus(), Call.STATUS_SERVICE_NOT_FOUND);
+ call = new Call("echoService", "doesntExist", params);
+ invoker.invoke(call, appCtx);
+ Assert.assertEquals(call.isSuccess(), false);
+ Assert.assertEquals(call.getStatus(), Call.STATUS_METHOD_NOT_FOUND);
+ params = new Object[] { "too", "many", "params" };
+ call = new Call("echoService", "echoString", params);
+ invoker.invoke(call, appCtx);
+ Assert.assertEquals(call.isSuccess(), false);
+ Assert.assertEquals(call.getStatus(), Call.STATUS_METHOD_NOT_FOUND);
+ }
+
+ public void testSimpleEchoCall() {
+ Object[] params = new Object[] { "Woot this is cool" };
+ PendingCall call = new PendingCall("echoService", "echoString", params);
+ ServiceInvoker invoker = (ServiceInvoker) appCtx
+ .getBean(ServiceInvoker.SERVICE_NAME);
+ invoker.invoke(call, appCtx);
+ Assert.assertEquals(call.isSuccess(), true);
+ Assert.assertEquals(call.getResult(), params[0]);
+ }
+
+}
Index: /java/server/tags/0_6_2/test/org/red5/server/rtmp/RTMPUtilsTest.java
===================================================================
--- /java/server/tags/0_6_2/test/org/red5/server/rtmp/RTMPUtilsTest.java (revision 1978)
+++ /java/server/tags/0_6_2/test/org/red5/server/rtmp/RTMPUtilsTest.java (revision 1978)
@@ -0,0 +1,76 @@
+package org.red5.server.rtmp;
+
+/*
+ * RED5 Open Source Flash Server - http://www.osflash.org/red5
+ *
+ * Copyright © 2006 by respective authors. All rights reserved.
+ *
+ * This library is free software; you can redistribute it and/or modify it under the
+ * terms of the GNU Lesser General Public License as published by the Free Software
+ * Foundation; either version 2.1 of the License, or (at your option) any later
+ * version.
+ *
+ * This library is distributed in the hope that it will be useful, but WITHOUT ANY
+ * WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A
+ * PARTICULAR PURPOSE. See the GNU Lesser General Public License for more details.
+ *
+ * You should have received a copy of the GNU Lesser General Public License along
+ * with this library; if not, write to the Free Software Foundation, Inc.,
+ * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+ *
+ * @author The Red5 Project (red5 at osflash.org)
+ * @author Luke Hubbard, Codegent Ltd (luke at codegent.com)
+ */
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.red5.io.utils.HexDump;
+import org.red5.server.net.rtmp.RTMPUtils;
+
+public class RTMPUtilsTest extends TestCase {
+
+ protected static Log log = LogFactory.getLog(RTMPUtilsTest.class.getName());
+
+ public void testDecodingHeader() {
+
+ if (log.isDebugEnabled()) {
+ log.debug("Testing");
+ /*
+ log.debug(""+(0x03 >> 6));
+ log.debug(""+(0x43 >> 6));
+ log.debug(""+(0x83 >> 6));
+ log.debug(""+((byte)(((byte)0xC3) >> 6)));
+ */
+ }
+ byte test;
+ test = 0x03;
+ if (log.isDebugEnabled()) {
+ log.debug(HexDump.byteArrayToHexString(new byte[] { test }));
+ log.debug("" + test);
+ log.debug("" + RTMPUtils.decodeHeaderSize(test, 1));
+ }
+ test = (byte) (0x43);
+ if (log.isDebugEnabled()) {
+ log.debug(HexDump.byteArrayToHexString(new byte[] { test }));
+ log.debug("" + test);
+ log.debug("" + RTMPUtils.decodeHeaderSize(test, 1));
+ }
+ test = (byte) (0x83);
+ if (log.isDebugEnabled()) {
+ log.debug(HexDump.byteArrayToHexString(new byte[] { test }));
+ log.debug("" + test);
+ log.debug("" + RTMPUtils.decodeHeaderSize(test, 1));
+ }
+ test = (byte) (0xC3 - 256);
+ if (log.isDebugEnabled()) {
+ log.debug(HexDump.byteArrayToHexString(new byte[] { test }));
+ log.debug("" + test);
+ log.debug("" + RTMPUtils.decodeHeaderSize(test, 1));
+ }
+ Assert.assertEquals(true, false);
+ }
+
+}
Index: /java/server/tags/0_6_2/test/org/red5/server/rtmp/RTMPTestCase.java
===================================================================
--- /java/server/tags/0_6_2/test/org/red5/server/rtmp/RTMPTestCase.java (revision 1978)
+++ /java/server/tags/0_6_2/test/org/red5/server/rtmp/RTMPTestCase.java (revision 1978)
@@ -0,0 +1,61 @@
+package org.red5.server.rtmp;
+
+import junit.framework.Assert;
+import junit.framework.TestCase;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.mina.common.ByteBuffer;
+import org.red5.io.object.Deserializer;
+import org.red5.io.object.Serializer;
+import org.red5.server.net.rtmp.codec.RTMPProtocolDecoder;
+import org.red5.server.net.rtmp.codec.RTMPProtocolEncoder;
+import org.red5.server.net.rtmp.event.Invoke;
+import org.red5.server.net.rtmp.message.Constants;
+import org.red5.server.net.rtmp.message.Header;
+
+public class RTMPTestCase extends TestCase implements Constants {
+
+ protected static Log log = LogFactory.getLog(RTMPTestCase.class.getName());
+
+ protected RTMPProtocolDecoder decoder;
+
+ protected Deserializer deserializer;
+
+ protected RTMPProtocolEncoder encoder;
+
+ protected Serializer serializer;
+
+ /** {@inheritDoc} */
+ @Override
+ protected void setUp() throws Exception {
+ // TODO Auto-generated method stub
+ super.setUp();
+ serializer = new Serializer();
+ deserializer = new Deserializer();
+ encoder = new RTMPProtocolEncoder();
+ decoder = new RTMPProtocolDecoder();
+ encoder.setSerializer(serializer);
+ decoder.setDeserializer(deserializer);
+ }
+
+ public void testHeaders() {
+ Header header = new Header();
+ header.setChannelId((byte) 0x12);
+ header.setDataType(TYPE_INVOKE);
+ header.setStreamId(100);
+ header.setTimer(2);
+ header.setSize(320);
+ ByteBuffer buf = encoder.encodeHeader(header, null);
+ buf.flip();
+ log.debug(buf.getHexDump());
+ Assert.assertNotNull(buf);
+ Header result = decoder.decodeHeader(buf, null);
+ Assert.assertEquals(header, result);
+ }
+
+ public void testInvokePacket() {
+ Invoke invoke = new Invoke();
+ }
+
+}
Index: /java/server/tags/0_6_2/test/org/red5/server/script/ScriptEngineTest.java
===================================================================
--- /java/server/tags/0_6_2/test/org/red5/server/script/ScriptEngineTest.java (revision 1981)
+++ /java/server/tags/0_6_2/test/org/red5/server/script/ScriptEngineTest.java (revision 1981)
@@ -0,0 +1,286 @@
+package org.red5.server.script;
+
+import static org.junit.Assert.assertFalse;
+
+import java.util.HashMap;
+import java.util.Map;
+
+import javax.script.ScriptEngine;
+import javax.script.ScriptEngineFactory;
+import javax.script.ScriptEngineManager;
+
+import org.apache.log4j.Logger;
+import org.junit.Test;
+
+/**
+ * Simple script engine tests. Some of the hello world scripts found here:
+ * http://www.roesler-ac.de/wolfram/hello.htm
+ *
+ * @author paul.gregoire
+ */
+public class ScriptEngineTest {
+
+ private static final Logger log = Logger.getLogger(ScriptEngineTest.class);
+
+ // ScriptEngine manager
+ private static ScriptEngineManager mgr = new ScriptEngineManager();
+
+ // Javascript
+ @Test
+ public void testJavascriptHelloWorld() {
+ ScriptEngine jsEngine = null;
+ for (ScriptEngineFactory factory : mgr.getEngineFactories()) {
+ if (factory.getEngineName().toLowerCase().matches(
+ ".*(rhino|javascript|ecma).*")) {
+ jsEngine = factory.getScriptEngine();
+ }
+ }
+ if (null == jsEngine) {
+ log.fatal("Javascript is not supported in this build");
+ }
+ /*
+ try {
+ jsEngine = mgr.getEngineByName("javascript");
+ jsEngine.eval("print('Javascript - Hello, world!')");
+ } catch (Throwable ex) {
+ System.err.println("Get by name failed for: javascript");
+ //ex.printStackTrace();
+ jsEngine = null;
+ }
+ if (null == jsEngine) {
+ try {
+ jsEngine = mgr.getEngineByName("rhino");
+ jsEngine.eval("print('Javascript/Rhino - Hello, world!')");
+ } catch (Throwable ex) {
+ System.err.println("Get by name failed for: rhino");
+ //ex.printStackTrace();
+ assertFalse(true);
+ }
+ }
+ */
+ }
+
+ // Ruby
+ @Test
+ public void testRubyHelloWorld() {
+ ScriptEngine rbEngine = mgr.getEngineByName("ruby");
+ try {
+ rbEngine.eval("puts 'Ruby - Hello, world!'");
+ } catch (Exception ex) {
+ //ex.printStackTrace();
+ assertFalse(true);
+ }
+ }
+
+ // Python
+ @Test
+ public void testPythonHelloWorld() {
+ ScriptEngine pyEngine = mgr.getEngineByName("python");
+ try {
+ pyEngine.eval("print \"Python - Hello, world!\"");
+ } catch (Exception ex) {
+ //ex.printStackTrace();
+ assertFalse(true);
+ }
+ }
+
+ // Groovy
+ @Test
+ public void testGroovyHelloWorld() {
+ ScriptEngine gvyEngine = mgr.getEngineByName("groovy");
+ try {
+ gvyEngine.eval("println \"Groovy - Hello, world!\"");
+ } catch (Exception ex) {
+ //ex.printStackTrace();
+ assertFalse(true);
+ }
+ }
+
+ // Judoscript
+ // @Test
+ // public void testJudoscriptHelloWorld() {
+ // ScriptEngine jdEngine = mgr.getEngineByName("judo");
+ // try {
+ // jdEngine.eval(". \'Judoscript - Hello World\';");
+ // } catch (Exception ex) {
+ // //ex.printStackTrace();
+ // assertFalse(true);
+ // }
+ // }
+
+ // Haskell
+ // @Test
+ // public void testHaskellHelloWorld()
+ // {
+ // ScriptEngine hkEngine = mgr.getEngineByName("jaskell");
+ // try
+ // {
+ // StringBuilder sb = new StringBuilder();
+ // sb.append("module Hello where ");
+ // sb.append("hello::String ");
+ // sb.append("hello = 'Haskell - Hello World!'");
+ // hkEngine.eval(sb.toString());
+ // }
+ // catch (Exception ex)
+ // {
+ // //ex.printStackTrace();
+ // assertFalse(true);
+ // }
+ // }
+
+ // Tcl
+ // @Test
+ // public void testTclHelloWorld() {
+ // ScriptEngine tEngine = mgr.getEngineByName("tcl");
+ // try {
+ // StringBuilder sb = new StringBuilder();
+ // sb.append("#!/usr/local/bin/tclsh\n");
+ // sb.append("puts \"Tcl - Hello World!\"");
+ // tEngine.eval(sb.toString());
+ // } catch (Exception ex) {
+ // //ex.printStackTrace();
+ // assertFalse(true);
+ // }
+ // }
+
+ // Awk
+ // @Test
+ // public void testAwkHelloWorld()
+ // {
+ // ScriptEngine aEngine = mgr.getEngineByName("awk");
+ // try
+ // {
+ // StringBuilder sb = new StringBuilder();
+ // sb.append("BEGIN { print 'Awk - Hello World!' } END");
+ // aEngine.eval(sb.toString());
+ // }
+ // catch (Exception ex)
+ // {
+ // //ex.printStackTrace();
+ // assertFalse(true);
+ // }
+ // }
+
+ // E4X
+ @Test
+ public void testE4XHelloWorld() {
+ ScriptEngine eEngine = mgr.getEngineByName("rhino");
+ try {
+ //Compilable compiler = (Compilable) eEngine;
+ //CompiledScript script = compiler.compile("var d = new XML('<d><item>Hello</item><item>World!</item></d>');print(d..item);");
+ //Namespace ns = eEngine.createNamespace();
+ //ns.put('d', "new XML('<d><item>Hello</item><item>World!</item></d>');");
+ //System.out.println("E4X - " + script.eval(ns));
+ eEngine
+ .eval("var d = new XML('<d><item>Hello</item><item>World!</item></d>');print('E4X - ' + d..item);");
+ } catch (Exception ex) {
+ //ex.printStackTrace();
+ assertFalse(true);
+ }
+ }
+
+ // PHP
+ // @Test
+ // public void testPHPHelloWorld()
+ // {
+ // //have to add php lib to java env
+ // //java.library.path
+ // //System.setProperty("java.library.path", "C:\\PHP;" +
+ // System.getProperty("java.library.path"));
+ // ScriptEngine pEngine = mgr.getEngineByName("php");
+ // try
+ // {
+ // pEngine.eval("<? echo 'PHP - Hello World'; ?>");
+ // }
+ // catch (Exception ex)
+ // {
+ // //ex.printStackTrace();
+ // assertFalse(true);
+ // }
+ // }
+
+ // @Test
+ // public void testE4X()
+ // {
+ // // Javascript
+ // ScriptEngine jsEngine = mgr.getEngineByName("rhino"
Note:
Diffs are chopped if more than 25k.
This is to get past the limit on the mailing list.
More information about the Red5commits
mailing list