Search in sources :

Example 6 with SVcsModification

use of jetbrains.buildServer.vcs.SVcsModification in project teamcity-rest by JetBrains.

the class ChangeStatusTest method testNoNewFailedTests.

public void testNoNewFailedTests() {
    final BuildTypeImpl buildConf = registerBuildType("buildConf1", "project");
    VcsRootInstance root1 = prepareSingleVscRoot(buildConf);
    SVcsModification m20 = myFixture.addModification(modification().in(root1).version("20").parentVersions("10"));
    SVcsModification m30 = myFixture.addModification(modification().in(root1).version("30").parentVersions("20"));
    build().in(buildConf).onModifications(m20).withFailedTests("failedTestName").finish();
    // same test failed
    build().in(buildConf).onModifications(m30).withFailedTests("failedTestName").finish();
    ChangeStatus status = new ChangeStatus(myFixture.getChangeStatusProvider().getMergedChangeStatus(m30), Fields.ALL_NESTED, getBeanContext(myFixture));
    assertEquals(1, (int) status.getFinished());
    assertEquals(0, (int) status.getSuccessful());
    assertEquals(1, (int) status.getFailed());
    assertEquals(0, (int) status.getNewFailedTests());
    assertEquals(1, (int) status.getOtherFailedTests());
    assertEquals(0, (int) status.getNewTestsFailedBuilds().count);
}
Also used : SVcsModification(jetbrains.buildServer.vcs.SVcsModification) ChangeStatus(jetbrains.buildServer.server.rest.model.change.ChangeStatus) BuildTypeImpl(jetbrains.buildServer.serverSide.impl.BuildTypeImpl) VcsRootInstance(jetbrains.buildServer.vcs.VcsRootInstance)

Example 7 with SVcsModification

use of jetbrains.buildServer.vcs.SVcsModification in project teamcity-rest by JetBrains.

the class ChangeStatusTest method testSuccessfulRunning.

public void testSuccessfulRunning() {
    final BuildTypeImpl buildConf = registerBuildType("buildConf1", "project");
    VcsRootInstance root1 = prepareSingleVscRoot(buildConf);
    SVcsModification m20 = myFixture.addModification(modification().in(root1).version("20").parentVersions("10"));
    RunningBuildEx runningBuildEx = build().in(buildConf).onModifications(m20).run();
    ChangeStatus status = new ChangeStatus(myFixture.getChangeStatusProvider().getMergedChangeStatus(m20), Fields.ALL_NESTED, getBeanContext(myFixture));
    myFixture.finishBuild(runningBuildEx, false);
    assertEquals(0, (int) status.getFinished());
    assertEquals(1, (int) status.getRunning());
    assertEquals(0, (int) status.getSuccessful());
    assertEquals(1, (int) status.getRunningSuccessfuly());
}
Also used : SVcsModification(jetbrains.buildServer.vcs.SVcsModification) RunningBuildEx(jetbrains.buildServer.serverSide.RunningBuildEx) ChangeStatus(jetbrains.buildServer.server.rest.model.change.ChangeStatus) BuildTypeImpl(jetbrains.buildServer.serverSide.impl.BuildTypeImpl) VcsRootInstance(jetbrains.buildServer.vcs.VcsRootInstance)

Example 8 with SVcsModification

use of jetbrains.buildServer.vcs.SVcsModification in project teamcity-rest by JetBrains.

the class ChangeRequest method getChangeFirstBuilds.

/**
 * Experimental support only!
 */
@GET
@Path("/{changeLocator}/firstBuilds")
@Produces({ "application/xml", "application/json" })
@ApiOperation(value = "Get first builds of the matching change.", nickname = "getChangeFirstBuilds", hidden = true)
public Builds getChangeFirstBuilds(@ApiParam(format = LocatorName.CHANGE) @PathParam("changeLocator") String changeLocator, @QueryParam("fields") String fields) {
    final SVcsModification change = myChangeFinder.getItem(changeLocator).getSVcsModification();
    ChangeStatusProvider myStatusProvider = myServiceLocator.getSingletonService(ChangeStatusProvider.class);
    ChangeStatus changeStatus = myStatusProvider.getMergedChangeStatus(change);
    List<BuildPromotion> firstBuildsPromotions = changeStatus.getBuildTypesStatusMap().values().stream().filter(Objects::nonNull).collect(Collectors.toList());
    return Builds.createFromBuildPromotions(firstBuildsPromotions, null, new Fields(fields), myBeanContext);
}
Also used : SVcsModification(jetbrains.buildServer.vcs.SVcsModification) ChangeStatus(jetbrains.buildServer.vcs.ChangeStatus) BuildPromotion(jetbrains.buildServer.serverSide.BuildPromotion) Fields(jetbrains.buildServer.server.rest.model.Fields) ChangeStatusProvider(jetbrains.buildServer.vcs.ChangeStatusProvider) ApiOperation(io.swagger.annotations.ApiOperation)

