Search in sources :

Example 96 with AgentRuntimeInfo

use of com.thoughtworks.go.server.service.AgentRuntimeInfo in project gocd by gocd.

the class BuildRepositoryMessageProducerTest method shouldDelegatePingToTheOldImplementation.

@Test
public void shouldDelegatePingToTheOldImplementation() {
    producer.ping(new AgentRuntimeInfo(agentIdentifier, AgentRuntimeStatus.Idle, currentWorkingDirectory(), "cookie", false));
    verify(oldImplementation).ping(new AgentRuntimeInfo(agentIdentifier, AgentRuntimeStatus.Idle, currentWorkingDirectory(), "cookie", false));
}
Also used : AgentRuntimeInfo(com.thoughtworks.go.server.service.AgentRuntimeInfo) Test(org.junit.Test)

Example 97 with AgentRuntimeInfo

use of com.thoughtworks.go.server.service.AgentRuntimeInfo in project gocd by gocd.

the class BuildRepositoryMessageProducerTest method shouldDelegateReportJobResultToTheOldImplementation.

@Test
public void shouldDelegateReportJobResultToTheOldImplementation() {
    producer.reportCompleting(new AgentRuntimeInfo(agentIdentifier, AgentRuntimeStatus.Idle, currentWorkingDirectory(), "cookie", false), jobIdentifier, passed);
    verify(oldImplementation).reportCompleting(new AgentRuntimeInfo(agentIdentifier, AgentRuntimeStatus.Idle, currentWorkingDirectory(), "cookie", false), jobIdentifier, passed);
}
Also used : AgentRuntimeInfo(com.thoughtworks.go.server.service.AgentRuntimeInfo) Test(org.junit.Test)

Example 98 with AgentRuntimeInfo

use of com.thoughtworks.go.server.service.AgentRuntimeInfo in project gocd by gocd.

the class WorkAssignmentsTest method setup.

@Before
public void setup() {
    context = new ClassMockery();
    idleAgentsTopic = context.mock(IdleAgentTopic.class, "idle_topic");
    assignedWorkTopic = context.mock(WorkAssignedTopic.class, "assigned_work_topic");
    context.checking(new Expectations() {

        {
            one(assignedWorkTopic).addListener(with(any(WorkAssignments.class)));
        }
    });
    assignments = new WorkAssignments(idleAgentsTopic, assignedWorkTopic);
    agentIdentifier = new AgentIdentifier("localhost", "127.0.0.1", "uuid");
    agent = new AgentRuntimeInfo(agentIdentifier, AgentRuntimeStatus.Idle, currentWorkingDirectory(), "cookie", false);
}
Also used : Expectations(org.jmock.Expectations) AgentRuntimeInfo(com.thoughtworks.go.server.service.AgentRuntimeInfo) AgentIdentifier(com.thoughtworks.go.remote.AgentIdentifier) ClassMockery(com.thoughtworks.go.util.ClassMockery) Before(org.junit.Before)

Example 99 with AgentRuntimeInfo

use of com.thoughtworks.go.server.service.AgentRuntimeInfo in project gocd by gocd.

the class WorkFinderTest method shouldPostNoWorkOnException.

@Test
public void shouldPostNoWorkOnException() {
    final RuntimeException exception = new RuntimeException("foo");
    context.checking(new Expectations() {

        {
            one(workAssigner).assignWorkToAgent(AGENT_1);
            will(throwException(exception));
            one(assignedWorkTopic).post(new WorkAssignedMessage(AGENT_1, NO_WORK));
        }
    });
    try {
        finder.onMessage(new IdleAgentMessage(new AgentRuntimeInfo(AGENT_1, AgentRuntimeStatus.Idle, currentWorkingDirectory(), "cookie", false)));
    } catch (Exception e) {
        assertSame(exception, e);
    }
}
Also used : Expectations(org.jmock.Expectations) AgentRuntimeInfo(com.thoughtworks.go.server.service.AgentRuntimeInfo) Test(org.junit.Test)

Example 100 with AgentRuntimeInfo

use of com.thoughtworks.go.server.service.AgentRuntimeInfo in project gocd by gocd.

the class BuildVariablesTest method setup.

@Before
public void setup() {
    AgentIdentifier agentIdentifier = new AgentIdentifier("duloc", "127.0.0.1", "uuid");
    AgentRuntimeInfo runtimeInfo = new AgentRuntimeInfo(agentIdentifier, AgentRuntimeStatus.Idle, "/home/lord-farquaad/builds", "cookie", false);
    bvs = new BuildVariables(runtimeInfo, new TestingClock(new Date(0)));
}
Also used : AgentRuntimeInfo(com.thoughtworks.go.server.service.AgentRuntimeInfo) AgentIdentifier(com.thoughtworks.go.remote.AgentIdentifier) TestingClock(com.thoughtworks.go.util.TestingClock) Date(java.util.Date) Before(org.junit.Before)

Aggregations

AgentRuntimeInfo (com.thoughtworks.go.server.service.AgentRuntimeInfo)112 Test (org.junit.Test)93 AgentIdentifier (com.thoughtworks.go.remote.AgentIdentifier)31 File (java.io.File)14 AgentInstruction (com.thoughtworks.go.remote.AgentInstruction)13 StringContains.containsString (org.hamcrest.core.StringContains.containsString)12 FakeBuildRepositoryRemote (com.thoughtworks.go.agent.testhelpers.FakeBuildRepositoryRemote)11 UploadEntry (com.thoughtworks.go.matchers.UploadEntry)10 AgentBuildingInfo (com.thoughtworks.go.server.service.AgentBuildingInfo)8 SystemEnvironment (com.thoughtworks.go.util.SystemEnvironment)8 AgentInstance (com.thoughtworks.go.domain.AgentInstance)6 Before (org.junit.Before)5 EnvironmentVariableContext (com.thoughtworks.go.util.command.EnvironmentVariableContext)4 Expectations (org.jmock.Expectations)4 RunIf (com.googlecode.junit.ext.RunIf)3 Date (java.util.Date)3 CoreMatchers.containsString (org.hamcrest.CoreMatchers.containsString)3 MaterialConfigs (com.thoughtworks.go.config.materials.MaterialConfigs)2 JobIdentifier (com.thoughtworks.go.domain.JobIdentifier)2 Registration (com.thoughtworks.go.security.Registration)2