[Red5commits] [1638] Created branch from r1637 to work on AMF3 integration. Will require some API cha

jbauch luke at codegent.com
Wed Jan 24 11:12:33 EST 2007


Created branch from r1637 to work on AMF3 integration. Will require some API changes in IO code.


Timestamp: 01/21/07 09:34:44 EST (3 days ago) 
Change: 1638 
Author: jbauch

Files (see diff or trac for details): 
java/server/branches/joachim_amf3_integration


Trac: http://mirror1.cvsdude.com/trac/osflash/red5/changeset/1638

Index: /java/server/branches/joachim_amf3_integration/test/org/red5/server/service/test/TestEchoService.java
===================================================================
--- /java/server/branches/joachim_amf3_integration/test/org/red5/server/service/test/TestEchoService.java (revision 1606)
+++ /java/server/branches/joachim_amf3_integration/test/org/red5/server/service/test/TestEchoService.java (revision 1606)
@@ -0,0 +1,128 @@
+package org.red5.server.service.test;
+
+/*
+ * 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 testEchoBoolean() {
+		boolean b = true;
+		assertTrue(echoService.echoBoolean(b));
+	}
+
+	public void testEchoNumber() {
+		double num = 100;
+		assertEquals(200, echoService.echoNumber(num), echoService
+				.echoNumber(num));
+	}
+
+	public void testEchoString() {
+		String str = "This is a test.";
+		assertEquals("This is a test.", echoService.echoString(str));
+	}
+
+	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 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 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 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 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/branches/joachim_amf3_integration/test/org/red5/server/service/test/testcontext.xml
===================================================================
--- /java/server/branches/joachim_amf3_integration/test/org/red5/server/service/test/testcontext.xml (revision 471)
+++ /java/server/branches/joachim_amf3_integration/test/org/red5/server/service/test/testcontext.xml (revision 471)
@@ -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.server.service.EchoService" init-method="startUp"/>
+	<bean id="serviceInvoker" class="org.red5.server.service.ServiceInvoker" />
+
+</beans>
Index: /java/server/branches/joachim_amf3_integration/test/org/red5/server/service/test/ConversionUtilsTest.java
===================================================================
--- /java/server/branches/joachim_amf3_integration/test/org/red5/server/service/test/ConversionUtilsTest.java (revision 1406)
+++ /java/server/branches/joachim_amf3_integration/test/org/red5/server/service/test/ConversionUtilsTest.java (revision 1406)
@@ -0,0 +1,123 @@
+package org.red5.server.service.test;
+
+/*
+ * 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;
+import org.red5.server.service.ConversionUtils;
+
+// TODO: Add more tests here. 
+
+public class ConversionUtilsTest extends TestCase {
+
+	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 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);
+	}
+
+	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);
+
+	}
+
+	class TestJavaBean {
+
+	}
+
+}
Index: /java/server/branches/joachim_amf3_integration/test/org/red5/server/service/test/ServiceInvokerTest.java
===================================================================
--- /java/server/branches/joachim_amf3_integration/test/org/red5/server/service/test/ServiceInvokerTest.java (revision 1606)
+++ /java/server/branches/joachim_amf3_integration/test/org/red5/server/service/test/ServiceInvokerTest.java (revision 1606)
@@ -0,0 +1,101 @@
+package org.red5.server.service.test;
+
+/*
+ * 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.server.service.Call;
+import org.red5.server.service.PendingCall;
+import org.red5.server.service.ServiceInvoker;
+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/test/testcontext.xml");
+	}
+
+	public void testAppContextLoaded() {
+		Assert.assertNotNull(appCtx);
+		Assert.assertNotNull(appCtx.getBean("serviceInvoker"));
+		Assert.assertNotNull(appCtx.getBean("echoService"));
+	}
+
+	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]);
+	}
+
+	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);
+	}
+
+	/** {@inheritDoc} */
+    @Override
+	protected void tearDown() throws Exception {
+		// TODO Auto-generated method stub
+		super.tearDown();
+
+	}
+
+}
Index: /java/server/branches/joachim_amf3_integration/test/org/red5/server/rtmp/test/RTMPUtilsTest.java
===================================================================
--- /java/server/branches/joachim_amf3_integration/test/org/red5/server/rtmp/test/RTMPUtilsTest.java (revision 1519)
+++ /java/server/branches/joachim_amf3_integration/test/org/red5/server/rtmp/test/RTMPUtilsTest.java (revision 1519)
@@ -0,0 +1,76 @@
+package org.red5.server.rtmp.test;
+
+/*
+ * 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 = (byte) (0x03);
+		if (log.isDebugEnabled()) {
+			log.debug(HexDump.byteArrayToHexString(new byte[] { test }));
+			log.debug("" + test);
+			log.debug("" + RTMPUtils.decodeHeaderSize(test));
+		}
+		test = (byte) (0x43);
+		if (log.isDebugEnabled()) {
+			log.debug(HexDump.byteArrayToHexString(new byte[] { test }));
+			log.debug("" + test);
+			log.debug("" + RTMPUtils.decodeHeaderSize(test));
+		}
+		test = (byte) (0x83);
+		if (log.isDebugEnabled()) {
+			log.debug(HexDump.byteArrayToHexString(new byte[] { test }));
+			log.debug("" + test);
+			log.debug("" + RTMPUtils.decodeHeaderSize(test));
+		}
+		test = (byte) (0xC3 - 256);
+		if (log.isDebugEnabled()) {
+			log.debug(HexDump.byteArrayToHexString(new byte[] { test }));
+			log.debug("" + test);
+			log.debug("" + RTMPUtils.decodeHeaderSize(test));
+		}
+		Assert.assertEquals(true, false);
+	}
+
+}
Index: /java/server/branches/joachim_amf3_integration/test/org/red5/server/rtmp/test/RTMPTestCase.java
===================================================================
--- /java/server/branches/joachim_amf3_integration/test/org/red5/server/rtmp/test/RTMPTestCase.java (revision 1606)
+++ /java/server/branches/joachim_amf3_integration/test/org/red5/server/rtmp/test/RTMPTestCase.java (revision 1606)
@@ -0,0 +1,61 @@
+package org.red5.server.rtmp.test;
+
+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 Serializer serializer;
+
+	protected Deserializer deserializer;
+
+	protected RTMPProtocolEncoder encoder;
+
+	protected RTMPProtocolDecoder decoder;
+
+	/** {@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/branches/joachim_amf3_integration/test/org/red5/server/script/ScriptEngineTest.java
===================================================================
--- /java/server/branches/joachim_amf3_integration/test/org/red5/server/script/ScriptEngineTest.java (revision 1625)
+++ /java/server/branches/joachim_amf3_integration/test/org/red5/server/script/ScriptEngineTest.java (revision 1625)
@@ -0,0 +1,281 @@
+package org.red5.server.script;
+
+import static org.junit.Assert.assertFalse;
+
+import java.util.HashMap;
+import java.util.List;
+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;
+		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();
+			//assertFalse(true);
+			jsEngine = null;
+		}
+		if (null == jsEngine) {
+			try {
+				jsEngine = mgr.getEngineByName("rhino");
+				jsEngine.eval("print('Javascript - 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()
+	// 

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