[openwonderland-modules] r2028 committed - Fix for testing framework issues

1 view
Skip to first unread message

openwonderl...@googlecode.com

unread,
Sep 2, 2014, 2:46:01 AM9/2/14
to openwonder...@googlegroups.com
Revision: 2028
Author: abhishek...@wishtreetech.com
Date: Tue Sep 2 06:45:24 2014 UTC
Log: Fix for testing framework issues
https://code.google.com/p/openwonderland-modules/source/detail?r=2028

Modified:
/trunk/0.5/unstable/client-test/build.xml

/trunk/0.5/unstable/client-test/src/classes/org/jdesktop/wonderland/modules/clienttest/test/ui/AudioUtils.java

/trunk/0.5/unstable/client-test/src/classes/org/jdesktop/wonderland/modules/clienttest/test/ui/GraphicsUtils.java

/trunk/0.5/unstable/client-test/src/classes/org/jdesktop/wonderland/modules/clienttest/test/ui/ModelTestFrame.form

/trunk/0.5/unstable/client-test/src/classes/org/jdesktop/wonderland/modules/clienttest/test/ui/ModelTestFrame.java

/trunk/0.5/unstable/client-test/src/classes/org/jdesktop/wonderland/modules/clienttest/test/ui/SubmitLogFrame.form

/trunk/0.5/unstable/client-test/src/classes/org/jdesktop/wonderland/modules/clienttest/test/ui/SubmitLogFrame.java

/trunk/0.5/unstable/client-test/src/classes/org/jdesktop/wonderland/modules/clienttest/test/ui/TestManager.java

/trunk/0.5/unstable/client-test/src/classes/org/jdesktop/wonderland/modules/clienttest/test/ui/tests/BaseGraphicsTest.java

/trunk/0.5/unstable/client-test/src/classes/org/jdesktop/wonderland/modules/clienttest/test/ui/tests/ModelTest.java

/trunk/0.5/unstable/client-test/src/classes/org/jdesktop/wonderland/modules/clienttest/test/ui/tests/TCPBandwidthTest.java

/trunk/0.5/unstable/client-test/src/classes/org/jdesktop/wonderland/modules/clienttest/test/ui/tests/TCPPortsTest.java

/trunk/0.5/unstable/client-test/src/classes/org/jdesktop/wonderland/modules/clienttest/test/ui/tests/UDPPortsTest.java

/trunk/0.5/unstable/client-test/src/classes/org/jdesktop/wonderland/modules/clienttest/test/ui/tests/WebdavTest.java

/trunk/0.5/unstable/client-test/src/classes/org/jdesktop/wonderland/modules/clienttest/web/ClientTestSubstitutionHandler.java

=======================================
--- /trunk/0.5/unstable/client-test/build.xml Thu Mar 29 17:59:40 2012 UTC
+++ /trunk/0.5/unstable/client-test/build.xml Tue Sep 2 06:45:24 2014 UTC
@@ -92,6 +92,10 @@
<fileset dir="${current.dir}/src/classes">
<include name="${module.src}/test/ui/resources/**"/>
</fileset>
+ <manifest>
+ <attribute name="Permissions"
+ value="all-permissions"/>
+ </manifest>
</jar>

<jar jarfile="build/lib/client-test-tests.jar">
@@ -198,7 +202,7 @@
<target name="dist" depends="build, -clienttest-create-client-jar,
-clienttest-prepare-jnlp">
<mkdir dir="${module.dist.dir}"/>

- <module name="${module.name}" majorVersion="0" minorVersion="5"
jarfile="${module.dist.dir}/${module.name}.jar"
moduleDescription="${module.description}" builddir="${build.dir}">
+ <module name="${module.name}" majorVersion="0" minorVersion="6"
jarfile="${module.dist.dir}/${module.name}.jar"
moduleDescription="${module.description}" builddir="${build.dir}">
<requires name="avatarbase" majorversion="0" minorversion="5"
miniVersion="1"/>
<requires name="security" majorversion="0" minorversion="5"/>
<requires name="presencemanager" majorversion="0"
minorversion="5"/>
@@ -253,7 +257,7 @@
<pathelement
location="${wonderland.dir}/core/ext/softphone/softphone.jar"/>
</classpath>

- <jvmarg line="-Dwonderland.server.url=${sgs.server}"/>
+ <jvmarg line="-Djnlp.wonderland.server.url=${sgs.server}"/>
<!--jvmarg line="-Dsoftphone.debug=true"/-->
</java>
</target>
@@ -276,7 +280,7 @@
</classpath>
<jvmarg value="-Xdebug"/>
<jvmarg
value="-Xrunjdwp:transport=dt_socket,address=${jpda.address}"/>
- <jvmarg line="-Dwonderland.server.url=${sgs.server}"/>
+ <jvmarg line="-Djnlp.wonderland.server.url=${sgs.server}"/>
</java>
</target>

