Test with RMI
authorMathieu Baudier <mbaudier@argeo.org>
Mon, 15 Sep 2008 12:25:44 +0000 (12:25 +0000)
committerMathieu Baudier <mbaudier@argeo.org>
Mon, 15 Sep 2008 12:25:44 +0000 (12:25 +0000)
git-svn-id: https://svn.argeo.org/slc/trunk@1594 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc

14 files changed:
sandbox/argeo.slc.jemmytest/.classpath
sandbox/argeo.slc.jemmytest/.settings/org.eclipse.jdt.core.prefs [new file with mode: 0644]
sandbox/argeo.slc.jemmytest/autouiserver.jardesc [new file with mode: 0644]
sandbox/argeo.slc.jemmytest/pom.xml
sandbox/argeo.slc.jemmytest/server-old.policy [new file with mode: 0644]
sandbox/argeo.slc.jemmytest/server.policy [new file with mode: 0644]
sandbox/argeo.slc.jemmytest/src/main/java/org/argeo/slc/autoui/swingtest/SwingTestJemmy.java [deleted file]
sandbox/argeo.slc.jemmytest/src/main/java/org/argeo/slc/autoui/swingtest/SwingTestUi.java
sandbox/argeo.slc.jemmytest/src/main/java/org/argeo/slc/autoui/swingtest/rmi/AutoUiContext.java [new file with mode: 0644]
sandbox/argeo.slc.jemmytest/src/main/java/org/argeo/slc/autoui/swingtest/rmi/AutoUiServer.java [new file with mode: 0644]
sandbox/argeo.slc.jemmytest/src/main/java/org/argeo/slc/autoui/swingtest/rmi/AutoUiServerImpl.java [new file with mode: 0644]
sandbox/argeo.slc.jemmytest/src/main/java/org/argeo/slc/autoui/swingtest/rmi/AutoUiTask.java [new file with mode: 0644]
sandbox/argeo.slc.jemmytest/src/test/java/org/argeo/slc/autoui/swingtest/JemmyRemoteTest.java [new file with mode: 0644]
sandbox/argeo.slc.jemmytest/src/test/java/org/argeo/slc/autoui/swingtest/SwingTestJemmy.java [new file with mode: 0644]

index 449267b0ca48c331f1a63d94321c689548479b44..bddeaab3125ad6ef3effc4b0fae0d338fe10142a 100644 (file)
@@ -2,7 +2,8 @@
 <classpath>
        <classpathentry kind="src" path="src/main/java"/>
        <classpathentry kind="src" path="src/test/resources"/>
-       <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/J2SE-1.3"/>
+       <classpathentry kind="src" path="src/test/java"/>
        <classpathentry kind="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
+       <classpathentry kind="con" path="org.eclipse.jdt.launching.JRE_CONTAINER/org.eclipse.jdt.internal.debug.ui.launcher.StandardVMType/j2sdk1.3.1"/>
        <classpathentry kind="output" path="bin"/>
 </classpath>