Example 9 with SVcsModification

use of jetbrains.buildServer.vcs.SVcsModification in project teamcity-rest by JetBrains.

the class ChangeRequest method getDeploymentConfigurations.

/**
 * Experimental support only!
 */
@GET
@Path("/{changeLocator}/deploymentConfigurations")
@Produces({ "application/xml", "application/json" })
@ApiOperation(value = "Get build configurations where this change could potentially be deployed.", nickname = "getDeploymentConfigurations", hidden = true)
public BuildTypes getDeploymentConfigurations(@ApiParam(format = LocatorName.CHANGE) @PathParam("changeLocator") String changeLocator, @QueryParam("fields") String fields) {
    final SVcsModification change = myChangeFinder.getItem(changeLocator).getSVcsModification();
    ChangeStatusProvider myStatusProvider = myServiceLocator.getSingletonService(ChangeStatusProvider.class);
    ChangeStatus changeStatus = myStatusProvider.getMergedChangeStatus(change);
    return new BuildTypes(BuildTypes.fromBuildTypes(changeStatus.getDeploymentStatus().keySet()), null, new Fields(fields), myBeanContext);
}
Also used : SVcsModification(jetbrains.buildServer.vcs.SVcsModification) ChangeStatus(jetbrains.buildServer.vcs.ChangeStatus) Fields(jetbrains.buildServer.server.rest.model.Fields) BuildTypes(jetbrains.buildServer.server.rest.model.buildType.BuildTypes) ChangeStatusProvider(jetbrains.buildServer.vcs.ChangeStatusProvider) ApiOperation(io.swagger.annotations.ApiOperation)

Example 10 with SVcsModification

use of jetbrains.buildServer.vcs.SVcsModification in project teamcity-rest by JetBrains.

the class ChangeRequest method getRelatedBuildTypes.

/**
 * Experimental support only!
 */
@GET
@Path("/{changeLocator}/buildTypes")
@Produces({ "application/xml", "application/json" })
@ApiOperation(value = "Get build configurations related to the matching change.", nickname = "getRelatedBuildTypes", hidden = true)
public BuildTypes getRelatedBuildTypes(@ApiParam(format = LocatorName.CHANGE) @PathParam("changeLocator") String changeLocator, @QueryParam("fields") String fields) {
    final SVcsModification change = myChangeFinder.getItem(changeLocator).getSVcsModification();
    ChangeStatusProvider myStatusProvider = myServiceLocator.getSingletonService(ChangeStatusProvider.class);
    ChangeStatus changeStatus = myStatusProvider.getMergedChangeStatus(change);
    return new BuildTypes(BuildTypes.fromBuildTypes(changeStatus.getRelatedConfigurations()), null, new Fields(fields), myBeanContext);
}
Also used : SVcsModification(jetbrains.buildServer.vcs.SVcsModification) ChangeStatus(jetbrains.buildServer.vcs.ChangeStatus) Fields(jetbrains.buildServer.server.rest.model.Fields) BuildTypes(jetbrains.buildServer.server.rest.model.buildType.BuildTypes) ChangeStatusProvider(jetbrains.buildServer.vcs.ChangeStatusProvider) ApiOperation(io.swagger.annotations.ApiOperation)

Aggregations

SVcsModification (jetbrains.buildServer.vcs.SVcsModification)24 VcsRootInstance (jetbrains.buildServer.vcs.VcsRootInstance)14 ChangeStatus (jetbrains.buildServer.server.rest.model.change.ChangeStatus)12 BuildTypeImpl (jetbrains.buildServer.serverSide.impl.BuildTypeImpl)12 ApiOperation (io.swagger.annotations.ApiOperation)7 Fields (jetbrains.buildServer.server.rest.model.Fields)7 ChangeStatus (jetbrains.buildServer.vcs.ChangeStatus)7 ChangeStatusProvider (jetbrains.buildServer.vcs.ChangeStatusProvider)7 RunningBuildEx (jetbrains.buildServer.serverSide.RunningBuildEx)5 Test (org.testng.annotations.Test)5 BuildPromotion (jetbrains.buildServer.serverSide.BuildPromotion)4 ServiceLocator (jetbrains.buildServer.ServiceLocator)3 BaseFinderTest (jetbrains.buildServer.server.rest.data.BaseFinderTest)3 Locator (jetbrains.buildServer.server.rest.data.Locator)3 Objects (java.util.Objects)2 NotFoundException (jetbrains.buildServer.server.rest.errors.NotFoundException)2 BuildTypes (jetbrains.buildServer.server.rest.model.buildType.BuildTypes)2 SVcsRootImpl (jetbrains.buildServer.vcs.impl.SVcsRootImpl)2 IOException (java.io.IOException)1 ArrayList (java.util.ArrayList)1