@@ -295,7 +299,7 @@
keystore="${wonderland.keystore}"
alias="${wonderland.keystore.alias}"
storepass="${wonderland.keystore.password}"
- signedjar="@{dest.jar}"/>
+ signedjar="@{dest.jar}" />
</sequential>
</macrodef>
</project>
=======================================
---
/trunk/0.5/unstable/client-test/src/classes/org/jdesktop/wonderland/modules/clienttest/test/ui/AudioUtils.java
Thu Dec 22 20:24:31 2011 UTC
+++
/trunk/0.5/unstable/client-test/src/classes/org/jdesktop/wonderland/modules/clienttest/test/ui/AudioUtils.java
Tue Sep 2 06:45:24 2014 UTC
@@ -1,3 +1,7 @@
+/**
+ * Copyright (c) 2014, WonderBuilders, Inc., All Rights Reserved
+ */
+
/**
* Open Wonderland
*
@@ -61,10 +65,10 @@
}

if (!sc.isRunning()) {
- String bridgeInfo = System.getProperty("voicebridge.info");
+ String bridgeInfo =
System.getProperty("jnlp.voicebridge.info");
if (bridgeInfo == null) {
LOGGER.warning("No bridge info. Guessing based on
Wonderland server");
- URL serverURL = new
URL(System.getProperty("wonderland.server.url"));
+ URL serverURL = new
URL(System.getProperty("jnlp.wonderland.server.url"));
bridgeInfo = "null::" + serverURL.getHost()
+ ":6666:5060:" +
serverURL.getHost() + ":6666:5060";
}
=======================================
---
/trunk/0.5/unstable/client-test/src/classes/org/jdesktop/wonderland/modules/clienttest/test/ui/GraphicsUtils.java
Tue Dec 6 07:34:20 2011 UTC
+++
/trunk/0.5/unstable/client-test/src/classes/org/jdesktop/wonderland/modules/clienttest/test/ui/GraphicsUtils.java
Tue Sep 2 06:45:24 2014 UTC
@@ -1,3 +1,7 @@
+/**
+ * Copyright (c) 2014, WonderBuilders, Inc., All Rights Reserved
+ */
+
/**
* Open Wonderland
*
@@ -37,10 +41,12 @@
private final WorldManager worldManager;
private final RenderBuffer rb;
private final Canvas canvas;
- private final WorkProcessor workProcessor;
+ private final WorkProcessor workProcessor;

private ModelTestFrame frame;

+ private static int flg=0;
+
GraphicsUtils(int width, int height) {
worldManager = new WorldManager("ClientTest");

@@ -113,4 +119,13 @@

return frame;
}
+
+ public static int getFlg() {
+ return flg;
+ }
+
+ public static void setFlg(int flg) {
+ GraphicsUtils.flg = flg;
+ }
+
}
=======================================
---
/trunk/0.5/unstable/client-test/src/classes/org/jdesktop/wonderland/modules/clienttest/test/ui/ModelTestFrame.form
Tue Dec 6 07:34:20 2011 UTC
+++
/trunk/0.5/unstable/client-test/src/classes/org/jdesktop/wonderland/modules/clienttest/test/ui/ModelTestFrame.form
Tue Sep 2 06:45:24 2014 UTC
@@ -1,4 +1,4 @@
-<?xml version="1.1" encoding="UTF-8" ?>
+<?xml version="1.0" encoding="UTF-8" ?>

<Form version="1.5" maxVersion="1.7"
type="org.netbeans.modules.form.forminfo.JFrameFormInfo">
<Properties>
@@ -8,6 +8,7 @@
</Properties>
<SyntheticProperties>
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
+ <SyntheticProperty name="generateCenter" type="boolean" value="false"/>
</SyntheticProperties>
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer"
value="1"/>
@@ -50,7 +51,7 @@
<Component id="yesButton" alignment="3" min="-2"
max="-2" attributes="0"/>
<Component id="cancelButton" alignment="3" min="-2"
max="-2" attributes="0"/>
</Group>
- <EmptySpace max="-2" attributes="0"/>
+ <EmptySpace min="-2" pref="26" max="-2" attributes="0"/>
</Group>
</Group>
</DimensionLayout>
@@ -105,7 +106,7 @@
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="1" attributes="0">
- <Component id="referenceLabel" pref="312"
max="32767" attributes="0"/>
+ <Component id="referenceLabel" pref="338"
max="32767" attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="jLabel1" min="-2" max="-2"
attributes="0"/>
</Group>
@@ -151,7 +152,7 @@
<DimensionLayout dim="1">
<Group type="103" groupAlignment="0" attributes="0">
<Group type="102" alignment="1" attributes="0">
- <Component id="testPanel" pref="312" max="32767"
attributes="0"/>
+ <Component id="testPanel" pref="338" max="32767"
attributes="0"/>
<EmptySpace max="-2" attributes="0"/>
<Component id="testLabel" min="-2" max="-2"
attributes="0"/>
</Group>
=======================================
---
/trunk/0.5/unstable/client-test/src/classes/org/jdesktop/wonderland/modules/clienttest/test/ui/ModelTestFrame.java
Tue Dec 6 18:51:26 2011 UTC
+++
/trunk/0.5/unstable/client-test/src/classes/org/jdesktop/wonderland/modules/clienttest/test/ui/ModelTestFrame.java
Tue Sep 2 06:45:24 2014 UTC
@@ -1,3 +1,7 @@
+/**
+ * Copyright (c) 2014, WonderBuilders, Inc., All Rights Reserved
+ */
+
/**
* Open Wonderland
*
@@ -23,13 +27,16 @@
*/
package org.jdesktop.wonderland.modules.clienttest.test.ui;

-import java.awt.BorderLayout;
import java.awt.Component;
+import java.awt.EventQueue;
+import java.awt.event.ComponentAdapter;
+import java.awt.event.ComponentEvent;
import java.awt.event.WindowAdapter;
import java.awt.event.WindowEvent;
import java.text.MessageFormat;
import java.util.ResourceBundle;
import javax.swing.ImageIcon;
+import javax.swing.JDialog;

/**
*
@@ -42,6 +49,7 @@
private boolean answered = false;
private TestResult answer;
private boolean loading = true;
+ private JDialog testDialog = null;

/** Creates new form ModelTestFrame */
public ModelTestFrame() {
@@ -53,15 +61,56 @@
setAnswer(TestResult.NOT_RUN);
}
});
+ setResizable(false);
}

public void setReferenceImage(ImageIcon image) {
referenceLabel.setIcon(image);
repaint();
}
+
+ @Override
+ public void setVisible(boolean visible) {
+ super.setVisible(visible);
+ testDialog.setVisible(visible);
+ }

