@Test public void should_find_state_build() throws Exception { TeamCityBuild build = new TeamCityBuild(); build.setStatus("SUCCESS"); when(teamCity.findBuild(anyString(), anyString())).thenReturn(build); SoftwareProjectId projectId = new SoftwareProjectId("projectId"); BuildState state = teamCityConnection.getBuildState(projectId, "1234"); assertEquals(BuildState.SUCCESS, state); }
@Override public BuildState getBuildState(SoftwareProjectId softwareProjectId, String buildId) throws ProjectNotFoundException, BuildNotFoundException { checkConnected(); checkSoftwareProjectId(softwareProjectId); checkBuildId(buildId); try { String projectId = softwareProjectId.getProjectId(); TeamCityBuild build = teamCity.findBuild(projectId, buildId); String status = build.getStatus(); return States.asVisuwallState(status); } catch (TeamCityBuildTypeNotFoundException e) { throw new ProjectNotFoundException("Cannot find build type for software project id:" + softwareProjectId, e); } catch (TeamCityBuildNotFoundException e) { try { TeamCityBuild runningBuild = teamCity.findRunningBuild(); if (buildId.equals(runningBuild.getId())) { return BuildState.UNKNOWN; } } catch (TeamCityBuildNotFoundException e1) { } throw new BuildNotFoundException("Cannot find build #" + buildId + " for software project id:" + softwareProjectId, e); } }
TeamCityConnection implements BuildCapability, TestCapability, ViewCapability { @Override public BuildState getBuildState(SoftwareProjectId softwareProjectId, String buildId) throws ProjectNotFoundException, BuildNotFoundException { checkConnected(); checkSoftwareProjectId(softwareProjectId); checkBuildId(buildId); try { String projectId = softwareProjectId.getProjectId(); TeamCityBuild build = teamCity.findBuild(projectId, buildId); String status = build.getStatus(); return States.asVisuwallState(status); } catch (TeamCityBuildTypeNotFoundException e) { throw new ProjectNotFoundException("Cannot find build type for software project id:" + softwareProjectId, e); } catch (TeamCityBuildNotFoundException e) { try { TeamCityBuild runningBuild = teamCity.findRunningBuild(); if (buildId.equals(runningBuild.getId())) { return BuildState.UNKNOWN; } } catch (TeamCityBuildNotFoundException e1) { } throw new BuildNotFoundException("Cannot find build #" + buildId + " for software project id:" + softwareProjectId, e); } } }
TeamCityConnection implements BuildCapability, TestCapability, ViewCapability { @Override public BuildState getBuildState(SoftwareProjectId softwareProjectId, String buildId) throws ProjectNotFoundException, BuildNotFoundException { checkConnected(); checkSoftwareProjectId(softwareProjectId); checkBuildId(buildId); try { String projectId = softwareProjectId.getProjectId(); TeamCityBuild build = teamCity.findBuild(projectId, buildId); String status = build.getStatus(); return States.asVisuwallState(status); } catch (TeamCityBuildTypeNotFoundException e) { throw new ProjectNotFoundException("Cannot find build type for software project id:" + softwareProjectId, e); } catch (TeamCityBuildNotFoundException e) { try { TeamCityBuild runningBuild = teamCity.findRunningBuild(); if (buildId.equals(runningBuild.getId())) { return BuildState.UNKNOWN; } } catch (TeamCityBuildNotFoundException e1) { } throw new BuildNotFoundException("Cannot find build #" + buildId + " for software project id:" + softwareProjectId, e); } }  }
TeamCityConnection implements BuildCapability, TestCapability, ViewCapability { @Override public BuildState getBuildState(SoftwareProjectId softwareProjectId, String buildId) throws ProjectNotFoundException, BuildNotFoundException { checkConnected(); checkSoftwareProjectId(softwareProjectId); checkBuildId(buildId); try { String projectId = softwareProjectId.getProjectId(); TeamCityBuild build = teamCity.findBuild(projectId, buildId); String status = build.getStatus(); return States.asVisuwallState(status); } catch (TeamCityBuildTypeNotFoundException e) { throw new ProjectNotFoundException("Cannot find build type for software project id:" + softwareProjectId, e); } catch (TeamCityBuildNotFoundException e) { try { TeamCityBuild runningBuild = teamCity.findRunningBuild(); if (buildId.equals(runningBuild.getId())) { return BuildState.UNKNOWN; } } catch (TeamCityBuildNotFoundException e1) { } throw new BuildNotFoundException("Cannot find build #" + buildId + " for software project id:" + softwareProjectId, e); } }  @Override void connect(String url, String login, String password); @Override void close(); @Override String getDescription(SoftwareProjectId softwareProjectId); @Override SoftwareProjectId identify(ProjectKey projectKey); @Override List<String> getBuildIds(SoftwareProjectId softwareProjectId); @Override Map<SoftwareProjectId, String> listSoftwareProjectIds(); @Override BuildState getBuildState(SoftwareProjectId softwareProjectId, String buildId); @Override Date getEstimatedFinishTime(SoftwareProjectId softwareProjectId, String buildId); @Override boolean isBuilding(SoftwareProjectId softwareProjectId, String buildId); @Override String getLastBuildId(SoftwareProjectId softwareProjectId); @Override String getMavenId(SoftwareProjectId softwareProjectId); @Override String getName(SoftwareProjectId softwareProjectId); @Override boolean isClosed(); @Override BuildTime getBuildTime(SoftwareProjectId softwareProjectId, String buildId); @Override boolean isProjectDisabled(SoftwareProjectId softwareProjectId); @Override List<Commiter> getBuildCommiters(SoftwareProjectId softwareProjectId, String buildId); @Override TestResult analyzeUnitTests(SoftwareProjectId softwareProjectId); @Override TestResult analyzeIntegrationTests(SoftwareProjectId softwareProjectId); @Override List<SoftwareProjectId> findSoftwareProjectIdsByViews(List<String> views); @Override List<String> findViews(); @Override List<String> findProjectNamesByView(String viewName); }
TeamCityConnection implements BuildCapability, TestCapability, ViewCapability { @Override public BuildState getBuildState(SoftwareProjectId softwareProjectId, String buildId) throws ProjectNotFoundException, BuildNotFoundException { checkConnected(); checkSoftwareProjectId(softwareProjectId); checkBuildId(buildId); try { String projectId = softwareProjectId.getProjectId(); TeamCityBuild build = teamCity.findBuild(projectId, buildId); String status = build.getStatus(); return States.asVisuwallState(status); } catch (TeamCityBuildTypeNotFoundException e) { throw new ProjectNotFoundException("Cannot find build type for software project id:" + softwareProjectId, e); } catch (TeamCityBuildNotFoundException e) { try { TeamCityBuild runningBuild = teamCity.findRunningBuild(); if (buildId.equals(runningBuild.getId())) { return BuildState.UNKNOWN; } } catch (TeamCityBuildNotFoundException e1) { } throw new BuildNotFoundException("Cannot find build #" + buildId + " for software project id:" + softwareProjectId, e); } }  @Override void connect(String url, String login, String password); @Override void close(); @Override String getDescription(SoftwareProjectId softwareProjectId); @Override SoftwareProjectId identify(ProjectKey projectKey); @Override List<String> getBuildIds(SoftwareProjectId softwareProjectId); @Override Map<SoftwareProjectId, String> listSoftwareProjectIds(); @Override BuildState getBuildState(SoftwareProjectId softwareProjectId, String buildId); @Override Date getEstimatedFinishTime(SoftwareProjectId softwareProjectId, String buildId); @Override boolean isBuilding(SoftwareProjectId softwareProjectId, String buildId); @Override String getLastBuildId(SoftwareProjectId softwareProjectId); @Override String getMavenId(SoftwareProjectId softwareProjectId); @Override String getName(SoftwareProjectId softwareProjectId); @Override boolean isClosed(); @Override BuildTime getBuildTime(SoftwareProjectId softwareProjectId, String buildId); @Override boolean isProjectDisabled(SoftwareProjectId softwareProjectId); @Override List<Commiter> getBuildCommiters(SoftwareProjectId softwareProjectId, String buildId); @Override TestResult analyzeUnitTests(SoftwareProjectId softwareProjectId); @Override TestResult analyzeIntegrationTests(SoftwareProjectId softwareProjectId); @Override List<SoftwareProjectId> findSoftwareProjectIdsByViews(List<String> views); @Override List<String> findViews(); @Override List<String> findProjectNamesByView(String viewName);  }