use of org.haiku.haikudepotserver.api1.model.repository.GetRepositorySourceMirrorResult in project haikudepotserver by haiku.
the class RepositoryApiImpl method getRepositorySourceMirror.
@Override
public GetRepositorySourceMirrorResult getRepositorySourceMirror(GetRepositorySourceMirrorRequest request) {
Preconditions.checkArgument(null != request, "the request must be provided");
Preconditions.checkArgument(StringUtils.isNotBlank(request.code), "a mirror code must be provided");
final ObjectContext context = serverRuntime.newContext();
RepositorySourceMirror repositorySourceMirror = RepositorySourceMirror.tryGetByCode(context, request.code).orElseThrow(() -> new ObjectNotFoundException(RepositorySourceMirror.class.getSimpleName(), request.code));
GetRepositorySourceMirrorResult result = new GetRepositorySourceMirrorResult();
result.active = repositorySourceMirror.getActive();
result.baseUrl = repositorySourceMirror.getBaseUrl();
result.code = repositorySourceMirror.getCode();
result.countryCode = repositorySourceMirror.getCountry().getCode();
result.createTimestamp = repositorySourceMirror.getCreateTimestamp().getTime();
result.modifyTimestamp = repositorySourceMirror.getModifyTimestamp().getTime();
result.description = repositorySourceMirror.getDescription();
result.isPrimary = repositorySourceMirror.getIsPrimary();
result.repositorySourceCode = repositorySourceMirror.getRepositorySource().getCode();
return result;
}
use of org.haiku.haikudepotserver.api1.model.repository.GetRepositorySourceMirrorResult in project haikudepotserver by haiku.
the class RepositoryApiIT method testGetRepositorySourceMirror.
@Test
public void testGetRepositorySourceMirror() {
integrationTestSupportService.createStandardTestData();
GetRepositorySourceMirrorRequest request = new GetRepositorySourceMirrorRequest();
request.code = "testreposrc_xyz_m_notpri";
// ------------------------------------
GetRepositorySourceMirrorResult result = repositoryApi.getRepositorySourceMirror(request);
// ------------------------------------
Assertions.assertThat(result.code).isEqualTo("testreposrc_xyz_m_notpri");
Assertions.assertThat(result.baseUrl).isEqualTo("file://not-found/on-disk");
Assertions.assertThat(result.countryCode).isEqualTo("ZA");
// ....
}
Aggregations