Teamcity Plugin Development - Unable to print agent size and agent ID


import jetbrains.buildServer.BuildAgent;
import jetbrains.buildServer.serverSide.BuildAgentManager;
import jetbrains.buildServer.serverSide.BuildServerAdapter;
import jetbrains.buildServer.serverSide.SBuildAgent;
import jetbrains.buildServer.serverSide.SBuildServer;

import java.util.List;

public class AppAgent extends BuildServerAdapter {
private int agentId;
private BuildAgent buildAgent;
private final SBuildServer buildServer;
private BuildAgentManager buildAgentManager;
private String name;

public AppAgent(SBuildServer buildServer) {
this.buildServer = buildServer;
this.buildAgentManager = buildServer.getBuildAgentManager();
}

public void register(){
buildServer.addListener(this);
List<SBuildAgent> registeredAgents = buildAgentManager.getRegisteredAgents();
System.out.println(registeredAgents.size());
SBuildAgent sBuildAgent = (SBuildAgent) buildAgentManager;
System.out.println(sBuildAgent.getId());
}
}
1 comment
Comment actions Permalink

Hi, could you please describe the issue you have?

0

Please sign in to leave a comment.