public void setTestPane(Component component) {
- testPanel.add(component, BorderLayout.CENTER);
+ //testPanel.add(component, BorderLayout.CENTER);
+
+ /*
+ * open dialog for rendering test. Also add component listener.
+ */
+ testDialog = new JDialog(this, "Child", false);
+ testDialog.setUndecorated(true);
+ testDialog.add(component);
+ testDialog.pack();
+
+ addComponentListener(new ComponentAdapter() {
+
+ public void componentMoved(ComponentEvent e) {
+ EventQueue.invokeLater(new Runnable() {
+ public void run() {
+ if(testDialog.isVisible()) {
+
testDialog.setLocation((int)testPanel.getLocationOnScreen().getX()+13
+ ,(int)testPanel.getLocationOnScreen().getY()+13);
+ }
+ }
+ });
+ }
+
+ public void componentShown(ComponentEvent e) {
+ EventQueue.invokeLater(new Runnable() {
+ public void run() {
+ if(testDialog.isVisible()) {
+
testDialog.setLocation((int)testPanel.getLocationOnScreen().getX()+13
+ ,(int)testPanel.getLocationOnScreen().getY()+13);
+ }
+ }
+ });
+ }
+
+ });
}

public TestResult waitForAnswer() throws InterruptedException {
@@ -136,7 +185,7 @@

setBackground(new java.awt.Color(255, 255, 255));

- questionLabel.setFont(new java.awt.Font("Lucida Grande", 1, 13));
+ questionLabel.setFont(new java.awt.Font("Lucida Grande", 1, 13));
// NOI18N
java.util.ResourceBundle bundle =
java.util.ResourceBundle.getBundle("org/jdesktop/wonderland/modules/clienttest/test/ui/resources/Bundle");
// NOI18N

questionLabel.setText(bundle.getString("ModelTestFrame.questionLabel.text"));
// NOI18N

@@ -171,7 +220,7 @@
referenceHolderLayout.setVerticalGroup(

referenceHolderLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
referenceHolderLayout.createSequentialGroup()
- .addComponent(referenceLabel,
javax.swing.GroupLayout.DEFAULT_SIZE, 312, Short.MAX_VALUE)
+ .addComponent(referenceLabel,
javax.swing.GroupLayout.DEFAULT_SIZE, 338, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(jLabel1))
);
@@ -194,7 +243,7 @@
testHolderLayout.setVerticalGroup(

testHolderLayout.createParallelGroup(javax.swing.GroupLayout.Alignment.LEADING)
.addGroup(javax.swing.GroupLayout.Alignment.TRAILING,
testHolderLayout.createSequentialGroup()
- .addComponent(testPanel,
javax.swing.GroupLayout.DEFAULT_SIZE, 312, Short.MAX_VALUE)
+ .addComponent(testPanel,
javax.swing.GroupLayout.DEFAULT_SIZE, 338, Short.MAX_VALUE)
.addPreferredGap(javax.swing.LayoutStyle.ComponentPlacement.RELATED)
.addComponent(testLabel))
);
@@ -234,7 +283,7 @@
.addComponent(noButton)
.addComponent(yesButton)
.addComponent(cancelButton))
- .addContainerGap())
+ .addGap(26, 26, 26))
);

pack();
@@ -269,7 +318,7 @@
protected synchronized TestResult getAnswer() {
return answer;
}
-
+
/**
* @param args the command line arguments
*/
=======================================
---
/trunk/0.5/unstable/client-test/src/classes/org/jdesktop/wonderland/modules/clienttest/test/ui/SubmitLogFrame.form
Thu Dec 22 20:24:31 2011 UTC
+++
/trunk/0.5/unstable/client-test/src/classes/org/jdesktop/wonderland/modules/clienttest/test/ui/SubmitLogFrame.form
Tue Sep 2 06:45:24 2014 UTC
@@ -1,4 +1,4 @@
-<?xml version="1.1" encoding="UTF-8" ?>
+<?xml version="1.0" encoding="UTF-8" ?>

