01: /*
02: * Licensed to the Apache Software Foundation (ASF) under one
03: * or more contributor license agreements. See the NOTICE file
04: * distributed with this work for additional information
05: * regarding copyright ownership. The ASF licenses this file
06: * to you under the Apache License, Version 2.0 (the
07: * "License"); you may not use this file except in compliance
08: * with the License. You may obtain a copy of the License at
09: *
10: * http://www.apache.org/licenses/LICENSE-2.0
11: *
12: * Unless required by applicable law or agreed to in writing,
13: * software distributed under the License is distributed on an
14: * * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15: * KIND, either express or implied. See the License for the
16: * specific language governing permissions and limitations
17: * under the License.
18: */
19:
20: package org.apache.synapse.config.xml;
21:
22: /**
23: * Factory and Serializer tests for the CloneMediator
24: */
25: public class CloneMediatorSerializationTest extends AbstractTestCase {
26:
27: CloneMediatorFactory cloneMediatorFactory;
28: CloneMediatorSerializer cloneMediatorSerializer;
29:
30: public CloneMediatorSerializationTest() {
31: super (CloneMediatorSerializationTest.class.getName());
32: cloneMediatorFactory = new CloneMediatorFactory();
33: cloneMediatorSerializer = new CloneMediatorSerializer();
34: }
35:
36: public void testCloneMediatorSerializationSenarioOne()
37: throws Exception {
38: String inputXml = "<clone xmlns=\"http://ws.apache.org/ns/synapse\" "
39: + "continueParent=\"true\"><target sequence=\"sequenceRef1\" "
40: + "endpoint=\"endpointRef1\"/><target sequence=\"sequenceRef2\" "
41: + "endpoint=\"endpointRef2\"/></clone> ";
42: assertTrue(serialization(inputXml, cloneMediatorFactory,
43: cloneMediatorSerializer));
44: assertTrue(serialization(inputXml, cloneMediatorSerializer));
45: }
46:
47: public void testCloneMediatorSerializationScenarioTwo()
48: throws Exception {
49: String inputXml = "<clone xmlns=\"http://ws.apache.org/ns/synapse\">"
50: + "<target endpoint=\"endpointRef1\"><sequence><log/></sequence></target>"
51: + "<target sequence=\"sequenceRef2\"><endpoint><address uri=\"http://testURL\"/>"
52: + "</endpoint></target></clone> ";
53: assertTrue(serialization(inputXml, cloneMediatorFactory,
54: cloneMediatorSerializer));
55: assertTrue(serialization(inputXml, cloneMediatorSerializer));
56: }
57:
58: public void testCloneMediatorSerializationScenarioThree()
59: throws Exception {
60: String inputXml = "<clone xmlns=\"http://ws.apache.org/ns/synapse\">"
61: + "<target><sequence><send/></sequence><endpoint><address uri=\"http://testURL2\"/>"
62: + "</endpoint></target><target sequence=\"sequenceRef2\" "
63: + "endpoint=\"endpointRef2\"/></clone> ";
64: assertTrue(serialization(inputXml, cloneMediatorFactory,
65: cloneMediatorSerializer));
66: assertTrue(serialization(inputXml, cloneMediatorSerializer));
67: }
68:
69: public void testCloneMediatorSerializationScenarioFour()
70: throws Exception {
71: String inputXml = "<clone xmlns=\"http://ws.apache.org/ns/synapse\" "
72: + "continueParent=\"true\"><target to=\"http://localhost:7777\"><sequence><send/>"
73: + "</sequence><endpoint><address uri=\"http://testURL2\"/></endpoint></target>"
74: + "<target soapAction=\"urn:test\" sequence=\"sequenceRef2\" "
75: + "endpoint=\"endpointRef2\"/></clone> ";
76: assertTrue(serialization(inputXml, cloneMediatorFactory,
77: cloneMediatorSerializer));
78: assertTrue(serialization(inputXml, cloneMediatorSerializer));
79: }
80: }
|