diff --git a/sandbox/argeo.slc.jemmytest/.settings/org.eclipse.jdt.core.prefs b/sandbox/argeo.slc.jemmytest/.settings/org.eclipse.jdt.core.prefs
new file mode 100644 (file)
index 0000000..43b6819
--- /dev/null
@@ -0,0 +1,12 @@
+#Sun Sep 14 07:26:48 CEST 2008
+eclipse.preferences.version=1
+org.eclipse.jdt.core.compiler.codegen.inlineJsrBytecode=enabled
+org.eclipse.jdt.core.compiler.codegen.targetPlatform=1.1
+org.eclipse.jdt.core.compiler.codegen.unusedLocal=preserve
+org.eclipse.jdt.core.compiler.compliance=1.3
+org.eclipse.jdt.core.compiler.debug.lineNumber=generate
+org.eclipse.jdt.core.compiler.debug.localVariable=generate
+org.eclipse.jdt.core.compiler.debug.sourceFile=generate
+org.eclipse.jdt.core.compiler.problem.assertIdentifier=ignore
+org.eclipse.jdt.core.compiler.problem.enumIdentifier=ignore
+org.eclipse.jdt.core.compiler.source=1.3
diff --git a/sandbox/argeo.slc.jemmytest/autouiserver.jardesc b/sandbox/argeo.slc.jemmytest/autouiserver.jardesc
new file mode 100644 (file)
index 0000000..fcde756
--- /dev/null
@@ -0,0 +1,16 @@
+<?xml version="1.0" encoding="UTF-8" standalone="no"?>
+<jardesc>
+    <jar path="/home/mbaudier/dev/src/slc/sandbox/argeo.slc.jemmytest/local/autouiserver.jar"/>
+    <options buildIfNeeded="true" compress="true" descriptionLocation="/argeo.slc.jemmytest/autouiserver.jardesc" exportErrors="true" exportWarnings="true" includeDirectoryEntries="false" overwrite="false" saveDescription="true" storeRefactorings="false" useSourceFolders="false"/>
+    <storedRefactorings deprecationInfo="true" structuralOnly="false"/>
+    <selectedProjects/>
+    <manifest generateManifest="true" manifestLocation="" manifestVersion="1.0" reuseManifest="false" saveManifest="false" usesManifest="true">
+        <sealing sealJar="false">
+            <packagesToSeal/>
+            <packagesToUnSeal/>
+        </sealing>
+    </manifest>
+    <selectedElements exportClassFiles="true" exportJavaFiles="false" exportOutputFolder="false">
+        <javaElement handleIdentifier="=argeo.slc.jemmytest/src\/main\/java"/>
+    </selectedElements>
+</jardesc>
index 9cec51cb26eb1f45e7e46e6dd7070b0703c446b1..ff6769a0bd28d5c75876880b4e379f1390b72dd6 100644 (file)
@@ -1,76 +1,81 @@
 <project xmlns="http://maven.apache.org/POM/4.0.0"
-    xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
-    xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
-    <modelVersion>4.0.0</modelVersion>
-    <groupId>org.argeo.slc</groupId>
-    <artifactId>slc-jemmy</artifactId>
-    <name>SLC Jemmy</name>
-    <version>0.1.1-SNAPSHOT</version>
-    <description />
-    <build>
-        <filters></filters>
-        <plugins>
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-compiler-plugin</artifactId>
-                <configuration>
-                    <source>1.3</source>
-                    <target>1.3</target>
-                </configuration>
-            </plugin>
-            <plugin>
-                <groupId>org.apache.maven.plugins</groupId>
-                <artifactId>maven-source-plugin</artifactId>
-                <executions>
-                    <execution>
-                        <id>attach-sources</id>
-                        <phase>package</phase>
-                        <goals>
-                            <goal>jar</goal>
-                        </goals>
-                    </execution>
-                </executions>
-            </plugin>
-        </plugins>
-    </build>
-    <profiles></profiles>
-    <dependencies>
-        <dependency>
-            <groupId>org.netbeans</groupId>
-            <artifactId>jemmy</artifactId>
-            <version>2.2.7.5</version>
-        </dependency>
-        <dependency>
-            <groupId>commons-logging</groupId>
-            <artifactId>commons-logging</artifactId>
-            <version>1.1.1</version>
-        </dependency>
-        <dependency>
-            <groupId>log4j</groupId>
-            <artifactId>log4j</artifactId>
-            <version>1.2.15</version>
-            <exclusions>
-                <exclusion>
-                    <groupId>com.sun.jmx</groupId>
-                    <artifactId>jmxri</artifactId>
-                </exclusion>
-                <exclusion>
-                    <groupId>com.sun.jdmk</groupId>
-                    <artifactId>jmxtools</artifactId>
-                </exclusion>
-                <exclusion>
-                    <groupId>javax.mail</groupId>
-                    <artifactId>mail</artifactId>
-                </exclusion>
-                <exclusion>
-                    <groupId>javax.jms</groupId>
-                    <artifactId>jms</artifactId>
-                </exclusion>
-            </exclusions>
-        </dependency>
-    </dependencies>
-    <dependencyManagement>
-        <dependencies></dependencies>
-    </dependencyManagement>
+       xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
+       xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
+       <modelVersion>4.0.0</modelVersion>
+       <groupId>org.argeo.slc</groupId>
+       <artifactId>slc-jemmy</artifactId>
+       <name>SLC Jemmy</name>
+       <version>0.1.1-SNAPSHOT</version>
+       <description />
+       <build>
+               <filters></filters>
+               <plugins>
+                       <plugin>
+                               <groupId>org.apache.maven.plugins</groupId>
+                               <artifactId>maven-compiler-plugin</artifactId>
+                               <configuration>
+                                       <source>1.3</source>
+                                       <target>1.3</target>
+                               </configuration>
+                       </plugin>
+                       <plugin>
+                               <groupId>org.apache.maven.plugins</groupId>
+                               <artifactId>maven-source-plugin</artifactId>
+                               <executions>
+                                       <execution>
+                                               <id>attach-sources</id>
+                                               <phase>package</phase>
+                                               <goals>
+                                                       <goal>jar</goal>
+                                               </goals>
+                                       </execution>
+                               </executions>
+                       </plugin>
+               </plugins>
+       </build>
+       <profiles></profiles>
+       <dependencies>
+               <dependency>
+                       <groupId>org.netbeans</groupId>
+                       <artifactId>jemmy</artifactId>
+                       <version>2.2.7.5</version>
+               </dependency>
+               <dependency>
+                       <groupId>junit</groupId>
+                       <artifactId>junit</artifactId>
+                       <version>3.8.2</version>
+               </dependency>
+               <dependency>
+                       <groupId>commons-logging</groupId>
+                       <artifactId>commons-logging</artifactId>
+                       <version>1.1.1</version>
+               </dependency>
+               <dependency>
+                       <groupId>log4j</groupId>
+                       <artifactId>log4j</artifactId>
+                       <version>1.2.15</version>
+                       <exclusions>
+                               <exclusion>
+                                       <groupId>com.sun.jmx</groupId>
+                                       <artifactId>jmxri</artifactId>
+                               </exclusion>
+                               <exclusion>
+                                       <groupId>com.sun.jdmk</groupId>
+                                       <artifactId>jmxtools</artifactId>
+                               </exclusion>
+                               <exclusion>
+                                       <groupId>javax.mail</groupId>
+                                       <artifactId>mail</artifactId>
+                               </exclusion>
+                               <exclusion>
+                                       <groupId>javax.jms</groupId>
+                                       <artifactId>jms</artifactId>
+                               </exclusion>
+                       </exclusions>
+               </dependency>
+       </dependencies>
+       <dependencyManagement>
+               <dependencies></dependencies>
+       </dependencyManagement>
 
 </project>
