[bisq-network/bisq] Refactor checkMaxConnections (#3126)
Florian Reimair
notifications at github.com
Mon Nov 18 12:09:34 UTC 2019
freimair requested changes on this pull request.
IMO we could get away with mocking the `SeedNodeRepository` superclass, thus eliminating the dependency to `core`. Can you verify that this is correct?
> @@ -205,6 +205,7 @@ configure(project(':common')) {
configure(project(':p2p')) {
dependencies {
compile project(':common')
+ testCompile project(':core')
```suggestion
```
> + * under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or (at
+ * your option) any later version.
+ *
+ * Bisq is distributed in the hope that it will be useful, but WITHOUT
+ * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
+ * FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public
+ * License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with Bisq. If not, see <http://www.gnu.org/licenses/>.
+ */
+
+package bisq.network.p2p;
+
+import bisq.core.network.p2p.seed.DefaultSeedNodeRepository;
```suggestion
import bisq.network.p2p.seed.SeedNodeRepository;
```
> +
+public class MockNode {
+ @Getter
+ public NetworkNode networkNode;
+ @Getter
+ public PeerManager peerManager;
+ @Getter
+ public Set<Connection> connections;
+ @Getter
+ public int maxConnections;
+
+ public MockNode(int maxConnections) {
+ this.maxConnections = maxConnections;
+ networkNode = mock(NetworkNode.class);
+ Storage<PeerList> storage = new Storage<>(mock(File.class), mock(PersistenceProtoResolver.class), mock(CorruptedDatabaseFilesHandler.class));
+ peerManager = new PeerManager(networkNode, mock(DefaultSeedNodeRepository.class), new ClockWatcher(), maxConnections, storage);
```suggestion
peerManager = new PeerManager(networkNode, mock(SeedNodeRepository.class), new ClockWatcher(), maxConnections, storage);
```
--
You are receiving this because you are subscribed to this thread.
Reply to this email directly or view it on GitHub:
https://github.com/bisq-network/bisq/pull/3126#pullrequestreview-318281189
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.bisq.network/pipermail/bisq-github/attachments/20191118/8523be1e/attachment.html>
More information about the bisq-github
mailing list