1
0
Fork 0
mirror of https://codeberg.org/Mercury-IM/Smack synced 2024-11-27 00:32:07 +01:00

git-svn-id: http://svn.igniterealtime.org/svn/repos/smack/trunk@7105 b35dd754-fafc-0310-a699-88a17e54d16e

This commit is contained in:
Thiago Camargo 2007-02-14 02:35:22 +00:00 committed by thiago
parent ed660f73e9
commit 4a856a497f
2 changed files with 25 additions and 47 deletions

View file

@ -1,16 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?> <?xml version="1.0" encoding="UTF-8"?>
<module version="4" relativePaths="true" type="JAVA_MODULE"> <module version="4" relativePaths="true" type="JAVA_MODULE">
<component name="BuildJarSettings">
<containerInfo>
<containerElement type="module" name="JingleMedia">
<attribute name="method" value="1" />
<attribute name="URI" value="/" />
</containerElement>
</containerInfo>
<setting name="jarUrl" value="file://$MODULE_DIR$/../../JingleMedia.jar" />
<setting name="buildJar" value="true" />
<setting name="mainClass" value="" />
</component>
<component name="ModuleRootManager" /> <component name="ModuleRootManager" />
<component name="NewModuleRootManager" inherit-compiler-output="false"> <component name="NewModuleRootManager" inherit-compiler-output="false">
<output url="file://$MODULE_DIR$/../../classes" /> <output url="file://$MODULE_DIR$/../../classes" />

View file