\ No newline at end of file
diff --git a/sandbox/argeo.slc.jemmytest/server-old.policy b/sandbox/argeo.slc.jemmytest/server-old.policy
new file mode 100644 (file)
index 0000000..de837a5
--- /dev/null
@@ -0,0 +1,11 @@
+grant codeBase "file:/home/mbaudier/dev/src/slc/sandbox/argeo.slc.jemmytest/bin/" {
+    permission java.security.AllPermission;
+};
+
+grant codeBase "file:/home/mbaudier/dev/src/slc/sandbox/argeo.slc.jemmytest/local/autouiserver.jar" {
+    permission java.security.AllPermission;
+};
+
+grant codeBase "file:/home/mbaudier/.m2/repository/org/netbeans/jemmy/2.2.7.5/jemmy-2.2.7.5.jar" {
+    permission java.security.AllPermission;
+};
diff --git a/sandbox/argeo.slc.jemmytest/server.policy b/sandbox/argeo.slc.jemmytest/server.policy
new file mode 100644 (file)
index 0000000..abf7847
--- /dev/null
@@ -0,0 +1,4 @@
+grant {
+       // Allow everything for now
+       permission java.security.AllPermission;
+};
diff --git a/sandbox/argeo.slc.jemmytest/src/main/java/org/argeo/slc/autoui/swingtest/SwingTestJemmy.java b/sandbox/argeo.slc.jemmytest/src/main/java/org/argeo/slc/autoui/swingtest/SwingTestJemmy.java
deleted file mode 100644 (file)
index dcdc57c..0000000
+++ /dev/null
@@ -1,30 +0,0 @@
-package org.argeo.slc.autoui.swingtest;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.netbeans.jemmy.ClassReference;
-import org.netbeans.jemmy.operators.JButtonOperator;
-import org.netbeans.jemmy.operators.JFrameOperator;
-
-public class SwingTestJemmy {
-       private final static Log log = LogFactory.getLog(SwingTestJemmy.class);
-
-       public static void main(String[] args) {
-               try {
-                       ClassReference classReference = new ClassReference(
-                                       SwingTestUi.class.getName());
-                       classReference.startApplication();
-                       JFrameOperator jFrameOperator = new JFrameOperator(
-                                       "HelloWorldSwing");
-                       JButtonOperator jButtonOperator = new JButtonOperator(
-                                       jFrameOperator, "Button");
-                       jButtonOperator.push();
-                       String textAfterPush = jButtonOperator.getText();
-                       log.info("textAfterPush=" + textAfterPush);
-                       
-                       jFrameOperator.close();
-               } catch (Exception e) {
-                       e.printStackTrace();
-               }
-       }
-}
index 8333e1c8bbff0952926e7be9c3b89c24dc828360..e29f2dd07315783f14db9031e2c8af271bf88f24 100644 (file)
@@ -1,5 +1,6 @@
 package org.argeo.slc.autoui.swingtest;
 
