use of jetbrains.buildServer.server.graphql.model.connections.ProjectsConnection 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.server.graphql.model.connections.ProjectsConnection in project teamcity-rest by JetBrains.
the class ProjectResolverTest method testAncestors.
@Test
public void testAncestors() throws Exception {
Project subsubproject = new Project(mySubSubProject);
myDataFetchingEnvironment.setLocalContext(mySubSubProject);
myDataFetchingEnvironment.setArgument("first", -1);
ProjectsConnection ancestors = myResolver.ancestorProjects(subsubproject, myDataFetchingEnvironment);
assertEquals(3, ancestors.getCount());
assertExtensibleEdges(ancestors.getEdges().getData(), new Project(mySubProject), new Project(myProject), new Project(myProject.getParentProject()));
}
use of jetbrains.buildServer.server.graphql.model.connections.ProjectsConnection in project teamcity-rest by JetBrains.
the class AgentPoolResolver method actions.
@NotNull
public AgentPoolActions actions(@NotNull AgentPool pool) {
ManageAgentsInPoolUnmetRequirements unmetMoveReqs = myPoolActionsAccessChecker.getUnmetRequirementsToManageAgentsInPool(pool.getRealPool().getAgentPoolId());
AgentPoolActionStatus moveAgentsActionStatus;
if (unmetMoveReqs == null) {
moveAgentsActionStatus = AgentPoolActionStatus.available();
} else {
moveAgentsActionStatus = AgentPoolActionStatus.unavailable(new MissingGlobalOrPerProjectPermission(unmetMoveReqs.getGlobalPermissions().stream().map(Permission::getName).collect(Collectors.toList()), unmetMoveReqs.getPerProjectPermission().getName(), new ProjectsConnection(myProjectManager.findProjects(unmetMoveReqs.getProjectsMissingPermission()), PaginationArguments.everything()), unmetMoveReqs.getHiddenProjectsMissingPermission()));
}
return new AgentPoolActions(moveAgentsActionStatus, AgentPoolActionStatus.unavailable(null), AgentPoolActionStatus.unavailable(null), AgentPoolActionStatus.unavailable(null), AgentPoolActionStatus.unavailable(null), AgentPoolActionStatus.unavailable(null));
}
Aggregations