Search in sources :

Example 66 with Agent

use of com.thoughtworks.go.config.Agent in project gocd by gocd.

the class AgentInstanceMother method updateOS.

public static AgentInstance updateOS(AgentInstance agentInstance, String operatingSystem) {
    Agent agent = agentInstance.getAgent();
    AgentRuntimeInfo newRuntimeInfo = fromServer(agent, true, agentInstance.getLocation(), agentInstance.getUsableSpace(), operatingSystem);
    newRuntimeInfo.setStatus(agentInstance.getStatus());
    agentInstance.update(newRuntimeInfo);
    return agentInstance;
}
Also used : AgentInstance.createFromLiveAgent(com.thoughtworks.go.domain.AgentInstance.createFromLiveAgent) Agent(com.thoughtworks.go.config.Agent) AgentRuntimeInfo(com.thoughtworks.go.server.service.AgentRuntimeInfo)

Example 67 with Agent

use of com.thoughtworks.go.config.Agent in project gocd by gocd.

the class AgentInstanceMother method pending.

public static AgentInstance pending(SystemEnvironment systemEnvironment) {
    Agent agent = new Agent("uuid4", "CCeDev03", "10.18.5.3", asList("db", "web"));
    AgentRuntimeInfo runtimeInfo = fromServer(agent, false, "/var/lib", 0L, "linux");
    AgentInstance agentInstance = createFromLiveAgent(runtimeInfo, systemEnvironment, mock(AgentStatusChangeListener.class));
    agentInstance.pending();
    agentInstance.update(runtimeInfo);
    agentInstance.pending();
    return agentInstance;
}
Also used : AgentInstance(com.thoughtworks.go.domain.AgentInstance) NullAgentInstance(com.thoughtworks.go.domain.NullAgentInstance) AgentInstance.createFromLiveAgent(com.thoughtworks.go.domain.AgentInstance.createFromLiveAgent) Agent(com.thoughtworks.go.config.Agent) AgentRuntimeInfo(com.thoughtworks.go.server.service.AgentRuntimeInfo) AgentStatusChangeListener(com.thoughtworks.go.listener.AgentStatusChangeListener)

Example 68 with Agent

use of com.thoughtworks.go.config.Agent in project gocd by gocd.

the class AgentInstanceMother method building.

public static AgentInstance building(String buildLocator, SystemEnvironment systemEnvironment) {
    Agent buildingAgentConfig = new Agent("uuid3", "CCeDev01", "10.18.5.1", singletonList("java"));
    AgentRuntimeInfo agentRuntimeInfo = new AgentRuntimeInfo(buildingAgentConfig.getAgentIdentifier(), AgentRuntimeStatus.Idle, currentWorkingDirectory(), "cookie");
    agentRuntimeInfo.busy(new AgentBuildingInfo("pipeline", buildLocator));
    AgentInstance building = AgentInstance.createFromAgent(buildingAgentConfig, systemEnvironment, mock(AgentStatusChangeListener.class));
    building.update(agentRuntimeInfo);
    return building;
}
Also used : AgentInstance(com.thoughtworks.go.domain.AgentInstance) NullAgentInstance(com.thoughtworks.go.domain.NullAgentInstance) AgentInstance.createFromLiveAgent(com.thoughtworks.go.domain.AgentInstance.createFromLiveAgent) Agent(com.thoughtworks.go.config.Agent) AgentRuntimeInfo(com.thoughtworks.go.server.service.AgentRuntimeInfo) AgentBuildingInfo(com.thoughtworks.go.server.service.AgentBuildingInfo) AgentStatusChangeListener(com.thoughtworks.go.listener.AgentStatusChangeListener)

Example 69 with Agent

use of com.thoughtworks.go.config.Agent in project gocd by gocd.

the class AgentInstanceMother method updateUsableSpace.

public static AgentInstance updateUsableSpace(AgentInstance agentInstance, Long freespace) {
    Agent agent = agentInstance.getAgent();
    agentInstance.update(fromServer(agent, true, agentInstance.getLocation(), freespace, "linux"));
    return agentInstance;
}
Also used : AgentInstance.createFromLiveAgent(com.thoughtworks.go.domain.AgentInstance.createFromLiveAgent) Agent(com.thoughtworks.go.config.Agent)

Example 70 with Agent

use of com.thoughtworks.go.config.Agent in project gocd by gocd.

the class AgentInstanceMother method updateElasticAgentId.

public static AgentInstance updateElasticAgentId(AgentInstance agentInstance, String elasticAgentId) {
    Agent agent = agentInstance.getAgent();
    agent.setElasticAgentId(elasticAgentId);
    agentInstance.syncAgentFrom(agent);
    return agentInstance;
}
Also used : AgentInstance.createFromLiveAgent(com.thoughtworks.go.domain.AgentInstance.createFromLiveAgent) Agent(com.thoughtworks.go.config.Agent)

Aggregations

Agent (com.thoughtworks.go.config.Agent)100 Test (org.junit.jupiter.api.Test)52 AgentInstance.createFromLiveAgent (com.thoughtworks.go.domain.AgentInstance.createFromLiveAgent)36 AgentInstance (com.thoughtworks.go.domain.AgentInstance)20 AgentStatusChangeListener (com.thoughtworks.go.listener.AgentStatusChangeListener)19 SystemEnvironment (com.thoughtworks.go.util.SystemEnvironment)16 AgentRuntimeInfo (com.thoughtworks.go.server.service.AgentRuntimeInfo)13 NullAgentInstance (com.thoughtworks.go.domain.NullAgentInstance)11 JobInstance (com.thoughtworks.go.domain.JobInstance)8 ResponseEntity (org.springframework.http.ResponseEntity)8 ServerConfig (com.thoughtworks.go.config.ServerConfig)6 AgentIdentifier (com.thoughtworks.go.remote.AgentIdentifier)6 Username (com.thoughtworks.go.server.domain.Username)5 MockHttpServletRequest (org.springframework.mock.web.MockHttpServletRequest)5 AgentInstance.createFromAgent (com.thoughtworks.go.domain.AgentInstance.createFromAgent)4 AgentBuildingInfo (com.thoughtworks.go.server.service.AgentBuildingInfo)4 Query (org.hibernate.Query)4 TransactionCallback (org.springframework.transaction.support.TransactionCallback)4 Gson (com.google.gson.Gson)3 ResourceConfig (com.thoughtworks.go.config.ResourceConfig)3