+import java.awt.GridLayout;
 import java.awt.event.ActionEvent;
 import java.awt.event.ActionListener;
 
@@ -8,24 +9,25 @@ import javax.swing.JFrame;
 import javax.swing.JLabel;
 
 public class SwingTestUi {
-       private static void createAndShowGUI() {
+       private static void createAndShowGUI(boolean exitOnClose) {
                // Create and set up the window.
                JFrame frame = new JFrame("HelloWorldSwing");
-               frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+               if (exitOnClose)
+                       frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+
+               frame.getContentPane().setLayout(new GridLayout(2, 1));
 
                // Add the ubiquitous "Hello World" label.
                final JLabel label = new JLabel("Hello World");
                frame.getContentPane().add(label);
-               
+
                final JButton button = new JButton("Button");
                frame.getContentPane().add(button);
                button.addActionListener(new ActionListener() {
-
-                       @Override
                        public void actionPerformed(ActionEvent e) {
-                               button.setText("Pressed!!");
-
-                       }});
+                               label.setText("Pressed!!");
+                       }
+               });
 
                // Display the window.
                frame.pack();
@@ -33,11 +35,17 @@ public class SwingTestUi {
        }
 
        public static void main(String[] args) {
-               // Schedule a job for the event-dispatching thread:
-               // creating and showing this application's GUI.
+               boolean noExitOnClose = false;
+               for (int i = 0; i < args.length; i++) {
+                       if (args[i].equals("noExitOnClose")) {
+                               noExitOnClose = true;
+                       }
+               }
+
+               final boolean exitOnClose = !noExitOnClose;
                javax.swing.SwingUtilities.invokeLater(new Runnable() {
                        public void run() {
-                               createAndShowGUI();
+                               createAndShowGUI(exitOnClose);
                        }
                });
        }
