Revision: 4154
Author: janne.t.harkonen
Date: Wed Sep 29 06:02:39 2010
Log: not really needed anymore
http://code.google.com/p/robotframework/source/detail?r=4154
Deleted:
/trunk/proto/test_application/lib/LoginApplication$_PyInner.class
/trunk/proto/test_application/lib/LoginApplication.class
/trunk/proto/test_application/lib/LoginApplication.java
/trunk/proto/test_application/lib/LoginApplication.py
/trunk/proto/test_application/lib/application.py
/trunk/proto/test_application/run_tests.bat
/trunk/proto/test_application/run_tests.sh
/trunk/proto/test_application/start_app.bat
/trunk/proto/test_application/start_app.sh
/trunk/proto/test_application/test.tsv
=======================================
--- /trunk/proto/test_application/lib/LoginApplication$_PyInner.class Fri
Mar 6 04:38:38 2009
+++ /dev/null
Binary file, no diff available.
=======================================
--- /trunk/proto/test_application/lib/LoginApplication.class Fri Mar 6
04:38:38 2009
+++ /dev/null
Binary file, no diff available.
=======================================
--- /trunk/proto/test_application/lib/LoginApplication.java Fri Mar 6
04:38:38 2009
+++ /dev/null
@@ -1,123 +0,0 @@
-import org.python.core.*;
-
-public class LoginApplication extends java.lang.Object implements
org.python.core.PyProxy, org.python.core.ClassDictInit {
- static String[] jpy$mainProperties = new String[]
{"python.modules.builtin", "exceptions:org.python.core.exceptions"};
- static String[] jpy$proxyProperties = new String[]
{"python.modules.builtin", "exceptions:org.python.core.exceptions", "python.options.showJavaExceptions", "true"};
- static String[] jpy$packages = new String[] {"java.lang", null};
-
- public static class _PyInner extends PyFunctionTable implements
PyRunnable {
- private static PyObject s$0;
- private static PyObject s$1;
- private static PyFunctionTable funcTable;
- private static PyCode c$0_start;
- private static PyCode c$1_LoginApplication;
- private static PyCode c$2_main;
- private static void initConstants() {
- s$0 = Py.newString("__main__");
- s$1 =
Py.newString("/home/jth/workspace/proto/lib/LoginApplication.py");
- funcTable = new _PyInner();
- c$0_start = Py.newCode(1, new String[]
{"self"}, "/home/jth/workspace/proto/lib/LoginApplication.py", "start",
false, false, funcTable, 0, null, null, 0, 17);
- c$1_LoginApplication = Py.newCode(0, new String[]
{}, "/home/jth/workspace/proto/lib/LoginApplication.py", "LoginApplication",
false, false, funcTable, 1, null, null, 0, 16);
- c$2_main = Py.newCode(0, new String[]
{}, "/home/jth/workspace/proto/lib/LoginApplication.py", "main", false,
false, funcTable, 2, null, null, 0, 16);
- }
-
-
- public PyCode getMain() {
- if (c$2_main == null) _PyInner.initConstants();
- return c$2_main;
- }
-
- public PyObject call_function(int index, PyFrame frame) {
- switch (index){
- case 0:
- return _PyInner.start$1(frame);
- case 1:
- return _PyInner.LoginApplication$2(frame);
- case 2:
- return _PyInner.main$3(frame);
- default:
- return null;
- }
- }
-
- private static PyObject start$1(PyFrame frame) {
- frame.getglobal("MainFrame").__call__().invoke("show");
- return Py.None;
- }
-
- private static PyObject LoginApplication$2(PyFrame frame) {
- frame.setlocal("start", new PyFunction(frame.f_globals, new
PyObject[] {}, c$0_start));
- return frame.getf_locals();
- }
-
- private static PyObject main$3(PyFrame frame) {
- frame.setglobal("__file__", s$1);
-
- // Temporary Variables
- PyObject[] t$0$PyObject__;
-
- // Code
- frame.setlocal("java",
org.python.core.imp.importOne("java.lang.Object", frame));
- t$0$PyObject__ = org.python.core.imp.importFrom("application",
new String[] {"MainFrame"}, frame);
- frame.setlocal("MainFrame", t$0$PyObject__[0]);
- t$0$PyObject__ = null;
- frame.setlocal("LoginApplication",
Py.makeClass("LoginApplication", new PyObject[]
{frame.getname("java").__getattr__("lang").__getattr__("Object")},
c$1_LoginApplication, null, LoginApplication.class));
- if (frame.getname("__name__")._eq(s$0).__nonzero__()) {
-
frame.getname("LoginApplication").__call__().invoke("start");
- }
- return Py.None;
- }
-
- }
- public static void moduleDictInit(PyObject dict) {
- dict.__setitem__("__name__", new PyString("LoginApplication"));
- Py.runCode(new _PyInner().getMain(), dict, dict);
- }
-
- public static void main(String[] args) throws java.lang.Exception {
- String[] newargs = new String[args.length+1];
- newargs[0] = "LoginApplication";
- java.lang.System.arraycopy(args, 0, newargs, 1, args.length);
- Py.runMain(LoginApplication._PyInner.class, newargs,
LoginApplication.jpy$packages, LoginApplication.jpy$mainProperties, null,
new String[] {"LoginApplication"});
- }
-
- public java.lang.Object clone() throws
java.lang.CloneNotSupportedException {
- return super.clone();
- }
-
- public void finalize() throws java.lang.Throwable {
- super.finalize();
- }
-
- public LoginApplication() {
- super();
- __initProxy__(new Object[] {});
- }
-
- private PyInstance __proxy;
- public void _setPyInstance(PyInstance inst) {
- __proxy = inst;
- }
-
- public PyInstance _getPyInstance() {
- return __proxy;
- }
-
- private PySystemState __sysstate;
- public void _setPySystemState(PySystemState inst) {
- __sysstate = inst;
- }
-
- public PySystemState _getPySystemState() {
- return __sysstate;
- }
-
- public void __initProxy__(Object[] args) {
- Py.initProxy(this, "LoginApplication", "LoginApplication", args,
LoginApplication.jpy$packages, LoginApplication.jpy$proxyProperties, null,
new String[] {"LoginApplication"});
- }
-
- static public void classDictInit(PyObject dict) {
- dict.__setitem__("__supernames__", Py.java2py(new String[]
{"finalize", "clone"}));
- }
-
-}
=======================================
--- /trunk/proto/test_application/lib/LoginApplication.py Fri Mar 6
04:38:38 2009
+++ /dev/null
@@ -1,13 +0,0 @@
-import java.lang.Object
-
-from application import MainFrame
-
-
-class LoginApplication(java.lang.Object):
-
- def start(self):
- MainFrame().show()
-
-if __name__ == '__main__':
- LoginApplication().start()
-
=======================================
--- /trunk/proto/test_application/lib/application.py Fri Mar 6 04:38:38
2009
+++ /dev/null
@@ -1,159 +0,0 @@
-import os
-from javax.swing import JPanel, JPasswordField, JButton, JTextField,
JFrame, \
- JLabel, JMenuBar, JMenu, JMenuItem, JSeparator
-from java.awt import GridBagLayout, GridBagConstraints
-from java.awt.event import ActionListener
-
-
-VALID_USERS = [('demo', 'mode'), ('dave', 'wibble')]
-STATUSFILE = os.path.join(os.path.dirname(__file__), 'store')
-
-
-class MainFrame(JFrame):
-
- def __init__(self):
- JFrame.__init__(self, title='Login Application', size=(600, 300))
- self.setJMenuBar(MenuBar(self))
- self._login_panel = LoginPanel(self)
- self._logged_in_panel = LoggedInPanel(self)
- self.setContentPane(self._login_panel)
- self._login_if_stored()
-
- def _login_if_stored(self):
- if not os.path.isfile(STATUSFILE):
- return
- stored_user = open(STATUSFILE).read()
- if stored_user:
- self._login(stored_user)
-
- def login(self):
- username, password = self._login_panel.username,
self._login_panel.password
- if (username, password) in VALID_USERS:
- self._login(username)
- self._store_logged_user(username)
- else:
- self._login_panel.set_status('Login Failed!')
- self._login_panel.reset()
- self.validate()
-
- def _login(self, username):
- status = 'You have logged in as "%s". Now you can logout.' %
username
- self._logged_in_panel.set_status(status)
- self.setContentPane(self._logged_in_panel)
-
- def _store_logged_user(self, username):
- open(STATUSFILE, 'w').write(username + '\n')
-
- def logout(self):
- self._login_panel.set_status()
- self.setContentPane(self._login_panel)
- self._reset_store()
- self.validate()
-
- def _reset_store(self):
- if os.path.isfile(STATUSFILE):
- os.remove(STATUSFILE)
-
-
-class MenuBar(JMenuBar):
-
- def __init__(self, parent):
- self.add(FileMenu(parent))
-
-
-class FileMenu(JMenu):
-
- def __init__(self, parent):
- JMenu.__init__(self, 'File')
- self.add(MenuItem('Logout', parent.logout))
- self.add(JSeparator())
- self.add(MenuItem('Exit', parent.dispose))
-
-
-class MenuItem(JMenuItem, ActionListener):
-
- def __init__(self, name, action):
- JMenuItem.__init__(self, name)
- self._action = action
- self.addActionListener(self)
-
- def actionPerformed(self, event):
- self._action()
-
-
-class _LoginAppPanel(JPanel):
-
- def __init__(self, parent):
- self.layout = GridBagLayout()
- self._create_components(parent)
-
- def _create_button(self, label, name, listener):
- button = JButton(label=label, name=name)
- button.addActionListener(listener)
- return button
-
- def _add(self, component, *coords):
- """Adds component to GridBagLayout. coords are in format (col,
row)"""
- constraints = GridBagConstraints()
- constraints.gridx, constraints.gridy = coords
- constraints.fill = GridBagConstraints.VERTICAL
- self.add(component, constraints)
-
- def set_status(self, message=''):
- self._status_field.text = message
-
-
-class LoginPanel(_LoginAppPanel):
-
- username = property(lambda self: self._username_field.text)
- password = property(lambda self: self._password_field.text)
-
- def _create_components(self, parent):
- self._create_labels()
- self._create_input_fields()
- self._create_login_button(parent)
-
- def _create_labels(self):
- self._add(JLabel(text='username'), 0, 0)
- self._add(JLabel(text='password'), 0, 1)
- self._status_field = JLabel(name='status_label')
- self._add(self._status_field, 1, 2)
-
- def _create_input_fields(self):
- self._username_field = JTextField(20, name='username_field')
- self._add(self._username_field, 1, 0)
- self._password_field = JPasswordField(20, name='password_field')
- self._add(self._password_field, 1, 1)
-
- def _create_login_button(self, parent):
- self._add(self._create_button('Login', 'login_button',
- SimpleAction(parent.login)), 0, 2)
-
- def reset(self):
- self._username_field.text = self._password_field.text = ''
-
-
-class LoggedInPanel(_LoginAppPanel):
-
- def _create_components(self, parent):
- self._status_field = JLabel(name='status_label')
- self._add(self._status_field, 1, 1)
- self._add(self._create_button('Logout', 'logout_button',
- SimpleAction(parent.logout)), 1, 2)
-
-
-class SimpleAction(ActionListener):
-
- def __init__(self, action):
- """Creates a simple ActionListener.
-
- 'action' must be a callable that will be called on
actionPerformed"""
- self._action = action
-
- def actionPerformed(self, event):
- self._action()
-
-
-if __name__ == '__main__':
- MainFrame().show()
-
=======================================
--- /trunk/proto/test_application/run_tests.bat Fri Mar 6 04:38:38 2009
+++ /dev/null
@@ -1,3 +0,0 @@
-set CLASSPATH=lib;lib\swinglibrary-0.12-SNAPSHOT.jar
-jybot --pythonpath lib\ --loglevel debug --outputdir result %*
-
=======================================
--- /trunk/proto/test_application/run_tests.sh Fri Mar 6 04:38:38 2009
+++ /dev/null
@@ -1,4 +0,0 @@
-#!/bin/bash
-export CLASSPATH=lib:lib/swinglibrary-0.12-SNAPSHOT.jar
-jybot --pythonpath lib/ --loglevel debug --outputdir result $*
-
=======================================
--- /trunk/proto/test_application/start_app.bat Fri Mar 6 04:38:38 2009
+++ /dev/null
@@ -1,1 +0,0 @@
-jython lib/LoginApplication.py
=======================================
--- /trunk/proto/test_application/start_app.sh Fri Mar 6 04:38:38 2009
+++ /dev/null
@@ -1,2 +0,0 @@
-#!/bin/bash
-jython lib/LoginApplication.py
=======================================
--- /trunk/proto/test_application/test.tsv Fri Mar 6 04:38:38 2009
+++ /dev/null
@@ -1,15 +0,0 @@
-*Settings*
-Library SwingLibrary
-
-*Test Cases*
-Login Test Launch Application LoginApplication
- Select Window Login Application
- Insert Into Textfield username_field demo
- Insert Into Textfield password_field mode
- Push Button login_button
- ${text}= Get Label Content status_label
- Should be Equal ${text} You have logged in as "demo". Now you can
logout.
- Push Button logout_button
- ${text}= Get Label Content status_label
- Should Be Equal ${text} ${EMPTY}
-