Skip to main content
summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorlmandel2006-04-05 03:37:34 +0000
committerlmandel2006-04-05 03:37:34 +0000
commitf26b6c87a17b6001cf96d8d05f1b97be32089c44 (patch)
treeb4c95b5b6788c505fd957bb5fe824e319d562c76
parentb05a57f93c6280124be686ed0537013761e124a0 (diff)
downloadwebtools.webservices-f26b6c87a17b6001cf96d8d05f1b97be32089c44.tar.gz
webtools.webservices-f26b6c87a17b6001cf96d8d05f1b97be32089c44.tar.xz
webtools.webservices-f26b6c87a17b6001cf96d8d05f1b97be32089c44.zip
[124398] WS-I validator wasn't caching the required TADs.
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/WSITestToolsEclipseProperties.java39
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/WSITestToolsProperties.java4
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/impl/ProfileAssertionsReaderImpl.java49
-rw-r--r--bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/validate/wsdl/WSDLValidator.java2
4 files changed, 86 insertions, 8 deletions
diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/WSITestToolsEclipseProperties.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/WSITestToolsEclipseProperties.java
index b5e509c25..debcff7ac 100644
--- a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/WSITestToolsEclipseProperties.java
+++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/WSITestToolsEclipseProperties.java
@@ -14,6 +14,8 @@ import org.eclipse.core.resources.IFile;
import org.eclipse.core.resources.IProject;
import org.eclipse.core.resources.ResourcesPlugin;
import org.eclipse.core.runtime.Path;
+import org.eclipse.wst.common.uriresolver.internal.provisional.URIResolver;
+import org.eclipse.wst.common.uriresolver.internal.provisional.URIResolverPlugin;
import org.eclipse.wst.ws.internal.plugin.WSPlugin;
import org.eclipse.wst.ws.internal.preferences.PersistentWSIContext;
@@ -27,8 +29,10 @@ public class WSITestToolsEclipseProperties extends WSITestToolsProperties
*/
public static WSIPreferences checkWSIPreferences(String fileuri)
{
+ // Cache the WS-I tads.
+ cacheTADFiles();
+
WSIPreferences preferences = new WSIPreferences();
-
// Remove file: and any slashes from the fileuri.
// Eclipse's resolution mechanism needs to start with the drive.
String uriStr = trimURI(fileuri);
@@ -101,5 +105,38 @@ public class WSITestToolsEclipseProperties extends WSITestToolsProperties
}
return preferences;
}
+
+ protected static void cacheTADFiles()
+ {
+ String resultAP = cacheFile(AP_ASSERTION_FILE);
+ if(resultAP != null)
+ {
+ AP_ASSERTION_FILE = resultAP;
+ }
+
+ String resultSSBP = cacheFile(SSBP_ASSERTION_FILE);
+ if(resultSSBP != null)
+ {
+ SSBP_ASSERTION_FILE = resultSSBP;
+ }
+ }
+
+ protected static String cacheFile(String uri)
+ {
+ URIResolver resolver = getURIResolver();
+ String resolvedUri = resolver.resolve("", null, uri);
+ return resolver.resolvePhysicalLocation("", null, resolvedUri);
+ }
+
+ /**
+ * Get the URI resolver to use for WS-I validaiton.
+ *
+ * @return
+ * The URI resolver to use for WS-I validation.
+ */
+ public static URIResolver getURIResolver()
+ {
+ return URIResolverPlugin.createResolver();
+ }
}
diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/WSITestToolsProperties.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/WSITestToolsProperties.java
index f18cf0427..8e69cdf47 100644
--- a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/WSITestToolsProperties.java
+++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/WSITestToolsProperties.java
@@ -19,8 +19,8 @@ public class WSITestToolsProperties
protected static String tadfile = "";
public final static String schemaDir = "common/schemas/";
- public final static String SSBP_ASSERTION_FILE = "http://www.ws-i.org/Testing/Tools/2005/01/SSBP10_BP11_TAD_1-0.xml";
- public final static String AP_ASSERTION_FILE = "http://www.ws-i.org/Testing/Tools/2004/12/AP10_BP11_SSBP10_TAD.xml";
+ public static String SSBP_ASSERTION_FILE = "http://www.ws-i.org/Testing/Tools/2005/01/SSBP10_BP11_TAD_1-0.xml";
+ public static String AP_ASSERTION_FILE = "http://www.ws-i.org/Testing/Tools/2004/12/AP10_BP11_SSBP10_TAD.xml";
public final static String DEFAULT_ASSERTION_FILE = AP_ASSERTION_FILE;
public static final String STOP_NON_WSI = "0";
diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/impl/ProfileAssertionsReaderImpl.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/impl/ProfileAssertionsReaderImpl.java
index 3b2a9d9e0..db959491d 100644
--- a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/impl/ProfileAssertionsReaderImpl.java
+++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/impl/ProfileAssertionsReaderImpl.java
@@ -10,12 +10,17 @@
*******************************************************************************/
package org.eclipse.wst.wsi.internal.core.profile.impl;
+import java.io.IOException;
import java.io.Reader;
+import java.net.URL;
import java.util.Iterator;
import java.util.LinkedList;
import java.util.List;
import java.util.TreeMap;
+import org.eclipse.wst.common.uriresolver.internal.provisional.URIResolver;
+import org.eclipse.wst.wsi.internal.WSITestToolsEclipseProperties;
+import org.eclipse.wst.wsi.internal.WSITestToolsProperties;
import org.eclipse.wst.wsi.internal.core.WSIConstants;
import org.eclipse.wst.wsi.internal.core.WSIException;
import org.eclipse.wst.wsi.internal.core.profile.EntryTypeList;
@@ -27,7 +32,9 @@ import org.eclipse.wst.wsi.internal.core.util.ArtifactType;
import org.eclipse.wst.wsi.internal.core.util.Utils;
import org.eclipse.wst.wsi.internal.core.xml.XMLUtils;
import org.xml.sax.Attributes;
+import org.xml.sax.EntityResolver;
import org.xml.sax.InputSource;
+import org.xml.sax.SAXException;
import org.xml.sax.XMLReader;
import org.xml.sax.helpers.DefaultHandler;
@@ -93,7 +100,32 @@ public class ProfileAssertionsReaderImpl implements ProfileAssertionsReader
// Set content handler to inner class
reader.setContentHandler(new ProfileAssertionsHandler());
-
+
+ if(WSITestToolsProperties.getEclipseContext())
+ {
+ EntityResolver resolver = new EntityResolver(){
+
+ public InputSource resolveEntity(String publicId, String systemId) throws SAXException, IOException {
+ URIResolver resolver = WSITestToolsEclipseProperties.getURIResolver();
+ String uri = resolver.resolve("", publicId, systemId);
+ String physicalLocation = resolver.resolvePhysicalLocation("", publicId, uri);
+ InputSource is = null;
+ try
+ {
+ URL url = new URL(physicalLocation);
+ is = new InputSource(uri);
+ is.setByteStream(url.openStream());
+ }
+ catch(Exception e)
+ {
+ // Do nothing if opening the stream fails.
+ }
+ return is;
+ }
+
+ };
+ reader.setEntityResolver(resolver);
+ }
// Parse profile definition file
reader.parse(inputSource);
}
@@ -107,15 +139,24 @@ public class ProfileAssertionsReaderImpl implements ProfileAssertionsReader
//Check to see if the version of test asssertion document is supported
if (!Utils.isValidProfileTADVersion(profileAssertions))
{
- throw new WSIException(
+ String tadVersion = profileAssertions.getTADVersion();
+ if(tadVersion != null)
+ {
+ String tadName = profileAssertions.getTADName();
+ throw new WSIException(
"\nVersion "
- + profileAssertions.getTADVersion()
+ + tadVersion
+ " of the \""
- + profileAssertions.getTADName()
+ + tadName
+ "\"\n"
+ "document is not compatible with this version of"
+ "\n"
+ "the test tools.");
+ }
+ else
+ {
+ throw new WSIException("WS-I validation was unable to run. Unable to read the test assertion document.");
+ }
}
}
diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/validate/wsdl/WSDLValidator.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/validate/wsdl/WSDLValidator.java
index 997ad205c..6488f0de8 100644
--- a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/validate/wsdl/WSDLValidator.java
+++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/validate/wsdl/WSDLValidator.java
@@ -299,7 +299,7 @@ public class WSDLValidator implements IWSDLValidator
catch (WSIAnalyzerException e)
{
// TODO: Add code to log error
- System.out.println("Unable to run WS-I WSDL conformance check.\n" + e);
+ valInfo.addWarning(WSIConstants.WSI_PREFIX + "A problem occured while running the WS-I WSDL conformance check: " + e, 1, 0, valInfo.getFileURI());
}
}
}

Back to the top