use of com.github.vase4kin.teamcityapp.navigation.api.BuildType in project TeamCityApp by vase4kin.
the class RunBuildInteractorImpl method loadAgents.
/**
* {@inheritDoc}
*/
@Override
public void loadAgents(final OnLoadingListener<List<Agent>> loadingListener) {
Subscription queueBuildSubscription = mRepository.buildType(mBuildTypeId, false).flatMap(new Func1<BuildType, Observable<Agents>>() {
@Override
public Observable<Agents> call(BuildType buildType) {
boolean isCompatibleAgentsSupported = buildType.getCompatibleAgents() != null;
if (isCompatibleAgentsSupported) {
// TODO: No hardcode
String locator = String.format("compatible:(buildType:(id:%s))", mBuildTypeId);
return mRepository.listAgents(null, null, locator, false);
} else {
return mRepository.listAgents(false, null, null, false);
}
}
}).subscribeOn(Schedulers.io()).observeOn(AndroidSchedulers.mainThread()).subscribe(new Observer<Agents>() {
@Override
public void onCompleted() {
}
@Override
public void onError(Throwable e) {
loadingListener.onFail(e.getMessage());
}
@Override
public void onNext(Agents agents) {
loadingListener.onSuccess(agents.getObjects());
}
});
mSubscription.add(queueBuildSubscription);
}
use of com.github.vase4kin.teamcityapp.navigation.api.BuildType in project TeamCityApp by vase4kin.
the class Mocks method navigationNode.
/**
* MOCK
*
* @return projects and build type
*/
public static NavigationNode navigationNode() {
Project project = new Project();
project.setName("Project");
project.setDescription("Description");
BuildType buildType = new BuildType();
buildType.setId("build_type_id");
buildType.setName("build type");
return new NavigationNode(new Projects(Collections.singletonList(project)), new BuildTypes(Collections.singletonList(buildType)));
}
use of com.github.vase4kin.teamcityapp.navigation.api.BuildType in project TeamCityApp by vase4kin.
the class RootProjectsActivityTest method testUserCanSeeProjectsData.
@Test
public void testUserCanSeeProjectsData() throws Exception {
// Prepare data
Project project = new Project();
project.setName("New project");
project.setDescription("Contains a lof of projects");
BuildType buildType = new BuildType();
buildType.setId("build_type_id");
buildType.setName("Build and run tests");
NavigationNode navigationNode = new NavigationNode(new Projects(Collections.singletonList(project)), new BuildTypes(Collections.singletonList(buildType)));
when(mTeamCityService.listBuildTypes(anyString())).thenCallRealMethod().thenReturn(Observable.just(navigationNode));
mActivityRule.launchActivity(null);
// Checking toolbar title
matchToolbarTitle("Projects");
// Checking projects data
onView(withId(R.id.navigation_recycler_view)).check(hasItemsCount(2));
onView(withRecyclerView(R.id.navigation_recycler_view).atPositionOnView(0, R.id.itemTitle)).check(matches(withText("Project")));
onView(withRecyclerView(R.id.navigation_recycler_view).atPositionOnView(0, R.id.itemSubTitle)).check(matches(withText("Description")));
onView(withRecyclerView(R.id.navigation_recycler_view).atPositionOnView(1, R.id.itemTitle)).check(matches(withText("build type")));
// Click on projects
onView(withText("Project")).perform(click());
// Check toolbar
matchToolbarTitle("Project");
// Check Project data
onView(withId(R.id.navigation_recycler_view)).check(hasItemsCount(2));
onView(withRecyclerView(R.id.navigation_recycler_view).atPositionOnView(0, R.id.itemTitle)).check(matches(withText("New project")));
onView(withRecyclerView(R.id.navigation_recycler_view).atPositionOnView(0, R.id.itemSubTitle)).check(matches(withText("Contains a lof of projects")));
onView(withRecyclerView(R.id.navigation_recycler_view).atPositionOnView(1, R.id.itemTitle)).check(matches(withText("Build and run tests")));
}
use of com.github.vase4kin.teamcityapp.navigation.api.BuildType in project TeamCityApp by vase4kin.
the class Build method setBuildTypeId.
public void setBuildTypeId(String buildTypeId) {
this.buildType = new BuildType();
this.buildType.setId(buildTypeId);
}
Aggregations