Search in sources :

Example 1 with Agent

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

the class AgentTest method cookieAssignedShouldReturnTrueWhenAgentHasCookie.

@Test
void cookieAssignedShouldReturnTrueWhenAgentHasCookie() {
    Agent agent = new Agent("uuid", "host", "127.0.0.1", "cookie");
    assertThat(agent.cookieAssigned(), is(true));
}
Also used : Agent(com.thoughtworks.go.config.Agent) Test(org.junit.jupiter.api.Test)

Example 2 with Agent

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

the class AgentTest method cookieAssignedShouldReturnFalseWhenAgentDoesNotHaveCookie.

@Test
void cookieAssignedShouldReturnFalseWhenAgentDoesNotHaveCookie() {
    Agent agent = new Agent("uuid", "host", "127.0.0.1");
    assertThat(agent.cookieAssigned(), is(false));
}
Also used : Agent(com.thoughtworks.go.config.Agent) Test(org.junit.jupiter.api.Test)

Example 3 with Agent

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

the class JobStatusJsonPresentationModelTest method shouldShowBuildStatus.

@Test
public void shouldShowBuildStatus() {
    JobInstance instance = assigned("test");
    instance.setId(12);
    instance.setAgentUuid("1234");
    final Agent agent = new Agent("1234", "localhost", "1234", "cookie");
    JobStatusJsonPresentationModel presenter = new JobStatusJsonPresentationModel(instance, agent, mock(DurationBean.class));
    Map json = presenter.toJsonHash();
    assertThatJson(new Gson().toJson(json)).when(IGNORING_EXTRA_FIELDS).isEqualTo("{\n" + "  \"name\": \"test\",\n" + "  \"id\": \"12\",\n" + "  \"agent\": \"localhost\",\n" + "  \"current_status\": \"assigned\"\n" + "}");
}
Also used : Agent(com.thoughtworks.go.config.Agent) DurationBean(com.thoughtworks.go.dto.DurationBean) JobInstance(com.thoughtworks.go.domain.JobInstance) Gson(com.google.gson.Gson) Map(java.util.Map) Test(org.junit.jupiter.api.Test)

Example 4 with Agent

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

the class ElasticAgentRuntimeInfo method agent.

@Override
public Agent agent() {
    Agent agent = super.agent();
    agent.setElasticAgentId(elasticAgentId);
    agent.setElasticPluginId(elasticPluginId);
    return agent;
}
Also used : Agent(com.thoughtworks.go.config.Agent)

Example 5 with Agent

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

the class AgentRuntimeInfoTest method shouldUsingIdleWhenRegistrationRequestIsFromLocalAgent.

@Test
public void shouldUsingIdleWhenRegistrationRequestIsFromLocalAgent() {
    AgentRuntimeInfo agentRuntimeInfo = AgentRuntimeInfo.fromServer(new Agent("uuid", "localhost", "127.0.0.1"), false, "/var/lib", 0L, "linux");
    assertThat(agentRuntimeInfo.getRuntimeStatus(), is(Idle));
}
Also used : Agent(com.thoughtworks.go.config.Agent) Test(org.junit.jupiter.api.Test)

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