use of jetbrains.buildServer.server.graphql.model.connections.agentPool.AgentPoolAgentsConnection in project teamcity-rest by JetBrains.
the class AbstractAgentPoolResolverTest method basicAgentsConnection.
public void basicAgentsConnection() throws AgentPoolCannotBeRenamedException, NoSuchAgentPoolException, AgentTypeCannotBeMovedException, PoolQuotaExceededException {
AgentPoolManager manager = myFixture.getAgentPoolManager();
jetbrains.buildServer.serverSide.agentPools.AgentPool evenAgents = manager.createNewAgentPool("evenAgents");
jetbrains.buildServer.serverSide.agentPools.AgentPool oddAgents = manager.createNewAgentPool("oddAgents");
final int num = 2;
for (int i = 0; i < num * 2; i++) {
MockBuildAgent agent = myFixture.createEnabledAgent("agent_" + i);
registerAndEnableAgent(agent);
manager.moveAgentToPool((i % 2 == 0) ? evenAgents.getAgentPoolId() : oddAgents.getAgentPoolId(), agent);
}
AgentPoolAgentsConnection evenConnection = myResolver.agents(new AgentPool(evenAgents), myDataFetchingEnvironment);
assertEquals(num, evenConnection.getCount());
for (AgentPoolAgentsConnection.AgentPoolAgentsConnectionEdge edge : evenConnection.getEdges().getData()) {
assertEquals(evenAgents.getAgentPoolId(), edge.getNode().getData().getRealAgent().getAgentPoolId());
}
AgentPoolAgentsConnection oddConnection = myResolver.agents(new AgentPool(oddAgents), myDataFetchingEnvironment);
assertEquals(num, oddConnection.getCount());
for (AgentPoolAgentsConnection.AgentPoolAgentsConnectionEdge edge : oddConnection.getEdges().getData()) {
assertEquals(oddAgents.getAgentPoolId(), edge.getNode().getData().getRealAgent().getAgentPoolId());
}
}
Aggregations