Search in sources :

Example 16 with SArtifactDependency

use of jetbrains.buildServer.serverSide.artifacts.SArtifactDependency in project teamcity-rest by JetBrains.

the class BuildTypeRequest method getArtifactDepSetting.

// todo: list and allow changing parameters of the dependency
// like for features, steps (otherwise there is no way to update dependency in a template not resetting enabled/disabled in usages)
// Note: on adding editing should test editing of a dependnecy when inherited form a tempalte
@GET
@Path("/{btLocator}/artifact-dependencies/{artifactDepLocator}/{fieldName}")
@Produces({ "text/plain" })
@ApiOperation(value = "Get a parameter of an artifact dependency of the matching build configuration.", nickname = "getArtifactDependencyParameter")
public String getArtifactDepSetting(@ApiParam(format = LocatorName.BUILD_TYPE) @PathParam("btLocator") String buildTypeLocator, @PathParam("artifactDepLocator") String artifactDepLocator, @PathParam("fieldName") String name) {
    final BuildTypeOrTemplate buildType = myBuildTypeFinder.getBuildTypeOrTemplate(null, buildTypeLocator, true);
    final SArtifactDependency dep = getArtifactDependency(buildType, artifactDepLocator);
    return PropEntityArtifactDep.getSetting(buildType.get(), dep.getId(), name);
}
Also used : BuildTypeOrTemplate(jetbrains.buildServer.server.rest.util.BuildTypeOrTemplate) SArtifactDependency(jetbrains.buildServer.serverSide.artifacts.SArtifactDependency) ApiOperation(io.swagger.annotations.ApiOperation)

Example 17 with SArtifactDependency

use of jetbrains.buildServer.serverSide.artifacts.SArtifactDependency in project teamcity-rest by JetBrains.

the class BuildTypeRequest method changeArtifactDepSetting.

@PUT
@Path("/{btLocator}/artifact-dependencies/{artifactDepLocator}/{fieldName}")
@Consumes({ "text/plain" })
@Produces({ "text/plain" })
@ApiOperation(value = "Update a parameter of an artifact dependency of the matching build configuration.", nickname = "setArtifactDependencyParameter")
public String changeArtifactDepSetting(@ApiParam(format = LocatorName.BUILD_TYPE) @PathParam("btLocator") String buildTypeLocator, @PathParam("artifactDepLocator") String artifactDepLocator, @PathParam("fieldName") String name, String newValue) {
    final BuildTypeOrTemplate buildType = myBuildTypeFinder.getBuildTypeOrTemplate(null, buildTypeLocator, true);
    final SArtifactDependency dep = getArtifactDependency(buildType, artifactDepLocator);
    PropEntityArtifactDep.setSetting(buildType.get(), dep.getId(), name, newValue);
    buildType.persist("Artifact dependency settings changed");
    return PropEntityArtifactDep.getSetting(buildType.get(), dep.getId(), name);
}
Also used : BuildTypeOrTemplate(jetbrains.buildServer.server.rest.util.BuildTypeOrTemplate) SArtifactDependency(jetbrains.buildServer.serverSide.artifacts.SArtifactDependency) ApiOperation(io.swagger.annotations.ApiOperation)

Example 18 with SArtifactDependency

use of jetbrains.buildServer.serverSide.artifacts.SArtifactDependency in project teamcity-rest by JetBrains.

the class BuildTypeRequest method getArtifactDep.

@GET
@Path("/{btLocator}/artifact-dependencies/{artifactDepLocator}")
@Produces({ "application/xml", "application/json" })
@ApiOperation(value = "Get an artifact dependency of the matching build configuration.", nickname = "getArtifactDependency")
public PropEntityArtifactDep getArtifactDep(@ApiParam(format = LocatorName.BUILD_TYPE) @PathParam("btLocator") String buildTypeLocator, @PathParam("artifactDepLocator") String artifactDepLocator, @QueryParam("fields") String fields) {
    final BuildTypeOrTemplate buildType = myBuildTypeFinder.getBuildTypeOrTemplate(null, buildTypeLocator, true);
    final SArtifactDependency artifactDependency = getArtifactDependency(buildType, artifactDepLocator);
    return new PropEntityArtifactDep(artifactDependency, buildType.getSettingsEx(), new Fields(fields), new BeanContext(myFactory, myServiceLocator, myApiUrlBuilder));
}
Also used : BuildTypeOrTemplate(jetbrains.buildServer.server.rest.util.BuildTypeOrTemplate) BeanContext(jetbrains.buildServer.server.rest.util.BeanContext) SArtifactDependency(jetbrains.buildServer.serverSide.artifacts.SArtifactDependency) ApiOperation(io.swagger.annotations.ApiOperation)

Example 19 with SArtifactDependency

use of jetbrains.buildServer.serverSide.artifacts.SArtifactDependency in project teamcity-rest by JetBrains.

the class BaseFinderTest method addArtifactDependency.

protected SArtifactDependency addArtifactDependency(final SBuildType dependent, final SBuildType dependOn) {
    SArtifactDependency dep = myFixture.getSingletonService(ArtifactDependencyFactory.class).createArtifactDependency(dependOn, ARTIFACT_DEP_FILE_NAME, RevisionRules.LAST_FINISHED_RULE);
    dependent.addArtifactDependency(dep);
    return dep;
}
Also used : ArtifactDependencyFactory(jetbrains.buildServer.serverSide.ArtifactDependencyFactory) SArtifactDependency(jetbrains.buildServer.serverSide.artifacts.SArtifactDependency)

Aggregations

SArtifactDependency (jetbrains.buildServer.serverSide.artifacts.SArtifactDependency)19 BuildTypeOrTemplate (jetbrains.buildServer.server.rest.util.BuildTypeOrTemplate)8 BadRequestException (jetbrains.buildServer.server.rest.errors.BadRequestException)7 BaseFinderTest (jetbrains.buildServer.server.rest.data.BaseFinderTest)6 Test (org.testng.annotations.Test)6 ApiOperation (io.swagger.annotations.ApiOperation)5 NotNull (org.jetbrains.annotations.NotNull)5 NotFoundException (jetbrains.buildServer.server.rest.errors.NotFoundException)4 Build (jetbrains.buildServer.server.rest.model.build.Build)3 BeanContext (jetbrains.buildServer.server.rest.util.BeanContext)3 SUser (jetbrains.buildServer.users.SUser)3 ArrayList (java.util.ArrayList)2 BuildTriggerDescriptor (jetbrains.buildServer.buildTriggers.BuildTriggerDescriptor)2 Builds (jetbrains.buildServer.server.rest.model.build.Builds)2 AccessDeniedException (jetbrains.buildServer.serverSide.auth.AccessDeniedException)2 BuildTypeImpl (jetbrains.buildServer.serverSide.impl.BuildTypeImpl)2 MockVcsSupport (jetbrains.buildServer.serverSide.impl.MockVcsSupport)2 ProjectEx (jetbrains.buildServer.serverSide.impl.ProjectEx)2 CheckoutRules (jetbrains.buildServer.vcs.CheckoutRules)2 SVcsRoot (jetbrains.buildServer.vcs.SVcsRoot)2