View Javadoc

1   /*
2    * SymmetricDS is an open source database synchronization solution.
3    *   
4    * Copyright (C) Chris Henson <chenson42@users.sourceforge.net>
5    *
6    * This library is free software; you can redistribute it and/or
7    * modify it under the terms of the GNU Lesser General Public
8    * License as published by the Free Software Foundation; either
9    * version 3 of the License, or (at your option) any later version.
10   *
11   * This library is distributed in the hope that it will be useful,
12   * but WITHOUT ANY WARRANTY; without even the implied warranty of
13   * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
14   * Lesser General Public License for more details.
15   *
16   * You should have received a copy of the GNU Lesser General Public
17   * License along with this library; if not, see
18   * <http://www.gnu.org/licenses/>.
19   */
20  
21  package org.jumpmind.symmetric.transport.mock;
22  
23  import java.io.IOException;
24  import java.io.OutputStream;
25  import java.util.List;
26  import java.util.Map;
27  
28  import org.jumpmind.symmetric.model.BatchInfo;
29  import org.jumpmind.symmetric.model.Node;
30  import org.jumpmind.symmetric.model.IncomingBatchHistory;
31  import org.jumpmind.symmetric.transport.IIncomingTransport;
32  import org.jumpmind.symmetric.transport.IOutgoingWithResponseTransport;
33  import org.jumpmind.symmetric.transport.ITransportManager;
34  
35  public class MockTransportManager implements ITransportManager {
36  
37      protected IIncomingTransport incomingTransport;
38  
39      protected IOutgoingWithResponseTransport outgoingTransport;
40  
41      public IIncomingTransport getPullTransport(Node remote, Node local) throws IOException {
42          return incomingTransport;
43      }
44  
45      public IOutgoingWithResponseTransport getPushTransport(Node remote, Node local) throws IOException {
46          return outgoingTransport;
47      }
48  
49      public boolean sendAcknowledgement(Node remote, List<IncomingBatchHistory> list, Node local) throws IOException {
50          return true;
51      }
52  
53      public boolean sendMessage(Node node, String data) throws IOException {
54          return true;
55      }
56  
57      public void writeAcknowledgement(OutputStream out, List<IncomingBatchHistory> list) throws IOException {
58      }
59  
60      public void writeMessage(OutputStream out, String data) throws IOException {
61      }
62  
63      public IIncomingTransport getIncomingTransport() {
64          return incomingTransport;
65      }
66  
67      public void setIncomingTransport(IIncomingTransport is) {
68          this.incomingTransport = is;
69      }
70  
71      public IOutgoingWithResponseTransport getOutgoingTransport() {
72          return outgoingTransport;
73      }
74  
75      public void setOutgoingTransport(IOutgoingWithResponseTransport outgoingTransport) {
76          this.outgoingTransport = outgoingTransport;
77      }
78  
79      public IIncomingTransport getRegisterTransport(Node node) throws IOException {
80          return incomingTransport;
81      }
82  
83      public List<BatchInfo> readAcknowledgement(String parameterString) throws IOException {
84          return null;
85      }
86  
87      public List<BatchInfo> readAcknowledgement(Map<String, Object> parameters) {
88          return null;
89      }
90  
91      public List<BatchInfo> readAcknowledgement(String parameterString1, String parameterString2) throws IOException {
92          return null;
93      }
94  
95  }