JBoss Tools SVN: r37402 - trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation.
by jbosstools-commits@lists.jboss.org
Author: scabanovich
Date: 2011-12-16 14:30:11 -0500 (Fri, 16 Dec 2011)
New Revision: 37402
Modified:
trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ELValidator.java
Log:
JBIDE-10496
https://issues.jboss.org/browse/JBIDE-10496
ELValidator should create marker with IJavaSourceReference when it is relevant.
Modified: trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ELValidator.java
===================================================================
--- trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ELValidator.java 2011-12-16 18:15:42 UTC (rev 37401)
+++ trunk/jst/plugins/org.jboss.tools.jst.web.kb/src/org/jboss/tools/jst/web/kb/internal/validation/ELValidator.java 2011-12-16 19:30:11 UTC (rev 37402)
@@ -29,9 +29,13 @@
import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.IStatus;
import org.eclipse.core.runtime.Platform;
-import org.eclipse.core.runtime.Status;
+import org.eclipse.jdt.core.ICompilationUnit;
+import org.eclipse.jdt.core.IJavaElement;
+import org.eclipse.jdt.core.IMember;
+import org.eclipse.jdt.core.JavaCore;
import org.eclipse.wst.validation.internal.core.ValidationException;
import org.eclipse.wst.validation.internal.provisional.core.IReporter;
+import org.jboss.tools.common.CommonPlugin;
import org.jboss.tools.common.el.core.ELReference;
import org.jboss.tools.common.el.core.model.ELExpression;
import org.jboss.tools.common.el.core.model.ELInvocationExpression;
@@ -51,6 +55,7 @@
import org.jboss.tools.common.el.core.resolver.SimpleELContext;
import org.jboss.tools.common.el.core.resolver.TypeInfoCollector;
import org.jboss.tools.common.el.core.resolver.Var;
+import org.jboss.tools.common.java.IJavaSourceReference;
import org.jboss.tools.common.validation.ContextValidationHelper;
import org.jboss.tools.common.validation.IELValidationDelegate;
import org.jboss.tools.common.validation.IProjectValidationContext;
@@ -250,7 +255,12 @@
if(!references[i].getSyntaxErrors().isEmpty()) {
for (SyntaxError error: references[i].getSyntaxErrors()) {
markers++;
- addError(ELValidationMessages.EL_SYNTAX_ERROR, ELSeverityPreferences.EL_SYNTAX_ERROR, new String[]{error.getProblem()}, references[i].getLineNumber(), 1, references[i].getStartPosition() + error.getPosition(), context.getResource());
+ IJavaSourceReference reference = getJavaReference(file, references[i].getStartPosition() + error.getPosition(), 1);
+ if(reference == null) {
+ addError(ELValidationMessages.EL_SYNTAX_ERROR, ELSeverityPreferences.EL_SYNTAX_ERROR, new String[]{error.getProblem()}, references[i].getLineNumber(), 1, references[i].getStartPosition() + error.getPosition(), context.getResource());
+ } else {
+ addError(ELValidationMessages.EL_SYNTAX_ERROR, ELSeverityPreferences.EL_SYNTAX_ERROR, new String[]{error.getProblem()}, reference, context.getResource());
+ }
}
}
if(markers<getMaxNumberOfMarkersPerFile(file.getProject())) {
@@ -362,8 +372,17 @@
length = propertyName.length();
}
markers++;
- IMarker marker = addError(ELValidationMessages.UNPAIRED_GETTER_OR_SETTER, ELSeverityPreferences.UNPAIRED_GETTER_OR_SETTER, new String[]{propertyName, existedMethodName, missingMethodName}, elReference.getLineNumber(), length, startPosition, file);
- elReference.addMarker(marker);
+
+ IJavaSourceReference reference = getJavaReference(file, startPosition, length);
+
+ if(reference != null) {
+ IMarker marker = addError(ELValidationMessages.UNPAIRED_GETTER_OR_SETTER, ELSeverityPreferences.UNPAIRED_GETTER_OR_SETTER, new String[]{propertyName, existedMethodName, missingMethodName}, reference, file);
+ elReference.addMarker(marker);
+ } else {
+ IMarker marker = addError(ELValidationMessages.UNPAIRED_GETTER_OR_SETTER, ELSeverityPreferences.UNPAIRED_GETTER_OR_SETTER, new String[]{propertyName, existedMethodName, missingMethodName}, elReference.getLineNumber(), length, startPosition, file);
+ elReference.addMarker(marker);
+ }
+
}
}
}
@@ -395,16 +414,70 @@
}
}
markers++;
+ IJavaSourceReference reference = getJavaReference(file, offsetOfVarName, lengthOfVarName);
+
+ IMarker marker = null;
// Mark invalid EL
if(unresolvedTokenIsVariable) {
- IMarker marker = addError(ELValidationMessages.UNKNOWN_EL_VARIABLE_NAME, ELSeverityPreferences.UNKNOWN_EL_VARIABLE_NAME, new String[]{varName}, elReference.getLineNumber(), lengthOfVarName, offsetOfVarName, file);
- elReference.addMarker(marker);
+ if(reference == null) {
+ marker = addError(ELValidationMessages.UNKNOWN_EL_VARIABLE_NAME, ELSeverityPreferences.UNKNOWN_EL_VARIABLE_NAME, new String[]{varName}, elReference.getLineNumber(), lengthOfVarName, offsetOfVarName, file);
+ } else {
+ marker = addError(ELValidationMessages.UNKNOWN_EL_VARIABLE_NAME, ELSeverityPreferences.UNKNOWN_EL_VARIABLE_NAME, new String[]{varName}, reference, file);
+ }
+
} else {
- IMarker marker = addError(ELValidationMessages.UNKNOWN_EL_VARIABLE_PROPERTY_NAME, ELSeverityPreferences.UNKNOWN_EL_VARIABLE_PROPERTY_NAME, new String[]{varName}, elReference.getLineNumber(), lengthOfVarName, offsetOfVarName, file);
+ if(reference == null) {
+ marker = addError(ELValidationMessages.UNKNOWN_EL_VARIABLE_PROPERTY_NAME, ELSeverityPreferences.UNKNOWN_EL_VARIABLE_PROPERTY_NAME, new String[]{varName}, elReference.getLineNumber(), lengthOfVarName, offsetOfVarName, file);
+ } else {
+ marker = addError(ELValidationMessages.UNKNOWN_EL_VARIABLE_PROPERTY_NAME, ELSeverityPreferences.UNKNOWN_EL_VARIABLE_PROPERTY_NAME, new String[]{varName}, reference, file);
+ }
+ }
+
+ if(marker != null) {
elReference.addMarker(marker);
}
}
+ IJavaSourceReference getJavaReference(final IFile file, final int startPosition, final int length) {
+ IMember m = null;
+
+ if(file.getName().endsWith(".java")) {
+ IJavaElement el = JavaCore.create(file);
+ if(el instanceof ICompilationUnit) {
+ try {
+ el = ((ICompilationUnit)el).getElementAt(startPosition);
+ } catch (CoreException exc) {
+ CommonPlugin.getDefault().logError(exc);
+ }
+ if(el instanceof IMember) {
+ m = (IMember)el;
+ }
+ }
+ }
+
+ if(m != null) {
+ final IMember mm = m;
+ return new IJavaSourceReference() {
+ public int getStartPosition() {
+ return startPosition;
+ }
+ public int getLength() {
+ return length;
+ }
+ public IResource getResource() {
+ return file;
+ }
+ public IMember getSourceMember() {
+ return mm;
+ }
+ public IJavaElement getSourceElement() {
+ return mm;
+ }
+ };
+ }
+ return null;
+ }
+
private Set<String> findVariableNames(ELInvocationExpression invocationExpression){
Set<String> names = new HashSet<String>();
while(invocationExpression != null) {
14 years
JBoss Tools SVN: r37401 - in trunk: as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/bean and 5 other directories.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2011-12-16 13:15:42 -0500 (Fri, 16 Dec 2011)
New Revision: 37401
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/runtime/CustomRuntimeClasspathModel.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/bean/ServerBeanLoader.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/ServerCreationUtils.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/wizards/JBoss7RuntimeWizardFragment.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/wizards/JBossRuntimeLocator.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/wizards/JBossRuntimeWizardFragment.java
trunk/as/tests/org.jboss.ide.eclipse.as.test/src/org/jboss/ide/eclipse/as/test/server/ServerBeanLoaderTest.java
trunk/runtime/plugins/org.jboss.tools.runtime.as.detector/src/org/jboss/tools/runtime/as/detector/IJBossRuntimePluginConstants.java
trunk/runtime/plugins/org.jboss.tools.runtime.as.detector/src/org/jboss/tools/runtime/as/detector/Messages.java
trunk/runtime/plugins/org.jboss.tools.runtime.as.detector/src/org/jboss/tools/runtime/as/detector/messages.properties
trunk/runtime/plugins/org.jboss.tools.runtime.as.detector/src/org/jboss/tools/runtime/handlers/JBossASHandler.java
Log:
JBIDE-10494 - ServerBeanLoader and other AS7.1 / EAP6.0 updates. Also added keyword NEW_SERVER_ADAPTER to several locations.
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/runtime/CustomRuntimeClasspathModel.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/runtime/CustomRuntimeClasspathModel.java 2011-12-16 17:55:19 UTC (rev 37400)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.classpath.core/src/org/jboss/ide/eclipse/as/classpath/core/runtime/CustomRuntimeClasspathModel.java 2011-12-16 18:15:42 UTC (rev 37401)
@@ -100,6 +100,8 @@
return getDefaultAS70Entries();
if(AS_71.equals(type.getId()))
return getDefaultAS71Entries();
+ if(EAP_60.equals(type.getId()))
+ return getDefaultAS71Entries();
// NEW_SERVER_ADAPTER add logic for new adapter here
return new IDefaultPathProvider[]{};
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/bean/ServerBeanLoader.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/bean/ServerBeanLoader.java 2011-12-16 17:55:19 UTC (rev 37400)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/bean/ServerBeanLoader.java 2011-12-16 18:15:42 UTC (rev 37401)
@@ -91,6 +91,10 @@
ZipEntry manifest = jar.getEntry("META-INF/MANIFEST.MF");//$NON-NLS-1$
Properties props = new Properties();
props.load(jar.getInputStream(manifest));
+ version = props.getProperty("JBossEAP-Release-Version"); //$NON-NLS-1$
+ if (version != null) {
+ return version;
+ }
version = (String)props.get("Specification-Version");//$NON-NLS-1$
} catch (IOException e) {
// version = ""
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/ServerCreationUtils.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/ServerCreationUtils.java 2011-12-16 17:55:19 UTC (rev 37400)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/ServerCreationUtils.java 2011-12-16 18:15:42 UTC (rev 37401)
@@ -34,6 +34,7 @@
runtimeServerTypeMap.put(IJBossToolingConstants.AS_70, IJBossToolingConstants.SERVER_AS_70);
runtimeServerTypeMap.put(IJBossToolingConstants.EAP_43, IJBossToolingConstants.SERVER_EAP_43);
runtimeServerTypeMap.put(IJBossToolingConstants.EAP_50, IJBossToolingConstants.SERVER_EAP_50);
+ runtimeServerTypeMap.put(IJBossToolingConstants.EAP_60, IJBossToolingConstants.SERVER_EAP_60);
// NEW_SERVER_ADAPTER Add the server / runtime mapping here
}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/wizards/JBoss7RuntimeWizardFragment.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/wizards/JBoss7RuntimeWizardFragment.java 2011-12-16 17:55:19 UTC (rev 37400)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/wizards/JBoss7RuntimeWizardFragment.java 2011-12-16 18:15:42 UTC (rev 37401)
@@ -220,11 +220,11 @@
TaskModel.TASK_RUNTIME);
String adapterVersion = rt.getRuntimeType().getVersion();
- if(!isEAP() && (adapterVersion.equals("7.0") && !version.startsWith("7.0."))
- || (adapterVersion.equals("7.1") && version.startsWith("7.0."))) {
+ if(!isEAP() && ((adapterVersion.equals("7.0") && !version.startsWith("7.0."))
+ || (adapterVersion.equals("7.1") && version.startsWith("7.0."))) ) {
return NLS.bind(Messages.rwf_homeIncorrectVersionError, adapterVersion, version);
}
- if( isEAP() && (adapterVersion.equals("6.0") && !version.startsWith("7.")))
+ if( isEAP() && !adapterVersion.equals("6.0") )
return NLS.bind(Messages.rwf_homeIncorrectVersionError, adapterVersion, version);
return null;
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/wizards/JBossRuntimeLocator.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/wizards/JBossRuntimeLocator.java 2011-12-16 17:55:19 UTC (rev 37400)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/wizards/JBossRuntimeLocator.java 2011-12-16 18:15:42 UTC (rev 37401)
@@ -164,9 +164,11 @@
String runtimeTypeId = null;
if( version.compareTo("5.0") < 0 ) //$NON-NLS-1$
runtimeTypeId=IJBossToolingConstants.EAP_43;
- else
+ else if( version.compareTo("6.0") < 0 ) //$NON-NLS-1$
runtimeTypeId=IJBossToolingConstants.EAP_50;
-
+ else
+ runtimeTypeId=IJBossToolingConstants.EAP_60
+ ;
IPath path2 = path.append(IJBossRuntimeResourceConstants.JBOSS_AS_EAP_DIRECTORY);
if( runtimeTypeId != null ) {
try {
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/wizards/JBossRuntimeWizardFragment.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/wizards/JBossRuntimeWizardFragment.java 2011-12-16 17:55:19 UTC (rev 37400)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/wizards/JBossRuntimeWizardFragment.java 2011-12-16 18:15:42 UTC (rev 37401)
@@ -683,7 +683,7 @@
if( !isEAP() && v.startsWith("7."))
v = "7.";
if( isEAP() && v.startsWith("6."))
- v = "7.";
+ v = "6.";
if( !isEAP() && v.startsWith("7."))
v = "7.";
Modified: trunk/as/tests/org.jboss.ide.eclipse.as.test/src/org/jboss/ide/eclipse/as/test/server/ServerBeanLoaderTest.java
===================================================================
--- trunk/as/tests/org.jboss.ide.eclipse.as.test/src/org/jboss/ide/eclipse/as/test/server/ServerBeanLoaderTest.java 2011-12-16 17:55:19 UTC (rev 37400)
+++ trunk/as/tests/org.jboss.ide.eclipse.as.test/src/org/jboss/ide/eclipse/as/test/server/ServerBeanLoaderTest.java 2011-12-16 18:15:42 UTC (rev 37401)
@@ -40,11 +40,7 @@
serverBeanLoaderTestAS6AndBelow("serverEAP5/jbossas", IJBossToolingConstants.SERVER_EAP_50, JBossServerType.EAP_STD,IJBossToolingConstants.V5_0);
}
public void testEAP60() {
- try {
serverBeanLoaderTestAS7Style("serverEap6", IJBossToolingConstants.SERVER_EAP_60, JBossServerType.EAP6,IJBossToolingConstants.V6_0);
- } catch(AssertionError e) {
- // TODO FIX THIS SITUATION!!! NOT expected failure, but, this test cannot run correctly.
- }
}
private void serverBeanLoaderTestAS6AndBelow(String name, String serverTypeId,
Modified: trunk/runtime/plugins/org.jboss.tools.runtime.as.detector/src/org/jboss/tools/runtime/as/detector/IJBossRuntimePluginConstants.java
===================================================================
--- trunk/runtime/plugins/org.jboss.tools.runtime.as.detector/src/org/jboss/tools/runtime/as/detector/IJBossRuntimePluginConstants.java 2011-12-16 17:55:19 UTC (rev 37400)
+++ trunk/runtime/plugins/org.jboss.tools.runtime.as.detector/src/org/jboss/tools/runtime/as/detector/IJBossRuntimePluginConstants.java 2011-12-16 18:15:42 UTC (rev 37401)
@@ -38,7 +38,9 @@
"org.jboss.ide.eclipse.as.runtime.eap.43", //$NON-NLS-1$
"org.jboss.ide.eclipse.as.runtime.eap.50", //$NON-NLS-1$
"org.jboss.ide.eclipse.as.runtime.70", //$NON-NLS-1$
- "org.jboss.ide.eclipse.as.runtime.71" //$NON-NLS-1$
+ "org.jboss.ide.eclipse.as.runtime.71", //$NON-NLS-1$
+ "org.jboss.ide.eclipse.as.runtime.eap.60" //$NON-NLS-1$
+ // NEW_SERVER_ADAPTER add logic for new adapter here
};
public static final String HSQLDB_DRIVER_JAR_NAME = "hsqldb.jar"; //$NON-NLS-1$
@@ -69,7 +71,8 @@
"org.jboss.ide.eclipse.as.eap.43", //$NON-NLS-1$
"org.jboss.ide.eclipse.as.eap.50", //$NON-NLS-1$
"org.jboss.ide.eclipse.as.70", //$NON-NLS-1$
- "org.jboss.ide.eclipse.as.71" //$NON-NLS-1$
+ "org.jboss.ide.eclipse.as.71", //$NON-NLS-1$
+ "org.jboss.ide.eclipse.as.eap.60" //$NON-NLS-1$
};
public static final String JBOSS_AS_NAME[] = {
@@ -82,7 +85,8 @@
Messages.JBossRuntimeStartup_JBoss_EAP_Server_4_3,
Messages.JBossRuntimeStartup_JBoss_EAP_Server_5_0,
Messages.JBossRuntimeStartup_JBoss_Application_Server_7_0,
- Messages.JBossRuntimeStartup_JBoss_Application_Server_7_1
+ Messages.JBossRuntimeStartup_JBoss_Application_Server_7_1,
+ Messages.JBossRuntimeStartup_JBoss_EAP_Server_6_0
};
public static final String JBOSS_AS_HOST = "localhost"; //$NON-NLS-1$
Modified: trunk/runtime/plugins/org.jboss.tools.runtime.as.detector/src/org/jboss/tools/runtime/as/detector/Messages.java
===================================================================
--- trunk/runtime/plugins/org.jboss.tools.runtime.as.detector/src/org/jboss/tools/runtime/as/detector/Messages.java 2011-12-16 17:55:19 UTC (rev 37400)
+++ trunk/runtime/plugins/org.jboss.tools.runtime.as.detector/src/org/jboss/tools/runtime/as/detector/Messages.java 2011-12-16 18:15:42 UTC (rev 37401)
@@ -27,6 +27,8 @@
public static String JBossRuntimeStartup_JBoss_Application_Server_5_1;
public static String JBossRuntimeStartup_JBoss_EAP_Server_4_3;
public static String JBossRuntimeStartup_JBoss_EAP_Server_5_0;
+ public static String JBossRuntimeStartup_JBoss_EAP_Server_6_0;
+ // NEW_SERVER_ADAPTER add logic for new adapter here
public static String JBossRuntimeStartup_Runtime;
public static String JBossRuntimeStartup_The_JBoss_AS_Hypersonic_embedded_database;
static {
Modified: trunk/runtime/plugins/org.jboss.tools.runtime.as.detector/src/org/jboss/tools/runtime/as/detector/messages.properties
===================================================================
--- trunk/runtime/plugins/org.jboss.tools.runtime.as.detector/src/org/jboss/tools/runtime/as/detector/messages.properties 2011-12-16 17:55:19 UTC (rev 37400)
+++ trunk/runtime/plugins/org.jboss.tools.runtime.as.detector/src/org/jboss/tools/runtime/as/detector/messages.properties 2011-12-16 18:15:42 UTC (rev 37401)
@@ -11,5 +11,6 @@
JBossRuntimeStartup_JBoss_Application_Server_7_1=JBoss Application Server 7.1
JBossRuntimeStartup_JBoss_EAP_Server_4_3=JBoss EAP Server 4.3
JBossRuntimeStartup_JBoss_EAP_Server_5_0=JBoss EAP Server 5.0
+JBossRuntimeStartup_JBoss_EAP_Server_6_0=JBoss EAP Server 6.0
JBossRuntimeStartup_Runtime=Runtime
JBossRuntimeStartup_The_JBoss_AS_Hypersonic_embedded_database=The JBoss AS Hypersonic embedded database
Modified: trunk/runtime/plugins/org.jboss.tools.runtime.as.detector/src/org/jboss/tools/runtime/handlers/JBossASHandler.java
===================================================================
--- trunk/runtime/plugins/org.jboss.tools.runtime.as.detector/src/org/jboss/tools/runtime/handlers/JBossASHandler.java 2011-12-16 17:55:19 UTC (rev 37400)
+++ trunk/runtime/plugins/org.jboss.tools.runtime.as.detector/src/org/jboss/tools/runtime/handlers/JBossASHandler.java 2011-12-16 18:15:42 UTC (rev 37401)
@@ -63,6 +63,7 @@
private static final int JBOSS_AS70_INDEX = 8;
private static final int JBOSS_AS71_INDEX = 9;
+ private static final int JBOSS_EAP60_INDEX = 10;
private static String[] hasIncludedRuntimes = new String[] {SOA_P, EAP, EPP, EWP, SOA_P_STD};
private static final String DROOLS = "DROOLS"; // NON-NLS-1$
private static final String ESB = "ESB"; //$NON-NLS-1$
@@ -73,6 +74,10 @@
private static File getLocation(ServerDefinition serverDefinition) {
String type = serverDefinition.getType();
+ String version = serverDefinition.getVersion();
+ if (EAP.equals(type) && version != null && version.startsWith("6") ) {
+ return serverDefinition.getLocation();
+ }
if (SOA_P.equals(type) || EAP.equals(type) || EPP.equals(type)) {
return new File(serverDefinition.getLocation(), "jboss-as");
}
@@ -103,7 +108,7 @@
|| EAP_STD.equals(type)) {
String name = serverDefinition.getName();
String runtimeName = name + " " + RUNTIME; //$NON-NLS-1$
- int index = getJBossASVersion(asLocation);
+ int index = getJBossASVersion(asLocation, serverDefinition);
createJBossServer(asLocation, index, name, runtimeName);
} else if (AS.equals(type)){
String version = serverDefinition.getVersion();
@@ -125,15 +130,23 @@
} else if ("7.1".equals(version)) { //$NON-NLS-1$
index = JBOSS_AS71_INDEX;
}
+ // NEW_SERVER_ADAPTER add logic for new adapter here
createJBossServer(serverDefinition.getLocation(),index,serverDefinition.getName(),serverDefinition.getName() + " " + RUNTIME); //$NON-NLS-1$
}
createJBossServerFromDefinitions(serverDefinition.getIncludedServerDefinitions());
}
}
- private static int getJBossASVersion(File asLocation) {
+ private static int getJBossASVersion(File asLocation, ServerDefinition serverDefinition) {
int index = -1;
- String fullVersion = new ServerBeanLoader().getFullServerVersion(new File(asLocation, JBossServerType.AS.getSystemJarPath()));
+ String type = serverDefinition.getType();
+ String ver = serverDefinition.getVersion();
+ String fullVersion;
+ if (EAP.equals(type) && "6.0".equals(ver)) {
+ fullVersion = new ServerBeanLoader().getFullServerVersion(new File(asLocation, JBossServerType.EAP6.getSystemJarPath()));
+ } else {
+ fullVersion = new ServerBeanLoader().getFullServerVersion(new File(asLocation, JBossServerType.AS.getSystemJarPath()));
+ }
if(fullVersion != null ) {
String version = fullVersion.substring(0, 3);
if ("4.3".equals(version)) { //$NON-NLS-1$
@@ -146,6 +159,9 @@
} else if ("5.2".equals(version)) { //$NON-NLS-1$
// SOA-P 5.2
index = 7;
+ } else if ("6.0".equals(version)) { //$NON-NLS-1$
+ // EAP 6.0
+ index = 10;
}
}
return index;
@@ -252,7 +268,7 @@
// Don't create the driver a few times
return;
}
- if (index == JBOSS_AS70_INDEX || index == JBOSS_AS71_INDEX) {
+ if (index == JBOSS_AS70_INDEX || index == JBOSS_AS71_INDEX || index == JBOSS_EAP60_INDEX) {
// AS 7
return;
}
14 years
JBoss Tools SVN: r37400 - trunk/as/tests/org.jboss.ide.eclipse.as.test/src/org/jboss/ide/eclipse/as/test.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2011-12-16 12:55:19 -0500 (Fri, 16 Dec 2011)
New Revision: 37400
Modified:
trunk/as/tests/org.jboss.ide.eclipse.as.test/src/org/jboss/ide/eclipse/as/test/ASTestSuite.java
Log:
https://issues.jboss.org/browse/JBIDE-10513 Activate the test case
Modified: trunk/as/tests/org.jboss.ide.eclipse.as.test/src/org/jboss/ide/eclipse/as/test/ASTestSuite.java
===================================================================
--- trunk/as/tests/org.jboss.ide.eclipse.as.test/src/org/jboss/ide/eclipse/as/test/ASTestSuite.java 2011-12-16 17:54:21 UTC (rev 37399)
+++ trunk/as/tests/org.jboss.ide.eclipse.as.test/src/org/jboss/ide/eclipse/as/test/ASTestSuite.java 2011-12-16 17:55:19 UTC (rev 37400)
@@ -43,12 +43,14 @@
import org.jboss.ide.eclipse.as.test.server.JBossServerAPITest;
import org.jboss.ide.eclipse.as.test.server.ServerBeanLoaderTest;
import org.jboss.ide.eclipse.as.test.util.ArgsUtilTest;
+import org.jboss.ide.eclipse.as.test.util.ExpressionResolverUtilTest;
public class ASTestSuite extends TestSuite {
public static Test suite() {
ValidationFramework.getDefault().suspendAllValidation(true);
TestSuite suite = new TestSuite("ASTools Test Suite");
suite.addTestSuite(ArgsUtilTest.class);
+ suite.addTestSuite(ExpressionResolverUtilTest.class);
suite.addTestSuite(PreReqTest.class);
suite.addTestSuite(ServerBeanLoaderTest.class);
suite.addTestSuite(RuntimeServerModelTest.class);
14 years
JBoss Tools SVN: r37399 - in trunk/as: plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7 and 3 other directories.
by jbosstools-commits@lists.jboss.org
Author: rob.stryker(a)jboss.com
Date: 2011-12-16 12:54:21 -0500 (Fri, 16 Dec 2011)
New Revision: 37399
Added:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/ExpressionResolverUtil.java
trunk/as/tests/org.jboss.ide.eclipse.as.test/src/org/jboss/ide/eclipse/as/test/util/ExpressionResolverUtilTest.java
Modified:
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/JBossServer.java
trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7Server.java
trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/PortSection.java
Log:
https://issues.jboss.org/browse/JBIDE-10513 - port error for AS7.1 near-final.
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/JBossServer.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/JBossServer.java 2011-12-16 17:09:20 UTC (rev 37398)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/JBossServer.java 2011-12-16 17:54:21 UTC (rev 37399)
@@ -47,6 +47,7 @@
import org.jboss.ide.eclipse.as.core.server.IDeployableServer;
import org.jboss.ide.eclipse.as.core.server.IJBossServerRuntime;
import org.jboss.ide.eclipse.as.core.util.DeploymentPreferenceLoader;
+import org.jboss.ide.eclipse.as.core.util.ExpressionResolverUtil;
import org.jboss.ide.eclipse.as.core.util.IJBossToolingConstants;
import org.jboss.ide.eclipse.as.core.util.RuntimeUtils;
import org.jboss.ide.eclipse.as.core.util.ServerUtil;
@@ -193,6 +194,8 @@
}
if( result != null ) {
+ result = resolveXPathResult(result);
+
try {
return Integer.parseInt(result);
} catch(NumberFormatException nfe) {
@@ -202,6 +205,10 @@
return defaultValue;
}
+ protected String resolveXPathResult(String result) {
+ return result;
+ }
+
public URL getModuleRootURL(IModule module) {
if (module == null || module.loadAdapter(IWebModule.class,null)==null )
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7Server.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7Server.java 2011-12-16 17:09:20 UTC (rev 37398)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/server/internal/v7/JBoss7Server.java 2011-12-16 17:54:21 UTC (rev 37399)
@@ -24,6 +24,7 @@
import org.eclipse.wst.server.core.IRuntime;
import org.jboss.ide.eclipse.as.core.extensions.polling.WebPortPoller;
import org.jboss.ide.eclipse.as.core.server.internal.JBossServer;
+import org.jboss.ide.eclipse.as.core.util.ExpressionResolverUtil;
import org.jboss.ide.eclipse.as.core.util.IJBossToolingConstants;
import org.jboss.ide.eclipse.as.core.util.ServerUtil;
@@ -51,6 +52,12 @@
}
@Override
+ protected String resolveXPathResult(String result) {
+ return ExpressionResolverUtil.safeReplaceProperties(result);
+ }
+
+
+ @Override
public String getDeployLocationType() {
return getAttribute(DEPLOY_DIRECTORY_TYPE, DEPLOY_SERVER);
}
Added: trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/ExpressionResolverUtil.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/ExpressionResolverUtil.java (rev 0)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.core/jbosscore/org/jboss/ide/eclipse/as/core/util/ExpressionResolverUtil.java 2011-12-16 17:54:21 UTC (rev 37399)
@@ -0,0 +1,186 @@
+package org.jboss.ide.eclipse.as.core.util;
+
+import java.io.File;
+
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.IStatus;
+import org.eclipse.core.runtime.Status;
+import org.jboss.ide.eclipse.as.core.JBossServerCorePlugin;
+
+/**
+ * This class coppied from JBoss's DMR project, ExpressionValue.java
+ *
+ */
+public class ExpressionResolverUtil {
+
+ /*
+ * An interface is added to allow the actual resolving of the variables
+ * to be customized
+ */
+ public interface IExpressionResolver {
+ public String getSystemProperty(String variable);
+ public String getEnvironmentProperty(String variable);
+ }
+
+ public static class NullExpressionResolver implements IExpressionResolver {
+ public String getSystemProperty(String variable) {
+ return null;
+ }
+ public String getEnvironmentProperty(String variable) {
+ return null;
+ }
+ }
+
+ private static final int INITIAL = 0;
+ private static final int GOT_DOLLAR = 1;
+ private static final int GOT_OPEN_BRACE = 2;
+ private static final int RESOLVED = 3;
+ private static final int DEFAULT = 4;
+
+ public static String safeReplaceProperties(final String value) {
+ return safeReplaceProperties(value, null);
+ }
+ public static String safeReplaceProperties(final String value, IExpressionResolver resolver) {
+ try {
+ return replaceProperties(value, resolver);
+ } catch(IllegalStateException ise) {
+ return value; // Just return the string unchanged
+ }
+ }
+
+ /**
+ * Replace properties of the form:
+ * <code>${<i><[env.]name>[</i>,<i><[env.]name2>[</i>,<i><[env.]name3>...]][</i>:<i><default>]</i>}</code>
+ *
+ * @param value - either a system property or environment variable reference
+ * @param resolver - to resolve the variables
+ * @return the value of the system property or environment variable referenced if
+ * it exists
+ */
+ public static String replaceProperties(final String value, IExpressionResolver resolver) {
+ if( resolver == null )
+ resolver = new NullExpressionResolver();
+
+ final StringBuilder builder = new StringBuilder();
+ final int len = value.length();
+ int state = INITIAL;
+ int start = -1;
+ int nameStart = -1;
+ String resolvedValue = null;
+ for (int i = 0; i < len; i = value.offsetByCodePoints(i, 1)) {
+ final int ch = value.codePointAt(i);
+ System.out.print((char)ch);
+ switch (state) {
+ case INITIAL: {
+ switch (ch) {
+ case '$': {
+ state = GOT_DOLLAR;
+ continue;
+ }
+ default: {
+ builder.appendCodePoint(ch);
+ continue;
+ }
+ }
+ // not reachable
+ }
+ case GOT_DOLLAR: {
+ switch (ch) {
+ case '$': {
+ builder.appendCodePoint(ch);
+ state = INITIAL;
+ continue;
+ }
+ case '{': {
+ start = i + 1;
+ nameStart = start;
+ state = GOT_OPEN_BRACE;
+ continue;
+ }
+ default: {
+ // invalid; emit and resume
+ builder.append('$').appendCodePoint(ch);
+ state = INITIAL;
+ continue;
+ }
+ }
+ // not reachable
+ }
+ case GOT_OPEN_BRACE: {
+ switch (ch) {
+ case ':':
+ case '}':
+ case ',': {
+ final String name = value.substring(nameStart, i).trim();
+ if ("/".equals(name)) { //$NON-NLS-1$
+ builder.append(File.separator);
+ state = ch == '}' ? INITIAL : RESOLVED;
+ continue;
+ } else if (":".equals(name)) { //$NON-NLS-1$
+ builder.append(File.pathSeparator);
+ state = ch == '}' ? INITIAL : RESOLVED;
+ continue;
+ }
+ // First check for system property, then env variable
+ String val = resolver.getSystemProperty(name);
+ if (val == null && name.startsWith("env.")) //$NON-NLS-1$
+ val = resolver.getEnvironmentProperty(name.substring(4));
+
+ if (val != null) {
+ builder.append(val);
+ resolvedValue = val;
+ state = ch == '}' ? INITIAL : RESOLVED;
+ continue;
+ } else if (ch == ',') {
+ nameStart = i + 1;
+ continue;
+ } else if (ch == ':') {
+ start = i + 1;
+ state = DEFAULT;
+ continue;
+ } else {
+ throw new IllegalStateException("Failed to resolve expression: "+ value.substring(start - 2, i + 1)); //$NON-NLS-1$
+ }
+ }
+ default: {
+ continue;
+ }
+ }
+ // not reachable
+ }
+ case RESOLVED: {
+ if (ch == '}') {
+ state = INITIAL;
+ }
+ continue;
+ }
+ case DEFAULT: {
+ if (ch == '}') {
+ state = INITIAL;
+ builder.append(value.substring(start, i));
+ }
+ continue;
+ }
+ default:
+ throw new IllegalStateException("Unexpected char seen: "+ch); //$NON-NLS-1$
+ }
+ }
+ switch (state) {
+ case GOT_DOLLAR: {
+ builder.append('$');
+ break;
+ }
+ case DEFAULT: {
+ builder.append(value.substring(start - 2));
+ break;
+ }
+ case GOT_OPEN_BRACE: {
+ // We had a reference that was not resolved, throw ISE
+ if (resolvedValue == null)
+ throw new IllegalStateException("Incomplete expression: "+builder.toString()); //$NON-NLS-1$
+ break;
+ }
+ }
+ return builder.toString();
+ }
+}
Modified: trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/PortSection.java
===================================================================
--- trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/PortSection.java 2011-12-16 17:09:20 UTC (rev 37398)
+++ trunk/as/plugins/org.jboss.ide.eclipse.as.ui/jbossui/org/jboss/ide/eclipse/as/ui/editor/PortSection.java 2011-12-16 17:54:21 UTC (rev 37399)
@@ -54,6 +54,7 @@
import org.jboss.ide.eclipse.as.core.server.IJBoss6Server;
import org.jboss.ide.eclipse.as.core.server.IJBossServerConstants;
import org.jboss.ide.eclipse.as.core.server.internal.ServerAttributeHelper;
+import org.jboss.ide.eclipse.as.core.util.ExpressionResolverUtil;
import org.jboss.ide.eclipse.as.core.util.IJBossToolingConstants;
import org.jboss.ide.eclipse.as.ui.JBossServerUIPlugin;
import org.jboss.ide.eclipse.as.ui.Messages;
@@ -409,6 +410,7 @@
query.refresh();
result = query.getFirstResult();
result = result == null ? "" : result; //$NON-NLS-1$
+ result = ExpressionResolverUtil.safeReplaceProperties(result);
return new Integer(Integer.parseInt(result)).toString();
} catch(NumberFormatException nfe) {
} catch( IllegalStateException ise ) {
Added: trunk/as/tests/org.jboss.ide.eclipse.as.test/src/org/jboss/ide/eclipse/as/test/util/ExpressionResolverUtilTest.java
===================================================================
--- trunk/as/tests/org.jboss.ide.eclipse.as.test/src/org/jboss/ide/eclipse/as/test/util/ExpressionResolverUtilTest.java (rev 0)
+++ trunk/as/tests/org.jboss.ide.eclipse.as.test/src/org/jboss/ide/eclipse/as/test/util/ExpressionResolverUtilTest.java 2011-12-16 17:54:21 UTC (rev 37399)
@@ -0,0 +1,20 @@
+package org.jboss.ide.eclipse.as.test.util;
+
+import org.jboss.ide.eclipse.as.core.util.ExpressionResolverUtil;
+
+import junit.framework.TestCase;
+
+public class ExpressionResolverUtilTest extends TestCase {
+ public void testExpressionResolver() {
+ assertEquals("aaa", ExpressionResolverUtil.safeReplaceProperties("aaa"));
+ assertEquals("t9", ExpressionResolverUtil.safeReplaceProperties("t${something:9}"));
+ assertEquals("t9a", ExpressionResolverUtil.safeReplaceProperties("t${something:9}a"));
+
+ // NO recursive checking
+ assertEquals("5:notfound}", ExpressionResolverUtil.safeReplaceProperties("${twoPoint${someNumber:5}:notfound}"));
+
+ // unresolvable, so no change
+ assertEquals("t${something}", ExpressionResolverUtil.safeReplaceProperties("t${something}"));
+ assertEquals("t${something}a", ExpressionResolverUtil.safeReplaceProperties("t${something}a"));
+ }
+}
14 years
JBoss Tools SVN: r37398 - trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard.
by jbosstools-commits@lists.jboss.org
Author: adietish
Date: 2011-12-16 12:09:20 -0500 (Fri, 16 Dec 2011)
New Revision: 37398
Modified:
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationWizardModel.java
trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/EmbedCartridgeWizardPageModel.java
Log:
[JBIDE-10502] waiting for jenkins to become ready
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationWizardModel.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationWizardModel.java 2011-12-16 14:51:46 UTC (rev 37397)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/ApplicationWizardModel.java 2011-12-16 17:09:20 UTC (rev 37398)
@@ -65,14 +65,7 @@
public void createApplication() throws OpenShiftException {
IApplication application = createApplication(name, cartridge);
- final boolean isApplicationAvailable = application.waitForAccessible(APP_CREATION_TIMEOUT * 1000);
- if (isApplicationAvailable) {
- setApplication(application);
- } else {
- throw new OpenShiftApplicationNotAvailableException(NLS.bind(
- OpenShiftExpressUIMessages.HOSTNAME_NOT_ANSWERING,
- application.getApplicationUrl()));
- }
+ setApplication(application);
}
public void setApplication(IApplication application) {
@@ -84,10 +77,21 @@
}
public IApplication createApplication(String name, ICartridge cartridge) throws OpenShiftException {
- return getUser().createApplication(name, cartridge);
+ IApplication application = getUser().createApplication(name, cartridge);
+ waitForAccessible(application);
+ return application;
}
public boolean hasApplication(String name) throws OpenShiftException {
return user.hasApplication(name);
}
+
+ private void waitForAccessible(IApplication application) throws OpenShiftApplicationNotAvailableException, OpenShiftException {
+ if (!application.waitForAccessible(APP_CREATION_TIMEOUT * 1000)) {
+ throw new OpenShiftApplicationNotAvailableException(NLS.bind(
+ OpenShiftExpressUIMessages.HOSTNAME_NOT_ANSWERING,
+ application.getApplicationUrl()));
+ }
+ }
+
}
Modified: trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/EmbedCartridgeWizardPageModel.java
===================================================================
--- trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/EmbedCartridgeWizardPageModel.java 2011-12-16 14:51:46 UTC (rev 37397)
+++ trunk/openshift/plugins/org.jboss.tools.openshift.express.ui/src/org/jboss/tools/openshift/express/internal/ui/wizard/EmbedCartridgeWizardPageModel.java 2011-12-16 17:09:20 UTC (rev 37398)
@@ -94,10 +94,9 @@
}
public IApplication createJenkinsApplication(String name) throws OpenShiftException {
- IApplication application = wizardModel.getUser().createApplication(name, ICartridge.JENKINS_14);
- return application;
+ return wizardModel.createApplication(name, ICartridge.JENKINS_14);
}
-
+
/**
* Embeds/removes the cartridges that were added/removed in this wizard
* page.
14 years
JBoss Tools SVN: r37396 - in trunk/vpe/tests: org.jboss.tools.vpe.html.test/resources/htmlTest/WebContent/pages/jbide9975( and 2 other directories.
by jbosstools-commits@lists.jboss.org
Author: dmaliarevich
Date: 2011-12-16 09:46:49 -0500 (Fri, 16 Dec 2011)
New Revision: 37396
Modified:
trunk/vpe/tests/org.jboss.tools.vpe.base.test/src/org/jboss/tools/vpe/base/test/TestDomUtil.java
trunk/vpe/tests/org.jboss.tools.vpe.html.test/resources/htmlTest/WebContent/pages/jbide9975( 1 )/CSSImportConstruction.html
trunk/vpe/tests/org.jboss.tools.vpe.html.test/resources/htmlTest/WebContent/pages/jbide9975( 1 )/CSSImportConstruction.html.xml
Log:
https://issues.jboss.org/browse/JBIDE-5861 - JUnit was updated.
Modified: trunk/vpe/tests/org.jboss.tools.vpe.base.test/src/org/jboss/tools/vpe/base/test/TestDomUtil.java
===================================================================
--- trunk/vpe/tests/org.jboss.tools.vpe.base.test/src/org/jboss/tools/vpe/base/test/TestDomUtil.java 2011-12-16 14:06:22 UTC (rev 37395)
+++ trunk/vpe/tests/org.jboss.tools.vpe.base.test/src/org/jboss/tools/vpe/base/test/TestDomUtil.java 2011-12-16 14:46:49 UTC (rev 37396)
@@ -194,9 +194,9 @@
String xmlName = null;
String xmlValue = null;
while (m.find()) {
- vpeValue = computedStyle.getPropertyValue(m.group(1));
xmlName = m.group(1);
xmlValue = m.group(2);
+ vpeValue = computedStyle.getPropertyValue(xmlName);
if (vpeValue == null) {
throw new DOMComparisonException("CSS property [" //$NON-NLS-1$
+ xmlName + "] is missing in VPE visual node", modelNode); //$NON-NLS-1$
Modified: trunk/vpe/tests/org.jboss.tools.vpe.html.test/resources/htmlTest/WebContent/pages/jbide9975( 1 )/CSSImportConstruction.html
===================================================================
--- trunk/vpe/tests/org.jboss.tools.vpe.html.test/resources/htmlTest/WebContent/pages/jbide9975( 1 )/CSSImportConstruction.html 2011-12-16 14:06:22 UTC (rev 37395)
+++ trunk/vpe/tests/org.jboss.tools.vpe.html.test/resources/htmlTest/WebContent/pages/jbide9975( 1 )/CSSImportConstruction.html 2011-12-16 14:46:49 UTC (rev 37396)
@@ -26,13 +26,13 @@
<body>
<table>
<tr>
- <td>1</td><td>2</td><td>3</td>
+ <td id="id1">1</td><td>2</td><td>3</td>
</tr>
</table>
-<div class="label" id="id1">
+<div class="label" id="id2">
TEXT 111
</div>
-<div class="label2">
+<div class="label2" id="id3">
TEXT 222
</div>
</body>
Modified: trunk/vpe/tests/org.jboss.tools.vpe.html.test/resources/htmlTest/WebContent/pages/jbide9975( 1 )/CSSImportConstruction.html.xml
===================================================================
--- trunk/vpe/tests/org.jboss.tools.vpe.html.test/resources/htmlTest/WebContent/pages/jbide9975( 1 )/CSSImportConstruction.html.xml 2011-12-16 14:06:22 UTC (rev 37395)
+++ trunk/vpe/tests/org.jboss.tools.vpe.html.test/resources/htmlTest/WebContent/pages/jbide9975( 1 )/CSSImportConstruction.html.xml 2011-12-16 14:46:49 UTC (rev 37396)
@@ -1,24 +1,23 @@
<tests>
<test id="id1">
- <DIV>
+ <TD>
background-attachment: scroll;
- background-color: rgb(255, 0, 0);
- background-image:
- url("file:///D:/Projects/jbds/jsf/WebContent/css(2)/print_share_sprite.png");
+ background-color: transparent;
+ background-image: none;
background-position: 0% 0%;
- background-repeat: no-repeat;
- border-bottom-color: rgb(0, 0, 0);
+ background-repeat: repeat;
+ border-bottom-color: rgb(128, 128, 128);
border-bottom-style: none;
border-bottom-width: 0px;
border-collapse: separate;
- border-left-color: rgb(0, 0, 0);
+ border-left-color: rgb(128, 128, 128);
border-left-style: none;
border-left-width: 0px;
- border-right-color: rgb(0, 0, 0);
+ border-right-color: rgb(128, 128, 128);
border-right-style: none;
border-right-width: 0px;
border-spacing: 0px 0px;
- border-top-color: rgb(0, 0, 0);
+ border-top-color: rgb(128, 128, 128);
border-top-style: none;
border-top-width: 0px;
bottom: auto;
@@ -31,7 +30,7 @@
counter-reset: none;
cursor: auto;
direction: ltr;
- display: block;
+ display: table-cell;
empty-cells: -moz-show-background;
float: none;
font-family: serif;
@@ -40,42 +39,9 @@
font-stretch: normal;
font-style: normal;
font-variant: normal;
- font-weight: bold;
+ font-weight: 400;
height: 20px;
left: auto;
- letter-spacing: normal;
- line-height: 20px;
- list-style-image: none;
- list-style-position: outside;
- list-style-type: disc;
- margin-bottom: 0px;
- margin-left: 0px;
- margin-right: 0px;
- margin-top: 0px;
- marker-offset: auto;
- max-height: none;
- max-width: none;
- min-height: 0px;
- min-width: 0px;
- ime-mode: auto;
- opacity: 1;
- outline-color: rgb(0, 0, 0);
- outline-style: none;
- outline-width: 0px;
- outline-offset: 0px;
- overflow: visible;
- overflow-x: visible;
- overflow-y: visible;
- padding-bottom: 0px;
- padding-left: 0px;
- padding-right: 0px;
- padding-top: 0px;
- page-break-after: auto;
- page-break-before: auto;
- pointer-events: auto;
- position: static;
- quotes: "“" "”" "‘" "’";
- right: auto;
table-layout: auto;
text-align: start;
text-decoration: none;
@@ -84,87 +50,46 @@
text-transform: none;
top: auto;
unicode-bidi: embed;
- vertical-align: baseline;
+ vertical-align: middle;
visibility: visible;
white-space: normal;
- width: 1051px;
- word-spacing: 0px;
- z-index: auto;
- -moz-appearance: none;
- -moz-background-clip: border;
- -moz-background-inline-policy: continuous;
- -moz-background-origin: padding;
- -moz-background-size: auto auto;
- -moz-binding: none;
- -moz-border-bottom-colors: none;
- -moz-border-image: none;
- -moz-border-left-colors: none;
- -moz-border-right-colors: none;
- -moz-border-top-colors: none;
- -moz-border-radius-bottomleft: 0px;
- -moz-border-radius-bottomright: 0px;
- -moz-border-radius-topleft: 0px;
- -moz-border-radius-topright: 0px;
- -moz-box-align: stretch;
- -moz-box-direction: normal;
- -moz-box-flex: 0;
- -moz-box-ordinal-group: 1;
- -moz-box-orient: horizontal;
- -moz-box-pack: start;
- -moz-box-shadow: none;
- -moz-box-sizing: content-box;
- -moz-column-count: auto;
- -moz-column-width: auto;
- -moz-column-gap: 16px;
- -moz-column-rule-color: rgb(0, 0, 0);
- -moz-column-rule-width: 0px;
- -moz-column-rule-style: none;
- -moz-float-edge: content-box;
- -moz-force-broken-image-icon: 0;
- -moz-image-region: auto;
- -moz-outline-radius-bottomleft: 0px;
- -moz-outline-radius-bottomright: 0px;
- -moz-outline-radius-topleft: 0px;
- -moz-outline-radius-topright: 0px;
- -moz-stack-sizing: stretch-to-fit;
- -moz-transform: none;
- -moz-transform-origin: 50% 50%;
- -moz-user-focus: none;
- -moz-user-input: enabled;
- -moz-user-modify: read-write;
- -moz-user-select: auto;
- -moz-window-shadow: default;
- word-wrap: normal;
- clip-path: none;
- clip-rule: nonzero;
- color-interpolation: srgb;
- color-interpolation-filters: linearrgb;
- dominant-baseline: auto;
- fill: rgb(0, 0, 0);
- fill-opacity: 1;
- fill-rule: nonzero;
- filter: none;
- flood-color: rgb(0, 0, 0);
- flood-opacity: 1;
- lighting-color: rgb(255, 255, 255);
- image-rendering: auto;
- mask: none;
- marker-end: none;
- marker-mid: none;
- marker-start: none;
- shape-rendering: auto;
- stop-color: rgb(0, 0, 0);
- stop-opacity: 1;
- stroke: none;
- stroke-dasharray: none;
- stroke-dashoffset: 0px;
- stroke-linecap: butt;
- stroke-linejoin: miter;
- stroke-miterlimit: 4;
- stroke-opacity: 1;
- stroke-width: 1px;
- text-anchor: start;
- text-rendering: auto;
+ </TD>
+ </test>
+ <test id="id2">
+ <DIV>
+ background-attachment: scroll;
+ background-color: rgb(255, 0, 0);
+ background-image:
+ url("file:///D:/Projects/jbds/jsf/WebContent/css(2)/print_share_sprite.png");
+ background-position: 0% 0%;
+ background-repeat: no-repeat;
+ float: none;
+ font-family: serif;
+ font-size: 16px;
+ font-size-adjust: none;
+ font-stretch: normal;
+ font-style: normal;
+ font-variant: normal;
+ font-weight: bold;
</DIV>
</test>
+ <test id="id3">
+ <DIV>
+ background-attachment: scroll;
+ background-color: rgb(0, 128, 0);
+ background-image:
+ url("file:///D:/Projects/jbds/jsf/WebContent/css/print_share_sprite.png");
+ background-position: 0% 0%;
+ background-repeat: no-repeat;
+ border-bottom-color: rgb(0, 0, 0);
+ float: none;
+ font-family: serif;
+ font-size: 16px;
+ font-size-adjust: none;
+ font-stretch: normal;
+ font-style: normal;
+ font-variant: normal;
+ font-weight: bold;
+ </DIV>
+ </test>
</tests>
\ No newline at end of file
14 years
JBoss Tools SVN: r37395 - in trunk/vpe: plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe and 9 other directories.
by jbosstools-commits@lists.jboss.org
Author: dmaliarevich
Date: 2011-12-16 09:06:22 -0500 (Fri, 16 Dec 2011)
New Revision: 37395
Added:
trunk/vpe/tests/org.jboss.tools.vpe.html.test/resources/htmlTest/WebContent/css(2)/
trunk/vpe/tests/org.jboss.tools.vpe.html.test/resources/htmlTest/WebContent/css(2)/Style.css
trunk/vpe/tests/org.jboss.tools.vpe.html.test/resources/htmlTest/WebContent/css(2)/s2.css
trunk/vpe/tests/org.jboss.tools.vpe.html.test/resources/htmlTest/WebContent/css/Style.css
trunk/vpe/tests/org.jboss.tools.vpe.html.test/resources/htmlTest/WebContent/css/s2.css
trunk/vpe/tests/org.jboss.tools.vpe.html.test/resources/htmlTest/WebContent/pages/jbide9975( 1 )/CSSImportConstruction.html
trunk/vpe/tests/org.jboss.tools.vpe.html.test/resources/htmlTest/WebContent/pages/jbide9975( 1 )/CSSImportConstruction.html.xml
Modified:
trunk/vpe/plugins/org.jboss.tools.vpe/.options
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/VpeDebug.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/menu/MenuCreationHelper.java
trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/menu/VpeMenuCreator.java
trunk/vpe/tests/org.jboss.tools.vpe.base.test/src/org/jboss/tools/vpe/base/test/ComponentContentTest.java
trunk/vpe/tests/org.jboss.tools.vpe.base.test/src/org/jboss/tools/vpe/base/test/TestDomUtil.java
trunk/vpe/tests/org.jboss.tools.vpe.html.test/src/org/jboss/tools/vpe/html/test/HtmlComponentContentTest.java
Log:
https://issues.jboss.org/browse/JBIDE-5861 - component content test util methods for css style checking were added, "Dump CSS Style" debug option was added, draft version of @import test was added.
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/.options
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/.options 2011-12-16 13:40:38 UTC (rev 37394)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/.options 2011-12-16 14:06:22 UTC (rev 37395)
@@ -11,6 +11,7 @@
org.jboss.tools.vpe/debug/visual/add_pseudo_element=
org.jboss.tools.vpe/debug/visual/contextmenu/dump_source=
org.jboss.tools.vpe/debug/visual/contextmenu/dump_selected_element=
+org.jboss.tools.vpe/debug/visual/contextmenu/dump_style=
org.jboss.tools.vpe/debug/visual/contextmenu/dump_mapping=
org.jboss.tools.vpe/debug/visual/dump_print_hash=
#This may be a list, e.g.:style,class,width
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/VpeDebug.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/VpeDebug.java 2011-12-16 13:40:38 UTC (rev 37394)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/VpeDebug.java 2011-12-16 14:06:22 UTC (rev 37395)
@@ -33,6 +33,7 @@
public static final boolean VISUAL_CONTEXTMENU_DUMP_SOURCE;
public static final boolean VISUAL_CONTEXTMENU_DUMP_SELECTED_ELEMENT;
+ public static final boolean VISUAL_CONTEXTMENU_DUMP_CSS_STYLE;
public static final boolean VISUAL_CONTEXTMENU_DUMP_MAPPING;
public static final boolean VISUAL_DUMP_PRINT_HASH;
@@ -61,17 +62,15 @@
VISUAL_CONTEXTMENU_DUMP_SOURCE = "true".equals(Platform.getDebugOption(VpePlugin.PLUGIN_ID + "/debug/visual/contextmenu/dump_source")); //$NON-NLS-1$ //$NON-NLS-2$
VISUAL_CONTEXTMENU_DUMP_SELECTED_ELEMENT = "true".equals(Platform.getDebugOption(VpePlugin.PLUGIN_ID + "/debug/visual/contextmenu/dump_selected_element")); //$NON-NLS-1$ //$NON-NLS-2$
+ VISUAL_CONTEXTMENU_DUMP_CSS_STYLE = "true".equals(Platform.getDebugOption(VpePlugin.PLUGIN_ID + "/debug/visual/contextmenu/dump_style")); //$NON-NLS-1$ //$NON-NLS-2$
VISUAL_CONTEXTMENU_DUMP_MAPPING = "true".equals(Platform.getDebugOption(VpePlugin.PLUGIN_ID + "/debug/visual/contextmenu/dump_mapping")); //$NON-NLS-1$ //$NON-NLS-2$
VISUAL_DUMP_PRINT_HASH = "true".equals(Platform.getDebugOption(VpePlugin.PLUGIN_ID + "/debug/visual/dump_print_hash")); //$NON-NLS-1$ //$NON-NLS-2$
- VISUAL_DUMP_IGNORED_ATTRIBUTES = Platform
- .getDebugOption(VpePlugin.PLUGIN_ID
+ VISUAL_DUMP_IGNORED_ATTRIBUTES = Platform.getDebugOption(VpePlugin.PLUGIN_ID
+ "/debug/visual/ignored_attributes") != null ? Arrays //$NON-NLS-1$
- .asList(Platform.getDebugOption(
- VpePlugin.PLUGIN_ID
+ .asList(Platform.getDebugOption(VpePlugin.PLUGIN_ID
+ "/debug/visual/ignored_attributes").split( //$NON-NLS-1$
Constants.COMMA)) : null;
VISUAL_CONTEXTMENU_TEST = "true".equals(Platform.getDebugOption(VpePlugin.PLUGIN_ID + "/debug/visual/contextmenu/show_test")); //$NON-NLS-1$ //$NON-NLS-2$
-
USE_PRINT_STACK_TRACE = "true".equals(Platform.getDebugOption(VpePlugin.PLUGIN_ID + "/debug/use_PrintStackTrace")); //$NON-NLS-1$ //$NON-NLS-2$
}
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/menu/MenuCreationHelper.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/menu/MenuCreationHelper.java 2011-12-16 13:40:38 UTC (rev 37394)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/menu/MenuCreationHelper.java 2011-12-16 14:06:22 UTC (rev 37395)
@@ -339,6 +339,19 @@
}
});
}
+ if (VpeDebug.VISUAL_CONTEXTMENU_DUMP_CSS_STYLE) {
+ manager.add(new Action("Dump CSS Style") { //$NON-NLS-1$
+ public void run() {
+ VpeNodeMapping nodeMapping = SelectionUtil
+ .getNodeMappingBySourceSelection(sourceEditor, domMapping);
+ if (nodeMapping != null) {
+ DOMTreeDumper dumper = new DOMTreeDumper(VpeDebug.VISUAL_DUMP_PRINT_HASH);
+ dumper.setIgnoredAttributes(VpeDebug.VISUAL_DUMP_IGNORED_ATTRIBUTES);
+ dumper.dumpStyle(nodeMapping.getVisualNode());
+ }
+ }
+ });
+ }
if (VpeDebug.VISUAL_CONTEXTMENU_DUMP_MAPPING) {
manager.add(new Action("Dump Mapping") { //$NON-NLS-1$
public void run() {
Modified: trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/menu/VpeMenuCreator.java
===================================================================
--- trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/menu/VpeMenuCreator.java 2011-12-16 13:40:38 UTC (rev 37394)
+++ trunk/vpe/plugins/org.jboss.tools.vpe/src/org/jboss/tools/vpe/editor/menu/VpeMenuCreator.java 2011-12-16 14:06:22 UTC (rev 37395)
@@ -132,6 +132,7 @@
if (topLevelMenu) {
addIfEnabled(new DumpSourceAction());
addIfEnabled(new DumpSelectedElementAction());
+ addIfEnabled(new DumpStyleAction());
addIfEnabled(new DumpMappingAction());
addIfEnabled(new TestAction());
}
@@ -307,6 +308,36 @@
return VpeDebug.VISUAL_CONTEXTMENU_DUMP_SELECTED_ELEMENT;
}
}
+
+ /**
+ * Action to dump computed css style
+ * of the selected VPE element.
+ * For debugging purposes only.
+ */
+ public class DumpStyleAction extends Action {
+ public DumpStyleAction() {
+ setText("Dump CSS Style"); //$NON-NLS-1$
+ }
+
+ @Override
+ public void run() {
+ final StructuredTextEditor sourceEditor = vpeMenuUtil.getSourceEditor();
+ final VpeDomMapping domMapping = vpeMenuUtil.getDomMapping();
+ final VpeNodeMapping nodeMapping = SelectionUtil
+ .getNodeMappingBySourceSelection(sourceEditor, domMapping);
+ if (nodeMapping != null) {
+ DOMTreeDumper dumper = new DOMTreeDumper(
+ VpeDebug.VISUAL_DUMP_PRINT_HASH);
+ dumper.setIgnoredAttributes(VpeDebug.VISUAL_DUMP_IGNORED_ATTRIBUTES);
+ dumper.dumpStyle(nodeMapping.getVisualNode());
+ }
+ }
+
+ @Override
+ public boolean isEnabled() {
+ return VpeDebug.VISUAL_CONTEXTMENU_DUMP_CSS_STYLE;
+ }
+ }
/**
* Action to print the {@link #domMapping}. For debugging purposes only.
Modified: trunk/vpe/tests/org.jboss.tools.vpe.base.test/src/org/jboss/tools/vpe/base/test/ComponentContentTest.java
===================================================================
--- trunk/vpe/tests/org.jboss.tools.vpe.base.test/src/org/jboss/tools/vpe/base/test/ComponentContentTest.java 2011-12-16 13:40:38 UTC (rev 37394)
+++ trunk/vpe/tests/org.jboss.tools.vpe.base.test/src/org/jboss/tools/vpe/base/test/ComponentContentTest.java 2011-12-16 14:06:22 UTC (rev 37395)
@@ -99,7 +99,33 @@
throw getException();
}
}
+ protected void compareStyles(VpeController controller, File xmlTestFile)
+ throws FileNotFoundException {
+ Document xmlTestDocument = TestDomUtil.getDocument(xmlTestFile);
+ assertNotNull("Can't get test file, possibly file not exists " + xmlTestFile,xmlTestDocument); //$NON-NLS-1$
+ List<String> ids = TestDomUtil.getTestIds(xmlTestDocument);
+ for (String id : ids) {
+ try{
+ compareStylesJob(controller, xmlTestDocument, id, id);
+ } catch (DOMComparisonException e) {
+ String xPathToNode = SourceDomUtil.getXPath(e.getNode());
+ String testFileName = xmlTestFile.getPath();
+ String message = e.getMessage();
+ fail(String.format("%s[%s]:\n%s", testFileName, xPathToNode, message)); //$NON-NLS-1$
+ }
+ }
+ }
+ private void compareStylesJob(VpeController controller, Document xmlTestDocument,
+ String elementId, String xmlTestId) throws DOMComparisonException {
+ nsIDOMElement vpeElement = findElementById(controller, elementId);
+ assertNotNull("Cannot find element with id = "+elementId, vpeElement); //$NON-NLS-1$
+ Element xmlModelElement = TestDomUtil.getFirstChildElement(
+ TestDomUtil.getElemenById(xmlTestDocument, xmlTestId));
+ assertNotNull(xmlModelElement);
+ TestDomUtil.compareComputedStyle(vpeElement, xmlModelElement);
+ }
+
protected void compareContent(VpeController controller, File xmlTestFile)
throws FileNotFoundException {
Document xmlTestDocument = TestDomUtil.getDocument(xmlTestFile);
@@ -315,6 +341,36 @@
+ tagName + "</span>"; //$NON-NLS-1$
}
+ protected void performStyleTest(String elementPagePath) throws Throwable {
+ String fullelementPagePath = TestUtil.COMPONENTS_PATH + elementPagePath;
+ IFile elementPageFile = (IFile) TestUtil.getComponentFileByFullPath(
+ fullelementPagePath, getTestProjectName());
+ /*
+ * Test that test file was found and exists
+ */
+ assertNotNull("Could not find component file '"+fullelementPagePath+"'", elementPageFile); //$NON-NLS-1$ //$NON-NLS-2$
+
+ IEditorPart editor = WorkbenchUtils.openEditor(elementPageFile,getEditorID());
+ assertNotNull("Editor should be opened.", editor); //$NON-NLS-1$
+ VpeController controller = TestUtil.getVpeController((JSPMultiPageEditor) editor);
+ /*
+ * Get xml test file
+ */
+ IResource xmlFile =TestUtil.getComponentFileByFullPath(fullelementPagePath + XML_FILE_EXTENSION, getTestProjectName());
+ /*
+ * Test that XML test file was found and exists
+ */
+ assertNotNull("Could not find XML component file '"+fullelementPagePath + XML_FILE_EXTENSION+"'", xmlFile); //$NON-NLS-1$ //$NON-NLS-2$
+ File xmlTestFile = xmlFile.getLocation().toFile();
+ /*
+ * Compare styles
+ */
+ compareStyles(controller, xmlTestFile);
+ if (getException() != null) {
+ throw getException();
+ }
+ }
+
/**
* find visual element by "id" entered in source part of vpe
*
@@ -338,6 +394,7 @@
}
return result;
}
+
/**
* find visual element by "id" entered in source part of vpe
*
@@ -346,20 +403,12 @@
* @return
*/
protected nsIDOMNode findNode(VpeController controller, Node node) {
-
- VpeNodeMapping nodeMapping = controller.getDomMapping().getNodeMapping(
- node);
-
- if (nodeMapping == null)
+ VpeNodeMapping nodeMapping = controller.getDomMapping().getNodeMapping(node);
+ if (nodeMapping == null) {
return null;
-
+ }
return nodeMapping.getVisualNode();
}
- /**
- *
- * @return
- */
abstract protected String getTestProjectName();
-
-}
+}
\ No newline at end of file
Modified: trunk/vpe/tests/org.jboss.tools.vpe.base.test/src/org/jboss/tools/vpe/base/test/TestDomUtil.java
===================================================================
--- trunk/vpe/tests/org.jboss.tools.vpe.base.test/src/org/jboss/tools/vpe/base/test/TestDomUtil.java 2011-12-16 13:40:38 UTC (rev 37394)
+++ trunk/vpe/tests/org.jboss.tools.vpe.base.test/src/org/jboss/tools/vpe/base/test/TestDomUtil.java 2011-12-16 14:06:22 UTC (rev 37395)
@@ -37,10 +37,12 @@
import org.jboss.tools.vpe.editor.util.VpeStyleUtil;
import org.mozilla.interfaces.nsIDOMAttr;
import org.mozilla.interfaces.nsIDOMCSSStyleDeclaration;
+import org.mozilla.interfaces.nsIDOMDocumentView;
import org.mozilla.interfaces.nsIDOMElement;
import org.mozilla.interfaces.nsIDOMNamedNodeMap;
import org.mozilla.interfaces.nsIDOMNode;
import org.mozilla.interfaces.nsIDOMNodeList;
+import org.mozilla.interfaces.nsIDOMViewCSS;
import org.w3c.dom.Attr;
import org.w3c.dom.Document;
import org.w3c.dom.Element;
@@ -73,7 +75,9 @@
final public static String START_REGEX = "/"; //$NON-NLS-1$
final public static String END_REGEX = "/"; //$NON-NLS-1$
-
+
+ public static final Pattern CSS_PROPERTY_PATTERN = Pattern.compile("([^\\p{Space}]*)[\\p{Space}]*:[\\p{Space}]*(.*)[\\p{Space}]*;"); //$NON-NLS-1$
+
public static Document getDocument(File file) throws FileNotFoundException {
// create reader
FileReader reader = new FileReader(file);
@@ -145,6 +149,65 @@
}
+ public static void compareComputedStyle(nsIDOMNode vpeNode, Node modelNode)
+ throws DOMComparisonException {
+ /*
+ * Check node names
+ */
+ if (!modelNode.getNodeName().equalsIgnoreCase(vpeNode.getNodeName())) {
+ throw new DOMComparisonException("name of tag is \"" //$NON-NLS-1$
+ + vpeNode.getNodeName() + "\"but must be \"" //$NON-NLS-1$
+ + modelNode.getNodeName() + "\"", modelNode); //$NON-NLS-1$
+ }
+ /*
+ * Check node values
+ */
+ if ((modelNode.getNodeValue() != null)
+ && (!modelNode.getNodeValue().trim().equalsIgnoreCase(
+ vpeNode.getNodeValue().trim()))) {
+ throw new DOMComparisonException("value of " + vpeNode.getNodeName() //$NON-NLS-1$
+ + " is \"" + vpeNode.getNodeValue().trim() //$NON-NLS-1$
+ + "\" but must be \"" + modelNode.getNodeValue().trim() //$NON-NLS-1$
+ + "\"", modelNode); //$NON-NLS-1$
+ }
+ /*
+ * Check node attributes
+ */
+ if (modelNode.getNodeType() == Node.ELEMENT_NODE) {
+ compareAttributes(modelNode.getAttributes(), vpeNode.getAttributes());
+ }
+ /*
+ * Check node styles
+ */
+ compareComputedStyleJob(vpeNode, modelNode);
+ }
+
+ private static void compareComputedStyleJob(nsIDOMNode vpeNode, Node modelNode)
+ throws DOMComparisonException {
+ final nsIDOMDocumentView view = queryInterface(vpeNode.getOwnerDocument(), nsIDOMDocumentView.class);
+ final nsIDOMViewCSS viewCss = queryInterface(view.getDefaultView(), nsIDOMViewCSS.class);
+ final nsIDOMElement vpeElement = queryInterface(vpeNode, nsIDOMElement.class);
+ final nsIDOMCSSStyleDeclaration computedStyle = viewCss.getComputedStyle(vpeElement, null);
+ String modelText = modelNode.getTextContent();
+ Matcher m = CSS_PROPERTY_PATTERN.matcher(modelText);
+ String vpeValue = null;
+ String xmlName = null;
+ String xmlValue = null;
+ while (m.find()) {
+ vpeValue = computedStyle.getPropertyValue(m.group(1));
+ xmlName = m.group(1);
+ xmlValue = m.group(2);
+ if (vpeValue == null) {
+ throw new DOMComparisonException("CSS property [" //$NON-NLS-1$
+ + xmlName + "] is missing in VPE visual node", modelNode); //$NON-NLS-1$
+ } else if (!vpeValue.equalsIgnoreCase(xmlValue)) {
+ throw new DOMComparisonException("CSS property [" //$NON-NLS-1$
+ + xmlName + "] is [" + vpeValue + "]" //$NON-NLS-1$ //$NON-NLS-2$
+ + ", but should be [" + xmlValue + "]", modelNode); //$NON-NLS-1$ //$NON-NLS-2$
+ }
+ }
+ }
+
/**
*
* @param vpeNode
@@ -154,7 +217,6 @@
*/
public static void compareNodes(nsIDOMNode vpeNode, Node modelNode)
throws DOMComparisonException {
-
if (!modelNode.getNodeName().equalsIgnoreCase(vpeNode.getNodeName())) {
throw new DOMComparisonException("name of tag is \"" //$NON-NLS-1$
+ vpeNode.getNodeName() + "\"but must be \"" //$NON-NLS-1$
@@ -171,19 +233,15 @@
// compare node's attributes
if (modelNode.getNodeType() == Node.ELEMENT_NODE) {
- compareAttributes(modelNode.getAttributes(), vpeNode
- .getAttributes());
+ compareAttributes(modelNode.getAttributes(), vpeNode.getAttributes());
}
-
// compare children
nsIDOMNodeList vpeChildren = vpeNode.getChildNodes();
NodeList schemeChildren = modelNode.getChildNodes();
int realCount = 0;
int length = schemeChildren.getLength();
for (int i = 0; i < length; i++) {
-
Node schemeChild = schemeChildren.item(i);
-
// leave out empty text nodes in test dom model
String nodeValue = schemeChild.getNodeValue();
if ((schemeChild.getNodeType() != Node.TEXT_NODE)
@@ -214,7 +272,6 @@
compareNodes(vpeChild, schemeChild);
}
}
-
}
/**
@@ -353,7 +410,7 @@
private static List<String> splitAndSort(String property) {
List<String> propertyParts = new ArrayList<String>();
- for (String propertyPart : property.split("[\\s]+")) {
+ for (String propertyPart : property.split("[\\s]+")) { //$NON-NLS-1$
if (!propertyPart.isEmpty()) {
propertyParts.add(propertyPart);
}
Added: trunk/vpe/tests/org.jboss.tools.vpe.html.test/resources/htmlTest/WebContent/css/Style.css
===================================================================
--- trunk/vpe/tests/org.jboss.tools.vpe.html.test/resources/htmlTest/WebContent/css/Style.css (rev 0)
+++ trunk/vpe/tests/org.jboss.tools.vpe.html.test/resources/htmlTest/WebContent/css/Style.css 2011-12-16 14:06:22 UTC (rev 37395)
@@ -0,0 +1,10 @@
+.label {
+ font-weight: bold;
+ background: transparent url("file:///D:/Projects/jbds/jsf/WebContent/css(2)/print_share_sprite.png") no-repeat;
+}
+.label2 {
+ font-weight: bold;
+ background: transparent url(file:///D:/Projects/jbds/jsf/WebContent/css/print_share_sprite.png) no-repeat;
+}
+table {width: 100%; border-spacing: 0; }
+tr { background: #f6d654 url(images/orangebg.png) repeat-y; }
\ No newline at end of file
Added: trunk/vpe/tests/org.jboss.tools.vpe.html.test/resources/htmlTest/WebContent/css/s2.css
===================================================================
--- trunk/vpe/tests/org.jboss.tools.vpe.html.test/resources/htmlTest/WebContent/css/s2.css (rev 0)
+++ trunk/vpe/tests/org.jboss.tools.vpe.html.test/resources/htmlTest/WebContent/css/s2.css 2011-12-16 14:06:22 UTC (rev 37395)
@@ -0,0 +1,8 @@
+.label {
+ font-weight: bold;
+ background-color: red;
+}
+.label2 {
+ font-weight: bold;
+ background-color: green;
+}
\ No newline at end of file
Added: trunk/vpe/tests/org.jboss.tools.vpe.html.test/resources/htmlTest/WebContent/css(2)/Style.css
===================================================================
--- trunk/vpe/tests/org.jboss.tools.vpe.html.test/resources/htmlTest/WebContent/css(2)/Style.css (rev 0)
+++ trunk/vpe/tests/org.jboss.tools.vpe.html.test/resources/htmlTest/WebContent/css(2)/Style.css 2011-12-16 14:06:22 UTC (rev 37395)
@@ -0,0 +1,10 @@
+.label {
+ font-weight: bold;
+ background: transparent url("file:///D:/Projects/jbds/jsf/WebContent/css(2)/print_share_sprite.png") no-repeat;
+}
+.label2 {
+ font-weight: bold;
+ background: transparent url(file:///D:/Projects/jbds/jsf/WebContent/css/print_share_sprite.png) no-repeat;
+}
+table {width: 100%; border-spacing: 0; }
+tr { background: #f6d654 url(images/orangebg.png) repeat-y; }
\ No newline at end of file
Added: trunk/vpe/tests/org.jboss.tools.vpe.html.test/resources/htmlTest/WebContent/css(2)/s2.css
===================================================================
--- trunk/vpe/tests/org.jboss.tools.vpe.html.test/resources/htmlTest/WebContent/css(2)/s2.css (rev 0)
+++ trunk/vpe/tests/org.jboss.tools.vpe.html.test/resources/htmlTest/WebContent/css(2)/s2.css 2011-12-16 14:06:22 UTC (rev 37395)
@@ -0,0 +1,8 @@
+.label {
+ font-weight: bold;
+ background-color: red;
+}
+.label2 {
+ font-weight: bold;
+ background-color: green;
+}
\ No newline at end of file
Added: trunk/vpe/tests/org.jboss.tools.vpe.html.test/resources/htmlTest/WebContent/pages/jbide9975( 1 )/CSSImportConstruction.html
===================================================================
--- trunk/vpe/tests/org.jboss.tools.vpe.html.test/resources/htmlTest/WebContent/pages/jbide9975( 1 )/CSSImportConstruction.html (rev 0)
+++ trunk/vpe/tests/org.jboss.tools.vpe.html.test/resources/htmlTest/WebContent/pages/jbide9975( 1 )/CSSImportConstruction.html 2011-12-16 14:06:22 UTC (rev 37395)
@@ -0,0 +1,39 @@
+<html>
+<head>
+<style type="text/css" title="currentStyle" media="screen">
+@import "./css/Style.css";
+@import "../../css(2)/Style.css";
+@import "../../css/s2.css";
+</style>
+
+<style>
+ @import "/style/main.css" screen;
+ @import "/style/palm.css" handheld, print;
+ </style>
+
+ <style type="text/css">
+ @import url("/style/header.css");
+ H1 { font-size: 120%; font-family: Arial, Helvetica, sans-serif; color: green;
+ }
+ </style>
+ <style type="text/css">
+ @import url('/style/headerSingleQuotes.css');
+ @import url(/style(2)/header111.css);
+ H1 { font-size: 120%; font-family: Arial, Helvetica, sans-serif; color: green;
+ }
+ </style>
+</head>
+<body>
+<table>
+ <tr>
+ <td>1</td><td>2</td><td>3</td>
+ </tr>
+ </table>
+<div class="label" id="id1">
+TEXT 111
+</div>
+<div class="label2">
+TEXT 222
+</div>
+</body>
+</html>
\ No newline at end of file
Added: trunk/vpe/tests/org.jboss.tools.vpe.html.test/resources/htmlTest/WebContent/pages/jbide9975( 1 )/CSSImportConstruction.html.xml
===================================================================
--- trunk/vpe/tests/org.jboss.tools.vpe.html.test/resources/htmlTest/WebContent/pages/jbide9975( 1 )/CSSImportConstruction.html.xml (rev 0)
+++ trunk/vpe/tests/org.jboss.tools.vpe.html.test/resources/htmlTest/WebContent/pages/jbide9975( 1 )/CSSImportConstruction.html.xml 2011-12-16 14:06:22 UTC (rev 37395)
@@ -0,0 +1,170 @@
+<tests>
+ <test id="id1">
+ <DIV>
+ background-attachment: scroll;
+ background-color: rgb(255, 0, 0);
+ background-image:
+ url("file:///D:/Projects/jbds/jsf/WebContent/css(2)/print_share_sprite.png");
+ background-position: 0% 0%;
+ background-repeat: no-repeat;
+ border-bottom-color: rgb(0, 0, 0);
+ border-bottom-style: none;
+ border-bottom-width: 0px;
+ border-collapse: separate;
+ border-left-color: rgb(0, 0, 0);
+ border-left-style: none;
+ border-left-width: 0px;
+ border-right-color: rgb(0, 0, 0);
+ border-right-style: none;
+ border-right-width: 0px;
+ border-spacing: 0px 0px;
+ border-top-color: rgb(0, 0, 0);
+ border-top-style: none;
+ border-top-width: 0px;
+ bottom: auto;
+ caption-side: top;
+ clear: none;
+ clip: auto;
+ color: rgb(0, 0, 0);
+ content: none;
+ counter-increment: none;
+ counter-reset: none;
+ cursor: auto;
+ direction: ltr;
+ display: block;
+ empty-cells: -moz-show-background;
+ float: none;
+ font-family: serif;
+ font-size: 16px;
+ font-size-adjust: none;
+ font-stretch: normal;
+ font-style: normal;
+ font-variant: normal;
+ font-weight: bold;
+ height: 20px;
+ left: auto;
+ letter-spacing: normal;
+ line-height: 20px;
+ list-style-image: none;
+ list-style-position: outside;
+ list-style-type: disc;
+ margin-bottom: 0px;
+ margin-left: 0px;
+ margin-right: 0px;
+ margin-top: 0px;
+ marker-offset: auto;
+ max-height: none;
+ max-width: none;
+ min-height: 0px;
+ min-width: 0px;
+ ime-mode: auto;
+ opacity: 1;
+ outline-color: rgb(0, 0, 0);
+ outline-style: none;
+ outline-width: 0px;
+ outline-offset: 0px;
+ overflow: visible;
+ overflow-x: visible;
+ overflow-y: visible;
+ padding-bottom: 0px;
+ padding-left: 0px;
+ padding-right: 0px;
+ padding-top: 0px;
+ page-break-after: auto;
+ page-break-before: auto;
+ pointer-events: auto;
+ position: static;
+ quotes: "“" "”" "‘" "’";
+ right: auto;
+ table-layout: auto;
+ text-align: start;
+ text-decoration: none;
+ text-indent: 0px;
+ text-shadow: none;
+ text-transform: none;
+ top: auto;
+ unicode-bidi: embed;
+ vertical-align: baseline;
+ visibility: visible;
+ white-space: normal;
+ width: 1051px;
+ word-spacing: 0px;
+ z-index: auto;
+ -moz-appearance: none;
+ -moz-background-clip: border;
+ -moz-background-inline-policy: continuous;
+ -moz-background-origin: padding;
+ -moz-background-size: auto auto;
+ -moz-binding: none;
+ -moz-border-bottom-colors: none;
+ -moz-border-image: none;
+ -moz-border-left-colors: none;
+ -moz-border-right-colors: none;
+ -moz-border-top-colors: none;
+ -moz-border-radius-bottomleft: 0px;
+ -moz-border-radius-bottomright: 0px;
+ -moz-border-radius-topleft: 0px;
+ -moz-border-radius-topright: 0px;
+ -moz-box-align: stretch;
+ -moz-box-direction: normal;
+ -moz-box-flex: 0;
+ -moz-box-ordinal-group: 1;
+ -moz-box-orient: horizontal;
+ -moz-box-pack: start;
+ -moz-box-shadow: none;
+ -moz-box-sizing: content-box;
+ -moz-column-count: auto;
+ -moz-column-width: auto;
+ -moz-column-gap: 16px;
+ -moz-column-rule-color: rgb(0, 0, 0);
+ -moz-column-rule-width: 0px;
+ -moz-column-rule-style: none;
+ -moz-float-edge: content-box;
+ -moz-force-broken-image-icon: 0;
+ -moz-image-region: auto;
+ -moz-outline-radius-bottomleft: 0px;
+ -moz-outline-radius-bottomright: 0px;
+ -moz-outline-radius-topleft: 0px;
+ -moz-outline-radius-topright: 0px;
+ -moz-stack-sizing: stretch-to-fit;
+ -moz-transform: none;
+ -moz-transform-origin: 50% 50%;
+ -moz-user-focus: none;
+ -moz-user-input: enabled;
+ -moz-user-modify: read-write;
+ -moz-user-select: auto;
+ -moz-window-shadow: default;
+ word-wrap: normal;
+ clip-path: none;
+ clip-rule: nonzero;
+ color-interpolation: srgb;
+ color-interpolation-filters: linearrgb;
+ dominant-baseline: auto;
+ fill: rgb(0, 0, 0);
+ fill-opacity: 1;
+ fill-rule: nonzero;
+ filter: none;
+ flood-color: rgb(0, 0, 0);
+ flood-opacity: 1;
+ lighting-color: rgb(255, 255, 255);
+ image-rendering: auto;
+ mask: none;
+ marker-end: none;
+ marker-mid: none;
+ marker-start: none;
+ shape-rendering: auto;
+ stop-color: rgb(0, 0, 0);
+ stop-opacity: 1;
+ stroke: none;
+ stroke-dasharray: none;
+ stroke-dashoffset: 0px;
+ stroke-linecap: butt;
+ stroke-linejoin: miter;
+ stroke-miterlimit: 4;
+ stroke-opacity: 1;
+ stroke-width: 1px;
+ text-anchor: start;
+ text-rendering: auto;
+ </DIV>
+ </test>
+</tests>
\ No newline at end of file
Modified: trunk/vpe/tests/org.jboss.tools.vpe.html.test/src/org/jboss/tools/vpe/html/test/HtmlComponentContentTest.java
===================================================================
--- trunk/vpe/tests/org.jboss.tools.vpe.html.test/src/org/jboss/tools/vpe/html/test/HtmlComponentContentTest.java 2011-12-16 13:40:38 UTC (rev 37394)
+++ trunk/vpe/tests/org.jboss.tools.vpe.html.test/src/org/jboss/tools/vpe/html/test/HtmlComponentContentTest.java 2011-12-16 14:06:22 UTC (rev 37395)
@@ -485,6 +485,10 @@
performContentTest("jbide9975( 1 )/CSSUrlQuotes.html"); //$NON-NLS-1$
}
+ public void testCssImport() throws Throwable {
+ performStyleTest("jbide9975( 1 )/CSSImportConstruction.html"); //$NON-NLS-1$
+ }
+
protected String getTestProjectName() {
return HtmlAllTests.IMPORT_PROJECT_NAME;
}
14 years
JBoss Tools SVN: r37394 - trunk/hibernatetools/plugins/org.jboss.tools.hibernate4_0/src/org/jboss/tools/hibernate4_0.
by jbosstools-commits@lists.jboss.org
Author: dgeraskov
Date: 2011-12-16 08:40:38 -0500 (Fri, 16 Dec 2011)
New Revision: 37394
Modified:
trunk/hibernatetools/plugins/org.jboss.tools.hibernate4_0/src/org/jboss/tools/hibernate4_0/ConfigurationFactory.java
Log:
https://issues.jboss.org/browse/JBIDE-10515
Call buildMapping evidently on EJB3Configuration in Hibernate4
Modified: trunk/hibernatetools/plugins/org.jboss.tools.hibernate4_0/src/org/jboss/tools/hibernate4_0/ConfigurationFactory.java
===================================================================
--- trunk/hibernatetools/plugins/org.jboss.tools.hibernate4_0/src/org/jboss/tools/hibernate4_0/ConfigurationFactory.java 2011-12-16 11:34:14 UTC (rev 37393)
+++ trunk/hibernatetools/plugins/org.jboss.tools.hibernate4_0/src/org/jboss/tools/hibernate4_0/ConfigurationFactory.java 2011-12-16 13:40:38 UTC (rev 37394)
@@ -238,6 +238,9 @@
persistenceUnit);
throw new HibernateConsoleRuntimeException(out);
}
+ //in hibernate 4 "buildMappings" is not called in method "configure", so call it manually
+ method = clazz.getMethod("buildMappings", new Class[0]); //$NON-NLS-1$
+ method.invoke(ejb3cfg, new Object[0]);
method = clazz.getMethod("getHibernateConfiguration", new Class[0]);//$NON-NLS-1$
Configuration invoke = (Configuration) method.invoke(ejb3cfg, (Object[]) null);
invoke = configureConnectionProfile(invoke);
14 years
JBoss Tools SVN: r37393 - in trunk/ws/tests/org.jboss.tools.ws.ui.bot.test: META-INF and 7 other directories.
by jbosstools-commits@lists.jboss.org
Author: jjankovi
Date: 2011-12-16 06:34:14 -0500 (Fri, 16 Dec 2011)
New Revision: 37393
Added:
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/WSTestBase.java
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/utils/DeploymentHelper.java
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/utils/ProjectHelper.java
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/utils/ResourceHelper.java
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/utils/WebServiceClientHelper.java
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/webservice/
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/webservice/BottomUpWSTest.java
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/webservice/TopDownWSTest.java
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/webservice/WebServiceTestBase.java
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/webservice/eap/
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/webservice/eap/EAPCompAllTests.java
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/webservice/eap/EAPFromJavaTest.java
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/webservice/eap/EAPFromWSDLTest.java
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/wsclient/
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/wsclient/WSClient.java
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/wsclient/WsClientTest.java
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/wstester/
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/wstester/WsTesterTest.java
Removed:
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/eap/
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/jbt/
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/utils/WSClient.java
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/wtp/
Modified:
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/EAPCompAllTests.launch
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/META-INF/MANIFEST.MF
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/JBossWSProjectFacetBotTest.java
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/WSAllBotTests.java
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/sample/SampleRESTWebServiceTest.java
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/sample/SampleSoapWebServiceTest.java
trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/sample/SampleWSBase.java
Log:
Huge decomposition of all web services bot tests
Modified: trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/EAPCompAllTests.launch
===================================================================
--- trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/EAPCompAllTests.launch 2011-12-16 08:34:19 UTC (rev 37392)
+++ trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/EAPCompAllTests.launch 2011-12-16 11:34:14 UTC (rev 37393)
@@ -14,7 +14,7 @@
<booleanAttribute key="includeOptional" value="true"/>
<stringAttribute key="location" value="${workspace_loc}/../junit-workspace"/>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_PATHS">
-<listEntry value="/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/eap/EAPCompAllTests.java"/>
+<listEntry value="/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/webservice/eap/EAPCompAllTests.java"/>
</listAttribute>
<listAttribute key="org.eclipse.debug.core.MAPPED_RESOURCE_TYPES">
<listEntry value="1"/>
@@ -26,7 +26,7 @@
<booleanAttribute key="org.eclipse.jdt.junit.KEEPRUNNING_ATTR" value="false"/>
<stringAttribute key="org.eclipse.jdt.junit.TESTNAME" value=""/>
<stringAttribute key="org.eclipse.jdt.junit.TEST_KIND" value="org.eclipse.jdt.junit.loader.junit4"/>
-<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.jboss.tools.ws.ui.bot.test.eap.EAPCompAllTests"/>
+<stringAttribute key="org.eclipse.jdt.launching.MAIN_TYPE" value="org.jboss.tools.ws.ui.bot.test.webservice.eap.EAPCompAllTests"/>
<stringAttribute key="org.eclipse.jdt.launching.PROGRAM_ARGUMENTS" value="-os ${target.os} -ws ${target.ws} -arch ${target.arch} -nl ${target.nl} -consoleLog"/>
<stringAttribute key="org.eclipse.jdt.launching.PROJECT_ATTR" value="org.jboss.tools.ws.ui.bot.test"/>
<stringAttribute key="org.eclipse.jdt.launching.SOURCE_PATH_PROVIDER" value="org.eclipse.pde.ui.workbenchClasspathProvider"/>
Modified: trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/META-INF/MANIFEST.MF
===================================================================
--- trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/META-INF/MANIFEST.MF 2011-12-16 08:34:19 UTC (rev 37392)
+++ trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/META-INF/MANIFEST.MF 2011-12-16 11:34:14 UTC (rev 37393)
@@ -35,4 +35,4 @@
org.jboss.tools.ui.bot.ext,
org.osgi.framework,
org.jboss.tools.ws.ui.bot.test.uiutils.wizards",
- org.jboss.tools.ws.ui.bot.test.eap
+ org.jboss.tools.ws.ui.bot.test.webservice.eap
Modified: trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/JBossWSProjectFacetBotTest.java
===================================================================
--- trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/JBossWSProjectFacetBotTest.java 2011-12-16 08:34:19 UTC (rev 37392)
+++ trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/JBossWSProjectFacetBotTest.java 2011-12-16 11:34:14 UTC (rev 37393)
@@ -1,3 +1,13 @@
+ /*******************************************************************************
+ * Copyright (c) 2007-2009 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributor:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
package org.jboss.tools.ws.ui.bot.test;
import java.io.IOException;
Modified: trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/WSAllBotTests.java
===================================================================
--- trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/WSAllBotTests.java 2011-12-16 08:34:19 UTC (rev 37392)
+++ trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/WSAllBotTests.java 2011-12-16 11:34:14 UTC (rev 37393)
@@ -11,14 +11,14 @@
package org.jboss.tools.ws.ui.bot.test;
import org.jboss.tools.ui.bot.ext.RequirementAwareSuite;
-import org.jboss.tools.ws.ui.bot.test.eap.EAPFromJavaTest;
-import org.jboss.tools.ws.ui.bot.test.eap.EAPFromWSDLTest;
-import org.jboss.tools.ws.ui.bot.test.jbt.WsTesterTest;
import org.jboss.tools.ws.ui.bot.test.sample.SampleRESTWebServiceTest;
import org.jboss.tools.ws.ui.bot.test.sample.SampleSoapWebServiceTest;
-import org.jboss.tools.ws.ui.bot.test.wtp.BottomUpWSTest;
-import org.jboss.tools.ws.ui.bot.test.wtp.TopDownWSTest;
-import org.jboss.tools.ws.ui.bot.test.wtp.WsClientTest;
+import org.jboss.tools.ws.ui.bot.test.webservice.BottomUpWSTest;
+import org.jboss.tools.ws.ui.bot.test.webservice.TopDownWSTest;
+import org.jboss.tools.ws.ui.bot.test.webservice.eap.EAPFromJavaTest;
+import org.jboss.tools.ws.ui.bot.test.webservice.eap.EAPFromWSDLTest;
+import org.jboss.tools.ws.ui.bot.test.wsclient.WsClientTest;
+import org.jboss.tools.ws.ui.bot.test.wstester.WsTesterTest;
import org.junit.runner.RunWith;
import org.junit.runners.Suite.SuiteClasses;
Added: trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/WSTestBase.java
===================================================================
--- trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/WSTestBase.java (rev 0)
+++ trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/WSTestBase.java 2011-12-16 11:34:14 UTC (rev 37393)
@@ -0,0 +1,106 @@
+/*******************************************************************************
+ * Copyright (c) 2010-2011 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.ws.ui.bot.test;
+
+import java.text.MessageFormat;
+import java.util.logging.Logger;
+
+import org.jboss.tools.ui.bot.ext.RequirementAwareSuite;
+import org.jboss.tools.ui.bot.ext.SWTTestExt;
+import org.jboss.tools.ui.bot.ext.config.Annotations.Require;
+import org.jboss.tools.ui.bot.ext.config.Annotations.Server;
+import org.jboss.tools.ws.ui.bot.test.uiutils.wizards.WsWizardBase.Slider_Level;
+import org.jboss.tools.ws.ui.bot.test.utils.DeploymentHelper;
+import org.jboss.tools.ws.ui.bot.test.utils.ProjectHelper;
+import org.jboss.tools.ws.ui.bot.test.utils.ResourceHelper;
+import org.jboss.tools.ws.ui.bot.test.utils.WebServiceClientHelper;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Before;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite.SuiteClasses;
+
+@Require(server=@Server(),perspective="Java EE")
+(a)RunWith(RequirementAwareSuite.class)
+@SuiteClasses({ WSAllBotTests.class })
+public class WSTestBase extends SWTTestExt {
+
+ private Slider_Level level;
+
+ private static final String SOAP_REQUEST_TEMPLATE = "<?xml version=\"1.0\" encoding=\"utf-8\" standalone=\"yes\" ?>"
+ + "<soap:Envelope xmlns:soap=\"http://schemas.xmlsoap.org/soap/envelope/\""
+ + " xmlns:xsi=\"http://www.w3.org/2001/XMLSchema-instance\""
+ + " xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\">"
+ + "<soap:Body>{0}</soap:Body>" + "</soap:Envelope>";
+
+ protected static final Logger LOGGER = Logger
+ .getLogger(WSTestBase.class.getName());
+
+ protected static ResourceHelper resourceHelper = new ResourceHelper();
+ protected static ProjectHelper projectHelper = new ProjectHelper();
+ protected static DeploymentHelper deploymentHelper = new DeploymentHelper();
+ protected static WebServiceClientHelper clientHelper = new WebServiceClientHelper();
+
+ @Before
+ public void setup() {
+ if (getEarProjectName() != null && !projectExists(getEarProjectName())) {
+ projectHelper.createEARProject(getEarProjectName());
+ }
+ if (!projectExists(getWsProjectName())) {
+ projectHelper.createProject(getWsProjectName());
+ }
+ }
+
+ protected boolean projectExists(String name) {
+ return projectExplorer.existsResource(name);
+ }
+
+ @After
+ public void cleanup() {
+ servers.removeAllProjectsFromServer();
+ }
+
+ @AfterClass
+ public static void cleanAll() {
+ LOGGER.info("cleanAll");
+ projectExplorer.deleteAllProjects();
+ }
+
+ protected Slider_Level getLevel() {
+ return level;
+ }
+
+ protected void setLevel(Slider_Level level) {
+ this.level = level;
+ }
+
+ protected String getWsProjectName() {
+ return null;
+ }
+
+ protected String getEarProjectName() {
+ return null;
+ }
+
+ protected String getWsPackage() {
+ return null;
+ }
+
+ protected String getWsName() {
+ return null;
+ }
+
+ public static String getSoapRequest(String body) {
+ return MessageFormat.format(SOAP_REQUEST_TEMPLATE, body);
+ }
+
+}
Modified: trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/sample/SampleRESTWebServiceTest.java
===================================================================
--- trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/sample/SampleRESTWebServiceTest.java 2011-12-16 08:34:19 UTC (rev 37392)
+++ trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/sample/SampleRESTWebServiceTest.java 2011-12-16 11:34:14 UTC (rev 37393)
@@ -20,8 +20,14 @@
import org.jboss.tools.ui.bot.ext.Timing;
import org.jboss.tools.ws.ui.bot.test.uiutils.actions.TreeItemAction;
import org.jboss.tools.ws.ui.bot.test.uiutils.wizards.SampleWSWizard.Type;
+import org.junit.Ignore;
import org.junit.Test;
+/**
+ *
+ * @author jjankovi
+ *
+ */
public class SampleRESTWebServiceTest extends SampleWSBase {
private final String REST_WS_NODE = "JAX-RS REST Web Services";
@@ -46,7 +52,7 @@
createSampleRESTWS(getWsProjectName(), "RESTSample", "rest.sample", "Sample", "RESTApp");
checkRESTService(getWsProjectName(), "RESTSample", "rest.sample", "Sample", "Hello World!", "RESTApp");
}
-
+ @Ignore //not implemented yet
@Test
public void testSimpleRestWS() {
@@ -69,7 +75,7 @@
private void createSampleRESTWS(String project, String name, String pkg, String cls, String appCls) {
SWTBotEditor ed = createSampleService(Type.REST, project, name, pkg, cls, appCls);
- copyResourceToClass(ed, SampleRESTWebServiceTest.class.
+ resourceHelper.copyResourceToClass(ed, SampleRESTWebServiceTest.class.
getResourceAsStream("/resources/jbossws/Rest.java.ws"),false);
}
Modified: trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/sample/SampleSoapWebServiceTest.java
===================================================================
--- trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/sample/SampleSoapWebServiceTest.java 2011-12-16 08:34:19 UTC (rev 37392)
+++ trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/sample/SampleSoapWebServiceTest.java 2011-12-16 11:34:14 UTC (rev 37393)
@@ -11,8 +11,14 @@
package org.jboss.tools.ws.ui.bot.test.sample;
import org.eclipse.core.resources.IFile;
+import org.junit.Ignore;
import org.junit.Test;
+/**
+ *
+ * @author jjankovi
+ *
+ */
public class SampleSoapWebServiceTest extends SampleWSBase {
@Override
@@ -33,10 +39,9 @@
createSampleSOAPWS(getWsProjectName(), "GreetService", "greeter", "Greeter");
checkSOAPService(getWsProjectName(), "GreetService", "greeter", "Greeter", "Tester");
}
-
+ @Ignore //not implemented yet
@Test
public void testSimpleSoapWS() {
}
-
}
Modified: trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/sample/SampleWSBase.java
===================================================================
--- trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/sample/SampleWSBase.java 2011-12-16 08:34:19 UTC (rev 37392)
+++ trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/sample/SampleWSBase.java 2011-12-16 11:34:14 UTC (rev 37393)
@@ -16,7 +16,6 @@
import java.net.URL;
import java.text.MessageFormat;
import java.util.logging.Level;
-import java.util.logging.Logger;
import javax.xml.namespace.QName;
@@ -26,50 +25,29 @@
import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEditor;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
-import org.jboss.tools.ui.bot.ext.RequirementAwareSuite;
-import org.jboss.tools.ui.bot.ext.config.Annotations.Require;
-import org.jboss.tools.ui.bot.ext.config.Annotations.Server;
-import org.jboss.tools.ws.ui.bot.test.WSAllBotTests;
+import org.jboss.tools.ws.ui.bot.test.WSTestBase;
import org.jboss.tools.ws.ui.bot.test.uiutils.actions.NewSampleWSWizardAction;
import org.jboss.tools.ws.ui.bot.test.uiutils.actions.TreeItemAction;
import org.jboss.tools.ws.ui.bot.test.uiutils.wizards.SampleWSWizard;
import org.jboss.tools.ws.ui.bot.test.uiutils.wizards.SampleWSWizard.Type;
-import org.jboss.tools.ws.ui.bot.test.utils.WSClient;
-import org.jboss.tools.ws.ui.bot.test.wtp.WSTestBase;
+import org.jboss.tools.ws.ui.bot.test.wsclient.WSClient;
import org.junit.AfterClass;
-import org.junit.runner.RunWith;
-import org.junit.runners.Suite.SuiteClasses;
-@Require(server=@Server(),perspective="Java EE")
-(a)RunWith(RequirementAwareSuite.class)
-@SuiteClasses({ WSAllBotTests.class })
+/**
+ *
+ * @author jjankovi
+ *
+ */
public class SampleWSBase extends WSTestBase {
protected static final String SOAP_REQUEST = getSoapRequest("<ns1:sayHello xmlns:ns1=\"http://{0}/\"><arg0>{1}</arg0></ns1:sayHello>");
protected static final String SERVER_URL = "localhost:8080";
- protected static final Logger L = Logger.getLogger(SampleSoapWebServiceTest.class.getName());
@AfterClass
public static void clean() {
servers.removeAllProjectsFromServer();
- //projectExplorer.deleteAllProjects();
}
- @Override
- protected String getWsProjectName() {
- return null;
- }
-
- @Override
- protected String getWsPackage() {
- return null;
- }
-
- @Override
- protected String getWsName() {
- return null;
- }
-
protected void createDD(String project) {
SWTBotTree tree = projectExplorer.bot().tree();
SWTBotTreeItem ti = tree.expandNode(project);
@@ -107,7 +85,7 @@
assertEquals(svcClass + ".java", ed.getTitle());
String code = ed.toTextEditor().getText();
assertContains("package " + svcPkg + ";", code);
- String dd = readFile(getDD(project));
+ String dd = resourceHelper.readFile(getDD(project));
switch (type) {
case REST:
assertContains("@Path(\"/" + svcName + "\")", code);
@@ -120,17 +98,17 @@
assertContains("<servlet-name>" + svcName + "</servlet-name>", dd);
break;
}
- runProject(project);
+ deploymentHelper.runProject(project);
switch (type) {
case REST:
try {
URL u = new URL("http://" + SERVER_URL + "/" + project + "/" + svcName);
- String s = readStream(u.openConnection().getInputStream());
+ String s = resourceHelper.readStream(u.openConnection().getInputStream());
assertEquals(msgContent, s);
} catch (MalformedURLException e) {
- L.log(Level.WARNING, e.getMessage(), e);
+ LOGGER.log(Level.WARNING, e.getMessage(), e);
} catch (IOException e) {
- L.log(Level.WARNING, e.getMessage(), e);
+ LOGGER.log(Level.WARNING, e.getMessage(), e);
}
break;
case SOAP:
@@ -140,7 +118,7 @@
new QName("http://" + svcPkg + "/", svcClass + "Port"));
assertContains("Hello " + msgContent + "!", c.callService(MessageFormat.format(SOAP_REQUEST, svcPkg, msgContent)));
} catch (MalformedURLException e) {
- L.log(Level.WARNING, e.getMessage(), e);
+ LOGGER.log(Level.WARNING, e.getMessage(), e);
}
break;
}
Added: trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/utils/DeploymentHelper.java
===================================================================
--- trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/utils/DeploymentHelper.java (rev 0)
+++ trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/utils/DeploymentHelper.java 2011-12-16 11:34:14 UTC (rev 37393)
@@ -0,0 +1,179 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.ws.ui.bot.test.utils;
+
+import java.io.IOException;
+import java.net.HttpURLConnection;
+import java.net.MalformedURLException;
+import java.net.URL;
+import java.util.Scanner;
+import java.util.logging.Logger;
+
+import org.jboss.tools.ui.bot.ext.SWTTestExt;
+import org.jboss.tools.ui.bot.ext.gen.ActionItem;
+
+/**
+ *
+ * @author jjankovi
+ *
+ */
+public class DeploymentHelper extends SWTTestExt {
+
+ private final Logger LOGGER = Logger
+ .getLogger(DeploymentHelper.class.getName());
+
+ /**
+ *
+ * @param project
+ */
+ public void runProject(String project) {
+ open.viewOpen(ActionItem.View.ServerServers.LABEL);
+ projectExplorer.runOnServer(project);
+ }
+
+ /**
+ *
+ * @param wsdlURL
+ */
+ public void assertServiceDeployed(String wsdlURL) {
+ assertServiceDeployed(wsdlURL, 5000);
+ }
+
+ /**
+ *
+ * @param wsdlURL
+ * @param timeout
+ */
+ public void assertServiceDeployed(String wsdlURL, long timeout) {
+ long t = System.currentTimeMillis();
+ int rsp = -1;
+ while (t + timeout > System.currentTimeMillis()) {
+ HttpURLConnection connection = null;
+ try {
+ URL u = new URL(wsdlURL);
+ connection = (HttpURLConnection) u.openConnection();
+ rsp = connection.getResponseCode();
+ if (rsp == HttpURLConnection.HTTP_OK) {
+ break;
+ } else {
+ try {
+ Thread.sleep(1000);
+ } catch (InterruptedException e) {
+ // ignore
+ }
+ LOGGER.info("retrying...");
+ }
+ } catch (MalformedURLException e1) {
+ throw new RuntimeException(e1);
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ } finally {
+ if (connection != null) {
+ connection.disconnect();
+ }
+ }
+ }
+ LOGGER.info("done after: " + (System.currentTimeMillis() - t) + "ms.");
+ assertEquals("Service was not sucessfully deployed, WSDL '" + wsdlURL
+ + "' was not found", HttpURLConnection.HTTP_OK, rsp);
+ }
+
+ /**
+ *
+ * @param wsdlURL
+ */
+ public void assertServiceNotDeployed(String wsdlURL) {
+ HttpURLConnection connection = null;
+ try {
+ URL u = new URL(wsdlURL);
+ connection = (HttpURLConnection) u.openConnection();
+ assertEquals("Project was not sucessfully undeployed, WSDL '"
+ + wsdlURL + "' is still available",
+ HttpURLConnection.HTTP_NOT_FOUND,
+ connection.getResponseCode());
+ } catch (MalformedURLException e1) {
+ throw new RuntimeException(e1);
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ } finally {
+ if (connection != null) {
+ connection.disconnect();
+ }
+ }
+ }
+
+ /**
+ *
+ * @param startServlet
+ * @param response
+ */
+ public void assertServiceResponseToClient(String startServlet,
+ String response) {
+ assertContains(response, getPage(startServlet, 15000));
+ }
+
+ /**
+ *
+ * @param url
+ * @param timeout
+ * @return
+ */
+ public String getPage(String url, long timeout) {
+ long t = System.currentTimeMillis();
+ int rsp = -1;
+ String page = null;
+ while (t + timeout > System.currentTimeMillis()) {
+ HttpURLConnection connection = null;
+ try {
+ URL u = new URL(url);
+ connection = (HttpURLConnection) u.openConnection();
+ rsp = connection.getResponseCode();
+ if (rsp == HttpURLConnection.HTTP_OK) {
+ page = new Scanner(connection.getInputStream())
+ .useDelimiter("\\A").next();
+ break;
+ } else {
+ try {
+ Thread.sleep(1000);
+ } catch (InterruptedException e) {
+ // ignore
+ }
+ LOGGER.info("retrying...");
+ }
+ } catch (MalformedURLException e1) {
+ throw new RuntimeException(e1);
+ } catch (IOException e) {
+ throw new RuntimeException(e);
+ } finally {
+ if (connection != null) {
+ connection.disconnect();
+ }
+ }
+ }
+ LOGGER.info("done after: " + (System.currentTimeMillis() - t) + "ms.");
+ assertEquals("cannot connect to '" + url + "'",
+ HttpURLConnection.HTTP_OK, rsp);
+ return page;
+ }
+
+ /**
+ *
+ * @param projectName
+ * @param wsName
+ * @return
+ */
+ public String getWSDLUrl(String projectName, String wsName) {
+ return "http://localhost:8080/" + projectName + "/"
+ + wsName + "?wsdl";
+ }
+
+}
Added: trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/utils/ProjectHelper.java
===================================================================
--- trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/utils/ProjectHelper.java (rev 0)
+++ trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/utils/ProjectHelper.java 2011-12-16 11:34:14 UTC (rev 37393)
@@ -0,0 +1,100 @@
+/*******************************************************************************
+ * Copyright (c) 2010-2011 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.ws.ui.bot.test.utils;
+
+import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEditor;
+import org.eclipse.swtbot.swt.finder.SWTBot;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotCombo;
+import org.jboss.tools.ui.bot.ext.SWTTestExt;
+import org.jboss.tools.ui.bot.ext.gen.ActionItem.NewObject.JavaEEEnterpriseApplicationProject;
+import org.jboss.tools.ui.bot.ext.gen.ActionItem.NewObject.WebServicesWSDL;
+import org.jboss.tools.ui.bot.ext.types.IDELabel;
+import org.jboss.tools.ws.ui.bot.test.uiutils.actions.NewFileWizardAction;
+import org.jboss.tools.ws.ui.bot.test.uiutils.wizards.DynamicWebProjectWizard;
+import org.jboss.tools.ws.ui.bot.test.uiutils.wizards.Wizard;
+
+/**
+ *
+ * @author jjankovi
+ *
+ */
+public class ProjectHelper extends SWTTestExt {
+
+ /**
+ *
+ * @param projectName
+ * @param pkg
+ * @param cName
+ * @return
+ */
+ public SWTBotEditor createClass(String projectName, String pkg, String cName) {
+ new NewFileWizardAction().run().selectTemplate("Java", "Class").next();
+ Wizard w = new Wizard();
+ w.bot().textWithLabel("Package:").setText(pkg);
+ w.bot().textWithLabel("Name:").setText(cName);
+ w.bot().textWithLabel("Source folder:")
+ .setText(projectName + "/src");
+ w.finish();
+ bot.sleep(4500);
+ return bot.editorByTitle(cName + ".java");
+ }
+
+ /**
+ *
+ * @param projectName
+ * @param s
+ * @return
+ */
+ public SWTBotEditor createWsdl(String projectName, String s) {
+ SWTBot wiz1 = open.newObject(WebServicesWSDL.LABEL);
+ wiz1.textWithLabel(WebServicesWSDL.TEXT_FILE_NAME).setText(s + ".wsdl");
+ wiz1.textWithLabel(
+ WebServicesWSDL.TEXT_ENTER_OR_SELECT_THE_PARENT_FOLDER)
+ .setText(projectName + "/src");
+ wiz1.button(IDELabel.Button.NEXT).click();
+ open.finish(wiz1);
+ return bot.editorByTitle(s + ".wsdl");
+ }
+
+ /**
+ *
+ * @param name
+ */
+ public void createProject(String name) {
+ new NewFileWizardAction().run()
+ .selectTemplate("Web", "Dynamic Web Project").next();
+ new DynamicWebProjectWizard().setProjectName(name).finish();
+ util.waitForNonIgnoredJobs();
+ assertTrue(projectExplorer.existsResource(name));
+ projectExplorer.selectProject(name);
+ }
+
+ /**
+ *
+ * @param name
+ */
+ public void createEARProject(String name) {
+ SWTBot wiz = open.newObject(JavaEEEnterpriseApplicationProject.LABEL);
+ wiz.textWithLabel(JavaEEEnterpriseApplicationProject.TEXT_PROJECT_NAME)
+ .setText(name);
+ // set EAR version
+ SWTBotCombo combo = wiz.comboBox(1);
+ combo.setSelection(combo.itemCount() - 1);
+ wiz.button(IDELabel.Button.NEXT).click();
+ wiz.checkBox("Generate application.xml deployment descriptor").click();
+ open.finish(wiz);
+ bot.sleep(5000);
+ assertTrue(projectExplorer.existsResource(name));
+ projectExplorer.selectProject(name);
+ }
+
+}
Added: trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/utils/ResourceHelper.java
===================================================================
--- trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/utils/ResourceHelper.java (rev 0)
+++ trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/utils/ResourceHelper.java 2011-12-16 11:34:14 UTC (rev 37393)
@@ -0,0 +1,84 @@
+/*******************************************************************************
+ * Copyright (c) 2010-2011 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.ws.ui.bot.test.utils;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Scanner;
+
+import org.eclipse.core.resources.IFile;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEclipseEditor;
+import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEditor;
+
+/**
+ *
+ * @author jjankovi
+ *
+ */
+public class ResourceHelper {
+
+ /**
+ *
+ * @param is
+ * @return
+ */
+ public String readStream(InputStream is) {
+ // we don't care about performance in tests too much, so this should be
+ // OK
+ return new Scanner(is).useDelimiter("\\A").next();
+ }
+
+ /**
+ *
+ * @param f
+ * @return
+ */
+ public String readFile(IFile f) {
+ String content = null;
+ InputStream is = null;
+ try {
+ is = f.getContents();
+ content = readStream(is);
+ } catch (CoreException e) {
+ e.printStackTrace();
+ throw new RuntimeException(e);
+ } finally {
+ if (is != null) {
+ try {
+ is.close();
+ } catch (IOException e) {
+ // ignore
+ }
+ }
+ }
+ return content;
+ }
+
+ /**
+ *
+ * @param classEdit
+ * @param resource
+ * @param closeEdit
+ */
+ public void copyResourceToClass(SWTBotEditor classEdit,
+ InputStream resource, boolean closeEdit) {
+ SWTBotEclipseEditor st = classEdit.toTextEditor();
+ st.selectRange(0, 0, st.getText().length());
+ String code = readStream(resource);
+ st.setText(code);
+ classEdit.save();
+ if (closeEdit) classEdit.close();
+ }
+
+
+}
Deleted: trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/utils/WSClient.java
===================================================================
--- trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/utils/WSClient.java 2011-12-16 08:34:19 UTC (rev 37392)
+++ trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/utils/WSClient.java 2011-12-16 11:34:14 UTC (rev 37393)
@@ -1,76 +0,0 @@
-/*******************************************************************************
- * Copyright (c) 2010 Red Hat, Inc.
- * Distributed under license by Red Hat, Inc. All rights reserved.
- * This program is made available under the terms of the
- * Eclipse Public License v1.0 which accompanies this distribution,
- * and is available at http://www.eclipse.org/legal/epl-v10.html
- *
- * Contributors:
- * Red Hat, Inc. - initial API and implementation
- ******************************************************************************/
-package org.jboss.tools.ws.ui.bot.test.utils;
-
-import java.io.ByteArrayInputStream;
-import java.io.ByteArrayOutputStream;
-import java.io.IOException;
-import java.net.URL;
-import java.util.logging.Level;
-import java.util.logging.Logger;
-
-import javax.xml.namespace.QName;
-import javax.xml.soap.MessageFactory;
-import javax.xml.soap.SOAPException;
-import javax.xml.soap.SOAPMessage;
-import javax.xml.ws.Dispatch;
-import javax.xml.ws.Service;
-import javax.xml.ws.Service.Mode;
-
-public class WSClient {
-
- private static final Logger L = Logger.getLogger(WSClient.class.getName());
- private Dispatch<SOAPMessage> d;
-
- public WSClient(URL location, QName serviceName, QName portName) {
- Service s = Service.create(location, serviceName);
- d = s.createDispatch(portName, SOAPMessage.class, Mode.MESSAGE);
- }
-
- public String callService(String message) {
- SOAPMessage result = null;
- try {
- SOAPMessage msg = MessageFactory.newInstance().createMessage( null, new ByteArrayInputStream(message.getBytes()));
- msg.saveChanges();
- result = d.invoke(msg);
- } catch (SOAPException e) {
- L.log(Level.WARNING, e.getMessage(), e);
- } catch (IOException e) {
- L.log(Level.WARNING, e.getMessage(), e);
- }
- String s = msgToString(result);
- L.fine("SOAP Request :\n" + message);
- L.fine("SOAP Response:\n" + s);
- return s;
- }
-
- private String msgToString(SOAPMessage msg) {
- if (msg == null) {
- return "";
- }
- ByteArrayOutputStream out = new ByteArrayOutputStream();
- try {
- msg.writeTo(out);
- } catch (SOAPException e) {
- L.log(Level.WARNING, e.getMessage(), e);
- } catch (IOException e) {
- L.log(Level.WARNING, e.getMessage(), e);
- } finally {
- try {
- out.close();
- } catch (IOException e) {
- //ignore
- L.log(Level.WARNING, e.getMessage(), e);
- }
- }
- return out.toString();
- }
-}
Added: trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/utils/WebServiceClientHelper.java
===================================================================
--- trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/utils/WebServiceClientHelper.java (rev 0)
+++ trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/utils/WebServiceClientHelper.java 2011-12-16 11:34:14 UTC (rev 37393)
@@ -0,0 +1,56 @@
+package org.jboss.tools.ws.ui.bot.test.utils;
+
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
+import org.jboss.tools.ui.bot.ext.SWTTestExt;
+import org.jboss.tools.ws.ui.bot.test.uiutils.actions.NewFileWizardAction;
+import org.jboss.tools.ws.ui.bot.test.uiutils.wizards.WebServiceClientWizard;
+import org.jboss.tools.ws.ui.bot.test.uiutils.wizards.WsWizardBase.Slider_Level;
+import org.junit.Assert;
+
+/**
+ *
+ * @author jjankovi
+ *
+ */
+public class WebServiceClientHelper extends SWTTestExt {
+
+ /**
+ *
+ * @param wsdl
+ * @param targetProject
+ * @param level
+ * @param pkg
+ */
+ public void createClient(String wsdl, String targetProject,
+ Slider_Level level, String pkg) {
+ new NewFileWizardAction().run()
+ .selectTemplate("Web Services", "Web Service Client").next();
+ WebServiceClientWizard w = new WebServiceClientWizard();
+ w.setSource(wsdl);
+ util.waitForNonIgnoredJobs();
+ bot.sleep(1000);
+ w.setSlider(level, 0);
+ w.setServerRuntime(configuredState.getServer().name);
+ w.setWebServiceRuntime("JBossWS");
+ w.setClientProject(targetProject);
+ if (pkg != null && !"".equals(pkg.trim())) {
+ w.next();
+ w.setPackageName(pkg);
+ }
+ w.finish();
+ util.waitForNonIgnoredJobs();
+ bot.sleep(1000);
+
+ // let's fail if there's some error in the wizard,
+ // and close error dialog and the wizard so other tests
+ // can continue
+ if (bot.activeShell().getText().contains("Error")) {
+ SWTBotShell sh = bot.activeShell();
+ String msg = sh.bot().text().getText();
+ sh.bot().button(0).click();
+ w.cancel();
+ Assert.fail(msg);
+ }
+ }
+
+}
Added: trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/webservice/BottomUpWSTest.java
===================================================================
--- trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/webservice/BottomUpWSTest.java (rev 0)
+++ trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/webservice/BottomUpWSTest.java 2011-12-16 11:34:14 UTC (rev 37393)
@@ -0,0 +1,105 @@
+/*******************************************************************************
+ * Copyright (c) 2010-2011 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.ws.ui.bot.test.webservice;
+
+import org.jboss.tools.ws.ui.bot.test.uiutils.wizards.WsWizardBase.Slider_Level;
+import org.junit.Test;
+
+/**
+ *
+ * @author jjankovi
+ *
+ */
+public class BottomUpWSTest extends WebServiceTestBase {
+
+ //http://localhost:8080/BottomUpWS/ClassA?wsdl
+ /*
+ <soap:Body>
+<method xmlns = "http://jbossws/">
+</method>
+</soap:Body>
+
+<soap:Body>
+<ns2:methodResponse xmlns:ns2="http://jbossws/">
+<return>1234567890</return>
+</ns2:methodResponse>
+</soap:Body>
+ */
+
+ @Override
+ protected String getWsPackage() {
+ return "jbossws." + getLevel().toString().toLowerCase();
+ }
+
+ @Override
+ protected String getWsName() {
+ return "JavaWs_" + getLevel();
+ }
+
+ protected String getWsProjectName() {
+ return "BottomUpWS-web";
+ }
+
+ @Override
+ protected String getEarProjectName() {
+ return "BottomUpWS-ear";
+ }
+
+ @Test
+ public void testDeployService() {
+ setLevel(Slider_Level.DEPLOY);
+ bottomUpJbossWebService();
+ }
+
+ @Test
+ public void testAssembleService() {
+ setLevel(Slider_Level.ASSEMBLE);
+ bottomUpJbossWebService();
+ }
+
+ @Test
+ public void testDevelopService() {
+ setLevel(Slider_Level.DEVELOP);
+ bottomUpJbossWebService();
+ }
+
+ @Test
+ public void testInstallService() {
+ setLevel(Slider_Level.INSTALL);
+ bottomUpJbossWebService();
+ }
+
+ @Test
+ public void testStartService() {
+ setLevel(Slider_Level.START);
+ bottomUpJbossWebService();
+ }
+
+ @Test
+ public void testTestService() {
+ setLevel(Slider_Level.TEST);
+ bottomUpJbossWebService();
+ }
+
+ protected void bottomUpJbossWebService() {
+ bottomUpJbossWebService(BottomUpWSTest.class.getResourceAsStream("/resources/jbossws/ClassA.java.ws"));
+ switch (getLevel()) {
+ case DEVELOP:
+ case ASSEMBLE:
+ case DEPLOY:
+ deploymentHelper.runProject(getEarProjectName());
+ break;
+ }
+ deploymentHelper.assertServiceDeployed(deploymentHelper.getWSDLUrl(getWsProjectName(), getWsName()), 10000);
+// checkService(getWSDLUrl(svcName.substring(svcName.lastIndexOf(".") + 1)), QName service, QName port, String msg, String rsp)
+// servers.removeAllProjectsFromServer(configuredState.getServer().name);
+ }
+}
Added: trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/webservice/TopDownWSTest.java
===================================================================
--- trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/webservice/TopDownWSTest.java (rev 0)
+++ trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/webservice/TopDownWSTest.java 2011-12-16 11:34:14 UTC (rev 37393)
@@ -0,0 +1,116 @@
+/*******************************************************************************
+ * Copyright (c) 2010-2011 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.ws.ui.bot.test.webservice;
+
+import org.jboss.tools.ws.ui.bot.test.uiutils.wizards.WsWizardBase.Slider_Level;
+import org.junit.Ignore;
+import org.junit.Test;
+
+/**
+ *
+ * @author jjankovi
+ *
+ */
+public class TopDownWSTest extends WebServiceTestBase {
+
+ @Override
+ protected String getEarProjectName() {
+ return "TopDownWS-ear";
+ }
+
+ @Override
+ protected String getWsPackage() {
+ return "jbossws.td." + getLevel().toString().toLowerCase();
+ }
+
+ @Override
+ protected String getWsName() {
+ return "WsdlWs" + getLevel();
+ }
+
+ @Override
+ protected String getWsProjectName() {
+ return "TopDownWS-web";
+ }
+
+ //http://localhost:8080/TopDownJbossWS/jbossws.ClassB?wsdl
+ /*
+<soap:Body>
+<method xmlns = "http://jbossws/">
+</method>
+</soap:Body>
+
+<soap:Body>
+<ns2:methodResponse xmlns:ns2="http://jbossws/">
+<return>0</return>
+</ns2:methodResponse>
+</soap:Body>
+ */
+
+ @Test
+ public void testDeployService() {
+ setLevel(Slider_Level.DEPLOY);
+ topDownWS();
+ }
+
+ @Test
+ public void testDevelopService() {
+ setLevel(Slider_Level.DEVELOP);
+ topDownWS();
+ }
+ @Ignore
+ @Test
+ public void testAssembleService() {
+ setLevel(Slider_Level.ASSEMBLE);
+ topDownWS();
+ }
+
+ @Test
+ public void testInstallService() {
+ setLevel(Slider_Level.INSTALL);
+ topDownWS();
+ }
+
+ @Test
+ public void testStartService() {
+ setLevel(Slider_Level.START);
+ topDownWS();
+ }
+
+ @Test
+ public void testTestService() {
+ setLevel(Slider_Level.TEST);
+ topDownWS();
+ }
+
+ @Test
+ public void testDefaultPkg() {
+ setLevel(Slider_Level.ASSEMBLE);
+ topDownWS(null);
+ }
+
+ private void topDownWS() {
+ topDownWS("ws." + getWsName().toLowerCase());
+ }
+
+ protected void topDownWS(String pkg) {
+ topDownWS(TopDownWSTest.class.getResourceAsStream("/resources/jbossws/ClassB.wsdl"), pkg);
+ switch (getLevel()) {
+ case DEVELOP:
+ case ASSEMBLE:
+ case DEPLOY:
+ deploymentHelper.runProject(getEarProjectName());
+ break;
+ }
+ deploymentHelper.assertServiceDeployed(deploymentHelper.getWSDLUrl(getWsProjectName(), getWsName()), 10000);
+ servers.removeAllProjectsFromServer(configuredState.getServer().name);
+ }
+}
Added: trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/webservice/WebServiceTestBase.java
===================================================================
--- trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/webservice/WebServiceTestBase.java (rev 0)
+++ trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/webservice/WebServiceTestBase.java 2011-12-16 11:34:14 UTC (rev 37393)
@@ -0,0 +1,140 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.ws.ui.bot.test.webservice;
+
+import java.io.InputStream;
+import java.text.MessageFormat;
+import java.util.logging.Level;
+
+import org.eclipse.core.resources.IWorkspaceRoot;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.eclipse.core.runtime.CoreException;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEclipseEditor;
+import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEditor;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
+import org.jboss.tools.ws.ui.bot.test.WSTestBase;
+import org.jboss.tools.ws.ui.bot.test.uiutils.actions.NewFileWizardAction;
+import org.jboss.tools.ws.ui.bot.test.uiutils.wizards.WebServiceWizard;
+import org.jboss.tools.ws.ui.bot.test.uiutils.wizards.WebServiceWizard.Service_Type;
+import org.jboss.tools.ws.ui.bot.test.uiutils.wizards.WsWizardBase.Slider_Level;
+import org.junit.Assert;
+
+/**
+ *
+ * @author jjankovi
+ *
+ */
+public class WebServiceTestBase extends WSTestBase {
+
+ /**
+ *
+ * @param javasrc
+ */
+ protected void bottomUpJbossWebService(InputStream javasrc) {
+ String s = resourceHelper.readStream(javasrc);
+ String src = MessageFormat.format(s, getWsPackage(), getWsName());
+ createService(Service_Type.BOTTOM_UP, getWsPackage() + "."
+ + getWsName(), getLevel(), null, src);
+ }
+
+ /**
+ *
+ * @param input
+ * @param pkg
+ */
+ protected void topDownWS(InputStream input, String pkg) {
+ String s = resourceHelper.readStream(input);
+ String[] tns = getWsPackage().split("\\.");
+ StringBuilder sb = new StringBuilder();
+ for (int i = tns.length - 1; i > 0; i--) {
+ sb.append(tns[i]);
+ sb.append(".");
+ }
+ sb.append(tns[0]);
+ String src = MessageFormat.format(s, sb.toString(), getWsName());
+ createService(Service_Type.TOP_DOWN, "/" + getWsProjectName() + "/src/"
+ + getWsName() + ".wsdl", getLevel(), pkg, src);
+ }
+
+ /**
+ *
+ * @param t
+ * @param source
+ * @param level
+ * @param pkg
+ * @param code
+ */
+ private void createService(Service_Type t, String source,
+ Slider_Level level, String pkg, String code) {
+ // create ws source - java class or wsdl
+ SWTBotEditor ed = null;
+ switch (t) {
+ case BOTTOM_UP:
+ ed = projectHelper.createClass(getWsProjectName(), getWsPackage(), getWsName());
+ break;
+ case TOP_DOWN:
+ ed = projectHelper.createWsdl(getWsProjectName(),getWsName());
+ break;
+ }
+ assertNotNull(ed);
+ // replace default content of java class w/ code
+ SWTBotEclipseEditor st = ed.toTextEditor();
+ st.selectRange(0, 0, st.getText().length());
+ st.setText(code);
+ ed.saveAndClose();
+ // refresh workspace - workaround for JBIDE-6731
+ try {
+ ResourcesPlugin
+ .getWorkspace()
+ .getRoot()
+ .refreshLocal(IWorkspaceRoot.DEPTH_INFINITE,
+ new NullProgressMonitor());
+ } catch (CoreException e) {
+ LOGGER.log(Level.WARNING, e.getMessage(), e);
+ }
+ bot.sleep(500);
+ // create a web service
+ new NewFileWizardAction().run()
+ .selectTemplate("Web Services", "Web Service").next();
+ WebServiceWizard wsw = new WebServiceWizard();
+ wsw.setServiceType(t);
+ wsw.setSource(source);
+ wsw.setServerRuntime(configuredState.getServer().name);
+ wsw.setWebServiceRuntime("JBossWS");
+ wsw.setServiceProject(getWsProjectName());
+ wsw.setServiceEARProject(getEarProjectName());
+ wsw.setServiceSlider(level);
+ if (wsw.isClientEnabled()) {
+ wsw.setClientSlider(Slider_Level.NO_CLIENT);
+ }
+ if (pkg != null && pkg.trim().length() > 0) {
+ wsw.next();
+ wsw.setPackageName(pkg);
+ }
+ wsw.finish();
+ util.waitForNonIgnoredJobs();
+ bot.sleep(2*TIME_1S);
+
+ // let's fail if there's some error in the wizard,
+ // and close error dialog and the wizard so other tests
+ // can continue
+ if (bot.activeShell().getText().contains("Error")) {
+ SWTBotShell sh = bot.activeShell();
+ String msg = sh.bot().text().getText();
+ sh.bot().button(0).click();
+ wsw.cancel();
+ Assert.fail(msg);
+ }
+ }
+
+}
Added: trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/webservice/eap/EAPCompAllTests.java
===================================================================
--- trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/webservice/eap/EAPCompAllTests.java (rev 0)
+++ trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/webservice/eap/EAPCompAllTests.java 2011-12-16 11:34:14 UTC (rev 37393)
@@ -0,0 +1,29 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.ws.ui.bot.test.webservice.eap;
+
+import org.jboss.tools.ui.bot.ext.RequirementAwareSuite;
+import org.junit.runner.RunWith;
+import org.junit.runners.Suite.SuiteClasses;
+
+/**
+ * Documentation/description is available at <a href="https://docspace.corp.redhat.com/docs/DOC-43675">Docspace</a>}
+ *
+ * @author jlukas, jjankovi
+ * @see <a href="https://docspace.corp.redhat.com/docs/DOC-43675">DOC-43675</a>
+ */
+@SuiteClasses({
+ EAPFromJavaTest.class,
+ EAPFromWSDLTest.class
+})
+(a)RunWith(RequirementAwareSuite.class)
+public class EAPCompAllTests {
+}
Added: trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/webservice/eap/EAPFromJavaTest.java
===================================================================
--- trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/webservice/eap/EAPFromJavaTest.java (rev 0)
+++ trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/webservice/eap/EAPFromJavaTest.java 2011-12-16 11:34:14 UTC (rev 37393)
@@ -0,0 +1,158 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.ws.ui.bot.test.webservice.eap;
+
+import java.util.logging.Level;
+
+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.core.runtime.CoreException;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotEclipseEditor;
+import org.jboss.tools.ws.ui.bot.test.WSAllBotTests;
+import org.jboss.tools.ws.ui.bot.test.uiutils.actions.NewFileWizardAction;
+import org.jboss.tools.ws.ui.bot.test.uiutils.wizards.Wizard;
+import org.jboss.tools.ws.ui.bot.test.uiutils.wizards.WsWizardBase.Slider_Level;
+import org.jboss.tools.ws.ui.bot.test.webservice.WebServiceTestBase;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runners.Suite.SuiteClasses;
+
+/**
+ *
+ * @author jjankovi
+ *
+ */
+@SuiteClasses({ WSAllBotTests.class, EAPCompAllTests.class })
+public class EAPFromJavaTest extends WebServiceTestBase {
+
+ private static boolean servicePassed = false;
+
+ @Before
+ @Override
+ public void setup() {
+ if (!projectExists(getWsProjectName())) {
+ projectHelper.createProject(getWsProjectName());
+ }
+ if (!projectExists(getWsClientProjectName())) {
+ projectHelper.createProject(getWsClientProjectName());
+ }
+ }
+
+ @After
+ @Override
+ public void cleanup() {
+ //do nothing here
+ //we don't want to undeploy our app yet
+ }
+
+ @AfterClass
+ public static void removeAllProjects() {
+ servers.removeAllProjectsFromServer();
+ }
+
+ @Override
+ protected String getWsProjectName() {
+ return "TestWSProject";
+ }
+
+ @Override
+ protected String getEarProjectName() {
+ return getWsProjectName() + "EAR";
+ }
+
+ protected String getWsClientProjectName() {
+ return "TestWSClientProject";
+ }
+
+ @Override
+ protected String getWsPackage() {
+ return "test.ws";
+ }
+
+ @Override
+ protected String getWsName() {
+ return "Echo";
+ }
+
+ @Override
+ protected Slider_Level getLevel() {
+ return Slider_Level.DEPLOY;
+ }
+
+ @Test
+ public void testService() {
+ //create a class representing some complex type
+ SWTBotEclipseEditor st = projectHelper.createClass(getWsProjectName(), "test", "Person").toTextEditor();
+ st.selectRange(0, 0, st.getText().length());
+ st.setText(resourceHelper.readStream(EAPFromJavaTest.class.getResourceAsStream("/resources/jbossws/Person.java.ws")));
+ st.saveAndClose();
+ //refresh workspace - workaround??? for JBIDE-6731
+ try {
+ ResourcesPlugin.getWorkspace().getRoot().refreshLocal(IWorkspaceRoot.DEPTH_INFINITE, new NullProgressMonitor());
+ } catch (CoreException e) {
+ LOGGER.log(Level.WARNING, e.getMessage(), e);
+ }
+ bot.sleep(TIME_500MS);
+ bottomUpJbossWebService(EAPFromJavaTest.class.getResourceAsStream("/resources/jbossws/Echo.java.ws"));
+ IProject project = ResourcesPlugin.getWorkspace().getRoot().getProject(getWsProjectName());
+ IFile f = project.getFile("WebContent/WEB-INF/web.xml");
+ String content = resourceHelper.readFile(f);
+ Assert.assertNotNull(content);
+ Assert.assertTrue(content.contains("<servlet-class>test.ws.Echo</servlet-class>"));
+ Assert.assertTrue(content.contains("<url-pattern>/Echo</url-pattern>"));
+ deploymentHelper.runProject(getEarProjectName());
+ deploymentHelper.assertServiceDeployed(deploymentHelper.getWSDLUrl(getWsProjectName(), getWsName()), 10000);
+ servicePassed = true;
+ }
+
+ @Test
+ public void testClient() {
+ Assert.assertTrue("service must exist", servicePassed);
+ clientHelper.createClient(deploymentHelper.getWSDLUrl(getWsProjectName(), getWsName()),
+ getWsClientProjectName(), getLevel(), "");
+ IProject p = ResourcesPlugin.getWorkspace().getRoot().getProject(getWsClientProjectName());
+ String pkg = "test/ws";
+ String cls = "src/" + pkg + "/EchoService.java";
+ Assert.assertTrue(p.getFile(cls).exists());
+ cls = "src/" + pkg + "/clientsample/ClientSample.java";
+ Assert.assertTrue(p.getFile(cls).exists());
+ //create JSP
+ new NewFileWizardAction().run().selectTemplate("Web", "JSP File").next();
+ Wizard w = new Wizard();
+ w.bot().textWithLabel("File name:").setText("index");
+ w.bot().textWithLabel("Enter or select the parent folder:").setText(getWsClientProjectName() + "/WebContent");
+ w.finish();
+ bot.sleep(TIME_5S);
+ /**
+ * Workaround for 4.x branch
+ *
+ * bot.activeShell().bot().button("Skip").click();
+ * bot.sleep(TIME_5S);
+ */
+ SWTBotEclipseEditor st = bot.editorByTitle("index.jsp").toTextEditor();
+ st.selectRange(0, 0, st.getText().length());
+ st.setText(resourceHelper.readStream(EAPFromJavaTest.class.getResourceAsStream("/resources/jbossws/index.jsp.ws")));
+ st.saveAndClose();
+ bot.sleep(TIME_1S*2);
+ deploymentHelper.runProject(getWsClientProjectName());
+ String pageContent = deploymentHelper.getPage("http://localhost:8080/" + getWsClientProjectName() + "/index.jsp", 15000);
+ LOGGER.info(pageContent);
+ Assert.assertTrue(pageContent.contains("BartSimpson(age: 12)"));
+ Assert.assertTrue(pageContent.contains("Homer(age: 44)"));
+ }
+}
Added: trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/webservice/eap/EAPFromWSDLTest.java
===================================================================
--- trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/webservice/eap/EAPFromWSDLTest.java (rev 0)
+++ trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/webservice/eap/EAPFromWSDLTest.java 2011-12-16 11:34:14 UTC (rev 37393)
@@ -0,0 +1,267 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+
+package org.jboss.tools.ws.ui.bot.test.webservice.eap;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.logging.Level;
+
+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.core.runtime.CoreException;
+import org.eclipse.core.runtime.NullProgressMonitor;
+import org.eclipse.swtbot.swt.finder.finders.UIThreadRunnable;
+import org.eclipse.swtbot.swt.finder.results.Result;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotMenu;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTree;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotTreeItem;
+import org.jboss.tools.ui.bot.ext.SWTBotExt;
+import org.jboss.tools.ui.bot.ext.SWTUtilExt;
+import org.jboss.tools.ui.bot.ext.Timing;
+import org.jboss.tools.ui.bot.ext.helper.ContextMenuHelper;
+import org.jboss.tools.ws.ui.bot.test.WSAllBotTests;
+import org.jboss.tools.ws.ui.bot.test.uiutils.wizards.WsWizardBase.Slider_Level;
+import org.jboss.tools.ws.ui.bot.test.webservice.TopDownWSTest;
+import org.jboss.tools.ws.ui.bot.test.webservice.WebServiceTestBase;
+import org.junit.After;
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+import org.junit.runners.Suite.SuiteClasses;
+
+/**
+ *
+ * @author jjankovi
+ *
+ */
+@SuiteClasses({ WSAllBotTests.class, EAPCompAllTests.class })
+public class EAPFromWSDLTest extends WebServiceTestBase {
+
+ private static boolean servicePassed = false;
+
+ @Before
+ @Override
+ public void setup() {
+ if (!projectExists(getWsProjectName())) {
+ projectHelper.createProject(getWsProjectName());
+ }
+ if (!projectExists(getWsClientProjectName())) {
+ projectHelper.createProject(getWsClientProjectName());
+ }
+ }
+
+ @After
+ @Override
+ public void cleanup() {
+ LOGGER.info("overridden");
+ }
+
+ @AfterClass
+ public static void x() {
+ LOGGER.info("x");
+ servers.removeAllProjectsFromServer();
+ }
+
+ @Override
+ protected String getWsProjectName() {
+ return "AreaWSProject";
+ }
+
+ @Override
+ protected String getEarProjectName() {
+ return getWsProjectName() + "EAR";
+ }
+
+ protected String getWsClientProjectName() {
+ return "AreaWSClientProject";
+ }
+
+ protected String getClientEarProjectName() {
+ return getWsClientProjectName() + "EAR";
+ }
+
+ @Override
+ protected String getWsPackage() {
+ return "org.jboss.ws";
+ }
+
+ @Override
+ protected String getWsName() {
+ return "AreaService";
+ }
+
+ @Override
+ protected Slider_Level getLevel() {
+ return Slider_Level.DEPLOY;
+ }
+
+ @Test
+ public void testService() {
+ topDownWS(TopDownWSTest.class.getResourceAsStream("/resources/jbossws/AreaService.wsdl"),
+ getWsPackage());
+
+ IProject project = ResourcesPlugin.getWorkspace().getRoot()
+ .getProject(getWsProjectName());
+ IFile f = project.getFile("src/" + getWsPackage().replace(".", "/")
+ + "/AreaServiceImpl.java");
+ /*
+ * workaround when package is not typed
+ */
+ if (f == null) {
+ f = project.getFile("src/" + "org.tempuri.areaservice"
+ + "/AreaServiceImpl.java");
+ }
+ String content = resourceHelper.readFile(f);
+ Assert.assertNotNull(content);
+ Assert.assertTrue(content
+ .contains("public class AreaServiceImpl implements AreaService {"));
+ Assert.assertTrue(content
+ .contains("public float calculateRectArea(Dimensions parameters)"));
+ replaceContent(f, "/resources/jbossws/AreaWS.java.ws");
+
+ f = project.getFile("WebContent/WEB-INF/web.xml");
+ content = resourceHelper.readFile(f);
+ Assert.assertNotNull(content);
+ Assert.assertTrue(content
+ .contains("<servlet-class>org.jboss.ws.AreaServiceImpl</servlet-class>"));
+ Assert.assertTrue(content
+ .contains("<url-pattern>/AreaService</url-pattern>"));
+ deploymentHelper.runProject(getEarProjectName());
+ deploymentHelper.assertServiceDeployed(deploymentHelper.getWSDLUrl(getWsProjectName(), getWsName()), 10000);
+ servicePassed = true;
+ }
+
+ @Test
+ public void testClient() {
+ Assert.assertTrue("service must exist", servicePassed);
+ clientHelper.createClient(deploymentHelper.getWSDLUrl(getWsProjectName(), getWsName()),
+ getWsClientProjectName(), Slider_Level.DEVELOP, "org.jboss.wsclient");
+ IProject p = ResourcesPlugin.getWorkspace().getRoot()
+ .getProject(getWsClientProjectName());
+ String pkg = "org/jboss/wsclient";
+ String cls = "src/" + pkg + "/AreaService.java";
+ Assert.assertTrue(p.getFile(cls).exists());
+ cls = "src/" + pkg + "/clientsample/ClientSample.java";
+ IFile f = p.getFile(cls);
+ Assert.assertTrue(f.exists());
+ replaceContent(f, "/resources/jbossws/clientsample.java.ws");
+
+ /*
+ * workaround for https://issues.jboss.org/browse/JBIDE-9817
+ */
+ projectExplorer.selectProject(getWsClientProjectName());
+ SWTBotTree tree = projectExplorer.bot().tree();
+ SWTBotTreeItem item = tree.getTreeItem(getWsClientProjectName());
+ item.expand();
+ removeRuntimeLibrary(tree, item, bot, util);
+
+ eclipse.runJavaApplication(getWsClientProjectName(),
+ "org.jboss.wsclient.clientsample.ClientSample", null);
+ util.waitForNonIgnoredJobs();
+ bot.sleep(15 * TIME_1S);
+ String output = console.getConsoleText();
+ LOGGER.info(output);
+ Assert.assertTrue(output, output.contains("Server said: 37.5"));
+ Assert.assertTrue(output.contains("Server said: 3512.3699"));
+ }
+
+ private void replaceContent(IFile f, String content) {
+ try {
+ f.delete(true, new NullProgressMonitor());
+ } catch (CoreException ce) {
+ LOGGER.log(Level.WARNING, ce.getMessage(), ce);
+ }
+ InputStream is = null;
+ try {
+ is = EAPFromWSDLTest.class.getResourceAsStream(content);
+ f.create(is, true, new NullProgressMonitor());
+ } catch (CoreException ce) {
+ LOGGER.log(Level.WARNING, ce.getMessage(), ce);
+ } finally {
+ if (is != null) {
+ try {
+ is.close();
+ } catch (IOException ioe) {
+ // ignore
+ }
+ }
+ }
+ try {
+ ResourcesPlugin
+ .getWorkspace()
+ .getRoot()
+ .refreshLocal(IWorkspaceRoot.DEPTH_INFINITE,
+ new NullProgressMonitor());
+ } catch (CoreException e) {
+ LOGGER.log(Level.WARNING, e.getMessage(), e);
+ }
+ util.waitForNonIgnoredJobs();
+ bot.sleep(TIME_1S);
+ }
+
+ private void removeRuntimeLibrary(final SWTBotTree tree,
+ SWTBotTreeItem item, SWTBotExt bot, SWTUtilExt util) {
+ nodeContextMenu(tree, item, "Build Path", "Configure Build Path...")
+ .click();
+ bot.activeShell().activate();
+ bot.tabItem("Libraries").activate();
+ assertTrue(!bot.button("Remove").isEnabled());
+ try {
+ findSelectEnterpriseRuntimeLibrary(bot);
+ assertTrue(bot.button("Remove").isEnabled());
+ bot.button("Remove").click();
+ bot.button("OK").click();
+ bot.sleep(Timing.time2S());
+ util.waitForNonIgnoredJobs();
+ } catch (Exception e) {
+ e.printStackTrace();
+ bot.button("Cancel").click();
+ }
+
+ }
+
+ private void findSelectEnterpriseRuntimeLibrary(SWTBotExt bot)
+ throws Exception {
+ SWTBotTree libraryTree = bot.tree(1);
+ boolean libraryFound = false;
+ for (SWTBotTreeItem libraryItem : libraryTree.getAllItems()) {
+ if (libraryItem.getText().contains(
+ "JBoss Enterprise Application Platform")) {
+ libraryTree.select(libraryItem);
+ libraryFound = true;
+ break;
+ }
+ }
+ if (!libraryFound)
+ throw new RuntimeException("No runtime library has been found");
+ }
+
+ private SWTBotMenu nodeContextMenu(final SWTBotTree tree,
+ SWTBotTreeItem item, final String... menu) {
+ assert menu.length > 0;
+ ContextMenuHelper.prepareTreeItemForContextMenu(tree, item);
+ return UIThreadRunnable.syncExec(new Result<SWTBotMenu>() {
+
+ public SWTBotMenu run() {
+ SWTBotMenu m = new SWTBotMenu(ContextMenuHelper.getContextMenu(
+ tree, menu[0], false));
+ for (int i = 1; i < menu.length; i++) {
+ m = m.menu(menu[i]);
+ }
+ return m;
+ }
+ });
+ }
+}
Added: trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/wsclient/WSClient.java
===================================================================
--- trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/wsclient/WSClient.java (rev 0)
+++ trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/wsclient/WSClient.java 2011-12-16 11:34:14 UTC (rev 37393)
@@ -0,0 +1,76 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.ws.ui.bot.test.wsclient;
+
+import java.io.ByteArrayInputStream;
+import java.io.ByteArrayOutputStream;
+import java.io.IOException;
+import java.net.URL;
+import java.util.logging.Level;
+import java.util.logging.Logger;
+
+import javax.xml.namespace.QName;
+import javax.xml.soap.MessageFactory;
+import javax.xml.soap.SOAPException;
+import javax.xml.soap.SOAPMessage;
+import javax.xml.ws.Dispatch;
+import javax.xml.ws.Service;
+import javax.xml.ws.Service.Mode;
+
+public class WSClient {
+
+ private static final Logger L = Logger.getLogger(WSClient.class.getName());
+ private Dispatch<SOAPMessage> d;
+
+ public WSClient(URL location, QName serviceName, QName portName) {
+ Service s = Service.create(location, serviceName);
+ d = s.createDispatch(portName, SOAPMessage.class, Mode.MESSAGE);
+ }
+
+ public String callService(String message) {
+ SOAPMessage result = null;
+ try {
+ SOAPMessage msg = MessageFactory.newInstance().createMessage( null, new ByteArrayInputStream(message.getBytes()));
+ msg.saveChanges();
+ result = d.invoke(msg);
+ } catch (SOAPException e) {
+ L.log(Level.WARNING, e.getMessage(), e);
+ } catch (IOException e) {
+ L.log(Level.WARNING, e.getMessage(), e);
+ }
+ String s = msgToString(result);
+ L.fine("SOAP Request :\n" + message);
+ L.fine("SOAP Response:\n" + s);
+ return s;
+ }
+
+ private String msgToString(SOAPMessage msg) {
+ if (msg == null) {
+ return "";
+ }
+ ByteArrayOutputStream out = new ByteArrayOutputStream();
+ try {
+ msg.writeTo(out);
+ } catch (SOAPException e) {
+ L.log(Level.WARNING, e.getMessage(), e);
+ } catch (IOException e) {
+ L.log(Level.WARNING, e.getMessage(), e);
+ } finally {
+ try {
+ out.close();
+ } catch (IOException e) {
+ //ignore
+ L.log(Level.WARNING, e.getMessage(), e);
+ }
+ }
+ return out.toString();
+ }
+}
Added: trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/wsclient/WsClientTest.java
===================================================================
--- trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/wsclient/WsClientTest.java (rev 0)
+++ trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/wsclient/WsClientTest.java 2011-12-16 11:34:14 UTC (rev 37393)
@@ -0,0 +1,88 @@
+/*******************************************************************************
+ * Copyright (c) 2011 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.ws.ui.bot.test.wsclient;
+
+import org.eclipse.core.resources.IProject;
+import org.eclipse.core.resources.ResourcesPlugin;
+import org.jboss.tools.ws.ui.bot.test.WSTestBase;
+import org.jboss.tools.ws.ui.bot.test.uiutils.wizards.WsWizardBase.Slider_Level;
+import org.junit.Assert;
+import org.junit.Test;
+
+/**
+ *
+ * @author jjankovi
+ *
+ */
+public class WsClientTest extends WSTestBase {
+
+ @Override
+ protected String getWsProjectName() {
+ return "client";
+ }
+
+ @Override
+ protected String getWsPackage() {
+ return "client." + getLevel().toString().toLowerCase();
+ }
+
+ @Test
+ public void testDeployClient() {
+ setLevel(Slider_Level.DEPLOY);
+ clientTest(getWsPackage());
+ }
+
+ @Test
+ public void testAssembleClient() {
+ setLevel(Slider_Level.ASSEMBLE);
+ clientTest(getWsPackage());
+ }
+
+ @Test
+ public void testDevelopClient() {
+ setLevel(Slider_Level.DEVELOP);
+ clientTest(getWsPackage());
+ }
+
+ @Test
+ public void testInstallClient() {
+ setLevel(Slider_Level.INSTALL);
+ clientTest(getWsPackage());
+ }
+
+ @Test
+ public void testStartClient() {
+ setLevel(Slider_Level.START);
+ clientTest(getWsPackage());
+ }
+
+ @Test
+ public void testTestClient() {
+ setLevel(Slider_Level.TEST);
+ clientTest(getWsPackage());
+ }
+
+ @Test
+ public void testDefaultPkg() {
+ setLevel(Slider_Level.ASSEMBLE);
+ clientTest(null);
+ }
+
+ private void clientTest(String targetPkg) {
+ clientHelper.createClient("http://footballpool.dataaccess.eu/data/info.wso?WSDL", getWsProjectName(), getLevel(), targetPkg);
+ IProject p = ResourcesPlugin.getWorkspace().getRoot().getProject(getWsProjectName());
+ String pkg = (targetPkg != null && !"".equals(targetPkg.trim())) ? getWsPackage() : "eu.dataaccess.footballpool";
+ String cls = "src/" + pkg.replace('.', '/') + "/Info.java";
+ Assert.assertTrue(p.getFile(cls).exists());
+ cls = "src/" + pkg.replace('.', '/') + "/clientsample/ClientSample.java";
+ Assert.assertTrue(p.getFile(cls).exists());
+ }
+}
Added: trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/wstester/WsTesterTest.java
===================================================================
--- trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/wstester/WsTesterTest.java (rev 0)
+++ trunk/ws/tests/org.jboss.tools.ws.ui.bot.test/src/org/jboss/tools/ws/ui/bot/test/wstester/WsTesterTest.java 2011-12-16 11:34:14 UTC (rev 37393)
@@ -0,0 +1,397 @@
+/*******************************************************************************
+ * Copyright (c) 2010 Red Hat, Inc.
+ * Distributed under license by Red Hat, Inc. All rights reserved.
+ * This program is made available under the terms of the
+ * Eclipse Public License v1.0 which accompanies this distribution,
+ * and is available at http://www.eclipse.org/legal/epl-v10.html
+ *
+ * Contributors:
+ * Red Hat, Inc. - initial API and implementation
+ ******************************************************************************/
+package org.jboss.tools.ws.ui.bot.test.wstester;
+
+import java.io.BufferedOutputStream;
+import java.io.BufferedReader;
+import java.io.File;
+import java.io.FileNotFoundException;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.InputStreamReader;
+import java.io.OutputStream;
+import java.util.Arrays;
+import java.util.List;
+import java.util.logging.Level;
+
+import org.eclipse.swtbot.eclipse.finder.widgets.SWTBotView;
+import org.eclipse.swtbot.swt.finder.widgets.SWTBotShell;
+import org.jboss.tools.ws.ui.bot.test.WSTestBase;
+import org.jboss.tools.ws.ui.bot.test.widgets.SelectWSDLDialog;
+import org.jboss.tools.ws.ui.bot.test.widgets.WsTesterView;
+import org.jboss.tools.ws.ui.bot.test.widgets.WsTesterView.Request_Arg_Type;
+import org.jboss.tools.ws.ui.bot.test.widgets.WsTesterView.Request_Type;
+import org.jboss.tools.ws.ui.messages.JBossWSUIMessages;
+import org.junit.AfterClass;
+import org.junit.Assert;
+import org.junit.Test;
+
+/**
+ * Tests for Web Service Tester
+ *
+ * @author jlukas
+ */
+public class WsTesterTest extends WSTestBase {
+
+ private static final String SERVICE_URL = "http://www.webservicex.net/BibleWebservice.asmx";
+
+ @Override
+ public void setup() {
+ // do nothing
+ }
+
+ @Override
+ public void cleanup() {
+ // do nothing
+ }
+
+ @AfterClass
+ public static void cleanAll() {
+ // do nothing
+ }
+
+ /**
+ * Test behavior of UI
+ */
+ @Test
+ public void testUI() {
+ WsTesterView wstv = new WsTesterView();
+ SWTBotView viewBot = wstv.show();
+ Assert.assertTrue("Tester View is not active", viewBot.isActive());
+ wstv.setRequestType(Request_Type.PUT);
+ Assert.assertEquals(Request_Type.PUT, wstv.getRequestType());
+ wstv.setRequestType(Request_Type.JAX_WS);
+ Assert.assertEquals(Request_Type.JAX_WS, wstv.getRequestType());
+
+ wstv.setRequestType(Request_Type.DELETE);
+ Assert.assertEquals(Request_Type.DELETE, wstv.getRequestType());
+ wstv.expandSection(Request_Arg_Type.HEADER.toString());
+ wstv.addRequestArg(Request_Arg_Type.HEADER, "a", "1");
+ wstv.addRequestArg(Request_Arg_Type.HEADER, "b", "2");
+ wstv.addRequestArg(Request_Arg_Type.HEADER, "c", "3");
+ Assert.assertEquals(3, wstv.getRequestArgs(Request_Arg_Type.HEADER).keySet().size());
+ Assert.assertTrue(wstv.getRequestArgs(Request_Arg_Type.HEADER).containsKey("b"));
+ wstv.addRequestArg(Request_Arg_Type.HEADER, "d", "4");
+ Assert.assertEquals(4, wstv.getRequestArgs(Request_Arg_Type.HEADER).keySet().size());
+ Assert.assertTrue(wstv.getRequestArgs(Request_Arg_Type.HEADER).containsKey("d"));
+ Assert.assertEquals(4, wstv.getRequestArgs(Request_Arg_Type.HEADER).keySet().size());
+ wstv.removeRequestArg(Request_Arg_Type.HEADER, "a", "1");
+ wstv.removeRequestArg(Request_Arg_Type.HEADER, "c", "3");
+ Assert.assertEquals(2, wstv.getRequestArgs(Request_Arg_Type.HEADER).keySet().size());
+ wstv.clearRequestArgs(Request_Arg_Type.HEADER);
+ Assert.assertEquals(0, wstv.getRequestArgs(Request_Arg_Type.HEADER).keySet().size());
+
+ wstv.setRequestType(Request_Type.JAX_WS);
+ selectPort(wstv, "BibleWebserviceSoap");
+ Assert.assertTrue(wstv.getRequestBody().contains("http://schemas.xmlsoap.org/soap/envelope/"));
+ selectPort(wstv, "BibleWebserviceSoap12");
+ Assert.assertTrue("Got: " + wstv.getRequestBody(), wstv.getRequestBody().contains("http://www.w3.org/2003/05/soap-envelope"));
+ viewBot.close();
+ }
+
+ /**
+ * Test refreshing body requests in the UI
+ */
+ @Test
+ public void testNamespaces() {
+ String uri = new File(prepareWsdl(), "original.wsdl").toURI().toString();
+ WsTesterView wstv = new WsTesterView();
+ SWTBotView viewBot = wstv.show();
+ Assert.assertTrue("Tester View is not active", viewBot.isActive());
+ SelectWSDLDialog dlg = wstv.getFromWSDL();
+ dlg.setURI(uri);
+ bot.sleep(1000);
+ List<String> items = dlg.getServices();
+ LOGGER.log(Level.FINE, "Services: {0}", items);
+ Assert.assertEquals(2, items.size());
+ Assert.assertTrue(items.contains("EchoService"));
+ items = dlg.getPorts();
+ LOGGER.log(Level.FINE, "Ports: {0}", items);
+ Assert.assertEquals(1, items.size());
+ Assert.assertTrue(items.contains("EchoPort"));
+ items = dlg.getOperations();
+ LOGGER.log(Level.FINE, "Operations: {0}", items);
+ Assert.assertEquals(1, items.size());
+ Assert.assertTrue(items.contains("echo"));
+ dlg.ok();
+ LOGGER.log(Level.INFO, "Request: {0}", wstv.getRequestBody());
+ Assert.assertTrue(wstv.getRequestBody().contains(
+ "<tns:echo xmlns:tns=\"http://test.jboss.org/ns\">"));
+
+ dlg = wstv.getFromWSDL();
+ dlg.setURI(uri);
+ bot.sleep(1000);
+ items = dlg.getServices();
+ LOGGER.log(Level.FINE, "Services: {0}", items);
+ Assert.assertEquals(2, items.size());
+ Assert.assertTrue(items.contains("gsearch_rss"));
+ dlg.selectService("gsearch_rss");
+ items = dlg.getPorts();
+ LOGGER.log(Level.FINE, "Ports: {0}", items);
+ Assert.assertEquals(1, items.size());
+ Assert.assertTrue(items.contains("gsearch_rssSoap"));
+ items = dlg.getOperations();
+ LOGGER.log(Level.FINE, "Operations: {0}", items);
+ Assert.assertEquals(1, items.size());
+ Assert.assertTrue(items.contains("GetSearchResults"));
+ dlg.ok();
+ LOGGER.log(Level.INFO, "Request: {0}", wstv.getRequestBody());
+ Assert.assertTrue(wstv.getRequestBody().contains(
+ "<tns:GetSearchResults xmlns:tns=\"http://www.ecubicle.net/webservices\">"));
+ }
+
+ /**
+ * Test SOAP service invocation
+ */
+ @Test
+ public void testSOAPService() {
+ WsTesterView wstv = new WsTesterView();
+ wstv.show();
+ wstv.setRequestType(Request_Type.JAX_WS);
+ Assert.assertEquals(Request_Type.JAX_WS, wstv.getRequestType());
+ wstv.setServiceURL(SERVICE_URL + "?WSDL");
+ InputStream is = WsTesterTest.class.getResourceAsStream("/resources/jbossws/message_soap_out.xml");
+ wstv.setRequestBody(readResource(is));
+ wstv.invoke();
+ bot.sleep(5000);
+ String rsp = wstv.getResponseBody();
+ LOGGER.log(Level.FINE, "SOAP response: {0}", rsp);
+ Assert.assertTrue(rsp.trim().length() > 0);
+ checkResponse(rsp, "<BookTitle>Mark</BookTitle>");
+ }
+
+ /**
+ * Test SOAP 1.2 service invocation
+ */
+ @Test
+ public void testSOAP12Service() {
+ WsTesterView wstv = new WsTesterView();
+ wstv.show();
+ wstv.setRequestType(Request_Type.JAX_WS);
+ Assert.assertEquals(Request_Type.JAX_WS, wstv.getRequestType());
+ SelectWSDLDialog dlg = wstv.getFromWSDL();
+ try {
+ dlg.openURL();
+ SWTBotShell sh = bot.activeShell();
+ sh.bot().text().typeText(SERVICE_URL + "?WSDL");
+ sh.bot().button("OK").click();
+ bot.sleep(1000);
+ Assert.assertEquals(SERVICE_URL + "?WSDL", dlg.getURI());
+ dlg.selectPort("BibleWebserviceSoap12");
+ dlg.ok();
+ } finally {
+ if (dlg.isOpen()) {
+ dlg.close();
+ }
+ }
+ Assert.assertEquals(SERVICE_URL + "?WSDL", wstv.getServiceURL());
+ InputStream is = WsTesterTest.class.getResourceAsStream("/resources/jbossws/message_soap12_out.xml");
+ wstv.setRequestBody(readResource(is));
+ wstv.invoke();
+ String rsp = wstv.getResponseBody();
+ LOGGER.log(Level.FINE, "SOAP response: {0}", rsp);
+ Assert.assertTrue(rsp.trim().length() > 0);
+ checkResponse(rsp, "<BookTitle>Mark</BookTitle>");
+ }
+
+ /**
+ * Test REST service invocation (GET request)
+ */
+ @Test
+ public void testRESTGETService() {
+ WsTesterView wstv = new WsTesterView();
+ wstv.show();
+ wstv.setRequestType(Request_Type.GET);
+ wstv.setServiceURL(SERVICE_URL + "/GetBibleWordsByChapterAndVerse");
+ wstv.expandSection(Request_Arg_Type.PARAMETER.toString());
+ wstv.addRequestArg(Request_Arg_Type.PARAMETER, "BookTitle", "Luke");
+ wstv.addRequestArg(Request_Arg_Type.PARAMETER, "chapter", "2");
+ wstv.addRequestArg(Request_Arg_Type.PARAMETER, "Verse", "2");
+ wstv.editRequestArg(Request_Arg_Type.PARAMETER, "chapter", "2", "chapter", "1");
+ try {
+ wstv.invoke();
+ String rsp = wstv.getResponseBody();
+ String[] rspHeaders = wstv.getResponseHeaders();
+ LOGGER.log(Level.FINE, "REST response: {0}", rsp);
+ LOGGER.log(Level.FINE, "Response headers: {0}", Arrays.asList(rspHeaders));
+ Assert.assertTrue(rsp.trim().length() > 0);
+ checkResponse(rsp, "<Chapter>1</Chapter>");
+ checkResponse(rsp, "ministers of the word");
+ } finally {
+ wstv.clearRequestArgs(Request_Arg_Type.PARAMETER);
+ }
+ }
+
+ /**
+ * Test REST service invocation (POST request)
+ */
+ @Test
+ public void testRESTPOSTService() {
+ WsTesterView wstv = new WsTesterView();
+ wstv.show();
+ wstv.setRequestType(WsTesterView.Request_Type.POST);
+ wstv.setServiceURL(SERVICE_URL + "/GetBibleWordsByChapterAndVerse");
+ String requestBody = "BookTitle=John&chapter=3&Verse=1\r";
+ wstv.setRequestBody(requestBody);
+ wstv.expandSection(JBossWSUIMessages.JAXRSWSTestView2_ResponseHeaders_Section);
+ wstv.addRequestArg(Request_Arg_Type.HEADER, "Content-Type", "application/x-www-form-urlencoded");
+ wstv.addRequestArg(Request_Arg_Type.HEADER, "Content-Length", String.valueOf(requestBody.length()));
+ try {
+ wstv.invoke();
+ String rsp = wstv.getResponseBody();
+ String[] rspHeaders = wstv.getResponseHeaders();
+ LOGGER.log(Level.FINE, "REST response: {0}", rsp);
+ LOGGER.log(Level.FINE, "Response headers: {0}", Arrays.asList(rspHeaders));
+ Assert.assertTrue(rsp.trim().length() > 0);
+ checkResponse(rsp, "<Chapter>3</Chapter>");
+ checkResponse(rsp, "There was a man of the Pharisees, named Nicodemus, a ruler of the Jews");
+ } finally {
+ wstv.clearRequestArgs(Request_Arg_Type.HEADER);
+ }
+ }
+
+ @Test
+ public void testErrorResponse() {
+ WsTesterView wstv = new WsTesterView();
+ wstv.show();
+ wstv.setRequestType(Request_Type.GET);
+ wstv.setServiceURL("http://www.zvents.com/rest/event_update");
+ wstv.invoke();
+ Assert.assertEquals(0, wstv.getRequestArgs(Request_Arg_Type.PARAMETER).size());
+ String rsp = wstv.getResponseBody();
+ String[] rspHeaders = wstv.getResponseHeaders();
+ LOGGER.log(Level.FINE, "REST response: {0}", rsp);
+ LOGGER.log(Level.FINE, "Response headers: {0}", Arrays.asList(rspHeaders));
+ Assert.assertTrue(rsp.trim().length() > 0);
+ checkResponse(rsp, "Invalid API Key.");
+ }
+
+ private String readResource(InputStream is) {
+ StringBuilder sb = new StringBuilder();
+ BufferedReader br = null;
+ try {
+ br = new BufferedReader(new InputStreamReader(is));
+ String s;
+ while ((s = br.readLine()) != null) {
+ sb.append(s);
+ sb.append('\n');
+ }
+ } catch (IOException e) {
+ LOGGER.log(Level.WARNING, e.getMessage(), e);
+ } finally {
+ if (br != null) {
+ try {
+ br.close();
+ } catch (IOException e) {
+ LOGGER.log(Level.FINEST, e.getMessage(), e);
+ }
+ }
+ }
+ return sb.toString();
+ }
+
+ private void checkResponse(String rsp, String expContent) {
+ try {
+ Assert.assertTrue(rsp, rsp.contains(expContent));
+ } catch (AssertionError t) {
+ if (rsp.contains("503")) {
+ LOGGER.log(Level.WARNING, "Service Unavailable: {0}", SERVICE_URL);
+ } else {
+ throw t;
+ }
+ }
+ }
+
+ private File prepareWsdl() {
+ String[] files = {"imported.wsdl", "original.wsdl", "schema.xsd"};
+ File targetFolder = new File(System.getProperty("java.io.tmpdir"),
+ "WsTesterTest");
+ targetFolder.mkdirs();
+ for (String file : files) {
+ InputStream is = WsTesterTest.class.getResourceAsStream("/wsdl/"
+ + file);
+ File target = new File(targetFolder, file);
+ if (target.exists()) {
+ target.delete();
+ }
+ try {
+ OutputStream os = new BufferedOutputStream(
+ new FileOutputStream(target));
+ copy(is, os);
+ } catch (FileNotFoundException fnfe) {
+ throw new RuntimeException(fnfe);
+ }
+ }
+ return targetFolder;
+ }
+
+ private void copy(InputStream in, OutputStream out) {
+ byte[] buf = new byte[1024];
+ int len;
+ try {
+ while ((len = in.read(buf)) > 0) {
+ out.write(buf, 0, len);
+ }
+ } catch (IOException ioe) {
+ throw new RuntimeException(ioe);
+ } finally {
+ if (in != null) {
+ try {
+ in.close();
+ } catch (IOException ioe2) {
+ LOGGER.log(Level.WARNING, ioe2.getMessage(), ioe2);
+ }
+ }
+ if (out != null) {
+ try {
+ out.close();
+ } catch (IOException ioe2) {
+ LOGGER.log(Level.WARNING, ioe2.getMessage(), ioe2);
+ }
+ }
+ }
+ }
+
+ private void selectPort(WsTesterView wstv, String portName) {
+ SelectWSDLDialog dlg = wstv.getFromWSDL();
+ try {
+ dlg.openURL();
+ SWTBotShell sh = bot.activeShell();
+ sh.bot().text().typeText(SERVICE_URL + "?WSDL");
+ sh.bot().button("OK").click();
+ bot.sleep(1000);
+ Assert.assertEquals(SERVICE_URL + "?WSDL", dlg.getURI());
+ List<String> items = dlg.getServices();
+ LOGGER.log(Level.FINE, "Services: {0}", items);
+ Assert.assertEquals(1, items.size());
+ Assert.assertTrue(items.contains("BibleWebservice"));
+ items = dlg.getPorts();
+ LOGGER.log(Level.FINE, "Ports: {0}", items);
+ Assert.assertEquals(2, items.size());
+ Assert.assertTrue(items.contains("BibleWebserviceSoap"));
+ Assert.assertTrue(items.contains("BibleWebserviceSoap12"));
+ dlg.selectPort(portName);
+ items = dlg.getOperations();
+ LOGGER.log(Level.FINE, "Operations: {0}", items);
+ Assert.assertEquals(4, items.size());
+ Assert.assertTrue(items.contains("GetBookTitles"));
+ Assert.assertTrue(items.contains("GetBibleWordsByChapterAndVerse"));
+ dlg.selectOperation("GetBibleWordsbyKeyWord");
+ dlg.ok();
+ Assert.assertEquals("http://www.webservicex.net/BibleWebservice.asmx?WSDL", wstv.getServiceURL());
+ } finally {
+ if (dlg.isOpen()) {
+ dlg.close();
+ }
+ }
+ }
+}
14 years