use of com.sequenceiq.cloudbreak.api.endpoint.v4.util.responses.RepoConfigValidationV4Response in project cloudbreak by hortonworks.
the class RepositoryConfigValidationServiceTest method testValidateForStackBaseUrlWhenDebRepoIsReachable.
@Test
public void testValidateForStackBaseUrlWhenDebRepoIsReachable() {
String stackBaseUrl = "http://public-repo-1.hortonworks.com/HDP/ubuntu14/2.x/updates/2.5.5.0";
String rpmRepoDataTarget = stackBaseUrl + RPM_REPO_REPODATA_PATH;
String debRepoDataTarget = stackBaseUrl + "/dists/HDP/InRelease";
RepoConfigValidationV4Request request = new RepoConfigValidationV4Request();
request.setStackBaseURL(stackBaseUrl);
when(urlAccessValidationService.isAccessible(rpmRepoDataTarget)).thenReturn(false);
when(urlAccessValidationService.isAccessible(debRepoDataTarget)).thenReturn(true);
RepoConfigValidationV4Response result = underTest.validate(request);
ArgumentCaptor<String> argumentCaptor = ArgumentCaptor.forClass(String.class);
verify(urlAccessValidationService, times(2)).isAccessible(argumentCaptor.capture());
List<String> arguments = argumentCaptor.getAllValues();
assertTrue(arguments.contains(rpmRepoDataTarget));
assertTrue(arguments.contains(debRepoDataTarget));
assertTrue(result.getStackBaseURL());
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.util.responses.RepoConfigValidationV4Response in project cloudbreak by hortonworks.
the class RepositoryConfigValidationServiceTest method testValidateForStackBaseUrlWhenNoRepoIsAvailable.
@Test
public void testValidateForStackBaseUrlWhenNoRepoIsAvailable() {
String stackBaseUrl = "http://public-repo-1.hortonworks.com/HDP/ubuntu14/2.x/updates/2.5.5.0";
RepoConfigValidationV4Request request = new RepoConfigValidationV4Request();
request.setStackBaseURL(stackBaseUrl);
when(urlAccessValidationService.isAccessible(anyString())).thenReturn(false);
RepoConfigValidationV4Response result = underTest.validate(request);
ArgumentCaptor<String> argumentCaptor = ArgumentCaptor.forClass(String.class);
verify(urlAccessValidationService, times(2)).isAccessible(argumentCaptor.capture());
List<String> arguments = argumentCaptor.getAllValues();
String rpmRepoDataTarget = stackBaseUrl + RPM_REPO_REPODATA_PATH;
String debRepoDataTarget = stackBaseUrl + "/dists/HDP/InRelease";
assertTrue(arguments.contains(rpmRepoDataTarget));
assertTrue(arguments.contains(debRepoDataTarget));
assertFalse(result.getStackBaseURL());
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.util.responses.RepoConfigValidationV4Response in project cloudbreak by hortonworks.
the class RepositoryConfigValidationServiceTest method testValidateForAmbariGpgKeyUrlWhenTheUrlIsReachable.
@Test
public void testValidateForAmbariGpgKeyUrlWhenTheUrlIsReachable() {
String ambariGpgKeyUrl = "http://s3.amazonaws.com/dev.hortonworks.com/ambari/centos6/2.x/BUILDS/2.6.1.0-143/RPM-GPG-KEY/RPM-GPG-KEY-Jenkins";
RepoConfigValidationV4Request request = new RepoConfigValidationV4Request();
request.setAmbariGpgKeyUrl(ambariGpgKeyUrl);
when(urlAccessValidationService.isAccessible(ambariGpgKeyUrl)).thenReturn(true);
RepoConfigValidationV4Response result = underTest.validate(request);
verify(urlAccessValidationService, times(1)).isAccessible(ambariGpgKeyUrl);
assertTrue(result.getAmbariGpgKeyUrl());
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.util.responses.RepoConfigValidationV4Response in project cloudbreak by hortonworks.
the class RepositoryConfigValidationServiceTest method testValidateForStackBaseUrlWhenRPMRepoIsReachable.
@Test
public void testValidateForStackBaseUrlWhenRPMRepoIsReachable() {
String stackBaseUrl = "http://public-repo-1.hortonworks.com/HDP/centos6/2.x/updates/2.5.5.0";
RepoConfigValidationV4Request request = new RepoConfigValidationV4Request();
request.setStackBaseURL(stackBaseUrl);
String rpmRepoDataTarget = stackBaseUrl + RPM_REPO_REPODATA_PATH;
when(urlAccessValidationService.isAccessible(rpmRepoDataTarget)).thenReturn(true);
RepoConfigValidationV4Response result = underTest.validate(request);
verify(urlAccessValidationService, times(1)).isAccessible(rpmRepoDataTarget);
assertTrue(result.getStackBaseURL());
}
use of com.sequenceiq.cloudbreak.api.endpoint.v4.util.responses.RepoConfigValidationV4Response in project cloudbreak by hortonworks.
the class RepositoryConfigValidationServiceTest method testValidateForRequestsIsNull.
@Test
public void testValidateForRequestsIsNull() {
RepoConfigValidationV4Response result = underTest.validate(null);
assertNull(result.getAmbariBaseUrl());
assertNull(result.getAmbariGpgKeyUrl());
assertNull(result.getVersionDefinitionFileUrl());
assertNull(result.getMpackUrl());
assertNull(result.getStackBaseURL());
assertNull(result.getUtilsBaseURL());
}
Aggregations