You are viewing a plain text version of this content. The canonical link for it is here.
Posted to scm@geronimo.apache.org by mc...@apache.org on 2008/10/19 04:46:54 UTC
svn commit: r705953 - in /geronimo/devtools/eclipse-plugin/branches/2.1.4:
plugins/org.apache.geronimo.st.ui/
testsuite/plugins/org.apache.geronimo.testsuite.common/src/main/java/org/apache/geronimo/testsuite/common/ui/
testsuite/plugins/org.apache.ger...
Author: mcconne
Date: Sat Oct 18 19:46:53 2008
New Revision: 705953
URL: http://svn.apache.org/viewvc?rev=705953&view=rev
Log:
GERONIMODEVTOOLS-363 POJO testcases add to testsuite -- Thanks to Ashish for the patch!!
Added:
geronimo/devtools/eclipse-plugin/branches/2.1.4/testsuite/plugins/org.apache.geronimo.testsuite.v20/src/main/java/org/apache/geronimo/testsuite/v20/ui/SharedLibPojoTest.java (with props)
geronimo/devtools/eclipse-plugin/branches/2.1.4/testsuite/plugins/org.apache.geronimo.testsuite.v20/src/main/resources/sharedlib/
geronimo/devtools/eclipse-plugin/branches/2.1.4/testsuite/plugins/org.apache.geronimo.testsuite.v20/src/main/resources/sharedlib/CurrencyConverter.java (with props)
geronimo/devtools/eclipse-plugin/branches/2.1.4/testsuite/plugins/org.apache.geronimo.testsuite.v20/src/main/resources/sharedlib/index.jsp (with props)
geronimo/devtools/eclipse-plugin/branches/2.1.4/testsuite/plugins/org.apache.geronimo.testsuite.v21/src/main/java/org/apache/geronimo/testsuite/v21/ui/SharedLibPojoTest.java (with props)
geronimo/devtools/eclipse-plugin/branches/2.1.4/testsuite/plugins/org.apache.geronimo.testsuite.v21/src/main/resources/sharedlib/
geronimo/devtools/eclipse-plugin/branches/2.1.4/testsuite/plugins/org.apache.geronimo.testsuite.v21/src/main/resources/sharedlib/CurrencyConverter.java (with props)
geronimo/devtools/eclipse-plugin/branches/2.1.4/testsuite/plugins/org.apache.geronimo.testsuite.v21/src/main/resources/sharedlib/index.jsp (with props)
Modified:
geronimo/devtools/eclipse-plugin/branches/2.1.4/plugins/org.apache.geronimo.st.ui/plugin.xml
geronimo/devtools/eclipse-plugin/branches/2.1.4/testsuite/plugins/org.apache.geronimo.testsuite.common/src/main/java/org/apache/geronimo/testsuite/common/ui/AbbotHelper.java
geronimo/devtools/eclipse-plugin/branches/2.1.4/testsuite/plugins/org.apache.geronimo.testsuite.common/src/main/java/org/apache/geronimo/testsuite/common/ui/ServerTasks.java
geronimo/devtools/eclipse-plugin/branches/2.1.4/testsuite/plugins/org.apache.geronimo.testsuite.v20/test.xml
geronimo/devtools/eclipse-plugin/branches/2.1.4/testsuite/plugins/org.apache.geronimo.testsuite.v21/test.xml
Modified: geronimo/devtools/eclipse-plugin/branches/2.1.4/plugins/org.apache.geronimo.st.ui/plugin.xml
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/branches/2.1.4/plugins/org.apache.geronimo.st.ui/plugin.xml?rev=705953&r1=705952&r2=705953&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/branches/2.1.4/plugins/org.apache.geronimo.st.ui/plugin.xml (original)
+++ geronimo/devtools/eclipse-plugin/branches/2.1.4/plugins/org.apache.geronimo.st.ui/plugin.xml Sat Oct 18 19:46:53 2008
@@ -21,10 +21,10 @@
<plugin>
- <extension-point id="loader" name="Source Path Computer Mapping" schema="schema/loader.exsd"/>
- <extension-point id="actionURLs" name="Action ID and URL" schema="schema/actionURLs.exsd"/>
-
-
+ <extension-point id="loader" name="Source Path Computer Mapping" schema="schema/loader.exsd"/>
+ <extension-point id="actionURLs" name="Action ID and URL" schema="schema/actionURLs.exsd"/>
+
+
<!-- ======================================================================================= -->
<!-- -->
<!-- Define the icon for the Geronimo <runtime-component-type> and the "Geronimo Deployment" -->
@@ -47,15 +47,15 @@
-->
<extension point="org.eclipse.wst.server.ui.serverImages">
- <image id="org.apache.geronimo.runtime.image"
- icon="icons/obj16/littleG.gif"
+ <image id="org.apache.geronimo.runtime.image"
+ icon="icons/obj16/littleG.gif"
typeIds="org.apache.geronimo.runtime.20,
- org.apache.geronimo.runtime.21"/>
+ org.apache.geronimo.runtime.21"/>
<image id="org.apache.geronimo.server.image"
- icon="icons/obj16/littleG.gif"
+ icon="icons/obj16/littleG.gif"
typeIds="org.apache.geronimo.server.20,
- org.apache.geronimo.server.21"/>
+ org.apache.geronimo.server.21"/>
</extension>
@@ -79,39 +79,39 @@
</extension>
<extension point="org.eclipse.ui.popupMenus">
- <objectContribution
- adaptable="true"
- id="org.apache.geronimo.ui.serveractions"
- objectClass="org.eclipse.wst.server.core.IServer">
- <enablement>
- <test forcePluginActivation="true"
- property="org.eclipse.wst.server.ui.serverType"
- value="org.apache.geronimo.*" />
- </enablement>
- <action id="org.apache.geronimo.ui.launchSupport"
- label="%PopupMenus.launchSupport" icon="icons/obj16/littleG.gif"
- class="org.apache.geronimo.st.ui.actions.LaunchGeronimoSupportAction"
- enablesFor="1">
- </action>
- </objectContribution>
- </extension>
-
- <extension point="org.eclipse.ui.popupMenus">
- <objectContribution
- adaptable="true"
- id="org.apache.geronimo.ui.serveractions"
- objectClass="org.eclipse.wst.server.core.IServer">
- <enablement>
- <test forcePluginActivation="true"
- property="org.eclipse.wst.server.ui.serverType"
- value="org.apache.geronimo.*" />
- </enablement>
- <action id="org.apache.geronimo.ui.launchconsole"
- label="%PopupMenus.launchconsole" icon="icons/obj16/littleG.gif"
- class="org.apache.geronimo.st.ui.actions.LaunchGeronimoConsoleAction"
- enablesFor="1">
- </action>
- </objectContribution>
+ <objectContribution
+ adaptable="true"
+ id="org.apache.geronimo.ui.serveractions"
+ objectClass="org.eclipse.wst.server.core.IServer">
+ <enablement>
+ <test forcePluginActivation="true"
+ property="org.eclipse.wst.server.ui.serverType"
+ value="org.apache.geronimo.*" />
+ </enablement>
+ <action id="org.apache.geronimo.ui.launchSupport"
+ label="%PopupMenus.launchSupport" icon="icons/obj16/littleG.gif"
+ class="org.apache.geronimo.st.ui.actions.LaunchGeronimoSupportAction"
+ enablesFor="1">
+ </action>
+ </objectContribution>
+ </extension>
+
+ <extension point="org.eclipse.ui.popupMenus">
+ <objectContribution
+ adaptable="true"
+ id="org.apache.geronimo.ui.serveractions"
+ objectClass="org.eclipse.wst.server.core.IServer">
+ <enablement>
+ <test forcePluginActivation="true"
+ property="org.eclipse.wst.server.ui.serverType"
+ value="org.apache.geronimo.*" />
+ </enablement>
+ <action id="org.apache.geronimo.ui.launchconsole"
+ label="%PopupMenus.launchconsole" icon="icons/obj16/littleG.gif"
+ class="org.apache.geronimo.st.ui.actions.LaunchGeronimoConsoleAction"
+ enablesFor="1">
+ </action>
+ </objectContribution>
</extension>
<extension point="org.eclipse.wst.server.ui.editorPageSections">
@@ -157,8 +157,7 @@
<extension point="org.eclipse.wst.server.ui.editorPageSections">
<section id="org.apache.server.geronimo.testenv" order="20"
insertionId="org.eclipse.wst.server.editor.overview.left"
- typeIds="org.apache.geronimo.server.20,
- org.apache.geronimo.server.21"
+ typeIds="org.apache.geronimo.server.*"
class="org.apache.geronimo.st.ui.sections.ServerEditorTestEnvSection">
</section>
</extension>
@@ -185,23 +184,23 @@
</extension>
- <extension point="org.eclipse.debug.ui.launchConfigurationTypeImages">
- <launchConfigurationTypeImage
- id="org.apache.geronimo.st.ui.launchConfigurationTypeImage"
- configTypeID="org.apache.geronimo.st.core.launchConfigurationType"
- icon="icons/obj16/littleG.gif">
- </launchConfigurationTypeImage>
- </extension>
-
- <extension point="org.eclipse.debug.ui.launchConfigurationTabGroups">
- <launchConfigurationTabGroup
- id="org.apache.geronimo.st.ui.launchConfigurationTabGroup"
- type="org.apache.geronimo.st.core.launchConfigurationType"
- class="org.apache.geronimo.st.ui.internal.GeronimoLaunchConfigurationTabGroup">
- </launchConfigurationTabGroup>
- </extension>
-
-
+ <extension point="org.eclipse.debug.ui.launchConfigurationTypeImages">
+ <launchConfigurationTypeImage
+ id="org.apache.geronimo.st.ui.launchConfigurationTypeImage"
+ configTypeID="org.apache.geronimo.st.core.launchConfigurationType"
+ icon="icons/obj16/littleG.gif">
+ </launchConfigurationTypeImage>
+ </extension>
+
+ <extension point="org.eclipse.debug.ui.launchConfigurationTabGroups">
+ <launchConfigurationTabGroup
+ id="org.apache.geronimo.st.ui.launchConfigurationTabGroup"
+ type="org.apache.geronimo.st.core.launchConfigurationType"
+ class="org.apache.geronimo.st.ui.internal.GeronimoLaunchConfigurationTabGroup">
+ </launchConfigurationTabGroup>
+ </extension>
+
+
<extension
point="org.apache.geronimo.st.ui.actionURLs">
<server_prefix>org.apache.geronimo.</server_prefix>
@@ -211,5 +210,3 @@
</plugin>
-
-
\ No newline at end of file
Modified: geronimo/devtools/eclipse-plugin/branches/2.1.4/testsuite/plugins/org.apache.geronimo.testsuite.common/src/main/java/org/apache/geronimo/testsuite/common/ui/AbbotHelper.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/branches/2.1.4/testsuite/plugins/org.apache.geronimo.testsuite.common/src/main/java/org/apache/geronimo/testsuite/common/ui/AbbotHelper.java?rev=705953&r1=705952&r2=705953&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/branches/2.1.4/testsuite/plugins/org.apache.geronimo.testsuite.common/src/main/java/org/apache/geronimo/testsuite/common/ui/AbbotHelper.java (original)
+++ geronimo/devtools/eclipse-plugin/branches/2.1.4/testsuite/plugins/org.apache.geronimo.testsuite.common/src/main/java/org/apache/geronimo/testsuite/common/ui/AbbotHelper.java Sat Oct 18 19:46:53 2008
@@ -174,6 +174,19 @@
waitTime( 1500 );
}
+ //helper method when there are multiple text boxes
+ public void setTextFieldForMulti (Shell aShell, String oldText, String newText) throws MultipleFoundException, NotFoundException {
+ Text text = (Text) finder.find (aShell, new TextMultipleMatcher(oldText, Text.class, true));
+ if (oldText.length() > 0)
+ {
+ TextTester.getTextTester().actionSelect (text, 0, oldText.length());
+ TextTester.getTextTester().actionKeyString (newText);
+ } else {
+ TextTester.getTextTester().actionKeyString (text, newText);
+ }
+ waitTime( 1500 );
+ }
+
//helper method to select a Tab
public void selectTabItem(Shell aShell, String newText)throws MultipleFoundException,NotFoundException
{
@@ -206,8 +219,8 @@
public void waitForDialogDisposal (Shell aShell) {
while (!ShellTester.getShellTester().isDisposed (aShell))
ShellTester.getShellTester().actionDelay (1000);
- // wait an extra 2 seconds
- ShellTester.getShellTester().actionDelay (2000);
+ // wait an extra 4 seconds
+ ShellTester.getShellTester().actionDelay (4000);
}
// helper method
@@ -229,7 +242,11 @@
}
public void waitTime (long time) {
- ShellTester.getShellTester().actionDelay (time);
+ try {
+ ShellTester.getShellTester().actionDelay (time);
+ }
+ catch (Exception e) {
+ }
}
// TabMatcher has bugs currently with abbot. This is a inner class
@@ -283,6 +300,45 @@
}
}
+ //helper inner class for multiple text boxes
+ final class TextMultipleMatcher extends TextMultiMatcher{
+ public TextMultipleMatcher(String text, Class clazz, boolean mustBeShowing) {
+ super(text, clazz, mustBeShowing);
+ }
+
+ /**
+ * Constructs a new {@link TextMultiMatcher}.
+ */
+ public TextMultipleMatcher(String text, boolean mustBeShowing) {
+ this(text, Widget.class, mustBeShowing);
+ }
+
+ /**
+ * Constructs a new {@link TextMultiMatcher}.
+ */
+ public TextMultipleMatcher(String text, Class clazz) {
+ this(text, clazz, false);
+ }
+
+ /**
+ * Constructs a new {@link TextMultiMatcher}.
+ */
+ public TextMultipleMatcher(String text) {
+ this(text, Widget.class, false);
+ }
+
+ public Widget bestMatch(List<Widget> candidates)
+ throws MultipleFoundException {
+ Text text = null;
+ for (int i = 0; i < candidates.size(); i++) {
+ text = (Text)candidates.get(i);
+ if (TextTester.getTextTester().getText(text).equals(candidates))
+ return text;
+ }
+ return text;
+ }
+
+ }
// helper inner class
final class ButtonMultiMatcher extends TextMultiMatcher {
public ButtonMultiMatcher(String text, Class clazz, boolean mustBeShowing) {
Modified: geronimo/devtools/eclipse-plugin/branches/2.1.4/testsuite/plugins/org.apache.geronimo.testsuite.common/src/main/java/org/apache/geronimo/testsuite/common/ui/ServerTasks.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/branches/2.1.4/testsuite/plugins/org.apache.geronimo.testsuite.common/src/main/java/org/apache/geronimo/testsuite/common/ui/ServerTasks.java?rev=705953&r1=705952&r2=705953&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/branches/2.1.4/testsuite/plugins/org.apache.geronimo.testsuite.common/src/main/java/org/apache/geronimo/testsuite/common/ui/ServerTasks.java (original)
+++ geronimo/devtools/eclipse-plugin/branches/2.1.4/testsuite/plugins/org.apache.geronimo.testsuite.common/src/main/java/org/apache/geronimo/testsuite/common/ui/ServerTasks.java Sat Oct 18 19:46:53 2008
@@ -1,137 +1,144 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one or more
- * contributor license agreements. See the NOTICE file distributed with
- * this work for additional information regarding copyright ownership.
- * The ASF licenses this file to You under the Apache License, Version 2.0
- * (the "License"); you may not use this file except in compliance with
- * the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing, software
- * distributed under the License is distributed on an "AS IS" BASIS,
- * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
- * See the License for the specific language governing permissions and
- * limitations under the License.
- */
-
-package org.apache.geronimo.testsuite.common.ui;
-
-import java.io.File;
-
-import org.eclipse.core.resources.IWorkspace;
-import org.eclipse.core.resources.ResourcesPlugin;
-import org.eclipse.jface.dialogs.IDialogConstants;
-import org.eclipse.swt.widgets.Shell;
-
-import abbot.swt.finder.generic.MultipleFoundException;
-import abbot.swt.finder.generic.NotFoundException;
-
-public class ServerTasks {
- Shell workbenchShell;
- AbbotHelper aHelper;
- String serverVersion;
-
- public ServerTasks (Shell shell, AbbotHelper helper, String serverVersion) {
- workbenchShell = shell;
- aHelper = helper;
- this.serverVersion = serverVersion;
- }
-
- // just getting through this with no exceptions is success.
- public void createServer() throws MultipleFoundException, NotFoundException {
- // Launch the New Project wizard and aHelper.wait for it to open.
- Shell wizardShell = aHelper.clickMenuItem (workbenchShell,
- new String[] {"&File", "&New\tAlt+Shift+N", "&Other..."},
- "New");
-
- // Having 2 tree items with the same name is not very good design
- aHelper.clickTreeItem (wizardShell,
- new String[] {"Server", "Server"});
- aHelper.clickButton (wizardShell, IDialogConstants.NEXT_LABEL);
-
- // Select the proper Server. why do we have this in there twice?
- aHelper.clickItem (wizardShell, Constants.getConstant(serverVersion, Constants.SERVERNAME));
- aHelper.clickButton (wizardShell, IDialogConstants.NEXT_LABEL);
-
- //TODO would be nice to install the server instead of have to know where it is in advance
- aHelper.setTextField (wizardShell, "", getServerInstallDirectory());
-
- aHelper.clickButton (wizardShell, IDialogConstants.NEXT_LABEL);
- aHelper.clickButton (wizardShell, IDialogConstants.NEXT_LABEL);
- aHelper.clickButton (wizardShell, IDialogConstants.NEXT_LABEL);
- aHelper.clickButton (wizardShell, IDialogConstants.FINISH_LABEL);
- }
-
- public void startServer () throws MultipleFoundException, NotFoundException {
- String serverDisplay = Constants.getConstant(serverVersion, Constants.SERVERDISPLAY);
- aHelper.clickMenuItem (workbenchShell,
- new String[] {"&Window", "Show &View", "Servers"});
-
- aHelper.rightClickItem (workbenchShell, serverDisplay,
- new String[] {"&Start"});
- aHelper.waitForServerStatus (workbenchShell, serverDisplay, "Started");
-
- aHelper.waitTime( 1500 );
- }
-
- public void stopServer () throws MultipleFoundException, NotFoundException {
- String serverDisplay = Constants.getConstant(serverVersion, Constants.SERVERDISPLAY);
- aHelper.clickMenuItem (workbenchShell,
- new String[] {"&Window", "Show &View", "Servers"});
-
- aHelper.rightClickItem (workbenchShell, serverDisplay,
- new String[] {"S&top"});
- aHelper.waitForServerStatus (workbenchShell, serverDisplay, "Stopped");
-
- aHelper.waitTime( 1500 );
- }
-
-
- // remove the server so that the test will be reset back to its original state.
- public void removeServer () throws MultipleFoundException, NotFoundException {
- Shell preferenceShell = aHelper.clickMenuItem (workbenchShell,
- new String[] {"&Window", "&Preferences"},
- "Preferences");
-
- aHelper.clickTreeItem (preferenceShell,
- new String[] {"Server", "Runtime Environments"});
- aHelper.clickItem (preferenceShell, Constants.getConstant(serverVersion, Constants.SERVERRUNTIME));
- Shell questionShell = aHelper.clickButton (preferenceShell, "&Remove", "Server");
-
- aHelper.clickButton (questionShell, IDialogConstants.OK_LABEL);
- aHelper.clickButton (preferenceShell, IDialogConstants.OK_LABEL);
- }
-
- public void publishAllProjects () throws MultipleFoundException, NotFoundException {
- String serverDisplay = Constants.getConstant(serverVersion, Constants.SERVERDISPLAY);
-
- aHelper.clickMenuItem (workbenchShell,
- new String[] {"&Window", "Show &View", "Servers"});
- Shell deployShell = aHelper.rightClickItem (workbenchShell, serverDisplay,
- new String[] {"Add and Remove &Projects..."}, "Add and Remove Projects");
- aHelper.clickButton (deployShell, "Add A&ll >>");
-
- aHelper.clickButton (deployShell, IDialogConstants.FINISH_LABEL);
- aHelper.waitForDialogDisposal (deployShell);
- }
-
- private String getServerInstallDirectory() {
- IWorkspace ws = ResourcesPlugin.getWorkspace();
- String location = ws.getRoot().getLocation().toOSString();
- int index = location.lastIndexOf(File.separatorChar);
- if (index > -1) {
- location = location.substring(0,index);
- }
- index = location.lastIndexOf(File.separatorChar);
- if (index > -1) {
- location = location.substring(0,index);
- }
- index = location.lastIndexOf(File.separatorChar);
- if (index > -1) {
- location = location.substring(0,index);
- }
- location = location + File.separatorChar + Constants.getConstant(serverVersion, Constants.SERVERPATH); ;
- return location;
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.geronimo.testsuite.common.ui;
+
+import java.io.File;
+
+import org.eclipse.core.resources.IWorkspace;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.swt.widgets.Shell;
+
+import abbot.swt.finder.generic.MultipleFoundException;
+import abbot.swt.finder.generic.NotFoundException;
+
+public class ServerTasks {
+ Shell workbenchShell;
+ AbbotHelper aHelper;
+ String serverVersion;
+
+ public ServerTasks (Shell shell, AbbotHelper helper, String serverVersion) {
+ workbenchShell = shell;
+ aHelper = helper;
+ this.serverVersion = serverVersion;
+ }
+
+ // just getting through this with no exceptions is success.
+ public void createServer() throws MultipleFoundException, NotFoundException {
+ // Launch the New Project wizard and aHelper.wait for it to open.
+ Shell wizardShell = aHelper.clickMenuItem (workbenchShell,
+ new String[] {"&File", "&New\tAlt+Shift+N", "&Other..."},
+ "New");
+
+ // Having 2 tree items with the same name is not very good design
+ aHelper.clickTreeItem (wizardShell,
+ new String[] {"Server", "Server"});
+ aHelper.clickButton (wizardShell, IDialogConstants.NEXT_LABEL);
+
+ // Select the proper Server. why do we have this in there twice?
+ aHelper.clickItem (wizardShell, Constants.getConstant(serverVersion, Constants.SERVERNAME));
+ aHelper.clickButton (wizardShell, IDialogConstants.NEXT_LABEL);
+
+ //TODO would be nice to install the server instead of have to know where it is in advance
+ aHelper.setTextField (wizardShell, "", getServerInstallDirectory());
+
+ aHelper.clickButton (wizardShell, IDialogConstants.NEXT_LABEL);
+ aHelper.clickButton (wizardShell, IDialogConstants.NEXT_LABEL);
+ aHelper.clickButton (wizardShell, IDialogConstants.NEXT_LABEL);
+ aHelper.clickButton (wizardShell, IDialogConstants.FINISH_LABEL);
+ }
+
+ public void editServer()throws MultipleFoundException, NotFoundException {
+ String serverDisplay = Constants.getConstant(serverVersion, Constants.SERVERDISPLAY);
+ aHelper.clickMenuItem (workbenchShell,
+ new String[] {"&Window", "Show &View", "Servers"});
+ aHelper.doubleClickItem(workbenchShell, serverDisplay);
+ }
+
+ public void startServer () throws MultipleFoundException, NotFoundException {
+ String serverDisplay = Constants.getConstant(serverVersion, Constants.SERVERDISPLAY);
+ aHelper.clickMenuItem (workbenchShell,
+ new String[] {"&Window", "Show &View", "Servers"});
+
+ aHelper.rightClickItem (workbenchShell, serverDisplay,
+ new String[] {"&Start"});
+ aHelper.waitForServerStatus (workbenchShell, serverDisplay, "Started");
+
+ aHelper.waitTime( 1500 );
+ }
+
+ public void stopServer () throws MultipleFoundException, NotFoundException {
+ String serverDisplay = Constants.getConstant(serverVersion, Constants.SERVERDISPLAY);
+ aHelper.clickMenuItem (workbenchShell,
+ new String[] {"&Window", "Show &View", "Servers"});
+
+ aHelper.rightClickItem (workbenchShell, serverDisplay,
+ new String[] {"S&top"});
+ aHelper.waitForServerStatus (workbenchShell, serverDisplay, "Stopped");
+
+ aHelper.waitTime( 1500 );
+ }
+
+
+ // remove the server so that the test will be reset back to its original state.
+ public void removeServer () throws MultipleFoundException, NotFoundException {
+ Shell preferenceShell = aHelper.clickMenuItem (workbenchShell,
+ new String[] {"&Window", "&Preferences"},
+ "Preferences");
+
+ aHelper.clickTreeItem (preferenceShell,
+ new String[] {"Server", "Runtime Environments"});
+ aHelper.clickItem (preferenceShell, Constants.getConstant(serverVersion, Constants.SERVERRUNTIME));
+ Shell questionShell = aHelper.clickButton (preferenceShell, "&Remove", "Server");
+
+ aHelper.clickButton (questionShell, IDialogConstants.OK_LABEL);
+ aHelper.clickButton (preferenceShell, IDialogConstants.OK_LABEL);
+ }
+
+ public void publishAllProjects () throws MultipleFoundException, NotFoundException {
+ String serverDisplay = Constants.getConstant(serverVersion, Constants.SERVERDISPLAY);
+
+ aHelper.clickMenuItem (workbenchShell,
+ new String[] {"&Window", "Show &View", "Servers"});
+ Shell deployShell = aHelper.rightClickItem (workbenchShell, serverDisplay,
+ new String[] {"Add and Remove &Projects..."}, "Add and Remove Projects");
+ aHelper.clickButton (deployShell, "Add A&ll >>");
+
+ aHelper.clickButton (deployShell, IDialogConstants.FINISH_LABEL);
+ aHelper.waitForDialogDisposal (deployShell);
+ }
+
+ private String getServerInstallDirectory() {
+ IWorkspace ws = ResourcesPlugin.getWorkspace();
+ String location = ws.getRoot().getLocation().toOSString();
+ int index = location.lastIndexOf(File.separatorChar);
+ if (index > -1) {
+ location = location.substring(0,index);
+ }
+ index = location.lastIndexOf(File.separatorChar);
+ if (index > -1) {
+ location = location.substring(0,index);
+ }
+ index = location.lastIndexOf(File.separatorChar);
+ if (index > -1) {
+ location = location.substring(0,index);
+ }
+ location = location + File.separatorChar + Constants.getConstant(serverVersion, Constants.SERVERPATH); ;
+ return location;
+ }
+}
Added: geronimo/devtools/eclipse-plugin/branches/2.1.4/testsuite/plugins/org.apache.geronimo.testsuite.v20/src/main/java/org/apache/geronimo/testsuite/v20/ui/SharedLibPojoTest.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/branches/2.1.4/testsuite/plugins/org.apache.geronimo.testsuite.v20/src/main/java/org/apache/geronimo/testsuite/v20/ui/SharedLibPojoTest.java?rev=705953&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/branches/2.1.4/testsuite/plugins/org.apache.geronimo.testsuite.v20/src/main/java/org/apache/geronimo/testsuite/v20/ui/SharedLibPojoTest.java (added)
+++ geronimo/devtools/eclipse-plugin/branches/2.1.4/testsuite/plugins/org.apache.geronimo.testsuite.v20/src/main/java/org/apache/geronimo/testsuite/v20/ui/SharedLibPojoTest.java Sat Oct 18 19:46:53 2008
@@ -0,0 +1,270 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.geronimo.testsuite.v20.ui;
+
+import java.io.FileInputStream;
+
+import org.apache.geronimo.testsuite.common.AssertUtil;
+import org.apache.geronimo.testsuite.common.selenium.EclipseSelenium;
+import org.apache.geronimo.testsuite.common.ui.AbbotHelper;
+import org.apache.geronimo.testsuite.common.ui.Constants;
+import org.apache.geronimo.testsuite.common.ui.ProjectTasks;
+import org.apache.geronimo.testsuite.common.ui.ServerTasks;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.swt.widgets.Shell;
+
+import abbot.swt.eclipse.junit.extensions.WorkbenchTestCase;
+import abbot.swt.eclipse.utils.WorkbenchUtilities;
+
+/*
+ * @version $Rev$ $Date$
+ */
+public class SharedLibPojoTest extends WorkbenchTestCase {
+
+ Shell aShell;
+ AbbotHelper aHelper;
+ boolean success = false;
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ deleteProjects();
+ deleteServer();
+ }
+
+ public void testSharedLib()
+ {
+ createPojoProject();
+ copyCodeToPojoProject();
+ createHelloWorldProject();
+ copyCodeToHellowWorldProject();
+ modifyHelloWorldBuildPath();
+ deployHelloWorldProject();
+ addSharedLibSupport();
+ displayApplication();
+ }
+
+ public void createPojoProject()
+ {
+ try {
+ aShell = WorkbenchUtilities.getWorkbenchWindow().getShell();
+ aHelper = new AbbotHelper(aShell);
+ ServerTasks serverTasks = new ServerTasks(aShell, aHelper, Constants.SERVER_V20 );
+ serverTasks.createServer();
+ aHelper.clickMenuItem (aShell,new String[] {"&Window", "&Close Perspective"});
+ Shell perspectiveShell = aHelper.clickMenuItem (aShell,
+ new String[] {"&Window", "&Open Perspective", "&Other..."},
+ "Open Perspective");
+ aHelper.clickItem (perspectiveShell, "Java");
+ aHelper.clickButton (perspectiveShell, IDialogConstants.OK_LABEL);
+
+ Shell wizardShell = aHelper.clickMenuItem (aShell,
+ new String[] {"&File", "&New\tAlt+Shift+N", "&Other..."},
+ "New");
+ aHelper.clickTreeItem (wizardShell,
+ new String[] {"Java", "Java Project"});
+ aHelper.clickButton (wizardShell, IDialogConstants.NEXT_LABEL);
+ aHelper.setTextField(wizardShell,"", "CurrencyConverterPojo");
+ aHelper.clickButton (wizardShell, IDialogConstants.NEXT_LABEL);
+ aHelper.clickButton (wizardShell, IDialogConstants.FINISH_LABEL);
+ aHelper.doubleClickItem(aShell, "CurrencyConverterPojo");
+
+ wizardShell=aHelper.clickMenuItem (aShell,
+ new String[] {"&File", "&New\tAlt+Shift+N", "&Other..."},
+ "New");
+ aHelper.clickTreeItem (wizardShell,
+ new String[] {"Java", "Package"});
+ aHelper.clickButton (wizardShell, IDialogConstants.NEXT_LABEL);
+ aHelper.setTextField(wizardShell,"", "myPackage");
+ aHelper.clickButton (wizardShell, IDialogConstants.FINISH_LABEL);
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ public void copyCodeToPojoProject()
+ {
+ try {
+ IWorkspaceRoot aWSRoot = ResourcesPlugin.getWorkspace().getRoot();
+ IProject aProject = aWSRoot.getProject ("CurrencyConverterPojo");
+ String fileDir =aWSRoot.getLocation().toOSString()+ "/src/main/resources/sharedlib";
+ IFile aFile = aProject.getFile("src/myPackage/CurrencyConverter.java");
+ aFile.create(new FileInputStream (fileDir + "/CurrencyConverter.java"), true, null);
+ aHelper.waitTime(1500);
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ public void createHelloWorldProject()
+ {
+ try {
+ aHelper.clickMenuItem (aShell,
+ new String[] {"&Window", "&Close Perspective"});
+ Shell perspectiveShell = aHelper.clickMenuItem (aShell,
+ new String[] {"&Window", "&Open Perspective", "&Other..."},
+ "Open Perspective");
+ aHelper.clickItem (perspectiveShell, "Java EE (default)");
+ aHelper.clickButton (perspectiveShell, IDialogConstants.OK_LABEL);
+ Shell wizardShell = aHelper.clickMenuItem (aShell,
+ new String[] {"&File", "&New\tAlt+Shift+N", "&Other..."},
+ "New");
+ aHelper.clickTreeItem (wizardShell,
+ new String[] {"Web", "Dynamic Web Project"});
+ aHelper.clickButton (wizardShell, IDialogConstants.NEXT_LABEL);
+ aHelper.setTextField(wizardShell,"", "HelloWorld");
+ aHelper.clickButton (wizardShell, IDialogConstants.NEXT_LABEL);
+ aHelper.clickButton (wizardShell, IDialogConstants.NEXT_LABEL);
+ aHelper.clickButton(wizardShell, "Add a runtime dependency to Geronimo's shared library");
+ aHelper.clickButton (wizardShell, IDialogConstants.FINISH_LABEL);
+ aHelper.waitForDialogDisposal(wizardShell);
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ }
+ public void copyCodeToHellowWorldProject()
+ {
+ try {
+ IWorkspaceRoot aWSRoot = ResourcesPlugin.getWorkspace().getRoot();
+ IProject aProject = aWSRoot.getProject ("HelloWorld");
+ String fileDir =aWSRoot.getLocation().toOSString()+"/src/main/resources/sharedlib";
+ IFile aFile = aProject.getFile("WebContent/index.jsp");
+ aFile.create(new FileInputStream (fileDir + "/index.jsp"), true, null);
+ aHelper.waitTime(1500);
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ public void modifyHelloWorldBuildPath()
+ {
+ try {
+ Shell wizardShell=aHelper.clickMenuItem (aShell,
+ new String[] {"&Project","&Properties"},
+ "Properties for HelloWorld");
+ aHelper.clickItem(wizardShell,"Java Build Path");
+ aHelper.selectTabItem(wizardShell,"&Projects");
+ Shell newShell=aHelper.clickButton(wizardShell, "&Add...","Required Project Selection");
+ aHelper.clickButton(newShell, "&Select All");
+ aHelper.clickButton(newShell, IDialogConstants.OK_LABEL);
+ aHelper.clickButton(wizardShell, IDialogConstants.OK_LABEL);
+ newShell=aHelper.clickMenuItem(aShell, new String[]{"&Project","Clea&n..."}, "Clean");
+ aHelper.clickButton(newShell, IDialogConstants.OK_LABEL);
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ public void addSharedLibSupport()
+ {
+ try {
+ ServerTasks serverTasks = new ServerTasks(aShell, aHelper, Constants.SERVER_V20 );
+ serverTasks.editServer();
+ aHelper.clickButton(aShell, "Enable in-place shared library support.");
+ aHelper.clickMenuItem(aShell,new String[]{"&File","&Save"});
+ aHelper.clickMenuItem(aShell, new String[]{"&File","C&lose All"});
+ serverTasks.startServer();
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ public void deployHelloWorldProject()
+ {
+ try {
+ aHelper.clickMenuItem (aShell,
+ new String[] {"&Window", "&Close Perspective"});
+ Shell perspectiveShell = aHelper.clickMenuItem (aShell,
+ new String[] {"&Window", "&Open Perspective", "&Other..."},
+ "Open Perspective");
+ aHelper.clickItem (perspectiveShell, "Java EE (default)");
+ aHelper.clickButton (perspectiveShell, IDialogConstants.OK_LABEL);
+ ServerTasks serverTasks = new ServerTasks(aShell, aHelper, Constants.SERVER_V20 );
+ serverTasks.publishAllProjects();
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ public void displayApplication()
+ {
+ try {
+ EclipseSelenium selenium = new EclipseSelenium();
+ selenium.start();
+ selenium.open("http://localhost:8080/HelloWorld/index.jsp");
+ selenium.waitForPageToLoad("60000");
+ AssertUtil.assertTrue(selenium.getHtmlSource().indexOf( "Hello World!!" ) > 0);
+ AssertUtil.assertTrue(selenium.getHtmlSource().indexOf( "100 USD = 3938.81 INR" ) > 0);
+ aHelper.waitTime(1500);
+ selenium.stop();
+ success=true;
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ }
+ assertTrue(success);
+ }
+
+ public void deleteProjects()
+ {
+ try {
+ ProjectTasks projectTasks = new ProjectTasks(aShell, aHelper, Constants.SERVER_V20 );
+ // delete the projects that have been created
+ // reverse alphabetical is a little smoother
+ projectTasks.deleteProject ("HelloWorld");
+ projectTasks.deleteProject ("CurrencyConverterPojo");
+ success=true;
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ }
+ assertTrue(success);
+ }
+
+ public void deleteServer()
+ {
+ try {
+ ServerTasks serverTasks = new ServerTasks(aShell, aHelper, Constants.SERVER_V20 );
+ // stop the server
+ serverTasks.stopServer();
+ // remove the server
+ serverTasks.removeServer();
+ success=true;
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ }
+ assertTrue(success);
+ }
+
+}
Propchange: geronimo/devtools/eclipse-plugin/branches/2.1.4/testsuite/plugins/org.apache.geronimo.testsuite.v20/src/main/java/org/apache/geronimo/testsuite/v20/ui/SharedLibPojoTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/devtools/eclipse-plugin/branches/2.1.4/testsuite/plugins/org.apache.geronimo.testsuite.v20/src/main/java/org/apache/geronimo/testsuite/v20/ui/SharedLibPojoTest.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/devtools/eclipse-plugin/branches/2.1.4/testsuite/plugins/org.apache.geronimo.testsuite.v20/src/main/java/org/apache/geronimo/testsuite/v20/ui/SharedLibPojoTest.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/devtools/eclipse-plugin/branches/2.1.4/testsuite/plugins/org.apache.geronimo.testsuite.v20/src/main/resources/sharedlib/CurrencyConverter.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/branches/2.1.4/testsuite/plugins/org.apache.geronimo.testsuite.v20/src/main/resources/sharedlib/CurrencyConverter.java?rev=705953&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/branches/2.1.4/testsuite/plugins/org.apache.geronimo.testsuite.v20/src/main/resources/sharedlib/CurrencyConverter.java (added)
+++ geronimo/devtools/eclipse-plugin/branches/2.1.4/testsuite/plugins/org.apache.geronimo.testsuite.v20/src/main/resources/sharedlib/CurrencyConverter.java Sat Oct 18 19:46:53 2008
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package myPackage;
+
+import java.math.BigDecimal;
+
+/*
+ * @version $Rev$ $Date$
+ */
+public class CurrencyConverter {
+
+ private static BigDecimal rupeeRate = new BigDecimal("39.3881");
+ private static BigDecimal euroRate = new BigDecimal("0.0170853");
+
+ public static BigDecimal dollarToRupees(BigDecimal dollars) {
+ BigDecimal result = dollars.multiply(rupeeRate);
+ return result.setScale(2, BigDecimal.ROUND_UP);
+ }
+
+ public static BigDecimal rupeesToEuro(BigDecimal rupees) {
+ BigDecimal result = rupees.multiply(euroRate);
+ return result.setScale(2, BigDecimal.ROUND_UP);
+ }
+}
Propchange: geronimo/devtools/eclipse-plugin/branches/2.1.4/testsuite/plugins/org.apache.geronimo.testsuite.v20/src/main/resources/sharedlib/CurrencyConverter.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/devtools/eclipse-plugin/branches/2.1.4/testsuite/plugins/org.apache.geronimo.testsuite.v20/src/main/resources/sharedlib/CurrencyConverter.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/devtools/eclipse-plugin/branches/2.1.4/testsuite/plugins/org.apache.geronimo.testsuite.v20/src/main/resources/sharedlib/CurrencyConverter.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/devtools/eclipse-plugin/branches/2.1.4/testsuite/plugins/org.apache.geronimo.testsuite.v20/src/main/resources/sharedlib/index.jsp
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/branches/2.1.4/testsuite/plugins/org.apache.geronimo.testsuite.v20/src/main/resources/sharedlib/index.jsp?rev=705953&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/branches/2.1.4/testsuite/plugins/org.apache.geronimo.testsuite.v20/src/main/resources/sharedlib/index.jsp (added)
+++ geronimo/devtools/eclipse-plugin/branches/2.1.4/testsuite/plugins/org.apache.geronimo.testsuite.v20/src/main/resources/sharedlib/index.jsp Sat Oct 18 19:46:53 2008
@@ -0,0 +1,32 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<!-- @version $Rev$ $Date$ -->
+
+<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
+ pageEncoding="ISO-8859-1"%>
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Insert title here</title>
+</head>
+<body>
+Hello World!!
+100 USD = <%= myPackage.CurrencyConverter.dollarToRupees(new java.math.BigDecimal(100.0)) %> INR
+</body>
+</html>
Propchange: geronimo/devtools/eclipse-plugin/branches/2.1.4/testsuite/plugins/org.apache.geronimo.testsuite.v20/src/main/resources/sharedlib/index.jsp
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/devtools/eclipse-plugin/branches/2.1.4/testsuite/plugins/org.apache.geronimo.testsuite.v20/src/main/resources/sharedlib/index.jsp
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/devtools/eclipse-plugin/branches/2.1.4/testsuite/plugins/org.apache.geronimo.testsuite.v20/src/main/resources/sharedlib/index.jsp
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: geronimo/devtools/eclipse-plugin/branches/2.1.4/testsuite/plugins/org.apache.geronimo.testsuite.v20/test.xml
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/branches/2.1.4/testsuite/plugins/org.apache.geronimo.testsuite.v20/test.xml?rev=705953&r1=705952&r2=705953&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/branches/2.1.4/testsuite/plugins/org.apache.geronimo.testsuite.v20/test.xml (original)
+++ geronimo/devtools/eclipse-plugin/branches/2.1.4/testsuite/plugins/org.apache.geronimo.testsuite.v20/test.xml Sat Oct 18 19:46:53 2008
@@ -75,6 +75,35 @@
<!--
#########################################################################
## ##
+ ## Copy the testsuite.v20 resources required for the SharedLib project ##
+ ## ##
+ #########################################################################
+ -->
+ <mkdir dir="${jdt-folder}/src"/>
+ <copy todir="${jdt-folder}/src">
+ <fileset dir="${eclipse-home}/../../../plugins/org.apache.geronimo.testsuite.v20/src">
+ <include name="**/*.java"/>
+ <include name="**/*.jsp"/>
+ </fileset>
+ </copy>
+
+ <!--
+ ######################################################################### ##
+ ## ##
+ ## Shared Lib Pojo testcase ##
+ ## ##
+ #########################################################################
+ -->
+ <ant target="ui-test" antfile="${library-file}" dir="${eclipse-home}">
+ <property name="data-dir" value="${jdt-folder}"/>
+ <property name="plugin-name" value="${plugin-name}"/>
+ <property name="classname"
+ value="org.apache.geronimo.testsuite.v20.ui.SharedLibPojoTest"/>
+ </ant>
+
+ <!--
+ #########################################################################
+ ## ##
## Define new server testcase ##
## ##
#########################################################################
Added: geronimo/devtools/eclipse-plugin/branches/2.1.4/testsuite/plugins/org.apache.geronimo.testsuite.v21/src/main/java/org/apache/geronimo/testsuite/v21/ui/SharedLibPojoTest.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/branches/2.1.4/testsuite/plugins/org.apache.geronimo.testsuite.v21/src/main/java/org/apache/geronimo/testsuite/v21/ui/SharedLibPojoTest.java?rev=705953&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/branches/2.1.4/testsuite/plugins/org.apache.geronimo.testsuite.v21/src/main/java/org/apache/geronimo/testsuite/v21/ui/SharedLibPojoTest.java (added)
+++ geronimo/devtools/eclipse-plugin/branches/2.1.4/testsuite/plugins/org.apache.geronimo.testsuite.v21/src/main/java/org/apache/geronimo/testsuite/v21/ui/SharedLibPojoTest.java Sat Oct 18 19:46:53 2008
@@ -0,0 +1,270 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package org.apache.geronimo.testsuite.v21.ui;
+
+import java.io.FileInputStream;
+
+import org.apache.geronimo.testsuite.common.AssertUtil;
+import org.apache.geronimo.testsuite.common.selenium.EclipseSelenium;
+import org.apache.geronimo.testsuite.common.ui.AbbotHelper;
+import org.apache.geronimo.testsuite.common.ui.Constants;
+import org.apache.geronimo.testsuite.common.ui.ProjectTasks;
+import org.apache.geronimo.testsuite.common.ui.ServerTasks;
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.jface.dialogs.IDialogConstants;
+import org.eclipse.swt.widgets.Shell;
+
+import abbot.swt.eclipse.junit.extensions.WorkbenchTestCase;
+import abbot.swt.eclipse.utils.WorkbenchUtilities;
+
+/*
+ * @version $Rev$ $Date$
+ */
+public class SharedLibPojoTest extends WorkbenchTestCase {
+
+ Shell aShell;
+ AbbotHelper aHelper;
+ boolean success = false;
+
+ protected void setUp() throws Exception {
+ super.setUp();
+ }
+
+ protected void tearDown() throws Exception {
+ super.tearDown();
+ deleteProjects();
+ deleteServer();
+ }
+
+ public void testSharedLib()
+ {
+ createPojoProject();
+ copyCodeToPojoProject();
+ createHelloWorldProject();
+ copyCodeToHellowWorldProject();
+ modifyHelloWorldBuildPath();
+ deployHelloWorldProject();
+ addSharedLibSupport();
+ displayApplication();
+ }
+
+ public void createPojoProject()
+ {
+ try {
+ aShell = WorkbenchUtilities.getWorkbenchWindow().getShell();
+ aHelper = new AbbotHelper(aShell);
+ ServerTasks serverTasks = new ServerTasks(aShell, aHelper, Constants.SERVER_V21 );
+ serverTasks.createServer();
+ aHelper.clickMenuItem (aShell,new String[] {"&Window", "&Close Perspective"});
+ Shell perspectiveShell = aHelper.clickMenuItem (aShell,
+ new String[] {"&Window", "&Open Perspective", "&Other..."},
+ "Open Perspective");
+ aHelper.clickItem (perspectiveShell, "Java");
+ aHelper.clickButton (perspectiveShell, IDialogConstants.OK_LABEL);
+
+ Shell wizardShell = aHelper.clickMenuItem (aShell,
+ new String[] {"&File", "&New\tAlt+Shift+N", "&Other..."},
+ "New");
+ aHelper.clickTreeItem (wizardShell,
+ new String[] {"Java", "Java Project"});
+ aHelper.clickButton (wizardShell, IDialogConstants.NEXT_LABEL);
+ aHelper.setTextField(wizardShell,"", "CurrencyConverterPojo");
+ aHelper.clickButton (wizardShell, IDialogConstants.NEXT_LABEL);
+ aHelper.clickButton (wizardShell, IDialogConstants.FINISH_LABEL);
+ aHelper.doubleClickItem(aShell, "CurrencyConverterPojo");
+
+ wizardShell=aHelper.clickMenuItem (aShell,
+ new String[] {"&File", "&New\tAlt+Shift+N", "&Other..."},
+ "New");
+ aHelper.clickTreeItem (wizardShell,
+ new String[] {"Java", "Package"});
+ aHelper.clickButton (wizardShell, IDialogConstants.NEXT_LABEL);
+ aHelper.setTextField(wizardShell,"", "myPackage");
+ aHelper.clickButton (wizardShell, IDialogConstants.FINISH_LABEL);
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ public void copyCodeToPojoProject()
+ {
+ try {
+ IWorkspaceRoot aWSRoot = ResourcesPlugin.getWorkspace().getRoot();
+ IProject aProject = aWSRoot.getProject ("CurrencyConverterPojo");
+ String fileDir =aWSRoot.getLocation().toOSString()+ "/src/main/resources/sharedlib";
+ IFile aFile = aProject.getFile("src/myPackage/CurrencyConverter.java");
+ aFile.create(new FileInputStream (fileDir + "/CurrencyConverter.java"), true, null);
+ aHelper.waitTime(1500);
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ public void createHelloWorldProject()
+ {
+ try {
+ aHelper.clickMenuItem (aShell,
+ new String[] {"&Window", "&Close Perspective"});
+ Shell perspectiveShell = aHelper.clickMenuItem (aShell,
+ new String[] {"&Window", "&Open Perspective", "&Other..."},
+ "Open Perspective");
+ aHelper.clickItem (perspectiveShell, "Java EE (default)");
+ aHelper.clickButton (perspectiveShell, IDialogConstants.OK_LABEL);
+ Shell wizardShell = aHelper.clickMenuItem (aShell,
+ new String[] {"&File", "&New\tAlt+Shift+N", "&Other..."},
+ "New");
+ aHelper.clickTreeItem (wizardShell,
+ new String[] {"Web", "Dynamic Web Project"});
+ aHelper.clickButton (wizardShell, IDialogConstants.NEXT_LABEL);
+ aHelper.setTextField(wizardShell,"", "HelloWorld");
+ aHelper.clickButton (wizardShell, IDialogConstants.NEXT_LABEL);
+ aHelper.clickButton (wizardShell, IDialogConstants.NEXT_LABEL);
+ aHelper.clickButton(wizardShell, "Add a runtime dependency to Geronimo's shared library");
+ aHelper.clickButton (wizardShell, IDialogConstants.FINISH_LABEL);
+ aHelper.waitForDialogDisposal(wizardShell);
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ }
+
+ }
+ public void copyCodeToHellowWorldProject()
+ {
+ try {
+ IWorkspaceRoot aWSRoot = ResourcesPlugin.getWorkspace().getRoot();
+ IProject aProject = aWSRoot.getProject ("HelloWorld");
+ String fileDir =aWSRoot.getLocation().toOSString()+"/src/main/resources/sharedlib";
+ IFile aFile = aProject.getFile("WebContent/index.jsp");
+ aFile.create(new FileInputStream (fileDir + "/index.jsp"), true, null);
+ aHelper.waitTime(1500);
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ public void modifyHelloWorldBuildPath()
+ {
+ try {
+ Shell wizardShell=aHelper.clickMenuItem (aShell,
+ new String[] {"&Project","&Properties"},
+ "Properties for HelloWorld");
+ aHelper.clickItem(wizardShell,"Java Build Path");
+ aHelper.selectTabItem(wizardShell,"&Projects");
+ Shell newShell=aHelper.clickButton(wizardShell, "&Add...","Required Project Selection");
+ aHelper.clickButton(newShell, "&Select All");
+ aHelper.clickButton(newShell, IDialogConstants.OK_LABEL);
+ aHelper.clickButton(wizardShell, IDialogConstants.OK_LABEL);
+ newShell=aHelper.clickMenuItem(aShell, new String[]{"&Project","Clea&n..."}, "Clean");
+ aHelper.clickButton(newShell, IDialogConstants.OK_LABEL);
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ public void addSharedLibSupport()
+ {
+ try {
+ ServerTasks serverTasks = new ServerTasks(aShell, aHelper, Constants.SERVER_V21 );
+ serverTasks.editServer();
+ aHelper.clickButton(aShell, "Enable in-place shared library support.");
+ aHelper.clickMenuItem(aShell,new String[]{"&File","&Save"});
+ aHelper.clickMenuItem(aShell, new String[]{"&File","C&lose All"});
+ serverTasks.startServer();
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ public void deployHelloWorldProject()
+ {
+ try {
+ aHelper.clickMenuItem (aShell,
+ new String[] {"&Window", "&Close Perspective"});
+ Shell perspectiveShell = aHelper.clickMenuItem (aShell,
+ new String[] {"&Window", "&Open Perspective", "&Other..."},
+ "Open Perspective");
+ aHelper.clickItem (perspectiveShell, "Java EE (default)");
+ aHelper.clickButton (perspectiveShell, IDialogConstants.OK_LABEL);
+ ServerTasks serverTasks = new ServerTasks(aShell, aHelper, Constants.SERVER_V21 );
+ serverTasks.publishAllProjects();
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ }
+ }
+
+ public void displayApplication()
+ {
+ try {
+ EclipseSelenium selenium = new EclipseSelenium();
+ selenium.start();
+ selenium.open("http://localhost:8080/HelloWorld/index.jsp");
+ selenium.waitForPageToLoad("60000");
+ AssertUtil.assertTrue(selenium.getHtmlSource().indexOf( "Hello World!!" ) > 0);
+ AssertUtil.assertTrue(selenium.getHtmlSource().indexOf( "100 USD = 3938.81 INR" ) > 0);
+ aHelper.waitTime(1500);
+ selenium.stop();
+ success=true;
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ }
+ assertTrue(success);
+ }
+
+ public void deleteProjects()
+ {
+ try {
+ ProjectTasks projectTasks = new ProjectTasks(aShell, aHelper, Constants.SERVER_V21 );
+ // delete the projects that have been created
+ // reverse alphabetical is a little smoother
+ projectTasks.deleteProject ("HelloWorld");
+ projectTasks.deleteProject ("CurrencyConverterPojo");
+ success=true;
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ }
+ assertTrue(success);
+ }
+
+ public void deleteServer()
+ {
+ try {
+ ServerTasks serverTasks = new ServerTasks(aShell, aHelper, Constants.SERVER_V21 );
+ // stop the server
+ serverTasks.stopServer();
+ // remove the server
+ serverTasks.removeServer();
+ success=true;
+ }
+ catch (Exception e) {
+ e.printStackTrace();
+ }
+ assertTrue(success);
+ }
+
+}
Propchange: geronimo/devtools/eclipse-plugin/branches/2.1.4/testsuite/plugins/org.apache.geronimo.testsuite.v21/src/main/java/org/apache/geronimo/testsuite/v21/ui/SharedLibPojoTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/devtools/eclipse-plugin/branches/2.1.4/testsuite/plugins/org.apache.geronimo.testsuite.v21/src/main/java/org/apache/geronimo/testsuite/v21/ui/SharedLibPojoTest.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/devtools/eclipse-plugin/branches/2.1.4/testsuite/plugins/org.apache.geronimo.testsuite.v21/src/main/java/org/apache/geronimo/testsuite/v21/ui/SharedLibPojoTest.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/devtools/eclipse-plugin/branches/2.1.4/testsuite/plugins/org.apache.geronimo.testsuite.v21/src/main/resources/sharedlib/CurrencyConverter.java
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/branches/2.1.4/testsuite/plugins/org.apache.geronimo.testsuite.v21/src/main/resources/sharedlib/CurrencyConverter.java?rev=705953&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/branches/2.1.4/testsuite/plugins/org.apache.geronimo.testsuite.v21/src/main/resources/sharedlib/CurrencyConverter.java (added)
+++ geronimo/devtools/eclipse-plugin/branches/2.1.4/testsuite/plugins/org.apache.geronimo.testsuite.v21/src/main/resources/sharedlib/CurrencyConverter.java Sat Oct 18 19:46:53 2008
@@ -0,0 +1,39 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing, software
+ * distributed under the License is distributed on an "AS IS" BASIS,
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ * See the License for the specific language governing permissions and
+ * limitations under the License.
+ */
+
+package myPackage;
+
+import java.math.BigDecimal;
+
+/*
+ * @version $Rev$ $Date$
+ */
+public class CurrencyConverter {
+
+ private static BigDecimal rupeeRate = new BigDecimal("39.3881");
+ private static BigDecimal euroRate = new BigDecimal("0.0170853");
+
+ public static BigDecimal dollarToRupees(BigDecimal dollars) {
+ BigDecimal result = dollars.multiply(rupeeRate);
+ return result.setScale(2, BigDecimal.ROUND_UP);
+ }
+
+ public static BigDecimal rupeesToEuro(BigDecimal rupees) {
+ BigDecimal result = rupees.multiply(euroRate);
+ return result.setScale(2, BigDecimal.ROUND_UP);
+ }
+}
Propchange: geronimo/devtools/eclipse-plugin/branches/2.1.4/testsuite/plugins/org.apache.geronimo.testsuite.v21/src/main/resources/sharedlib/CurrencyConverter.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/devtools/eclipse-plugin/branches/2.1.4/testsuite/plugins/org.apache.geronimo.testsuite.v21/src/main/resources/sharedlib/CurrencyConverter.java
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/devtools/eclipse-plugin/branches/2.1.4/testsuite/plugins/org.apache.geronimo.testsuite.v21/src/main/resources/sharedlib/CurrencyConverter.java
------------------------------------------------------------------------------
svn:mime-type = text/plain
Added: geronimo/devtools/eclipse-plugin/branches/2.1.4/testsuite/plugins/org.apache.geronimo.testsuite.v21/src/main/resources/sharedlib/index.jsp
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/branches/2.1.4/testsuite/plugins/org.apache.geronimo.testsuite.v21/src/main/resources/sharedlib/index.jsp?rev=705953&view=auto
==============================================================================
--- geronimo/devtools/eclipse-plugin/branches/2.1.4/testsuite/plugins/org.apache.geronimo.testsuite.v21/src/main/resources/sharedlib/index.jsp (added)
+++ geronimo/devtools/eclipse-plugin/branches/2.1.4/testsuite/plugins/org.apache.geronimo.testsuite.v21/src/main/resources/sharedlib/index.jsp Sat Oct 18 19:46:53 2008
@@ -0,0 +1,32 @@
+<!--
+ Licensed to the Apache Software Foundation (ASF) under one or more
+ contributor license agreements. See the NOTICE file distributed with
+ this work for additional information regarding copyright ownership.
+ The ASF licenses this file to You under the Apache License, Version 2.0
+ (the "License"); you may not use this file except in compliance with
+ the License. You may obtain a copy of the License at
+
+ http://www.apache.org/licenses/LICENSE-2.0
+
+ Unless required by applicable law or agreed to in writing, software
+ distributed under the License is distributed on an "AS IS" BASIS,
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+ See the License for the specific language governing permissions and
+ limitations under the License.
+-->
+
+<!-- @version $Rev$ $Date$ -->
+
+<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
+ pageEncoding="ISO-8859-1"%>
+<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
+<html>
+<head>
+<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
+<title>Insert title here</title>
+</head>
+<body>
+Hello World!!
+100 USD = <%= myPackage.CurrencyConverter.dollarToRupees(new java.math.BigDecimal(100.0)) %> INR
+</body>
+</html>
Propchange: geronimo/devtools/eclipse-plugin/branches/2.1.4/testsuite/plugins/org.apache.geronimo.testsuite.v21/src/main/resources/sharedlib/index.jsp
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: geronimo/devtools/eclipse-plugin/branches/2.1.4/testsuite/plugins/org.apache.geronimo.testsuite.v21/src/main/resources/sharedlib/index.jsp
------------------------------------------------------------------------------
svn:keywords = Date Revision
Propchange: geronimo/devtools/eclipse-plugin/branches/2.1.4/testsuite/plugins/org.apache.geronimo.testsuite.v21/src/main/resources/sharedlib/index.jsp
------------------------------------------------------------------------------
svn:mime-type = text/plain
Modified: geronimo/devtools/eclipse-plugin/branches/2.1.4/testsuite/plugins/org.apache.geronimo.testsuite.v21/test.xml
URL: http://svn.apache.org/viewvc/geronimo/devtools/eclipse-plugin/branches/2.1.4/testsuite/plugins/org.apache.geronimo.testsuite.v21/test.xml?rev=705953&r1=705952&r2=705953&view=diff
==============================================================================
--- geronimo/devtools/eclipse-plugin/branches/2.1.4/testsuite/plugins/org.apache.geronimo.testsuite.v21/test.xml (original)
+++ geronimo/devtools/eclipse-plugin/branches/2.1.4/testsuite/plugins/org.apache.geronimo.testsuite.v21/test.xml Sat Oct 18 19:46:53 2008
@@ -57,7 +57,7 @@
<echo message="## extraVMargs: ${extraVMargs}" />
<echo message="## " />
<echo message="######################################################" />
-
+
<!--
#########################################################################
## ##
@@ -71,7 +71,36 @@
<property name="classname"
value="org.apache.geronimo.testsuite.v21.ui.EclipseUITest"/>
</ant>
-
+
+ <!--
+ #########################################################################
+ ## ##
+ ## Copy the testsuite.v21 resources required for the SharedLib project ##
+ ## ##
+ #########################################################################
+ -->
+ <mkdir dir="${jdt-folder}/src"/>
+ <copy todir="${jdt-folder}/src">
+ <fileset dir="${eclipse-home}/../../../plugins/org.apache.geronimo.testsuite.v21/src">
+ <include name="**/*.java"/>
+ <include name="**/*.jsp"/>
+ </fileset>
+ </copy>
+
+ <!--
+ ######################################################################### ##
+ ## ##
+ ## Shared Lib Pojo testcase ##
+ ## ##
+ #########################################################################
+ -->
+ <ant target="ui-test" antfile="${library-file}" dir="${eclipse-home}">
+ <property name="data-dir" value="${jdt-folder}"/>
+ <property name="plugin-name" value="${plugin-name}"/>
+ <property name="classname"
+ value="org.apache.geronimo.testsuite.v21.ui.SharedLibPojoTest"/>
+ </ant>
+
<!--
#########################################################################
## ##