From 5bb5f76520d5d0873cde6cb6171a44ea402f4f4b Mon Sep 17 00:00:00 2001 From: Martin Stockhammer Date: Wed, 14 Sep 2016 10:22:21 +0200 Subject: [PATCH] Adding unit test for remote repository check --- .../services/RemoteRepositoriesServiceTest.java | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/RemoteRepositoriesServiceTest.java b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/RemoteRepositoriesServiceTest.java index db857719f..3d284e452 100644 --- a/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/RemoteRepositoriesServiceTest.java +++ b/archiva-modules/archiva-web/archiva-rest/archiva-rest-services/src/test/java/org/apache/archiva/rest/services/RemoteRepositoriesServiceTest.java @@ -146,6 +146,21 @@ public class RemoteRepositoriesServiceTest } + @Test + public void checkRemoteConnectivity() + throws Exception { + RemoteRepositoriesService service = getRemoteRepositoriesService(); + + WebClient.client(service).header("Authorization", authorizationHeader); + + int initialSize = service.getRemoteRepositories().size(); + + service.addRemoteRepository(getRemoteRepository()); + + assertTrue(service.checkRemoteConnectivity("id-new")); + + } + RemoteRepository getRemoteRepository() { return new RemoteRepository( "id-new", "new one", "http://foo.com", "default", "foo", "foopassword", 120, -- 2.39.5