Search in sources :

Example 1 with ProjectsConnection

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()));
}
Also used : ProjectEx(jetbrains.buildServer.serverSide.impl.ProjectEx) Project(jetbrains.buildServer.server.graphql.model.Project) BuildTypeImpl(jetbrains.buildServer.serverSide.impl.BuildTypeImpl) ProjectsConnection(jetbrains.buildServer.server.graphql.model.connections.ProjectsConnection)

Example 2 with ProjectsConnection

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()));
}
Also used : Project(jetbrains.buildServer.server.graphql.model.Project) ProjectsConnection(jetbrains.buildServer.server.graphql.model.connections.ProjectsConnection) Test(org.testng.annotations.Test)

Example 3 with ProjectsConnection

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));
}
Also used : Permission(jetbrains.buildServer.serverSide.auth.Permission) AgentPoolProjectsConnection(jetbrains.buildServer.server.graphql.model.connections.agentPool.AgentPoolProjectsConnection) ProjectsConnection(jetbrains.buildServer.server.graphql.model.connections.ProjectsConnection) NotNull(org.jetbrains.annotations.NotNull)

Aggregations

ProjectsConnection (jetbrains.buildServer.server.graphql.model.connections.ProjectsConnection)3 Project (jetbrains.buildServer.server.graphql.model.Project)2 AgentPoolProjectsConnection (jetbrains.buildServer.server.graphql.model.connections.agentPool.AgentPoolProjectsConnection)1 Permission (jetbrains.buildServer.serverSide.auth.Permission)1 BuildTypeImpl (jetbrains.buildServer.serverSide.impl.BuildTypeImpl)1 ProjectEx (jetbrains.buildServer.serverSide.impl.ProjectEx)1 NotNull (org.jetbrains.annotations.NotNull)1 Test (org.testng.annotations.Test)1