Search in sources :

Example 6 with Commit

use of com.khmelenko.lab.varis.network.response.Commit 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);
}
Also used : Commit(com.khmelenko.lab.varis.network.response.Commit) Build(com.khmelenko.lab.varis.network.response.Build) ArrayList(java.util.ArrayList) BuildHistory(com.khmelenko.lab.varis.network.response.BuildHistory) Test(org.junit.Test)

Example 7 with Commit

use of com.khmelenko.lab.varis.network.response.Commit 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();
}
Also used : Branches(com.khmelenko.lab.varis.network.response.Branches) ArrayList(java.util.ArrayList) Requests(com.khmelenko.lab.varis.network.response.Requests) Commit(com.khmelenko.lab.varis.network.response.Commit) Build(com.khmelenko.lab.varis.network.response.Build) RequestData(com.khmelenko.lab.varis.network.response.RequestData) Branch(com.khmelenko.lab.varis.network.response.Branch) BuildHistory(com.khmelenko.lab.varis.network.response.BuildHistory) Test(org.junit.Test)

Example 8 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 = (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)

Example 9 with Commit

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

the class BranchesListAdapter method onBindViewHolder.

@Override
public void onBindViewHolder(BuildViewHolder holder, int position) {
    if (mBranches != null) {
        Branch branch = mBranches.getBranches().get(position);
        Commit relatedCommit = null;
        for (Commit commit : mBranches.getCommits()) {
            if (branch.getCommitId() == commit.getId()) {
                relatedCommit = commit;
                break;
            }
        }
        holder.mBuildView.setState(branch);
        holder.mBuildView.setCommit(relatedCommit);
    }
}
Also used : Commit(com.khmelenko.lab.varis.network.response.Commit) Branch(com.khmelenko.lab.varis.network.response.Branch)

Example 10 with Commit

use of com.khmelenko.lab.varis.network.response.Commit 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);
    }
}
Also used : 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