use of com.thoughtworks.go.util.ClassMockery in project gocd by gocd.
the class WorkFinderTest method before.
@Before
public void before() {
context = new ClassMockery();
workAssigner = context.mock(BuildAssignmentService.class);
assignedWorkTopic = context.mock(WorkAssignedTopic.class, "assignedWork");
idleAgentTopic = context.mock(IdleAgentTopic.class, "idleAgent");
workAssignmentPerformanceLogger = mock(WorkAssignmentPerformanceLogger.class);
context.checking(new Expectations() {
{
one(idleAgentTopic).addListener(with(any(WorkFinder.class)));
}
});
finder = new WorkFinder(workAssigner, idleAgentTopic, assignedWorkTopic, workAssignmentPerformanceLogger);
}
use of com.thoughtworks.go.util.ClassMockery in project gocd by gocd.
the class JobStatusListenerTest method setUp.
@Before
public void setUp() throws Exception {
goCache.clear();
dbHelper.onSetUp();
configHelper.usingCruiseConfigDao(goConfigDao);
configHelper.onSetUp();
PipelineConfig pipelineConfig = withSingleStageWithMaterials(PIPELINE_NAME, STAGE_NAME, withBuildPlans(JOB_NAME));
configHelper.addPipeline(PIPELINE_NAME, STAGE_NAME);
savedPipeline = scheduleHelper.schedule(pipelineConfig, BuildCause.createWithModifications(modifyOneFile(pipelineConfig), ""), GoConstants.DEFAULT_APPROVED_BY);
JobInstance job = savedPipeline.getStages().first().getJobInstances().first();
job.setAgentUuid(UUID);
mockery = new ClassMockery();
stageStatusTopic = mockery.mock(StageStatusTopic.class);
}
use of com.thoughtworks.go.util.ClassMockery in project gocd by gocd.
the class StageAuthorizationCheckerTest method setUp.
@Before
public void setUp() throws Exception {
mockery = new ClassMockery();
securityService = mockery.mock(SecurityService.class);
pipelineName = "cruise";
stageName = "dev";
username = "gli";
checker = new StageAuthorizationChecker(pipelineName, stageName, username, securityService);
}
use of com.thoughtworks.go.util.ClassMockery in project gocd by gocd.
the class UniqueEmailSenderTest method shouldSendEmailIfNotEnoughSpaceForFirstTime.
@Test
public void shouldSendEmailIfNotEnoughSpaceForFirstTime() {
ClassMockery mockery = new ClassMockery();
final EmailNotificationTopic topic = mockery.mock(EmailNotificationTopic.class);
final SendEmailMessage message = new SendEmailMessage("pavan", "hu kai", "someone");
mockery.checking(new Expectations() {
{
one(topic).post(message);
}
});
EmailSender sender = new AsynchronousEmailSender(topic);
sender.sendEmail(message);
}
use of com.thoughtworks.go.util.ClassMockery in project gocd by gocd.
the class DiskSpaceWarningCheckerTest method shouldReturnSuccessWhenTheArtifactsFolderIsNotPresent.
@Test
public void shouldReturnSuccessWhenTheArtifactsFolderIsNotPresent() {
ClassMockery mockery = new ClassMockery();
final GoConfigService service = mockery.mock(GoConfigService.class);
mockery.checking(new Expectations() {
{
allowing(service).artifactsDir();
will(returnValue(new File("/pavan")));
}
});
ServerHealthStateOperationResult result = new ServerHealthStateOperationResult();
new ArtifactsDiskSpaceWarningChecker(new SystemEnvironment(), sender, service, new SystemDiskSpaceChecker(), serverHealthService).check(result);
assertThat(result.getServerHealthState().isSuccess(), is(true));
}
Aggregations