aboutsummaryrefslogtreecommitdiff
path: root/src/java/com/e1/pdj/test
diff options
context:
space:
mode:
authorIOhannes m zmölnig <zmoelnig@users.sourceforge.net>2009-07-19 15:56:13 +0000
committerIOhannes m zmölnig <zmoelnig@users.sourceforge.net>2009-07-19 15:56:13 +0000
commit5d63b1b2a6968f9c0146e1946b72ca6073370fbe (patch)
treed8c9ef35e0f68c95aac11ebd1decd345ba1f82a8 /src/java/com/e1/pdj/test
parent0f770551cebca90c92b7a39b0e0135a445af51f9 (diff)
svn path=/trunk/externals/loaders/pdj/; revision=11874
Diffstat (limited to 'src/java/com/e1/pdj/test')
-rw-r--r--src/java/com/e1/pdj/test/CallbackTest.java12
-rw-r--r--src/java/com/e1/pdj/test/NetTest.java55
2 files changed, 66 insertions, 1 deletions
diff --git a/src/java/com/e1/pdj/test/CallbackTest.java b/src/java/com/e1/pdj/test/CallbackTest.java
index 4105479..526a5f4 100644
--- a/src/java/com/e1/pdj/test/CallbackTest.java
+++ b/src/java/com/e1/pdj/test/CallbackTest.java
@@ -1,10 +1,20 @@
package com.e1.pdj.test;
+import com.cycling74.max.*;
import junit.framework.TestCase;
public class CallbackTest extends TestCase {
- public void testSomething() {
+
+
+ public void testArgs() {
+ Callback callback = new Callback(this, "callme", new Object[] { new Integer[0] });
+ Integer[] args = new Integer[] { new Integer(1), new Integer(2) };
+ callback.setArgs((Object[]) args);
+ callback.execute();
+ }
+
+ public void callme(Integer args[]) {
}
}
diff --git a/src/java/com/e1/pdj/test/NetTest.java b/src/java/com/e1/pdj/test/NetTest.java
new file mode 100644
index 0000000..01b103a
--- /dev/null
+++ b/src/java/com/e1/pdj/test/NetTest.java
@@ -0,0 +1,55 @@
+package com.e1.pdj.test;
+
+import com.cycling74.max.*;
+import com.cycling74.net.*;
+import junit.framework.TestCase;
+
+public class NetTest extends TestCase {
+ Atom value[];
+
+ public void testUDP() {
+ UdpReceiver receive = new UdpReceiver(7500);
+ receive.setCallback(this, "callback_test");
+ receive.setActive(true);
+
+ value = null;
+
+ UdpSender send = new UdpSender("localhost", 7500);
+ send.send(7500);
+
+ try {
+ Thread.sleep(1000);
+ } catch ( InterruptedException e ) {
+ }
+
+ receive.close();
+
+ assertNotNull(value);
+ assertEquals(Integer.parseInt(value[0].toString()), 7500);
+ }
+
+ public void callback_test(Atom args[]) {
+ value = args;
+ }
+
+ public void testTCP() {
+ TcpReceiver receive = new TcpReceiver(7500);
+ receive.setCallback(this, "callback_test");
+ receive.setActive(true);
+
+ value = null;
+
+ TcpSender send = new TcpSender("localhost", 7500);
+ send.send(7500);
+
+ try {
+ Thread.sleep(1000);
+ } catch ( InterruptedException e ) {
+ }
+
+ receive.close();
+
+ assertNotNull(value);
+ assertEquals(Integer.parseInt(value[0].toString()), 7500);
+ }
+}