Author: lmandel
Date: Tue Feb 19 07:39:29 2008
New Revision: 629127

URL: http://svn.apache.org/viewvc?rev=629127&view=rev
Log:
Fixed assertion test breakage.

Added:
    
webservices/woden/branches/woden62/test/org/apache/woden/internal/wsdl20/assertions/AssertionContextImpl.java
   (with props)
Modified:
    
webservices/woden/branches/woden62/test/org/apache/woden/internal/wsdl20/assertions/TestInterface1009.java
    
webservices/woden/branches/woden62/test/org/apache/woden/internal/wsdl20/assertions/TestInterface1010.java

Added: 
webservices/woden/branches/woden62/test/org/apache/woden/internal/wsdl20/assertions/AssertionContextImpl.java
URL: 
http://svn.apache.org/viewvc/webservices/woden/branches/woden62/test/org/apache/woden/internal/wsdl20/assertions/AssertionContextImpl.java?rev=629127&view=auto
==============================================================================
--- 
webservices/woden/branches/woden62/test/org/apache/woden/internal/wsdl20/assertions/AssertionContextImpl.java
 (added)
+++ 
webservices/woden/branches/woden62/test/org/apache/woden/internal/wsdl20/assertions/AssertionContextImpl.java
 Tue Feb 19 07:39:29 2008
@@ -0,0 +1,53 @@
+/**
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements.  See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You under the Apache License, Version 2.0
+ * (the "License"); you may not use this file except in compliance with
+ * the License.  You may obtain a copy of the License at
+ * 
+ *     http://www.apache.org/licenses/LICENSE-2.0 
+ * 
+ * Unless required by applicable law or agreed to in writing, software 
+ * distributed under the License is distributed on an "AS IS" BASIS, 
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 
+ * See the License for the specific language governing permissions and 
+ * limitations under the License.
+ */
+package org.apache.woden.internal.wsdl20.assertions;
+
+import org.apache.woden.ErrorReporter;
+import org.apache.woden.resolver.URIResolver;
+import org.apache.woden.wsdl20.validation.AssertionContext;
+
+/**
+ * Stub to allow for unit testing of assertions.
+ * 
+ * @author John Kaputin ([EMAIL PROTECTED])
+ */
+public class AssertionContextImpl implements AssertionContext {
+    
+    private ErrorReporter errReporter;
+    private URIResolver uriResolver;
+    
+    //package private ctor
+    public AssertionContextImpl(ErrorReporter errReporter, URIResolver 
uriResolver) {
+        this.errReporter = errReporter;
+        this.uriResolver = uriResolver;
+    }
+
+    /* (non-Javadoc)
+     * @see 
org.apache.woden.wsdl20.validation.AssertionContext#getErrorReporter()
+     */
+    public ErrorReporter getErrorReporter() {
+        return this.errReporter;
+    }
+
+    /* (non-Javadoc)
+     * @see 
org.apache.woden.wsdl20.validation.AssertionContext#getUriResolver()
+     */
+    public URIResolver getUriResolver() {
+        return this.uriResolver;
+    }
+
+}

Propchange: 
webservices/woden/branches/woden62/test/org/apache/woden/internal/wsdl20/assertions/AssertionContextImpl.java
------------------------------------------------------------------------------
    svn:eol-style = native

Modified: 
webservices/woden/branches/woden62/test/org/apache/woden/internal/wsdl20/assertions/TestInterface1009.java
URL: 
http://svn.apache.org/viewvc/webservices/woden/branches/woden62/test/org/apache/woden/internal/wsdl20/assertions/TestInterface1009.java?rev=629127&r1=629126&r2=629127&view=diff
==============================================================================
--- 
webservices/woden/branches/woden62/test/org/apache/woden/internal/wsdl20/assertions/TestInterface1009.java
 (original)
+++ 
webservices/woden/branches/woden62/test/org/apache/woden/internal/wsdl20/assertions/TestInterface1009.java
 Tue Feb 19 07:39:29 2008
