Source Code Cross Referenced for PolicyWSDLParserExtensionTest.java in  » 6.0-JDK-Modules-com.sun » wsit » com » sun » xml » ws » policy » jaxws » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » 6.0 JDK Modules com.sun » wsit » com.sun.xml.ws.policy.jaxws 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


0001:        /*
0002:         * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
0003:         * 
0004:         * Copyright 1997-2007 Sun Microsystems, Inc. All rights reserved.
0005:         * 
0006:         * The contents of this file are subject to the terms of either the GNU
0007:         * General Public License Version 2 only ("GPL") or the Common Development
0008:         * and Distribution License("CDDL") (collectively, the "License").  You
0009:         * may not use this file except in compliance with the License. You can obtain
0010:         * a copy of the License at https://glassfish.dev.java.net/public/CDDL+GPL.html
0011:         * or glassfish/bootstrap/legal/LICENSE.txt.  See the License for the specific
0012:         * language governing permissions and limitations under the License.
0013:         * 
0014:         * When distributing the software, include this License Header Notice in each
0015:         * file and include the License file at glassfish/bootstrap/legal/LICENSE.txt.
0016:         * Sun designates this particular file as subject to the "Classpath" exception
0017:         * as provided by Sun in the GPL Version 2 section of the License file that
0018:         * accompanied this code.  If applicable, add the following below the License
0019:         * Header, with the fields enclosed by brackets [] replaced by your own
0020:         * identifying information: "Portions Copyrighted [year]
0021:         * [name of copyright owner]"
0022:         * 
0023:         * Contributor(s):
0024:         * 
0025:         * If you wish your version of this file to be governed by only the CDDL or
0026:         * only the GPL Version 2, indicate your decision by adding "[Contributor]
0027:         * elects to include this software in this distribution under the [CDDL or GPL
0028:         * Version 2] license."  If you don't indicate a single choice of license, a
0029:         * recipient has the option to distribute your version of this file under
0030:         * either the CDDL, the GPL Version 2 or to extend the choice of license to
0031:         * its licensees as provided above.  However, if you add GPL Version 2 code
0032:         * and therefore, elected the GPL Version 2 license, then the option applies
0033:         * only if the new code is made subject to such option by the copyright
0034:         * holder.
0035:         */
0036:
0037:        package com.sun.xml.ws.policy.jaxws;
0038:
0039:        import com.sun.xml.stream.buffer.XMLStreamBuffer;
0040:        import com.sun.xml.ws.api.model.wsdl.WSDLModel;
0041:        import com.sun.xml.ws.api.server.SDDocumentSource;
0042:        import com.sun.xml.ws.api.wsdl.parser.WSDLParserExtension;
0043:        import com.sun.xml.ws.api.wsdl.parser.XMLEntityResolver;
0044:        import com.sun.xml.ws.policy.AssertionSet;
0045:        import com.sun.xml.ws.policy.Policy;
0046:        import com.sun.xml.ws.policy.PolicyException;
0047:        import com.sun.xml.ws.policy.PolicyMap;
0048:        import com.sun.xml.ws.policy.PolicyMapKey;
0049:        import com.sun.xml.ws.policy.privateutil.PolicyUtils;
0050:        import com.sun.xml.ws.policy.testutils.PolicyResourceLoader;
0051:        import javax.xml.namespace.QName;
0052:        import javax.xml.ws.WebServiceException;
0053:        import junit.framework.Test;
0054:        import junit.framework.TestCase;
0055:        import junit.framework.TestSuite;
0056:
0057:        import static com.sun.xml.ws.policy.testutils.PolicyResourceLoader.getPolicyMap;
0058:        import java.io.InputStream;
0059:        import java.net.URL;
0060:        import java.util.Collection;
0061:        import javax.xml.stream.XMLInputFactory;
0062:
0063:        /**
0064:         *
0065:         * @author Jakub Podlesak (jakub.podlesak at sun.com)
0066:         */
0067:        public class PolicyWSDLParserExtensionTest extends TestCase {
0068:            private static final XMLInputFactory XML_INPUT_FACTORY = XMLInputFactory
0069:                    .newInstance();
0070:
0071:            public PolicyWSDLParserExtensionTest(String testName) {
0072:                super (testName);
0073:            }
0074:
0075:            public static Test suite() {
0076:                TestSuite suite = new TestSuite(
0077:                        PolicyWSDLParserExtensionTest.class);
0078:                return suite;
0079:            }
0080:
0081:            public void testClientParsingWithDifferentlyCreatedSDDocumentSource()
0082:                    throws Exception {
0083:                InputStream configFileIS = null;
0084:                final URL configFileUrl = PolicyResourceLoader
0085:                        .getResourceUrl("parser/wsit-client.xml");
0086:                try {
0087:                    WSDLModel model = null;
0088:                    configFileIS = configFileUrl.openStream();
0089:                    final XMLStreamBuffer buffer = XMLStreamBuffer
0090:                            .createNewBufferFromXMLStreamReader(XML_INPUT_FACTORY
0091:                                    .createXMLStreamReader(configFileIS));
0092:                    final SDDocumentSource doc = SDDocumentSource.create(
0093:                            configFileUrl, buffer);
0094:                    final XMLEntityResolver.Parser parser = new XMLEntityResolver.Parser(
0095:                            doc);
0096:                    model = WSDLModel.WSDLParser
0097:                            .parse(
0098:                                    parser,
0099:                                    new PolicyConfigResolver(),
0100:                                    true,
0101:                                    new WSDLParserExtension[] { new PolicyWSDLParserExtension(
0102:                                            true) });
0103:
0104:                    assertNotNull(model);
0105:                } finally {
0106:                    PolicyUtils.IO.closeResource(configFileIS);
0107:                }
0108:
0109:                // What about when document source is created in a different way:
0110:
0111:                WSDLModel model = null;
0112:                final SDDocumentSource doc = SDDocumentSource
0113:                        .create(configFileUrl);
0114:                final XMLEntityResolver.Parser parser = new XMLEntityResolver.Parser(
0115:                        doc);
0116:                model = WSDLModel.WSDLParser
0117:                        .parse(
0118:                                parser,
0119:                                new PolicyConfigResolver(),
0120:                                true,
0121:                                new WSDLParserExtension[] { new PolicyWSDLParserExtension(
0122:                                        true) });
0123:
0124:                assertNotNull(model);
0125:            }
0126:
0127:            public void testWsdlParserBasics() throws Exception {
0128:                assertNotNull("PolicyMap can not be null",
0129:                        getPolicyMap("parser/testWsdlParserBasics.wsdl"));
0130:            }
0131:
0132:            public void testPolicyReferences() throws Exception {
0133:                PolicyMap map = getPolicyMap("parser/testPolicyReferences.wsdl");
0134:                assertNotNull("PolicyMap can not be null", map);
0135:
0136:                map = PolicyConfigParser.parse(PolicyResourceLoader
0137:                        .getResourceUrl("parser/testPolicyReferences.wsdl"),
0138:                        false);
0139:                assertNotNull("PolicyMap can not be null", map);
0140:            }
0141:
0142:            public void testWsdlParserImport() throws Exception {
0143:                PolicyMap policyMap = getPolicyMap("parser/testWsdlImportMain.wsdl");
0144:                Policy policy;
0145:                assertNotNull("PolicyMap can not be null", policyMap);
0146:                assertNotNull(policy = policyMap
0147:                        .getEndpointEffectivePolicy(PolicyMap
0148:                                .createWsdlEndpointScopeKey(new QName(
0149:                                        "http://example.org",
0150:                                        "DictionaryService"), new QName(
0151:                                        "http://example.org", "CzechToEnglish"))));
0152:                assertTrue(policy.contains(new QName("http://example.org",
0153:                        "dummyAssertion")));
0154:
0155:            }
0156:
0157:            public void testServiceElementAttachment() throws Exception {
0158:                PolicyMap policyMap = getPolicyMap("parser/testRuntimeWSExtElemService.wsdl");
0159:                assertNotNull(policyMap.getServiceEffectivePolicy(PolicyMap
0160:                        .createWsdlServiceScopeKey(new QName(
0161:                                "http://example.org", "DictionaryService"))));
0162:            }
0163:
0164:            public void testPortElementAttachment() throws Exception {
0165:                PolicyMap policyMap = getPolicyMap("parser/testRuntimeWSExtElemPort.wsdl");
0166:                assertNotNull(policyMap.getEndpointEffectivePolicy(PolicyMap
0167:                        .createWsdlEndpointScopeKey(new QName(
0168:                                "http://example.org", "DictionaryService"),
0169:                                new QName("http://example.org",
0170:                                        "CzechToEnglish"))));
0171:            }
0172:
0173:            /**
0174:             * invalid wsdl on input
0175:             */
0176:            public void testPortTypeElementAttachment() throws Exception {
0177:                PolicyMap policyMap = getPolicyMap("parser/testRuntimeWSExtElemPortType-invalid.wsdl");
0178:                assertNotNull(policyMap.getEndpointEffectivePolicy(policyMap
0179:                        .createWsdlEndpointScopeKey(new QName(
0180:                                "http://example.org", "DictionaryService"),
0181:                                new QName("http://example.org",
0182:                                        "CzechToEnglish"))));
0183:            }
0184:
0185:            public void testBindingElementAttachment() throws Exception {
0186:                PolicyMap policyMap = getPolicyMap("parser/testRuntimeWSExtElemBinding.wsdl");
0187:                assertNotNull(policyMap.getEndpointEffectivePolicy(policyMap
0188:                        .createWsdlEndpointScopeKey(new QName(
0189:                                "http://example.org", "DictionaryService"),
0190:                                new QName("http://example.org",
0191:                                        "CzechToEnglish"))));
0192:            }
0193:
0194:            public void testPortTypeOperationElementAttachment()
0195:                    throws Exception {
0196:                PolicyMap policyMap = getPolicyMap("parser/testRuntimeWSExtElemPortTypeOperation.wsdl");
0197:                assertNotNull(policyMap.getOperationEffectivePolicy(policyMap
0198:                        .createWsdlOperationScopeKey(new QName(
0199:                                "http://example.org", "DictionaryService"),
0200:                                new QName("http://example.org",
0201:                                        "CzechToEnglish"), new QName(
0202:                                        "http://example.org",
0203:                                        "TranslateOperation"))));
0204:            }
0205:
0206:            public void testBindingOperationElementAttachment()
0207:                    throws Exception {
0208:                PolicyMap policyMap = getPolicyMap("parser/testRuntimeWSExtElemBindingOperation.wsdl");
0209:                assertNotNull(policyMap.getOperationEffectivePolicy(policyMap
0210:                        .createWsdlOperationScopeKey(new QName(
0211:                                "http://example.org", "DictionaryService"),
0212:                                new QName("http://example.org",
0213:                                        "CzechToEnglish"), new QName(
0214:                                        "http://example.org",
0215:                                        "TranslateOperation"))));
0216:            }
0217:
0218:            public void testMessageInElementAttachment() throws Exception {
0219:                PolicyMap policyMap = getPolicyMap("parser/testRuntimeWSExtElemMessageIn.wsdl");
0220:                assertNotNull(policyMap
0221:                        .getInputMessageEffectivePolicy(policyMap
0222:                                .createWsdlMessageScopeKey(new QName(
0223:                                        "http://example.org",
0224:                                        "DictionaryService"),
0225:                                        new QName("http://example.org",
0226:                                                "CzechToEnglish"), new QName(
0227:                                                "http://example.org",
0228:                                                "TranslateOperation"))));
0229:            }
0230:
0231:            public void testMessageOutElementAttachment() throws Exception {
0232:                PolicyMap policyMap = getPolicyMap("parser/testRuntimeWSExtElemMessageOut.wsdl");
0233:                assertNotNull(policyMap
0234:                        .getOutputMessageEffectivePolicy(policyMap
0235:                                .createWsdlMessageScopeKey(new QName(
0236:                                        "http://example.org",
0237:                                        "DictionaryService"),
0238:                                        new QName("http://example.org",
0239:                                                "CzechToEnglish"), new QName(
0240:                                                "http://example.org",
0241:                                                "TranslateOperation"))));
0242:            }
0243:
0244:            public void testMessageFaultElementAttachment() throws Exception {
0245:                PolicyMap policyMap = getPolicyMap("parser/testRuntimeWSExtElemMessageFault.wsdl");
0246:                assertNotNull(policyMap
0247:                        .getFaultMessageEffectivePolicy(policyMap
0248:                                .createWsdlFaultMessageScopeKey(
0249:                                        new QName("http://example.org",
0250:                                                "DictionaryService"),
0251:                                        new QName("http://example.org",
0252:                                                "CzechToEnglish"),
0253:                                        new QName("http://example.org",
0254:                                                "TranslateOperation"),
0255:                                        new QName("http://example.org", "Fault"))));
0256:            }
0257:
0258:            /**
0259:             * invalid wsdl on input
0260:             */
0261:            public void testPortTypeOpInElementAttachment() throws Exception {
0262:                PolicyMap policyMap = getPolicyMap("parser/testRuntimeWSExtElemPortTypeOpIn-invalid.wsdl");
0263:                assertNotNull(policyMap
0264:                        .getInputMessageEffectivePolicy(policyMap
0265:                                .createWsdlMessageScopeKey(new QName(
0266:                                        "http://example.org",
0267:                                        "DictionaryService"),
0268:                                        new QName("http://example.org",
0269:                                                "CzechToEnglish"), new QName(
0270:                                                "http://example.org",
0271:                                                "TranslateOperation"))));
0272:            }
0273:
0274:            /**
0275:             * invalid wsdl on input
0276:             */
0277:            public void testPortTypeOpOutElementAttachment() throws Exception {
0278:                PolicyMap policyMap = getPolicyMap("parser/testRuntimeWSExtElemPortTypeOpOut-invalid.wsdl");
0279:                assertNotNull(policyMap
0280:                        .getOutputMessageEffectivePolicy(policyMap
0281:                                .createWsdlMessageScopeKey(new QName(
0282:                                        "http://example.org",
0283:                                        "DictionaryService"),
0284:                                        new QName("http://example.org",
0285:                                                "CzechToEnglish"), new QName(
0286:                                                "http://example.org",
0287:                                                "TranslateOperation"))));
0288:            }
0289:
0290:            /**
0291:             * invalid wsdl on input
0292:             */
0293:            public void testPortTypeOpFaultElementAttachment() throws Exception {
0294:                PolicyMap policyMap = getPolicyMap("parser/testRuntimeWSExtElemPortTypeOpFault-invalid.wsdl");
0295:                assertNotNull(policyMap
0296:                        .getFaultMessageEffectivePolicy(policyMap
0297:                                .createWsdlFaultMessageScopeKey(
0298:                                        new QName("http://example.org",
0299:                                                "DictionaryService"),
0300:                                        new QName("http://example.org",
0301:                                                "CzechToEnglish"),
0302:                                        new QName("http://example.org",
0303:                                                "TranslateOperation"),
0304:                                        new QName("http://example.org", "Fault"))));
0305:            }
0306:
0307:            public void testBindingOpInElementAttachment() throws Exception {
0308:                PolicyMap policyMap = getPolicyMap("parser/testRuntimeWSExtElemBindingOpIn.wsdl");
0309:                assertNotNull(policyMap
0310:                        .getInputMessageEffectivePolicy(policyMap
0311:                                .createWsdlMessageScopeKey(new QName(
0312:                                        "http://example.org",
0313:                                        "DictionaryService"),
0314:                                        new QName("http://example.org",
0315:                                                "CzechToEnglish"), new QName(
0316:                                                "http://example.org",
0317:                                                "TranslateOperation"))));
0318:            }
0319:
0320:            public void testBindingOpOutElementAttachment() throws Exception {
0321:                PolicyMap policyMap = getPolicyMap("parser/testRuntimeWSExtElemBindingOpOut.wsdl");
0322:                assertNotNull(policyMap
0323:                        .getOutputMessageEffectivePolicy(policyMap
0324:                                .createWsdlMessageScopeKey(new QName(
0325:                                        "http://example.org",
0326:                                        "DictionaryService"),
0327:                                        new QName("http://example.org",
0328:                                                "CzechToEnglish"), new QName(
0329:                                                "http://example.org",
0330:                                                "TranslateOperation"))));
0331:            }
0332:
0333:            public void testBindingOpFaultElementAttachment() throws Exception {
0334:                PolicyMap policyMap = getPolicyMap("parser/testRuntimeWSExtElemBindingOpFault.wsdl");
0335:                assertNotNull(policyMap
0336:                        .getFaultMessageEffectivePolicy(policyMap
0337:                                .createWsdlFaultMessageScopeKey(
0338:                                        new QName("http://example.org",
0339:                                                "DictionaryService"),
0340:                                        new QName("http://example.org",
0341:                                                "CzechToEnglish"),
0342:                                        new QName("http://example.org",
0343:                                                "TranslateOperation"),
0344:                                        new QName("http://example.org", "Fault"))));
0345:            }
0346:
0347:            /**
0348:             * invalid wsdl on input
0349:             */
0350:            public void testServiceAttrAttachment() throws Exception {
0351:                PolicyMap policyMap = getPolicyMap("parser/testRuntimeWSExtAttrService-invalid.wsdl");
0352:                assertNotNull(policyMap.getServiceEffectivePolicy(policyMap
0353:                        .createWsdlServiceScopeKey(new QName(
0354:                                "http://example.org", "DictionaryService"))));
0355:            }
0356:
0357:            /**
0358:             * invalid wsdl on input
0359:             */
0360:            public void testPortAttrAttachment() throws Exception {
0361:                PolicyMap policyMap = getPolicyMap("parser/testRuntimeWSExtAttrPort-invalid.wsdl");
0362:                assertNotNull(policyMap.getEndpointEffectivePolicy(policyMap
0363:                        .createWsdlEndpointScopeKey(new QName(
0364:                                "http://example.org", "DictionaryService"),
0365:                                new QName("http://example.org",
0366:                                        "CzechToEnglish"))));
0367:            }
0368:
0369:            public void testPortTypeAttrAttachment() throws Exception {
0370:                PolicyMap policyMap = getPolicyMap("parser/testRuntimeWSExtAttrPortType.wsdl");
0371:                assertNotNull(policyMap.getEndpointEffectivePolicy(policyMap
0372:                        .createWsdlEndpointScopeKey(new QName(
0373:                                "http://example.org", "DictionaryService"),
0374:                                new QName("http://example.org",
0375:                                        "CzechToEnglish"))));
0376:            }
0377:
0378:            /**
0379:             * invalid wsdl on input
0380:             */
0381:            public void testBindingAttrAttachment() throws Exception {
0382:                PolicyMap policyMap = getPolicyMap("parser/testRuntimeWSExtAttrBinding-invalid.wsdl");
0383:                assertNotNull(policyMap.getEndpointEffectivePolicy(policyMap
0384:                        .createWsdlEndpointScopeKey(new QName(
0385:                                "http://example.org", "DictionaryService"),
0386:                                new QName("http://example.org",
0387:                                        "CzechToEnglish"))));
0388:            }
0389:
0390:            /**
0391:             * invalid wsdl on input
0392:             */
0393:            public void testPortTypeOperationAttrAttachment() throws Exception {
0394:                PolicyMap policyMap = getPolicyMap("parser/testRuntimeWSExtAttrPortTypeOperation-invalid.wsdl");
0395:                assertNotNull(policyMap.getOperationEffectivePolicy(policyMap
0396:                        .createWsdlOperationScopeKey(new QName(
0397:                                "http://example.org", "DictionaryService"),
0398:                                new QName("http://example.org",
0399:                                        "CzechToEnglish"), new QName(
0400:                                        "http://example.org",
0401:                                        "TranslateOperation"))));
0402:            }
0403:
0404:            /**
0405:             * invalid wsdl on input
0406:             */
0407:            public void testBindingOperationAttrAttachment() throws Exception {
0408:                PolicyMap policyMap = getPolicyMap("parser/testRuntimeWSExtAttrBindingOperation-invalid.wsdl");
0409:                assertNotNull(policyMap.getOperationEffectivePolicy(policyMap
0410:                        .createWsdlOperationScopeKey(new QName(
0411:                                "http://example.org", "DictionaryService"),
0412:                                new QName("http://example.org",
0413:                                        "CzechToEnglish"), new QName(
0414:                                        "http://example.org",
0415:                                        "TranslateOperation"))));
0416:            }
0417:
0418:            /**
0419:             * invalid wsdl on input
0420:             */
0421:            public void testMessageInAttrAttachment() throws Exception {
0422:                PolicyMap policyMap = getPolicyMap("parser/testRuntimeWSExtAttrMessageIn-invalid.wsdl");
0423:                assertNotNull(policyMap
0424:                        .getInputMessageEffectivePolicy(policyMap
0425:                                .createWsdlMessageScopeKey(new QName(
0426:                                        "http://example.org",
0427:                                        "DictionaryService"),
0428:                                        new QName("http://example.org",
0429:                                                "CzechToEnglish"), new QName(
0430:                                                "http://example.org",
0431:                                                "TranslateOperation"))));
0432:            }
0433:
0434:            /**
0435:             * invalid wsdl on input
0436:             */
0437:            public void testMessageOutAttrAttachment() throws Exception {
0438:                PolicyMap policyMap = getPolicyMap("parser/testRuntimeWSExtAttrMessageOut-invalid.wsdl");
0439:                assertNotNull(policyMap
0440:                        .getOutputMessageEffectivePolicy(policyMap
0441:                                .createWsdlMessageScopeKey(new QName(
0442:                                        "http://example.org",
0443:                                        "DictionaryService"),
0444:                                        new QName("http://example.org",
0445:                                                "CzechToEnglish"), new QName(
0446:                                                "http://example.org",
0447:                                                "TranslateOperation"))));
0448:            }
0449:
0450:            /**
0451:             * invalid wsdl on input
0452:             */
0453:            public void testMessageFaultAttrAttachment() throws Exception {
0454:                PolicyMap policyMap = getPolicyMap("parser/testRuntimeWSExtAttrMessageFault-invalid.wsdl");
0455:                assertNotNull(policyMap
0456:                        .getFaultMessageEffectivePolicy(policyMap
0457:                                .createWsdlFaultMessageScopeKey(
0458:                                        new QName("http://example.org",
0459:                                                "DictionaryService"),
0460:                                        new QName("http://example.org",
0461:                                                "CzechToEnglish"),
0462:                                        new QName("http://example.org",
0463:                                                "TranslateOperation"),
0464:                                        new QName("http://example.org", "Fault"))));
0465:            }
0466:
0467:            public void testPortTypeOpInAttrAttachment() throws Exception {
0468:                PolicyMap policyMap = getPolicyMap("parser/testRuntimeWSExtAttrPortTypeOpIn.wsdl");
0469:                assertNotNull(policyMap
0470:                        .getInputMessageEffectivePolicy(policyMap
0471:                                .createWsdlMessageScopeKey(new QName(
0472:                                        "http://example.org",
0473:                                        "DictionaryService"),
0474:                                        new QName("http://example.org",
0475:                                                "CzechToEnglish"), new QName(
0476:                                                "http://example.org",
0477:                                                "TranslateOperation"))));
0478:            }
0479:
0480:            public void testPortTypeOpOutAttrAttachment() throws Exception {
0481:                PolicyMap policyMap = getPolicyMap("parser/testRuntimeWSExtAttrPortTypeOpOut.wsdl");
0482:                assertNotNull(policyMap
0483:                        .getOutputMessageEffectivePolicy(policyMap
0484:                                .createWsdlMessageScopeKey(new QName(
0485:                                        "http://example.org",
0486:                                        "DictionaryService"),
0487:                                        new QName("http://example.org",
0488:                                                "CzechToEnglish"), new QName(
0489:                                                "http://example.org",
0490:                                                "TranslateOperation"))));
0491:            }
0492:
0493:            public void testPortTypeOpFaultAttrAttachment() throws Exception {
0494:                PolicyMap policyMap = getPolicyMap("parser/testRuntimeWSExtAttrPortTypeOpFault.wsdl");
0495:                assertNotNull(policyMap
0496:                        .getFaultMessageEffectivePolicy(policyMap
0497:                                .createWsdlFaultMessageScopeKey(
0498:                                        new QName("http://example.org",
0499:                                                "DictionaryService"),
0500:                                        new QName("http://example.org",
0501:                                                "CzechToEnglish"),
0502:                                        new QName("http://example.org",
0503:                                                "TranslateOperation"),
0504:                                        new QName("http://example.org", "Fault"))));
0505:            }
0506:
0507:            /**
0508:             * invalid wsdl on input
0509:             */
0510:            public void testBindingOpInAttrAttachment() throws Exception {
0511:                PolicyMap policyMap = getPolicyMap("parser/testRuntimeWSExtAttrBindingOpIn-invalid.wsdl");
0512:                assertNotNull(policyMap
0513:                        .getInputMessageEffectivePolicy(policyMap
0514:                                .createWsdlMessageScopeKey(new QName(
0515:                                        "http://example.org",
0516:                                        "DictionaryService"),
0517:                                        new QName("http://example.org",
0518:                                                "CzechToEnglish"), new QName(
0519:                                                "http://example.org",
0520:                                                "TranslateOperation"))));
0521:            }
0522:
0523:            /**
0524:             * invalid wsdl on input
0525:             */
0526:            public void testBindingOpOutAttrAttachment() throws Exception {
0527:                PolicyMap policyMap = getPolicyMap("parser/testRuntimeWSExtAttrBindingOpOut-invalid.wsdl");
0528:                assertNotNull(policyMap
0529:                        .getOutputMessageEffectivePolicy(policyMap
0530:                                .createWsdlMessageScopeKey(new QName(
0531:                                        "http://example.org",
0532:                                        "DictionaryService"),
0533:                                        new QName("http://example.org",
0534:                                                "CzechToEnglish"), new QName(
0535:                                                "http://example.org",
0536:                                                "TranslateOperation"))));
0537:            }
0538:
0539:            /**
0540:             * invalid wsdl on input
0541:             */
0542:            public void testBindingOpFaultAttrAttachment() throws Exception {
0543:                PolicyMap policyMap = getPolicyMap("parser/testRuntimeWSExtAttrBindingOpFault-invalid.wsdl");
0544:                assertNotNull(policyMap
0545:                        .getFaultMessageEffectivePolicy(policyMap
0546:                                .createWsdlFaultMessageScopeKey(
0547:                                        new QName("http://example.org",
0548:                                                "DictionaryService"),
0549:                                        new QName("http://example.org",
0550:                                                "CzechToEnglish"),
0551:                                        new QName("http://example.org",
0552:                                                "TranslateOperation"),
0553:                                        new QName("http://example.org", "Fault"))));
0554:            }
0555:
0556:            public void testServiceHeredocAttachment() throws Exception {
0557:                PolicyMap policyMap = getPolicyMap("parser/testRuntimeWSExtHeredocService.wsdl");
0558:                assertNotNull(policyMap.getServiceEffectivePolicy(policyMap
0559:                        .createWsdlServiceScopeKey(new QName(
0560:                                "http://example.org", "DictionaryService"))));
0561:            }
0562:
0563:            public void testPortHeredocAttachment() throws Exception {
0564:                PolicyMap policyMap = getPolicyMap("parser/testRuntimeWSExtHeredocPort.wsdl");
0565:                assertNotNull(policyMap.getEndpointEffectivePolicy(policyMap
0566:                        .createWsdlEndpointScopeKey(new QName(
0567:                                "http://example.org", "DictionaryService"),
0568:                                new QName("http://example.org",
0569:                                        "CzechToEnglish"))));
0570:            }
0571:
0572:            /**
0573:             * invalid wsdl on input
0574:             */
0575:            public void testPortTypeHeredocAttachment() throws Exception {
0576:                PolicyMap policyMap = getPolicyMap("parser/testRuntimeWSExtHeredocPortType-invalid.wsdl");
0577:                assertNotNull(policyMap.getEndpointEffectivePolicy(policyMap
0578:                        .createWsdlEndpointScopeKey(new QName(
0579:                                "http://example.org", "DictionaryService"),
0580:                                new QName("http://example.org",
0581:                                        "CzechToEnglish"))));
0582:            }
0583:
0584:            public void testBindingHeredocAttachment() throws Exception {
0585:                PolicyMap policyMap = getPolicyMap("parser/testRuntimeWSExtHeredocBinding.wsdl");
0586:                assertNotNull(policyMap.getEndpointEffectivePolicy(policyMap
0587:                        .createWsdlEndpointScopeKey(new QName(
0588:                                "http://example.org", "DictionaryService"),
0589:                                new QName("http://example.org",
0590:                                        "CzechToEnglish"))));
0591:            }
0592:
0593:            public void testPortTypeOperationHeredocAttachment()
0594:                    throws Exception {
0595:                PolicyMap policyMap = getPolicyMap("parser/testRuntimeWSExtHeredocPortTypeOperation.wsdl");
0596:                assertNotNull(policyMap.getOperationEffectivePolicy(policyMap
0597:                        .createWsdlOperationScopeKey(new QName(
0598:                                "http://example.org", "DictionaryService"),
0599:                                new QName("http://example.org",
0600:                                        "CzechToEnglish"), new QName(
0601:                                        "http://example.org",
0602:                                        "TranslateOperation"))));
0603:            }
0604:
0605:            public void testBindingOperationHeredocAttachment()
0606:                    throws Exception {
0607:                PolicyMap policyMap = getPolicyMap("parser/testRuntimeWSExtHeredocBindingOperation.wsdl");
0608:                assertNotNull(policyMap.getOperationEffectivePolicy(policyMap
0609:                        .createWsdlOperationScopeKey(new QName(
0610:                                "http://example.org", "DictionaryService"),
0611:                                new QName("http://example.org",
0612:                                        "CzechToEnglish"), new QName(
0613:                                        "http://example.org",
0614:                                        "TranslateOperation"))));
0615:            }
0616:
0617:            public void testMessageInHeredocAttachment() throws Exception {
0618:                PolicyMap policyMap = getPolicyMap("parser/testRuntimeWSExtHeredocMessageIn.wsdl");
0619:                assertNotNull(policyMap
0620:                        .getInputMessageEffectivePolicy(policyMap
0621:                                .createWsdlMessageScopeKey(new QName(
0622:                                        "http://example.org",
0623:                                        "DictionaryService"),
0624:                                        new QName("http://example.org",
0625:                                                "CzechToEnglish"), new QName(
0626:                                                "http://example.org",
0627:                                                "TranslateOperation"))));
0628:            }
0629:
0630:            public void testMessageOutHeredocAttachment() throws Exception {
0631:                PolicyMap policyMap = getPolicyMap("parser/testRuntimeWSExtHeredocMessageOut.wsdl");
0632:                assertNotNull(policyMap
0633:                        .getOutputMessageEffectivePolicy(policyMap
0634:                                .createWsdlMessageScopeKey(new QName(
0635:                                        "http://example.org",
0636:                                        "DictionaryService"),
0637:                                        new QName("http://example.org",
0638:                                                "CzechToEnglish"), new QName(
0639:                                                "http://example.org",
0640:                                                "TranslateOperation"))));
0641:            }
0642:
0643:            public void testMessageFaultHeredocAttachment() throws Exception {
0644:                PolicyMap policyMap = getPolicyMap("parser/testRuntimeWSExtHeredocMessageFault.wsdl");
0645:                assertNotNull(policyMap
0646:                        .getFaultMessageEffectivePolicy(policyMap
0647:                                .createWsdlFaultMessageScopeKey(
0648:                                        new QName("http://example.org",
0649:                                                "DictionaryService"),
0650:                                        new QName("http://example.org",
0651:                                                "CzechToEnglish"),
0652:                                        new QName("http://example.org",
0653:                                                "TranslateOperation"),
0654:                                        new QName("http://example.org", "Fault"))));
0655:            }
0656:
0657:            /**
0658:             * invalid wsdl on input
0659:             */
0660:            public void testPortTypeOpInHeredocAttachment() throws Exception {
0661:                PolicyMap policyMap = getPolicyMap("parser/testRuntimeWSExtHeredocPortTypeOpIn-invalid.wsdl");
0662:                assertNotNull(policyMap
0663:                        .getInputMessageEffectivePolicy(policyMap
0664:                                .createWsdlMessageScopeKey(new QName(
0665:                                        "http://example.org",
0666:                                        "DictionaryService"),
0667:                                        new QName("http://example.org",
0668:                                                "CzechToEnglish"), new QName(
0669:                                                "http://example.org",
0670:                                                "TranslateOperation"))));
0671:            }
0672:
0673:            /**
0674:             * invalid wsdl on input
0675:             */
0676:            public void testPortTypeOpOutHeredocAttachment() throws Exception {
0677:                PolicyMap policyMap = getPolicyMap("parser/testRuntimeWSExtHeredocPortTypeOpOut-invalid.wsdl");
0678:                assertNotNull(policyMap
0679:                        .getOutputMessageEffectivePolicy(policyMap
0680:                                .createWsdlMessageScopeKey(new QName(
0681:                                        "http://example.org",
0682:                                        "DictionaryService"),
0683:                                        new QName("http://example.org",
0684:                                                "CzechToEnglish"), new QName(
0685:                                                "http://example.org",
0686:                                                "TranslateOperation"))));
0687:            }
0688:
0689:            /**
0690:             * invalid wsdl on input
0691:             */
0692:            public void testPortTypeOpFaultHeredocAttachment() throws Exception {
0693:                PolicyMap policyMap = getPolicyMap("parser/testRuntimeWSExtHeredocPortTypeOpFault-invalid.wsdl");
0694:                assertNotNull(policyMap
0695:                        .getFaultMessageEffectivePolicy(policyMap
0696:                                .createWsdlFaultMessageScopeKey(
0697:                                        new QName("http://example.org",
0698:                                                "DictionaryService"),
0699:                                        new QName("http://example.org",
0700:                                                "CzechToEnglish"),
0701:                                        new QName("http://example.org",
0702:                                                "TranslateOperation"),
0703:                                        new QName("http://example.org", "Fault"))));
0704:            }
0705:
0706:            public void testBindingOpInHeredocAttachment() throws Exception {
0707:                PolicyMap policyMap = getPolicyMap("parser/testRuntimeWSExtHeredocBindingOpIn.wsdl");
0708:                assertNotNull(policyMap
0709:                        .getInputMessageEffectivePolicy(policyMap
0710:                                .createWsdlMessageScopeKey(new QName(
0711:                                        "http://example.org",
0712:                                        "DictionaryService"),
0713:                                        new QName("http://example.org",
0714:                                                "CzechToEnglish"), new QName(
0715:                                                "http://example.org",
0716:                                                "TranslateOperation"))));
0717:            }
0718:
0719:            public void testBindingOpOutHeredocAttachment() throws Exception {
0720:                PolicyMap policyMap = getPolicyMap("parser/testRuntimeWSExtHeredocBindingOpOut.wsdl");
0721:                assertNotNull(policyMap
0722:                        .getOutputMessageEffectivePolicy(policyMap
0723:                                .createWsdlMessageScopeKey(new QName(
0724:                                        "http://example.org",
0725:                                        "DictionaryService"),
0726:                                        new QName("http://example.org",
0727:                                                "CzechToEnglish"), new QName(
0728:                                                "http://example.org",
0729:                                                "TranslateOperation"))));
0730:            }
0731:
0732:            public void testBindingOpFaultHeredocAttachment() throws Exception {
0733:                PolicyMap policyMap = getPolicyMap("parser/testRuntimeWSExtHeredocBindingOpFault.wsdl");
0734:                assertNotNull(policyMap
0735:                        .getFaultMessageEffectivePolicy(policyMap
0736:                                .createWsdlFaultMessageScopeKey(
0737:                                        new QName("http://example.org",
0738:                                                "DictionaryService"),
0739:                                        new QName("http://example.org",
0740:                                                "CzechToEnglish"),
0741:                                        new QName("http://example.org",
0742:                                                "TranslateOperation"),
0743:                                        new QName("http://example.org", "Fault"))));
0744:            }
0745:
0746:            public void testBindingOpFaultExternalPolicyAttachment()
0747:                    throws Exception {
0748:                PolicyMap policyMap = getPolicyMap("parser/testRuntimeWSExtExternalBindingOpFault.wsdl");
0749:                assertNotNull(policyMap
0750:                        .getFaultMessageEffectivePolicy(policyMap
0751:                                .createWsdlFaultMessageScopeKey(
0752:                                        new QName("http://example.org",
0753:                                                "DictionaryService"),
0754:                                        new QName("http://example.org",
0755:                                                "CzechToEnglish"),
0756:                                        new QName("http://example.org",
0757:                                                "TranslateOperation"),
0758:                                        new QName("http://example.org", "Fault"))));
0759:            }
0760:
0761:            public void testBindingOpFaultExternalFromAnonymousPolicyAttachment()
0762:                    throws Exception {
0763:                PolicyMap policyMap = getPolicyMap("parser/testRuntimeWSExtExternalFromAnonBindingOpFault.wsdl");
0764:                assertNotNull(policyMap
0765:                        .getFaultMessageEffectivePolicy(policyMap
0766:                                .createWsdlFaultMessageScopeKey(
0767:                                        new QName("http://example.org",
0768:                                                "DictionaryService"),
0769:                                        new QName("http://example.org",
0770:                                                "CzechToEnglish"),
0771:                                        new QName("http://example.org",
0772:                                                "TranslateOperation"),
0773:                                        new QName("http://example.org", "Fault"))));
0774:            }
0775:
0776:            public void testInvalidAssertionShouldCauseException()
0777:                    throws Exception {
0778:                try {
0779:                    PolicyMap policyMap = getPolicyMap(
0780:                            "parser/testInvalidAssertionError.wsdl", false);
0781:                    fail("WSDL validation should fail");
0782:                } catch (WebServiceException e) {
0783:                    // ok - exception thrown as expected
0784:                }
0785:            }
0786:
0787:            public void testCircularReference() throws Exception {
0788:                try {
0789:                    PolicyMap policyMap = getPolicyMap(
0790:                            "parser/testPolicyCircularReferences.wsdl", false);
0791:                    fail("Parsing WSDL containing circular policy references should fail");
0792:                } catch (WebServiceException e) {
0793:                    // ok - exception thrown as expected
0794:                }
0795:            }
0796:
0797:            public void testComprehensive() throws PolicyException {
0798:                PolicyMap policyMap = getPolicyMap("parser/testComprehensive.wsdl");
0799:
0800:                // Test service scope
0801:
0802:                Collection<PolicyMapKey> keys = policyMap
0803:                        .getAllServiceScopeKeys();
0804:                assertEquals(1, keys.size());
0805:
0806:                Policy policy = policyMap.getServiceEffectivePolicy(policyMap
0807:                        .createWsdlServiceScopeKey(new QName(
0808:                                "http://wsit.test/", "FaultServiceService")));
0809:                assertEquals(1, policy.getNumberOfAssertionSets());
0810:                AssertionSet assertionSet = policy.iterator().next();
0811:                assertTrue(assertionSet.contains(new QName("http://wsit.test/",
0812:                        "ServiceMarker")));
0813:
0814:                // Test endpoint scope
0815:
0816:                keys = policyMap.getAllEndpointScopeKeys();
0817:                assertEquals(1, keys.size());
0818:
0819:                policy = policyMap.getEndpointEffectivePolicy(policyMap
0820:                        .createWsdlEndpointScopeKey(new QName(
0821:                                "http://wsit.test/", "FaultServiceService"),
0822:                                new QName("http://wsit.test/",
0823:                                        "FaultServicePort")));
0824:                assertEquals(1, policy.getNumberOfAssertionSets());
0825:                assertionSet = policy.iterator().next();
0826:                assertTrue(assertionSet.contains(new QName("http://wsit.test/",
0827:                        "BindingMarker")));
0828:                assertTrue(assertionSet.contains(new QName("http://wsit.test/",
0829:                        "PortMarker")));
0830:
0831:                // Test operation scope
0832:
0833:                keys = policyMap.getAllOperationScopeKeys();
0834:                assertEquals(3, keys.size());
0835:
0836:                policy = policyMap.getOperationEffectivePolicy(policyMap
0837:                        .createWsdlOperationScopeKey(new QName(
0838:                                "http://wsit.test/", "FaultServiceService"),
0839:                                new QName("http://wsit.test/",
0840:                                        "FaultServicePort"), new QName(
0841:                                        "http://wsit.test/", "echo")));
0842:                assertEquals(1, policy.getNumberOfAssertionSets());
0843:                assertionSet = policy.iterator().next();
0844:                assertTrue(assertionSet.contains(new QName("http://wsit.test/",
0845:                        "BindingOperationEcho")));
0846:
0847:                policy = policyMap.getOperationEffectivePolicy(policyMap
0848:                        .createWsdlOperationScopeKey(new QName(
0849:                                "http://wsit.test/", "FaultServiceService"),
0850:                                new QName("http://wsit.test/",
0851:                                        "FaultServicePort"), new QName(
0852:                                        "http://wsit.test/", "hello")));
0853:                assertEquals(1, policy.getNumberOfAssertionSets());
0854:                assertionSet = policy.iterator().next();
0855:                assertTrue(assertionSet.contains(new QName("http://wsit.test/",
0856:                        "BindingOperationHello")));
0857:
0858:                policy = policyMap.getOperationEffectivePolicy(policyMap
0859:                        .createWsdlOperationScopeKey(new QName(
0860:                                "http://wsit.test/", "FaultServiceService"),
0861:                                new QName("http://wsit.test/",
0862:                                        "FaultServicePort"), new QName(
0863:                                        "http://wsit.test/", "ping")));
0864:                assertEquals(1, policy.getNumberOfAssertionSets());
0865:                assertionSet = policy.iterator().next();
0866:                assertTrue(assertionSet.contains(new QName("http://wsit.test/",
0867:                        "BindingOperationPing")));
0868:
0869:                // Test input message scope
0870:
0871:                keys = policyMap.getAllInputMessageScopeKeys();
0872:                assertEquals(3, keys.size());
0873:
0874:                policy = policyMap.getInputMessageEffectivePolicy(policyMap
0875:                        .createWsdlMessageScopeKey(new QName(
0876:                                "http://wsit.test/", "FaultServiceService"),
0877:                                new QName("http://wsit.test/",
0878:                                        "FaultServicePort"), new QName(
0879:                                        "http://wsit.test/", "echo")));
0880:                assertEquals(1, policy.getNumberOfAssertionSets());
0881:                assertionSet = policy.iterator().next();
0882:                assertTrue(assertionSet.contains(new QName("http://wsit.test/",
0883:                        "MessageEcho")));
0884:                assertTrue(assertionSet.contains(new QName("http://wsit.test/",
0885:                        "BindingEchoInput")));
0886:
0887:                policy = policyMap.getInputMessageEffectivePolicy(policyMap
0888:                        .createWsdlMessageScopeKey(new QName(
0889:                                "http://wsit.test/", "FaultServiceService"),
0890:                                new QName("http://wsit.test/",
0891:                                        "FaultServicePort"), new QName(
0892:                                        "http://wsit.test/", "hello")));
0893:                assertEquals(1, policy.getNumberOfAssertionSets());
0894:                assertionSet = policy.iterator().next();
0895:                assertTrue(assertionSet.contains(new QName("http://wsit.test/",
0896:                        "MessageHello")));
0897:                assertTrue(assertionSet.contains(new QName("http://wsit.test/",
0898:                        "BindingHelloInput")));
0899:
0900:                policy = policyMap.getInputMessageEffectivePolicy(policyMap
0901:                        .createWsdlMessageScopeKey(new QName(
0902:                                "http://wsit.test/", "FaultServiceService"),
0903:                                new QName("http://wsit.test/",
0904:                                        "FaultServicePort"), new QName(
0905:                                        "http://wsit.test/", "ping")));
0906:                assertEquals(1, policy.getNumberOfAssertionSets());
0907:                assertionSet = policy.iterator().next();
0908:                assertTrue(assertionSet.contains(new QName("http://wsit.test/",
0909:                        "MessagePing")));
0910:                assertTrue(assertionSet.contains(new QName("http://wsit.test/",
0911:                        "BindingPingInput")));
0912:
0913:                // Test output message scope
0914:
0915:                keys = policyMap.getAllOutputMessageScopeKeys();
0916:                assertEquals(3, keys.size());
0917:
0918:                policy = policyMap.getOutputMessageEffectivePolicy(policyMap
0919:                        .createWsdlMessageScopeKey(new QName(
0920:                                "http://wsit.test/", "FaultServiceService"),
0921:                                new QName("http://wsit.test/",
0922:                                        "FaultServicePort"), new QName(
0923:                                        "http://wsit.test/", "echo")));
0924:                assertEquals(1, policy.getNumberOfAssertionSets());
0925:                assertionSet = policy.iterator().next();
0926:                assertTrue(assertionSet.contains(new QName("http://wsit.test/",
0927:                        "MessageEchoResponse")));
0928:                assertTrue(assertionSet.contains(new QName("http://wsit.test/",
0929:                        "BindingEchoOutput")));
0930:
0931:                policy = policyMap.getOutputMessageEffectivePolicy(policyMap
0932:                        .createWsdlMessageScopeKey(new QName(
0933:                                "http://wsit.test/", "FaultServiceService"),
0934:                                new QName("http://wsit.test/",
0935:                                        "FaultServicePort"), new QName(
0936:                                        "http://wsit.test/", "hello")));
0937:                assertEquals(1, policy.getNumberOfAssertionSets());
0938:                assertionSet = policy.iterator().next();
0939:                assertTrue(assertionSet.contains(new QName("http://wsit.test/",
0940:                        "MessageHelloResponse")));
0941:                assertTrue(assertionSet.contains(new QName("http://wsit.test/",
0942:                        "BindingHelloOutput")));
0943:
0944:                policy = policyMap.getOutputMessageEffectivePolicy(policyMap
0945:                        .createWsdlMessageScopeKey(new QName(
0946:                                "http://wsit.test/", "FaultServiceService"),
0947:                                new QName("http://wsit.test/",
0948:                                        "FaultServicePort"), new QName(
0949:                                        "http://wsit.test/", "ping")));
0950:                assertEquals(1, policy.getNumberOfAssertionSets());
0951:                assertionSet = policy.iterator().next();
0952:                assertTrue(assertionSet.contains(new QName("http://wsit.test/",
0953:                        "BindingPingOutput")));
0954:
0955:                // Test fault message scope
0956:
0957:                keys = policyMap.getAllFaultMessageScopeKeys();
0958:                assertEquals(6, keys.size());
0959:
0960:                policy = policyMap
0961:                        .getFaultMessageEffectivePolicy(policyMap
0962:                                .createWsdlFaultMessageScopeKey(new QName(
0963:                                        "http://wsit.test/",
0964:                                        "FaultServiceService"),
0965:                                        new QName("http://wsit.test/",
0966:                                                "FaultServicePort"), new QName(
0967:                                                "http://wsit.test/", "echo"),
0968:                                        new QName("http://wsit.test/",
0969:                                                "EchoException")));
0970:                assertEquals(1, policy.getNumberOfAssertionSets());
0971:                assertionSet = policy.iterator().next();
0972:                assertTrue(assertionSet.contains(new QName("http://wsit.test/",
0973:                        "BindingEchoException")));
0974:                assertTrue(assertionSet.contains(new QName("http://wsit.test/",
0975:                        "EchoException")));
0976:
0977:                policy = policyMap
0978:                        .getFaultMessageEffectivePolicy(policyMap
0979:                                .createWsdlFaultMessageScopeKey(new QName(
0980:                                        "http://wsit.test/",
0981:                                        "FaultServiceService"),
0982:                                        new QName("http://wsit.test/",
0983:                                                "FaultServicePort"), new QName(
0984:                                                "http://wsit.test/", "echo"),
0985:                                        new QName("http://wsit.test/",
0986:                                                "Echo2Exception")));
0987:                assertEquals(1, policy.getNumberOfAssertionSets());
0988:                assertionSet = policy.iterator().next();
0989:                assertTrue(assertionSet.contains(new QName("http://wsit.test/",
0990:                        "BindingEcho2Exception")));
0991:                assertTrue(assertionSet.contains(new QName("http://wsit.test/",
0992:                        "Echo2Exception")));
0993:
0994:                policy = policyMap
0995:                        .getFaultMessageEffectivePolicy(policyMap
0996:                                .createWsdlFaultMessageScopeKey(new QName(
0997:                                        "http://wsit.test/",
0998:                                        "FaultServiceService"),
0999:                                        new QName("http://wsit.test/",
1000:                                                "FaultServicePort"), new QName(
1001:                                                "http://wsit.test/", "hello"),
1002:                                        new QName("http://wsit.test/",
1003:                                                "HelloException")));
1004:                assertEquals(1, policy.getNumberOfAssertionSets());
1005:                assertionSet = policy.iterator().next();
1006:                assertTrue(assertionSet.contains(new QName("http://wsit.test/",
1007:                        "BindingHelloException")));
1008:                assertTrue(assertionSet.contains(new QName("http://wsit.test/",
1009:                        "HelloException")));
1010:
1011:                policy = policyMap.getFaultMessageEffectivePolicy(policyMap
1012:                        .createWsdlFaultMessageScopeKey(new QName(
1013:                                "http://wsit.test/", "FaultServiceService"),
1014:                                new QName("http://wsit.test/",
1015:                                        "FaultServicePort"), new QName(
1016:                                        "http://wsit.test/", "hello"),
1017:                                new QName("http://wsit.test/",
1018:                                        "Hello2Exception")));
1019:                assertEquals(1, policy.getNumberOfAssertionSets());
1020:                assertionSet = policy.iterator().next();
1021:                assertTrue(assertionSet.contains(new QName("http://wsit.test/",
1022:                        "BindingHello2Exception")));
1023:                assertTrue(assertionSet.contains(new QName("http://wsit.test/",
1024:                        "Hello2Exception")));
1025:
1026:                policy = policyMap
1027:                        .getFaultMessageEffectivePolicy(policyMap
1028:                                .createWsdlFaultMessageScopeKey(new QName(
1029:                                        "http://wsit.test/",
1030:                                        "FaultServiceService"),
1031:                                        new QName("http://wsit.test/",
1032:                                                "FaultServicePort"), new QName(
1033:                                                "http://wsit.test/", "ping"),
1034:                                        new QName("http://wsit.test/",
1035:                                                "EchoException")));
1036:                assertEquals(1, policy.getNumberOfAssertionSets());
1037:                assertionSet = policy.iterator().next();
1038:                assertTrue(assertionSet.contains(new QName("http://wsit.test/",
1039:                        "BindingPingException")));
1040:                assertTrue(assertionSet.contains(new QName("http://wsit.test/",
1041:                        "BindingEchoException")));
1042:                assertTrue(assertionSet.contains(new QName("http://wsit.test/",
1043:                        "BindingEcho2Exception")));
1044:                assertTrue(assertionSet.contains(new QName("http://wsit.test/",
1045:                        "EchoException")));
1046:                assertFalse(assertionSet.contains(new QName(
1047:                        "http://wsit.test/", "Echo2Exception")));
1048:
1049:                policy = policyMap
1050:                        .getFaultMessageEffectivePolicy(policyMap
1051:                                .createWsdlFaultMessageScopeKey(new QName(
1052:                                        "http://wsit.test/",
1053:                                        "FaultServiceService"),
1054:                                        new QName("http://wsit.test/",
1055:                                                "FaultServicePort"), new QName(
1056:                                                "http://wsit.test/", "ping"),
1057:                                        new QName("http://wsit.test/",
1058:                                                "Echo2Exception")));
1059:                assertEquals(1, policy.getNumberOfAssertionSets());
1060:                assertionSet = policy.iterator().next();
1061:                assertTrue(assertionSet.contains(new QName("http://wsit.test/",
1062:                        "BindingPing2Exception")));
1063:                assertFalse(assertionSet.contains(new QName(
1064:                        "http://wsit.test/", "EchoException")));
1065:                assertTrue(assertionSet.contains(new QName("http://wsit.test/",
1066:                        "Echo2Exception")));
1067:
1068:            }
1069:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.