1   /*
2    * Copyright 2005 the original author or authors.
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  
17  package org.springframework.ws.server.endpoint;
18  
19  import org.w3c.dom.Document;
20  import org.w3c.dom.Element;
21  
22  public class DomPayloadEndpointTest extends AbstractPayloadEndpointTestCase {
23  
24      protected PayloadEndpoint createNoResponseEndpoint() throws Exception {
25          return new AbstractDomPayloadEndpoint() {
26  
27              protected Element invokeInternal(Element requestElement, Document document) throws Exception {
28                  return null;
29              }
30          };
31      }
32  
33      protected PayloadEndpoint createResponseEndpoint() throws Exception {
34          return new AbstractDomPayloadEndpoint() {
35  
36              protected Element invokeInternal(Element requestElement, Document responseDocument) throws Exception {
37                  assertNotNull("No requestElement passed", requestElement);
38                  assertNotNull("No responseDocument passed", responseDocument);
39                  assertEquals("Invalid request element", REQUEST_ELEMENT, requestElement.getLocalName());
40                  assertEquals("Invalid request element", NAMESPACE_URI, requestElement.getNamespaceURI());
41                  return responseDocument.createElementNS(NAMESPACE_URI, RESPONSE_ELEMENT);
42              }
43          };
44      }
45  
46      protected PayloadEndpoint createNoRequestEndpoint() throws Exception {
47          return new AbstractDomPayloadEndpoint() {
48  
49              protected Element invokeInternal(Element requestElement, Document responseDocument) throws Exception {
50                  assertNull("RequestElement passed", requestElement);
51                  return null;
52              }
53          };
54      }
55  }