diff --git a/sandbox/argeo.slc.jemmytest/src/main/java/org/argeo/slc/autoui/swingtest/rmi/AutoUiContext.java b/sandbox/argeo.slc.jemmytest/src/main/java/org/argeo/slc/autoui/swingtest/rmi/AutoUiContext.java
new file mode 100644 (file)
index 0000000..868a0c9
--- /dev/null
@@ -0,0 +1,7 @@
+package org.argeo.slc.autoui.swingtest.rmi;
+
+public interface AutoUiContext {
+       public Object getLocalRef(String key);
+
+       public void setLocalRef(String key, Object ref);
+}
diff --git a/sandbox/argeo.slc.jemmytest/src/main/java/org/argeo/slc/autoui/swingtest/rmi/AutoUiServer.java b/sandbox/argeo.slc.jemmytest/src/main/java/org/argeo/slc/autoui/swingtest/rmi/AutoUiServer.java
new file mode 100644 (file)
index 0000000..089e6f8
--- /dev/null
@@ -0,0 +1,8 @@
+package org.argeo.slc.autoui.swingtest.rmi;
+
+import java.rmi.Remote;
+import java.rmi.RemoteException;
+
+public interface AutoUiServer extends Remote {
+       public Object executeTask(AutoUiTask task) throws RemoteException;
+}
diff --git a/sandbox/argeo.slc.jemmytest/src/main/java/org/argeo/slc/autoui/swingtest/rmi/AutoUiServerImpl.java b/sandbox/argeo.slc.jemmytest/src/main/java/org/argeo/slc/autoui/swingtest/rmi/AutoUiServerImpl.java
new file mode 100644 (file)
index 0000000..b32b237
--- /dev/null
@@ -0,0 +1,55 @@
+package org.argeo.slc.autoui.swingtest.rmi;
+
+import java.rmi.Naming;
+import java.rmi.RemoteException;
+import java.rmi.registry.LocateRegistry;
+import java.rmi.registry.Registry;
+import java.rmi.server.UnicastRemoteObject;
+import java.util.Map;
+import java.util.TreeMap;
+
+public class AutoUiServerImpl extends UnicastRemoteObject implements
+               AutoUiServer, AutoUiContext {
+       private Map map = new TreeMap();
+
+       public AutoUiServerImpl() throws RemoteException {
+               super();
+       }
+
+       public Object executeTask(AutoUiTask task) throws RemoteException {
+               try {
+                       return task.execute(this);
+               } catch (Exception e) {
+                       throw new RemoteException("Coul not execute task.", e);
+               }
+       }
+
+       public Object getLocalRef(String key) {
+               return map.get(key);
+       }
+
+       public void setLocalRef(String key, Object ref) {
+               map.put(key, ref);
+       }
+
+       public static void main(String[] args) {
+               if (System.getSecurityManager() == null) {
+                       System.setSecurityManager(new SecurityManager());
+               }
+               try {
+                       String name = "AutoUiServer";
+                       AutoUiServer engine = new AutoUiServerImpl();
+                       // AutoUiServer stub = (AutoUiServer) UnicastRemoteObject
+                       // .exportObject(engine, 0);
+                       // Registry registry = LocateRegistry.getRegistry();
+                       // registry.rebind(name, stub);
+                       Naming.rebind(name, engine);
+                       System.out.println("AutoUiServer bound");
+
+               } catch (Exception e) {
+                       System.err.println("AutoUiServer exception:");
+                       e.printStackTrace();
+               }
+
+       }
+}
diff --git a/sandbox/argeo.slc.jemmytest/src/main/java/org/argeo/slc/autoui/swingtest/rmi/AutoUiTask.java b/sandbox/argeo.slc.jemmytest/src/main/java/org/argeo/slc/autoui/swingtest/rmi/AutoUiTask.java
new file mode 100644 (file)
index 0000000..86dcc1f
--- /dev/null
@@ -0,0 +1,7 @@
+package org.argeo.slc.autoui.swingtest.rmi;
+
+import java.io.Serializable;
+
+public interface AutoUiTask extends Serializable {
+       public Object execute(AutoUiContext context) throws Exception;
+}
diff --git a/sandbox/argeo.slc.jemmytest/src/test/java/org/argeo/slc/autoui/swingtest/JemmyRemoteTest.java b/sandbox/argeo.slc.jemmytest/src/test/java/org/argeo/slc/autoui/swingtest/JemmyRemoteTest.java
new file mode 100644 (file)
index 0000000..48bec9c
--- /dev/null
@@ -0,0 +1,85 @@
+package org.argeo.slc.autoui.swingtest;
+
+import java.io.Serializable;
+import java.rmi.registry.LocateRegistry;
+import java.rmi.registry.Registry;
+
+import org.argeo.slc.autoui.swingtest.rmi.AutoUiContext;
+import org.argeo.slc.autoui.swingtest.rmi.AutoUiServer;
+import org.argeo.slc.autoui.swingtest.rmi.AutoUiTask;
+import org.netbeans.jemmy.ClassReference;
+import org.netbeans.jemmy.operators.JButtonOperator;
+import org.netbeans.jemmy.operators.JFrameOperator;
+import org.netbeans.jemmy.operators.JLabelOperator;
+
+import junit.framework.TestCase;
+
+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();
+               }
+       }
+}
diff --git a/sandbox/argeo.slc.jemmytest/src/test/java/org/argeo/slc/autoui/swingtest/SwingTestJemmy.java b/sandbox/argeo.slc.jemmytest/src/test/java/org/argeo/slc/autoui/swingtest/SwingTestJemmy.java
new file mode 100644 (file)
index 0000000..023968c
--- /dev/null
@@ -0,0 +1,40 @@
+package org.argeo.slc.autoui.swingtest;
+
+import junit.framework.TestCase;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+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 SwingTestJemmy extends TestCase {
+       private final static Log log = LogFactory.getLog(SwingTestJemmy.class);
+
+       public void testSimple() 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");
+
+               // Execute actions
+               jButtonOperator.push();
+
+               // Performs checks
+               String textAfterPush = jLabelOperator.getText();
+               assertEquals("Pressed!!", textAfterPush);
+
+               // Clean up
+               jFrameOperator.close();
+       }
+
+}