@ -4,6 +4,7 @@ import org.jivesoftware.jingleaudio.jmf.JmfMediaManager;
import org.jivesoftware.jingleaudio.jspeex.SpeexMediaManager; import org.jivesoftware.jingleaudio.jspeex.SpeexMediaManager;
import org.jivesoftware.smack.XMPPConnection; import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.XMPPException; import org.jivesoftware.smack.XMPPException;
import org.jivesoftware.smack.test.SmackTestCase;
import org.jivesoftware.smackx.jingle.IncomingJingleSession; import org.jivesoftware.smackx.jingle.IncomingJingleSession;
import org.jivesoftware.smackx.jingle.JingleManager; import org.jivesoftware.smackx.jingle.JingleManager;
import org.jivesoftware.smackx.jingle.JingleSessionRequest; import org.jivesoftware.smackx.jingle.JingleSessionRequest;
@ -37,7 +38,11 @@ import java.net.InetAddress;
* See the License for the specific language governing permissions and * See the License for the specific language governing permissions and
* limitations under the License. * limitations under the License.
*/ */
public class JingleMediaTest extends TestCase { public class JingleMediaTest extends SmackTestCase {
public JingleMediaTest(final String name) {
super(name);
}
public void testCompleteJmf() { public void testCompleteJmf() {
@ -45,13 +50,8 @@ public class JingleMediaTest extends TestCase {
//XMPPConnection.DEBUG_ENABLED = true; //XMPPConnection.DEBUG_ENABLED = true;
XMPPConnection x0 = new XMPPConnection("thiago"); XMPPConnection x0 = getConnection(0);
XMPPConnection x1 = new XMPPConnection("thiago"); XMPPConnection x1 = getConnection(1);
x0.connect();
x0.login("barata7", "barata7");
x1.connect();
x1.login("barata6", "barata6");
ICETransportManager icetm0 = new ICETransportManager(x0, "stun.xten.net", 3478); ICETransportManager icetm0 = new ICETransportManager(x0, "stun.xten.net", 3478);
ICETransportManager icetm1 = new ICETransportManager(x1, "stun.xten.net", 3478); ICETransportManager icetm1 = new ICETransportManager(x1, "stun.xten.net", 3478);
@ -84,11 +84,11 @@ public class JingleMediaTest extends TestCase {
} }
}); });
OutgoingJingleSession js0 = jm0.createOutgoingJingleSession("barata6@thiago/Smack"); OutgoingJingleSession js0 = jm0.createOutgoingJingleSession(x1.getUser());
js0.start(); js0.start();
Thread.sleep(50000); Thread.sleep(60000);
js0.terminate(); js0.terminate();
Thread.sleep(6000); Thread.sleep(6000);
@ -109,13 +109,8 @@ public class JingleMediaTest extends TestCase {
//XMPPConnection.DEBUG_ENABLED = true; //XMPPConnection.DEBUG_ENABLED = true;
XMPPConnection x0 = new XMPPConnection("thiago"); XMPPConnection x0 = getConnection(0);
XMPPConnection x1 = new XMPPConnection("thiago"); XMPPConnection x1 = getConnection(1);
x0.connect();
x0.login("barata7", "barata7");
x1.connect();
x1.login("barata6", "barata6");
final JingleManager jm0 = new JingleManager( final JingleManager jm0 = new JingleManager(
x0, new STUNTransportManager()); x0, new STUNTransportManager());
@ -144,7 +139,7 @@ public class JingleMediaTest extends TestCase {
} }
}); });
OutgoingJingleSession js0 = jm0.createOutgoingJingleSession("barata6@thiago/Smack"); OutgoingJingleSession js0 = jm0.createOutgoingJingleSession(x1.getUser());
js0.start(); js0.start();
@ -171,13 +166,8 @@ public class JingleMediaTest extends TestCase {
public void run() { public void run() {
try { try {
XMPPConnection x0 = new XMPPConnection("thiago"); XMPPConnection x0 = getConnection(n);
XMPPConnection x1 = new XMPPConnection("thiago"); XMPPConnection x1 = getConnection(n + 1);
x0.connect();
x0.login("user" + String.valueOf(n), "user" + String.valueOf(n));
x1.connect();
x1.login("user" + String.valueOf(n + 1), "user" + String.valueOf(n + 1));
BridgedTransportManager btm0 = new BridgedTransportManager(x0); BridgedTransportManager btm0 = new BridgedTransportManager(x0);
BridgedTransportManager btm1 = new BridgedTransportManager(x1); BridgedTransportManager btm1 = new BridgedTransportManager(x1);
@ -209,7 +199,7 @@ public class JingleMediaTest extends TestCase {
} }
}); });
OutgoingJingleSession js0 = jm0.createOutgoingJingleSession("user" + String.valueOf(n + 1) + "@thiago/Smack"); OutgoingJingleSession js0 = jm0.createOutgoingJingleSession(x1.getUser());
js0.start(); js0.start();
@ -236,7 +226,7 @@ public class JingleMediaTest extends TestCase {
Thread.sleep(250000); Thread.sleep(250000);
} }
catch (InterruptedException e) { catch (InterruptedException e) {
e.printStackTrace(); //To change body of catch statement use File | Settings | File Templates. e.printStackTrace();
} }
} }
@ -245,13 +235,8 @@ public class JingleMediaTest extends TestCase {
//XMPPConnection.DEBUG_ENABLED = true; //XMPPConnection.DEBUG_ENABLED = true;
XMPPConnection x0 = new XMPPConnection("thiago"); XMPPConnection x0 = getConnection(0);
XMPPConnection x1 = new XMPPConnection("thiago"); XMPPConnection x1 = getConnection(1);
x0.connect();
x0.login("barata5", "barata5");
x1.connect();
x1.login("barata4", "barata4");
BridgedTransportManager btm0 = new BridgedTransportManager(x0); BridgedTransportManager btm0 = new BridgedTransportManager(x0);
BridgedTransportManager btm1 = new BridgedTransportManager(x1); BridgedTransportManager btm1 = new BridgedTransportManager(x1);
@ -283,7 +268,7 @@ public class JingleMediaTest extends TestCase {
} }
}); });
OutgoingJingleSession js0 = jm0.createOutgoingJingleSession("barata4@thiago/Smack"); OutgoingJingleSession js0 = jm0.createOutgoingJingleSession(x1.getUser());
js0.start(); js0.start();
@ -293,7 +278,7 @@ public class JingleMediaTest extends TestCase {
Thread.sleep(3000); Thread.sleep(3000);
js0 = jm0.createOutgoingJingleSession("barata4@thiago/Smack"); js0 = jm0.createOutgoingJingleSession(x1.getUser());
js0.start(); js0.start();
@ -380,4 +365,8 @@ public class JingleMediaTest extends TestCase {
e.printStackTrace(); e.printStackTrace();
} }
} }
protected int getMaxConnections() {
return 2;
}
} }