Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with
or
.
Download ZIP
Browse files

Rename the integration test runner

git-svn-id: https://svn.apache.org/repos/asf/mina/vysper/branches/s2s@1054813 13f79535-47bb-0310-9956-ffa450edef68
  • Loading branch information...
commit 0da14eb77827373f68f2124cdb50beb5559f7cc4 1 parent 3344632
Niklas Gustavsson authored
View
86 ...pp/server/s2s/S2SIntegrationTestCase.java → ...vysper/xmpp/server/s2s/RunS2SServers.java
@@ -19,6 +19,7 @@
import org.apache.vysper.xmpp.server.ServerRuntimeContext;
import org.apache.vysper.xmpp.server.XMPPServer;
import org.jivesoftware.smack.ConnectionConfiguration;
+import org.jivesoftware.smack.ConnectionListener;
import org.jivesoftware.smack.PacketListener;
import org.jivesoftware.smack.XMPPConnection;
import org.jivesoftware.smack.XMPPException;
@@ -30,20 +31,22 @@
import junit.framework.TestCase;
import junit.framework.TestSuite;
-public class S2SIntegrationTestCase extends TestCase {
+public class RunS2SServers extends TestCase {
+ private static final String FILE_FILTER = "s2s-p";
+
public static Test suite() {
File testsDir = new File(".");
File[] testFiles = testsDir.listFiles(new FilenameFilter() {
public boolean accept(File arg0, String name) {
- return name.startsWith("s2s-");
+ return name.startsWith(FILE_FILTER);
}
});
TestSuite suite = new TestSuite("S2S integration tests");
for(File testFile : testFiles) {
try {
- suite.addTest(new S2SIntegrationTestCase(testFile));
+ suite.addTest(new RunS2SServers(testFile));
} catch (IOException e) {
fail(e.getMessage());
}
@@ -54,7 +57,7 @@ public boolean accept(File arg0, String name) {
private File testFile;
private Properties config = new Properties();
- public S2SIntegrationTestCase(File testFile) throws IOException {
+ public RunS2SServers(File testFile) throws IOException {
this.testFile = testFile;
config.load(new FileInputStream(testFile));
}
@@ -69,8 +72,8 @@ protected void runTest() throws Throwable {
String localConnect = config.getProperty("local.connect", localServer.getFullQualifiedName());
Entity localUser = EntityImpl.parseUnchecked(config.getProperty("local.user"));
String localPassword = "password";
- Entity remoteServer = EntityImpl.parseUnchecked(config.getProperty("remote.server"));
- Entity remoteUser = EntityImpl.parseUnchecked(config.getProperty("remote.user"));
+ String remoteServer = config.getProperty("remote.server");
+ String remoteUser = config.getProperty("remote.user");
String remotePassword = config.getProperty("remote.password");
String keystorePath = config.getProperty("keystore.path");
@@ -89,7 +92,8 @@ protected void runTest() throws Throwable {
LinkedBlockingQueue<Packet> localClientPackages = new LinkedBlockingQueue<Packet>();
LinkedBlockingQueue<Packet> remoteClientPackages = new LinkedBlockingQueue<Packet>();
- XMPPConnection localClient = connectClient(localConnect, localUser, localPassword, keystorePath, keystorePassword, localClientPackages);
+ XMPPConnection localClient = connectClient(localConnect, localUser.getFullQualifiedName(), localPassword, keystorePath, keystorePassword, localClientPackages);
+// XMPPConnection localClient = null;
System.out.println();
System.out.println();
@@ -97,7 +101,8 @@ protected void runTest() throws Throwable {
System.out.println();
System.out.println();
- XMPPConnection remoteClient = connectClient(remoteServer.getDomain(), remoteUser, remotePassword, keystorePath, keystorePassword, remoteClientPackages);
+// XMPPConnection remoteClient = connectClient(remoteServer, remoteUser, remotePassword, keystorePath, keystorePassword, remoteClientPackages);
+ XMPPConnection remoteClient = null;
Thread.sleep(3000);
@@ -108,38 +113,38 @@ protected void runTest() throws Throwable {
System.out.println();
remoteClientPackages.clear();
- Message msg = new Message(remoteUser.getFullQualifiedName());
+ Message msg = new Message(remoteUser);
msg.setBody("Hello world");
localClient.sendPacket(msg);
- Packet packet = remoteClientPackages.poll(15000, TimeUnit.MILLISECONDS);
- if(packet != null && packet instanceof Message) {
- System.out.println("!!!!!!" + ((Message)packet).getBody());
- } else {
- fail("Message not received by remote client");
- }
-
- Thread.sleep(3000);
-
- System.out.println();
- System.out.println();
- System.out.println("Sending message from remote to local");
- System.out.println();
- System.out.println();
-
- localClientPackages.clear();
- msg = new Message(localUser.getFullQualifiedName());
- msg.setBody("Hello world");
-
- remoteClient.sendPacket(msg);
-
- packet = localClientPackages.poll(15000, TimeUnit.MILLISECONDS);
- if(packet != null && packet instanceof Message) {
- System.out.println("!!!!!!" + ((Message)packet).getBody());
- } else {
- fail("Message not received by local client");
- }
+// Packet packet = remoteClientPackages.poll(15000, TimeUnit.MILLISECONDS);
+// if(packet != null && packet instanceof Message) {
+// System.out.println("!!!!!!" + ((Message)packet).getBody());
+// } else {
+// fail("Message not received by remote client");
+// }
+//
+// Thread.sleep(3000);
+//
+// System.out.println();
+// System.out.println();
+// System.out.println("Sending message from remote to local");
+// System.out.println();
+// System.out.println();
+//
+// localClientPackages.clear();
+// msg = new Message(localUser.getFullQualifiedName());
+// msg.setBody("Hello world");
+//
+// remoteClient.sendPacket(msg);
+//
+// packet = localClientPackages.poll(15000, TimeUnit.MILLISECONDS);
+// if(packet != null && packet instanceof Message) {
+// System.out.println("!!!!!!" + ((Message)packet).getBody());
+// } else {
+// fail("Message not received by local client");
+// }
Thread.sleep(15000);
System.out.println();
@@ -156,16 +161,17 @@ protected void runTest() throws Throwable {
server.stop();
}
- private XMPPConnection connectClient(String host, Entity user, String password, String keystorePath, String keystorePassword, final LinkedBlockingQueue<Packet> packageQueue)
+ private XMPPConnection connectClient(String host, String user, String password, String keystorePath, String keystorePassword, final LinkedBlockingQueue<Packet> packageQueue)
throws XMPPException {
- ConnectionConfiguration connectionConfiguration = new ConnectionConfiguration(host, 5222);
+// ConnectionConfiguration connectionConfiguration = new ConnectionConfiguration(host, 5222);
+ ConnectionConfiguration connectionConfiguration = new ConnectionConfiguration(host, 5222, "protocol7.com");
connectionConfiguration.setKeystorePath(keystorePath);
connectionConfiguration.setTruststorePath(keystorePath);
connectionConfiguration.setTruststorePassword(keystorePassword);
XMPPConnection client = new XMPPConnection(connectionConfiguration);
-
+
client.connect();
- client.login(user.getNode(), password);
+ client.login(user, password);
client.addPacketListener(new PacketListener() {
public void processPacket(Packet packet) {
System.out.println("# " + packet);
Please sign in to comment.
Something went wrong with that request. Please try again.