use of jetbrains.buildServer.serverSide.dependency.Dependency in project teamcity-rest by JetBrains.
the class BuildTypeRequest method deleteSnapshotDep.
@DELETE
@Path("/{btLocator}/snapshot-dependencies/{snapshotDepLocator}")
@ApiOperation(value = "Delete a snapshot dependency of the matching build configuration.", nickname = "deleteSnapshotDependency")
public void deleteSnapshotDep(@ApiParam(format = LocatorName.BUILD_TYPE) @PathParam("btLocator") String buildTypeLocator, @PathParam("snapshotDepLocator") String snapshotDepLocator) {
final BuildTypeOrTemplate buildType = myBuildTypeFinder.getBuildTypeOrTemplate(null, buildTypeLocator, true);
final Dependency dependency = PropEntitySnapshotDep.getSnapshotDep(buildType.get(), snapshotDepLocator, myBuildTypeFinder);
PropEntitySnapshotDep.removeFrom(buildType.get(), dependency);
buildType.persist("Snapshot dependency removed");
}
use of jetbrains.buildServer.serverSide.dependency.Dependency in project teamcity-rest by JetBrains.
the class BuildTypeRequest method getSnapshotDep.
@GET
@Path("/{btLocator}/snapshot-dependencies/{snapshotDepLocator}")
@Produces({ "application/xml", "application/json" })
@ApiOperation(value = "Get a snapshot dependency of the matching build configuration.", nickname = "getSnapshotDependency")
public PropEntitySnapshotDep getSnapshotDep(@ApiParam(format = LocatorName.BUILD_TYPE) @PathParam("btLocator") String buildTypeLocator, @PathParam("snapshotDepLocator") String snapshotDepLocator, @QueryParam("fields") String fields) {
final BuildTypeOrTemplate buildType = myBuildTypeFinder.getBuildTypeOrTemplate(null, buildTypeLocator, true);
final Dependency dependency = PropEntitySnapshotDep.getSnapshotDep(buildType.get(), snapshotDepLocator, myBuildTypeFinder);
return new PropEntitySnapshotDep(dependency, buildType.getSettingsEx(), new Fields(fields), new BeanContext(myFactory, myServiceLocator, myApiUrlBuilder));
}
use of jetbrains.buildServer.serverSide.dependency.Dependency in project teamcity-rest by JetBrains.
the class BuildPromotionFinderTest method testSnapshotDependenciesProblems.
@Test
public void testSnapshotDependenciesProblems() {
final SProject project = createProject("prj", "project");
final BuildTypeEx buildConfA = (BuildTypeEx) project.createBuildType("buildConfA", "buildConfA");
final BuildTypeEx buildConfB1 = (BuildTypeEx) project.createBuildType("buildConfB1", "buildConfB1");
final BuildTypeEx buildConfB2 = (BuildTypeEx) project.createBuildType("buildConfB2", "buildConfB2");
final BuildTypeEx buildConfC = (BuildTypeEx) project.createBuildType("buildConfC", "buildConfC");
addDependency(buildConfB1, buildConfA).setOption(DependencyOptions.RUN_BUILD_IF_DEPENDENCY_FAILED, DependencyOptions.BuildContinuationMode.RUN_ADD_PROBLEM);
addDependency(buildConfB2, buildConfA).setOption(DependencyOptions.RUN_BUILD_IF_DEPENDENCY_FAILED, DependencyOptions.BuildContinuationMode.RUN_ADD_PROBLEM);
addDependency(buildConfC, buildConfB1).setOption(DependencyOptions.RUN_BUILD_IF_DEPENDENCY_FAILED, DependencyOptions.BuildContinuationMode.RUN_ADD_PROBLEM);
addDependency(buildConfC, buildConfB2).setOption(DependencyOptions.RUN_BUILD_IF_DEPENDENCY_FAILED, DependencyOptions.BuildContinuationMode.RUN_ADD_PROBLEM);
{
BuildPromotion buildA = build().in(buildConfA).withProblem(BuildProblemData.createBuildProblem("problem1", "problemType", "problem descr")).finish().getBuildPromotion();
BuildPromotion buildB1 = build().in(buildConfB1).withProblem(BuildProblemData.createBuildProblem("problem21", "problemType", "problem descr2")).snapshotDepends(buildA).finish().getBuildPromotion();
BuildPromotion buildB2 = build().in(buildConfB2).withProblem(BuildProblemData.createBuildProblem("problem22", "problemType", "problem descr2")).snapshotDepends(buildA).finish().getBuildPromotion();
BuildPromotion buildC = build().in(buildConfC).withProblem(BuildProblemData.createBuildProblem("problem3", "problemType", "problem descr3")).snapshotDepends(buildB1, buildB2).finish().getBuildPromotion();
check(null, buildC, buildB2, buildB1, buildA);
check("snapshotDependencyProblem:(to:(id:" + buildC.getId() + "))", buildB2, buildB1, buildA);
check("snapshotDependencyProblem:(from:(id:" + buildB1.getId() + "))", buildC);
check("snapshotDependencyProblem:(from:(id:" + buildA.getId() + "))", buildC, buildB2, buildB1);
checkProblemOccurrences("build:(snapshotDependencyProblem:(to:(id:" + buildC.getId() + "))),type:(snapshotDependencyProblem:false)", "problem22", "problem21", "problem1");
buildC.getAssociatedBuild().muteBuildProblems(createUser("u"), true, "");
check("snapshotDependencyProblem:(to:(id:" + buildC.getId() + "))");
checkProblemOccurrences("build:(snapshotDependencyProblem:(to:(id:" + buildC.getId() + "))),type:(snapshotDependencyProblem:false)");
}
{
BuildPromotion buildA = build().in(buildConfA).withProblem(BuildProblemData.createBuildProblem("problem1", "problemType", "problem descr")).finish().getBuildPromotion();
BuildPromotion buildB1 = build().in(buildConfB1).withProblem(BuildProblemData.createBuildProblem("problem21", "problemType", "problem descr2")).snapshotDepends(buildA).finish().getBuildPromotion();
BuildPromotion buildB2 = build().in(buildConfB2).snapshotDepends(buildA).finish().getBuildPromotion();
BuildPromotion buildC = build().in(buildConfC).snapshotDepends(buildB1, buildB2).finish().getBuildPromotion();
check("snapshotDependencyProblem:(to:(id:" + buildC.getId() + "))", buildB2, buildB1, buildA);
check("snapshotDependencyProblem:(to:(id:" + buildC.getId() + "),includeInitial:true)", buildC, buildB2, buildB1, buildA);
check("id:" + buildB2.getId() + ",snapshotDependencyProblem:(to:(id:" + buildC.getId() + "),includeInitial:true)", buildB2);
checkProblemOccurrences("build:(snapshotDependencyProblem:(to:(id:" + buildC.getId() + "))),type:(snapshotDependencyProblem:false)", "problem21", "problem1");
}
{
BuildPromotion buildA = build().in(buildConfA).withProblem(BuildProblemData.createBuildProblem("problem1", "problemType", "problem descr")).finish().getBuildPromotion();
BuildPromotion buildB1 = build().in(buildConfB1).snapshotDepends(buildA).finish().getBuildPromotion();
BuildPromotion buildB2 = build().in(buildConfB2).snapshotDepends(buildA).finish().getBuildPromotion();
BuildPromotion buildC = build().in(buildConfC).snapshotDepends(buildB1, buildB2).finish().getBuildPromotion();
check("snapshotDependencyProblem:(to:(id:" + buildC.getId() + "))", buildB2, buildB1, buildA);
checkProblemOccurrences("build:(snapshotDependencyProblem:(to:(id:" + buildC.getId() + "))),type:(snapshotDependencyProblem:false)", "problem1");
}
Dependency depCB2 = buildConfC.getDependencies().stream().filter(d -> buildConfB2.equals(d.getDependOn())).findAny().get();
depCB2.setOption(DependencyOptions.RUN_BUILD_IF_DEPENDENCY_FAILED, DependencyOptions.BuildContinuationMode.RUN);
{
BuildPromotion buildA = build().in(buildConfA).withProblem(BuildProblemData.createBuildProblem("problem1", "problemType", "problem descr")).finish().getBuildPromotion();
BuildPromotion buildB1 = build().in(buildConfB1).snapshotDepends(buildA).finish().getBuildPromotion();
BuildPromotion buildB2 = build().in(buildConfB2).snapshotDepends(buildA).finish().getBuildPromotion();
BuildPromotion buildC = build().in(buildConfC).snapshotDepends(buildB1, buildB2).finish().getBuildPromotion();
check("snapshotDependencyProblem:(to:(id:" + buildC.getId() + "))", buildB1, buildA);
checkProblemOccurrences("build:(snapshotDependencyProblem:(to:(id:" + buildC.getId() + "))),type:(snapshotDependencyProblem:false)", "problem1");
}
depCB2.setOption(DependencyOptions.RUN_BUILD_IF_DEPENDENCY_FAILED, DependencyOptions.BuildContinuationMode.MAKE_FAILED_TO_START);
{
BuildPromotion buildA = build().in(buildConfA).withProblem(BuildProblemData.createBuildProblem("problem1", "problemType", "problem descr")).finish().getBuildPromotion();
BuildPromotion buildB1 = build().in(buildConfB1).snapshotDepends(buildA).finish().getBuildPromotion();
BuildPromotion buildB2 = build().in(buildConfB2).snapshotDepends(buildA).finish().getBuildPromotion();
BuildPromotion buildC = build().in(buildConfC).snapshotDepends(buildB1, buildB2).finish().getBuildPromotion();
check("snapshotDependencyProblem:(to:(id:" + buildC.getId() + "))", buildB2, buildB1, buildA);
checkProblemOccurrences("build:(snapshotDependencyProblem:(to:(id:" + buildC.getId() + "))),type:(snapshotDependencyProblem:false)", "problem1");
}
}
Aggregations