<Form version="1.5" maxVersion="1.7"
type="org.netbeans.modules.form.forminfo.JFrameFormInfo">
<Properties>
@@ -8,6 +8,7 @@
</Properties>
<SyntheticProperties>
<SyntheticProperty name="formSizePolicy" type="int" value="1"/>
+ <SyntheticProperty name="generateCenter" type="boolean" value="false"/>
</SyntheticProperties>
<AuxValues>
<AuxValue name="FormSettings_autoResourcing" type="java.lang.Integer"
value="1"/>
@@ -31,24 +32,20 @@
<EmptySpace type="unrelated" max="-2" attributes="0"/>
<Component id="submitButton" min="-2" max="-2"
attributes="0"/>
</Group>
- <Group type="102" alignment="0" attributes="0">
+ <Group type="102" attributes="0">
<EmptySpace max="-2" attributes="0"/>
- <Component id="jLabel1" min="-2" max="-2" attributes="0"/>
- <EmptySpace pref="250" max="32767" attributes="0"/>
- </Group>
- <Group type="102" alignment="0" attributes="0">
- <EmptySpace max="-2" attributes="0"/>
- <Component id="nameTF" pref="379" max="32767"
attributes="0"/>
- <EmptySpace max="-2" attributes="0"/>
- </Group>
- <Group type="102" alignment="0" attributes="0">
- <EmptySpace max="-2" attributes="0"/>
- <Component id="jLabel2" min="-2" max="-2" attributes="0"/>
- <EmptySpace pref="307" max="32767" attributes="0"/>
- </Group>
- <Group type="102" alignment="0" attributes="0">
- <EmptySpace max="-2" attributes="0"/>
- <Component id="jScrollPane1" pref="379" max="32767"
attributes="0"/>
+ <Group type="103" groupAlignment="0" attributes="0">
+ <Group type="102" alignment="0" attributes="0">
+ <Component id="jLabel1" min="-2" max="-2"
attributes="0"/>
+ <EmptySpace min="0" pref="240" max="32767"
attributes="0"/>
+ </Group>
+ <Component id="nameTF" alignment="0" pref="379"
max="32767" attributes="0"/>
+ <Group type="102" alignment="0" attributes="0">
+ <Component id="jLabel2" min="-2" max="-2"
attributes="0"/>
+ <EmptySpace min="0" pref="297" max="32767"
attributes="0"/>
+ </Group>
+ <Component id="jScrollPane1" alignment="0" pref="379"
max="32767" attributes="0"/>
+ </Group>
<EmptySpace max="-2" attributes="0"/>
</Group>
</Group>
=======================================
---
/trunk/0.5/unstable/client-test/src/classes/org/jdesktop/wonderland/modules/clienttest/test/ui/SubmitLogFrame.java
Thu Dec 22 20:24:31 2011 UTC
+++
/trunk/0.5/unstable/client-test/src/classes/org/jdesktop/wonderland/modules/clienttest/test/ui/SubmitLogFrame.java
Tue Sep 2 06:45:24 2014 UTC
@@ -1,3 +1,7 @@
+/**
+ * Copyright (c) 2014, WonderBuilders, Inc., All Rights Reserved
+ */
+
/**
* Open Wonderland
*
@@ -68,7 +72,7 @@
}

private void doSubmit(String name, String log) throws IOException {
- URL serverURL = new
URL(System.getProperty("wonderland.server.url"));
+ URL serverURL = new
URL(System.getProperty("jnlp.wonderland.server.url"));
URL submitURL = new URL(serverURL, SUBMIT_URL);

HttpURLConnection huc = (HttpURLConnection)
submitURL.openConnection();
=======================================
---
/trunk/0.5/unstable/client-test/src/classes/org/jdesktop/wonderland/modules/clienttest/test/ui/TestManager.java
Tue Dec 6 18:51:26 2011 UTC
+++
/trunk/0.5/unstable/client-test/src/classes/org/jdesktop/wonderland/modules/clienttest/test/ui/TestManager.java
Tue Sep 2 06:45:24 2014 UTC
@@ -1,3 +1,7 @@
+/**
+ * Copyright (c) 2014, WonderBuilders, Inc., All Rights Reserved
+ */
+
/**
* Open Wonderland
*
@@ -294,7 +298,7 @@
}

private static String getServerNameAndPort() throws
MalformedURLException {
- URL serverURL = new
URL(System.getProperty("wonderland.server.url"));
+ URL serverURL = new
URL(System.getProperty("jnlp.wonderland.server.url"));
return serverURL.getHost() + ":" + serverURL.getPort();
}

=======================================
---
/trunk/0.5/unstable/client-test/src/classes/org/jdesktop/wonderland/modules/clienttest/test/ui/tests/BaseGraphicsTest.java
Thu Dec 22 20:24:31 2011 UTC
+++
/trunk/0.5/unstable/client-test/src/classes/org/jdesktop/wonderland/modules/clienttest/test/ui/tests/BaseGraphicsTest.java
Tue Sep 2 06:45:24 2014 UTC
@@ -1,91 +1,133 @@
+/**
+ * Copyright (c) 2014, WonderBuilders, Inc., All Rights Reserved
+ */
+
/**
* Open Wonderland
*
* Copyright (c) 2011, Open Wonderland Foundation, All Rights Reserved
*
- * Redistributions in source code form must reproduce the above
- * copyright and this condition.
+ * Redistributions in source code form must reproduce the above copyright
and
+ * this condition.
*
- * The contents of this file are subject to the GNU General Public
- * License, Version 2 (the "License"); you may not use this file
- * except in compliance with the License. A copy of the License is
- * available at http://www.opensource.org/licenses/gpl-license.php.
+ * The contents of this file are subject to the GNU General Public License,
+ * Version 2 (the "License"); you may not use this file except in
compliance
+ * with the License. A copy of the License is available at
+ * http://www.opensource.org/licenses/gpl-license.php.
*
- * The Open Wonderland Foundation designates this particular file as
- * subject to the "Classpath" exception as provided by the Open Wonderland
- * Foundation in the License file that accompanied this code.
+ * The Open Wonderland Foundation designates this particular file as
subject to
+ * the "Classpath" exception as provided by the Open Wonderland Foundation
in
+ * the License file that accompanied this code.
*/
package org.jdesktop.wonderland.modules.clienttest.test.ui.tests;

import com.jme.light.DirectionalLight;
import com.jme.light.LightNode;
+import com.jme.math.Quaternion;
import com.jme.math.Vector3f;
import com.jme.renderer.ColorRGBA;
import com.jme.scene.CameraNode;
import com.jme.scene.Node;
+import com.jme.scene.state.CullState;
+import com.jme.scene.state.RenderState;
+import com.jme.scene.state.ZBufferState;
+import com.jme.util.resource.ResourceLocator;
+import com.jme.util.resource.ResourceLocatorTool;
+import com.jmex.model.collada.ThreadSafeColladaImporter;
+import java.awt.EventQueue;
+import java.awt.event.ComponentAdapter;
+import java.awt.event.ComponentEvent;
+import java.io.File;
+import java.io.FileInputStream;
+import java.io.FileOutputStream;
import java.io.IOException;
+import java.net.MalformedURLException;
import java.net.URL;
import java.util.ArrayList;
import java.util.List;
+import java.util.Vector;
import java.util.concurrent.Semaphore;
import java.util.concurrent.atomic.AtomicBoolean;
import java.util.logging.Level;
import java.util.logging.Logger;
+import java.util.zip.ZipEntry;
+import java.util.zip.ZipInputStream;
import javax.swing.ImageIcon;
import javax.swing.SwingUtilities;
import org.jdesktop.mtgame.CameraComponent;
import org.jdesktop.mtgame.Entity;
import org.jdesktop.mtgame.FrameRateListener;
+import org.jdesktop.mtgame.RenderComponent;
import org.jdesktop.mtgame.WorldManager;
import org.jdesktop.mtgame.processor.WorkProcessor.WorkCommit;
import org.jdesktop.wonderland.modules.clienttest.test.ui.GraphicsUtils;
import org.jdesktop.wonderland.modules.clienttest.test.ui.TestManager;
import org.jdesktop.wonderland.modules.clienttest.test.ui.TestResult;
+import static
org.jdesktop.wonderland.modules.clienttest.test.ui.tests.ModelTest.getAssetURL;
import org.json.simple.JSONObject;

