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

org.arquillian.cube.q.simianarmy.client.KillProcessSimianArmyChaosScript Maven / Gradle / Ivy

The newest version!
package org.arquillian.cube.q.simianarmy.client;

import org.apache.commons.lang3.text.StrSubstitutor;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class KillProcessSimianArmyChaosScript extends SimianArmyScriptChaos {

    private String process;

    public KillProcessSimianArmyChaosScript(String process) {
        super("killprocess");
        this.process = process;
    }

    @Override
    public String[] postProcessScript(String[] chaosScriptsContent) {

        List commands = new ArrayList<>();

        Map params = new HashMap<>();
        params.put("process", process);

        StrSubstitutor substitutor = new StrSubstitutor(params);

        for (String chaosScriptContent : chaosScriptsContent) {
            commands.add(substitutor.replace(chaosScriptContent));
        }

        return commands.toArray(new String[commands.size()]);
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy