|
From: <tre...@us...> - 2007-08-28 23:51:32
|
Revision: 286
http://ogoglio.svn.sourceforge.net/ogoglio/?rev=286&view=rev
Author: trevorolio
Date: 2007-08-28 16:51:30 -0700 (Tue, 28 Aug 2007)
Log Message:
-----------
Moved boostrap info out of common WebConstants into test BootstrapInfo.
Moved the applet test window into this module.
Modified Paths:
--------------
maven/trunk/ogoglio-integration-test/pom.xml
maven/trunk/ogoglio-integration-test/src/test/java/com/ogoglio/client/test/ClientTest.java
Added 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/BootstrapInfo.java
maven/trunk/ogoglio-integration-test/src/test/resources/bootstrapUser.properties
Modified: maven/trunk/ogoglio-integration-test/pom.xml
===================================================================
--- maven/trunk/ogoglio-integration-test/pom.xml 2007-08-28 23:50:41 UTC (rev 285)
+++ maven/trunk/ogoglio-integration-test/pom.xml 2007-08-28 23:51:30 UTC (rev 286)
@@ -9,6 +9,13 @@
<packaging>pom</packaging>
<build>
+ <testResources>
+ <testResource>
+ <targetPath></targetPath>
+ <directory>src/test/resources/</directory>
+ <filtering>true</filtering>
+ </testResource>
+ </testResources>
<plugins>
<!-- COMPILER needed b/c POM packaging by default doesn't build the tests -->
<plugin>
@@ -189,6 +196,11 @@
<artifactId>ogoglio-common</artifactId>
<version>0.0.1</version>
</dependency>
+ <dependency>
+ <groupId>com.ogoglio</groupId>
+ <artifactId>ogoglio-viewer-applet</artifactId>
+ <version>0.0.1</version>
+ </dependency>
</dependencies>
</project>
Added: 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 (rev 0)
+++ maven/trunk/ogoglio-integration-test/src/test/java/com/ogoglio/client/test/AppletTestWindow.java 2007-08-28 23:51:30 UTC (rev 286)
@@ -0,0 +1,150 @@
+/* Copyright 2007 Transmutable (http://transmutable.com/)
+
+ Licensed under the Apache License, Version 2.0 (the "License");
+ you may not use this file except in compliance with the License.
+ You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License. */
+
+package com.ogoglio.client.test;
+
+import java.applet.Applet;
+import java.applet.AppletContext;
+import java.applet.AppletStub;
+import java.awt.BorderLayout;
+import java.awt.Dimension;
+import java.awt.Frame;
+import java.awt.GraphicsDevice;
+import java.awt.GraphicsEnvironment;
+import java.net.MalformedURLException;
+import java.net.URI;
+import java.net.URL;
+import java.util.HashMap;
+
+import com.ogoglio.client.WebAPIAuthenticator;
+import com.ogoglio.client.WebAPIClientWire;
+import com.ogoglio.client.WebAPIDescriptor;
+import com.ogoglio.viewer.applet.ViewerApplet;
+
+public class AppletTestWindow extends Frame {
+
+ //static Dimension appDimension = new Dimension(640, 500);
+ //static Dimension appDimension = new Dimension(500, 522);
+ static Dimension appDimension = new Dimension(1000, 640);
+
+ Applet applet = null;
+
+ EnvironmentStub clientStub1 = null;
+
+ String host = "127.0.0.1:8080";
+
+ String serviceURI = "http://" + host + "/og/";
+
+ URL codeBase = getURL(serviceURI);
+
+ static boolean fullScreen = false;
+
+ public AppletTestWindow() {
+ setLayout(new BorderLayout());
+ setSize(appDimension);
+ setLocation(30, 50);
+ setResizable(false);
+ if (fullScreen) {
+ this.setUndecorated(true);
+ }
+
+ HashMap parameters1 = new HashMap();
+ try {
+ WebAPIAuthenticator authenticator = new WebAPIAuthenticator(new WebAPIClientWire(), new WebAPIDescriptor(new URI(serviceURI)), BootstrapInfo.getBootstrapUsername(), BootstrapInfo.getBootstrapUserPW());
+ parameters1.put("loginCookie", authenticator.getAuthCookie());
+ } catch (Exception e) {
+ e.printStackTrace();
+ }
+ //parameters1.put("loginCookie", "guestApplet_Test_Window2");
+
+ parameters1.put("spaceID", "" + 4);
+ parameters1.put("serviceURI", serviceURI);
+
+ //parameters1.put("x", "0");
+ //parameters1.put("y", "1000");
+ //parameters1.put("z", "0");
+ //parameters1.put("rx", "-1.6");
+ //parameters1.put("ry", "0");
+ //parameters1.put("rz", "0");
+
+ //parameters1.put("movable", "false");
+
+ clientStub1 = new EnvironmentStub(parameters1);
+ applet = new ViewerApplet();
+ //applet = new BodyEditorApplet();
+ applet.setStub(clientStub1);
+ add(applet, BorderLayout.CENTER);
+ }
+
+ private class EnvironmentStub implements AppletStub {
+
+ HashMap parameters = null;
+
+ public EnvironmentStub(HashMap parameters) {
+ this.parameters = parameters;
+ }
+
+ public void appletResize(int width, int height) {
+ }
+
+ public AppletContext getAppletContext() {
+ return null;
+ }
+
+ public URL getCodeBase() {
+ return codeBase;
+ }
+
+ public URL getDocumentBase() {
+ return codeBase;
+ }
+
+ public String getParameter(String name) {
+ return (String) parameters.get(name);
+ }
+
+ public boolean isActive() {
+ return true;
+ }
+
+ }
+
+ public void start() {
+ applet.init();
+ applet.start();
+ }
+
+ private static URL getURL(String url) {
+ try {
+ return new URL(url);
+ } catch (MalformedURLException e) {
+ throw new IllegalStateException("Bad url: " + url);
+ }
+ }
+
+ public static void main(String[] args) {
+ GraphicsEnvironment graphicsEnv = GraphicsEnvironment.getLocalGraphicsEnvironment();
+ GraphicsDevice device = graphicsEnv.getDefaultScreenDevice();
+ if (fullScreen) {
+ appDimension = new Dimension(device.getDisplayMode().getWidth(), device.getDisplayMode().getWidth());
+ }
+ AppletTestWindow test = new AppletTestWindow();
+ test.setVisible(true);
+ if (fullScreen) {
+ device.setFullScreenWindow(test);
+ }
+ test.start();
+ }
+
+}
Added: maven/trunk/ogoglio-integration-test/src/test/java/com/ogoglio/client/test/BootstrapInfo.java
===================================================================
--- maven/trunk/ogoglio-integration-test/src/test/java/com/ogoglio/client/test/BootstrapInfo.java (rev 0)
+++ maven/trunk/ogoglio-integration-test/src/test/java/com/ogoglio/client/test/BootstrapInfo.java 2007-08-28 23:51:30 UTC (rev 286)
@@ -0,0 +1,40 @@
+package com.ogoglio.client.test;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Properties;
+
+public class BootstrapInfo {
+ private static Properties bootstrapProps=null;
+
+ public static String getBootstrapUsername() {
+ if (bootstrapProps==null) {
+ fetchBootstrapProps();
+ }
+ return bootstrapProps.getProperty("bootstrapUser");
+ }
+
+ public static String getBootstrapUserPW() {
+ if (bootstrapProps==null) {
+ fetchBootstrapProps();
+ }
+ return bootstrapProps.getProperty("bootstrapUserPW");
+ }
+
+ private static void fetchBootstrapProps() {
+ InputStream str=(new BootstrapInfo().getClass()).getResourceAsStream("/bootstrapUser.properties");
+ if (str==null) {
+ System.out.println("Unable to load bootstrapUser.properties!");
+ bootstrapProps=new Properties();
+ } else {
+ try {
+ bootstrapProps=new Properties();
+ bootstrapProps.load(str);
+ } catch (IOException e) {
+ System.out.println("Unable to load bootstrapUser.properties due to IOException:"+e.getMessage());
+ bootstrapProps=new Properties();
+ }
+ }
+ }
+
+}
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 2007-08-28 23:50:41 UTC (rev 285)
+++ maven/trunk/ogoglio-integration-test/src/test/java/com/ogoglio/client/test/ClientTest.java 2007-08-28 23:51:30 UTC (rev 286)
@@ -97,7 +97,7 @@
public void testWebAdmin() {
try {
- WebAPIAuthenticator adminAuthenticator = new WebAPIAuthenticatorFactory().authenticate(wire1, descriptor1, WebConstants.getBootstrapUsername(), WebConstants.getBootstrapUserPW());
+ WebAPIAuthenticator adminAuthenticator = new WebAPIAuthenticatorFactory().authenticate(wire1, descriptor1, BootstrapInfo.getBootstrapUsername(), BootstrapInfo.getBootstrapUserPW());
assertNotNull("got null auth cookie", adminAuthenticator.getAuthCookie());
WebAPIClient adminWebClient = new WebAPIClient(descriptor1, adminAuthenticator, wire1);
Added: maven/trunk/ogoglio-integration-test/src/test/resources/bootstrapUser.properties
===================================================================
--- maven/trunk/ogoglio-integration-test/src/test/resources/bootstrapUser.properties (rev 0)
+++ maven/trunk/ogoglio-integration-test/src/test/resources/bootstrapUser.properties 2007-08-28 23:51:30 UTC (rev 286)
@@ -0,0 +1,2 @@
+bootstrapUser=${ogoglio.bootstrapUser}
+bootstrapUserPW=${ogoglio.bootstrapUserPW}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
|