|
What this is
Other links
The source code/* * Sun Public License Notice * * The contents of this file are subject to the Sun Public License * Version 1.0 (the "License"). You may not use this file except in * compliance with the License. A copy of the License is available at * http://www.sun.com/ * * The Original Code is NetBeans. The Initial Developer of the Original * Code is Sun Microsystems, Inc. Portions Copyright 1997-2002 Sun * Microsystems, Inc. All Rights Reserved. */ /* * Tests for JSP Backward compatibility */ package org.netbeans.test.gui.web.JSP_Compilation_and_Execution; import org.netbeans.junit.NbTestSuite; import org.netbeans.junit.NbTestCase; import java.awt.Robot; import java.awt.*; import java.awt.event.*; import org.netbeans.jellytools.*; import org.netbeans.jellytools.nodes.*; import org.netbeans.jellytools.actions.*; import org.netbeans.jellytools.properties.*; import org.netbeans.jemmy.*; import org.netbeans.jemmy.operators.*; public class JSP_BwComp extends NbTestCase { private String workDir=null; private String value=null; private String delim="|"; // NOI18N private String web="web"; // NOI18N private ExplorerOperator explorer=null; private static boolean mwm=true; private JavaNode node=null; private NbDialogOperator dop=null; private JButtonOperator jbo=null; public JSP_BwComp(String testName) { super(testName); } public static void main(java.lang.String[] args) { junit.textui.TestRunner.run(new NbTestSuite(JSP_BwComp.class)); } public void setUp() { String fSep = System.getProperty("file.separator"); // NOI18N workDir = (java.lang.System.getProperty("jsptests.workdir")+"/2.2").replace('/',fSep.charAt(0)); // NOI18N if(mwm) { mwm=false; try { dop=new NbDialogOperator(org.netbeans.jellytools.Bundle.getString("org.netbeans.modules.web.context.Bundle", "CTL_TITLE")); dop.close(); dop=new NbDialogOperator(org.netbeans.jellytools.Bundle.getString("org.netbeans.modules.web.context.Bundle", "CTL_TITLE")); dop.close(); } catch(Exception e) { System.out.println(org.netbeans.jellytools.Bundle.getString("org.netbeans.modules.web.context.Bundle", "CTL_TITLE") + "dialog not found: "+e); } } explorer = ExplorerOperator.invoke(); explorer.selectPageFilesystems(); } private JavaNode getNode() { try { node=new JavaNode(workDir+delim+"WEB-INF"+delim+"web"); // NOI18N }catch(Exception e) { fail(workDir+delim+"WEB-INF"+delim+"web" // NOI18N +" not found"); } return node; } private void checkDialog(String name) { try { dop=new NbDialogOperator(name); } catch(Exception ex) { fail("No '"+name+"' dialog appears"); } dop.close(); } private void testAction(String name, JavaNode node) { new PropertiesAction().perform(node); PropertySheetOperator pw = new PropertySheetOperator(PropertySheetOperator.MODE_PROPERTIES_OF_ONE_OBJECT, web); PropertySheetTabOperator psto = pw.getPropertySheetTabOperator("Deployment"); TextFieldProperty tf=new TextFieldProperty(psto, "Filter Mappings"); tf.openEditor(); NbDialogOperator nbdop=new NbDialogOperator("Filter Mappings"); nbdop.ok(); } private void check(JavaNode node) { checkDialog("Question"); new PropertiesAction().perform(node); PropertySheetOperator pw = new PropertySheetOperator(PropertySheetOperator.MODE_PROPERTIES_OF_ONE_OBJECT, web); PropertySheetTabOperator psto = pw.getPropertySheetTabOperator("Deployment"); ComboBoxProperty cb=new ComboBoxProperty(psto, "Web Application Version"); value=cb.getValue(); if (value.equals("2.3")) { // NOI18N fail("Application upgraded to 2.3"); } } // S1S tests // Upgrading web module to J2EE 1.3 by adding Filter Mapping [Discard] public void test_upgrade_via_FMapping() { JavaNode node=getNode(); testAction("Filter Mappings", node); check(node); } // Upgrading web module to J2EE 1.3 by adding Filters [Discard] public void test_upgrade_via_Filters() { JavaNode node=getNode(); testAction("Filters", node); check(node); } // Upgrading web module to J2EE 1.3 by adding Servlets [Discard] public void test_upgrade_via_Servlets() { JavaNode node=getNode(); testAction("Servlets", node); check(node); } // Upgrading web module to J2EE 1.3 by adding JSP [Discard] public void test_upgrade_via_JSP() { JavaNode node=getNode(); testAction("JSP Files", node); check(node); } // Upgrading web module to J2EE 1.3 by adding Servlet Mapping [Discard] public void test_upgrade_via_SMapping() { JavaNode node=getNode(); testAction("Servlet Mappings", node); check(node); } // Upgrading web module to J2EE 1.3 by adding Listener [Discard] public void test_upgrade_via_Listener() { JavaNode node=getNode(); testAction("Listeners", node); check(node); } // Upgrading web module to J2EE 1.3 via Tool menu [Discard] public void test_upgrade_via_Tool() { JavaNode node=getNode(); new org.netbeans.jellytools.actions.Action("Tools|Update Web Application Version", null).perform(node); check(node); } // Upgrading web module to J2EE 1.3 via Tool menu [Save] public void test_upgrade_via_Tool_Save() { JavaNode node=getNode(); new org.netbeans.jellytools.actions.Action("Tools|Update Web Application Version", null).perform(node); try { dop=new NbDialogOperator("Question"); } catch(Exception ex) { fail("No 'Question' dialog appears"); } JButtonOperator jbo=new JButtonOperator(dop, "Save"); jbo.push(); new PropertiesAction().perform(node); PropertySheetOperator pw = new PropertySheetOperator(PropertySheetOperator.MODE_PROPERTIES_OF_ONE_OBJECT, web); PropertySheetTabOperator psto = pw.getPropertySheetTabOperator("Deployment"); ComboBoxProperty cb=new ComboBoxProperty(psto, "Web Application Version"); value=cb.getValue(); if (value.equals("2.2")) { // NOI18N fail("Application didn't upgrade to 2.3"); } } } |
... this post is sponsored by my books ... | |
#1 New Release! |
FP Best Seller |
Copyright 1998-2021 Alvin Alexander, alvinalexander.com
All Rights Reserved.
A percentage of advertising revenue from
pages under the /java/jwarehouse
URI on this website is
paid back to open source projects.