diff options
Diffstat (limited to 'bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/uddi')
12 files changed, 0 insertions, 1837 deletions
diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/uddi/BP3001.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/uddi/BP3001.java deleted file mode 100644 index b206cd03d..000000000 --- a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/uddi/BP3001.java +++ /dev/null @@ -1,160 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002-2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are 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: - * IBM - Initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.wsi.internal.core.profile.validator.impl.uddi; - -import java.util.Map; - -import javax.wsdl.Binding; -import javax.wsdl.Definition; - -import org.eclipse.wst.wsi.internal.core.WSIConstants; -import org.eclipse.wst.wsi.internal.core.WSIException; -import org.eclipse.wst.wsi.internal.core.profile.TestAssertion; -import org.eclipse.wst.wsi.internal.core.profile.validator.EntryContext; -import org.eclipse.wst.wsi.internal.core.profile.validator.impl.AssertionProcess; -import org.eclipse.wst.wsi.internal.core.report.AssertionResult; -import org.eclipse.wst.wsi.internal.core.wsdl.WSDLDocument; -import org.uddi4j.datatype.OverviewDoc; -import org.uddi4j.datatype.tmodel.TModel; - - -/** - * BP3001 - The tModel element uses WSDL as the description language: - * the uddi:overviewDoc/uddi:overviewURL element contains a reference - * to a WSDL definition, which uses a namespace - * of http://schemas.xmlsoap.org/wsdl/. - * The uddi:overviewURL may use the fragment notation to resolve - * to a wsdl:binding. - */ -public class BP3001 extends AssertionProcess -{ - private final UDDIValidatorImpl validator; - - /** - * @param UDDIValidatorImpl - */ - public BP3001(UDDIValidatorImpl impl) - { - super(impl); - this.validator = impl; - } - - /** - * Sets the result variable to AssertionResult.RESULT_FAILED value and - * places a tModel key in the fault detail message. - * @param tModelKey - */ - private void setFaultMessage(String tModelKey) - { - result = AssertionResult.RESULT_FAILED; - failureDetailMessage = "The tModel key is: [" + tModelKey + "]."; - } - - /** - * Validates the test assertion. - * @see org.eclipse.wst.wsi.test.profile.validator.impl.BaseValidatorImpl.AssertionProcess#validate(org.wsi.test.profile.TestAssertion, org.wsi.test.profile.validator.EntryContext) - */ - public AssertionResult validate( - TestAssertion testAssertion, - EntryContext entryContext) - throws WSIException - { - result = AssertionResult.RESULT_PASSED; - - Binding binding = null; - - // Get the tModel from the entryContext - TModel tModel = (TModel) entryContext.getEntry().getEntryDetail(); - - // If the tModel does not exist, then fail - if (tModel == null) - { - result = AssertionResult.RESULT_FAILED; - failureDetailMessage = "Could not locate a tModel."; - return validator.createAssertionResult( - testAssertion, - result, - failureDetailMessage); - } - - String key = tModel.getTModelKey(); - - OverviewDoc doc = tModel.getOverviewDoc(); - if (doc != null) - { - String urlText = doc.getOverviewURLString(); - - // Try to resolve the URL & check the WSDL - try - { - WSDLDocument wsdlDocument = new WSDLDocument(urlText); - Definition definition = wsdlDocument.getDefinitions(); - Map namespaces = definition.getNamespaces(); - if (!namespaces.containsValue(WSIConstants.NS_URI_WSDL)) - { - urlText = null; - } - - // Get binding - binding = validator.getBinding(urlText, wsdlDocument); - - // See if the binding is in the WSDL document - if (binding == null - || definition.getBinding(binding.getQName()) == null) - { - urlText = null; - } - } - - catch (Exception e) - { - urlText = null; - } - - if (urlText != null) - { - String fragmentID = null; - int index = urlText.indexOf("#"); - if (index > -1) - { - fragmentID = urlText.substring(index + 1); - } - - if ((fragmentID != null) - && (fragmentID.length() != 0) - && (fragmentID.toUpperCase().indexOf("xpointer(".toUpperCase()) == -1 - || fragmentID.lastIndexOf(")") != fragmentID.length() - 1)) - { - setFaultMessage(key); - } - } - - else - { - setFaultMessage(key); - } - } - - else - { - setFaultMessage(key); - } - - if (result == AssertionResult.RESULT_PASSED) - { - // Set the binding that will be used - validator.setWSDLBinding(binding); - } - - // Return assertion result - return validator.createAssertionResult(testAssertion, result, failureDetailMessage); - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/uddi/BP3002.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/uddi/BP3002.java deleted file mode 100644 index 572cde4cd..000000000 --- a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/uddi/BP3002.java +++ /dev/null @@ -1,81 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002-2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are 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: - * IBM - Initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.wsi.internal.core.profile.validator.impl.uddi; - -import org.eclipse.wst.wsi.internal.core.WSIException; -import org.eclipse.wst.wsi.internal.core.profile.TestAssertion; -import org.eclipse.wst.wsi.internal.core.profile.validator.EntryContext; -import org.eclipse.wst.wsi.internal.core.profile.validator.impl.AssertionProcess; -import org.eclipse.wst.wsi.internal.core.report.AssertionResult; -import org.uddi4j.datatype.binding.BindingTemplate; - - -/** - * BP3002 - The uddi:bindingTemplate element contains a uddi:accessPoint element, - * with a non-empty value. - */ -public class BP3002 extends AssertionProcess -{ - private final UDDIValidatorImpl validator; - - /** - * @param UDDIValidatorImpl - */ - public BP3002(UDDIValidatorImpl impl) - { - super(impl); - this.validator = impl; - } - - /** - * Validates the test assertion. - * @see org.eclipse.wst.wsi.test.profile.validator.impl.BaseValidatorImpl.AssertionProcess#validate(org.wsi.test.profile.TestAssertion, org.wsi.test.profile.validator.EntryContext) - */ - public AssertionResult validate( - TestAssertion testAssertion, - EntryContext entryContext) - throws WSIException - { - String serviceLocation = null; - - result = AssertionResult.RESULT_PASSED; - - // Get the bindingTemplate from the entryContext - BindingTemplate bindingTemplate = - (BindingTemplate) entryContext.getEntry().getEntryDetail(); - - // If the bindingTemplate does not contain an accessPoint, then fail - if ((bindingTemplate.getAccessPoint() == null) - || ((serviceLocation = bindingTemplate.getAccessPoint().getText()) - == null)) - { - result = AssertionResult.RESULT_FAILED; - failureDetailMessage = - "The bindingTempate key is: [" - + bindingTemplate.getBindingKey() - + "]."; - } - - // Else save the service location in the assertion result - else - { - // Save service location in analyzer context - entryContext - .getAnalyzerContext() - .getServiceReference() - .setServiceLocation( - serviceLocation); - } - - // Return assertion result - return validator.createAssertionResult(testAssertion, result, failureDetailMessage); - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/uddi/BP3003.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/uddi/BP3003.java deleted file mode 100644 index c0e04f04b..000000000 --- a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/uddi/BP3003.java +++ /dev/null @@ -1,84 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002-2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are 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: - * IBM - Initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.wsi.internal.core.profile.validator.impl.uddi; - -import org.eclipse.wst.wsi.internal.core.WSIException; -import org.eclipse.wst.wsi.internal.core.profile.TestAssertion; -import org.eclipse.wst.wsi.internal.core.profile.validator.EntryContext; -import org.eclipse.wst.wsi.internal.core.profile.validator.impl.AssertionProcess; -import org.eclipse.wst.wsi.internal.core.report.AssertionResult; -import org.uddi4j.datatype.tmodel.TModel; - - -/** - * BP3003 - The uddi:tModel is categorized using the uddi:types taxonomy, - * as "wsdlSpec": the uddi:keyedReference element has an attribute keyValue - * equal to "wsdlSpec", and keyName equal to "uddi-org:types" or "types". - */ -public class BP3003 extends AssertionProcess -{ - private final UDDIValidatorImpl validator; - - /** - * @param UDDIValidatorImpl - */ - public BP3003(UDDIValidatorImpl impl) - { - super(impl); - this.validator = impl; - } - - /** - * Validates the test assertion. - * @see org.eclipse.wst.wsi.test.profile.validator.impl.BaseValidatorImpl.AssertionProcess#validate(org.wsi.test.profile.TestAssertion, org.wsi.test.profile.validator.EntryContext) - */ - public AssertionResult validate( - TestAssertion testAssertion, - EntryContext entryContext) - throws WSIException - { - result = AssertionResult.RESULT_PASSED; - - // Get the tModel from the entryContext - TModel tModel = (TModel) entryContext.getEntry().getEntryDetail(); - - // If the tModel does not exist, then fail - if (tModel == null) - { - result = AssertionResult.RESULT_FAILED; - failureDetailMessage = - "Could not locate a tModel with a categorization of 'wsdlSpec'."; - } - - // If there is a tModel and it is not categorized as "wsdlSpec", then fail - else if (!(validator.isWsdlSpec(tModel))) - { - result = AssertionResult.RESULT_FAILED; - failureDetailMessage = - "The tModel key is: [" - + tModel.getTModelKey() - + "]\n" - + "The categoryBag is: [" - + this.validator.categoryBagToString(tModel.getCategoryBag()) - + "]"; - } - - // Else get the WSDL document location and set it and the binding element in analyzer context - else - { - // set WSDL location in analyzer context - validator.setWSDLLocation(validator.getWSDLLocation(validator.getOverviewURL(tModel))); - } - - // Return assertion result - return validator.createAssertionResult(testAssertion, result, failureDetailMessage); - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/uddi/UDDIValidatorImpl.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/uddi/UDDIValidatorImpl.java deleted file mode 100644 index 0ffdce883..000000000 --- a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/uddi/UDDIValidatorImpl.java +++ /dev/null @@ -1,590 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002-2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are 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: - * IBM - Initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.wsi.internal.core.profile.validator.impl.uddi; - -import java.io.IOException; -import java.io.InputStream; -import java.net.MalformedURLException; -import java.net.URL; -import java.net.UnknownHostException; -import java.util.Iterator; -import java.util.Vector; - -import javax.wsdl.Binding; -import javax.wsdl.WSDLException; - -import org.eclipse.wst.wsi.internal.core.WSIException; -import org.eclipse.wst.wsi.internal.core.analyzer.AnalyzerContext; -import org.eclipse.wst.wsi.internal.core.analyzer.ServiceReference; -import org.eclipse.wst.wsi.internal.core.analyzer.config.UDDIReference; -import org.eclipse.wst.wsi.internal.core.analyzer.config.WSDLElement; -import org.eclipse.wst.wsi.internal.core.analyzer.config.impl.WSDLElementImpl; -import org.eclipse.wst.wsi.internal.core.profile.ProfileArtifact; -import org.eclipse.wst.wsi.internal.core.profile.TestAssertion; -import org.eclipse.wst.wsi.internal.core.profile.validator.EntryContext; -import org.eclipse.wst.wsi.internal.core.profile.validator.UDDIValidator; -import org.eclipse.wst.wsi.internal.core.profile.validator.impl.BaseValidatorImpl; -import org.eclipse.wst.wsi.internal.core.report.Entry; -import org.eclipse.wst.wsi.internal.core.report.ReportArtifact; -import org.eclipse.wst.wsi.internal.core.report.Reporter; -import org.eclipse.wst.wsi.internal.core.util.EntryType; -import org.eclipse.wst.wsi.internal.core.util.UDDIUtils; -import org.eclipse.wst.wsi.internal.core.wsdl.WSDLDocument; -import org.uddi4j.client.UDDIProxy; -import org.uddi4j.datatype.binding.BindingTemplate; -import org.uddi4j.datatype.binding.TModelInstanceInfo; -import org.uddi4j.datatype.tmodel.TModel; -import org.uddi4j.response.BindingDetail; -import org.uddi4j.response.TModelDetail; -import org.uddi4j.util.CategoryBag; -import org.uddi4j.util.KeyedReference; - -import com.ibm.wsdl.util.StringUtils; - -/** - * The UDDI validator will verify that a web service description was published correctly in a UDDI registry. - * - * @version 1.0.1 - * @author Peter Brittenham (peterbr@us.ibm.com) - */ -public class UDDIValidatorImpl - extends BaseValidatorImpl - implements UDDIValidator -{ - /** - * UDDI reference. - */ - protected UDDIReference uddiReference; - /** - * UDDI proxy. - */ - protected UDDIProxy uddiProxy; - - /* (non-Javadoc) - * @see org.wsi.test.profile.validator.UDDIValidator#init(org.eclipse.wst.wsi.internal.core.analyzer.AnalyzerContext, org.wsi.test.profile.ProfileArtifact, org.wsi.test.report.ReportArtifact, org.wsi.test.analyzer.config.UDDIReference, org.wsi.test.report.Reporter) - */ - public void init( - AnalyzerContext analyzerContext, - ProfileArtifact profileArtifact, - ReportArtifact reportArtifact, - UDDIReference uddiReference, - Reporter reporter) - throws WSIException - { - // BaseValidatorImpl - super.init(analyzerContext, profileArtifact, reportArtifact, reporter); - - // Save input references - this.uddiReference = uddiReference; - } - - /* (non-Javadoc) - * @see org.wsi.test.profile.validator.UDDIValidator#validate() - */ - public String validate() throws WSIException - { - String wsdlURL = null; - Entry entry = null; - - BindingTemplate bindingTemplate = null; - TModel tModel = null; - - // it depricated after refactoring - // now the inner classes moved out from validator - //String classPrefix = this.getClass().getName() + "$"; - String classPrefix = this.getClass().getPackage().getName()+"."; - - try - { - // Set up a reference to the UDDI registry - uddiProxy = new UDDIProxy(); - - //new Socket(new InetAddress(uddiReference.getInquiryURL())); - uddiProxy.setInquiryURL(uddiReference.getInquiryURL()); - boolean wasEx = false; - InputStream stream; - try - { - URL url = StringUtils.getURL(null, uddiReference.getInquiryURL()); - stream = url.openStream(); - stream.close(); - } - - catch (UnknownHostException ex) - { - wasEx = true; - } - - catch (IOException ex) - { - } - - if (!wasEx) - { - - // If the UDDI reference is to a bindingTemplate then get it - if (uddiReference.getKeyType().equals(UDDIReference.BINDING_KEY)) - { - // Get binding detail which will contain the bindingTemplate - BindingDetail bindingDetail = - uddiProxy.get_bindingDetail(uddiReference.getKey()); - - // Get bindingTemplate - bindingTemplate = - (BindingTemplate) bindingDetail - .getBindingTemplateVector() - .elementAt( - 0); - - if (verboseOption) - { - System.err.println( - " BindingTemplate - " - + UDDIUtils.bindingTemplateToString(bindingTemplate)); - } - - // Get the wsdlSpec tModel - tModel = findTModel(uddiProxy, bindingTemplate); - } - - // Else it has to be a tModel - else - { - TModelDetail tModelDetail = - uddiProxy.get_tModelDetail(uddiReference.getKey()); - tModel = (TModel) tModelDetail.getTModelVector().elementAt(0); - } - - if (verboseOption) - { - System.err.println( - " TModel specified or found in bindingTemplate - " - + UDDIUtils.tModelToString(tModel)); - } - } - - if (bindingTemplate == null) - { - setMissingInput( - EntryType.getEntryType(EntryType.TYPE_DISCOVERY_BINDINGTEMPLATE)); - } - - // If there is a bindingTemplate, then process test assertions for it - else - { - // Create entry - entry = this.reporter.getReport().createEntry(); - entry.setEntryType( - EntryType.getEntryType(EntryType.TYPE_DISCOVERY_BINDINGTEMPLATE)); - entry.setReferenceID(bindingTemplate.getBindingKey()); - entry.setEntryDetail(bindingTemplate); - - // Process test assertions - processAssertions( - classPrefix, - new EntryContext(entry, this.analyzerContext)); - } - - // NOTE: From this point forward, if a bindingTemplate does NOT have a wsdlSpec tModel, - // the tModel will be NULL. - - //Parse WSDL document, and get WSDL document url, binding name and namespace - try - { - String overviewURL = getOverviewURL(tModel); - wsdlURL = getWSDLLocation(overviewURL); - WSDLDocument wsdlDocument = getWSDLDocument(wsdlURL); - - // ADD: The WSDL binding is used in WSI3001 and should be moved to the entryContext - getBinding(overviewURL, wsdlDocument); - } - - catch (Exception e) - { - // ADD: - if (verboseOption) - { - System.err.println(" EXCEPTION: " + e.toString()); - } - } - - // Create entry - entry = this.reporter.getReport().createEntry(); - entry.setEntryType( - EntryType.getEntryType(EntryType.TYPE_DISCOVERY_TMODEL)); - entry.setReferenceID( - (tModel == null ? "[tModel]" : tModel.getTModelKey())); - entry.setEntryDetail(tModel); - - // Process test assertions - processAssertions( - classPrefix, - new EntryContext(entry, this.analyzerContext)); - } - - catch (Exception e) - { - // Throw WSIException - if (e instanceof WSIException) - throw (WSIException) e; - else - throw new WSIException( - "An exception occurred while processing the discovery test assertions.", - e); - } - - // Cleanup - cleanup(); - - // Get WSDL location - wsdlURL = this.analyzerContext.getServiceReference().getWSDLLocation(); - - // Return WSDL URL - return wsdlURL; - } - - /** - * Set WSDL binding in the service reference portion of the analyzer context. - */ - protected void setWSDLBinding(Binding binding) - { - String bindingName = - binding == null ? null : binding.getQName().getLocalPart(); - String namespace = - binding == null ? null : binding.getQName().getNamespaceURI(); - - // Set the WSDL document location in analyzerContext - ServiceReference serviceReference = - this.analyzerContext.getServiceReference(); - - // If the wsdlElement does not exist, then set it - WSDLElement wsdlElement; - if ((wsdlElement = serviceReference.getWSDLElement()) == null) - { - // Get the WSDL binding from the overviewURL and set in analyzerContext - wsdlElement = new WSDLElementImpl(); - wsdlElement.setName(bindingName); - wsdlElement.setNamespace(namespace); - wsdlElement.setType(EntryType.TYPE_DESCRIPTION_BINDING); - } - - // Set the wsdlElement in the service reference - serviceReference.setWSDLElement(wsdlElement); - - // Set the service reference back into the analyzerContext - analyzerContext.setServiceReference(serviceReference); - } - - /** - * Set the WSDL location in the service reference portion of the analyzer context. - */ - protected void setWSDLLocation(String wsdlURL) - { - // Set the WSDL document location in analyzerContext - ServiceReference serviceReference = - this.analyzerContext.getServiceReference(); - serviceReference.setWSDLLocation(wsdlURL); - - // Set the service reference back into the analyzerContext - analyzerContext.setServiceReference(serviceReference); - } - - /** - * Find the wsdlSpec tModel associated with a binding. - */ - private TModel findTModel( - UDDIProxy uddiProxy, - BindingTemplate bindingTemplate) - throws WSIException - { - TModel tModel = null; - - // Get the list of tModel references associated with this bindingTemplate - Iterator iterator = - bindingTemplate - .getTModelInstanceDetails() - .getTModelInstanceInfoVector() - .iterator(); - - // Process each tModel reference - Vector tModelKeyList = new Vector(); - while (iterator.hasNext()) - { - // Get tModelInstanceInfo - TModelInstanceInfo tModelInstanceInfo = - (TModelInstanceInfo) iterator.next(); - - // Add key to list - tModelKeyList.add(tModelInstanceInfo.getTModelKey()); - } - - // Get the tModels associated with the bindingTemplate - if (tModelKeyList.size() > 0) - { - try - { - // Get the tModel details - TModelDetail tModelDetail = uddiProxy.get_tModelDetail(tModelKeyList); - - // Get the list of tModels - Iterator tModelIterator = tModelDetail.getTModelVector().iterator(); - - //boolean tModelFound = false; - TModel nextTModel = null; - - // Go through the list of tModels - while ((tModelIterator.hasNext()) && (tModel == null)) - { - // Get next tModel in list - nextTModel = (TModel) tModelIterator.next(); - - if (verboseOption) - { - System.err.println( - " TModel referenced from bindingTemplate - " - + UDDIUtils.tModelToString(nextTModel)); - } - - // If this is a wsdlSpec tModel, then this is the tModel we want - if (isWsdlSpec(nextTModel)) - tModel = nextTModel; - } - } - - catch (Exception e) - { - // Throw WSIException - throw new WSIException("Could not get tModel details.", e); - } - } - - else - { - // Throw exception - //throw new WSIException("UDDI bindingTemplate did not contain any tModel references."); - } - - return tModel; - } - - /** - * Determine if this is a wsdlSpec tModel. - */ - protected boolean isWsdlSpec(TModel tModel) - { - boolean tModelFound = false; - CategoryBag categoryBag = null; - Iterator categoryBagIterator = null; - - // Determine if the catetgoryBag contains wsdlSpec - if ((categoryBag = tModel.getCategoryBag()) != null) - { - // Get the list of keyed references - categoryBagIterator = categoryBag.getKeyedReferenceVector().iterator(); - - KeyedReference keyedReference = null; - - // Go through the list of keyed references - while (categoryBagIterator.hasNext() && !(tModelFound)) - { - // Get next keyed reference - keyedReference = (KeyedReference) categoryBagIterator.next(); - - // If this is a types taxonomy tModel and the value is wsdlSpec, then this is the tModel we want - // REMOVE: It is not necessary to check the key name - //if (keyedReference.getTModelKey().equalsIgnoreCase(TModel.TYPES_TMODEL_KEY) && - // "wsdlSpec".equals(keyedReference.getKeyValue()) && - // ("types".equals(keyedReference.getKeyName()) || - // "uddi-org:types".equals(keyedReference.getKeyName()))) { - // tModelFound = true; - //} - if (keyedReference - .getTModelKey() - .equalsIgnoreCase(TModel.TYPES_TMODEL_KEY) - && "wsdlSpec".equals(keyedReference.getKeyValue())) - { - tModelFound = true; - } - } - } - - return tModelFound; - } - - /** - * Get an OverviewURL from tModel. - */ - protected String getOverviewURL(TModel tModel) - { - if (tModel != null - && tModel.getOverviewDoc() != null - && tModel.getOverviewDoc().getOverviewURL() != null) - { - return tModel.getOverviewDoc().getOverviewURL().getText(); - } - return null; - } - - /** - * Get WSDL document. - */ - protected String getWSDLLocation(String wsdlLocation) - { - int index; - - // Check if the overviewURL contains a fragment identifier - if ((index = wsdlLocation.indexOf("#")) > -1) - { - wsdlLocation = wsdlLocation.substring(0, index); - } - return wsdlLocation; - } - - /** - * Get WSDL document. - */ - protected WSDLDocument getWSDLDocument(String wsdlLocation) - throws MalformedURLException, WSDLException - { - return new WSDLDocument(getWSDLLocation(wsdlLocation)); - } - - /** - * Get WSDL binding from the overviewURL in the tModel. - */ - protected Binding getBinding(String overviewURL, WSDLDocument wsdlDocument) - { - int index; - int nameIndex; - - Binding[] bindings = wsdlDocument.getBindings(); - if (bindings == null || bindings.length == 0) - return null; - - if (overviewURL != null) - { - // Check if the overviewURL contains a fragment identifier - if ((index = overviewURL.indexOf("#")) > -1) - { - // TEMP: Need to use a real XPath evaluator like Xalan - String nameAttribute = "@name="; - - // Locate name reference - if ((nameIndex = - overviewURL.substring(index + 1).indexOf(nameAttribute)) - > -1) - { - // Get the next character which should be a quote - int firstQuoteIndex = index + 1 + nameIndex + nameAttribute.length(); - String quote = - overviewURL.substring(firstQuoteIndex, firstQuoteIndex + 1); - - // Get the part of the URL which should contain the binding name - String urlPart = overviewURL.substring(firstQuoteIndex + 1); - - // Find the next quote - int nextQuoteIndex; - if ((nextQuoteIndex = urlPart.indexOf(quote)) > -1) - { - String bindingName = urlPart.substring(0, nextQuoteIndex); - //look for binding with the specified name - for (int i = 0; i < bindings.length; i++) - { - if (bindingName.equals(bindings[i].getQName().getLocalPart())) - return bindings[i]; - } - } - } - } - } - - return bindings[0]; - } - - /** - * Get string representation of categoryBag. - * @param categoryBag a CategoryBag object. - * @return string representation of categoryBag. - */ - protected String categoryBagToString(CategoryBag categoryBag) - { - String toString = ""; - - if (categoryBag != null) - { - Vector keyedReferenceList = null; - if (((keyedReferenceList = categoryBag.getKeyedReferenceVector()) - == null) - || (keyedReferenceList.size() == 0)) - { - toString += "No KeyedReferences"; - } - - else - { - int count = 1; - KeyedReference keyedReference; - Iterator iterator = keyedReferenceList.iterator(); - while (iterator.hasNext()) - { - keyedReference = (KeyedReference) iterator.next(); - toString += "\n [" - + count++ - + "] tModelKey: " - + keyedReference.getTModelKey() - + ", keyName: " - + keyedReference.getKeyName() - + ", keyValue: " - + keyedReference.getKeyValue(); - } - } - } - else - { - toString = "null"; - } - - return toString; - } - - /* (non-Javadoc) - * @see org.wsi.test.profile.validator.impl.BaseValidatorImpl#isPrimaryEntryTypeMatch(org.wsi.test.profile.TestAssertion, org.wsi.test.profile.validator.EntryContext) - */ - protected boolean isPrimaryEntryTypeMatch( - TestAssertion testAssertion, - EntryContext targetContext) - { - boolean match = false; - - // If the test assertion entry type matches the target context entry type, then contine - if (testAssertion - .getEntryTypeName() - .equals(targetContext.getEntry().getEntryType().getTypeName())) - { - match = true; - } - - return match; - } - - /* (non-Javadoc) - * @see org.wsi.test.profile.validator.impl.BaseValidatorImpl#isNotApplicable(org.wsi.test.profile.TestAssertion) - */ - protected boolean isNotApplicable(TestAssertion testAssertion) - { - boolean notApplicable = false; - - // ADD: - - return notApplicable; - } - -} diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/uddi/WSI3001.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/uddi/WSI3001.java deleted file mode 100644 index de684b032..000000000 --- a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/uddi/WSI3001.java +++ /dev/null @@ -1,26 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002-2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are 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: - * IBM - Initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.wsi.internal.core.profile.validator.impl.uddi; - -/** - * WSI3001 - */ -public class WSI3001 extends BP3001 -{ - - /** - * @param UDDIValidatorImpl - */ - public WSI3001(UDDIValidatorImpl impl) - { - super(impl); - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/uddi/WSI3002.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/uddi/WSI3002.java deleted file mode 100644 index c08dd2e9c..000000000 --- a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/uddi/WSI3002.java +++ /dev/null @@ -1,26 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002-2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are 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: - * IBM - Initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.wsi.internal.core.profile.validator.impl.uddi; - -/** - * WSI3002 - */ -public class WSI3002 extends BP3002 -{ - - /** - * @param UDDIValidatorImpl - */ - public WSI3002(UDDIValidatorImpl impl) - { - super(impl); - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/uddi/WSI3003.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/uddi/WSI3003.java deleted file mode 100644 index deb0176b3..000000000 --- a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/uddi/WSI3003.java +++ /dev/null @@ -1,26 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002-2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are 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: - * IBM - Initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.wsi.internal.core.profile.validator.impl.uddi; - -/** - * WSI3003 - */ -public class WSI3003 extends BP3003 -{ - - /** - * @param UDDIValidatorImpl - */ - public WSI3003(UDDIValidatorImpl impl) - { - super(impl); - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/uddi/WSI3004.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/uddi/WSI3004.java deleted file mode 100644 index 065480e3d..000000000 --- a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/uddi/WSI3004.java +++ /dev/null @@ -1,290 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002-2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are 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: - * IBM - Initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.wsi.internal.core.profile.validator.impl.uddi; - -import java.util.HashMap; -import java.util.HashSet; -import java.util.Iterator; -import java.util.Map; -import java.util.Vector; - -import javax.wsdl.Binding; -import javax.wsdl.Port; - -import org.eclipse.wst.wsi.internal.core.WSIException; -import org.eclipse.wst.wsi.internal.core.WSITag; -import org.eclipse.wst.wsi.internal.core.profile.TestAssertion; -import org.eclipse.wst.wsi.internal.core.profile.validator.EntryContext; -import org.eclipse.wst.wsi.internal.core.profile.validator.impl.AssertionProcessVisitor; -import org.eclipse.wst.wsi.internal.core.report.AssertionResult; -import org.eclipse.wst.wsi.internal.core.util.UDDIUtils; -import org.eclipse.wst.wsi.internal.core.wsdl.WSDLDocument; -import org.eclipse.wst.wsi.internal.core.wsdl.traversal.WSDLTraversal; -import org.eclipse.wst.wsi.internal.core.wsdl.traversal.WSDLTraversalContext; -import org.eclipse.wst.wsi.internal.core.xml.XMLUtils; -import org.uddi4j.datatype.tmodel.TModel; -import org.uddi4j.util.CategoryBag; -import org.uddi4j.util.KeyedReference; -import org.w3c.dom.Element; - - -/** - * WSI3004 - The conformance claims in the uddi:tModel are the same - * as those in the wsdl:binding which is referenced by the uddi:tModel. - */ -public class WSI3004 extends AssertionProcessVisitor implements WSITag -{ - private final UDDIValidatorImpl validator; - - /** - * @param UDDIValidatorImpl - */ - public WSI3004(UDDIValidatorImpl impl) - { - super(impl); - this.validator = impl; - } - - private static final String PORTS_PARAM = "ports"; - private static final String BINDING_PARAM = "binding"; - - /** - * Gets WSI conformance claims from a tModel. - * @param tModel - * @return HashSet - * @throws WSIException - */ - private HashSet getConformanceClaimsFromUDDI(TModel tModel) - throws WSIException - { - String conformanceKey = UDDIUtils.getWSIConformanceTModelKey(validator.uddiProxy); - - HashSet result = new HashSet(); - - CategoryBag bag = tModel.getCategoryBag(); - if (bag != null) - { - Vector references = bag.getKeyedReferenceVector(); - for (int i = 0; i < references.size(); i++) - { - KeyedReference ref = (KeyedReference) references.get(i); - - if (ref.getTModelKey().equalsIgnoreCase(conformanceKey)) - { - result.add(ref.getKeyValue()); - } - } - } - - return result; - } - - /** - * Gets WSI conformance claims from WSDL binding - * that references specified tModel. Additionally, - * WSDL ports, which uses the binding, are processed. - * - * @param tModel - * @return HashSet - */ - private HashSet getConformanceClaimsFromWSDL(TModel tModel) - { - HashSet result = new HashSet(); - - try - { - // Read the WSDL document - String overviewURL = validator.getOverviewURL(tModel); - WSDLDocument wsdlDocument = validator.getWSDLDocument(overviewURL); - - // Get binding - Binding binding = validator.getBinding(overviewURL, wsdlDocument); - String bindingName = binding.getQName().getLocalPart(); - - // Get claims - result = - getClaimsFromElement(binding.getDocumentationElement(), result); - - // Get ports, which reference this binding, because: - // "A claim on a wsdl:port is inherited by the referenced wsdl:bindings." - Vector ports = getPorts(wsdlDocument, bindingName); - for (int i = 0; i < ports.size(); i++) - { - Port port = (Port) ports.get(i); - - result = getClaimsFromElement(port.getDocumentationElement(), result); - } - } - catch (Exception e) - { - // ADD: - } - - return result; - } - - /** - * Gets WSI conformance claims from the 'documentation' XML element - * and puts them into the HashSet. - * @param docElement - * @param result - * @return HashSet - */ - private HashSet getClaimsFromElement(Element docElement, HashSet result) - { - if (result == null) - { - result = new HashSet(); - } - - if (docElement != null) - { - Element claimElement = XMLUtils.findChildElement(docElement, WSI_CLAIM); - while (claimElement != null) - { - /* - Node attr = XMLUtils.getAttribute(claimElement, ATTR_CLAIM_CONFORMSTO); - if (attr != null) - result.add(attr.getNodeValue()); - */ - String value = - claimElement.getAttribute(ATTR_CLAIM_CONFORMSTO.getLocalPart()); - if (value != null) - result.add(value); - - claimElement = XMLUtils.findElement(claimElement, WSI_CLAIM); - } - } - - return result; - } - - /** - * Gets wsdl:ports, which use specified binding. - * @param wsdlDocument - * @param bindingName - * @return Vector - */ - private Vector getPorts(WSDLDocument wsdlDocument, String bindingName) - { - Vector ports = new Vector(); - - Map params = new HashMap(); - params.put(PORTS_PARAM, ports); - params.put(BINDING_PARAM, bindingName); - - WSDLTraversal traversal = new WSDLTraversal(); - //VisitorAdaptor.adapt(this); - traversal.setVisitor(this); - traversal.visitPort(true); - traversal.ignoreReferences(); - traversal.ignoreImport(); - traversal.traverse(wsdlDocument.getDefinitions(), params); - - return ports; - } - - /* (non-Javadoc) - * @see org.wsi.wsdl.traversal.WSDLVisitor#visit(javax.wsdl.Port, java.lang.Object, org.wsi.wsdl.traversal.WSDLTraversalContext) - */ - public void visit(Port port, Object parent, WSDLTraversalContext ctx) - { - if (port - .getBinding() - .getQName() - .getLocalPart() - .equals(ctx.getParameter(BINDING_PARAM).toString())) - { - ((Vector) ctx.getParameter(PORTS_PARAM)).add(port); - } - } - - /* (non-Javadoc) - * @see org.wsi.test.profile.validator.impl.BaseValidatorImpl.AssertionProcess#validate(org.wsi.test.profile.TestAssertion, org.wsi.test.profile.validator.EntryContext) - */ - public AssertionResult validate( - TestAssertion testAssertion, - EntryContext entryContext) - throws WSIException - { - result = AssertionResult.RESULT_PASSED; - - // Get the tModel from the entryContext - TModel tModel = (TModel) entryContext.getEntry().getEntryDetail(); - - // If the tModel does not exist, then fail - if (tModel == null) - { - result = AssertionResult.RESULT_FAILED; - failureDetailMessage = "Could not locate a tModel."; - } - - // If there is a tModel - else - { - try - { - HashSet claimsFromUDDI = getConformanceClaimsFromUDDI(tModel); - HashSet claimsFromWSDL = getConformanceClaimsFromWSDL(tModel); - - if (claimsFromUDDI.size() == 0) - { - result = AssertionResult.RESULT_PASSED; - } - else if (claimsFromUDDI.size() == claimsFromWSDL.size()) - { - int counter = 0; - for (Iterator iter = claimsFromWSDL.iterator(); iter.hasNext();) - { - String claim = (String) iter.next(); - - for (Iterator iter2 = claimsFromUDDI.iterator(); - iter2.hasNext(); - ) - { - String uddiClaim = (String) iter2.next(); - if (claim.equalsIgnoreCase(uddiClaim)) - { - counter++; - break; - } - } - } - - if (counter != claimsFromWSDL.size()) - { - // failed - result = AssertionResult.RESULT_FAILED; - failureDetailMessage = - "The tModel key is: [" + tModel.getTModelKey() + "]."; - } - } - else - { - // failed - result = AssertionResult.RESULT_FAILED; - failureDetailMessage = - "The tModel key is: [" + tModel.getTModelKey() + "]."; - } - } - catch (IllegalStateException e) - { - result = AssertionResult.RESULT_FAILED; - failureDetailMessage = - "The tModel key is: [" + tModel.getTModelKey() + "]."; - } - - } - - // Return assertion result - return validator.createAssertionResult(testAssertion, result, failureDetailMessage); - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/uddi/WSI3005_OBSOLETE.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/uddi/WSI3005_OBSOLETE.java deleted file mode 100644 index fc6f5a47b..000000000 --- a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/uddi/WSI3005_OBSOLETE.java +++ /dev/null @@ -1,119 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002-2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are 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: - * IBM - Initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.wsi.internal.core.profile.validator.impl.uddi; - -import java.util.Vector; - -import org.eclipse.wst.wsi.internal.core.WSIException; -import org.eclipse.wst.wsi.internal.core.profile.TestAssertion; -import org.eclipse.wst.wsi.internal.core.profile.validator.EntryContext; -import org.eclipse.wst.wsi.internal.core.profile.validator.impl.AssertionProcess; -import org.eclipse.wst.wsi.internal.core.report.AssertionResult; -import org.eclipse.wst.wsi.internal.core.util.UDDIUtils; -import org.uddi4j.client.UDDIProxy; -import org.uddi4j.datatype.tmodel.TModel; -import org.uddi4j.util.CategoryBag; -import org.uddi4j.util.KeyedReference; - - -/** - * WSI3005_OBSOLETE - A uddi:tModel which claims conformance with a WS-I profile - * must be categorized using the ws-i-org:conformsTo taxonomy. - */ -public class WSI3005_OBSOLETE extends AssertionProcess -{ - private final UDDIValidatorImpl validator; - - /** - * @param UDDIValidatorImpl - */ - public WSI3005_OBSOLETE(UDDIValidatorImpl impl) - { - super(impl); - this.validator = impl; - } - - /** - * Validates the test assertion. - * @see org.eclipse.wst.wsi.test.profile.validator.impl.BaseValidatorImpl.AssertionProcess#validate(org.wsi.test.profile.TestAssertion, org.wsi.test.profile.validator.EntryContext) - */ - public AssertionResult validate( - TestAssertion testAssertion, - EntryContext entryContext) - throws WSIException - { - - result = AssertionResult.RESULT_PASSED; - - // Get the tModel from the entryContext - TModel tModel = (TModel) entryContext.getEntry().getEntryDetail(); - - // If the tModel does not exist, then fail - if (tModel == null) - { - result = AssertionResult.RESULT_FAILED; - failureDetailMessage = "Could not locate a tModel."; - } - - // If there is a tModel - else - { - CategoryBag bag = tModel.getCategoryBag(); - - try - { - if (!checkCategoryBag(this.validator.uddiProxy, bag)) - { - // failed - result = AssertionResult.RESULT_FAILED; - failureDetailMessage = - "The tModel key is: [" + tModel.getTModelKey() + "]."; - } - } - catch (IllegalStateException e) - { - result = AssertionResult.RESULT_FAILED; - failureDetailMessage = - "The UDDI registry does not contain WSI conformance taxonomy" - + " tModel (\"ws-i-org:conformsTo:2002_12\")."; - } - } - - // Return assertion result - return validator.createAssertionResult(testAssertion, result, failureDetailMessage); - } - - /** - * Checks a category bag. - * @param proxy - * @param bag - * @return boolean - */ - private boolean checkCategoryBag(UDDIProxy proxy, CategoryBag bag) - { - String conformanceKey = UDDIUtils.getWSIConformanceTModelKey(proxy); - - boolean result = false; - - if (bag != null) - { - Vector references = bag.getKeyedReferenceVector(); - for (int i = 0; i < references.size() && !result; i++) - { - KeyedReference ref = (KeyedReference) references.get(i); - - result = ref.getTModelKey().equalsIgnoreCase(conformanceKey); - } - } - - return result; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/uddi/WSI3006.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/uddi/WSI3006.java deleted file mode 100644 index aa8c00318..000000000 --- a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/uddi/WSI3006.java +++ /dev/null @@ -1,165 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002-2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are 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: - * IBM - Initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.wsi.internal.core.profile.validator.impl.uddi; - -import java.util.Vector; - -import org.eclipse.wst.wsi.internal.core.WSIConstants; -import org.eclipse.wst.wsi.internal.core.WSIException; -import org.eclipse.wst.wsi.internal.core.analyzer.AssertionResultException; -import org.eclipse.wst.wsi.internal.core.profile.TestAssertion; -import org.eclipse.wst.wsi.internal.core.profile.validator.EntryContext; -import org.eclipse.wst.wsi.internal.core.profile.validator.impl.AssertionProcess; -import org.eclipse.wst.wsi.internal.core.report.AssertionResult; -import org.eclipse.wst.wsi.internal.core.util.UDDIUtils; -import org.uddi4j.client.UDDIProxy; -import org.uddi4j.datatype.tmodel.TModel; -import org.uddi4j.util.CategoryBag; -import org.uddi4j.util.KeyedReference; - - -/** - * WSI3006 - The uddi:tModel uses the ws-i-org:conformsTo:2002_12 categorization - * value of "http://ws-i.org/profiles/base/1.0". The categoryBag in the tModel - * contains a keyedReference with a tModelKey that contains the key value - * uuid:65719168-72c6-3f29-8c20-62defb0961c0 for the ws-i-org:conformsTo:2002_12 - * tModel. - */ -public class WSI3006 extends AssertionProcess -{ - private final UDDIValidatorImpl validator; - /** - * @param UDDIValidatorImpl - */ - public WSI3006(UDDIValidatorImpl impl) - { - super(impl); - this.validator = impl; - } - - /** - * Validates the test assertion. - * @see org.eclipse.wst.wsi.test.profile.validator.impl.BaseValidatorImpl.AssertionProcess#validate(org.wsi.test.profile.TestAssertion, org.wsi.test.profile.validator.EntryContext) - */ - public AssertionResult validate( - TestAssertion testAssertion, - EntryContext entryContext) - throws WSIException - { - - result = AssertionResult.RESULT_PASSED; - failureDetailMessage = null; - KeyedReference claimKeyedRef = null; - - // check whether a UDDI conformance claim is being made... - - // Get the tModel from the entryContext - TModel tModel = (TModel) entryContext.getEntry().getEntryDetail(); - try - { - if ((claimKeyedRef = conformanceClaimMade(tModel)) == null) - { - throw new AssertionResultException( - AssertionResult.RESULT_NOT_APPLICABLE); - } - - // we have a conformance claim, so check the keyedReference keyValue - if (!claimKeyedRef - .getKeyValue() - .equals(WSIConstants.ATTRVAL_UDDI_CLAIM_KEYVALUE)) - { - throw new AssertionResultException( - AssertionResult.RESULT_FAILED, - "The tModel key is: [" - + tModel.getTModelKey() - + "].\nThe categoryBag is: [" - + tModel.getCategoryBag() - + "]."); - } - } - catch (AssertionResultException e) - { - result = e.getMessage(); - failureDetailMessage = e.getDetailMessage(); - } - - // Return assertion result - return validator.createAssertionResult(testAssertion, result, failureDetailMessage); - } - - /** - * Checks a category bag and extracts KeyedReference containing - * the conformance claim. - * @param proxy - * @param bag - * @return boolean - */ - private KeyedReference checkCategoryBag(UDDIProxy proxy, CategoryBag bag) - { - String conformanceKey = null; - try - { - conformanceKey = UDDIUtils.getWSIConformanceTModelKey(proxy); - } - catch (IllegalStateException ex) - { - return null; - } - - boolean result = true; - KeyedReference conformanceRef = null; - - if (bag != null) - { - Vector references = bag.getKeyedReferenceVector(); - for (int i = 0; i < references.size() && result; i++) - { - KeyedReference ref = (KeyedReference) references.get(i); - - if (ref - .getTModelKey() - .equalsIgnoreCase(conformanceKey) //&& ref.getKeyValue().equals(WSIConstants.ATTRVAL_UDDI_CLAIM_KEYVALUE) - // we need only tModel key - ) - { - result = true; - conformanceRef = ref; - } - } - } - - return conformanceRef; - } - /** - * Gets KeyedReference containing the conformance claim. - * @param tModel - * @return - * @throws WSIException - */ - private KeyedReference conformanceClaimMade(TModel tModel) - throws WSIException - { - - // If the tModel does not exist, then fail - if (tModel == null) - { - throw new IllegalArgumentException("tModel cannot be null"); - } - - // If there is a tModel - else - { - CategoryBag bag = tModel.getCategoryBag(); - return checkCategoryBag(this.validator.uddiProxy, bag); - } - - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/uddi/WSI3007.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/uddi/WSI3007.java deleted file mode 100644 index 06674dd9b..000000000 --- a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/uddi/WSI3007.java +++ /dev/null @@ -1,155 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002-2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are 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: - * IBM - Initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.wsi.internal.core.profile.validator.impl.uddi; - -import java.util.Vector; - -import org.eclipse.wst.wsi.internal.core.WSIException; -import org.eclipse.wst.wsi.internal.core.profile.TestAssertion; -import org.eclipse.wst.wsi.internal.core.profile.validator.EntryContext; -import org.eclipse.wst.wsi.internal.core.profile.validator.impl.AssertionProcess; -import org.eclipse.wst.wsi.internal.core.report.AssertionResult; -import org.eclipse.wst.wsi.internal.core.util.UDDIUtils; -import org.uddi4j.client.UDDIProxy; -import org.uddi4j.datatype.binding.BindingTemplate; -import org.uddi4j.datatype.business.BusinessEntity; -import org.uddi4j.datatype.service.BusinessService; -import org.uddi4j.util.CategoryBag; -import org.uddi4j.util.KeyedReference; - - -/** - * WSI3007 - A uddi:businessEntity or uddi:businessService associated - * with this uddi:bindingTemplate is not categorized using - * the ws-i-org:conformsTo:2002_12 taxonomy. - */ -public class WSI3007 extends AssertionProcess -{ - private final UDDIValidatorImpl validator; - - /** - * @param UDDIValidatorImpl - */ - public WSI3007(UDDIValidatorImpl impl) - { - super(impl); - this.validator = impl; - } - - /** - * Validates the test assertion. - * @see org.eclipse.wst.wsi.test.profile.validator.impl.BaseValidatorImpl.AssertionProcess#validate(org.wsi.test.profile.TestAssertion, org.wsi.test.profile.validator.EntryContext) - */ - public AssertionResult validate( - TestAssertion testAssertion, - EntryContext entryContext) - throws WSIException - { - result = AssertionResult.RESULT_PASSED; - - // Get the bindingTemplate from the entryContext - BindingTemplate bindingTemplate = - (BindingTemplate) entryContext.getEntry().getEntryDetail(); - - boolean validService = false; - boolean validBusiness = false; - - String serviceKey = null; - String businessKey = null; - try - { - serviceKey = bindingTemplate.getServiceKey(); - BusinessService service = - UDDIUtils.getBusinessServiceByKey(this.validator.uddiProxy, serviceKey); - - businessKey = service.getBusinessKey(); - BusinessEntity business = - UDDIUtils.getBusinessByKey(this.validator.uddiProxy, businessKey); - - validService = checkCategoryBag(this.validator.uddiProxy, service.getCategoryBag()); - validBusiness = checkCategoryBag(this.validator.uddiProxy, business.getCategoryBag()); - - if (!validBusiness || !validService) - { - result = AssertionResult.RESULT_FAILED; - - if (!validBusiness) - { - failureDetailMessage = - "The businessEntity key is: [" + businessKey + "]."; - } - - if (!validService) - { - if (!validBusiness) - failureDetailMessage += " "; - else - failureDetailMessage = ""; - - failureDetailMessage += "The businessService key is: [" - + serviceKey - + "]."; - } - } - } - catch (IllegalStateException e) - { - result = AssertionResult.RESULT_FAILED; - failureDetailMessage = - "The UDDI registry does not contain WSI conformance taxonomy" - + " tModel (\"ws-i-org:conformsTo:2002_12\")."; - } - catch (Throwable e) - { - throw new WSIException( - "An exception occurred while processing the discovery test assertions.", - e); - } - - // Return assertion result - return validator.createAssertionResult(testAssertion, result, failureDetailMessage); - } - - /** - * Checks whether the category bag contains the conformance claim. - * Returns <b>true</b> if the bag does not contain the conformance claim. - * @param proxy - * @param bag - * @return boolean - */ - private boolean checkCategoryBag(UDDIProxy proxy, CategoryBag bag) - { - String conformanceKey = null; - try - { - conformanceKey = UDDIUtils.getWSIConformanceTModelKey(proxy); - } - catch (IllegalStateException ex) - { - return false; - } - - boolean result = true; - - if (bag != null) - { - Vector references = bag.getKeyedReferenceVector(); - for (int i = 0; i < references.size() && result; i++) - { - KeyedReference ref = (KeyedReference) references.get(i); - - result = !ref.getTModelKey().equalsIgnoreCase(conformanceKey); - } - } - - return result; - } -}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/uddi/WSI3021.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/uddi/WSI3021.java deleted file mode 100644 index 085352d2f..000000000 --- a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/uddi/WSI3021.java +++ /dev/null @@ -1,115 +0,0 @@ -/******************************************************************************* - * Copyright (c) 2002-2005 IBM Corporation and others. - * All rights reserved. This program and the accompanying materials - * are 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: - * IBM - Initial API and implementation - *******************************************************************************/ -package org.eclipse.wst.wsi.internal.core.profile.validator.impl.uddi; - -import java.util.Vector; - -import org.eclipse.wst.wsi.internal.core.WSIException; -import org.eclipse.wst.wsi.internal.core.profile.TestAssertion; -import org.eclipse.wst.wsi.internal.core.profile.validator.EntryContext; -import org.eclipse.wst.wsi.internal.core.profile.validator.impl.AssertionProcess; -import org.eclipse.wst.wsi.internal.core.report.AssertionResult; -import org.eclipse.wst.wsi.internal.core.util.UDDIUtils; -import org.uddi4j.datatype.tmodel.TModel; -import org.uddi4j.util.CategoryBag; -import org.uddi4j.util.KeyedReference; - - -/** -* WSI3021 - The uddi:tModel has a "name" element of value "ws-i-org:conformsTo:2002_12" , -* has an overviewURL value of "http://ws-i.org/schemas/conformanceClaim/", and has -* a keyedReference element with keyName attribute value of "uddi-org:types:categorization". -*/ -public class WSI3021 extends AssertionProcess -{ - private final UDDIValidatorImpl validator; - - /** - * @param UDDIValidatorImpl - */ - public WSI3021(UDDIValidatorImpl impl) - { - super(impl); - this.validator = impl; - } - - /** - * Validates the test assertion. - * @see org.eclipse.wst.wsi.test.profile.validator.impl.BaseValidatorImpl.AssertionProcess#validate(org.wsi.test.profile.TestAssertion, org.wsi.test.profile.validator.EntryContext) - */ - public AssertionResult validate( - TestAssertion testAssertion, - EntryContext entryContext) - throws WSIException - { - result = AssertionResult.RESULT_FAILED; - - TModel tModel = - UDDIUtils.getTModelByKey( - this.validator.uddiProxy, - UDDIUtils.getWSIConformanceTModelKey(this.validator.uddiProxy)); - - // If the tModel does not exist, then fail - if (tModel == null) - { - result = AssertionResult.RESULT_FAILED; - failureDetailMessage = "Could not locate a tModel."; - } - else - { - boolean validURL = - tModel.getOverviewDoc() != null - && "http://ws-i.org/schemas/conformanceClaim/".equals( - tModel.getOverviewDoc().getOverviewURLString()); - boolean validCategory = checkCategoryBag(tModel.getCategoryBag()); - - if (validURL && validCategory) - { - result = AssertionResult.RESULT_PASSED; - } - else - { - result = AssertionResult.RESULT_FAILED; - failureDetailMessage = this.validator.uddiReference.getInquiryURL(); - } - } - - // Return assertion result - return validator.createAssertionResult(testAssertion, result, failureDetailMessage); - } - - /** - * Checks whether the category bag meets the WSI's requirements. - * @param bag - * @return - */ - private boolean checkCategoryBag(CategoryBag bag) - { - boolean result = false; - - if (bag != null) - { - Vector references = bag.getKeyedReferenceVector(); - for (int i = 0; i < references.size() && !result; i++) - { - KeyedReference ref = (KeyedReference) references.get(i); - - result = - "uddi-org:types:categorization".equals(ref.getKeyName()) - && "categorization".equals(ref.getKeyValue()) - && "uuid:C1ACF26D-9672-4404-9D70-39B756E62AB4".equals( - ref.getTModelKey()); - } - } - - return result; - } -}
\ No newline at end of file |