|
From: <tre...@us...> - 2008-01-30 22:44:08
|
Revision: 699
http://ogoglio.svn.sourceforge.net/ogoglio/?rev=699&view=rev
Author: trevorolio
Date: 2008-01-30 14:44:12 -0800 (Wed, 30 Jan 2008)
Log Message:
-----------
Added the requested IP number to the service doc so the applet can work against round robin dns clusters, on Windows, in Firefox. Also tweaked the renderer graphics config to indicate a lowest level of texture bit depth, which also has the nice side effect of making the card use higher bit depth if possible.
Modified Paths:
--------------
maven/trunk/ogoglio-integration-test/src/test/java/com/ogoglio/client/test/AppletTestWindow.java
maven/trunk/ogoglio-integration-test/src/test/java/com/ogoglio/client/test/ClientTest.java
Modified: maven/trunk/ogoglio-integration-test/src/test/java/com/ogoglio/client/test/AppletTestWindow.java
===================================================================
--- maven/trunk/ogoglio-integration-test/src/test/java/com/ogoglio/client/test/AppletTestWindow.java 2008-01-30 22:43:45 UTC (rev 698)
+++ maven/trunk/ogoglio-integration-test/src/test/java/com/ogoglio/client/test/AppletTestWindow.java 2008-01-30 22:44:12 UTC (rev 699)
@@ -21,10 +21,12 @@
import java.awt.Frame;
import java.awt.GraphicsDevice;
import java.awt.GraphicsEnvironment;
+import java.net.InetAddress;
import java.net.MalformedURLException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;
+import java.net.UnknownHostException;
import java.util.HashMap;
import com.ogoglio.client.WebAPIAuthenticator;
@@ -39,14 +41,14 @@
public static final String TEST_HELP_MESSAGE = "This is the help message.\nDo you feel helped?";
Dimension appDimension = new Dimension(500, 500);
-
+
public ViewerApplet applet = null;
EnvironmentStub clientStub1 = null;
URI serviceURI = null;
- public AppletTestWindow(URI serviceURI, long spaceID, String authCookie, Dimension appDimension, boolean fullScreen) {
+ public AppletTestWindow(URI serviceURI, long spaceID, String serverIP, String authCookie, Dimension appDimension, boolean fullScreen) {
ArgumentUtils.assertNotNull(appDimension);
this.appDimension = appDimension;
ArgumentUtils.assertNotNull(serviceURI);
@@ -63,6 +65,7 @@
parameters1.put("loginCookie", authCookie);
parameters1.put("spaceID", "" + spaceID);
parameters1.put("serviceURI", serviceURI.toString());
+ parameters1.put("serverIP", serverIP);
parameters1.put("helpMessage", TEST_HELP_MESSAGE);
@@ -159,18 +162,19 @@
}
}
- long spaceID = Long.parseLong(System.getProperty("AppletTestWindow.space"));
-
try {
- AppletTestWindow test = new AppletTestWindow(new URI(serviceURI), spaceID, loginCookie, dim, fullScreen);
+ long spaceID = Long.parseLong(System.getProperty("AppletTestWindow.space"));
+ URI actualServiceURI = URI.create(serviceURI);
+ String serverIP = InetAddress.getByName(actualServiceURI.getHost()).getHostAddress();
+ AppletTestWindow test = new AppletTestWindow(actualServiceURI, spaceID, serverIP, loginCookie, dim, fullScreen);
test.setVisible(true);
if (fullScreen) {
device.setFullScreenWindow(test);
}
test.start();
- } catch (URISyntaxException e) {
+ } catch (UnknownHostException e) {
+ // TODO Auto-generated catch block
e.printStackTrace();
- System.exit(1);
}
}
}
Modified: maven/trunk/ogoglio-integration-test/src/test/java/com/ogoglio/client/test/ClientTest.java
===================================================================
--- maven/trunk/ogoglio-integration-test/src/test/java/com/ogoglio/client/test/ClientTest.java 2008-01-30 22:43:45 UTC (rev 698)
+++ maven/trunk/ogoglio-integration-test/src/test/java/com/ogoglio/client/test/ClientTest.java 2008-01-30 22:44:12 UTC (rev 699)
@@ -22,9 +22,11 @@
import java.io.IOException;
import java.io.InputStream;
import java.io.LineNumberReader;
+import java.net.InetAddress;
import java.net.Socket;
import java.net.URI;
import java.net.URISyntaxException;
+import java.net.UnknownHostException;
import java.text.DateFormat;
import java.text.ParseException;
import java.util.Date;
@@ -209,15 +211,15 @@
serviceStateDoc = adminWebClient.setRegistrationState(ServiceStateDocument.REGISTRATION_STATE_OPEN);
assertEquals(ServiceStateDocument.REGISTRATION_STATE_OPEN, serviceStateDoc.getRegistrationState());
- assertNotNull(adminWebClient.createAccount("shouldexist" + System.currentTimeMillis(), AccountDocument.ACCOUNT_LEVEL_BASIC, "Test", "Sims", null, "foo"+System.currentTimeMillis() + "@example.com", "1234"));
- assertNotNull(basicWebClient.createAccount("shouldexist" + System.currentTimeMillis(), AccountDocument.ACCOUNT_LEVEL_BASIC, "Test", "Sims", null, "foo"+System.currentTimeMillis() + "@example.com", "1234"));
- assertNotNull(guestWebClient.createAccount("shouldexist" + System.currentTimeMillis(), AccountDocument.ACCOUNT_LEVEL_BASIC, "Test", "Sims", null, "foo"+System.currentTimeMillis() + "@example.com", "1234"));
+ assertNotNull(adminWebClient.createAccount("shouldexist" + System.currentTimeMillis(), AccountDocument.ACCOUNT_LEVEL_BASIC, "Test", "Sims", null, "foo" + System.currentTimeMillis() + "@example.com", "1234"));
+ assertNotNull(basicWebClient.createAccount("shouldexist" + System.currentTimeMillis(), AccountDocument.ACCOUNT_LEVEL_BASIC, "Test", "Sims", null, "foo" + System.currentTimeMillis() + "@example.com", "1234"));
+ assertNotNull(guestWebClient.createAccount("shouldexist" + System.currentTimeMillis(), AccountDocument.ACCOUNT_LEVEL_BASIC, "Test", "Sims", null, "foo" + System.currentTimeMillis() + "@example.com", "1234"));
serviceStateDoc = adminWebClient.setRegistrationState(ServiceStateDocument.REGISTRATION_STATE_ADMIN_ONLY);
assertEquals(ServiceStateDocument.REGISTRATION_STATE_ADMIN_ONLY, serviceStateDoc.getRegistrationState());
- assertNotNull(adminWebClient.createAccount("shouldexist" + System.currentTimeMillis(), AccountDocument.ACCOUNT_LEVEL_BASIC, "Test", "Sims", null, "foo"+System.currentTimeMillis() + "@example.com", "1234"));
- assertNull(basicWebClient.createAccount("shouldnotexist" + System.currentTimeMillis(), AccountDocument.ACCOUNT_LEVEL_BASIC, "Test", "Sims", null, "foo"+System.currentTimeMillis() + "@example.com", "1234"));
- assertNull(guestWebClient.createAccount("shouldnotexist" + System.currentTimeMillis(), AccountDocument.ACCOUNT_LEVEL_BASIC, "Test", "Sims", null, "foo"+System.currentTimeMillis() + "@example.com", "1234"));
+ assertNotNull(adminWebClient.createAccount("shouldexist" + System.currentTimeMillis(), AccountDocument.ACCOUNT_LEVEL_BASIC, "Test", "Sims", null, "foo" + System.currentTimeMillis() + "@example.com", "1234"));
+ assertNull(basicWebClient.createAccount("shouldnotexist" + System.currentTimeMillis(), AccountDocument.ACCOUNT_LEVEL_BASIC, "Test", "Sims", null, "foo" + System.currentTimeMillis() + "@example.com", "1234"));
+ assertNull(guestWebClient.createAccount("shouldnotexist" + System.currentTimeMillis(), AccountDocument.ACCOUNT_LEVEL_BASIC, "Test", "Sims", null, "foo" + System.currentTimeMillis() + "@example.com", "1234"));
String username = "testuser" + Math.abs(new Random().nextLong());
AccountDocument accountDoc = adminWebClient.createAccount(username, AccountDocument.ACCOUNT_LEVEL_BASIC, "Test", "Sims", null, username + "@example.com", "1234");
@@ -231,7 +233,7 @@
StreamUtils.discardInput(wire1.performGET(URI.create(emailValidationURL), null));
accountDoc = adminWebClient.getAccountDocument(username);
assertTrue(accountDoc.isEmailValid());
-
+
Date frozenDate = new Date(System.currentTimeMillis() + 1000000);
accountDoc.setFrozenUntil(frozenDate);
accountDoc.setAccountLevel(AccountDocument.ACCOUNT_LEVEL_ADMIN);
@@ -298,22 +300,22 @@
public boolean accept(File dir, String name) {
return name.startsWith("Mail-Message-");
}
-
+
});
File emailFile = null;
for (int i = 0; i < mailFiles.length; i++) {
- if(containsString(email, mailFiles[i])){
+ if (containsString(email, mailFiles[i])) {
emailFile = mailFiles[i];
break;
}
}
- if(emailFile == null){
+ if (emailFile == null) {
return null;
}
LineNumberReader input = new LineNumberReader(new FileReader(emailFile));
String line;
- while((line = input.readLine()) != null){
- if(line.startsWith("http://")){
+ while ((line = input.readLine()) != null) {
+ if (line.startsWith("http://")) {
return line.trim();
}
}
@@ -323,14 +325,14 @@
private boolean containsString(String target, File file) throws IOException {
LineNumberReader input = new LineNumberReader(new FileReader(file));
String line;
- while((line = input.readLine()) != null){
- if(line.indexOf(target) != -1){
+ while ((line = input.readLine()) != null) {
+ if (line.indexOf(target) != -1) {
return true;
}
}
return false;
}
-
+
public void testWebAPIClient() throws IOException {
SpaceClient spaceClient1 = null;
SpaceClient guestSpaceClient1 = null;
@@ -443,7 +445,7 @@
}
- public void testApplet() throws AuthenticationFailedException, IOException {
+ public void testApplet() throws AuthenticationFailedException, IOException, UnknownHostException {
WebAPIAuthenticator basicAuthenticator = new WebAPIAuthenticatorFactory().authenticate(wire1, descriptor1, USERNAME1, PASSWORD1);
assertNotNull("got null auth cookie", basicAuthenticator.getAuthCookie());
WebAPIClient basicWebClient = new WebAPIClient(descriptor1, basicAuthenticator, wire1);
@@ -477,11 +479,11 @@
assertEquals(basicAuthenticator.getAuthDocument(true).getUsername(), testWindow.applet.getUsername());
testWindow.cleanup();
testWindow.setVisible(false);
-
+
BodyAppletTestWindow bodyWindow = openBodyAppletTestWindow(basicAuthenticator);
bodyWindow.cleanup();
bodyWindow.setVisible(false);
-
+
basicWebClient.deleteSpace(spaceDocument.getSpaceID());
}
@@ -501,8 +503,10 @@
return bodyWindow;
}
- private AppletTestWindow openAppletTestWindow(SpaceDocument spaceDocument, WebAPIAuthenticator authenticator) {
- AppletTestWindow testWindow = new AppletTestWindow(descriptor1.getServiceURI(), spaceDocument.getSpaceID(), authenticator.getAuthCookie(), new Dimension(500, 500), true);
+ private AppletTestWindow openAppletTestWindow(SpaceDocument spaceDocument, WebAPIAuthenticator authenticator) throws UnknownHostException {
+
+ String serverIP = InetAddress.getByName(descriptor1.getServiceURI().getHost()).getHostAddress();
+ AppletTestWindow testWindow = new AppletTestWindow(descriptor1.getServiceURI(), spaceDocument.getSpaceID(), serverIP, authenticator.getAuthCookie(), new Dimension(500, 500), true);
testWindow.setVisible(true);
testWindow.start();
@@ -515,6 +519,7 @@
}
assertTrue(testWindow.applet.completedInitialLoad());
return testWindow;
+
}
private void checkThingScripting(WebAPIClient webClient, ThingDocument thingDocument, SpaceDocument spaceDocument) throws IOException {
@@ -1158,7 +1163,7 @@
public void receivedTellMessage(String username, String message) {
// TODO Auto-generated method stub
-
+
}
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|