com.thoughtworks.gauge.processor.SuiteExecutionEndingProcessor Maven / Gradle / Ivy
/*----------------------------------------------------------------
* Copyright (c) ThoughtWorks, Inc.
* Licensed under the Apache License, Version 2.0
* See LICENSE.txt in the project root for license information.
*----------------------------------------------------------------*/
package com.thoughtworks.gauge.processor;
import com.thoughtworks.gauge.ClassInstanceManager;
import com.thoughtworks.gauge.ExecutionContext;
import com.thoughtworks.gauge.MessageCollector;
import com.thoughtworks.gauge.ScreenshotCollector;
import com.thoughtworks.gauge.execution.ExecutionInfoMapper;
import com.thoughtworks.gauge.registry.HooksRegistry;
import gauge.messages.Messages;
import gauge.messages.Spec;
public class SuiteExecutionEndingProcessor extends MethodExecutionMessageProcessor implements IMessageProcessor {
public SuiteExecutionEndingProcessor(ClassInstanceManager instanceManager) {
super(instanceManager);
}
public Messages.Message process(Messages.Message message) {
ExecutionContext info = new ExecutionInfoMapper().executionInfoFrom(message.getExecutionEndingRequest().getCurrentExecutionInfo());
Messages.Message result = executeHooks(HooksRegistry.getAfterSuiteHooks(), message, info);
ClearObjectCache.clear(ClearObjectCache.SPEC_LEVEL, getInstanceManager());
Spec.ProtoExecutionResult executionResult = result.getExecutionStatusResponse().getExecutionResult();
Spec.ProtoExecutionResult protoExecutionResult = new MessageCollector().addPendingMessagesTo(executionResult);
protoExecutionResult = new ScreenshotCollector().addPendingScreenshotTo(protoExecutionResult);
return createMessageWithExecutionStatusResponse(message, protoExecutionResult);
}
}
© 2015 - 2024 Weber Informatics LLC | Privacy Policy