diff options
Diffstat (limited to 'bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message')
88 files changed, 6719 insertions, 0 deletions
diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/AP1003.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/AP1003.java new file mode 100644 index 000000000..53ff37299 --- /dev/null +++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/AP1003.java @@ -0,0 +1,59 @@ +/******************************************************************************* + * 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.message; + +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.BaseMessageValidator; +import org.eclipse.wst.wsi.internal.core.report.AssertionResult; + +/** + * AP1003 + * + * <context>For a candidate non-multipart/related message in the log file, which has a non-empty entity-body</context> + * <assertionDescription> + * The logged SOAP envelope is a UTF-8 transcript of an envelope originally encoded as UTF-8 or UTF-16. + * The HTTP Content-Type header's charset value is either UTF-8 or UTF-16. Looking at the messageContent + * element of the logged message, either + * (1) it has a BOM attribute which maps the charset value in the Content-Type header, or + * (2) it has it has an XML declaration which matches the charset value in the Content-Type header, or + * (3) there is no BOM attribute and no XML declaration, and the charset value is UTF-8. + * </assertionDescription> + * + * @author lauzond + */ +public class AP1003 extends SSBP1003 { + + /** + * @param impl + */ + public AP1003(BaseMessageValidator impl) + { + super(impl); + } + + public AssertionResult validate( + TestAssertion testAssertion, + EntryContext entryContext) + throws WSIException + { + // If there is a SOAP Message with Attachments, the assertion is not applicable + if (entryContext.getMessageEntry().isMimeContent()) + { + return validator.createAssertionResult(testAssertion, AssertionResult.RESULT_NOT_APPLICABLE, failureDetail); + } + else + { + return super.validate(testAssertion, entryContext); + } + } +} diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/AP1902.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/AP1902.java new file mode 100644 index 000000000..bd900e6f9 --- /dev/null +++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/AP1902.java @@ -0,0 +1,124 @@ +/******************************************************************************* + * 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.message; + +import java.util.List; + +import javax.wsdl.BindingOperation; +import javax.wsdl.extensions.ExtensibilityElement; + +import org.eclipse.wst.wsi.internal.core.WSIException; +import org.eclipse.wst.wsi.internal.core.WSITag; +import org.eclipse.wst.wsi.internal.core.analyzer.AssertionFailException; +import org.eclipse.wst.wsi.internal.core.analyzer.AssertionNotApplicableException; +import org.eclipse.wst.wsi.internal.core.log.MessageEntry; +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.profile.validator.impl.BaseMessageValidator; +import org.eclipse.wst.wsi.internal.core.report.AssertionResult; + +/** + * AP1902 + * + * <context>For a candidate message</context> + * <assertionDescription>In a description, if the wsdl:input or wsdl:output + * element in the wsdl:binding specifies WSDL MIME binding, then the message + * can contain SOAP attachments.</assertionDescription> + */ +public class AP1902 extends AssertionProcess implements WSITag +{ + private final BaseMessageValidator validator; + + /** + * @param WSDLValidatorImpl + */ + public AP1902(BaseMessageValidator impl) + { + super(impl); + this.validator = impl; + } + + /* Validates the test assertion. + * @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 + { + try + { + // Getting an operation matched for a message + BindingOperation bindingOperation = validator.getOperationMatch( + entryContext.getEntry().getEntryType(), + entryContext.getMessageEntryDocument()); + // If no one operation matches, the assertion is not applicable + if (bindingOperation == null) + throw new AssertionNotApplicableException(); + // Getting the corresponding extensibility elements + List extElems; + String type; + if (MessageEntry.TYPE_REQUEST + .equals(entryContext.getEntry().getEntryType())) + { + type = "input"; + extElems = bindingOperation.getBindingInput() == null ? null + : bindingOperation.getBindingInput().getExtensibilityElements(); + } + else + { + type = "output"; + extElems = bindingOperation.getBindingOutput() == null ? null + : bindingOperation.getBindingOutput().getExtensibilityElements(); + } + // If the MIME binding is not used, but the message has + // at least one non-root MIME part, the assertion failed + if (!usesMimeBinding(extElems) + && entryContext.getMessageEntry().getMimeParts().count() > 1) + { + throw new AssertionFailException("The wsdl:" + type + " of the \"" + + bindingOperation.getName() + "\" binding operation."); + } + } + catch (AssertionNotApplicableException anae) + { + result = AssertionResult.RESULT_NOT_APPLICABLE; + } + catch (AssertionFailException afe) + { + result = AssertionResult.RESULT_FAILED; + failureDetail = validator.createFailureDetail( + afe.getMessage(), entryContext); + } + // Return assertion result + return validator.createAssertionResult( + testAssertion, result, failureDetail); + } + + /** + * Checks whether the first extensibility element is mime:multipartRelated. + * @param extElems a list of extensibility elements. + * @return true if the element is mime:multipartRelated, false otherwise + */ + private boolean usesMimeBinding(List extElems) { + // If the first extensibility element is mime:multipartRelated, + // return true + if (extElems != null && extElems.size() > 0 + && ((ExtensibilityElement)extElems.get(0)) + .getElementType().equals(WSDL_MIME_MULTIPART)) + { + return true; + } + // otherwise return false + return false; + } +}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/AP1915.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/AP1915.java new file mode 100644 index 000000000..e85297608 --- /dev/null +++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/AP1915.java @@ -0,0 +1,136 @@ +/******************************************************************************* + * 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.message; + +import org.eclipse.wst.wsi.internal.core.WSIConstants; +import org.eclipse.wst.wsi.internal.core.WSIException; +import org.eclipse.wst.wsi.internal.core.analyzer.AssertionFailException; +import org.eclipse.wst.wsi.internal.core.log.MimePart; +import org.eclipse.wst.wsi.internal.core.log.MimeParts; +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.profile.validator.impl.BaseMessageValidator; +import org.eclipse.wst.wsi.internal.core.report.AssertionResult; +import org.eclipse.wst.wsi.internal.core.util.MIMEConstants; +import org.eclipse.wst.wsi.internal.core.util.MIMEUtils; +import org.eclipse.wst.wsi.internal.core.util.Utils; + +/** + * AP1915 + * + * <context>For a candidate root-part of a multipart/related message</context> + * <assertionDescription>The entity body of the root-part of a + * multipart/related message is serialized using either UTF-8 or UTF-16 + * character encoding.</assertionDescription> + */ +public class AP1915 extends AssertionProcess +{ + private final BaseMessageValidator validator; + + /** + * @param WSDLValidatorImpl + */ + public AP1915(BaseMessageValidator impl) + { + super(impl); + this.validator = impl; + } + + /* Validates the test assertion. + * @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 + { + // get MIME parts + if (!entryContext.getMessageEntry().isMimeContent()) + { + result = AssertionResult.RESULT_NOT_APPLICABLE; + } + else + { + MimeParts mimeParts = entryContext.getMessageEntry().getMimeParts(); + MimePart part = mimeParts.getRootPart(); + if (part == null) + { + result = AssertionResult.RESULT_NOT_APPLICABLE; + } + else + { + String xmlEncoding = null; + String charset = MIMEUtils.getMimeHeaderSubAttribute( + part.getHeaders(), + MIMEConstants.HEADER_CONTENT_TYPE, + "charset"); + try + { + // The HTTP Content-Type header's charset value is either UTF-8 or UTF-16. + if((charset != null) && (charset.equalsIgnoreCase("utf-8") || + charset.equalsIgnoreCase("utf-16"))) + { + // Looking at the messageContent element of the logged message, either + // (1) it has a BOM attribute which maps the charset value in the Content-Type header, or + int bom = 0; + if ((bom = entryContext.getMessageEntry().getBOM()) != 0) + { + if ((bom == WSIConstants.BOM_UTF8 + && !charset.equalsIgnoreCase("utf-8")) + || ((bom == WSIConstants.BOM_UTF16 + && !charset.equalsIgnoreCase("utf-16"))) + || ((bom == WSIConstants.BOM_UTF16_BIG_ENDIAN + && !charset.equalsIgnoreCase("utf-16")))) + { + throw new AssertionFailException("The BOM (" + bom + + ") and charset value (" + charset + ")do not match."); + } + } + // (2) it has an XML declaration which matches the charset value in the Content-Type header, or + else if (((xmlEncoding = + Utils.getXMLEncoding(part.getContent())) != null) && + !xmlEncoding.equals("")) + { + if(!xmlEncoding.equalsIgnoreCase(charset)) + { + throw new AssertionFailException("The XML declaration encoding (" + + xmlEncoding + ") and charset value (" + charset + + ") do not match."); + } + + } + // (3) there is no BOM attribute and no XML declaration, and the charset value is UTF-8. + else if(!charset.equalsIgnoreCase("utf-8")) + { + throw new AssertionFailException("The no BOM attribute and no XML "+ + "declaration, and the charset value is (" + charset + ")"); + } + } + // header do not found or incorrect charset value + else + { + throw new AssertionFailException("Either the Content-Type header is not "+ + "present in the Root Part or a charset value is invalid."); + } + } + catch (AssertionFailException e) + { + result = AssertionResult.RESULT_FAILED; + failureDetail = validator.createFailureDetail(e.getMessage(), entryContext); + } + } + } + // Return assertion result + return validator.createAssertionResult( + testAssertion, result, failureDetail); + } +}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/AP1917.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/AP1917.java new file mode 100644 index 000000000..012d0d6f7 --- /dev/null +++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/AP1917.java @@ -0,0 +1,153 @@ +/******************************************************************************* + * 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.message; + +import java.util.List; + +import javax.wsdl.BindingOperation; +import javax.wsdl.extensions.mime.MIMEMultipartRelated; +import javax.wsdl.extensions.soap.SOAPBody; + +import org.eclipse.wst.wsi.internal.core.WSIConstants; +import org.eclipse.wst.wsi.internal.core.WSIException; +import org.eclipse.wst.wsi.internal.core.analyzer.AssertionFailException; +import org.eclipse.wst.wsi.internal.core.analyzer.AssertionNotApplicableException; +import org.eclipse.wst.wsi.internal.core.log.MessageEntry; +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.profile.validator.impl.BaseMessageValidator; +import org.eclipse.wst.wsi.internal.core.report.AssertionResult; +import org.eclipse.wst.wsi.internal.core.util.HTTPConstants; +import org.eclipse.wst.wsi.internal.core.util.HTTPUtils; + +/** + * AP1917 + * + * <context>For a candidate message containing zero attachment parts</context> + * <assertionDescription>A message containing zero attachment parts is sent + * using a content-type of either "text/xml" as though a SOAP HTTP binding were + * used or "multipart/related" when the WSDL description for the message + * specifies the mime:multipartRelated element on the corresponding wsdl:input + * or wsdl:output element in its wsdl:binding.</assertionDescription> + */ +public class AP1917 extends AssertionProcess +{ + private final BaseMessageValidator validator; + + /** + * @param WSDLValidatorImpl + */ + public AP1917(BaseMessageValidator impl) + { + super(impl); + this.validator = impl; + } + + /* Validates the test assertion. + * @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 + { + try + { + // not applicable if there are attachments + if (entryContext.getMessageEntry().isMimeContent()) + { + if (entryContext.getMessageEntry().getMimeParts().count() > 1) + throw new AssertionNotApplicableException(); + } + + BindingOperation bindingOperation = validator.getOperationMatch( + entryContext.getEntry().getEntryType(), + entryContext.getMessageEntryDocument()); + + // If there is no matched operation, the assertion is not applicable + if (bindingOperation == null) + throw new AssertionNotApplicableException(); + + // Finding operation extensibility elems + // in the binding depending on message type + List extElems = null; + if (entryContext.getMessageEntry().getType().equals( + MessageEntry.TYPE_REQUEST) + && bindingOperation.getBindingInput() != null) + { + extElems = bindingOperation + .getBindingInput().getExtensibilityElements(); + } + else if (entryContext.getMessageEntry().getType().equals( + MessageEntry.TYPE_RESPONSE) + && bindingOperation.getBindingOutput() != null) + { + extElems = bindingOperation + .getBindingOutput().getExtensibilityElements(); + } + + // check list + if((extElems == null) || (extElems.size() == 0)) + { + throw new AssertionNotApplicableException(); + } + + // determine type + boolean isMultiPart = false; + + // if MIMEMultipartRelated then only root-part allowed + if(extElems.get(0) instanceof MIMEMultipartRelated) + { + if(((MIMEMultipartRelated) extElems.get(0)).getMIMEParts().size() != 1) { + throw new AssertionNotApplicableException(); + } + isMultiPart = true; + } + // else if not soapbind:body root element + else if(!(extElems.get(0) instanceof SOAPBody)) + { + throw new AssertionNotApplicableException(); + } + + // get HTTP content type + String contentType = HTTPUtils.getHttpHeaderAttribute( + entryContext.getMessageEntry().getHTTPHeaders(), + HTTPConstants.HEADER_CONTENT_TYPE); + + //allow "text/xml" or + //("multipart/related" and "mime:multipartRelated" WSDL bindings) + if((contentType == null) || + (!contentType.equalsIgnoreCase(WSIConstants.CONTENT_TYPE_MULTIPART) && + !contentType.equalsIgnoreCase(WSIConstants.CONTENT_TYPE_TEXT_XML)) || + ((contentType.equalsIgnoreCase(WSIConstants.CONTENT_TYPE_MULTIPART) && + !isMultiPart))) + { + throw new AssertionFailException("The content-type header field " + + "value \"" + contentType + "\" is incorrect"); + } + } + catch (AssertionNotApplicableException e) + { + result = AssertionResult.RESULT_NOT_APPLICABLE; + } + catch (AssertionFailException e) + { + result = AssertionResult.RESULT_FAILED; + failureDetail = + validator.createFailureDetail(e.getMessage(), entryContext); + } + + // Return assertion result + return validator.createAssertionResult( + testAssertion, result, failureDetail); + } +}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/AP1925.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/AP1925.java new file mode 100644 index 000000000..b01a2b855 --- /dev/null +++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/AP1925.java @@ -0,0 +1,133 @@ +/******************************************************************************* + * 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.message; + +import java.util.List; + +import javax.wsdl.BindingOperation; +import javax.wsdl.extensions.mime.MIMEMultipartRelated; +import org.eclipse.wst.wsi.internal.core.WSIConstants; +import org.eclipse.wst.wsi.internal.core.WSIException; +import org.eclipse.wst.wsi.internal.core.analyzer.AssertionFailException; +import org.eclipse.wst.wsi.internal.core.analyzer.AssertionNotApplicableException; +import org.eclipse.wst.wsi.internal.core.log.MessageEntry; +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.profile.validator.impl.BaseMessageValidator; +import org.eclipse.wst.wsi.internal.core.report.AssertionResult; +import org.eclipse.wst.wsi.internal.core.util.HTTPConstants; +import org.eclipse.wst.wsi.internal.core.util.HTTPUtils; + +/** + * AP1925 + * + * <context>For a candidate message</context> + * <assertionDescription>If the WSDL description lists at least one non-root + * MIME part, then the corresponding message has a Content-Type HTTP header + * field-value with a media-type of "multipart/related.</assertionDescription> + */ +public class AP1925 extends AssertionProcess +{ + private final BaseMessageValidator validator; + + /** + * @param WSDLValidatorImpl + */ + public AP1925(BaseMessageValidator impl) + { + super(impl); + this.validator = impl; + } + + /* Validates the test assertion. + * @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 + { + try + { + BindingOperation bindingOperation = validator.getOperationMatch( + entryContext.getEntry().getEntryType(), + entryContext.getMessageEntryDocument()); + + // If there is no matched operation, the assertion is not applicable + if (bindingOperation == null) + throw new AssertionNotApplicableException(); + + // Finding operation extensibility elems + // in the binding depending on message type + List extElems = null; + if (entryContext.getMessageEntry().getType().equals( + MessageEntry.TYPE_REQUEST) + && bindingOperation.getBindingInput() != null) + { + extElems = bindingOperation + .getBindingInput().getExtensibilityElements(); + } + else if (entryContext.getMessageEntry().getType().equals( + MessageEntry.TYPE_RESPONSE) + && bindingOperation.getBindingOutput() != null) + { + extElems = bindingOperation + .getBindingOutput().getExtensibilityElements(); + } + // check list on first element + if((extElems == null) || (extElems.size() == 0) || + !(extElems.get(0) instanceof MIMEMultipartRelated)) + throw new AssertionNotApplicableException(); + + // get list mime parts from definition + MIMEMultipartRelated mime = (MIMEMultipartRelated) extElems.get(0); + List parts = mime.getMIMEParts(); + // if parts count is more than one, than assertion is notApplicable + if(parts.size() <= 1) + throw new AssertionNotApplicableException(); + String contentType = HTTPUtils.getHttpHeaderAttribute( + entryContext.getMessageEntry().getHTTPHeaders(), + HTTPConstants.HEADER_CONTENT_TYPE); + if((contentType == null) || + !contentType.equalsIgnoreCase(WSIConstants.CONTENT_TYPE_MULTIPART)) + { + throw new AssertionFailException("Incorrect Content-Type value \"" + + contentType + "\" in HTTP header"); + } + } + catch (AssertionNotApplicableException e) + { + result = AssertionResult.RESULT_NOT_APPLICABLE; + } + catch (AssertionFailException e) + { + result = AssertionResult.RESULT_FAILED; + failureDetail = + validator.createFailureDetail(e.getMessage(), entryContext); + } + // Return assertion result + return validator.createAssertionResult( + testAssertion, result, failureDetail); + } + + /** + * Returns the part value from MIMEContent element + * @param part MIMEPart element + * @return the part value from MIMEContent element + */ + //private String getMIMEContentPart(MIMEPart part) { + // List list = part.getExtensibilityElements(); + // if(list.size() == 0) + // return null; + // return ((MIMEContent) list.get(0)).getPart(); + //} +}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/AP1926.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/AP1926.java new file mode 100644 index 000000000..a3f24ecd9 --- /dev/null +++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/AP1926.java @@ -0,0 +1,210 @@ +/******************************************************************************* + * 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.message; + +import java.util.Collection; +import java.util.Iterator; +import java.util.List; + +import javax.wsdl.BindingOperation; +import javax.wsdl.extensions.mime.MIMEContent; +import javax.wsdl.extensions.mime.MIMEMultipartRelated; +import javax.wsdl.extensions.mime.MIMEPart; + +import org.eclipse.wst.wsi.internal.core.WSIException; +import org.eclipse.wst.wsi.internal.core.analyzer.AssertionFailException; +import org.eclipse.wst.wsi.internal.core.analyzer.AssertionNotApplicableException; +import org.eclipse.wst.wsi.internal.core.log.MessageEntry; +import org.eclipse.wst.wsi.internal.core.log.MimePart; +import org.eclipse.wst.wsi.internal.core.log.MimeParts; +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.profile.validator.impl.BaseMessageValidator; +import org.eclipse.wst.wsi.internal.core.report.AssertionResult; +import org.eclipse.wst.wsi.internal.core.util.MIMEConstants; +import org.eclipse.wst.wsi.internal.core.util.MIMEUtils; + +/** + * AP1926 + * + * <context>For a candidate message</context> + * <assertionDescription>A message includes all of the MIME parts described by + * its WSDL MIME binding.</assertionDescription> + */ +public class AP1926 extends AssertionProcess +{ + private final BaseMessageValidator validator; + + /** + * @param WSDLValidatorImpl + */ + public AP1926(BaseMessageValidator impl) + { + super(impl); + this.validator = impl; + } + + /* Validates the test assertion. + * @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 + { + try + { + if(!entryContext.getMessageEntry().isMimeContent()) + { + throw new AssertionNotApplicableException(); + } + + // get message mime parts + MimeParts mimeParts = entryContext.getMessageEntry().getMimeParts(); + + BindingOperation bindingOperation = validator.getOperationMatch( + entryContext.getEntry().getEntryType(), + entryContext.getMessageEntryDocument()); + + // If there is no matched operation, the assertion is not applicable + if (bindingOperation == null) + throw new AssertionNotApplicableException(); + + // Finding operation extensibility elems + // in the binding depending on message type + List extElems = null; + if (entryContext.getMessageEntry().getType().equals( + MessageEntry.TYPE_REQUEST) + && bindingOperation.getBindingInput() != null) + { + extElems = bindingOperation + .getBindingInput().getExtensibilityElements(); + } + else if (entryContext.getMessageEntry().getType().equals( + MessageEntry.TYPE_RESPONSE) + && bindingOperation.getBindingOutput() != null) + { + extElems = bindingOperation + .getBindingOutput().getExtensibilityElements(); + } + // check list for the first element + if((extElems == null) || (extElems.size() == 0) || + !(extElems.get(0) instanceof MIMEMultipartRelated)) + throw new AssertionNotApplicableException(); + + // get list mime parts from definition + MIMEMultipartRelated mime = (MIMEMultipartRelated) extElems.get(0); + List parts = mime.getMIMEParts(); + + if(mimeParts.getRootPart() == null || mimeParts.count()==0) + throw new AssertionNotApplicableException(); + // skip root part + for (int i = 1; i < parts.size(); i++) + { + String partName = getMIMEContentPart((MIMEPart) parts.get(i)); + // find the corresponding MIME part + if (findMIMEPart(mimeParts.getParts(), partName) == null) + { + throw new AssertionFailException("The corresponding binding " + + "operation \"" + bindingOperation.getName() + + "\" does not contain part \"" + partName + "\""); + } + } + } + catch (AssertionNotApplicableException e) + { + result = AssertionResult.RESULT_NOT_APPLICABLE; + } + catch (AssertionFailException e) + { + result = AssertionResult.RESULT_FAILED; + failureDetail = + validator.createFailureDetail(e.getMessage(), entryContext); + } + + // Return assertion result + return validator.createAssertionResult( + testAssertion, result, failureDetail); + } + + /** + * find corresponding MIME part + * @param parts array of soap MIME parts + * @param partName part name to find + * @return corresponding MIME part "Content-ID" value, + * if the part doesnt found, retuns null + * @throws WSIException + */ + private String findMIMEPart(Collection parts, String partName) + throws WSIException + { + if(partName == null) + return null; + Iterator iparts = parts.iterator(); + while (iparts.hasNext()) + { + MimePart part = (MimePart)iparts.next(); + String m_partName = MIMEUtils.getMimeHeaderAttribute( + part.getHeaders(), MIMEConstants.HEADER_CONTENT_ID); + + // check value format <partname=UID@host> + if ((m_partName != null) && (m_partName.startsWith("<")) && + (m_partName.indexOf("=") != -1) && + (encodePartName(m_partName.substring(1, m_partName.indexOf("="))).equals(partName))) + { + return m_partName; + } + } + return null; + } + + /** + * Returns the part value from MIMEContent element + * @param part MIMEPart element + * @return the part value from MIMEContent element + */ + private String getMIMEContentPart(MIMEPart part) { + List list = part.getExtensibilityElements(); + if(list.size() == 0) + return null; + return ((MIMEContent) list.get(0)).getPart(); + } + + /** + * Encode string from %HH to UTF + * @param str string + * @return encoded string from %HH format + */ + private String encodePartName(String str) { + StringBuffer res = new StringBuffer(""); + for (int i = 0; i < str.length(); i++) + { + if((str.charAt(i) == '%') && (str.length() > i+2)) + { + try + { + int value = Integer.parseInt( + String.valueOf(str.charAt(i+1)) + + String.valueOf(str.charAt(i+2)), 16); + res.append((char) value); + i +=2; + } + catch(NumberFormatException e){} + } + else + { + res.append(str.charAt(i)); + } + } + return res.toString(); + } +}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/AP1931.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/AP1931.java new file mode 100644 index 000000000..01cdfc9b9 --- /dev/null +++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/AP1931.java @@ -0,0 +1,91 @@ +/******************************************************************************* + * 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.message; + +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.AssertionProcess; +import org.eclipse.wst.wsi.internal.core.profile.validator.impl.BaseMessageValidator; +import org.eclipse.wst.wsi.internal.core.report.AssertionResult; +import org.eclipse.wst.wsi.internal.core.xml.XMLUtils; +import org.w3c.dom.Document; +import org.w3c.dom.Element; + +/** + * AP1931 + * + * <context>For a candidate root-part of a multipart/related message</context> + * <assertionDescription>The entity body of the root-part of multipart/related + * message is a soap:Envelope.</assertionDescription> + */ +public class AP1931 extends AssertionProcess +{ + private final BaseMessageValidator validator; + + /** + * @param WSDLValidatorImpl + */ + public AP1931(BaseMessageValidator impl) + { + super(impl); + this.validator = impl; + } + + /* Validates the test assertion. + * @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 + { + // check for the root part + if(entryContext.getMessageEntry().isMimeContent() && + (entryContext.getMessageEntry().getMimeParts().getRootPart() != null)) + { + try + { + // parse root part message + Document doc = XMLUtils.parseXML( + entryContext.getMessageEntry().getMimeParts().getRootPart().getContent()); + + // get entity body + Element el = doc.getDocumentElement(); + + // if the element is not soap:Envelope, then fail + if(!el.getLocalName().equals(WSITag.ELEM_SOAP_ENVELOPE.getLocalPart()) || + !el.getNamespaceURI().equals(WSITag.ELEM_SOAP_ENVELOPE.getNamespaceURI())) + { + result = AssertionResult.RESULT_FAILED; + failureDetail = validator.createFailureDetail( + "the entity body of the root part is {" + + el.getNamespaceURI() + "}" + el.getLocalName(), entryContext); + } + } + catch (Exception e) + { + result = AssertionResult.RESULT_FAILED; + failureDetail = validator.createFailureDetail( + "the entity body of the root part does not contain " + + "\"soap:Envelope\" element", entryContext); + } + } + else + { + result = AssertionResult.RESULT_NOT_APPLICABLE; + } + // Return assertion result + return validator.createAssertionResult( + testAssertion, result, failureDetail); + } +}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/AP1932.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/AP1932.java new file mode 100644 index 000000000..d9c0fc722 --- /dev/null +++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/AP1932.java @@ -0,0 +1,80 @@ +/******************************************************************************* + * 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.message; + +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.profile.validator.impl.BaseMessageValidator; +import org.eclipse.wst.wsi.internal.core.report.AssertionResult; +import org.eclipse.wst.wsi.internal.core.util.HTTPConstants; +import org.eclipse.wst.wsi.internal.core.util.HTTPUtils; + +/** + * AP1932 + * + * <context>For a candidate message containing a Content-Type HTTP header + * field-value with a media type of "multipart/related"</context> + * <assertionDescription>In a message, the Content-Type HTTP header field-value + * has a type parameter with a value of "text/xml" when it has a media type of + * "multipart/related".</assertionDescription> + */ +public class AP1932 extends AssertionProcess +{ + private final BaseMessageValidator validator; + + /** + * @param WSDLValidatorImpl + */ + public AP1932(BaseMessageValidator impl) + { + super(impl); + this.validator = impl; + } + + /* Validates the test assertion. + * @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 + { + // check for multipart/related content type + String content_type = HTTPUtils.getHttpHeaderAttribute( + entryContext.getMessageEntry().getHTTPHeaders(), + HTTPConstants.HEADER_CONTENT_TYPE); + + if((content_type == null) || + (!content_type.equalsIgnoreCase(WSIConstants.CONTENT_TYPE_MULTIPART))) + { + result = AssertionResult.RESULT_NOT_APPLICABLE; + } + else + { + String subType = HTTPUtils.getHttpHeaderSubAttribute( + entryContext.getMessageEntry().getHTTPHeaders(), + HTTPConstants.HEADER_CONTENT_TYPE, "type"); + if((subType == null) + || !subType.equalsIgnoreCase(WSIConstants.CONTENT_TYPE_TEXT_XML)) + { + result = AssertionResult.RESULT_FAILED; + failureDetail = validator.createFailureDetail( + "The \"type\" parameter value is \"" + subType + "\"", entryContext); + } + } + // Return assertion result + return validator.createAssertionResult( + testAssertion, result, failureDetail); + } +}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/AP1933.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/AP1933.java new file mode 100644 index 000000000..a4491fbb7 --- /dev/null +++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/AP1933.java @@ -0,0 +1,257 @@ +/******************************************************************************* + * 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.message; + +import java.net.MalformedURLException; +import java.net.URL; +import java.util.Collection; +import java.util.Iterator; +import java.util.List; + +import javax.wsdl.BindingOperation; +import javax.wsdl.extensions.mime.MIMEContent; +import javax.wsdl.extensions.mime.MIMEMultipartRelated; +import javax.wsdl.extensions.mime.MIMEPart; + +import org.eclipse.wst.wsi.internal.core.WSIException; +import org.eclipse.wst.wsi.internal.core.analyzer.AssertionFailException; +import org.eclipse.wst.wsi.internal.core.analyzer.AssertionNotApplicableException; +import org.eclipse.wst.wsi.internal.core.log.MessageEntry; +import org.eclipse.wst.wsi.internal.core.log.MimePart; +import org.eclipse.wst.wsi.internal.core.log.MimeParts; +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.profile.validator.impl.BaseMessageValidator; +import org.eclipse.wst.wsi.internal.core.report.AssertionResult; +import org.eclipse.wst.wsi.internal.core.util.MIMEConstants; +import org.eclipse.wst.wsi.internal.core.util.MIMEUtils; + +/** + * AP1933 + * + * <context>For a candidate message</context> + * <assertionDescription>If a description binds a wsdl:message part to a + * mime:content element, then the corresponding MIME part in a message has a + * content-id header with a globally unique value of the form + * <partname=ID@hostname>, where 'partname' is the value of the name attribute of + * the wsdl:part element referenced by the mime:content.</assertionDescription> + */ +public class AP1933 extends AssertionProcess +{ + private final BaseMessageValidator validator; + + /** + * @param WSDLValidatorImpl + */ + public AP1933(BaseMessageValidator impl) + { + super(impl); + this.validator = impl; + } + + /* Validates the test assertion. + * @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 + { + + try + { + if(!entryContext.getMessageEntry().isMimeContent()) + { + throw new AssertionNotApplicableException(); + } + + // get message mime parts + MimeParts mimeParts = entryContext.getMessageEntry().getMimeParts(); + + BindingOperation bindingOperation = validator.getOperationMatch( + entryContext.getEntry().getEntryType(), + entryContext.getMessageEntryDocument()); + + // If there is no matched operation, the assertion is not applicable + if (bindingOperation == null) + throw new AssertionNotApplicableException(); + + // Finding operation extensibility elems + // in the binding depending on message type + List extElems = null; + if (entryContext.getMessageEntry().getType().equals( + MessageEntry.TYPE_REQUEST) + && bindingOperation.getBindingInput() != null) + { + extElems = bindingOperation + .getBindingInput().getExtensibilityElements(); + } + else if (entryContext.getMessageEntry().getType().equals( + MessageEntry.TYPE_RESPONSE) + && bindingOperation.getBindingOutput() != null) + { + extElems = bindingOperation + .getBindingOutput().getExtensibilityElements(); + } + // check list for the first element + if((extElems == null) || (extElems.size() == 0) || + !(extElems.get(0) instanceof MIMEMultipartRelated)) + throw new AssertionNotApplicableException(); + + // get list mime parts from definition + MIMEMultipartRelated mime = (MIMEMultipartRelated) extElems.get(0); + List parts = mime.getMIMEParts(); + + // skip root part + for (int i = 1; i < parts.size(); i++) + { + String partName = getMIMEContentPart((MIMEPart) parts.get(i)); + // find the corresponding MIME part + if (findMIMEPart(mimeParts.getParts(), partName) == null) + { + throw new AssertionFailException("The corresponding binding " + + "operation \"" + bindingOperation.getName() + + "\" does not contain part \"" + partName + "\""); + } + } + } + catch (AssertionNotApplicableException e) + { + result = AssertionResult.RESULT_NOT_APPLICABLE; + } + catch (AssertionFailException e) + { + result = AssertionResult.RESULT_FAILED; + failureDetail = + validator.createFailureDetail(e.getMessage(), entryContext); + } + // Return assertion result + return validator.createAssertionResult( + testAssertion, result, failureDetail); + } + + /** + * find corresponding MIME part + * @param parts array of soap MIME parts + * @param partName part name to find + * @return corresponding MIME part "Content-ID" value, + * if the part doesnt found, retuns null + * @throws WSIException + */ + private String findMIMEPart(Collection parts, String partName) + throws WSIException, AssertionFailException + { + if(partName == null) + return null; + + Iterator iparts = parts.iterator(); + int i = 0; + while (iparts.hasNext()) + { + i = i + 1; + MimePart part = (MimePart)iparts.next(); + String m_partName = MIMEUtils.getMimeHeaderAttribute( + part.getHeaders(), MIMEConstants.HEADER_CONTENT_ID); + + // check value format <partname=UID@hostname> + if ((m_partName != null) && m_partName.startsWith("<") && m_partName.endsWith(">")) + { + int idx, atIdx; + String enPartName = null; + String uid = null; + String host = null; + + // get part name from content-id + if ((idx = m_partName.indexOf("=")) != -1) + { + enPartName = encodePartName(m_partName.substring(1, idx)); + } + // get uid and hostname from content-id + if (((atIdx = m_partName.indexOf("@")) != -1) && (atIdx > idx)) + { + uid = m_partName.substring(idx+1, atIdx); + host = m_partName.substring(atIdx+1, m_partName.length()-1); + } + // if part names match, validate format + if((enPartName != null) && enPartName.equals(partName)) + { + if((uid == null) || (uid.length() == 0)) + throw new AssertionFailException( + "The \"Content-ID\" attribute of the part \""+(i+1)+ + "\"contains value \""+ m_partName+ + "\" which has a incorrect UID format"); + if(host == null) + throw new AssertionFailException( + "The \"Content-ID\" attribute of the part \""+(i+1)+ + "\"contains value \""+ m_partName+ + "\" which has a incorrect host format"); + // check for malformed URL + try + { + new URL("HTTP", host, ""); + } + catch (MalformedURLException e) + { + throw new AssertionFailException( + "The \"Content-ID\" attribute of the part \""+(i+1)+ + "\"contains value \""+ m_partName+ + "\" which has a incorrect host format"); + } + return m_partName; + } + } + } + return null; + } + + /** + * Returns the part value from MIMEContent element + * @param part MIMEPart element + * @return the part value from MIMEContent element + */ + private String getMIMEContentPart(MIMEPart part) + { + List list = part.getExtensibilityElements(); + if(list.size() == 0) + return null; + return ((MIMEContent) list.get(0)).getPart(); + } + + /** + * Encode string from %HH to UTF + * @param str string + * @return encoded string from %HH format + */ + private String encodePartName(String str) { + StringBuffer res = new StringBuffer(""); + for (int i = 0; i < str.length(); i++) + { + if((str.charAt(i) == '%') && (str.length() > i+2)) + { + try + { + int value = Integer.parseInt( + String.valueOf(str.charAt(i+1)) + + String.valueOf(str.charAt(i+2)), 16); + res.append((char) value); + i +=2; + } + catch(NumberFormatException e){} + } + else + { + res.append(str.charAt(i)); + } + } + return res.toString(); + } +}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/AP1934.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/AP1934.java new file mode 100644 index 000000000..1c060516d --- /dev/null +++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/AP1934.java @@ -0,0 +1,103 @@ +/******************************************************************************* + * 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.message; + +import java.util.Iterator; + +import org.eclipse.wst.wsi.internal.core.WSIException; +import org.eclipse.wst.wsi.internal.core.log.MimePart; +import org.eclipse.wst.wsi.internal.core.log.MimeParts; +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.profile.validator.impl.BaseMessageValidator; +import org.eclipse.wst.wsi.internal.core.report.AssertionResult; +import org.eclipse.wst.wsi.internal.core.util.MIMEConstants; +import org.eclipse.wst.wsi.internal.core.util.MIMEUtils; + +/** + * AP1934 + * + * <context>For a candidate part of a multipart/related message</context> + * <assertionDescription>The Content-Transfer-Encoding field of a part in a + * multipart/related message has a value of "7bit", "8bit", "binary", + * "quoted-printable" or "base64".</assertionDescription> + */ +public class AP1934 extends AssertionProcess +{ + private final BaseMessageValidator validator; + + /** + * @param WSDLValidatorImpl + */ + public AP1934(BaseMessageValidator impl) + { + super(impl); + this.validator = impl; + } + + /* Validates the test assertion. + * @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 + { + // check for multipart/related content type + if(!entryContext.getMessageEntry().isMimeContent()) + { + result = AssertionResult.RESULT_NOT_APPLICABLE; + } + else + { + // get MIME parts + MimeParts parts = entryContext.getMessageEntry().getMimeParts(); + if(parts.count() == 0) + { + result = AssertionResult.RESULT_NOT_APPLICABLE; + } + else + { + Iterator iparts = parts.getParts().iterator(); + // check each part for the Content-Transfer-Encoding field + int i = 0; + while (iparts.hasNext()) + { + MimePart part = (MimePart)iparts.next(); + String type_value = MIMEUtils.getMimeHeaderAttribute( + part.getHeaders(), + MIMEConstants.HEADER_CONTENT_TRANSFER_ENCODING); + if (type_value != null) + { + if((type_value == null) || !(type_value.equalsIgnoreCase("7bit") || + type_value.equalsIgnoreCase("8bit") || + type_value.equalsIgnoreCase("base64") || + type_value.equalsIgnoreCase("quoted-printable") || + type_value.equalsIgnoreCase("binary"))) + { + result = AssertionResult.RESULT_FAILED; + failureDetail = validator.createFailureDetail( + "(" + (i+1) + + "), part header field \"Content-Transfer-Encoding\" has incorrect value \""+ + type_value+"\"", entryContext); + } + } + i++; + } + } + } + + // Return assertion result + return validator.createAssertionResult( + testAssertion, result, failureDetail); + } +}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/AP1935.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/AP1935.java new file mode 100644 index 000000000..4d8fce7fc --- /dev/null +++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/AP1935.java @@ -0,0 +1,348 @@ +/******************************************************************************* + * 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.message; + +import java.util.ArrayList; +import java.util.Iterator; + +import org.eclipse.wst.wsi.internal.core.WSIException; +import org.eclipse.wst.wsi.internal.core.analyzer.AssertionFailException; +import org.eclipse.wst.wsi.internal.core.log.MimePart; +import org.eclipse.wst.wsi.internal.core.log.MimeParts; +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.profile.validator.impl.BaseMessageValidator; +import org.eclipse.wst.wsi.internal.core.report.AssertionResult; +import org.eclipse.wst.wsi.internal.core.util.HTTPConstants; +import org.eclipse.wst.wsi.internal.core.util.HTTPUtils; +import org.eclipse.wst.wsi.internal.core.util.Utils; + +/** + * AP1935 + * + * <context>For a candidate part of a multipart/related message</context> + * <assertionDescription>The encoding of the body of a part in a + * multipart/related message conforms to the encoding indicated by the + * Content-Transfer-Encoding field-value, + * as specified by RFC2045.</assertionDescription> + */ +public class AP1935 extends AssertionProcess +{ + private final BaseMessageValidator validator; + + /** + * @param WSDLValidatorImpl + */ + public AP1935(BaseMessageValidator impl) + { + super(impl); + this.validator = impl; + } + + /* Validates the test assertion. + * @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 + { + if(!entryContext.getMessageEntry().isMimeContent()) + { + result = AssertionResult.RESULT_NOT_APPLICABLE; + } + else + { + // get MIME parts + MimeParts parts = entryContext.getMessageEntry().getMimeParts(); + if(parts.count() == 0) + { + result = AssertionResult.RESULT_NOT_APPLICABLE; + } + else + { + // check each part for the encoding match + Iterator iparts = parts.getParts().iterator(); + int i = 0; + MimePart root = parts.getRootPart(); + while (iparts.hasNext()) + { + i = i = 1; + try + { + MimePart part = (MimePart)iparts.next(); + + // get encoding from header + String encoding = HTTPUtils.getHttpHeaderAttribute(part.getHeaders(), + HTTPConstants.HEADER_CONTENT_TRANSFER_ENCODING); + + if ((part == root) || + ((encoding != null) && encoding.equalsIgnoreCase("base64"))) + checkPart(part, encoding, false); + else + checkPart(part, encoding, true); + } catch (AssertionFailException e) + { + result = AssertionResult.RESULT_FAILED; + failureDetail = validator.createFailureDetail( + "part "+(i+1)+" Error: " + e.getMessage(), entryContext); + } + } + } + } + // Return assertion result + return validator.createAssertionResult( + testAssertion, result, failureDetail); + } + /** + * Check message entry to encoding conformity + * @param entry message entry + * @throws AssertionFailException if message does not encoding conformity + * @throws WSIException + */ + private void checkPart(MimePart part, String encoding, boolean encoded) + throws AssertionFailException, WSIException + { + String content = null; + if (encoded) + content = new String(Utils.decodeBase64(part.getContent())); + else + content = part.getContent(); + + if(encoding == null) + { + result = AssertionResult.RESULT_NOT_APPLICABLE; + // check 7bit + } else if(encoding.equalsIgnoreCase("7bit")) { + checkOn7bit(content); + // check 8bit + } else if(encoding.equalsIgnoreCase("8bit")) { + checkOn8bit(content); + // check quoted-printable + } else if(encoding.equalsIgnoreCase("quoted-printable")) { + checkOnQuotedPrintable(content); + // check base64 + } else if(encoding.equalsIgnoreCase("base64")) { + checkOnBase64(content); + } + // we dont check binary encoding, since message can contains any chars + } + + /** + * Validate a 7bit encoded message (RFC2045) + * @param message message to check + * @throws AssertionFailException if message does not conform + */ + private void checkOn7bit(String message) + throws AssertionFailException + { + String[] strs = split(message); + for (int i = 0; i < strs.length; i++) + { + String str = strs[i]; + + // check string length + if(str.length() > 998) + { + throw new AssertionFailException("The length (" + str.length() + + ") of the line (" + (i+1) + ") greater than 998"); + } + // No octets with decimal values greater than 127 + // are allowed and neither are NULs (octets with decimal value 0). CR + //(decimal value 13) and LF (decimal value 10) octets only occur as + // part of CRLF line separation sequences. + char[] chars = str.toCharArray(); + for (int j = 0; j < chars.length; j++) + { + if((chars[j] > 127) || (chars[j] == 0) || + (chars[j] == 10) || (chars[j] == 13)) + { + throw new AssertionFailException("The char (" + chars[j] + + ")[code=" + (byte) chars[j] + " position=" + j + + "] does not allows in 7bit encoding content"); + } + } + } + } + + /** + * Validate an 8bit encoded message (RFC2045) + * @param message message to check + * @throws AssertionFailException if message does not conform + */ + private void checkOn8bit(String message) + throws AssertionFailException + { + String[] strs = split(message); + for (int i = 0; i < strs.length; i++) + { + String str = strs[i]; + + // check string length + if(str.length() > 998) + { + throw new AssertionFailException("The length (" + str.length() + + ") of the line (" + (i+1) + ") greater than 998"); + } + // octets with decimal values greater than 127 + // may be used. As with "7bit data" CR and LF octets only occur as part + // of CRLF line separation sequences and no NULs are allowed. + char[] chars = str.toCharArray(); + for (int j = 0; j < chars.length; j++) + { + if((chars[j] == 0) || (chars[j] == 10) || (chars[j] == 13)) + { + throw new AssertionFailException("The char (" + chars[j] + + ")[code=" + (byte) chars[j] + " position=" + j + + "] does not allows in 8bit encoding content"); + } + } + } + } + + /** + * Validate a quoted-printable encoded message (RFC2045) + * @param message message to check + * @throws AssertionFailException if message does not conform + */ + private void checkOnQuotedPrintable(String message) + throws AssertionFailException + { + String[] strs = split(message); + for (int i = 0; i < strs.length; i++) + { + // check length + // RFC2045 + // (5) (Soft Line Breaks) The Quoted-Printable encoding + //REQUIRES that encoded lines be no more than 76 + //characters long. If longer lines are to be encoded + //with the Quoted-Printable encoding, "soft" line breaks + //must be used. An equal sign as the last character on a + //encoded line indicates such a non-significant ("soft") + //line break in the encoded text. + if(((strs[i].indexOf("\t") != -1) || (strs[i].indexOf(" ") != -1)) && + (strs[i].length() > 76)) + { + throw new AssertionFailException("The length (" + strs[i].length() + + ") of the line (" + (i+1) + + ") greater than 76, \"soft\" line breaks must be used"); + } + + char[] chars = strs[i].toCharArray(); + for (int j = 0; j < chars.length; j++) + { + //(1) (General 8bit representation) Any octet, except a CR or + //LF that is part of a CRLF line break of the canonical + //(standard) form of the data being encoded, may be + //represented by an "=" followed by a two digit + //hexadecimal representation of the octet's value. The + //digits of the hexadecimal alphabet, for this purpose, + //are "0123456789ABCDEF". Uppercase letters must be + //used; lowercase letters are not allowed. Thus, for + //example, the decimal value 12 (US-ASCII form feed) can + //be represented by "=0C", and the decimal value 61 (US- + //ASCII EQUAL SIGN) can be represented by "=3D". This + //rule must be followed except when the following rules + //allow an alternative encoding. + // (2) (Literal representation) Octets with decimal values of + //33 through 60 inclusive, and 62 through 126, inclusive, + //MAY be represented as the US-ASCII characters which + //correspond to those octets (EXCLAMATION POINT through + //LESS THAN, and GREATER THAN through TILDE, + //respectively). + if((chars[j] == 61) && (chars.length > j+2)) + { + if(!isHex(chars[j+1]) || !isHex(chars[j+2])) + { + throw new AssertionFailException("the quoted char (" + + chars[j] + chars[j+1] + chars[j+2] + ") is incorrect"); + } else { + j += 2; + } + } + // check for space and tab + else if((chars[j] != 9) && (chars[j] != 32)) + { + // check invalid symbol + if((chars[j] == 0) || (chars[j] == 10) || (chars[j] == 13) || + (chars[j] < 33) || (chars[j] > 126) || (chars[j] == 61)) + { + throw new AssertionFailException("The char (" + chars[j] + + ")[code=" + (byte) chars[j] + " position=" + j + + "] must be quoted"); + } + } + } + } + } + + /** + * Validate a base64 encoded message (RFC3548) + * @param message message to check + * @throws AssertionFailException if message does not conform + */ + private void checkOnBase64(String message) + throws AssertionFailException + { + String[] strs = split(message); + for (int i = 0; i < strs.length; i++) + { + String str = strs[i]; + + // check string length + if(str.length() > 76) + { + throw new AssertionFailException("The length (" + str.length() + + ") of the line (" + (i+1) + ") greater than 998"); + } + // check for "ABCDEFGHIJKLMNOPQRSTUVWXYZabcefghijklmnopqrstuvwxyz0123456789/+" + char[] chars = str.toCharArray(); + for (int j = 0; j < chars.length; j++) + { + char c = chars[i]; + if((c < 47) || (c > 122) || ((c > 57) && (c < 65)) || + ((c > 90) && (c < 97))) + { + throw new AssertionFailException("The char (" + chars[j] + + ")[code=" + (byte) chars[j] + " position=" + j + + "] does not allows in base64 encoding content"); + } + } + } + } + + /** + * split string to array of strings and use as delimeter CRLF + * @param str original string + * @return array of strings + */ + private String[] split(String str) + { + ArrayList list = new ArrayList(); + for(int idx = str.indexOf("\r\n"); idx != -1; idx = str.indexOf("\r\n")) + { + list.add(str.substring(0, idx)); + str = str.substring(idx+2); + } + list.add(str); + return (String[]) list.toArray(new String[list.size()]); + } + + /** + * Returns true if byte is "0123456789ABCDEF" range, false othewise + * @param c char + * @return true if byte is "0123456789ABCDEF" range, false othewise + */ + private boolean isHex(char c) { + return (((c >= 48) && (c <= 57)) || ((c >= 65) && (c <= 70))); + } +}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/AP1936.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/AP1936.java new file mode 100644 index 000000000..db8ae713f --- /dev/null +++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/AP1936.java @@ -0,0 +1,72 @@ +/******************************************************************************* + * 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.message; + +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.profile.validator.impl.BaseMessageValidator; +import org.eclipse.wst.wsi.internal.core.report.AssertionResult; + +/** + * AP1936 + * <context>For a candidate multipart/related message</context> + * <assertionDescription>In a message, all MIME encapsulation boundary strings + * are preceded with the ascii characters CR (13) and LF (10) + * in that sequence.</assertionDescription> + */ +public class AP1936 extends AssertionProcess +{ + private final BaseMessageValidator validator; + + /** + * @param BaseMessageValidator + */ + public AP1936(BaseMessageValidator impl) + { + super(impl); + this.validator = impl; + } + + public AssertionResult validate( + TestAssertion testAssertion, + EntryContext entryContext) + throws WSIException + { + // if boundary equals null, then result is not applicable + if (!entryContext.getMessageEntry().isMimeContent()) + { + result = AssertionResult.RESULT_NOT_APPLICABLE; + } + // otherwise it is true -- checked in monitor + // MimeParts mimeParts = entryContext.getMessageEntry().getMimeParts(); + // Iterator i = mimeParts.getParts().iterator(); + // boolean invalidBoundaryStringFound = false; + //while (i.hasNext() && !invalidBoundaryStringFound) + //{ + // MimePart part = (MimePart)i.next(); + // String[] boundaries = part.getBoundaryStrings(); + // for (int j = 0; j<boundaries.length; j++) + // { + // if (!boundaries[j].startsWith("
\n")) + // { + // invalidBoundaryStringFound = true; + // result = AssertionResult.RESULT_FAILED; + // failureDetail = validator.createFailureDetail(boundaries[j], entryContext); + // break; + // } + // } + //} + return validator.createAssertionResult( + testAssertion, result, failureDetail); + } +} diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/AP1942.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/AP1942.java new file mode 100644 index 000000000..5fb7973ea --- /dev/null +++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/AP1942.java @@ -0,0 +1,264 @@ +/******************************************************************************* + * 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.message; + +import java.util.Iterator; +import java.util.List; + +import javax.wsdl.BindingOperation; +import javax.wsdl.Message; +import javax.wsdl.Part; +import javax.wsdl.extensions.ExtensibilityElement; +import javax.wsdl.extensions.mime.MIMEContent; +import javax.wsdl.extensions.mime.MIMEMultipartRelated; +import javax.wsdl.extensions.mime.MIMEPart; +import javax.xml.namespace.QName; + +import org.eclipse.wst.wsi.internal.core.WSIException; +import org.eclipse.wst.wsi.internal.core.WSITag; +import org.eclipse.wst.wsi.internal.core.analyzer.AssertionFailException; +import org.eclipse.wst.wsi.internal.core.analyzer.AssertionNotApplicableException; +import org.eclipse.wst.wsi.internal.core.log.MessageEntry; +import org.eclipse.wst.wsi.internal.core.log.MimePart; +import org.eclipse.wst.wsi.internal.core.log.MimeParts; +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.profile.validator.impl.BaseMessageValidator; +import org.eclipse.wst.wsi.internal.core.report.AssertionResult; +import org.eclipse.wst.wsi.internal.core.util.MIMEConstants; +import org.eclipse.wst.wsi.internal.core.util.MIMEUtils; +import org.eclipse.wst.wsi.internal.core.xml.XMLUtils; +import org.w3c.dom.Document; + +/** + * AP1942 + * + * <context>For a candidate part of a multipart/related message that is bound + * to a mime:content that refers to global element declaration (via the element + * attribute of the wsdl:part element)</context> + * <assertionDescription>The bound message part is serialized within the MIME + * part as a serialization of an XML infoset whose root element is described by + * the referenced element.</assertionDescription> + */ +public class AP1942 extends AssertionProcess implements WSITag +{ + private final BaseMessageValidator validator; + + /** + * @param WSDLValidatorImpl + */ + public AP1942(BaseMessageValidator impl) + { + super(impl); + this.validator = impl; + } + + /* Validates the test assertion. + * @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 + { + try + { + if (!entryContext.getMessageEntry().isMimeContent()) + { + throw new AssertionNotApplicableException(); + } + else + { + MimeParts mimeParts = entryContext.getMessageEntry().getMimeParts(); + + // If the message does not contain non-root MIME parts + // the assertion is not applicable + if (mimeParts.count()< 2) + throw new AssertionNotApplicableException(); + + // Getting an operation matched for a message + BindingOperation bindingOperation = validator.getOperationMatch( + entryContext.getEntry().getEntryType(), + entryContext.getMessageEntryDocument()); + // If no one operation matches, the assertion is not applicable + if (bindingOperation == null) + throw new AssertionNotApplicableException(); + // Getting the corresponding extensibility elements and message + List extElems; + Message message; + if (MessageEntry.TYPE_REQUEST + .equals(entryContext.getEntry().getEntryType())) + { + extElems = bindingOperation.getBindingInput() == null ? null + : bindingOperation.getBindingInput().getExtensibilityElements(); + message = bindingOperation.getOperation().getInput() == null ? null + : bindingOperation.getOperation().getInput().getMessage(); + } + else + { + extElems = bindingOperation.getBindingOutput() == null ? null + : bindingOperation.getBindingOutput().getExtensibilityElements(); + message = bindingOperation.getOperation().getOutput() == null ? null + : bindingOperation.getOperation().getOutput().getMessage(); + } + // A variable that indicates a binding contains at least one + // mime:content element that refers to global element declaration + boolean mimeContentFound = false; + // Going through the message MIME parts + Iterator iMimeParts = mimeParts.getParts().iterator(); + int i = 0; + while (iMimeParts.hasNext()) + { + i = i + 1; + // Getting a MIME part + MimePart mimePart = (MimePart)iMimeParts.next(); + // Getting a part name form the Content-ID header + String partName = MIMEUtils.getMimeHeaderAttribute( + mimePart.getHeaders(), MIMEConstants.HEADER_CONTENT_ID); + try + { + int idx = partName.indexOf("="); + if((idx != -1) && partName.startsWith("<")) + partName = encodePartName(partName.substring(1, idx)); + } + catch (Exception e) + { + // Could not extract a part name from the header, + // proceed with the next MIME part + continue; + } + + // If the part is bound by a mime:content element + if (boundToMimeContent(extElems, partName) && message != null) + { + // Getting the corresponding part + Part part = (Part) message.getParts().get(partName); + QName refName; + // If the part refers to global element declaration + if (part != null && (refName = part.getElementName()) != null) + { + mimeContentFound = true; + // Trying to parse part content + Document doc = null; + try + { + doc = XMLUtils.parseXML(mimePart.getContent()); + } + catch (Exception e) {} + // If the message is not an XML infoset, the assertion failed + if (doc == null) + { + throw new AssertionFailException("The bound message part of the " + + "MIME part number " + (i + 1) + " is invalid XML infoset."); + } + // Creating a QName object of the root element + QName rootName = new QName( + doc.getDocumentElement().getNamespaceURI(), + doc.getDocumentElement().getLocalName()); + // If the names of the root element and the referenced element + // are not equal, the assertion failed + if (!refName.equals(rootName)) + { + throw new AssertionFailException("The root element name is " + + rootName + ", the name of the referenced element is " + + refName + "."); + } + } + } + } + // If no mime:contentS found, the assertion is not applicable + if (!mimeContentFound) + throw new AssertionNotApplicableException(); + } + } + catch (AssertionNotApplicableException anae) + { + result = AssertionResult.RESULT_NOT_APPLICABLE; + } + catch (AssertionFailException afe) + { + result = AssertionResult.RESULT_FAILED; + failureDetail = validator.createFailureDetail( + afe.getMessage(), entryContext); + } + // Return assertion result + return validator.createAssertionResult( + testAssertion, result, failureDetail); + } + + + /** + * Validates whether a part is bound by a mime:content element. + * @param extElems a list of extensibility elements. + * @param part a part name. + * @return true if a part is bound by mime:content, false otherwise. + */ + private boolean boundToMimeContent(List extElems, String part) + { + if (extElems != null && extElems.size() > 0) + { + ExtensibilityElement extElem = (ExtensibilityElement) extElems.get(0); + // Expected the first ext elem is mime:multipartRelated + if (extElem.getElementType().equals(WSDL_MIME_MULTIPART)) + { + // Getting the mime:part elements of the mime:multipartRelated + List mimeParts = ((MIMEMultipartRelated) extElem).getMIMEParts(); + for (int i = 0; i < mimeParts.size(); i++) + { + // Getting the mime:part element needed + List elems = ((MIMEPart) mimeParts.get(i)).getExtensibilityElements(); + if (elems.size() > 0) + { + // Getting the first element + ExtensibilityElement elem = (ExtensibilityElement) elems.get(0); + // If the element is mime:content and it binds a part + if (elem.getElementType().equals(WSDL_MIME_CONTENT) + && part.equals(((MIMEContent)elem).getPart())) + { + return true; + } + } + } + } + } + return false; + } + + /** + * Encode string from %HH to UTF + * @param str string + * @return encoded string from %HH format + */ + private String encodePartName(String str) { + StringBuffer res = new StringBuffer(""); + for (int i = 0; i < str.length(); i++) + { + if((str.charAt(i) == '%') && (str.length() > i+2)) + { + try + { + int value = Integer.parseInt( + String.valueOf(str.charAt(i+1)) + + String.valueOf(str.charAt(i+2)), 16); + res.append((char) value); + i +=2; + } + catch(NumberFormatException e){} + } + else + { + res.append(str.charAt(i)); + } + } + return res.toString(); + } +}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/AP1945.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/AP1945.java new file mode 100644 index 000000000..1dbf310cb --- /dev/null +++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/AP1945.java @@ -0,0 +1,73 @@ +/******************************************************************************* + * 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.message; + +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.profile.validator.impl.BaseMessageValidator; +import org.eclipse.wst.wsi.internal.core.report.AssertionResult; +import org.eclipse.wst.wsi.internal.core.util.HTTPConstants; +import org.eclipse.wst.wsi.internal.core.util.HTTPUtils; + +/** + * AP1945 + * <context>For a candidate message</context> + * <assertionDescription>The Content-Type HTTP header field-value in a message + * is either "multipart/related" or "text/xml".</assertionDescription> + */ +public class AP1945 extends AssertionProcess +{ + private final BaseMessageValidator validator; + + /** + * @param BaseMessageValidator + */ + public AP1945(BaseMessageValidator impl) + { + super(impl); + this.validator = impl; + } + + public AssertionResult validate( + TestAssertion testAssertion, + EntryContext entryContext) + throws WSIException + { + String headerName = HTTPConstants.HEADER_CONTENT_TYPE; + + // Getting a header + String headerValue = HTTPUtils.getHttpHeaderAttribute( + entryContext.getMessageEntry().getHTTPHeaders(), + headerName); + // If headerValue is null, the assertion is not applicable + if (headerValue == null) + { + result = AssertionResult.RESULT_NOT_APPLICABLE; + } + // If the header is "multipart/related" or "text/xml", + // then the assertion passed + else if (headerValue.equalsIgnoreCase(WSIConstants.CONTENT_TYPE_MULTIPART) + || headerValue.equalsIgnoreCase(WSIConstants.CONTENT_TYPE_TEXT_XML)) + { + } + // else the assertion failed + else { + result = AssertionResult.RESULT_FAILED; + failureDetail = validator.createFailureDetail( + headerValue, entryContext); + } + return validator.createAssertionResult( + testAssertion, result, failureDetail); + } +}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/AP1946.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/AP1946.java new file mode 100644 index 000000000..aaf0f1cb2 --- /dev/null +++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/AP1946.java @@ -0,0 +1,64 @@ +/******************************************************************************* + * 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.message; + +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.profile.validator.impl.BaseMessageValidator; +import org.eclipse.wst.wsi.internal.core.report.AssertionResult; + +/** + * AP1946 + * + * <context>For a candidate multipart/related message + * containing non-root parts</context> + * <assertionDescription>The candidate multipart/related message + * containing non-root parts.</assertionDescription> + */ +public class AP1946 extends AssertionProcess +{ + private final BaseMessageValidator validator; + + /** + * @param WSDLValidatorImpl + */ + public AP1946(BaseMessageValidator impl) + { + super(impl); + this.validator = impl; + } + + /* Validates the test assertion. + * @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 + { + // If there are more than one MIME parts, the assertion passed + if (entryContext.getMessageEntry().getMimeParts().count() > 1) + { + failureDetail = validator.createFailureDetail( + testAssertion.getDetailDescription(), entryContext); + } + // The assertion is not applicable + else + { + result = AssertionResult.RESULT_NOT_APPLICABLE; + } + // Return assertion result + return validator.createAssertionResult( + testAssertion, result, failureDetail); + } +}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/AP5100.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/AP5100.java new file mode 100644 index 000000000..850e66029 --- /dev/null +++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/AP5100.java @@ -0,0 +1,53 @@ +/******************************************************************************* + * 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.message; + +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.BaseMessageValidator; +import org.eclipse.wst.wsi.internal.core.report.AssertionResult; + +/** + * AP5100 + * + * <context>For a candidate non-multipart/related message in the log file, with an HTTP entity-body.</context> + * <assertionDescription>The SOAP envelope is the exclusive payload of the HTTP entity-body.</assertionDescription> + * + * @author lauzond + */ +public class AP5100 extends SSBP5100 +{ + /** + * Constructor. + * @param impl + */ + public AP5100(BaseMessageValidator impl) + { + super(impl); + } + + public AssertionResult validate( + TestAssertion testAssertion, + EntryContext entryContext) + throws WSIException + { + // If there is a SOAP Message with Attachments, the assertion is not applicable + if (entryContext.getMessageEntry().isMimeContent()) + { + return validator.createAssertionResult(testAssertion, AssertionResult.RESULT_NOT_APPLICABLE, failureDetail); + } + else + { + return super.validate(testAssertion, entryContext); + } + } +} diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/AP5101.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/AP5101.java new file mode 100644 index 000000000..5ba2cb9e0 --- /dev/null +++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/AP5101.java @@ -0,0 +1,51 @@ +/******************************************************************************* + * 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.message; + +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.BaseMessageValidator; +import org.eclipse.wst.wsi.internal.core.report.AssertionResult; + +/** + * AP5101 + * <context>For a non-multipart/related candidate message in the log file.</context> + * <assertionDescription>A message must have a "Content-Type" HTTP header field. The "Content-Type" HTTP header field must have a field-value whose media type is "text/xml".</assertionDescription> + * + * @author lauzond + */ +public class AP5101 extends SSBP5101 { + + /** + * @param impl + */ + public AP5101(BaseMessageValidator impl) + { + super(impl); + } + + public AssertionResult validate( + TestAssertion testAssertion, + EntryContext entryContext) + throws WSIException + { + // If there is a SOAP Message with Attachments, the assertion is not applicable + if (entryContext.getMessageEntry().isMimeContent()) + { + return validator.createAssertionResult(testAssertion, AssertionResult.RESULT_NOT_APPLICABLE, failureDetail); + } + else + { + return super.validate(testAssertion, entryContext); + } + } +} diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/BP1001.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/BP1001.java new file mode 100644 index 000000000..0abcbcc13 --- /dev/null +++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/BP1001.java @@ -0,0 +1,101 @@ +/******************************************************************************* + * 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.message; + +import java.util.Vector; + +import org.eclipse.wst.wsi.internal.core.WSIException; +import org.eclipse.wst.wsi.internal.core.log.MessageEntry; +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.MessageValidator; +import org.eclipse.wst.wsi.internal.core.profile.validator.impl.AssertionProcess; +import org.eclipse.wst.wsi.internal.core.profile.validator.impl.BaseMessageValidator; +import org.eclipse.wst.wsi.internal.core.report.AssertionResult; + + +/** + * BP1001. + * If it is a request, the arg #2 of POST is <HTTP/1.1>. If absent, first line of the + * body is: HTTP-Version = HTTP/1.1. If it is a response, it starts with <HTTP/1.1>. + */ +public class BP1001 extends AssertionProcess +{ + private final BaseMessageValidator validator; + + /** + * @param BaseMessageValidator + */ + public BP1001(BaseMessageValidator impl) + { + super(impl); + this.validator = impl; + } + + public AssertionResult validate( + TestAssertion testAssertion, + EntryContext entryContext) + throws WSIException + { + String httpHeader = entryContext.getMessageEntry().getHTTPHeaders(); + + // If this is a request message, then check POST header + if (entryContext + .getMessageEntry() + .getType() + .equalsIgnoreCase(MessageEntry.TYPE_REQUEST)) + { + Vector requestLine; + if (((requestLine = this.validator.getPostRequest(httpHeader)) == null) + || (requestLine.size() == 0)) + { + result = AssertionResult.RESULT_NOT_APPLICABLE; + } + else + { + String method = (String) requestLine.get(0); + //String requestURI = (String) requestLine.get(1); + String httpVersion = (String) requestLine.get(2); + + //For each request message that is an HTTP POST + if (method.equals(MessageValidator.HTTP_POST) && httpVersion != null) + { + if (httpVersion.equals(MessageValidator.HTTP_VERSION_1_1)) + { + result = AssertionResult.RESULT_PASSED; + } + else + { + result = AssertionResult.RESULT_WARNING; + failureDetail = this.validator.createFailureDetail(httpHeader, entryContext); + } + } + } + } + + // Otherwise it must be a response + else + { + if (httpHeader.startsWith(MessageValidator.HTTP_VERSION_1_1)) + { + result = AssertionResult.RESULT_PASSED; + } + else + { + result = AssertionResult.RESULT_WARNING; + failureDetail = this.validator.createFailureDetail(httpHeader, entryContext); + } + } + + // Return assertion result + return validator.createAssertionResult(testAssertion, result, failureDetail); + } +}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/BP1002.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/BP1002.java new file mode 100644 index 000000000..7564c1569 --- /dev/null +++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/BP1002.java @@ -0,0 +1,137 @@ +/******************************************************************************* + * 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.message; + +import java.util.StringTokenizer; + +import org.eclipse.wst.wsi.internal.core.WSIException; +import org.eclipse.wst.wsi.internal.core.analyzer.AssertionFailException; +import org.eclipse.wst.wsi.internal.core.log.MessageEntry; +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.MessageValidator; +import org.eclipse.wst.wsi.internal.core.profile.validator.impl.AssertionProcess; +import org.eclipse.wst.wsi.internal.core.profile.validator.impl.BaseMessageValidator; +import org.eclipse.wst.wsi.internal.core.report.AssertionResult; + + +/** + * BP1002. + * If it is a request, the arg #2 of POST is <HTTP/1.1> or <HTTP/1.0>. If absent, first line + * of the body is: HTTP-Version = HTTP/1.1. (or HTTP/1.0). If it is a response, it starts with + * <HTTP/1.1> or <HTTP/1.0> or higher; + */ +public class BP1002 extends AssertionProcess +{ + private final BaseMessageValidator validator; + + /** + * @param BaseMessageValidator + */ + public BP1002(BaseMessageValidator impl) + { + super(impl); + this.validator = impl; + } + + public AssertionResult validate( + TestAssertion testAssertion, + EntryContext entryContext) + throws WSIException + { + String httpHeader = entryContext.getMessageEntry().getHTTPHeaders(); + + // If this is a request message, then check POST for 1.1 or 1.0 + if (entryContext + .getMessageEntry() + .getType() + .equalsIgnoreCase(MessageEntry.TYPE_REQUEST)) + { + // Get each entry in the post header + StringTokenizer postMessage = new StringTokenizer(httpHeader, " \r\n"); + + // If there is no third token, then fail + if (postMessage.countTokens() < 3) + { + result = AssertionResult.RESULT_FAILED; + failureDetail = this.validator.createFailureDetail(httpHeader, entryContext); + } + else + { + // Get the 3rd token (there must be a better way to do this?) + String httpVersion = ""; + String messageType = ""; + for (int i = 0; i < 3; i++) + { + // Message type + if (i == 0) + messageType = postMessage.nextToken(); + else if (i == 2) + httpVersion = postMessage.nextToken(); + else + postMessage.nextToken(); + } + + if (!messageType.equals("POST")) + { + result = AssertionResult.RESULT_NOT_APPLICABLE; + } + + // If the third token is not HTTP/1.1 ot HTTP/1.0, then fail + else if ( + (!httpVersion.equalsIgnoreCase(MessageValidator.HTTP_VERSION_1_1)) + && (!httpVersion.equalsIgnoreCase(MessageValidator.HTTP_VERSION_1_0))) + { + result = AssertionResult.RESULT_FAILED; + failureDetail = this.validator.createFailureDetail(httpHeader, entryContext); + } + } + } + + // Else it is a response message + else + { + // Response-Line (1st) = HTTP-Version SP Response-code SP Response-text CRLF + StringTokenizer httpMessageTokenizer = + new StringTokenizer(httpHeader, "\n\r\f"); + + String startLine = null; + try + { + if (httpMessageTokenizer.hasMoreTokens()) + { + startLine = httpMessageTokenizer.nextToken(); + } + else + { + // HTTP version info expected but not found + // (state the fact in the exception message?) + throw new AssertionFailException(httpHeader); + } + + // check that protocol version indicates HTTP/1.0 or HTTP/1.1 + if (!startLine.startsWith(MessageValidator.HTTP_VERSION_1_1) + && !startLine.startsWith(MessageValidator.HTTP_VERSION_1_0)) + { + throw new AssertionFailException(httpHeader); + } + } + catch (AssertionFailException e) + { + result = AssertionResult.RESULT_FAILED; + failureDetail = this.validator.createFailureDetail(e.getMessage(), entryContext); + } + } + + // Return assertion result + return validator.createAssertionResult(testAssertion, result, failureDetail); + } +}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/BP1004.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/BP1004.java new file mode 100644 index 000000000..8b06ae766 --- /dev/null +++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/BP1004.java @@ -0,0 +1,73 @@ +/******************************************************************************* + * 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.message; + +import java.util.StringTokenizer; + +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.MessageValidator; +import org.eclipse.wst.wsi.internal.core.profile.validator.impl.AssertionProcess; +import org.eclipse.wst.wsi.internal.core.profile.validator.impl.BaseMessageValidator; +import org.eclipse.wst.wsi.internal.core.report.AssertionResult; + + +/** + * BP1004. + * The request message is a POST message, without any use of framework extension. + */ +public class BP1004 extends AssertionProcess +{ + private final BaseMessageValidator validator; + + /** + * @param BaseMessageValidator + */ + public BP1004(BaseMessageValidator impl) + { + super(impl); + this.validator = impl; + } + + public AssertionResult validate( + TestAssertion testAssertion, + EntryContext entryContext) + throws WSIException + { + String httpHeader = entryContext.getMessageEntry().getHTTPHeaders(); + StringTokenizer httpMessageTokenizer = + new StringTokenizer(httpHeader, "\n\r\f"); + + // Check if this is a POST message + if (!httpHeader.startsWith(MessageValidator.HTTP_POST)) + { + result = AssertionResult.RESULT_FAILED; + failureDetail = this.validator.createFailureDetail(httpHeader, entryContext); + } + + String line = null; + while (httpMessageTokenizer.hasMoreTokens() + && (result.equals(AssertionResult.RESULT_PASSED))) + { + line = httpMessageTokenizer.nextToken(); + if ((line != null) + && (line.startsWith("M-POST") || line.startsWith("Ext:"))) + { + result = AssertionResult.RESULT_FAILED; + failureDetail = this.validator.createFailureDetail(httpHeader, entryContext); + } + } //End While + + // Return assertion result + return validator.createAssertionResult(testAssertion, result, failureDetail); + } +}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/BP1006.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/BP1006.java new file mode 100644 index 000000000..b067ce09b --- /dev/null +++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/BP1006.java @@ -0,0 +1,69 @@ +/******************************************************************************* + * 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.message; + +import java.util.Map; + +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.profile.validator.impl.BaseMessageValidator; +import org.eclipse.wst.wsi.internal.core.report.AssertionResult; +import org.eclipse.wst.wsi.internal.core.util.HTTPUtils; + + +/** + * BP1006. + */ +public class BP1006 extends AssertionProcess +{ + private final BaseMessageValidator validator; + + /** + * @param BaseMessageValidator + */ + public BP1006(BaseMessageValidator impl) + { + super(impl); + this.validator = impl; + } + + public AssertionResult validate( + TestAssertion testAssertion, + EntryContext entryContext) + throws WSIException + { + // Parse the HTTP header + String rawHTTPHeader = entryContext.getMessageEntry().getHTTPHeaders(); + Map httpHeader = HTTPUtils.getHttpHeaderTokens(rawHTTPHeader, ":"); + + // Get the soap action header + String soapAction = (String) httpHeader.get("SOAPAction".toUpperCase()); + + // If there is no soap action header, then NA + if (soapAction == null) + { + result = AssertionResult.RESULT_NOT_APPLICABLE; + } + else if (!(soapAction.startsWith("\"")) || !(soapAction.endsWith("\""))) + { + result = AssertionResult.RESULT_FAILED; + failureDetail = + this.validator.createFailureDetail( + "HTTP Header: \"" + rawHTTPHeader + "\".", + entryContext); + } + + // Return assertion result + return validator.createAssertionResult(testAssertion, result, failureDetail); + } +}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/BP1010.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/BP1010.java new file mode 100644 index 000000000..faac735e3 --- /dev/null +++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/BP1010.java @@ -0,0 +1,126 @@ +/******************************************************************************* + * 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.message; + +import javax.wsdl.Binding; +import javax.wsdl.BindingOperation; +import javax.wsdl.Operation; + +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.profile.validator.impl.BaseMessageValidator; +import org.eclipse.wst.wsi.internal.core.report.AssertionResult; +import org.eclipse.wst.wsi.internal.core.util.HTTPUtils; +import org.eclipse.wst.wsi.internal.core.util.OperationSignature; +import org.eclipse.wst.wsi.internal.core.util.TypesRegistry; +import org.w3c.dom.Document; + + +/** + * BP1010. + * It MUST NOT contain a SOAP Envelope: the HTTP entity-body must be empty. + */ +public class BP1010 extends AssertionProcess +{ + private final BaseMessageValidator validator; + + /** + * @param BaseMessageValidator + */ + public BP1010(BaseMessageValidator impl) + { + super(impl); + this.validator = impl; + } + + /** + * @see org.eclipse.wst.wsi.test.profile.validator.impl.BaseValidatorImpl.AssertionProcess#validate(TestAssertion, EntryContext) + */ + public AssertionResult validate( + TestAssertion testAssertion, + EntryContext entryContext) + throws WSIException + { + + try + { + // Parse request message + Document docRequest = entryContext.getRequestDocument(); + + // get SOAPAction + String headers = entryContext.getRequest().getHTTPHeaders(); + String action = null; + if (headers != null) + action = (String) HTTPUtils.getHttpHeaderTokens(headers, ":").get("SOAPAction".toUpperCase()); + + Binding binding = validator.analyzerContext.getCandidateInfo().getBindings()[0]; + TypesRegistry registry = + new TypesRegistry( + this.validator.getWSDLDocument().getDefinitions(), + validator); + OperationSignature.OperationMatch match = + OperationSignature.matchOperation( + docRequest, + action, + binding, + registry); + + if (match == null) + { + result = AssertionResult.RESULT_NOT_APPLICABLE; + } + else + { + + BindingOperation bindingOperation = match.getOperation(); + //find operation in port type + Operation operation = bindingOperation.getOperation(); + if (operation == null) + { + result = AssertionResult.RESULT_FAILED; + } + else + { + if (operation.getOutput() == null) + { + String message = entryContext.getMessageEntry().getMessage(); + if (message.length() == 0) + { + result = AssertionResult.RESULT_PASSED; + } + else + { + result = AssertionResult.RESULT_FAILED; + } + } + else + { + result = AssertionResult.RESULT_NOT_APPLICABLE; + } + } + } + + if (result == AssertionResult.RESULT_FAILED) + { + failureDetail = this.validator.createFailureDetail(null, entryContext); + } + } + catch (Exception e) + { + result = AssertionResult.RESULT_NOT_APPLICABLE; + } + + // Return assertion result + return validator.createAssertionResult(testAssertion, result, failureDetail); + } +}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/BP1101.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/BP1101.java new file mode 100644 index 000000000..baecac158 --- /dev/null +++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/BP1101.java @@ -0,0 +1,86 @@ +/******************************************************************************* + * 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.message; + +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.profile.validator.impl.BaseMessageValidator; +import org.eclipse.wst.wsi.internal.core.report.AssertionResult; +import org.eclipse.wst.wsi.internal.core.util.Utils; + + +/** + * BP1101. + * A response message that does not contain a SOAP message SHOULD be sent + * using either a "200 OK" or "202 Accepted" HTTP status code. + */ +public class BP1101 extends AssertionProcess +{ + private final BaseMessageValidator validator; + + /** + * @param BaseMessageValidator + */ + public BP1101(BaseMessageValidator impl) + { + super(impl); + this.validator = impl; + } + + /** + * @see org.eclipse.wst.wsi.test.profile.validator.impl.BaseValidatorImpl.AssertionProcess#validate(TestAssertion, EntryContext) + */ + public AssertionResult validate( + TestAssertion testAssertion, + EntryContext entryContext) + throws WSIException + { + + // response does not contains SOAP message + if (entryContext.getMessageEntry().getMessage() == null + || "".equals(entryContext.getMessageEntry().getMessage())) + { + // check HTTP status code + String httpStatus = + Utils.getHTTPStatusCode( + entryContext.getMessageEntry().getHTTPHeaders()); + if ("200".equals(httpStatus)); + else if ("202".equals(httpStatus)); + + // If 4xx, then result is notApplicable + else if (httpStatus.startsWith("4")) + { + result = AssertionResult.RESULT_NOT_APPLICABLE; + } + else + { + result = AssertionResult.RESULT_WARNING; + failureDetail = + this.validator.createFailureDetail( + "\nResponse message:\nHeaders:\n" + + entryContext.getMessageEntry().getHTTPHeaders() + + "Message:\n" + + entryContext.getMessageEntry().getMessage(), + entryContext); + } + } + else + { + // response contains SOAP message + result = AssertionResult.RESULT_NOT_APPLICABLE; + } + + // Return assertion result + return validator.createAssertionResult(testAssertion, result, failureDetail); + } +}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/BP1103.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/BP1103.java new file mode 100644 index 000000000..900938f1f --- /dev/null +++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/BP1103.java @@ -0,0 +1,80 @@ +/******************************************************************************* + * 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.message; + +import org.eclipse.wst.wsi.internal.core.WSIException; +import org.eclipse.wst.wsi.internal.core.log.MessageEntry; +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.profile.validator.impl.BaseMessageValidator; +import org.eclipse.wst.wsi.internal.core.report.AssertionResult; +import org.eclipse.wst.wsi.internal.core.util.Utils; + + +/** + * BP1103. + * The request message should not contain a POST method. + */ +public class BP1103 extends AssertionProcess +{ + private final BaseMessageValidator validator; + + /** + * @param BaseMessageValidator + */ + public BP1103(BaseMessageValidator impl) + { + super(impl); + this.validator = impl; + } + + /** + * @see org.eclipse.wst.wsi.test.profile.validator.impl.BaseValidatorImpl.AssertionProcess#validate(TestAssertion, EntryContext) + */ + public AssertionResult validate( + TestAssertion testAssertion, + EntryContext entryContext) + throws WSIException + { + + MessageEntry request = entryContext.getRequest(); + String requestHeaders = request.getHTTPHeaders(); + + // Get HTTP status code + String httpStatus = + Utils.getHTTPStatusCode( + entryContext.getMessageEntry().getHTTPHeaders()); + + if (requestHeaders.startsWith("POST ")) + { + result = AssertionResult.RESULT_NOT_APPLICABLE; + } + else if (!"405".equals(httpStatus)) + { + result = AssertionResult.RESULT_WARNING; + failureDetail = + this.validator.createFailureDetail( + "\nRequest message:\nHeaders:\n" + + entryContext.getRequest().getHTTPHeaders() + + "\nMessage:\n" + + entryContext.getRequest().getMessage() + + "\n\nResponse message:\nHeaders:\n" + + entryContext.getResponse().getHTTPHeaders() + + "\nMessage:\n" + + entryContext.getResponse().getMessage(), + entryContext); + } + + // Return assertion result + return validator.createAssertionResult(testAssertion, result, failureDetail); + } +}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/BP1104.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/BP1104.java new file mode 100644 index 000000000..4fcdbd756 --- /dev/null +++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/BP1104.java @@ -0,0 +1,93 @@ +/******************************************************************************* + * 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.message; + +import org.eclipse.wst.wsi.internal.core.WSIConstants; +import org.eclipse.wst.wsi.internal.core.WSIException; +import org.eclipse.wst.wsi.internal.core.log.MessageEntry; +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.profile.validator.impl.BaseMessageValidator; +import org.eclipse.wst.wsi.internal.core.report.AssertionResult; +import org.eclipse.wst.wsi.internal.core.util.HTTPConstants; +import org.eclipse.wst.wsi.internal.core.util.HTTPUtils; +import org.eclipse.wst.wsi.internal.core.util.Utils; + + +/** + * BP1104. + * The request message should not contain a content-type of "text/xml". + */ +public class BP1104 extends AssertionProcess +{ + private final BaseMessageValidator validator; + + /** + * @param BaseMessageValidator + */ + public BP1104(BaseMessageValidator impl) + { + super(impl); + this.validator = impl; + } + + /** + * @see org.eclipse.wst.wsi.test.profile.validator.impl.BaseValidatorImpl.AssertionProcess#validate(TestAssertion, EntryContext) + */ + public AssertionResult validate( + TestAssertion testAssertion, + EntryContext entryContext) + throws WSIException + { + // check request for the "text/xml" content type + MessageEntry request = entryContext.getRequest(); + String headers = request.getHTTPHeaders(); + String contentType = (String) HTTPUtils.getHttpHeaderTokens(headers, ":") + .get(HTTPConstants.HEADER_CONTENT_TYPE.toUpperCase()); + + // Get HTTP status code + String httpStatus = + Utils.getHTTPStatusCode( + entryContext.getMessageEntry().getHTTPHeaders()); + + // If the request message has a content type of text/xml, + // then the assertion is not applicable + if (contentType != null + && contentType.indexOf(WSIConstants.CONTENT_TYPE_TEXT_XML) != -1) + { + result = AssertionResult.RESULT_NOT_APPLICABLE; + } + else + { + // check HTTP status code + if (!"415".equals(httpStatus)) + { + result = AssertionResult.RESULT_WARNING; + failureDetail = + this.validator.createFailureDetail( + "\nRequest message:\nHeaders:\n" + + entryContext.getRequest().getHTTPHeaders() + + "\nMessage:\n" + + entryContext.getRequest().getMessage() + + "\n\nResponse message:\nHeaders:\n" + + entryContext.getResponse().getHTTPHeaders() + + "\nMessage:\n" + + entryContext.getResponse().getMessage(), + entryContext); + } + } + + // Return assertion result + return validator.createAssertionResult( + testAssertion, result, failureDetail); + } +}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/BP1116.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/BP1116.java new file mode 100644 index 000000000..250f84f2b --- /dev/null +++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/BP1116.java @@ -0,0 +1,150 @@ +/******************************************************************************* + * 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.message; + +import javax.wsdl.extensions.soap.SOAPOperation; + +import org.eclipse.wst.wsi.internal.core.WSIException; +import org.eclipse.wst.wsi.internal.core.analyzer.AssertionNotApplicableException; +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.profile.validator.impl.BaseMessageValidator; +import org.eclipse.wst.wsi.internal.core.report.AssertionResult; +import org.eclipse.wst.wsi.internal.core.util.HTTPUtils; +import org.eclipse.wst.wsi.internal.core.util.OperationSignature; +import org.eclipse.wst.wsi.internal.core.util.TypesRegistry; +import org.eclipse.wst.wsi.internal.core.wsdl.traversal.WSDLTraversal; +import org.eclipse.wst.wsi.internal.core.wsdl.traversal.WSDLTraversalContext; +import org.w3c.dom.Document; + + +/** + * BP1116. + * SOAPAction header should contain a quoted string that has same + * value as the value of the soapbind:operation/@soapAction attribute, + * and an empty string ("") if there is no such attribute. + */ +public class BP1116 extends AssertionProcessVisitor +{ + + private final BaseMessageValidator validator; + + /** + * @param BaseMessageValidator + */ + public BP1116(BaseMessageValidator impl) + { + super(impl); + this.validator = impl; + } + + private String action = null; + private String headers = null; + + /* (non-Javadoc) + * @see org.wsi.wsdl.traversal.WSDLVisitor#visit(javax.wsdl.extensions.soap.SOAPOperation, java.lang.Object, org.wsi.wsdl.traversal.WSDLTraversalContext) + */ + public void visit( + SOAPOperation soapOper, + Object parent, + WSDLTraversalContext ctx) + { + String soapAction = soapOper.getSoapActionURI(); + if (soapAction == null) + { + if (!"".equals(action)) + { + result = AssertionResult.RESULT_FAILED; + failureDetailMessage = + "\nHTTP headers:\n" + headers + "\nsoapAction:\n" + soapAction; + } + } + else + { + if (!soapAction.equals(action)) + { + result = AssertionResult.RESULT_FAILED; + failureDetailMessage = + "\nHTTP headers:\n" + headers + "\nsoapAction:\n" + soapAction; + } + } + } + + /* (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 + { + try + { + // Parse request message + Document doc = entryContext.getMessageEntryDocument(); + + // get SOAPAction + headers = entryContext.getRequest().getHTTPHeaders(); + if (headers != null) + action = (String) HTTPUtils.getHttpHeaderTokens(headers, ":").get("SOAPAction".toUpperCase()); + + if (action == null) + throw new AssertionNotApplicableException(); + + if (action.length() > 1 + && action.charAt(0) == '"' + && action.charAt(action.length() - 1) == '"') + { + action = action.substring(1, action.length() - 1); + } + + OperationSignature.OperationMatch match = + OperationSignature.matchOperation( + doc, + null, + validator.analyzerContext.getCandidateInfo().getBindings()[0], + new TypesRegistry( + validator.analyzerContext + .getCandidateInfo() + .getWsdlDocument() + .getDefinitions(), + validator), + false); + + if (match != null) + { + WSDLTraversal traversal = new WSDLTraversal(); + //VisitorAdaptor.adapt(this); + traversal.setVisitor(this); + traversal.visitSOAPOperation(true); + traversal.traverse(match.getOperation()); + } + else + { + result = AssertionResult.RESULT_NOT_APPLICABLE; + } + } + catch (Exception e) + { + result = AssertionResult.RESULT_NOT_APPLICABLE; + } + + if (result == AssertionResult.RESULT_FAILED + && failureDetailMessage != null) + { + failureDetail = this.validator.createFailureDetail(failureDetailMessage, entryContext); + } + + // Return assertion result + return validator.createAssertionResult(testAssertion, result, failureDetail); + } +}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/BP4103.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/BP4103.java new file mode 100644 index 000000000..e63a5cf14 --- /dev/null +++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/BP4103.java @@ -0,0 +1,126 @@ +/******************************************************************************* + * 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.message; + +import org.eclipse.wst.wsi.internal.core.WSIException; +import org.eclipse.wst.wsi.internal.core.log.MessageEntry; +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.profile.validator.impl.BaseMessageValidator; +import org.eclipse.wst.wsi.internal.core.report.AssertionResult; +import org.eclipse.wst.wsi.internal.core.util.HTTPConstants; +import org.eclipse.wst.wsi.internal.core.util.HTTPUtils; + +/** + * BP4103 + * + * <context>For a candidate message in the message log file</context> + * <assertionDescription>The message contains an HTTP Authentication header field</assertionDescription> + */ +public class BP4103 extends AssertionProcess { + + private static final String HTTP_AUTH_SCHEME_BASIC = "Basic"; + private static final String HTTP_AUTH_SCHEME_DIGEST = "Digest"; + + private final BaseMessageValidator validator; + + /** + * @param BaseMessageValidator + */ + public BP4103(BaseMessageValidator impl) + { + super(impl); + this.validator = impl; + } + + public AssertionResult validate( + TestAssertion testAssertion, + EntryContext entryContext) + throws WSIException + { + // Getting message headers + String headers = entryContext.getMessageEntry().getHTTPHeaders(); + // If this is a request message + if (entryContext.getMessageEntry().getType().equals(MessageEntry.TYPE_REQUEST)) + { + // If the request headers contain authentication scheme "Basic" or "Digest" + // or there are no HTTP Authentication headers, the assertion is not applicable + if (!containsInvalidAuth(headers, HTTPConstants.HEADER_AUTHORIZATION) + && !containsInvalidAuth(headers, HTTPConstants.HEADER_PROXY_AUTHORIZATION)) + { + result = AssertionResult.RESULT_NOT_APPLICABLE; + } + } + // else this is a response + else + { + // If the response headers contain authentication scheme "Basic" or "Digest" + // or there are no HTTP Authentication headers, the assertion is not applicable + if (!containsInvalidAuth(headers, HTTPConstants.HEADER_WWW_AUTHENTICATE) + && !containsInvalidAuth(headers, HTTPConstants.HEADER_PROXY_AUTHENTICATE)) + { + result = AssertionResult.RESULT_NOT_APPLICABLE; + } + } + + // Assertion result has not been changed, HTTP Authentication headers + // does not contain authentication scheme "Basic" or "Digest", + // the assertion passed + if (result.equals(AssertionResult.RESULT_PASSED)) + { + failureDetail = validator.createFailureDetail( + testAssertion.getDetailDescription(), entryContext); + } + + // Return assertion result + return validator.createAssertionResult( + testAssertion, result, failureDetail); + } + + /** + * Checks whether HTTP headers contain HTTP Authentication headers that uses + * authentication scheme other than "Basic" or "Digest". + * @param headers HTTP headers. + * @param header a header name being retrieved. + * @return true if the HTTP Authentication header that uses authentication + * scheme other than "Basic" or "Digest" is found, false otherwise. + */ + private boolean containsInvalidAuth(String headers, String header) + { + // Getting a header value + String headerValue = null; + try + { + headerValue = (String) HTTPUtils.getHttpHeaderTokens(headers,":") + .get(header.toUpperCase()); + } + catch (Exception e) {} + + // If the header is presented + if (headerValue != null) + { + // Retrieving authentication scheme + int idxSP = headerValue.indexOf(" "); + if (idxSP > -1) + { + headerValue = headerValue.substring(0, idxSP); + } + // If a scheme is neither "Basic" nor "Digest", return true + if (!headerValue.equalsIgnoreCase(HTTP_AUTH_SCHEME_BASIC) + && !headerValue.equalsIgnoreCase(HTTP_AUTH_SCHEME_DIGEST)) + { + return true; + } + } + return false; + } +}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/BP4104.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/BP4104.java new file mode 100644 index 000000000..36d0cf961 --- /dev/null +++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/BP4104.java @@ -0,0 +1,87 @@ +/******************************************************************************* + * 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.message; + +import java.util.Iterator; +import java.util.List; +import java.util.Map; + +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.profile.validator.impl.BaseMessageValidator; +import org.eclipse.wst.wsi.internal.core.report.AssertionResult; +import org.eclipse.wst.wsi.internal.core.util.HTTPConstants; +import org.eclipse.wst.wsi.internal.core.util.HTTPUtils; + +/** + * BP4104 + * <context>For a candidate message in the message log file containing an HTTP Header field that is not from the following list of specified header fields: (http://www.mnot.net/drafts/draft-nottingham-http-header-reg-00.txt)</context> + * <assertionDescription>The message contains an HTTP Header field that is not from the following list of specified header fields: (http://www.mnot.net/drafts/draft-nottingham-http-header-reg-00.txt)</assertionDescription> + */ +public class BP4104 extends AssertionProcess { + + private final BaseMessageValidator validator; + + private List knownHeaderNames; + + /** + * @param BaseMessageValidator + */ + public BP4104(BaseMessageValidator impl) + { + super(impl); + this.validator = impl; + knownHeaderNames = null; + } + + private List getAllKnownHeaderNames() { + if (knownHeaderNames == null) { + knownHeaderNames = HTTPConstants.getAllKnownHeaderNames(); + } + return knownHeaderNames; + } + + public AssertionResult validate( + TestAssertion testAssertion, + EntryContext entryContext) + throws WSIException + { + + // getting HTTP Headers + Map hmap = HTTPUtils.getHttpHeaderTokens( + entryContext.getMessageEntry().getHTTPHeaders(), ":"); + + Iterator i = hmap.keySet().iterator() ; + while (i.hasNext()) { + String headerName = (String) i.next(); + // If header name is not known, then the assertion passed + if (!getAllKnownHeaderNames().contains(headerName.toUpperCase())) + { + failureDetail = validator.createFailureDetail( + testAssertion.getDetailDescription(), entryContext); + + break; + } + } + + // If there is no HTTP header that is not from a list, + // then the assertion is not applicable + if (failureDetail == null) + { + result = AssertionResult.RESULT_NOT_APPLICABLE; + } + + return validator.createAssertionResult( + testAssertion, result, failureDetail); + } +}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/BP4105.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/BP4105.java new file mode 100644 index 000000000..d14f77888 --- /dev/null +++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/BP4105.java @@ -0,0 +1,95 @@ +/******************************************************************************* + * 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.message; + +import java.util.StringTokenizer; + +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.profile.validator.impl.BaseMessageValidator; +import org.eclipse.wst.wsi.internal.core.report.AssertionResult; +import org.eclipse.wst.wsi.internal.core.util.HTTPConstants; +import org.eclipse.wst.wsi.internal.core.util.HTTPUtils; + + +/** + * BP4105 + * <context>For a candidate message in the message log file containing a Content-encoding HTTP header field with a value other than "gzip", "compress" or "deflate"</context> + * <assertionDescription>The contained Content-encoding HTTP header field has a value other than "gzip", "compress" or "deflate".</assertionDescription> + */ +public class BP4105 extends AssertionProcess { + + // All the registered content-coding value tokens (RFC2616) except "identity" + private static final String GZIP_VALUE = "gzip"; + private static final String COMPRESS_VALUE = "compress"; + private static final String DEFLATE_VALUE = "deflate"; + + private final BaseMessageValidator validator; + + /** + * @param BaseMessageValidator + */ + public BP4105(BaseMessageValidator impl) + { + super(impl); + this.validator = impl; + } + + public AssertionResult validate( + TestAssertion testAssertion, + EntryContext entryContext) + throws WSIException + { + + // Getting the Content-Encoding HTTP header value + String contentEncoding = (String) HTTPUtils.getHttpHeaderTokens( + entryContext.getMessageEntry().getHTTPHeaders(), + ":").get(HTTPConstants.HEADER_CONTENT_ENCODING.toUpperCase()); + + if (contentEncoding != null) + { + // Lowering value's case because RFC2616 says + // that all content-coding values are case-insensitive + contentEncoding = contentEncoding.toLowerCase(); + + // Multiple encodings can be applied to an entity, + // so breaking the value into tokens + StringTokenizer st = new StringTokenizer(contentEncoding, ","); + while (st.hasMoreTokens()) + { + String token = st.nextToken().trim(); + // If a token does not equal to any registered one + // then the assertion passed + if ( !token.equals(GZIP_VALUE) + && !token.equals(COMPRESS_VALUE) + && !token.equals(DEFLATE_VALUE)) { + + failureDetail = validator.createFailureDetail( + testAssertion.getDetailDescription(), entryContext); + + break; + } + } + } + + // If there is no unregistered value of Content-Encoding, + // then the assertion is not applicable + if (failureDetail == null) + { + result = AssertionResult.RESULT_NOT_APPLICABLE; + } + + return validator.createAssertionResult( + testAssertion, result, failureDetail); + } +}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/BP4106.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/BP4106.java new file mode 100644 index 000000000..a278633b0 --- /dev/null +++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/BP4106.java @@ -0,0 +1,77 @@ +/******************************************************************************* + * 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.message; + +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.profile.validator.impl.BaseMessageValidator; +import org.eclipse.wst.wsi.internal.core.report.AssertionResult; +import org.eclipse.wst.wsi.internal.core.util.HTTPConstants; +import org.eclipse.wst.wsi.internal.core.util.HTTPUtils; + + +/** + * BP4106 + * <context>For a candidate response message in the message log file that contains a transfer-encoding HTTP header field.</context> + * <assertionDescription>The contained transfer-encoding HTTP header field has a value of "chunked"</assertionDescription> + */ +public class BP4106 extends AssertionProcess { + + private static final String CHUNKED_VALUE = "chunked"; + + private final BaseMessageValidator validator; + + /** + * @param BaseMessageValidator + */ + public BP4106(BaseMessageValidator impl) + { + super(impl); + this.validator = impl; + } + + public AssertionResult validate( + TestAssertion testAssertion, + EntryContext entryContext) + throws WSIException + { + + // Getting a Transfer-Encoding HTTP header value + String transferEncoding = (String) HTTPUtils.getHttpHeaderTokens( + entryContext.getMessageEntry().getHTTPHeaders(), + ":").get(HTTPConstants.HEADER_TRANSFER_ENCODING.toUpperCase()); + + if (transferEncoding != null) + { + // Lowering value's case because RFC2616 says + // that all transfer-coding values are case-insensitive + transferEncoding = transferEncoding.toLowerCase(); + + // If the value is other than "chunked", then the assertion passed + if (!transferEncoding.equals(CHUNKED_VALUE)) { + failureDetail = validator.createFailureDetail( + testAssertion.getDetailDescription(), entryContext); + } + } + + // If there is no Tranfer-Encoding or its value is "chunked", + // then the assertion is not applicable + if (failureDetail == null) + { + result = AssertionResult.RESULT_NOT_APPLICABLE; + } + + return validator.createAssertionResult( + testAssertion, result, failureDetail); + } +}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/BP4107.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/BP4107.java new file mode 100644 index 000000000..e699a3320 --- /dev/null +++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/BP4107.java @@ -0,0 +1,66 @@ +/******************************************************************************* + * 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.message; + +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.profile.validator.impl.BaseMessageValidator; +import org.eclipse.wst.wsi.internal.core.report.AssertionResult; +import org.eclipse.wst.wsi.internal.core.util.HTTPConstants; +import org.eclipse.wst.wsi.internal.core.util.HTTPUtils; + + +/** + * BP4107 + * <context>For a request message containing an Upgrade field in the HTTP Headers.</context> + * <assertionDescription>The request message contains an Upgrade field in the HTTP Headers.</assertionDescription> + */ +public class BP4107 extends AssertionProcess { + + private final BaseMessageValidator validator; + + /** + * @param BaseMessageValidator + */ + public BP4107(BaseMessageValidator impl) + { + super(impl); + this.validator = impl; + } + + public AssertionResult validate( + TestAssertion testAssertion, + EntryContext entryContext) + throws WSIException + { + // Getting the Upgrade HTTP header value + String upgrage = (String) HTTPUtils.getHttpHeaderTokens( + entryContext.getMessageEntry().getHTTPHeaders(), + ":").get(HTTPConstants.HEADER_UPGRADE.toUpperCase()); + + // If the header is presented, then the assertion passed + if (upgrage != null) + { + failureDetail = validator.createFailureDetail( + testAssertion.getDetailDescription(), entryContext); + } + // else the assertion is not applicable + else + { + result = AssertionResult.RESULT_NOT_APPLICABLE; + } + + return validator.createAssertionResult( + testAssertion, result, failureDetail); + } +}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/MessageValidatorImpl.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/MessageValidatorImpl.java new file mode 100644 index 000000000..015bff2a2 --- /dev/null +++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/MessageValidatorImpl.java @@ -0,0 +1,57 @@ +/******************************************************************************* + * Copyright (c) 2002-2003 IBM Corporation, Parasoft 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 + * Parasoft - Initial API and implementation + *******************************************************************************/ +package org.eclipse.wst.wsi.internal.core.profile.validator.impl.message; + +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.MessageValidator; +import org.eclipse.wst.wsi.internal.core.profile.validator.impl.BaseMessageValidator; +import org.eclipse.wst.wsi.internal.core.util.EntryType; + +/** + * @version 1.0 + */ +public class MessageValidatorImpl + extends BaseMessageValidator + implements MessageValidator +{ + /* (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 entryContext) + { + boolean match = false; + + // Verify that the entry and test assertion have the same primary context + if ((testAssertion.getEntryTypeName().equals(EntryType.TYPE_MESSAGE_ANY)) + || (testAssertion.getEntryTypeName().equals(EntryType.TYPE_MESSAGE_REQUEST) + && (entryContext + .getEntry() + .getEntryType() + .getTypeName() + .equals(EntryType.TYPE_MESSAGE_REQUEST))) + || (testAssertion.getEntryTypeName().equals(EntryType.TYPE_MESSAGE_RESPONSE) + && (entryContext + .getEntry() + .getEntryType() + .getTypeName() + .equals(EntryType.TYPE_MESSAGE_RESPONSE))) + || testAssertion.getEntryTypeName().equals(EntryType.TYPE_MIME_ROOT_PART) + || testAssertion.getEntryTypeName().equals(EntryType.TYPE_MIME_PART)) + { + match = true; + } + + return match; + } +}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/SSBP1003.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/SSBP1003.java new file mode 100644 index 000000000..461eae6c4 --- /dev/null +++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/SSBP1003.java @@ -0,0 +1,228 @@ +/******************************************************************************* + * 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.message; + +import java.util.Map; + +import org.eclipse.wst.wsi.internal.core.WSIConstants; +import org.eclipse.wst.wsi.internal.core.WSIException; +import org.eclipse.wst.wsi.internal.core.analyzer.AssertionFailException; +import org.eclipse.wst.wsi.internal.core.analyzer.AssertionNotApplicableException; +import org.eclipse.wst.wsi.internal.core.analyzer.AssertionPassException; +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.profile.validator.impl.BaseMessageValidator; +import org.eclipse.wst.wsi.internal.core.report.AssertionResult; +import org.eclipse.wst.wsi.internal.core.util.HTTPUtils; + + +/** + * SSBP1003. + * + * <context>For a candidate non-multipart/related message in the log file, which has a non-empty entity-body</context> + * <assertionDescription> + * The logged SOAP envelope is a UTF-8 transcript of an envelope originally encoded as UTF-8 or UTF-16. + * The HTTP Content-Type header's charset value is either UTF-8 or UTF-16. Looking at the messageContent + * element of the logged message, either + * (1) it has a BOM attribute which maps the charset value in the Content-Type header, or + * (2) it has it has an XML declaration which matches the charset value in the Content-Type header, or + * (3) there is no BOM attribute and no XML declaration, and the charset value is UTF-8. + * </assertionDescription> + * + * @author lauzond + */ +public class SSBP1003 extends AssertionProcess +{ + protected final BaseMessageValidator validator; + + /** + * @param BaseMessageValidator + */ + public SSBP1003(BaseMessageValidator impl) + { + super(impl); + this.validator = impl; + } + + public AssertionResult validate( + TestAssertion testAssertion, + EntryContext entryContext) + throws WSIException + { + try + { + // If there is a response message for one-way operation, the assertion is not applicable + if (validator.isOneWayResponse(entryContext)) + { + throw new AssertionNotApplicableException(); + } + + String httpHeader = entryContext.getMessageEntry().getHTTPHeaders(); + + Map httpHeaderMap = HTTPUtils.getHttpHeaderTokens(httpHeader, ":"); + String contentType = (String) httpHeaderMap.get("Content-Type".toUpperCase()); + + if (contentType == null) + { + throw new AssertionFailException( + "The Content-Type header is not present."); + } + + contentType = contentType.trim(); + String charset = contentType.substring( + contentType.indexOf(";") + 1, contentType.length()); + charset = charset.trim(); + if (!charset.startsWith("charset")) + { + throw new AssertionFailException( + "Missing or bad \"charset\" attribute in the Content-Type header: " + + charset); + } + + String charsetValue = charset.substring( + charset.indexOf("=") + 1, charset.length()); + if (charsetValue.startsWith("\"")) + { + charsetValue = charsetValue.substring(1, charsetValue.length() - 1); + } + + if (!charsetValue.equalsIgnoreCase("utf-8") + && !charsetValue.equalsIgnoreCase("utf-16")) + { + throw new AssertionFailException("The value of the \"charset\" " + + "attribute of the Content-Type header is " + contentType); + } + // Parse log message + //gets first string + int idx = entryContext.getMessageEntry().getMessage().indexOf("<?xml"); + if (idx == -1) + { + throw new AssertionPassException(); + } + + int idx2 = entryContext.getMessageEntry().getMessage().indexOf("?>"); + if (idx2 == -1) + { + throw new AssertionPassException(); + } + + String xmlDeclaration = entryContext.getMessageEntry().getMessage() + .substring(idx, idx2 + "?>".length()); + + idx = xmlDeclaration.indexOf("encoding"); + if (idx == -1) + { + if (charsetValue.equalsIgnoreCase("utf-8")) + { + throw new AssertionPassException(); + } + else + { + throw new AssertionFailException("There is no XML declaration and the" + + " charset value in the Content-Type header is not UTF-8." + + "\nCharset value in the Content-Type header: " + charsetValue); + } + } + + int idxQ = xmlDeclaration.indexOf('\'', idx); + int idxQQ = xmlDeclaration.indexOf('\"', idx); + int idxQuote = -1; + char qouteCh = '\0'; + if (idxQ == -1) + { + idxQuote = idxQQ; + qouteCh = '\"'; + } + else + { + if (idxQQ == -1) + { + idxQuote = idxQ; + qouteCh = '\''; + } + else + { + if (idxQQ < idxQ) + { + idxQuote = idxQQ; + qouteCh = '\"'; + } + else + { + idxQuote = idxQ; + qouteCh = '\''; + } + } + } + + if (idxQuote == -1 || qouteCh == '\0') + { + throw new AssertionPassException(); + } + + int idxLQoute = xmlDeclaration.indexOf(qouteCh, idxQuote + 1); + + if (idxLQoute == -1) + { + throw new AssertionPassException(); + } + + String xmlEncoding = + xmlDeclaration.substring(idxQuote + 1, idxLQoute); + if (charsetValue.equalsIgnoreCase(xmlEncoding)) + { + // If there is a BOM, then check that it is the same as the xmlEncoding + int bom = 0; + if ((bom = entryContext.getMessageEntry().getBOM()) != 0) + { + if ((bom == WSIConstants.BOM_UTF8 + && !xmlEncoding.equalsIgnoreCase("utf-8")) + || ((bom == WSIConstants.BOM_UTF16 + && !xmlEncoding.equalsIgnoreCase("utf-16"))) + || ((bom == WSIConstants.BOM_UTF16_BIG_ENDIAN + && !xmlEncoding.equalsIgnoreCase("utf-16")))) + { + throw new AssertionFailException( + "The BOM and XML declaration do not match."); + } + } + + throw new AssertionPassException(); + } + else + { + throw new AssertionFailException("There is an XML declaration, but its " + + "encoding value does not match the charset value.\n" + + "Charset value in the Content-Type header: " + charsetValue + + "\nEncoding in the XML declaration: " + xmlEncoding); + } + } + catch (AssertionPassException e) + { + result = AssertionResult.RESULT_PASSED; + } + catch (AssertionNotApplicableException anae) + { + result = AssertionResult.RESULT_NOT_APPLICABLE; + } + catch (AssertionFailException afe) + { + result = AssertionResult.RESULT_FAILED; + failureDetail = validator.createFailureDetail( + afe.getMessage(), entryContext); + } + + // Return assertion result + return validator.createAssertionResult( + testAssertion, result, failureDetail); + } +}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/SSBP5100.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/SSBP5100.java new file mode 100644 index 000000000..f62152a45 --- /dev/null +++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/SSBP5100.java @@ -0,0 +1,80 @@ +/******************************************************************************* + * 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.message; + +import org.eclipse.wst.wsi.internal.core.WSIException; +import org.eclipse.wst.wsi.internal.core.analyzer.AssertionFailException; +import org.eclipse.wst.wsi.internal.core.analyzer.AssertionNotApplicableException; +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.profile.validator.impl.BaseMessageValidator; +import org.eclipse.wst.wsi.internal.core.report.AssertionResult; +import org.eclipse.wst.wsi.internal.core.xml.XMLUtils; +import org.w3c.dom.Document; + + +/** + * SSBP5100 + * <context>For a candidate message in the log file, with an HTTP entity-body.</context> + * <assertionDescription>The SOAP envelope is the exclusive payload of the HTTP entity-body.</assertionDescription> + */ +public class SSBP5100 extends AssertionProcess { + + protected final BaseMessageValidator validator; + + /** + * @param BaseMessageValidator + */ + public SSBP5100(BaseMessageValidator impl) + { + super(impl); + this.validator = impl; + } + + public AssertionResult validate( + TestAssertion testAssertion, + EntryContext entryContext) + throws WSIException + { + + try + { + // Getting a message document + Document doc = entryContext.getMessageEntryDocument(); + + // If the message is empty or invalid, the assertion is not applicable + if (doc == null) + { + if (this.validator.isOneWayResponse(entryContext)) + throw new AssertionNotApplicableException(); + else + throw new AssertionFailException(); + } + if (!doc.getDocumentElement().getLocalName().equals(XMLUtils.SOAP_ELEM_ENVELOPE)) + throw new AssertionFailException(); + } + catch (AssertionFailException afe) + { + result = AssertionResult.RESULT_FAILED; + failureDetail = validator.createFailureDetail( + testAssertion.getFailureMessage(), + entryContext); + } + catch (AssertionNotApplicableException anae) + { + result = AssertionResult.RESULT_NOT_APPLICABLE; + } + + return validator.createAssertionResult( + testAssertion, result, failureDetail); + } +}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/SSBP5101.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/SSBP5101.java new file mode 100644 index 000000000..82ae52074 --- /dev/null +++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/SSBP5101.java @@ -0,0 +1,67 @@ +/******************************************************************************* + * 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.message; + +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.profile.validator.impl.BaseMessageValidator; +import org.eclipse.wst.wsi.internal.core.report.AssertionResult; +import org.eclipse.wst.wsi.internal.core.util.HTTPConstants; +import org.eclipse.wst.wsi.internal.core.util.HTTPUtils; + +/** + * SSBP5101 + * <context>For a candidate message in the log file.</context> + * <assertionDescription>A message must have a "Content-Type" HTTP header field. The "Content-Type" HTTP header field must have a field-value whose media type is "text/xml".</assertionDescription> + * + * @author lauzond + */ +public class SSBP5101 extends AssertionProcess { + + protected final BaseMessageValidator validator; + + /** + * @param BaseMessageValidator + */ + public SSBP5101(BaseMessageValidator impl) + { + super(impl); + this.validator = impl; + } + + public AssertionResult validate( + TestAssertion testAssertion, + EntryContext entryContext) + throws WSIException + { + + // getting Content-Type HTTP header + String contentType = (String) HTTPUtils.getHttpHeaderTokens( + entryContext.getMessageEntry().getHTTPHeaders(), + ":").get(HTTPConstants.HEADER_CONTENT_TYPE.toUpperCase()); + + // if Content-Type header is not presented + // or does not equal to text/xml, then the assertion is failed + if (contentType == null + || !contentType.startsWith(WSIConstants.CONTENT_TYPE_TEXT_XML)) + { + result = AssertionResult.RESULT_FAILED; + failureDetail = validator.createFailureDetail( + testAssertion.getFailureMessage(), + entryContext); + } + return this.validator.createAssertionResult( + testAssertion, result, failureDetail); + } +}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/WSI1001.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/WSI1001.java new file mode 100644 index 000000000..53066b547 --- /dev/null +++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/WSI1001.java @@ -0,0 +1,28 @@ +/******************************************************************************* + * 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.message; + +import org.eclipse.wst.wsi.internal.core.profile.validator.impl.BaseMessageValidator; + +/** + * WSI1001 + */ +public class WSI1001 extends BP1001 +{ + + /** + * @param BaseMessageValidator + */ + public WSI1001(BaseMessageValidator 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/message/WSI1002.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/WSI1002.java new file mode 100644 index 000000000..cb4308bf4 --- /dev/null +++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/WSI1002.java @@ -0,0 +1,28 @@ +/******************************************************************************* + * 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.message; + +import org.eclipse.wst.wsi.internal.core.profile.validator.impl.BaseMessageValidator; + +/** + * WSI1002 + */ +public class WSI1002 extends BP1002 +{ + + /** + * @param BaseMessageValidator + */ + public WSI1002(BaseMessageValidator 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/message/WSI1003.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/WSI1003.java new file mode 100644 index 000000000..7d041049f --- /dev/null +++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/WSI1003.java @@ -0,0 +1,28 @@ +/******************************************************************************* + * 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.message; + +import org.eclipse.wst.wsi.internal.core.profile.validator.impl.BaseMessageValidator; + +/** + * WSI1003 + */ +public class WSI1003 extends SSBP1003 +{ + + /** + * @param BaseMessageValidator + */ + public WSI1003(BaseMessageValidator 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/message/WSI1004.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/WSI1004.java new file mode 100644 index 000000000..adfad8642 --- /dev/null +++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/WSI1004.java @@ -0,0 +1,28 @@ +/******************************************************************************* + * 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.message; + +import org.eclipse.wst.wsi.internal.core.profile.validator.impl.BaseMessageValidator; + +/** + * WSI1004 + */ +public class WSI1004 extends BP1004 +{ + + /** + * @param BaseMessageValidator + */ + public WSI1004(BaseMessageValidator 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/message/WSI1005.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/WSI1005.java new file mode 100644 index 000000000..f31c00676 --- /dev/null +++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/WSI1005.java @@ -0,0 +1,29 @@ +/******************************************************************************* + * 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.message; + +import org.eclipse.wst.wsi.internal.core.profile.validator.impl.BaseMessageValidator; +import org.eclipse.wst.wsi.internal.core.profile.validator.impl.envelope.BP1005; + +/** + * WSI1005 + */ +public class WSI1005 extends BP1005 +{ + + /** + * @param BaseMessageValidator + */ + public WSI1005(BaseMessageValidator 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/message/WSI1006.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/WSI1006.java new file mode 100644 index 000000000..72d6f8824 --- /dev/null +++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/WSI1006.java @@ -0,0 +1,28 @@ +/******************************************************************************* + * 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.message; + +import org.eclipse.wst.wsi.internal.core.profile.validator.impl.BaseMessageValidator; + +/** + * WSI1006 + */ +public class WSI1006 extends BP1006 +{ + + /** + * @param BaseMessageValidator + */ + public WSI1006(BaseMessageValidator 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/message/WSI1007.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/WSI1007.java new file mode 100644 index 000000000..9385aaaa8 --- /dev/null +++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/WSI1007.java @@ -0,0 +1,29 @@ +/******************************************************************************* + * 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.message; + +import org.eclipse.wst.wsi.internal.core.profile.validator.impl.BaseMessageValidator; +import org.eclipse.wst.wsi.internal.core.profile.validator.impl.envelope.BP1007; + +/** + * WSI1007 + */ +public class WSI1007 extends BP1007 +{ + + /** + * @param BaseMessageValidator + */ + public WSI1007(BaseMessageValidator 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/message/WSI1008.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/WSI1008.java new file mode 100644 index 000000000..92cd0eeab --- /dev/null +++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/WSI1008.java @@ -0,0 +1,29 @@ +/******************************************************************************* + * 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.message; + +import org.eclipse.wst.wsi.internal.core.profile.validator.impl.BaseMessageValidator; +import org.eclipse.wst.wsi.internal.core.profile.validator.impl.envelope.BP1008; + +/** + * WSI1008 + */ +public class WSI1008 extends BP1008 +{ + + /** + * @param BaseMessageValidator + */ + public WSI1008(BaseMessageValidator 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/message/WSI1009.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/WSI1009.java new file mode 100644 index 000000000..5b68ebe20 --- /dev/null +++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/WSI1009.java @@ -0,0 +1,29 @@ +/******************************************************************************* + * 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.message; + +import org.eclipse.wst.wsi.internal.core.profile.validator.impl.BaseMessageValidator; +import org.eclipse.wst.wsi.internal.core.profile.validator.impl.envelope.BP1009; + +/** + * WSI1009 + */ +public class WSI1009 extends BP1009 +{ + + /** + * @param BaseMessageValidator + */ + public WSI1009(BaseMessageValidator 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/message/WSI1010.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/WSI1010.java new file mode 100644 index 000000000..022d98692 --- /dev/null +++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/WSI1010.java @@ -0,0 +1,28 @@ +/******************************************************************************* + * 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.message; + +import org.eclipse.wst.wsi.internal.core.profile.validator.impl.BaseMessageValidator; + +/** + * WSI1010 + */ +public class WSI1010 extends BP1010 +{ + + /** + * @param BaseMessageValidator + */ + public WSI1010(BaseMessageValidator 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/message/WSI1011.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/WSI1011.java new file mode 100644 index 000000000..cadcdcb4a --- /dev/null +++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/WSI1011.java @@ -0,0 +1,29 @@ +/******************************************************************************* + * 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.message; + +import org.eclipse.wst.wsi.internal.core.profile.validator.impl.BaseMessageValidator; +import org.eclipse.wst.wsi.internal.core.profile.validator.impl.envelope.BP1011; + +/** + * WSI1011 + */ +public class WSI1011 extends BP1011 +{ + + /** + * @param BaseMessageValidator + */ + public WSI1011(BaseMessageValidator 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/message/WSI1012.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/WSI1012.java new file mode 100644 index 000000000..57f571be1 --- /dev/null +++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/WSI1012.java @@ -0,0 +1,29 @@ +/******************************************************************************* + * 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.message; + +import org.eclipse.wst.wsi.internal.core.profile.validator.impl.BaseMessageValidator; +import org.eclipse.wst.wsi.internal.core.profile.validator.impl.envelope.BP1012; + +/** + * WSI1012 + */ +public class WSI1012 extends BP1012 +{ + + /** + * @param BaseMessageValidator + */ + public WSI1012(BaseMessageValidator 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/message/WSI1013.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/WSI1013.java new file mode 100644 index 000000000..587e597bf --- /dev/null +++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/WSI1013.java @@ -0,0 +1,29 @@ +/******************************************************************************* + * 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.message; + +import org.eclipse.wst.wsi.internal.core.profile.validator.impl.BaseMessageValidator; +import org.eclipse.wst.wsi.internal.core.profile.validator.impl.envelope.BP1013; + +/** + * WSI1013 + */ +public class WSI1013 extends BP1013 +{ + + /** + * @param BaseMessageValidator + */ + public WSI1013(BaseMessageValidator 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/message/WSI1031.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/WSI1031.java new file mode 100644 index 000000000..dcd391783 --- /dev/null +++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/WSI1031.java @@ -0,0 +1,29 @@ +/******************************************************************************* + * 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.message; + +import org.eclipse.wst.wsi.internal.core.profile.validator.impl.BaseMessageValidator; +import org.eclipse.wst.wsi.internal.core.profile.validator.impl.envelope.BP1031; + +/** + * WSI1031 + */ +public class WSI1031 extends BP1031 +{ + + /** + * @param BaseMessageValidator + */ + public WSI1031(BaseMessageValidator 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/message/WSI1100.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/WSI1100.java new file mode 100644 index 000000000..4c20a04cd --- /dev/null +++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/WSI1100.java @@ -0,0 +1,29 @@ +/******************************************************************************* + * 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.message; + +import org.eclipse.wst.wsi.internal.core.profile.validator.impl.BaseMessageValidator; +import org.eclipse.wst.wsi.internal.core.profile.validator.impl.envelope.BP1100; + +/** + * WSI1100 + */ +public class WSI1100 extends BP1100 +{ + + /** + * @param BaseMessageValidator + */ + public WSI1100(BaseMessageValidator 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/message/WSI1101.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/WSI1101.java new file mode 100644 index 000000000..cbb113c82 --- /dev/null +++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/WSI1101.java @@ -0,0 +1,28 @@ +/******************************************************************************* + * 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.message; + +import org.eclipse.wst.wsi.internal.core.profile.validator.impl.BaseMessageValidator; + +/** + * WSI1101 + */ +public class WSI1101 extends BP1101 +{ + + /** + * @param BaseMessageValidator + */ + public WSI1101(BaseMessageValidator 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/message/WSI1102.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/WSI1102.java new file mode 100644 index 000000000..f13832dca --- /dev/null +++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/WSI1102.java @@ -0,0 +1,150 @@ +/******************************************************************************* + * 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.message; + +import java.io.StringReader; + +import javax.xml.parsers.DocumentBuilder; +import javax.xml.parsers.DocumentBuilderFactory; + +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.profile.validator.impl.BaseMessageValidator; +import org.eclipse.wst.wsi.internal.core.report.AssertionResult; +import org.eclipse.wst.wsi.internal.core.util.HTTPConstants; +import org.eclipse.wst.wsi.internal.core.util.HTTPUtils; +import org.eclipse.wst.wsi.internal.core.util.HttpHeadersValidator; +import org.eclipse.wst.wsi.internal.core.util.Utils; +import org.xml.sax.InputSource; +import org.xml.sax.SAXException; + + +/** + * BPWSI4. + * The request message should be invalid (HTTP request malformed, + * XML not well formed, ...). + */ +public class WSI1102 extends AssertionProcess +{ + private final BaseMessageValidator validator; + + /** + * @param BaseMessageValidator + */ + public WSI1102(BaseMessageValidator impl) + { + super(impl); + this.validator = impl; + } + + /* (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 + { + + String httpHeader = entryContext.getMessageEntry().getHTTPHeaders(); + + String requestMessage = null; + //String responseMessage = null; + String contentType = null; + result = null; + // + + try + { + // check HTTP status code + String httpStatus = + Utils.getHTTPStatusCode( + entryContext.getMessageEntry().getHTTPHeaders()); + if ("400".equals(httpStatus)) + { + + requestMessage = entryContext.getRequest().getMessage(); + + String requestHTTPHeaders = + entryContext.getRequest().getHTTPHeaders(); + + //check request HTTP Headers + + //HttpHeadersValidator validator = new HttpHeadersValidator(); + + if (!HttpHeadersValidator + .validateHttpRequestHeaders(requestHTTPHeaders)) + { + result = AssertionResult.RESULT_PASSED; + } + + //check request xml message + + contentType = (String) HTTPUtils.getHttpHeaderTokens(httpHeader, ":") + .get(HTTPConstants.HEADER_CONTENT_TYPE.toUpperCase()); + if (contentType.indexOf(WSIConstants.CONTENT_TYPE_TEXT_XML) != -1) + { + try + { + if (requestMessage != null) + { + DocumentBuilderFactory factory = + DocumentBuilderFactory.newInstance(); + DocumentBuilder builder = factory.newDocumentBuilder(); + //Document doc = builder.parse(new InputSource(new StringReader(requestMessage))); + builder.parse( + new InputSource(new StringReader(requestMessage))); + } + + } + catch (SAXException e) + { + result = AssertionResult.RESULT_PASSED; + } + catch (Exception e) + { + new WSIException(e.getMessage(), e); + } + } + + if (result == null) + { + result = AssertionResult.RESULT_WARNING; + failureDetail = + this.validator.createFailureDetail( + "\nRequest message:\nHeaders:\n" + + entryContext.getRequest().getHTTPHeaders() + + "Message:\n" + + entryContext.getRequest().getMessage() + + "\n\nResponse message:\nHeaders:\n" + + entryContext.getResponse().getHTTPHeaders() + + "Message:\n" + + entryContext.getResponse().getMessage(), + entryContext); + } + } + else + { + result = AssertionResult.RESULT_NOT_APPLICABLE; + } + } + catch (WSIException wsie) + { + result = AssertionResult.RESULT_NOT_APPLICABLE; + } + + // Return assertion result + return validator.createAssertionResult(testAssertion, result, failureDetail); + } +}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/WSI1103.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/WSI1103.java new file mode 100644 index 000000000..624652944 --- /dev/null +++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/WSI1103.java @@ -0,0 +1,28 @@ +/******************************************************************************* + * 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.message; + +import org.eclipse.wst.wsi.internal.core.profile.validator.impl.BaseMessageValidator; + +/** + * WSI1103 + */ +public class WSI1103 extends BP1103 +{ + + /** + * @param BaseMessageValidator + */ + public WSI1103(BaseMessageValidator 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/message/WSI1104.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/WSI1104.java new file mode 100644 index 000000000..422e46dda --- /dev/null +++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/WSI1104.java @@ -0,0 +1,29 @@ +/******************************************************************************* + * 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.message; + +import org.eclipse.wst.wsi.internal.core.profile.validator.impl.BaseMessageValidator; + +/** + * WSI1104. + * The request message should not contain a content-type of "text/xml". + */ +public class WSI1104 extends BP1104 +{ + + /** + * @param BaseMessageValidator + */ + public WSI1104(BaseMessageValidator impl) + { + super(impl); + } +} diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/WSI1105.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/WSI1105.java new file mode 100644 index 000000000..4d1a3bc26 --- /dev/null +++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/WSI1105.java @@ -0,0 +1,110 @@ +/******************************************************************************* + * 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.message; + +import org.eclipse.wst.wsi.internal.core.WSIException; +import org.eclipse.wst.wsi.internal.core.log.MessageEntry; +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.profile.validator.impl.BaseMessageValidator; +import org.eclipse.wst.wsi.internal.core.report.AssertionResult; +import org.eclipse.wst.wsi.internal.core.util.HTTPUtils; +import org.eclipse.wst.wsi.internal.core.util.SetCookie2Validator; + + +/** + * BPWSI4. + * The Cookies should conform to RFC2965. + */ +public class WSI1105 extends AssertionProcess +{ + private final BaseMessageValidator validator; + + /** + * @param BaseMessageValidator + */ + public WSI1105(BaseMessageValidator impl) + { + super(impl); + this.validator = impl; + } + + /** + * @see org.eclipse.wst.wsi.test.profile.validator.impl.BaseValidatorImpl.AssertionProcess#validate(TestAssertion, EntryContext) + */ + public AssertionResult validate( + TestAssertion testAssertion, + EntryContext entryContext) + throws WSIException + { + + SetCookie2Validator cookieVal = new SetCookie2Validator(); + String headers = entryContext.getMessageEntry().getHTTPHeaders(); + if (entryContext + .getMessageEntry() + .getType() + .equalsIgnoreCase(MessageEntry.TYPE_RESPONSE)) + { + // if response trom server + String setCookie2 = + (String) HTTPUtils.getHttpHeaderTokens(headers, ":").get("Set-Cookie2".toUpperCase()); + if (setCookie2 == null) + { + result = AssertionResult.RESULT_NOT_APPLICABLE; + } + else + { + if (cookieVal.isSetCookie2(setCookie2.trim())) + result = AssertionResult.RESULT_PASSED; + else + { + result = AssertionResult.RESULT_WARNING; + failureDetail = + this.validator.createFailureDetail( + "\nMessage:\nHeaders:\n" + + entryContext.getMessageEntry().getHTTPHeaders() + + "\nSOAP message:\n" + + entryContext.getMessageEntry().getMessage(), + entryContext); + } + } + } + else + { + // if request to the server + String cookie = + (String) HTTPUtils.getHttpHeaderTokens(headers, ":").get("Cookie"); + if (cookie == null) + { + result = AssertionResult.RESULT_NOT_APPLICABLE; + } + else + { + if (cookieVal.isCookie(cookie.trim())) + result = AssertionResult.RESULT_PASSED; + else + { + result = AssertionResult.RESULT_WARNING; + failureDetail = + this.validator.createFailureDetail( + "\nMessage:\nHeaders:\n" + + entryContext.getMessageEntry().getHTTPHeaders() + + "\nSOAP message:\n" + + entryContext.getMessageEntry().getMessage(), + entryContext); + } + } + } + // Return assertion result + return validator.createAssertionResult(testAssertion, result, failureDetail); + } +}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/WSI1107.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/WSI1107.java new file mode 100644 index 000000000..f1913e586 --- /dev/null +++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/WSI1107.java @@ -0,0 +1,29 @@ +/******************************************************************************* + * 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.message; + +import org.eclipse.wst.wsi.internal.core.profile.validator.impl.BaseMessageValidator; +import org.eclipse.wst.wsi.internal.core.profile.validator.impl.envelope.BP1107; + +/** + * WSI1107 + */ +public class WSI1107 extends BP1107 +{ + + /** + * @param BaseMessageValidator + */ + public WSI1107(BaseMessageValidator 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/message/WSI1108.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/WSI1108.java new file mode 100644 index 000000000..a5236e6d7 --- /dev/null +++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/WSI1108.java @@ -0,0 +1,415 @@ +/******************************************************************************* + * 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.message; + +import java.util.HashMap; +import java.util.List; +import java.util.Map; +import java.util.Vector; + +import javax.wsdl.BindingOperation; +import javax.wsdl.Definition; +import javax.wsdl.Message; +import javax.wsdl.Part; +import javax.wsdl.extensions.soap.SOAPBody; +import javax.wsdl.extensions.soap.SOAPFault; +import javax.wsdl.extensions.soap.SOAPHeader; +import javax.wsdl.extensions.soap.SOAPHeaderFault; +import javax.xml.namespace.QName; + +import org.eclipse.wst.wsi.internal.core.WSIConstants; +import org.eclipse.wst.wsi.internal.core.WSIException; +import org.eclipse.wst.wsi.internal.core.WSITag; +import org.eclipse.wst.wsi.internal.core.log.MessageEntry; +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.profile.validator.impl.BaseMessageValidator; +import org.eclipse.wst.wsi.internal.core.report.AssertionResult; +import org.eclipse.wst.wsi.internal.core.util.NullUtil; +import org.eclipse.wst.wsi.internal.core.util.OperationSignature; +import org.eclipse.wst.wsi.internal.core.util.TypesRegistry; +import org.eclipse.wst.wsi.internal.core.util.WSDLUtil; +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.w3c.dom.Document; +import org.w3c.dom.Element; + + +/** + * BPWSI4. + * Each soapbind extension element with a wsdl:required + * attribute of false must appear in a message. + */ +public class WSI1108 extends AssertionProcessVisitor implements WSITag +{ + + private final BaseMessageValidator validator; + + /** + * @param BaseMessageValidator + */ + public WSI1108(BaseMessageValidator impl) + { + super(impl); + this.validator = impl; + } + + private OperationSignature.OperationMatch match = null; + private EntryContext entryContext = null; + private OperationSignature responseSig = null; + private Vector headerRarts = null; + private boolean visitFault = false; + private boolean existSOAPHeader = true; + private boolean isRequest = false; + private boolean existSOAPHeaderFault = true; + + /** + * @see org.eclipse.wst.wsi.wsdl.traversal.WSDLVisitor#visit(SOAPBody, Object, WSDLTraversalContext) + */ + public void visit(SOAPBody body, Object parent, WSDLTraversalContext ctx) + { + + // if "wsdl:required" is true then return + if (body.getRequired() != null + && body.getRequired().booleanValue() == true) + return; + + // assert parent instanceof BindingOutput + BindingOperation bop = ctx.getBindingOperation(); + if (bop.getOperation() == null + || bop.getOperation().getOutput() == null + || bop.getOperation().getOutput().getMessage() == null) + return; + Message msg = bop.getOperation().getOutput().getMessage(); + List parts = + WSDLUtil.getParts( + bop.getOperation(), + msg, + body, + match.getOperationStyle()); + + QName additionalName = null; + // if operation is rpc, add to parts qname qith function name + if (WSIConstants + .ATTRVAL_SOAP_BIND_STYLE_RPC + .equals(match.getOperationStyle())) + { + // found out target namespace + String namespace = body.getNamespaceURI(); + if (namespace == null || namespace.length() == 0) + // !! ATTENTION + // namespace should be retrieved from service target nameapce + namespace = ctx.getBinding().getQName().getNamespaceURI(); + + // insert operation name as first signature part + additionalName = + new QName( + namespace, + bop + .getOperation() + .getOutput() + .getMessage() + .getQName() + .getLocalPart()); + } + + // create the signature of this operation + OperationSignature op = + new OperationSignature( + parts, + null, + new TypesRegistry( + validator.analyzerContext + .getCandidateInfo() + .getWsdlDocument() + .getDefinitions(), + validator), + false); + if (additionalName != null) + op.getSignature().add(0, additionalName); + + if (op.getSignature().equals(responseSig.getSignature())) + { + // ctx.cancelBindingOperationProcessing(); + } + else + { + // create the signature of this operation + op = + new OperationSignature( + parts, + null, + new TypesRegistry( + validator.analyzerContext + .getCandidateInfo() + .getWsdlDocument() + .getDefinitions(), + validator), + true); + + if (additionalName != null) + op.getSignature().add(0, additionalName); + if (op.getSignature().equals(responseSig.getSignature())) + { + // ctx.cancelBindingOperationProcessing(); + } + else + { + result = AssertionResult.RESULT_FAILED; + failureDetail = + this.validator.createFailureDetail( + "\nMessage:\n" + entryContext.getMessageEntry().getMessage(), + entryContext); + ctx.cancelBindingOperationProcessing(); + } + } + } + + /* (non-Javadoc) + * @see org.wsi.wsdl.traversal.WSDLVisitor#visit(javax.wsdl.extensions.soap.SOAPHeader, java.lang.Object, org.wsi.wsdl.traversal.WSDLTraversalContext) + */ + public void visit( + SOAPHeader header, + Object parent, + WSDLTraversalContext ctx) + { + + if (existSOAPHeaderFault == false) + { + existSOAPHeader = false; + ctx.cancelBindingOperationProcessing(); + return; + } + // if "wsdl:required" is true then return + if (header.getRequired() != null + && header.getRequired().booleanValue() == true) + return; + // find headr part + Definition d = (Definition) ctx.getParameter("definition"); + TypesRegistry tReg = (TypesRegistry) ctx.getParameter("TypesRegistry"); + Part mesPart = + WSDLUtil.getPart(d.getMessage(header.getMessage()), header.getPart()); + + // test this part and parts from header + QName partQName = mesPart.getTypeName(); + if (partQName == null) + partQName = tReg.getType(mesPart.getElementName()); + if (partQName == null) + throw new IllegalArgumentException( + "Part type can not be null." + mesPart.getElementName().toString()); + String local = partQName.getLocalPart(); + String ns = partQName.getNamespaceURI(); + + existSOAPHeader = false; + for (int i = 0; i < headerRarts.size(); i++) + { + Element elem = (Element) headerRarts.get(i); + if (elem.getLocalName().equals(local) + && NullUtil.equals(ns, elem.getNamespaceURI())) + { + existSOAPHeader = true; + break; + } + } + if (existSOAPHeader == true) + ctx.cancelSOAPHeaderProcessing(); + if (isRequest == true) + ctx.cancelBindingOperationProcessing(); + if (existSOAPHeader == false && isRequest == false) + existSOAPHeaderFault = false; + } + + /* (non-Javadoc) + * @see org.wsi.wsdl.traversal.WSDLVisitor#visit(javax.wsdl.extensions.soap.SOAPHeaderFault, java.lang.Object, org.wsi.wsdl.traversal.WSDLTraversalContext) + */ + public void visit( + SOAPHeaderFault headerFault, + Object parent, + WSDLTraversalContext ctx) + { + // find headr part + Definition d = (Definition) ctx.getParameter("definition"); + TypesRegistry tReg = (TypesRegistry) ctx.getParameter("TypesRegistry"); + Part mesPart = + WSDLUtil.getPart( + d.getMessage(headerFault.getMessage()), + headerFault.getPart()); + + // test this part and parts from headerfault + QName partQName = mesPart.getTypeName(); + if (partQName == null) + partQName = tReg.getType(mesPart.getElementName()); + if (partQName == null) + throw new IllegalArgumentException( + "Part type can not be null." + mesPart.getElementName().toString()); + String local = partQName.getLocalPart(); + String ns = partQName.getNamespaceURI(); + + for (int i = 0; i < headerRarts.size(); i++) + { + Element elem = (Element) headerRarts.get(i); + if (elem.getLocalName().equals(local) + && NullUtil.equals(ns, elem.getNamespaceURI())) + { + existSOAPHeaderFault = true; + break; + } + } + if (existSOAPHeaderFault == true) + ctx.cancelSOAPHeaderProcessing(); + } + + /* (non-Javadoc) + * @see org.wsi.wsdl.traversal.WSDLVisitor#visit(javax.wsdl.extensions.soap.SOAPFault, java.lang.Object, org.wsi.wsdl.traversal.WSDLTraversalContext) + */ + public void visit(SOAPFault fault, Object parent, WSDLTraversalContext ctx) + { + // set in true if any SOAPFault exist + visitFault = true; + } + + /* (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 + { + + if (this.validator.isOneWayResponse(entryContext)) + { + result = AssertionResult.RESULT_NOT_APPLICABLE; + } + else + { + this.entryContext = entryContext; + // Parse request message + Document doc = entryContext.getRequestDocument(); + // create request signature + match = + OperationSignature.matchOperation( + doc, + null, + validator.analyzerContext.getCandidateInfo().getBindings()[0], + new TypesRegistry( + validator.analyzerContext + .getCandidateInfo() + .getWsdlDocument() + .getDefinitions(), + validator), + false); + + // if such operation exist + if (match != null) + { + isRequest = + MessageEntry.TYPE_REQUEST.equals( + entryContext.getMessageEntry().getType()); + // Parse message + doc = entryContext.getMessageEntryDocument(); + + if (!isRequest) + { + responseSig = new OperationSignature(doc); + if (WSIConstants + .ATTRVAL_SOAP_BIND_STYLE_RPC + .equals(match.getOperationStyle())) + responseSig.createRPCSignature(); + } + // extract all headers from message + Element headerElem = + XMLUtils.findChildElement( + doc.getDocumentElement(), + WSITag.ELEM_SOAP_HEADER); + headerRarts = new Vector(); + if (headerElem != null) + headerRarts = XMLUtils.getChildElements(headerElem); + + WSDLTraversal traversal = new WSDLTraversal(); + //VisitorAdaptor.adapt(this); + traversal.setVisitor(this); + traversal.visitSOAPBody(true); + traversal.visitSOAPHeader(true); + traversal.visitSOAPHeaderFault(true); + traversal.visitSOAPFault(true); + + traversal.ignoreReferences(); + traversal.ignoreBindingInput2SOAPBody(); + + if (isRequest) + traversal.ignoreBindingOutput(); + else + traversal.ignoreBindingInput2SOAPHeader(); + + if (responseSig != null && responseSig.isFault()) + traversal.ignoreBindingOutput(); + else + traversal.ignoreBindingFault(); + + existSOAPHeaderFault = true; + Map m = new HashMap(); + WSDLUtil.expandDefinition( + validator.analyzerContext + .getCandidateInfo() + .getWsdlDocument() + .getDefinitions()); + m.put( + "definition", + validator.analyzerContext + .getCandidateInfo() + .getWsdlDocument() + .getDefinitions()); + TypesRegistry tReg = + new TypesRegistry( + validator.analyzerContext + .getCandidateInfo() + .getWsdlDocument() + .getDefinitions(), + validator); + m.put("TypesRegistry", tReg); + traversal.traverse(match.getOperation(), m); + + if (isRequest == false) + if (existSOAPHeaderFault == true) + existSOAPHeader = true; + + if (responseSig != null + && responseSig.isFault() + && visitFault == false) + { + result = AssertionResult.RESULT_FAILED; + failureDetail = + this.validator.createFailureDetail( + "\nMessage:\n" + entryContext.getMessageEntry().getMessage(), + entryContext); + } + if (existSOAPHeader == false) + { + result = AssertionResult.RESULT_FAILED; + failureDetail = + this.validator.createFailureDetail( + "\nMessage:\n" + entryContext.getMessageEntry().getMessage(), + entryContext); + } + } + else + { + result = AssertionResult.RESULT_NOT_APPLICABLE; + } + } + + // Return assertion result + return validator.createAssertionResult(testAssertion, result, failureDetail); + } +}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/WSI1109.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/WSI1109.java new file mode 100644 index 000000000..8bf44cf63 --- /dev/null +++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/WSI1109.java @@ -0,0 +1,103 @@ +/******************************************************************************* + * 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.message; + +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.profile.validator.impl.BaseMessageValidator; +import org.eclipse.wst.wsi.internal.core.report.AssertionResult; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.NodeList; + + +/** + * WSI1109. + * Any conformance claims MUST be children of the soap:Header element. + */ +public class WSI1109 extends AssertionProcess +{ + private final BaseMessageValidator validator; + + /** + * @param BaseMessageValidator + */ + public WSI1109(BaseMessageValidator impl) + { + super(impl); + this.validator = impl; + } + + /** + * @see org.eclipse.wst.wsi.test.profile.validator.impl.BaseValidatorImpl.AssertionProcess#validate(TestAssertion, EntryContext) + */ + public AssertionResult validate( + TestAssertion testAssertion, + EntryContext entryContext) + throws WSIException + { + + if ((entryContext.getMessageEntry() != null) + && (!this.validator.isOneWayResponse(entryContext))) + { + try + { + // Parse message + Document doc = entryContext.getMessageEntryDocument(); + Element root = doc.getDocumentElement(); + // find "Header" element + NodeList headerList = + root.getElementsByTagNameNS(WSIConstants.NS_URI_SOAP, "Header"); + Element headerElem = null; + if (headerList != null && headerList.getLength() != 0) + headerElem = (Element) headerList.item(0); + + // find "Claim" element + NodeList claimList = + root.getElementsByTagNameNS(WSIConstants.NS_URI_CLAIM, "Claim"); + if (claimList == null || claimList.getLength() == 0) + { + result = AssertionResult.RESULT_NOT_APPLICABLE; + } + else + { + for (int i = 0; i < claimList.getLength(); i++) + { + if (headerElem == null + || claimList.item(i).getParentNode() != headerElem) + { + result = AssertionResult.RESULT_FAILED; + failureDetail = + this.validator.createFailureDetail( + "\nSOAP message:\n" + + entryContext.getMessageEntry().getMessage(), + entryContext); + break; + } + } + } + } + catch (Exception e) + { + result = AssertionResult.RESULT_NOT_APPLICABLE; + } + } + else + { + result = AssertionResult.RESULT_NOT_APPLICABLE; + } + // Return assertion result + return validator.createAssertionResult(testAssertion, result, failureDetail); + } +}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/WSI1110.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/WSI1110.java new file mode 100644 index 000000000..8b3b9e247 --- /dev/null +++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/WSI1110.java @@ -0,0 +1,104 @@ +/******************************************************************************* + * 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.message; + +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.profile.validator.impl.BaseMessageValidator; +import org.eclipse.wst.wsi.internal.core.report.AssertionResult; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; + + +/** + * WSI1110. + * Any conformance claims MUST adhere to the WS-I conformance + * claim schema defined in the Basic Profile. + */ +public class WSI1110 extends AssertionProcess +{ + private final BaseMessageValidator validator; + + /** + * @param BaseMessageValidator + */ + public WSI1110(BaseMessageValidator impl) + { + super(impl); + this.validator = impl; + } + + /** + * @see org.eclipse.wst.wsi.test.profile.validator.impl.BaseValidatorImpl.AssertionProcess#validate(TestAssertion, EntryContext) + */ + public AssertionResult validate( + TestAssertion testAssertion, + EntryContext entryContext) + throws WSIException + { + + Document doc; + if (entryContext.getMessageEntry() != null + && !this.validator.isOneWayResponse(entryContext) + && (doc = entryContext.getMessageEntryDocument()) != null) + { + Element root = doc.getDocumentElement(); + // find "Claim" element + NodeList claimList = + root.getElementsByTagNameNS(WSIConstants.NS_URI_CLAIM, "Claim"); + if (claimList == null || claimList.getLength() == 0) + { + result = AssertionResult.RESULT_NOT_APPLICABLE; + } + else + { + for (int i = 0; i < claimList.getLength(); i++) + { + Element elem = (Element) claimList.item(i); + // check "conformsTo" attribute + Node node = elem.getAttributeNode("conformsTo"); + if (node == null) + { + result = AssertionResult.RESULT_FAILED; + failureDetail = + this.validator.createFailureDetail( + "\nSOAP message:\n" + + entryContext.getMessageEntry().getMessage(), + entryContext); + break; + } + /* This is checked in WSI1111 + // check "mustUnderstand" attribute + node = elem.getAttributeNodeNS(WSIConstants.NS_URI_SOAP, "mustUnderstand"); + if (node != null) + { + result = AssertionResult.RESULT_FAILED; + failureDetail = createFailureDetail("\nSOAP message:\n" + entryContext.getMessageEntry().getMessage(), entryContext); + break; + } + */ + } + } + } + else + { + result = AssertionResult.RESULT_NOT_APPLICABLE; + } + + // Return assertion result + return validator.createAssertionResult(testAssertion, result, failureDetail); + } +}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/WSI1111.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/WSI1111.java new file mode 100644 index 000000000..b84e3fb79 --- /dev/null +++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/WSI1111.java @@ -0,0 +1,111 @@ +/******************************************************************************* + * 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.message; + +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.profile.validator.impl.BaseMessageValidator; +import org.eclipse.wst.wsi.internal.core.report.AssertionResult; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.Node; +import org.w3c.dom.NodeList; + + +/** + * WSI1111. + * Any conformance claims MUST NOT use soap:mustUnderstand='1'. + */ +public class WSI1111 extends AssertionProcess +{ + private final BaseMessageValidator validator; + + /** + * @param BaseMessageValidator + */ + public WSI1111(BaseMessageValidator impl) + { + super(impl); + this.validator = impl; + } + + /** + * @see org.eclipse.wst.wsi.test.profile.validator.impl.BaseValidatorImpl.AssertionProcess#validate(TestAssertion, EntryContext) + */ + public AssertionResult validate( + TestAssertion testAssertion, + EntryContext entryContext) + throws WSIException + { + + Document doc; + if (entryContext.getMessageEntry() != null + && !this.validator.isOneWayResponse(entryContext) + && (doc = entryContext.getMessageEntryDocument()) != null) + { + Element root = doc.getDocumentElement(); + // find "Claim" element + NodeList claimList = + root.getElementsByTagNameNS(WSIConstants.NS_URI_CLAIM, "Claim"); + if (claimList != null && claimList.getLength() != 0) + { + // if contains "Claim" element find all "Header" elements + NodeList headerList = + root.getElementsByTagNameNS(WSIConstants.NS_URI_SOAP, "Header"); + if (headerList != null && headerList.getLength() != 0) + { + for (int iHeader = 0; iHeader < headerList.getLength(); iHeader++) + { + // find all "Header" child elements + Node child = headerList.item(iHeader).getFirstChild(); + while (child != null) + { + if (child.getNodeType() == Node.ELEMENT_NODE) + { + // if contains "mustUnderstand" -> fail + String attrVal = + ((Element) child).getAttributeNS( + WSIConstants.NS_URI_SOAP, + "mustUnderstand"); + if (attrVal != null && !"".equals(attrVal)) + { + result = AssertionResult.RESULT_FAILED; + failureDetail = + this.validator.createFailureDetail( + "\nSOAP message:\n" + + entryContext.getMessageEntry().getMessage(), + entryContext); + iHeader = headerList.getLength(); + break; + } + } + child = child.getNextSibling(); + } + } + } + } + else + { + result = AssertionResult.RESULT_NOT_APPLICABLE; + } + } + else + { + result = AssertionResult.RESULT_NOT_APPLICABLE; + } + + // Return assertion result + return validator.createAssertionResult(testAssertion, result, failureDetail); + } +}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/WSI1116.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/WSI1116.java new file mode 100644 index 000000000..f289dd6c9 --- /dev/null +++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/WSI1116.java @@ -0,0 +1,28 @@ +/******************************************************************************* + * 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.message; + +import org.eclipse.wst.wsi.internal.core.profile.validator.impl.BaseMessageValidator; + +/** + * WSI1116 + */ +public class WSI1116 extends BP1116 +{ + + /** + * @param BaseMessageValidator + */ + public WSI1116(BaseMessageValidator 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/message/WSI1121.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/WSI1121.java new file mode 100644 index 000000000..3b3ebae6b --- /dev/null +++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/WSI1121.java @@ -0,0 +1,162 @@ +/******************************************************************************* + * 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.message; + +import javax.wsdl.Binding; +import javax.wsdl.BindingOperation; +import javax.xml.namespace.QName; + +import org.eclipse.wst.wsi.internal.core.WSIConstants; +import org.eclipse.wst.wsi.internal.core.WSIException; +import org.eclipse.wst.wsi.internal.core.analyzer.AssertionFailException; +import org.eclipse.wst.wsi.internal.core.analyzer.AssertionNotApplicableException; +import org.eclipse.wst.wsi.internal.core.analyzer.AssertionPassException; +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.profile.validator.impl.BaseMessageValidator; +import org.eclipse.wst.wsi.internal.core.report.AssertionResult; +import org.eclipse.wst.wsi.internal.core.xml.XMLUtils; +import org.w3c.dom.Document; +import org.w3c.dom.Element; + + +/** + * BPWSI4. + */ +public class WSI1121 extends AssertionProcess +{ + private final BaseMessageValidator validator; + + /** + * @param BaseMessageValidator + */ + public WSI1121(BaseMessageValidator impl) + { + super(impl); + this.validator = impl; + } + + public AssertionResult validate( + TestAssertion testAssertion, + EntryContext entryContext) + throws WSIException + { + + try + { + // GT: -- start: base on wsi1011 - should refactor this + + Binding[] bindings = validator.analyzerContext.getCandidateInfo().getBindings(); + + // get soap message child name + // Get the DOM contents of the message soap:body (if non-empty) + Document messageDoc = null; + + QName messagePartElementQName = null; + if (!entryContext.getMessageEntry().getMessage().equals("")) + { + messageDoc = + XMLUtils.parseXML(entryContext.getMessageEntry().getMessage()); + // get soap operation name from the soap:body + + // NOTE: getSoapBodyChild() may return null, if the soap:body did not contain any child elements + Element soapMessageElement = this.validator.getSoapBodyChild(messageDoc); + + // for doc-lit... find the wsdl:part from one of the specified operations that has + // the soap element used in the message. + // we are looking for a part with an element attrib val matching the soap message element + if (soapMessageElement != null) + { + messagePartElementQName = + new QName( + soapMessageElement.getNamespaceURI(), + soapMessageElement.getLocalName()); + } + } + + if ((messageDoc == null) || this.validator.isFault(messageDoc)) + { + // empty messages and messages containing soap:Faults do not qualify for this TA + throw new AssertionNotApplicableException(); + } + + BindingOperation[] docBindingOperations = + this.validator.getMatchingBindingOps( + WSIConstants.ATTRVAL_SOAP_BIND_STYLE_DOC, + bindings); + // list of operations that match the <wsdl:input> or <wsdl:output> (depending on entryType) + // for part element="..." + // (ISSUE: what about part type="..."?) + BindingOperation[] potentialDocLitOps = + this.validator.getDocLitOperations( + entryContext.getEntry().getEntryType(), + messagePartElementQName, + docBindingOperations); + // GT: --- end: base on wsi1011 + + // + if (potentialDocLitOps.length == 0) + { + // not doc-lit so quit + throw new AssertionNotApplicableException(); + } + + // We know there is a doc-lit match, so now try to validate the soap message against the + // referenced schema + + // GT - how to reference the schema document?? need to use the <wsdl:part>, or do it purely + // from the soap message elements? + // ie body, envelope or wsdl?? + + // <experiment> + + boolean isSchemaValid; + + try { + isSchemaValid = this.validator.messageIsDocLitSchemaValid(entryContext); + } catch (Exception e) { + throw new AssertionFailException(); + } + // </experiment> + + + //isSchemaValid = true; // for now, getting this far does it + + if (isSchemaValid) + { + throw new AssertionPassException(); + } + else + { + throw new AssertionFailException(); + } + + } + catch (AssertionPassException e) + { + result = AssertionResult.RESULT_PASSED; + } + catch (AssertionFailException e) + { + result = AssertionResult.RESULT_FAILED; + failureDetail = this.validator.createFailureDetail(e.getMessage(), entryContext); + } + catch (AssertionNotApplicableException e) + { + result = AssertionResult.RESULT_NOT_APPLICABLE; + + } + + // Return assertion result + return validator.createAssertionResult(testAssertion, result, failureDetail); + } +}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/WSI1201.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/WSI1201.java new file mode 100644 index 000000000..0c6f087ce --- /dev/null +++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/WSI1201.java @@ -0,0 +1,29 @@ +/******************************************************************************* + * 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.message; + +import org.eclipse.wst.wsi.internal.core.profile.validator.impl.BaseMessageValidator; +import org.eclipse.wst.wsi.internal.core.profile.validator.impl.envelope.BP1201; + +/** + * WSI1201 + */ +public class WSI1201 extends BP1201 +{ + + /** + * @param BaseMessageValidator + */ + public WSI1201(BaseMessageValidator 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/message/WSI1202.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/WSI1202.java new file mode 100644 index 000000000..7a31cd6cc --- /dev/null +++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/WSI1202.java @@ -0,0 +1,29 @@ +/******************************************************************************* + * 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.message; + +import org.eclipse.wst.wsi.internal.core.profile.validator.impl.BaseMessageValidator; +import org.eclipse.wst.wsi.internal.core.profile.validator.impl.envelope.BP1202; + +/** + * WSI1202 + */ +public class WSI1202 extends BP1202 +{ + + /** + * @param BaseMessageValidator + */ + public WSI1202(BaseMessageValidator 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/message/WSI1203.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/WSI1203.java new file mode 100644 index 000000000..363bcbf52 --- /dev/null +++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/WSI1203.java @@ -0,0 +1,29 @@ +/******************************************************************************* + * 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.message; + +import org.eclipse.wst.wsi.internal.core.profile.validator.impl.BaseMessageValidator; +import org.eclipse.wst.wsi.internal.core.profile.validator.impl.envelope.BP1203; + +/** + * WSI1203 + */ +public class WSI1203 extends BP1203 +{ + + /** + * @param BaseMessageValidator + */ + public WSI1203(BaseMessageValidator 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/message/WSI1204.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/WSI1204.java new file mode 100644 index 000000000..16dda543b --- /dev/null +++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/WSI1204.java @@ -0,0 +1,29 @@ +/******************************************************************************* + * 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.message; + +import org.eclipse.wst.wsi.internal.core.profile.validator.impl.BaseMessageValidator; +import org.eclipse.wst.wsi.internal.core.profile.validator.impl.envelope.BP1204; + +/** + * WSI1204 + */ +public class WSI1204 extends BP1204 +{ + + /** + * @param BaseMessageValidator + */ + public WSI1204(BaseMessageValidator 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/message/WSI1208.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/WSI1208.java new file mode 100644 index 000000000..7b9496314 --- /dev/null +++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/WSI1208.java @@ -0,0 +1,29 @@ +/******************************************************************************* + * 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.message; + +import org.eclipse.wst.wsi.internal.core.profile.validator.impl.BaseMessageValidator; +import org.eclipse.wst.wsi.internal.core.profile.validator.impl.envelope.BP1208; + +/** + * WSI1208 + */ +public class WSI1208 extends BP1208 +{ + + /** + * @param BaseMessageValidator + */ + public WSI1208(BaseMessageValidator 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/message/WSI1211.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/WSI1211.java new file mode 100644 index 000000000..63f57c5fd --- /dev/null +++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/WSI1211.java @@ -0,0 +1,29 @@ +/******************************************************************************* + * 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.message; + +import org.eclipse.wst.wsi.internal.core.profile.validator.impl.BaseMessageValidator; +import org.eclipse.wst.wsi.internal.core.profile.validator.impl.envelope.BP1211; + +/** + * WSI1211 + */ +public class WSI1211 extends BP1211 +{ + + /** + * @param BaseMessageValidator + */ + public WSI1211(BaseMessageValidator 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/message/WSI1301.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/WSI1301.java new file mode 100644 index 000000000..9f0eb82b0 --- /dev/null +++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/WSI1301.java @@ -0,0 +1,29 @@ +/******************************************************************************* + * 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.message; + +import org.eclipse.wst.wsi.internal.core.profile.validator.impl.BaseMessageValidator; +import org.eclipse.wst.wsi.internal.core.profile.validator.impl.envelope.BP1301; + +/** + * WSI1301 + */ +public class WSI1301 extends BP1301 +{ + + /** + * @param BaseMessageValidator + */ + public WSI1301(BaseMessageValidator 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/message/WSI1302.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/WSI1302.java new file mode 100644 index 000000000..6e976fe35 --- /dev/null +++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/WSI1302.java @@ -0,0 +1,29 @@ +/******************************************************************************* + * 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.message; + +import org.eclipse.wst.wsi.internal.core.profile.validator.impl.BaseMessageValidator; +import org.eclipse.wst.wsi.internal.core.profile.validator.impl.envelope.BP1302; + +/** + * WSI1302 + */ +public class WSI1302 extends BP1302 +{ + + /** + * @param BaseMessageValidator + */ + public WSI1302(BaseMessageValidator 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/message/WSI1305.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/WSI1305.java new file mode 100644 index 000000000..bb2e13acb --- /dev/null +++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/WSI1305.java @@ -0,0 +1,29 @@ +/******************************************************************************* + * 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.message; + +import org.eclipse.wst.wsi.internal.core.profile.validator.impl.BaseMessageValidator; +import org.eclipse.wst.wsi.internal.core.profile.validator.impl.envelope.BP1305; + +/** + * WSI1305 + */ +public class WSI1305 extends BP1305 +{ + + /** + * @param BaseMessageValidator + */ + public WSI1305(BaseMessageValidator 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/message/WSI1306.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/WSI1306.java new file mode 100644 index 000000000..b610628b7 --- /dev/null +++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/WSI1306.java @@ -0,0 +1,29 @@ +/******************************************************************************* + * 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.message; + +import org.eclipse.wst.wsi.internal.core.profile.validator.impl.BaseMessageValidator; +import org.eclipse.wst.wsi.internal.core.profile.validator.impl.envelope.BP1306; + +/** + * WSI1306 + */ +public class WSI1306 extends BP1306 +{ + + /** + * @param BaseMessageValidator + */ + public WSI1306(BaseMessageValidator 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/message/WSI1307.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/WSI1307.java new file mode 100644 index 000000000..8c705a85a --- /dev/null +++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/WSI1307.java @@ -0,0 +1,29 @@ +/******************************************************************************* + * 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.message; + +import org.eclipse.wst.wsi.internal.core.profile.validator.impl.BaseMessageValidator; +import org.eclipse.wst.wsi.internal.core.profile.validator.impl.envelope.BP1307; + +/** + * WSI1307 + */ +public class WSI1307 extends BP1307 +{ + + /** + * @param BaseMessageValidator + */ + public WSI1307(BaseMessageValidator 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/message/WSI1308.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/WSI1308.java new file mode 100644 index 000000000..e2271cf89 --- /dev/null +++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/WSI1308.java @@ -0,0 +1,29 @@ +/******************************************************************************* + * 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.message; + +import org.eclipse.wst.wsi.internal.core.profile.validator.impl.BaseMessageValidator; +import org.eclipse.wst.wsi.internal.core.profile.validator.impl.envelope.BP1308; + +/** + * WSI1308 + */ +public class WSI1308 extends BP1308 +{ + + /** + * @param BaseMessageValidator + */ + public WSI1308(BaseMessageValidator 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/message/WSI1309.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/WSI1309.java new file mode 100644 index 000000000..ee6435731 --- /dev/null +++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/WSI1309.java @@ -0,0 +1,29 @@ +/******************************************************************************* + * 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.message; + +import org.eclipse.wst.wsi.internal.core.profile.validator.impl.BaseMessageValidator; +import org.eclipse.wst.wsi.internal.core.profile.validator.impl.envelope.BP1309; + +/** + * WSI1309 + */ +public class WSI1309 extends BP1309 +{ + + /** + * @param BaseMessageValidator + */ + public WSI1309(BaseMessageValidator 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/message/WSI1311.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/WSI1311.java new file mode 100644 index 000000000..ea98faa07 --- /dev/null +++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/WSI1311.java @@ -0,0 +1,204 @@ +/******************************************************************************* + * 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.message; + +import java.util.Iterator; +import java.util.List; + +import javax.wsdl.Binding; +import javax.wsdl.BindingOperation; +import javax.wsdl.Message; +import javax.wsdl.Operation; +import javax.wsdl.extensions.soap.SOAPBinding; +import javax.xml.namespace.QName; + +import org.eclipse.wst.wsi.internal.core.WSIConstants; +import org.eclipse.wst.wsi.internal.core.WSIException; +import org.eclipse.wst.wsi.internal.core.analyzer.AssertionFailException; +import org.eclipse.wst.wsi.internal.core.analyzer.AssertionPassException; +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.profile.validator.impl.BaseMessageValidator; +import org.eclipse.wst.wsi.internal.core.report.AssertionResult; +import org.eclipse.wst.wsi.internal.core.util.HTTPUtils; +import org.eclipse.wst.wsi.internal.core.util.OperationSignature; +import org.eclipse.wst.wsi.internal.core.util.TypesRegistry; +import org.eclipse.wst.wsi.internal.core.xml.XMLUtils; +import org.w3c.dom.Document; +import org.w3c.dom.Element; +import org.w3c.dom.NodeList; + + +/** + * BPWSI4. + * The response (SOAP envelope) should be carried by an HTTP + * response, over same HTTP connection as the Request. + */ +public class WSI1311 extends AssertionProcess +{ + private final BaseMessageValidator validator; + + /** + * @param BaseMessageValidator + */ + public WSI1311(BaseMessageValidator impl) + { + super(impl); + this.validator = impl; + } + + /** + * @see org.eclipse.wst.wsi.test.profile.validator.impl.BaseValidatorImpl.AssertionProcess#validate(TestAssertion, EntryContext) + */ + public AssertionResult validate( + TestAssertion testAssertion, + EntryContext entryContext) + throws WSIException + { + + result = AssertionResult.RESULT_PASSED; + boolean isOneWayResponse = this.validator.isOneWayResponse(entryContext); + + Document docResponse = null; + if (!isOneWayResponse) + docResponse = entryContext.getResponseDocument(); + + //if fault + if (!isOneWayResponse && this.validator.isFault(docResponse)) + { + result = AssertionResult.RESULT_PASSED; + } + else + { // not fault + // 1. get an operation from request + // Parse request message + Document docRequest = entryContext.getRequestDocument(); + + // get SOAPAction + String headers = entryContext.getRequest().getHTTPHeaders(); + String action = null; + if (headers != null) + action = (String) HTTPUtils.getHttpHeaderTokens(headers, ":").get("SOAPAction".toUpperCase()); + Binding binding = validator.analyzerContext.getCandidateInfo().getBindings()[0]; + TypesRegistry registry = + new TypesRegistry( + this.validator.getWSDLDocument().getDefinitions(), + validator); + OperationSignature.OperationMatch match = + OperationSignature.matchOperation( + docRequest, + action, + binding, + registry); + + if (match == null) + { + result = AssertionResult.RESULT_NOT_APPLICABLE; + } + else + { + try + { + + BindingOperation bindingOperation = match.getOperation(); + Operation operation = null; + + // Check whether the transport attribute has the value + // "http://schemas.xmlsoap.org/soap/http". + List extElem = binding.getExtensibilityElements(); + for (Iterator index = extElem.iterator(); index.hasNext();) + { + Object o = (Object) index.next(); + if (o instanceof SOAPBinding) + { + SOAPBinding soapBinding = (SOAPBinding) o; + if (!WSIConstants + .NS_URI_SOAP_HTTP + .equals(soapBinding.getTransportURI())) + { + throw new AssertionFailException(); + } + + } + } + + //find operation in port type + operation = bindingOperation.getOperation(); + if (operation == null) + { + throw new AssertionFailException(); + } + + if (isOneWayResponse) + { + if (operation.getOutput() == null) + throw new AssertionPassException(); + else + throw new AssertionFailException(); + } + + // check whether the response message from the log + // contains the output message + NodeList soapBodyList = + docResponse.getElementsByTagNameNS( + WSIConstants.NS_URI_SOAP, + XMLUtils.SOAP_ELEM_BODY); + if ((soapBodyList == null) || (soapBodyList.getLength() == 0)) + { + // Response does not contain any soap Body elements + throw new AssertionFailException(); + } + for (int i = 0; i < soapBodyList.getLength(); i++) + { + Element nextBodyElem = (Element) soapBodyList.item(i); + Element soapMessageElement = XMLUtils.getFirstChild(nextBodyElem); + while (soapMessageElement != null) + { + // check whether the operation output has message from SOAP response + Message message = operation.getOutput().getMessage(); + QName soapMessageQName = + new QName( + soapMessageElement.getNamespaceURI(), + soapMessageElement.getLocalName()); + + if (message != null + && soapMessageQName.equals(message.getQName())) + { + throw new AssertionPassException(); + } + + soapMessageElement = + XMLUtils.getNextSibling(soapMessageElement); + } + } + + } + catch (AssertionPassException e) + { + result = AssertionResult.RESULT_PASSED; + } + catch (AssertionFailException e) + { + result = AssertionResult.RESULT_FAILED; + } + + } + } + + if (result == AssertionResult.RESULT_FAILED) + { + failureDetail = this.validator.createFailureDetail(null, entryContext); + } + + return validator.createAssertionResult(testAssertion, result, failureDetail); + } +}
\ No newline at end of file diff --git a/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/WSI1316.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/WSI1316.java new file mode 100644 index 000000000..3fd3168c8 --- /dev/null +++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/WSI1316.java @@ -0,0 +1,29 @@ +/******************************************************************************* + * 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.message; + +import org.eclipse.wst.wsi.internal.core.profile.validator.impl.BaseMessageValidator; +import org.eclipse.wst.wsi.internal.core.profile.validator.impl.envelope.BP1316; + +/** + * WSI1316 + */ +public class WSI1316 extends BP1316 +{ + + /** + * @param BaseMessageValidator + */ + public WSI1316(BaseMessageValidator 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/message/WSI1318.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/WSI1318.java new file mode 100644 index 000000000..ea3cd9935 --- /dev/null +++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/WSI1318.java @@ -0,0 +1,29 @@ +/******************************************************************************* + * 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.message; + +import org.eclipse.wst.wsi.internal.core.profile.validator.impl.BaseMessageValidator; +import org.eclipse.wst.wsi.internal.core.profile.validator.impl.envelope.BP1318; + +/** + * WSI1318 + */ +public class WSI1318 extends BP1318 +{ + + /** + * @param BaseMessageValidator + */ + public WSI1318(BaseMessageValidator 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/message/WSI1601.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/WSI1601.java new file mode 100644 index 000000000..f5920f7a6 --- /dev/null +++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/WSI1601.java @@ -0,0 +1,29 @@ +/******************************************************************************* + * 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.message; + +import org.eclipse.wst.wsi.internal.core.profile.validator.impl.BaseMessageValidator; +import org.eclipse.wst.wsi.internal.core.profile.validator.impl.envelope.BP1601; + +/** + * WSI1601 + */ +public class WSI1601 extends BP1601 +{ + + /** + * @param BaseMessageValidator + */ + public WSI1601(BaseMessageValidator 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/message/WSI1701.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/WSI1701.java new file mode 100644 index 000000000..8a7befb96 --- /dev/null +++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/WSI1701.java @@ -0,0 +1,29 @@ +/******************************************************************************* + * 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.message; + +import org.eclipse.wst.wsi.internal.core.profile.validator.impl.BaseMessageValidator; +import org.eclipse.wst.wsi.internal.core.profile.validator.impl.envelope.BP1701; + +/** + * WSI1701 + */ +public class WSI1701 extends BP1701 +{ + + /** + * @param BaseMessageValidator + */ + public WSI1701(BaseMessageValidator 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/message/WSI4100.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/WSI4100.java new file mode 100644 index 000000000..81c1a1071 --- /dev/null +++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/WSI4100.java @@ -0,0 +1,29 @@ +/******************************************************************************* + * 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.message; + +import org.eclipse.wst.wsi.internal.core.profile.validator.impl.BaseMessageValidator; +import org.eclipse.wst.wsi.internal.core.profile.validator.impl.envelope.BP4100; + +/** + * WSI4100 + */ +public class WSI4100 extends BP4100 +{ + + /** + * @param BaseMessageValidator + */ + public WSI4100(BaseMessageValidator 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/message/WSI4101.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/WSI4101.java new file mode 100644 index 000000000..950165aa2 --- /dev/null +++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/WSI4101.java @@ -0,0 +1,29 @@ +/******************************************************************************* + * 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.message; + +import org.eclipse.wst.wsi.internal.core.profile.validator.impl.BaseMessageValidator; +import org.eclipse.wst.wsi.internal.core.profile.validator.impl.envelope.BP4101; + +/** + * WSI4101 + */ +public class WSI4101 extends BP4101 +{ + + /** + * @param BaseMessageValidator + */ + public WSI4101(BaseMessageValidator 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/message/WSI4102.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/WSI4102.java new file mode 100644 index 000000000..d25ffafbc --- /dev/null +++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/WSI4102.java @@ -0,0 +1,29 @@ +/******************************************************************************* + * 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.message; + +import org.eclipse.wst.wsi.internal.core.profile.validator.impl.BaseMessageValidator; +import org.eclipse.wst.wsi.internal.core.profile.validator.impl.envelope.BP4102; + +/** + * WSI4102 + */ +public class WSI4102 extends BP4102 +{ + + /** + * @param BaseMessageValidator + */ + public WSI4102(BaseMessageValidator 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/message/WSI4103.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/WSI4103.java new file mode 100644 index 000000000..6a61d048c --- /dev/null +++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/WSI4103.java @@ -0,0 +1,28 @@ +/******************************************************************************* + * 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.message; + +import org.eclipse.wst.wsi.internal.core.profile.validator.impl.BaseMessageValidator; + +/** + * WSI4103 + */ +public class WSI4103 extends BP4103 +{ + + /** + * @param BaseMessageValidator + */ + public WSI4103(BaseMessageValidator 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/message/WSI4104.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/WSI4104.java new file mode 100644 index 000000000..a6176d2b0 --- /dev/null +++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/WSI4104.java @@ -0,0 +1,28 @@ +/******************************************************************************* + * 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.message; + +import org.eclipse.wst.wsi.internal.core.profile.validator.impl.BaseMessageValidator; + +/** + * WSI4104 + */ +public class WSI4104 extends BP4104 +{ + + /** + * @param BaseMessageValidator + */ + public WSI4104(BaseMessageValidator 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/message/WSI4105.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/WSI4105.java new file mode 100644 index 000000000..c6ff8d0ea --- /dev/null +++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/WSI4105.java @@ -0,0 +1,28 @@ +/******************************************************************************* + * 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.message; + +import org.eclipse.wst.wsi.internal.core.profile.validator.impl.BaseMessageValidator; + +/** + * WSI4105 + */ +public class WSI4105 extends BP4105 +{ + + /** + * @param BaseMessageValidator + */ + public WSI4105(BaseMessageValidator 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/message/WSI4106.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/WSI4106.java new file mode 100644 index 000000000..97a44aef8 --- /dev/null +++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/WSI4106.java @@ -0,0 +1,28 @@ +/******************************************************************************* + * 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.message; + +import org.eclipse.wst.wsi.internal.core.profile.validator.impl.BaseMessageValidator; + +/** + * WSI4106 + */ +public class WSI4106 extends BP4106 +{ + + /** + * @param BaseMessageValidator + */ + public WSI4106(BaseMessageValidator 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/message/WSI4107.java b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/WSI4107.java new file mode 100644 index 000000000..4ad524265 --- /dev/null +++ b/bundles/org.eclipse.wst.wsi/src/org/eclipse/wst/wsi/internal/core/profile/validator/impl/message/WSI4107.java @@ -0,0 +1,28 @@ +/******************************************************************************* + * 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.message; + +import org.eclipse.wst.wsi.internal.core.profile.validator.impl.BaseMessageValidator; + +/** + * WSI4107 + */ +public class WSI4107 extends BP4107 +{ + + /** + * @param BaseMessageValidator + */ + public WSI4107(BaseMessageValidator impl) + { + super(impl); + } +}
\ No newline at end of file |