/**
*
* @author jkaplan
*/
-public abstract class BaseGraphicsTest extends BaseTest
+public abstract class BaseGraphicsTest extends BaseTest
implements FrameRateListener
{
private static final Logger LOGGER =
Logger.getLogger(BaseGraphicsTest.class.getName());
-
+
/**
* The WorldManager for this world
*/
private WorldManager wm = null;
-
+
/**
* The CameraNode
*/
private CameraNode cameraNode = null;
-
+
/**
* The desired frame rate
*/
private int desiredFrameRate = 60;
-
+
private String name;
private URL reference;
-
+
private Entity camera;
private final List<LightNode> lights = new ArrayList<LightNode>();
private final List<Entity> entities = new ArrayList<Entity>();
-
+
@Override
public void initialize(JSONObject config) {
super.initialize(config);
-
+
name = (String) config.get("name");
-
+
try {
reference = getAssetURL(((String) config.get("reference")));
} catch (IOException ex) {
LOGGER.log(Level.WARNING, "Unable to load reference image",
ex);
}
+
+ // hangle mtgame and awt threads so that the tests run properly
+ GraphicsUtils.getCanvas().addComponentListener(new
ComponentAdapter() {
+ public void componentResized(ComponentEvent e) {
+
GraphicsUtils.getWorldManager().getRenderManager().setRunning(false);
+ // ty to acquire synchronization semaphore
+ try {
+
GraphicsUtils.getWorldManager().getRenderManager().getSynchronizer().acquire();
+ } catch (InterruptedException ex) {
+ ex.printStackTrace();
+ }
+ final int width = e.getComponent().getWidth();
+ final int height = e.getComponent().getHeight();
+ GraphicsUtils.getCanvas().setBounds(0, 0, width, height);
+
+
GraphicsUtils.getWorldManager().getRenderManager().getSynchronizer().release();
+
GraphicsUtils.getWorldManager().getRenderManager().setRunning(true);
+ }
+ });
}

@Override
@@ -94,12 +136,18 @@
}

