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);
}
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);
}
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));
}
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));
}
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;
}
Aggregations