Introduce Jemmy sandbox project
authorMathieu Baudier <mbaudier@argeo.org>
Sat, 13 Sep 2008 09:18:49 +0000 (09:18 +0000)
committerMathieu Baudier <mbaudier@argeo.org>
Sat, 13 Sep 2008 09:18:49 +0000 (09:18 +0000)
git-svn-id: https://svn.argeo.org/slc/trunk@1593 4cfe0d0a-d680-48aa-b62c-e0a02a3f76cc

sandbox/argeo.slc.jemmytest/.classpath [new file with mode: 0644]
sandbox/argeo.slc.jemmytest/.project [new file with mode: 0644]
sandbox/argeo.slc.jemmytest/.settings/org.maven.ide.eclipse.prefs [new file with mode: 0644]
sandbox/argeo.slc.jemmytest/pom.xml [new file with mode: 0644]
sandbox/argeo.slc.jemmytest/src/main/java/org/argeo/slc/autoui/swingtest/SwingTestJemmy.java [new file with mode: 0644]
sandbox/argeo.slc.jemmytest/src/main/java/org/argeo/slc/autoui/swingtest/SwingTestUi.java [new file with mode: 0644]
sandbox/argeo.slc.jemmytest/src/test/resources/log4j.properties [new file with mode: 0644]

diff --git a/sandbox/argeo.slc.jemmytest/.classpath b/sandbox/argeo.slc.jemmytest/.classpath
new file mode 100644 (file)
index 0000000..449267b
--- /dev/null
@@ -0,0 +1,8 @@
+<?xml version="1.0" encoding="UTF-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="con" path="org.maven.ide.eclipse.MAVEN2_CLASSPATH_CONTAINER"/>
+       <classpathentry kind="output" path="bin"/>
+</classpath>
diff --git a/sandbox/argeo.slc.jemmytest/.project b/sandbox/argeo.slc.jemmytest/.project
new file mode 100644 (file)
index 0000000..991ee0f
--- /dev/null
@@ -0,0 +1,23 @@
+<?xml version="1.0" encoding="UTF-8"?>
+<projectDescription>
+       <name>argeo.slc.jemmytest</name>
+       <comment></comment>
+       <projects>
+       </projects>
+       <buildSpec>
+               <buildCommand>
+                       <name>org.eclipse.jdt.core.javabuilder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+               <buildCommand>
+                       <name>org.maven.ide.eclipse.maven2Builder</name>
+                       <arguments>
+                       </arguments>
+               </buildCommand>
+       </buildSpec>
+       <natures>
+               <nature>org.eclipse.jdt.core.javanature</nature>
+               <nature>org.maven.ide.eclipse.maven2Nature</nature>
+       </natures>
+</projectDescription>
diff --git a/sandbox/argeo.slc.jemmytest/.settings/org.maven.ide.eclipse.prefs b/sandbox/argeo.slc.jemmytest/.settings/org.maven.ide.eclipse.prefs
new file mode 100644 (file)
index 0000000..063c585
--- /dev/null
@@ -0,0 +1,9 @@
+#Sat Sep 13 10:49:32 CEST 2008
+activeProfiles=
+eclipse.preferences.version=1
+filterResources=false
+includeModules=false
+resolveWorkspaceProjects=true
+resourceFilterGoals=process-resources resources\:testResources
+useMavenFolders=false
+version=1
diff --git a/sandbox/argeo.slc.jemmytest/pom.xml b/sandbox/argeo.slc.jemmytest/pom.xml
new file mode 100644 (file)
index 0000000..9cec51c
--- /dev/null
@@ -0,0 +1,76 @@
+<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>
+
+</project>
\ No newline at end of file
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
new file mode 100644 (file)
index 0000000..dcdc57c
--- /dev/null
@@ -0,0 +1,30 @@
+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();
+               }
+       }
+}
diff --git a/sandbox/argeo.slc.jemmytest/src/main/java/org/argeo/slc/autoui/swingtest/SwingTestUi.java b/sandbox/argeo.slc.jemmytest/src/main/java/org/argeo/slc/autoui/swingtest/SwingTestUi.java
new file mode 100644 (file)
index 0000000..8333e1c
--- /dev/null
@@ -0,0 +1,45 @@
+package org.argeo.slc.autoui.swingtest;
+
+import java.awt.event.ActionEvent;
+import java.awt.event.ActionListener;
+
+import javax.swing.JButton;
+import javax.swing.JFrame;
+import javax.swing.JLabel;
+
+public class SwingTestUi {
+       private static void createAndShowGUI() {
+               // Create and set up the window.
+               JFrame frame = new JFrame("HelloWorldSwing");
+               frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
+
+               // 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!!");
+
+                       }});
+
+               // Display the window.
+               frame.pack();
+               frame.setVisible(true);
+       }
+
+       public static void main(String[] args) {
+               // Schedule a job for the event-dispatching thread:
+               // creating and showing this application's GUI.
+               javax.swing.SwingUtilities.invokeLater(new Runnable() {
+                       public void run() {
+                               createAndShowGUI();
+                       }
+               });
+       }
+
+}
diff --git a/sandbox/argeo.slc.jemmytest/src/test/resources/log4j.properties b/sandbox/argeo.slc.jemmytest/src/test/resources/log4j.properties
new file mode 100644 (file)
index 0000000..48539ac
--- /dev/null
@@ -0,0 +1,15 @@
+# Set root logger level to DEBUG and its only appender to A1.\r
+log4j.rootLogger=WARN, console\r
+\r
+## Levels\r
+# Slc\r
+log4j.logger.org.argeo.slc=DEBUG\r
+\r
+## Appenders\r
+# A1 is set to be a ConsoleAppender.\r
+log4j.appender.console=org.apache.log4j.ConsoleAppender\r
+\r
+# A1 uses PatternLayout.\r
+log4j.appender.console.layout=org.apache.log4j.PatternLayout\r
+log4j.appender.console.layout.ConversionPattern= %-5p %d{ISO8601} %m - %c %n\r
+\r