001: /*
002: * Copyright 2001-2006 C:1 Financial Services GmbH
003: *
004: * This software is free software; you can redistribute it and/or
005: * modify it under the terms of the GNU Lesser General Public
006: * License Version 2.1, as published by the Free Software Foundation.
007: *
008: * This software is distributed in the hope that it will be useful,
009: * but WITHOUT ANY WARRANTY; without even the implied warranty of
010: * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
011: * Lesser General Public License for more details.
012: *
013: * You should have received a copy of the GNU Lesser General Public
014: * License along with this library; if not, write to the Free Software
015: * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307, USA
016: */
017:
018: package de.finix.contelligent.action;
019:
020: import junit.framework.Test;
021: import junit.framework.TestSuite;
022: import de.finix.contelligent.test.ContelligentTestCase;
023:
024: public class ActionTests extends ContelligentTestCase {
025: final static public String TEST_DIR = (TEST_ROOT_DIR + "actiontest/");
026:
027: final static public String TEST_ACTION1 = (TEST_DIR + "action/test.act");
028:
029: final static public String TEST_ACTION2 = (TEST_DIR + "action/test2.act");
030:
031: public static Test suite() {
032: return new TestSuite(ActionTests.class);
033: }
034:
035: public ActionTests(String name) {
036: super (name);
037: }
038:
039: public void testEmpty() {
040:
041: }
042:
043: /*
044: * public void setUp() throws Exception { callData = getCallData(); }
045: *
046: *
047: * public void beginLogin(WebRequest request) { request.setURL("otto:7021",
048: * "", TEST_ACTION1, null, "kontonummer=1234567&pin=3333&submit=Submit"); }
049: *
050: * public void testLogin() throws Exception { InvokerBase actionInvoker =
051: * new InvokerBase(); assertNotNull("Could not create ActionInvoker
052: * servlet", actionInvoker); actionInvoker.doGet(request, response);
053: *
054: * assertTrue(callData.getSessionAttribute(TEST_DIR+"store/component") !=
055: * null);
056: * assertTrue(callData.getSessionAttribute(TEST_DIR+"store/component").toString().equals("Uncle
057: * Scrooge")); }
058: *
059: * public void endLogin(WebResponse response) { String content =
060: * response.getText(); int sBody = content.indexOf("<body>"); int eBody =
061: * content.indexOf("</body>");
062: *
063: * assertTrue(content.substring(sBody + 6,
064: * eBody).trim().equals("SuccessWelcomeUncle ScroogeEs wurde kein Name
065: * definiert.Uncle Scrooge/Uncle Scrooge/Uncle Scrooge/Uncle Scrooge/")); }
066: *
067: * public void beginWrongPIN(WebRequest request) {
068: * request.setURL("otto:7021", "", TEST_ACTION1, null,
069: * "kontonummer=1234567&pin=33333&submit=Submit"); }
070: *
071: * public void testWrongPIN() throws Exception { InvokerBase actionInvoker =
072: * new InvokerBase(); assertNotNull("Could not create ActionInvoker
073: * servlet", actionInvoker); actionInvoker.doGet(request, response);
074: *
075: * assertTrue(callData.getSessionAttribute(TEST_DIR+"store/component") ==
076: * null); }
077: *
078: * public void endWrongPIN(com.meterware.httpunit.WebResponse response)
079: * throws Exception { String content = response.getText(); WebTable table =
080: * response.getTables()[0]; String pinCell = table.getCellAsText(1,
081: * 0).trim();
082: *
083: * assertTrue(pinCell.equals("(1)PIN eingeben")); }
084: *
085: * public void beginWrongKonto(WebRequest request) { // host-name is just
086: * fake, the port also? request.setURL("otto:7021", "", TEST_ACTION1, null,
087: * "kontonummer=123&pin=3333&submit=Submit"); }
088: *
089: * public void testWrongKonto() throws Exception { InvokerBase actionInvoker =
090: * new InvokerBase(); assertNotNull("Could not create ActionInvoker
091: * servlet", actionInvoker); actionInvoker.doGet(request, response);
092: *
093: * assertTrue(callData.getSessionAttribute(TEST_DIR+"store/component") ==
094: * null); }
095: *
096: * public void endWrongKonto(com.meterware.httpunit.WebResponse response)
097: * throws Exception { String content = response.getText(); WebTable table =
098: * response.getTables()[0]; String pinCell =
099: * table.getCellAsText(0,0).trim();
100: *
101: * assertTrue(pinCell.equals("(1)Kontonummer eingeben")); }
102: *
103: * private HTTPCallData callData;
104: */
105: }
|