Search in sources :

Example 21 with Build

use of com.github.vase4kin.teamcityapp.buildlist.api.Build in project TeamCityApp by vase4kin.

the class RunBuildInteractorImpl method queueBuild.

/**
 * {@inheritDoc}
 */
@Override
public void queueBuild(String branchName, @Nullable Agent agent, boolean isPersonal, boolean queueToTheTop, boolean cleanAllFiles, Properties properties, final LoadingListenerWithForbiddenSupport<String> loadingListener) {
    Build build = new Build();
    build.setBranchName(branchName);
    build.setBuildTypeId(mBuildTypeId);
    build.setPersonal(isPersonal);
    build.setQueueAtTop(queueToTheTop);
    build.setCleanSources(cleanAllFiles);
    if (agent != null) {
        build.setAgent(agent);
    }
    if (!properties.getObjects().isEmpty()) {
        build.setProperties(properties);
    }
    queueBuild(build, loadingListener);
}
Also used : Build(com.github.vase4kin.teamcityapp.buildlist.api.Build)

Example 22 with Build

use of com.github.vase4kin.teamcityapp.buildlist.api.Build in project TeamCityApp by vase4kin.

the class RunBuildInteractorImpl method queueBuild.

/**
 * Queue build
 *
 * @param build           - Build to queue
 * @param loadingListener - listener to receive callbacks on UI
 */
private void queueBuild(Build build, final LoadingListenerWithForbiddenSupport<String> loadingListener) {
    Subscription queueBuildSubscription = mRepository.queueBuild(build).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(new Observer<Build>() {

        @Override
        public void onCompleted() {
        }

        @Override
        public void onError(Throwable e) {
            if (e instanceof HttpException) {
                HttpException exception = (HttpException) e;
                if (exception.code() == CODE_FORBIDDEN) {
                    loadingListener.onForbiddenError();
                } else {
                    loadingListener.onFail(e.getMessage());
                }
            } else {
                loadingListener.onFail(e.getMessage());
            }
        }

        @Override
        public void onNext(Build build) {
            loadingListener.onSuccess(build.getHref());
        }
    });
    mSubscription.add(queueBuildSubscription);
}
Also used : Build(com.github.vase4kin.teamcityapp.buildlist.api.Build) HttpException(retrofit2.adapter.rxjava.HttpException) CompositeSubscription(rx.subscriptions.CompositeSubscription) Subscription(rx.Subscription)

Example 23 with Build

use of com.github.vase4kin.teamcityapp.buildlist.api.Build in project TeamCityApp by vase4kin.

the class FakeTeamCityServiceImpl method listQueueBuilds.

@Override
public Observable<Builds> listQueueBuilds(@Query("fields") String fields) {
    List<Build> builds = new ArrayList<>();
    builds.add(Mocks.queuedBuild1());
    builds.add(Mocks.queuedBuild2());
    builds.add(Mocks.queuedBuild3());
    return Observable.just(new Builds(3, builds));
}
Also used : Builds(com.github.vase4kin.teamcityapp.buildlist.api.Builds) Build(com.github.vase4kin.teamcityapp.buildlist.api.Build) ArrayList(java.util.ArrayList)

Example 24 with Build

use of com.github.vase4kin.teamcityapp.buildlist.api.Build in project TeamCityApp by vase4kin.

the class FakeTeamCityServiceImpl method listRunningBuilds.

@Override
public Observable<Builds> listRunningBuilds(@Query("locator") String locator, @Query("fields") String fields) {
    List<Build> builds = new ArrayList<>();
    builds.add(Mocks.runningBuild());
    return Observable.just(new Builds(1, builds));
}
Also used : Builds(com.github.vase4kin.teamcityapp.buildlist.api.Builds) Build(com.github.vase4kin.teamcityapp.buildlist.api.Build) ArrayList(java.util.ArrayList)

Example 25 with Build

use of com.github.vase4kin.teamcityapp.buildlist.api.Build in project TeamCityApp by vase4kin.

the class Mocks method createNotFailedBuildMock.

/**
 * MOCK
 *
 * @return parametrized failed build
 */
public static Build createNotFailedBuildMock(String href, String number, String buildTypeId, String status, String state, String statusText, String waitReason, String branchName, String startDate, String startEstimate, String queuedDate, String finishDate) {
    Build build = createBuildMock(href, number, buildTypeId, status, state, statusText, waitReason, branchName, startDate, startEstimate, queuedDate, finishDate);
    build.setTestOccurrences(null);
    return build;
}
Also used : Build(com.github.vase4kin.teamcityapp.buildlist.api.Build)

Aggregations

Build (com.github.vase4kin.teamcityapp.buildlist.api.Build)27 Intent (android.content.Intent)14 Test (org.junit.Test)14 Builds (com.github.vase4kin.teamcityapp.buildlist.api.Builds)6 HttpException (retrofit2.adapter.rxjava.HttpException)6 Bundle (android.os.Bundle)5 ArrayList (java.util.ArrayList)5 Subscription (rx.Subscription)5 Properties (com.github.vase4kin.teamcityapp.properties.api.Properties)4 CompositeSubscription (rx.subscriptions.CompositeSubscription)3 Instrumentation (android.app.Instrumentation)2 Agent (com.github.vase4kin.teamcityapp.agents.api.Agent)2 BuildDetailsActivity (com.github.vase4kin.teamcityapp.build_details.view.BuildDetailsActivity)2 Triggered (com.github.vase4kin.teamcityapp.buildlist.api.Triggered)2 User (com.github.vase4kin.teamcityapp.buildlist.api.User)2 RunBuildActivity (com.github.vase4kin.teamcityapp.runbuild.view.RunBuildActivity)2 Agents (com.github.vase4kin.teamcityapp.agents.api.Agents)1 Artifacts (com.github.vase4kin.teamcityapp.artifact.api.Artifacts)1 BuildCancelRequest (com.github.vase4kin.teamcityapp.build_details.api.BuildCancelRequest)1 Changes (com.github.vase4kin.teamcityapp.changes.api.Changes)1