Search in sources :

Example 81 with SystemEnvironment

use of com.thoughtworks.go.util.SystemEnvironment in project gocd by gocd.

the class AgentInstanceTest method shouldNotifyAgentChangeListenerOnRefreshAndMarkedMissing.

@Test
public void shouldNotifyAgentChangeListenerOnRefreshAndMarkedMissing() throws Exception {
    AgentInstance agentInstance = AgentInstance.createFromConfig(agentConfig("abc"), new SystemEnvironment(), agentStatusChangeListener);
    agentInstance.idle();
    agentInstance.refresh();
    assertThat(agentInstance.getStatus(), is(AgentStatus.Missing));
    verify(agentStatusChangeListener, times(2)).onAgentStatusChange(agentInstance);
}
Also used : SystemEnvironment(com.thoughtworks.go.util.SystemEnvironment) Test(org.junit.Test)

Example 82 with SystemEnvironment

use of com.thoughtworks.go.util.SystemEnvironment in project gocd by gocd.

the class AgentInstanceTest method shouldNotifyAgentChangeListenerOnUpdate.

@Test
public void shouldNotifyAgentChangeListenerOnUpdate() throws Exception {
    AgentInstance idleAgent = AgentInstance.createFromConfig(agentConfig("abc"), new SystemEnvironment(), agentStatusChangeListener);
    idleAgent.update(buildingRuntimeInfo());
    verify(agentStatusChangeListener).onAgentStatusChange(idleAgent);
}
Also used : SystemEnvironment(com.thoughtworks.go.util.SystemEnvironment) Test(org.junit.Test)

Example 83 with SystemEnvironment

use of com.thoughtworks.go.util.SystemEnvironment in project gocd by gocd.

the class AgentInstanceTest method shouldNotifyAgentChangeListenerOnAgentBuilding.

@Test
public void shouldNotifyAgentChangeListenerOnAgentBuilding() throws Exception {
    AgentInstance idleAgent = AgentInstance.createFromConfig(agentConfig("abc"), new SystemEnvironment(), agentStatusChangeListener);
    idleAgent.building(new AgentBuildingInfo("running pipeline/stage/build", "buildLocator"));
    verify(agentStatusChangeListener).onAgentStatusChange(idleAgent);
}
Also used : SystemEnvironment(com.thoughtworks.go.util.SystemEnvironment) AgentBuildingInfo(com.thoughtworks.go.server.service.AgentBuildingInfo) Test(org.junit.Test)

Example 84 with SystemEnvironment

use of com.thoughtworks.go.util.SystemEnvironment in project gocd by gocd.

the class AgentInstanceTest method shouldNotifyAgentChangeListenerOnCancel.

@Test
public void shouldNotifyAgentChangeListenerOnCancel() throws Exception {
    AgentInstance agentInstance = AgentInstance.createFromConfig(agentConfig("abc"), new SystemEnvironment(), agentStatusChangeListener);
    agentInstance.cancel();
    verify(agentStatusChangeListener).onAgentStatusChange(agentInstance);
}
Also used : SystemEnvironment(com.thoughtworks.go.util.SystemEnvironment) Test(org.junit.Test)

Example 85 with SystemEnvironment

use of com.thoughtworks.go.util.SystemEnvironment in project gocd by gocd.

the class AgentInstanceTest method tearDown.

@After
public void tearDown() throws Exception {
    FileUtils.deleteQuietly(new File("config/agentkeystore"));
    new SystemEnvironment().setProperty("agent.connection.timeout", "300");
    new SystemEnvironment().clearProperty(SystemEnvironment.AGENT_SIZE_LIMIT);
}
Also used : SystemEnvironment(com.thoughtworks.go.util.SystemEnvironment) File(java.io.File) After(org.junit.After)

Aggregations

SystemEnvironment (com.thoughtworks.go.util.SystemEnvironment)174 Test (org.junit.Test)93 Before (org.junit.Before)38 File (java.io.File)37 AgentInstance (com.thoughtworks.go.domain.AgentInstance)27 MaterialRevisions (com.thoughtworks.go.domain.MaterialRevisions)15 HttpLocalizedOperationResult (com.thoughtworks.go.server.service.result.HttpLocalizedOperationResult)14 ArrayList (java.util.ArrayList)14 AgentRuntimeInfo (com.thoughtworks.go.server.service.AgentRuntimeInfo)11 CaseInsensitiveString (com.thoughtworks.go.config.CaseInsensitiveString)10 BuildCause (com.thoughtworks.go.domain.buildcause.BuildCause)10 AgentStatusChangeListener (com.thoughtworks.go.listener.AgentStatusChangeListener)10 AgentIdentifier (com.thoughtworks.go.remote.AgentIdentifier)9 AgentConfig (com.thoughtworks.go.config.AgentConfig)8 MaterialRevision (com.thoughtworks.go.domain.MaterialRevision)8 PipelineConfigDependencyGraph (com.thoughtworks.go.server.domain.PipelineConfigDependencyGraph)8 SvnMaterial (com.thoughtworks.go.config.materials.svn.SvnMaterial)7 EnvironmentVariableContext (com.thoughtworks.go.util.command.EnvironmentVariableContext)7 Date (java.util.Date)7 CruiseConfig (com.thoughtworks.go.config.CruiseConfig)6