use of com.khmelenko.lab.varis.network.response.Build in project Varis-Android by dkhmelenko.
the class TestBuildDetailsPresenter method testStartLoadingDataManyJobs.
@Test
public void testStartLoadingDataManyJobs() {
final long buildId = 1L;
final String slug = "test";
final Build build = new Build();
final Commit commit = new Commit();
final List<Job> jobs = new ArrayList<>();
final Job job1 = new Job();
jobs.add(job1);
final Job job2 = new Job();
jobs.add(job2);
BuildDetails buildDetails = new BuildDetails();
buildDetails.setBuild(build);
buildDetails.setCommit(commit);
buildDetails.setJobs(jobs);
when(mTravisRestClient.getApiService().getBuild(slug, buildId)).thenReturn(Single.just(buildDetails));
mBuildsDetailsPresenter.startLoadingData(null, slug, buildId);
verify(mBuildDetailsView).showProgress();
verify(mBuildDetailsView).hideProgress();
verify(mBuildDetailsView).updateBuildDetails(buildDetails);
verify(mBuildDetailsView).showBuildJobs(jobs);
}
use of com.khmelenko.lab.varis.network.response.Build in project Varis-Android by dkhmelenko.
the class TestRepoDetailsPresenter method testLoadBuildsHistory.
@Test
public void testLoadBuildsHistory() {
final String slug = "test";
final List<Build> builds = new ArrayList<>();
final List<Commit> commits = new ArrayList<>();
final BuildHistory buildHistory = new BuildHistory();
buildHistory.setBuilds(builds);
buildHistory.setCommits(commits);
when(mTravisRestClient.getApiService().getBuilds(slug)).thenReturn(Single.just(buildHistory));
mRepoDetailsPresenter.setRepoSlug(slug);
mRepoDetailsPresenter.loadBuildsHistory();
verify(mRepoDetailsView).updateBuildHistory(buildHistory);
}
use of com.khmelenko.lab.varis.network.response.Build in project Varis-Android by dkhmelenko.
the class TestRepoDetailsPresenter method testLoadData.
@Test
public void testLoadData() {
final String slug = "test";
final List<Build> builds = new ArrayList<>();
final List<Commit> commits = new ArrayList<>();
final List<RequestData> requestData = new ArrayList<>();
final Requests requests = new Requests();
requests.setCommits(commits);
requests.setRequests(requestData);
final BuildHistory buildHistory = new BuildHistory();
buildHistory.setBuilds(builds);
buildHistory.setCommits(commits);
final List<Branch> branch = new ArrayList<>();
final Branches branches = new Branches();
branches.setBranches(branch);
branches.setCommits(commits);
when(mTravisRestClient.getApiService().getBuilds(slug)).thenReturn(Single.just(buildHistory));
when(mTravisRestClient.getApiService().getBranches(slug)).thenReturn(Single.just(branches));
when(mTravisRestClient.getApiService().getRequests(slug)).thenReturn(Single.just(requests));
when(mTravisRestClient.getApiService().getPullRequestBuilds(slug)).thenReturn(Single.just(buildHistory));
mRepoDetailsPresenter.setRepoSlug(slug);
mRepoDetailsPresenter.loadData();
verify(mRepoDetailsPresenter).loadBuildsHistory();
verify(mRepoDetailsPresenter).loadBranches();
verify(mRepoDetailsPresenter).loadRequests();
}
use of com.khmelenko.lab.varis.network.response.Build in project Varis-Android by dkhmelenko.
the class BuildDetailsActivity method showBuildDetails.
/**
* Shows build details
*
* @param details Build details
*/
private void showBuildDetails(BuildDetails details) {
Build build = details.getBuild();
Commit commit = details.getCommit();
BuildView buildView = (BuildView) findViewById(R.id.build_details_build_data);
buildView.setState(build);
buildView.setCommit(commit);
}
use of com.khmelenko.lab.varis.network.response.Build in project Varis-Android by dkhmelenko.
the class BuildListAdapter method onBindViewHolder.
@Override
public void onBindViewHolder(BuildViewHolder holder, int position) {
if (mBuildHistory != null) {
Build build = mBuildHistory.getBuilds().get(position);
Commit relatedCommit = null;
for (Commit commit : mBuildHistory.getCommits()) {
if (build.getCommitId() == commit.getId()) {
relatedCommit = commit;
break;
}
}
holder.mBuildView.setState(build);
holder.mBuildView.setCommit(relatedCommit);
}
}
Aggregations