1   /*
2    * Copyright 2005-2010 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 nu.xom.Element;
20  
21  import static org.junit.Assert.*;
22  
23  public class XomPayloadEndpointTest extends AbstractPayloadEndpointTestCase {
24  
25      @Override
26      protected PayloadEndpoint createNoResponseEndpoint() throws Exception {
27          return new AbstractXomPayloadEndpoint() {
28  
29              @Override
30              protected Element invokeInternal(Element requestElement) throws Exception {
31                  return null;
32              }
33          };
34      }
35  
36      @Override
37      protected PayloadEndpoint createResponseEndpoint() throws Exception {
38          return new AbstractXomPayloadEndpoint() {
39  
40              @Override
41              protected Element invokeInternal(Element requestElement) throws Exception {
42                  assertNotNull("No requestElement passed", requestElement);
43                  assertEquals("Invalid request element", REQUEST_ELEMENT, requestElement.getLocalName());
44                  assertEquals("Invalid request element", NAMESPACE_URI, requestElement.getNamespaceURI());
45                  return new Element(RESPONSE_ELEMENT, NAMESPACE_URI);
46              }
47          };
48      }
49  
50      @Override
51      protected PayloadEndpoint createNoRequestEndpoint() throws Exception {
52          return new AbstractXomPayloadEndpoint() {
53  
54              @Override
55              protected Element invokeInternal(Element requestElement) throws Exception {
56                  assertNull("RequestElement passed", requestElement);
57                  return null;
58              }
59          };
60      }
61  
62      @Override
63      public void testStaxSourceEventReader() throws Exception {
64          // overriden, because XOM doesn't not support it
65      }
66  
67      @Override
68      public void testStaxSourceStreamReader() throws Exception {
69          // overriden, because XOM doesn't not support it
70      }
71  
72  }