public TestResult run() {
+
+ // run dummy test, so that all tests work properly
+ if (GraphicsUtils.getFlg() == 0) {
+ dummy();
+ }
+
GraphicsUtils.getFrame().reset();
-
+
wm = GraphicsUtils.getWorldManager();
wm.getRenderManager().setDesiredFrameRate(desiredFrameRate);
wm.getRenderManager().setFrameRateListener(this, 100);
-
+
SwingUtilities.invokeLater(new Runnable() {
public void run() {
GraphicsUtils.getFrame().setTitle(getName());
@@ -107,7 +155,10 @@
GraphicsUtils.getFrame().setVisible(true);
}
});
-
+
+
GraphicsUtils.getWorldManager().getRenderManager().getSynchronizer().release();
+
GraphicsUtils.getWorldManager().getRenderManager().setRunning(true);
+
// create the camera immediately
createCameraEntity();

@@ -115,18 +166,15 @@
final AtomicBoolean result = new AtomicBoolean(false);
final Semaphore lock = new Semaphore(1);
lock.drainPermits();
-
+
// add other components on the renderer commit thread
GraphicsUtils.workCommit(new WorkCommit() {
public void commit() {
try {
createLights();
-
+
List<Entity> loaded = doLoad();
entities.addAll(loaded);
-
- GraphicsUtils.getFrame().setLoaded();
-
result.set(true);
} catch (IOException ioe) {
LOGGER.log(Level.WARNING, "Error loading model", ioe);
@@ -135,54 +183,82 @@
}
}
});
-
+
try {
lock.acquire();
+
+ SwingUtilities.invokeLater(new Runnable() {
+
+ public void run() {
+
+
GraphicsUtils.getWorldManager().getRenderManager().setRunning(false);
+ // ty to acquire synchronization semaphore
+ try {
+
GraphicsUtils.getWorldManager().getRenderManager().getSynchronizer().acquire();
+ } catch (InterruptedException ex) {
+ ex.printStackTrace();
+ }
+
+ GraphicsUtils.getFrame().setLoaded();
+
GraphicsUtils.getWorldManager().getRenderManager().getSynchronizer().release();
+
GraphicsUtils.getWorldManager().getRenderManager().setRunning(true);
+ }
+ });
if (!result.get()) {
return TestResult.FAIL;
}
-
+
return GraphicsUtils.getFrame().waitForAnswer();
} catch (InterruptedException ie) {
} finally {
cleanup();
-
+
SwingUtilities.invokeLater(new Runnable() {
- public void run() {
+ public void run() {
GraphicsUtils.getFrame().setVisible(false);
}
});
}
-
+
return TestResult.FAIL;
}
-
+
protected abstract List<Entity> doLoad() throws IOException;
-
+
protected void cleanupEntities() {
for (Entity e : entities) {
wm.removeEntity(e);
}
entities.clear();
}
-
+
public void currentFramerate(final float fps) {
SwingUtilities.invokeLater(new Runnable() {
public void run() {
+
GraphicsUtils.getWorldManager().getRenderManager().setRunning(false);
+ // ty to acquire synchronization semaphore
+ try {
+
GraphicsUtils.getWorldManager().getRenderManager().getSynchronizer().acquire();
+ } catch (InterruptedException ex) {
+ ex.printStackTrace();
+ }
GraphicsUtils.getFrame().setFPS(fps);
+
GraphicsUtils.getWorldManager().getRenderManager().getSynchronizer().release();
+
GraphicsUtils.getWorldManager().getRenderManager().setRunning(true);
}
});
}
-
+
protected void cleanup() {
final Semaphore lock = new Semaphore(1);
lock.drainPermits();
-
+
GraphicsUtils.getWorldManager().getRenderManager().getSynchronizer().release();
+
GraphicsUtils.getWorldManager().getRenderManager().setRunning(true);
GraphicsUtils.workCommit(new WorkCommit() {
public void commit() {
try {
wm.getRenderManager().setFrameRateListener(null, 100);
-
+
cleanupLights();
cleanupCameraEntity();
cleanupEntities();
@@ -191,14 +267,21 @@
}
}
});
-
+
try {
lock.acquire();
+
GraphicsUtils.getWorldManager().getRenderManager().setRunning(false);
+ // ty to acquire synchronization semaphore
+ try {
+
GraphicsUtils.getWorldManager().getRenderManager().getSynchronizer().acquire();
+ } catch (InterruptedException ex) {
+ ex.printStackTrace();
+ }
} catch (InterruptedException ie) {
// ignore
}
}
-
+
protected void createLights() {
LightNode globalLight1 = null;
LightNode globalLight2 = null;
@@ -206,26 +289,26 @@

float radius = 75.0f;
float lheight = 30.0f;
- float x = (float)(radius*Math.cos(Math.PI/6));
- float z = (float)(radius*Math.sin(Math.PI/6));
+ float x = (float) (radius * Math.cos(Math.PI / 6));
+ float z = (float) (radius * Math.sin(Math.PI / 6));
globalLight1 = createLight(x, lheight, z);
- x = (float)(radius*Math.cos(5*Math.PI/6));
- z = (float)(radius*Math.sin(5*Math.PI/6));
+ x = (float) (radius * Math.cos(5 * Math.PI / 6));
+ z = (float) (radius * Math.sin(5 * Math.PI / 6));
globalLight2 = createLight(x, lheight, z);
- x = (float)(radius*Math.cos(3*Math.PI/2));
- z = (float)(radius*Math.sin(3*Math.PI/2));
+ x = (float) (radius * Math.cos(3 * Math.PI / 2));
+ z = (float) (radius * Math.sin(3 * Math.PI / 2));
globalLight3 = createLight(x, lheight, z);

wm.getRenderManager().addLight(globalLight3);
lights.add(globalLight1);
-
+
wm.getRenderManager().addLight(globalLight2);
lights.add(globalLight2);
-
+
wm.getRenderManager().addLight(globalLight1);
lights.add(globalLight3);
}
-
+
protected void cleanupLights() {
for (LightNode light : lights) {
wm.getRenderManager().removeLight(light);
@@ -247,35 +330,290 @@
}

protected void createCameraEntity() {
- Node cameraSG = new Node("MyCamera SG");
+ Node cameraSG = new Node("MyCamera SG");
cameraNode = new CameraNode("MyCamera", null);
cameraSG.attachChild(cameraNode);
-
+
// Add the camera
camera = new Entity("DefaultCamera");
-
+
int width = GraphicsUtils.getCanvas().getWidth();
int height = GraphicsUtils.getCanvas().getHeight();
float aspect = (float) width / (float) height;
-
- CameraComponent cc =
wm.getRenderManager().createCameraComponent(cameraSG, cameraNode,
+
+ CameraComponent cc =
GraphicsUtils.getWorldManager().getRenderManager().createCameraComponent(cameraSG,
cameraNode,
width, height, 45.0f, aspect, 1.0f, 1000.0f, true);
GraphicsUtils.getRenderBuffer().setCameraComponent(cc);
camera.addComponent(CameraComponent.class, cc);

- wm.addEntity(camera);
+ GraphicsUtils.getWorldManager().addEntity(camera);
}
-
+
protected void cleanupCameraEntity() {
GraphicsUtils.getRenderBuffer().setCameraComponent(null);
wm.removeEntity(camera);
}
-
+
protected WorldManager getWorldManager() {
return wm;
}
-
+
protected static URL getAssetURL(String asset) throws IOException {
return TestManager.getAssetURL(asset);
}
+
+ // for dummy test
+ protected Entity loadModel(ModelRecord model)
+ throws IOException
+ {
+ URL assetURL = getAssetURL(model.getURL());
+
+ final File tmpDir = File.createTempFile("model", "tmp");
+ tmpDir.delete();
+ tmpDir.mkdir();
+
+ byte[] buffer = new byte[16384];
+
+ ZipInputStream zis = new ZipInputStream(assetURL.openStream());
+ ZipEntry ze = null;
+ while ((ze = zis.getNextEntry()) != null) {
+ if (!ze.isDirectory()) {
+ File extractFile = new File(tmpDir, ze.getName());
+
+ // create the parent directory if necessary
+ File parentDir = extractFile.getParentFile();
+ if (!parentDir.exists()) {
+ parentDir.mkdirs();
+ }
+
+ FileOutputStream os = new FileOutputStream(extractFile);
+ int read;
+ while ((read = zis.read(buffer, 0, buffer.length)) > 0) {
+ os.write(buffer, 0, read);
+ }
+ os.close();
+ }
+ }
+
+ File modelFile = new File(tmpDir, model.getModel());
+ final File modelDir = modelFile.getParentFile();
+
+ ResourceLocator locator = new ResourceLocator() {
+ public URL locateResource(String string) {
+ LOGGER.log(Level.INFO, "Resolve: {0}", string);
+
+ try {
+ File file = new File(string);
+ if (file.isAbsolute()) {
+ return file.toURI().toURL();
+ }
+
+ return new File(modelDir, string).toURI().toURL();
+ } catch (MalformedURLException ex) {
+ LOGGER.log(Level.WARNING, "Error creating URL for " +
+ string, ex);
+ return null;
+ }
+ }
+ };
+
ResourceLocatorTool.addResourceLocator(ResourceLocatorTool.TYPE_TEXTURE,
locator);
+
+ ThreadSafeColladaImporter importer = new
ThreadSafeColladaImporter("model");
+ importer.load(new FileInputStream(modelFile));
+
+ // create a copy of the model before making any changes
+ model = model.clone();
+
+ float unitMeter = importer.getInstance().getUnitMeter();
+ model.setScale(model.getScale() * unitMeter);
+
+ String upAxis = importer.getInstance().getUpAxis();
+ if (upAxis.equals("Z_UP")) {
+ Quaternion up = new Quaternion(new float[] {-(float)Math.PI/2,
0f, 0f});
+ model.getRotation().multLocal(up);
+ } else if (upAxis.equals("X_UP")) {
+ Quaternion up = new Quaternion(new float[] {0f, 0f,
(float)Math.PI/2});
+ model.getRotation().multLocal(up);
+ } // Y_UP is the Wonderland default
+
+ importer.cleanUp();
+
ResourceLocatorTool.removeResourceLocator(ResourceLocatorTool.TYPE_TEXTURE,
locator);
+
+ return addModel(importer.getModel(), model);
+ }
+
+ /**
+ * Add a model to be visualized
+ */
+ protected Entity addModel(Node model, ModelRecord record)
+ {
+ WorldManager wm = getWorldManager();
+ Node modelRoot = new Node("Model");
+
+ ZBufferState buf = (ZBufferState)
wm.getRenderManager().createRendererState(RenderState.StateType.ZBuffer);
+ buf.setEnabled(true);
+ buf.setFunction(ZBufferState.TestFunction.LessThanOrEqualTo);
+ modelRoot.setRenderState(buf);
+ //modelRoot.setLocalScale(1.0f);
+
+ CullState culls = (CullState)
wm.getRenderManager().createRendererState(RenderState.StateType.Cull);
+ culls.setCullFace(CullState.Face.None);
+ modelRoot.setRenderState(culls);
+
+ modelRoot.setLocalTranslation(record.getTranslation());
+ modelRoot.setLocalRotation(record.getRotation());
+ modelRoot.setLocalScale(record.getScale());
+
+ //System.out.println("Adding: " + model);
+ modelRoot.attachChild(model);
+
+ Entity e = new Entity("Model");
+ RenderComponent sc =
wm.getRenderManager().createRenderComponent(modelRoot);
+ sc.setLightingEnabled(record.isLighting());
+
+ e.addComponent(RenderComponent.class, sc);
+ wm.addEntity(e);
+
+ return e;
+ }
+
+ private void dummy() {
+ GraphicsUtils.getFrame().reset();
+
+ wm = GraphicsUtils.getWorldManager();
+ wm.getRenderManager().setDesiredFrameRate(desiredFrameRate);
+ wm.getRenderManager().setFrameRateListener(this, 100);
+
+ SwingUtilities.invokeLater(new Runnable() {
+ public void run() {
+ GraphicsUtils.getFrame().setTitle(getName());
+ GraphicsUtils.getFrame().setReferenceImage(new
ImageIcon(reference));
+ GraphicsUtils.getFrame().setVisible(true);
+ }
+ });
+
+
GraphicsUtils.getWorldManager().getRenderManager().getSynchronizer().release();
+
GraphicsUtils.getWorldManager().getRenderManager().setRunning(true);
+
+ // create the camera immediately
+ createCameraEntity();
+
+ // add content to frame
+ final AtomicBoolean result = new AtomicBoolean(false);
+ final Semaphore lock = new Semaphore(1);
+ lock.drainPermits();
+
+ // add other components on the renderer commit thread
+ GraphicsUtils.workCommit(new WorkCommit() {
+ public void commit() {
+ try {
+ createLights();
+ float[] angles = new float[3];
+ angles[0] = 0;
+ angles[1] = 180;
+ angles[2] = 0;
+ ModelRecord rec = new
ModelRecord("wla://client-test/Ingrid.zip"
+ , "ingrid.dae", new Vector3f(0, (float) -0.5,
8),
+ new Quaternion(angles), 0.005f, false);
+ loadModel(rec);
+// List<Entity> loaded = doLoad();
+
+// entities.addAll(loaded);
+ GraphicsUtils.setFlg(1);
+ } catch (Exception ioe) {
+ LOGGER.log(Level.WARNING, "Error loading model", ioe);
+ } finally {
+ lock.release();
+ }
+ }
+ });
+
+ try {
+ lock.acquire();
+ } catch (InterruptedException ex) {
+
Logger.getLogger(BaseGraphicsTest.class.getName()).log(Level.SEVERE, null,
ex);
+ }
+
+
GraphicsUtils.getWorldManager().getRenderManager().setRunning(false);
+ // ty to acquire synchronization semaphore
+ try {
+
GraphicsUtils.getWorldManager().getRenderManager().getSynchronizer().acquire();
+ } catch (InterruptedException ex) {
+ ex.printStackTrace();
+ }
+
+ }
+
+ protected class ModelRecord implements Cloneable {
+ private final String url;
+ private final String model;
+ private Vector3f translation;
+ private Quaternion rotation;
+ private float scale;
+ private boolean lighting;
+
+ public ModelRecord(String url, String model, Vector3f translation,
+ Quaternion rotation, float scale, boolean
lighting)
+ {
+ this.url = url;
+ this.model = model;
+ this.translation = translation;
+ this.rotation = rotation;
+ this.scale = scale;
+ this.lighting = lighting;
+ }
+
+ protected ModelRecord(ModelRecord copy) {
+ this.url = copy.getURL();
+ this.model = copy.getModel();
+ this.translation = new Vector3f(copy.getTranslation());
+ this.rotation = new Quaternion(copy.getRotation());
+ this.scale = copy.getScale();
+ this.lighting = copy.isLighting();
+ }
+
+ public String getURL() {
+ return url;
+ }
+
+ public String getModel() {
+ return model;
+ }
+
+ public Vector3f getTranslation() {
+ return translation;
+ }
+
+ public void setTranslation(Vector3f translation) {
+ this.translation = translation;
+ }
+
+ public Quaternion getRotation() {
+ return rotation;
+ }
+
+ public void setRotation(Quaternion rotation) {
+ this.rotation = rotation;
+ }
+
+ public float getScale() {
+ return scale;
+ }
+
+ public void setScale(float scale) {
+ this.scale = scale;
+ }
+
+ public boolean isLighting() {
+ return lighting;
+ }
+
+ public void setLighting(boolean lighting) {
+ this.lighting = lighting;
+ }
+
+ public ModelRecord clone() {
+ return new ModelRecord(this);
+ }
+ }
}
=======================================
---
/trunk/0.5/unstable/client-test/src/classes/org/jdesktop/wonderland/modules/clienttest/test/ui/tests/ModelTest.java
Tue Dec 6 07:34:20 2011 UTC
+++
/trunk/0.5/unstable/client-test/src/classes/org/jdesktop/wonderland/modules/clienttest/test/ui/tests/ModelTest.java
Tue Sep 2 06:45:24 2014 UTC
@@ -1,3 +1,7 @@
+/**
+ * Copyright (c) 2014, WonderBuilders, Inc., All Rights Reserved
+ */
+
/**
* Open Wonderland
*
@@ -258,7 +262,7 @@
}

private static String getServerNameAndPort() throws
MalformedURLException {
- URL serverURL = new
URL(System.getProperty("wonderland.server.url"));
+ URL serverURL = new
URL(System.getProperty("jnlp.wonderland.server.url"));
return serverURL.getHost() + ":" + serverURL.getPort();
}

=======================================
---
/trunk/0.5/unstable/client-test/src/classes/org/jdesktop/wonderland/modules/clienttest/test/ui/tests/TCPBandwidthTest.java
Tue Dec 6 20:29:30 2011 UTC
+++
/trunk/0.5/unstable/client-test/src/classes/org/jdesktop/wonderland/modules/clienttest/test/ui/tests/TCPBandwidthTest.java
Tue Sep 2 06:45:24 2014 UTC
@@ -1,3 +1,7 @@
+/**
+ * Copyright (c) 2014, WonderBuilders, Inc., All Rights Reserved
+ */
+
/**
* Open Wonderland
*
@@ -50,7 +54,7 @@

public TestResult run() {
try {
- String serverURL = System.getProperty("wonderland.server.url");
+ String serverURL =
System.getProperty("jnlp.wonderland.server.url");
String contentURL = serverURL
+ "webdav/content/modules/installed/client-test/art/Hogwarts.kmz";

LOGGER.log(Level.INFO, "Connect to resource {0}", contentURL);
=======================================
---
/trunk/0.5/unstable/client-test/src/classes/org/jdesktop/wonderland/modules/clienttest/test/ui/tests/TCPPortsTest.java
Tue Dec 6 07:34:20 2011 UTC
+++
/trunk/0.5/unstable/client-test/src/classes/org/jdesktop/wonderland/modules/clienttest/test/ui/tests/TCPPortsTest.java
Tue Sep 2 06:45:24 2014 UTC
@@ -1,3 +1,7 @@
+/**
+ * Copyright (c) 2014, WonderBuilders, Inc., All Rights Reserved
+ */
+
/**
* Open Wonderland
*
@@ -47,7 +51,7 @@

public TestResult run() {
try {
- String serverURL = System.getProperty("wonderland.server.url");
+ String serverURL =
System.getProperty("jnlp.wonderland.server.url");
LOGGER.log(Level.INFO, "Connect to server {0}", serverURL);

ServerDetails details = loadDetails(serverURL);
=======================================
---
/trunk/0.5/unstable/client-test/src/classes/org/jdesktop/wonderland/modules/clienttest/test/ui/tests/UDPPortsTest.java
Thu Dec 22 20:24:31 2011 UTC
+++
/trunk/0.5/unstable/client-test/src/classes/org/jdesktop/wonderland/modules/clienttest/test/ui/tests/UDPPortsTest.java
Tue Sep 2 06:45:24 2014 UTC
@@ -1,3 +1,7 @@
+/**
+ * Copyright (c) 2014, WonderBuilders, Inc., All Rights Reserved
+ */
+
/**
* Open Wonderland
*
@@ -32,7 +36,7 @@

public TestResult run() {
try {
- String bridgeInfo = System.getProperty("voicebridge.info");
+ String bridgeInfo =
System.getProperty("jnlp.voicebridge.info");
LOGGER.log(Level.INFO, "Connect to voice bridge {0}",
bridgeInfo);

String addr = AudioUtils.INSTANCE.startSoftphone();
=======================================
---
/trunk/0.5/unstable/client-test/src/classes/org/jdesktop/wonderland/modules/clienttest/test/ui/tests/WebdavTest.java
Tue Dec 6 20:29:30 2011 UTC
+++
/trunk/0.5/unstable/client-test/src/classes/org/jdesktop/wonderland/modules/clienttest/test/ui/tests/WebdavTest.java
Tue Sep 2 06:45:24 2014 UTC
@@ -1,3 +1,7 @@
+/**
+ * Copyright (c) 2014, WonderBuilders, Inc., All Rights Reserved
+ */
+
/**
* Open Wonderland
*
@@ -33,7 +37,7 @@

public TestResult run() {
try {
- String serverURL = System.getProperty("wonderland.server.url");
+ String serverURL =
System.getProperty("jnlp.wonderland.server.url");
String contentURL = serverURL
+ "webdav/content/modules/installed/client-test/art";

LOGGER.log(Level.INFO, "Connect to webdave resource {0}",
contentURL);
=======================================
---
/trunk/0.5/unstable/client-test/src/classes/org/jdesktop/wonderland/modules/clienttest/web/ClientTestSubstitutionHandler.java
Thu Dec 22 20:24:31 2011 UTC
+++
/trunk/0.5/unstable/client-test/src/classes/org/jdesktop/wonderland/modules/clienttest/web/ClientTestSubstitutionHandler.java
Tue Sep 2 06:45:24 2014 UTC
@@ -1,3 +1,7 @@
+/**
+ * Copyright (c) 2014, WonderBuilders, Inc., All Rights Reserved
+ */
+
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
@@ -24,7 +28,7 @@
public String specializeJnlpTemplate(HttpServletRequest request,
String respath, String
jnlpTemplate)
{
- String bridgeProp = "<property name=\"voicebridge.info\" value=\""
+
+ String bridgeProp = "<property name=\"jnlp.voicebridge.info\"
value=\"" +
getVoiceBridge() + "\"/>\n$$url.props\n";
jnlpTemplate = substitute(jnlpTemplate, "$$url.props",
bridgeProp.toString());
jnlpTemplate = super.specializeJnlpTemplate(request, respath,
jnlpTemplate);
Reply all
Reply to author
Forward
0 new messages