class SSMStepDefinitions implements EC2StepFunctions {

    @When("^SSM CPU spike on (\\d+) instances for (\\d+) cores$")
    public SSMStepDefinitions spikeCPUOnHealthyInstances(int numHosts, int cores) throws Exception {
        List<EC2InstanceTO> instances = executionStateCache.getInstances();
        if (instances == null || instances.isEmpty()) {
            throw new RuntimeException("No Instances are vailable");
        }

        if (cores <= 0) {
            throw new RuntimeException("Invalid number of cores provided");
        }

        if (numHosts > instances.size()) {
            numHosts = instances.size();
        }

        List<EC2InstanceTO> instanceList = instances;
        if (instanceList.size() != numHosts) {
            instanceList = instances.subList(0, numHosts);
        }

        List<String> commands = new ArrayList<>();
        for (int i = 0; i < cores; i++) {
            commands.addAll(CommandUtility.getCommandsFromFile(Command.SPIKECPU.getCommandName() + ".txt"));
        }

        String commandId = ssmRaider.executeShellCommands(Ec2Utils.generateInstanceIdList(instanceList), commands);


        executionStateCache.setCpuSpiked(true);
        executionStateCache.setCommandId(commandId);
        executionStateCache.setSsmCommandInvocationInstances(instanceList);

        return this;
    }

    public  SSMStepDefinitions();

}