@@ -28,6 +28,7 @@
 import org.apache.woden.tests.TestErrorHandler;
 import org.apache.woden.types.NCName;
 import org.apache.woden.wsdl20.Description;
+import org.apache.woden.wsdl20.validation.AssertionContext;
 import org.apache.woden.wsdl20.xml.DescriptionElement;
 import org.apache.woden.wsdl20.xml.InterfaceElement;
 
@@ -42,6 +43,7 @@
        private Interface1009 assertion = new Interface1009();
        private ErrorReporter reporter;
        private TestErrorHandler handler;
+       private AssertionContext assertionContext;
        
        protected void setUp() throws Exception {
            try {
@@ -53,6 +55,14 @@
            handler = new TestErrorHandler();
            reporter = factory.newWSDLReader().getErrorReporter();
                reporter.setErrorHandler(handler);
+               assertionContext = new AssertionContextImpl(reporter, null);
+       }
+       
+       protected void tearDown() throws Exception {
+               factory = null;
+               reporter = null;
+               handler = null;
+               assertionContext = null;
        }
 
        /**
@@ -73,8 +83,11 @@
                
                // init Interface's ref to its Description, needed for 
interface extension.
                descComp.getInterfaces();
-               
-               assertion.validate(interfac, reporter);
+               try {
+                       assertion.validate(interfac, assertionContext);
+               } catch(WSDLException e){
+                       fail("Assertion Interface1009 threw a WSDLException.");
+               }
                if(handler.errorMessageHasBeenReported()) {
                        fail("Assertion Interface1009 fails incorrectly for an 
interface that extends no other interfaces.");
                }
@@ -100,7 +113,11 @@
            // init Interface's ref to its Description, needed for interface 
extension.
            descComp.getInterfaces(); 
                  
-           assertion.validate(interfac, reporter);
+           try {
+               assertion.validate(interfac, assertionContext);
+           } catch(WSDLException e) {
+               fail("Assertion Interface1009 threw a WSDLException.");
+           }
            if(!handler.errorMessageHasBeenReported()) {
                fail("Assertion Interface1009 passes incorrectly for an 
interface that directly extends itself.");
            }
@@ -128,7 +145,11 @@
                // init Interface's ref to its Description, needed for 
interface extension.
                descComp.getInterfaces(); 
                  
-               assertion.validate(interfac, reporter);
+               try {
+                       assertion.validate(interfac, assertionContext);
+               } catch(WSDLException e){
+                       fail("Assertion Interface1009 threw a WSDLException.");
+               }
                if(!handler.errorMessageHasBeenReported()) {
                        fail("Assertion Interface1009 passes incorrectly for an 
interface that indirectly extends itself.");
                }
@@ -170,7 +191,11 @@
                
                // init Interface's ref to its Description, needed for 
interface extension.
                descComp.getInterfaces(); 
-               assertion.validate(interfac, reporter);
+               try {
+                       assertion.validate(interfac, assertionContext);
+               } catch(WSDLException e){
+                       fail("Assertion Interface1009 threw a WSDLException.");
+               }
                
                if(handler.errorMessageHasBeenReported()) {
                        fail("Assertion Interface1009 fails incorrectly for an 
interface that is not in the list of exteneded interfaces.");

Modified: 
webservices/woden/branches/woden62/test/org/apache/woden/internal/wsdl20/assertions/TestInterface1010.java
URL: 
http://svn.apache.org/viewvc/webservices/woden/branches/woden62/test/org/apache/woden/internal/wsdl20/assertions/TestInterface1010.java?rev=629127&r1=629126&r2=629127&view=diff
==============================================================================
--- 
webservices/woden/branches/woden62/test/org/apache/woden/internal/wsdl20/assertions/TestInterface1010.java
 (original)
+++ 
webservices/woden/branches/woden62/test/org/apache/woden/internal/wsdl20/assertions/TestInterface1010.java
 Tue Feb 19 07:39:29 2008
@@ -29,6 +29,7 @@
 import org.apache.woden.types.NCName;
 import org.apache.woden.wsdl20.Description;
 import org.apache.woden.wsdl20.Interface;
+import org.apache.woden.wsdl20.validation.AssertionContext;
 import org.apache.woden.wsdl20.xml.DescriptionElement;
 import org.apache.woden.wsdl20.xml.InterfaceElement;
 
@@ -43,6 +44,7 @@
        private Interface1010 assertion = new Interface1010();
        private ErrorReporter reporter;
        private TestErrorHandler handler;
+       private AssertionContext assertionContext;
        
        protected void setUp() throws Exception {
            try {
@@ -54,12 +56,14 @@
            handler = new TestErrorHandler();
            reporter = factory.newWSDLReader().getErrorReporter();
                reporter.setErrorHandler(handler);
+               assertionContext = new AssertionContextImpl(reporter, null);
        }
        
        protected void tearDown() throws Exception {
                factory = null;
                reporter = null;
                handler = null;
+               assertionContext = null;
        }
 
        /**
@@ -75,7 +79,11 @@
                        // Do nothing.
                }
              
-               assertion.validate(descComp, reporter);
+               try {
+                       assertion.validate(descComp, assertionContext);
+               } catch(WSDLException e) {
+                       fail("Assertion Interface1010 threw WSDLException.");
+               }
                if(handler.errorMessageHasBeenReported()) {
                        fail("Assertion Interface1010 failed incorrectly with 
no interfaces specified.");
                }
@@ -96,7 +104,11 @@
                InterfaceImpl interfac = 
(InterfaceImpl)descEl.addInterfaceElement();
                interfac.setName(new NCName("name1"));
                
-               assertion.validate(descComp, reporter);
+               try {
+                       assertion.validate(descComp, assertionContext);
+               } catch(WSDLException e) {
+                       fail("Assertion Interface1010 threw WSDLException.");
+               }
                
                if(handler.errorMessageHasBeenReported()) {
                        fail("Assertion Interface1010 failed incorrectly with a 
single interface defined.");
@@ -122,7 +134,11 @@
                InterfaceImpl interfac3 = 
(InterfaceImpl)descEl.addInterfaceElement();
                interfac3.setName(new NCName("name3"));
                  
-               assertion.validate(descComp, reporter);
+               try {
+                       assertion.validate(descComp, assertionContext);
+               } catch(WSDLException e) {
+                       fail("Assertion Interface1010 threw WSDLException.");
+               }
                
                if(handler.errorMessageHasBeenReported()) {
                        fail("Assertion Interface1010 failed incorrectly with 
multiple interfaces defined with no duplicate names.");
@@ -153,7 +169,11 @@
                interfac3.setName(new NCName("name3"));
                interfac2.addExtendedInterfaceName(interfac3.getName());
                  
-               assertion.validate(descComp, reporter);
+               try {
+                       assertion.validate(descComp, assertionContext);
+               } catch(WSDLException e) {
+                       fail("Assertion Interface1010 threw WSDLException.");
+               }
                  
                if(!handler.errorMessageHasBeenReported()) {
                    fail("Assertion Interface1010 passed incorrectly for two 
interfaces defined with the same NCName.");
@@ -183,7 +203,11 @@
                interfac3.setName(new NCName("name3"));
                interfac2.addExtendedInterfaceName(interfac3.getName());
                  
-               assertion.validate(descComp, reporter);
+               try {
+                       assertion.validate(descComp, assertionContext);
+               } catch(WSDLException e) {
+                       fail("Assertion Interface1010 threw WSDLException.");
+               }
                  
                if(!handler.errorMessageHasBeenReported()) {
                    fail("Assertion Interface1010 passed incorrectly for two 
interfaces defined with the same name.");



---------------------------------------------------------------------
To unsubscribe, e-mail: [EMAIL PROTECTED]
For additional commands, e-mail: [EMAIL PROTECTED]

Reply via email to