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

org.arquillian.cube.q.simianarmy.client.FillDiskSimianArmyChaosScript 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 FillDiskSimianArmyChaosScript extends SimianArmyScriptChaos {

    private long size;

    public FillDiskSimianArmyChaosScript(long size) {
        super("filldisk");
        this.size = size;
    }

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

        List commands = new ArrayList<>();

        Map params = new HashMap<>();
        params.put("size", size);
        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