All Downloads are FREE. Search and download functionalities are using the official Maven repository.

com.thoughtworks.gauge.processor.StepPositionsRequestProcessor Maven / Gradle / Ivy

There is a newer version: 0.11.1
Show newest version
/*----------------------------------------------------------------
 *  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.registry.StepRegistry;
import gauge.messages.Messages;

import java.util.List;

public class StepPositionsRequestProcessor implements IMessageProcessor {
    private StepRegistry stepRegistry;

    public StepPositionsRequestProcessor(StepRegistry stepRegistry) {
        this.stepRegistry = stepRegistry;
    }

    @Override
    public Messages.Message process(Messages.Message message) {
        List positions = stepRegistry.getStepPositions(message.getStepPositionsRequest().getFilePath());

        return Messages.Message.newBuilder()
                .setMessageId(message.getMessageId())
                .setStepPositionsResponse(Messages.StepPositionsResponse.newBuilder().addAllStepPositions(positions))
                .setMessageType(Messages.Message.MessageType.StepPositionsResponse)
                .build();
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy