Search in sources :

Example 11 with Commit

use of com.khmelenko.lab.varis.network.response.Commit in project Varis-Android by dkhmelenko.

the class PullRequestsListAdapter method bindPullRequest.

private void bindPullRequest(BuildViewHolder holder, RequestData request) {
    Commit relatedCommit = null;
    for (Commit commit : mRequests.getCommits()) {
        if (request.getCommitId() == commit.getId()) {
            relatedCommit = commit;
            break;
        }
    }
    Build relatedBuild = null;
    for (Build build : mRequests.getBuilds()) {
        if (request.getBuildId() == build.getId()) {
            relatedBuild = build;
            break;
        }
    }
    holder.mBuildView.setPullRequestTitle(request);
    holder.mBuildView.setCommit(relatedCommit);
    holder.mBuildView.setState(relatedBuild);
    holder.mBuildView.setTitle(holder.mBuildView.getContext().getString(R.string.pull_request_number, request.getPullRequestNumber()));
}
Also used : Commit(com.khmelenko.lab.varis.network.response.Commit) Build(com.khmelenko.lab.varis.network.response.Build)

Example 12 with Commit

use of com.khmelenko.lab.varis.network.response.Commit in project Varis-Android by dkhmelenko.

the class TestRepoDetailsPresenter method testLoadBranches.

@Test
public void testLoadBranches() {
    final String slug = "test";
    final List<Branch> branch = new ArrayList<>();
    final List<Commit> commits = new ArrayList<>();
    final Branches branches = new Branches();
    branches.setBranches(branch);
    branches.setCommits(commits);
    when(mTravisRestClient.getApiService().getBranches(slug)).thenReturn(Single.just(branches));
    mRepoDetailsPresenter.setRepoSlug(slug);
    mRepoDetailsPresenter.loadBranches();
    verify(mRepoDetailsView).updateBranches(branches);
}
Also used : Commit(com.khmelenko.lab.varis.network.response.Commit) Branch(com.khmelenko.lab.varis.network.response.Branch) Branches(com.khmelenko.lab.varis.network.response.Branches) ArrayList(java.util.ArrayList) Test(org.junit.Test)

Example 13 with Commit

use of com.khmelenko.lab.varis.network.response.Commit in project Varis-Android by dkhmelenko.

the class TestRepoDetailsPresenter method testLoadRequests.

@Test
public void testLoadRequests() {
    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);
    when(mTravisRestClient.getApiService().getRequests(slug)).thenReturn(Single.just(requests));
    when(mTravisRestClient.getApiService().getPullRequestBuilds(slug)).thenReturn(Single.just(buildHistory));
    mRepoDetailsPresenter.setRepoSlug(slug);
    mRepoDetailsPresenter.loadRequests();
    verify(mRepoDetailsView).updatePullRequests(requests);
}
Also used : Commit(com.khmelenko.lab.varis.network.response.Commit) Build(com.khmelenko.lab.varis.network.response.Build) RequestData(com.khmelenko.lab.varis.network.response.RequestData) ArrayList(java.util.ArrayList) BuildHistory(com.khmelenko.lab.varis.network.response.BuildHistory) Requests(com.khmelenko.lab.varis.network.response.Requests) Test(org.junit.Test)

Example 14 with Commit

use of com.khmelenko.lab.varis.network.response.Commit 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 = findViewById(R.id.build_details_build_data);
    buildView.setState(build);
    buildView.setCommit(commit);
}
Also used : BuildView(com.khmelenko.lab.varis.widget.BuildView) Commit(com.khmelenko.lab.varis.network.response.Commit) Build(com.khmelenko.lab.varis.network.response.Build)

Aggregations

Commit (com.khmelenko.lab.varis.network.response.Commit)14 Build (com.khmelenko.lab.varis.network.response.Build)11 ArrayList (java.util.ArrayList)6 Test (org.junit.Test)6 Branch (com.khmelenko.lab.varis.network.response.Branch)4 BuildHistory (com.khmelenko.lab.varis.network.response.BuildHistory)3 Branches (com.khmelenko.lab.varis.network.response.Branches)2 BuildDetails (com.khmelenko.lab.varis.network.response.BuildDetails)2 Job (com.khmelenko.lab.varis.network.response.Job)2 RequestData (com.khmelenko.lab.varis.network.response.RequestData)2 Requests (com.khmelenko.lab.varis.network.response.Requests)2 BuildView (com.khmelenko.lab.varis.widget.BuildView)2