use of jetbrains.buildServer.server.rest.util.BeanContext in project teamcity-rest by JetBrains.
the class TestOccurrenceRequestTest method testWontFetchItemsWhenNotNeededWithDefaultFieldsValue.
@Test
public void testWontFetchItemsWhenNotNeededWithDefaultFieldsValue() {
BeanContext ctx = BaseFinderTest.getBeanContext(myFixture);
myRequest.initForTests(ctx.getServiceLocator(), new TestOccurrenceFinderDenyingItemsFetch(), ctx.getApiUrlBuilder(), ctx);
final SFinishedBuild build = build().in(myBuildType).withTest(BuildBuilder.TestData.test("aaa").duration(76)).finish();
FakeHttpServletRequest mockRequest = new FakeHttpServletRequest();
mockRequest.setRequestURL("http://test/httpAuth/app/rest/testOccurrences?locator=build:" + build.getBuildId());
TestOccurrences testOccurrences = myRequest.getTestOccurrences("build:" + build.getBuildId(), "", null, mockRequest);
assertEquals(new Integer(1), testOccurrences.getCount());
}
use of jetbrains.buildServer.server.rest.util.BeanContext in project teamcity-rest by JetBrains.
the class ServerRequestTest method setUp.
@Override
@BeforeMethod
public void setUp() throws Exception {
super.setUp();
BeanContext ctx = BaseFinderTest.getBeanContext(myFixture);
PermissionChecker checker = new PermissionChecker(myServer.getSecurityContext(), myProjectManager);
myFixture.addService(checker);
myRequest = new ServerRequest();
myRequest.initForTests(ctx.getServiceLocator(), ctx.getApiUrlBuilder(), new BeanFactory(null), ctx, checker);
}
use of jetbrains.buildServer.server.rest.util.BeanContext in project teamcity-rest by JetBrains.
the class BuildTypeRequest method replaceArtifactDeps.
/**
* Replaces the dependencies to those sent in the request.
*/
@PUT
@Path("/{btLocator}/artifact-dependencies")
@Consumes({ "application/xml", "application/json" })
@Produces({ "application/xml", "application/json" })
@ApiOperation(value = "Update all artifact dependencies of the matching build configuration.", nickname = "replaceAllArtifactDependencies")
public PropEntitiesArtifactDep replaceArtifactDeps(@ApiParam(format = LocatorName.BUILD_TYPE) @PathParam("btLocator") String buildTypeLocator, @QueryParam("fields") String fields, PropEntitiesArtifactDep deps) {
final BuildTypeOrTemplate buildType = myBuildTypeFinder.getBuildTypeOrTemplate(null, buildTypeLocator, true);
deps.setToBuildType(buildType.getSettingsEx(), myServiceLocator);
buildType.persist("Artifact dependencies replaced");
return new PropEntitiesArtifactDep(buildType.getSettingsEx(), new Fields(fields), new BeanContext(myFactory, myServiceLocator, myApiUrlBuilder));
}
use of jetbrains.buildServer.server.rest.util.BeanContext 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.server.rest.util.BeanContext 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));
}
Aggregations