use of jetbrains.buildServer.serverSide.impl.BuildTypeImpl in project teamcity-rest by JetBrains.
the class ProblemOccurrenceFinderTest method testCurrentlyFailing.
@Test
public void testCurrentlyFailing() {
final BuildTypeImpl buildType1 = registerBuildType("buildConf1", "project");
final BuildTypeImpl buildType2 = registerBuildType("buildConf2", "project");
final BuildPromotionEx build10 = (BuildPromotionEx) build().in(buildType1).withProblem(BuildProblemData.createBuildProblem("id1", "type1", "descr")).withProblem(BuildProblemData.createBuildProblem("id1", "type2", "descr")).finish().getBuildPromotion();
final BuildPromotionEx build20 = (BuildPromotionEx) build().in(buildType1).withProblem(BuildProblemData.createBuildProblem("id1", "type1", "descr")).finish().getBuildPromotion();
final BuildPromotionEx build30 = (BuildPromotionEx) build().in(buildType2).withProblem(BuildProblemData.createBuildProblem("id1", "type2", "descr")).finish().getBuildPromotion();
checkProblem("problem:(id:1)", pd(1, "id1", "type1", build20.getId()), pd(1, "id1", "type1", build10.getId()));
checkProblem("problem:(id:2)", pd(2, "id1", "type2", build30.getId()), pd(2, "id1", "type2", build10.getId()));
checkProblem("build:(id:" + build10.getId() + ")", pd(1, "id1", "type1", build10.getId()), pd(2, "id1", "type2", build10.getId()));
checkProblem("build:(id:" + build20.getId() + ")", pd(1, "id1", "type1", build20.getId()));
checkProblem("currentlyFailing:true", pd(1, "id1", "type1", build20.getId()), pd(2, "id1", "type2", build30.getId()));
checkProblem("currentlyFailing:true,build:(id:" + build10.getId() + ")", pd(1, "id1", "type1", build10.getId()));
checkProblem("currentlyFailing:false,build:(id:" + build10.getId() + ")", pd(2, "id1", "type2", build10.getId()));
checkProblem("currentlyFailing:true,build:(id:" + build20.getId() + ")", pd(1, "id1", "type1", build20.getId()));
checkProblem("currentlyFailing:false,build:(id:" + build20.getId() + ")");
checkProblem("currentlyFailing:true,problem:(id:1)", pd(1, "id1", "type1", build20.getId()));
checkProblem("currentlyFailing:false,problem:(id:1)");
checkProblem("currentlyFailing:true,problem:(id:2)", pd(2, "id1", "type2", build30.getId()));
checkProblem("currentlyFailing:false,problem:(id:2)", pd(2, "id1", "type2", build10.getId()));
checkExceptionOnItemsSearch(BadRequestException.class, "currentlyFailing:false");
}
use of jetbrains.buildServer.serverSide.impl.BuildTypeImpl in project teamcity-rest by JetBrains.
the class BuildTypeResolverTest method basicAncestorProjects.
public void basicAncestorProjects() throws Exception {
ProjectEx p0 = myFixture.createProject("p0");
ProjectEx p1 = myFixture.createProject("p1", p0);
ProjectEx p2 = myFixture.createProject("p2", p1);
ProjectEx p3 = myFixture.createProject("p3", p2);
BuildTypeImpl realBuildType = myFixture.createBuildType(p3, "testBT", "test");
ProjectsConnection ancestors = myResolver.ancestorProjects(new jetbrains.buildServer.server.graphql.model.buildType.BuildType(realBuildType), myDataFetchingEnvironment);
// _Root, p0 .. p3
assertEquals(5, ancestors.getCount());
// Ancestors must be from closest to _Root
assertExtensibleEdges(ancestors.getEdges().getData(), new Project(p3), new Project(p2), new Project(p1), new Project(p0), new Project(myFixture.getProjectManager().getRootProject()));
}
use of jetbrains.buildServer.serverSide.impl.BuildTypeImpl in project teamcity-rest by JetBrains.
the class TestOccurrenceRequestTest method testInvocationsAreFoundCorrectly.
@Test
@TestFor(issues = { "TW-70206" })
public void testInvocationsAreFoundCorrectly() {
if (true)
throw new SkipException("Ignored as current implementation does work only in a very specific number of cases when specific build is available when preparing TestOccurrences");
final BuildTypeImpl buildType = registerBuildType("buildConf1", "project");
final SFinishedBuild build = build().in(buildType).withTest("aaa", false).withTest("aaa", true).withTest("aaa", true).finish();
String fields = "testCounters(failed,success,all,duration),testOccurrence(id,name,muted,status,invocations($locator(count:90000),testCounters(all,success,failed),testOccurrence(id,name,status,muted)))";
String locator = "currentlyFailing:true,affectedProject:" + buildType.getProject().getExternalId();
FakeHttpServletRequest mockRequest = new FakeHttpServletRequest();
mockRequest.setRequestURL(String.format("http://test/httpAuth/app/rest/testOccurrences?locator=%s&fields=%s", locator, fields));
TestOccurrences testOccurrences = myRequest.getTestOccurrences(locator, fields, null, mockRequest);
assertEquals("Should return exactly one 'grouping' test run.", 1, testOccurrences.items.size());
TestOccurrence grouping = testOccurrences.items.get(0);
assertNotNull("Should contain invocations node.", grouping.getInvocations());
assertEquals("Should contain exactly 3 occurrences.", 3, grouping.getInvocations().items.size());
}
use of jetbrains.buildServer.serverSide.impl.BuildTypeImpl in project teamcity-rest by JetBrains.
the class TestOccurrenceRequestTest method testShouldRespectExpandInvocationsDimension.
@Test
@TestFor(issues = { "TW-70331" })
public void testShouldRespectExpandInvocationsDimension() {
final BuildTypeImpl buildType = registerBuildType("buildConf1", "project");
final SFinishedBuild build = build().in(buildType).withTest("aaa", false).withTest("aaa", false).withTest("aaa", true).finish();
FakeHttpServletRequest mockRequest = new FakeHttpServletRequest();
String fields = "testCounters(all,success,failed)";
String locator = "build:" + build.getBuildId() + ",expandInvocations:true";
mockRequest.setRequestURL(String.format("http://test/httpAuth/app/rest/testOccurrences?locator=%s&fields=%s", locator, fields));
TestOccurrences testOccurrences = myRequest.getTestOccurrences(locator, fields, null, mockRequest);
assertEquals(new Integer(3), testOccurrences.getTestCounters().getAll());
assertEquals(new Integer(2), testOccurrences.getTestCounters().getFailed());
assertEquals(new Integer(1), testOccurrences.getTestCounters().getSuccess());
}
use of jetbrains.buildServer.serverSide.impl.BuildTypeImpl in project teamcity-rest by JetBrains.
the class BuildTypeRequestTest method testParameterTypeResourses.
@Test
public void testParameterTypeResourses() {
BuildTypeImpl buildType1 = registerTemplateBasedBuildType("buildType1");
ParameterFactory parameterFactory = myFixture.getSingletonService(ParameterFactory.class);
ParameterDescriptionFactory parameterDescriptionFactory = myFixture.getSingletonService(ParameterDescriptionFactory.class);
buildType1.addParameter(parameterFactory.createParameter("a1", "b10", parameterDescriptionFactory.createDescription("cType", CollectionsUtil.asMap("a", "b", "c", "d"))));
buildType1.addParameter(new SimpleParameter("a2", "b9"));
final String btLocator = "id:" + buildType1.getExternalId();
TypedParametersSubResource parametersSubResource = myBuildTypeRequest.getParametersSubResource(btLocator);
assertEquals(2, parametersSubResource.getParameters(null, "$long,property($long)").properties.size());
{
Property parameter = parametersSubResource.getParameter("a1", "$long");
assertEquals("a1", parameter.name);
assertEquals("b10", parameter.value);
assertEquals("cType a='b' c='d'", parameter.type.rawValue);
}
{
ParameterType parameterType = parametersSubResource.getParameterType("a1");
assertEquals("cType a='b' c='d'", parameterType.rawValue);
}
/*
{
assertEquals("cType", buildType1.getParameter("a1").getControlDescription().getParameterType());
assertMap(buildType1.getParameter("a1").getControlDescription().getParameterTypeArguments(), "a", "b", "c", "d");
ParameterType parameterType = new ParameterType();
parameterType.rawValue = "cType a='b1' c='d'";
ParameterType newParameterType = parametersSubResource.setParameterType("a1", parameterType);
assertEquals("cType a='b1' c='d'", newParameterType.rawValue);
assertEquals("cType", buildType1.getParameter("a1").getControlDescription().getParameterType());
assertMap(buildType1.getParameter("a1").getControlDescription().getParameterTypeArguments(), "a", "b1", "c", "d");
}
*/
}
Aggregations