From: Mathieu Baudier Date: Thu, 2 Oct 2008 07:46:32 +0000 (+0000) Subject: Integrate detached with standard SLC X-Git-Tag: argeo-slc-2.1.7~2515 X-Git-Url: http://git.argeo.org/?a=commitdiff_plain;h=ed5489078954b1070e885e0bb3206f5fcfbe593f;p=gpl%2Fargeo-slc.git Integrate detached with standard SLC git-svn-id: https://svn.argeo.org/slc/trunk@1676 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc --- diff --git a/sandbox/argeo.slc.testui/pom.xml b/sandbox/argeo.slc.testui/pom.xml index 48edde702..40d00c243 100644 --- a/sandbox/argeo.slc.testui/pom.xml +++ b/sandbox/argeo.slc.testui/pom.xml @@ -33,22 +33,6 @@ - - org.argeo.slc - org.argeo.slc.autoui - 0.11.1-SNAPSHOT - test - - - org.apache.felix - org.osgi.core - - - org.apache.felix - org.apache.felix.main - - - org.argeo.dep.jemmy diff --git a/sandbox/argeo.slc.testui/src/main/java/org/argeo/slc/testui/SwingTestUi.java b/sandbox/argeo.slc.testui/src/main/java/org/argeo/slc/testui/SwingTestUi.java index 4ff18c746..c02891bb3 100644 --- a/sandbox/argeo.slc.testui/src/main/java/org/argeo/slc/testui/SwingTestUi.java +++ b/sandbox/argeo.slc.testui/src/main/java/org/argeo/slc/testui/SwingTestUi.java @@ -25,7 +25,10 @@ public class SwingTestUi { frame.getContentPane().add(button); button.addActionListener(new ActionListener() { public void actionPerformed(ActionEvent e) { - label.setText("Pressed!!"); + if (label.getText().equals("Hello World")) + label.setText("Pressed!!"); + else + label.setText("Hello World"); } }); diff --git a/sandbox/argeo.slc.testui/src/test/java/org/argeo/slc/jemmytest/JemmyRemoteTest.java b/sandbox/argeo.slc.testui/src/test/java/org/argeo/slc/jemmytest/JemmyRemoteTest.java deleted file mode 100644 index 19fa9c2a9..000000000 --- a/sandbox/argeo.slc.testui/src/test/java/org/argeo/slc/jemmytest/JemmyRemoteTest.java +++ /dev/null @@ -1,86 +0,0 @@ -package org.argeo.slc.jemmytest; - -import java.io.Serializable; -import java.rmi.registry.LocateRegistry; -import java.rmi.registry.Registry; - -import junit.framework.TestCase; - -import org.argeo.slc.autoui.rmi.AutoUiContext; -import org.argeo.slc.autoui.rmi.AutoUiServer; -import org.argeo.slc.autoui.rmi.AutoUiTask; -import org.argeo.slc.testui.SwingTestUi; -import org.netbeans.jemmy.ClassReference; -import org.netbeans.jemmy.operators.JButtonOperator; -import org.netbeans.jemmy.operators.JFrameOperator; -import org.netbeans.jemmy.operators.JLabelOperator; - -public class JemmyRemoteTest extends TestCase implements Serializable { - static final long serialVersionUID = 1l; - - public void testRemote() throws Exception { - if (System.getSecurityManager() == null) { - System.setSecurityManager(new SecurityManager()); - } - String name = "AutoUiServer"; - Registry registry = LocateRegistry.getRegistry("localhost"); - AutoUiServer server = (AutoUiServer) registry.lookup(name); - AutoUiTask startFrame = new AutoUiTask() { - static final long serialVersionUID = 1l; - - public Object execute(AutoUiContext context) throws Exception { - // Start application - ClassReference classReference = new ClassReference( - SwingTestUi.class.getName()); - String[] args = { "noExitOnClose" }; - classReference.startApplication(args); - - // Find components - JFrameOperator jFrameOperator = new JFrameOperator( - "HelloWorldSwing"); - JButtonOperator jButtonOperator = new JButtonOperator( - jFrameOperator, "Button"); - JLabelOperator jLabelOperator = new JLabelOperator( - jFrameOperator, "Hello World"); - - context.setLocalRef("label", jLabelOperator); - context.setLocalRef("button", jButtonOperator); - return null; - } - - }; - - AutoUiTask pushButton = new AutoUiTask() { - static final long serialVersionUID = 1l; - - public Object execute(AutoUiContext context) throws Exception { - JButtonOperator jButtonOperator = (JButtonOperator) context - .getLocalRef("button"); - JLabelOperator jLabelOperator = (JLabelOperator) context - .getLocalRef("label"); - - // Execute actions - jButtonOperator.push(); - - // Performs checks - String textAfterPush = jLabelOperator.getText(); - Boolean pressed = new Boolean(textAfterPush.equals("Pressed!!")); - return pressed; - } - - }; - - server.executeTask(startFrame); - Boolean pressed = (Boolean) server.executeTask(pushButton); - assertTrue("Has been pressed", pressed.booleanValue()); - } - - public static void main(String[] args){ - try { - JemmyRemoteTest jemmyRemoteTest = new JemmyRemoteTest(); - jemmyRemoteTest.testRemote(); - } catch (Exception e) { - e.printStackTrace(); - } - } -}