Search in sources :

Example 1 with SimulatorProperties

use of com.hazelcast.simulator.common.SimulatorProperties in project hazelcast-simulator by hazelcast.

the class WizardCli method run.

public void run() {
    if (options.has(installSpec)) {
        String homeDir = getUserHomePath();
        wizard.install(getSimulatorPath(), getProfileFile(homeDir));
    } else if (options.has(createWorkDirSpec)) {
        SimulatorProperties simulatorProperties = getSimulatorProperties(false);
        wizard.createWorkDir(simulatorProperties, createWorkDirSpec.value(options), cloudProvider.value(options));
    } else if (options.has(listCloudProvidersSpec)) {
        wizard.listCloudProviders();
    } else if (options.has(createSshCopyIdScriptSpec)) {
        wizard.createSshCopyIdScript(getSimulatorProperties());
    } else if (options.has(sshConnectionCheckSpec)) {
        SimulatorProperties simulatorProperties = getSimulatorProperties();
        wizard.sshConnectionCheck(simulatorProperties, newBash(simulatorProperties));
    } else if (options.has(compareSimulatorPropertiesSpec)) {
        wizard.compareSimulatorProperties();
    } else {
        printHelpAndExit(parser);
    }
}
Also used : SimulatorProperties(com.hazelcast.simulator.common.SimulatorProperties)

Example 2 with SimulatorProperties

use of com.hazelcast.simulator.common.SimulatorProperties in project hazelcast-simulator by hazelcast.

the class SimulatorUtils method loadSimulatorProperties.

public static SimulatorProperties loadSimulatorProperties() {
    SimulatorProperties simulatorProperties = new SimulatorProperties();
    File file = new File(FileUtils.getUserDir(), "simulator.properties");
    if (file.exists()) {
        simulatorProperties.init(file);
    }
    return simulatorProperties;
}
Also used : FileUtils.ensureExistingFile(com.hazelcast.simulator.utils.FileUtils.ensureExistingFile) FileUtils.newFile(com.hazelcast.simulator.utils.FileUtils.newFile) AgentsFile(com.hazelcast.simulator.common.AgentsFile) File(java.io.File) SimulatorProperties(com.hazelcast.simulator.common.SimulatorProperties)

Example 3 with SimulatorProperties

use of com.hazelcast.simulator.common.SimulatorProperties in project hazelcast-simulator by hazelcast.

the class CoordinatorTest method beforeClass.

@BeforeClass
public static void beforeClass() throws Exception {
    setupFakeEnvironment();
    hzConfig = FileUtils.fileAsText(new File(localResourceDirectory(), "hazelcast.xml"));
    hzClientConfig = FileUtils.fileAsText(new File(localResourceDirectory(), "client-hazelcast.xml"));
    File simulatorPropertiesFile = new File(getUserDir(), "simulator.properties");
    appendText("CLOUD_PROVIDER=embedded\n", simulatorPropertiesFile);
    SimulatorProperties simulatorProperties = loadSimulatorProperties();
    CoordinatorParameters coordinatorParameters = new CoordinatorParameters().setSimulatorProperties(simulatorProperties).setSkipShutdownHook(true);
    agent = new Agent(1, "127.0.0.1", simulatorProperties.getAgentPort(), 60, null);
    agent.start();
    registry = new Registry();
    agentData = registry.addAgent(localIp(), localIp());
    coordinator = new Coordinator(registry, coordinatorParameters);
    coordinator.start();
}
Also used : Agent(com.hazelcast.simulator.agent.Agent) Registry(com.hazelcast.simulator.coordinator.registry.Registry) File(java.io.File) SimulatorUtils.loadSimulatorProperties(com.hazelcast.simulator.utils.SimulatorUtils.loadSimulatorProperties) SimulatorProperties(com.hazelcast.simulator.common.SimulatorProperties) BeforeClass(org.junit.BeforeClass)

Example 4 with SimulatorProperties

use of com.hazelcast.simulator.common.SimulatorProperties in project hazelcast-simulator by hazelcast.

the class HazelcastDriverTest method before.

@Before
public void before() {
    simulatorProperties = new SimulatorProperties();
    agent = new AgentData(1, SimulatorUtils.localIp(), SimulatorUtils.localIp());
}
Also used : AgentData(com.hazelcast.simulator.coordinator.registry.AgentData) SimulatorProperties(com.hazelcast.simulator.common.SimulatorProperties) Before(org.junit.Before)

Example 5 with SimulatorProperties

use of com.hazelcast.simulator.common.SimulatorProperties in project hazelcast-simulator by hazelcast.

the class Wizard method compareSimulatorProperties.

void compareSimulatorProperties() {
    SimulatorProperties defaultProperties = new SimulatorProperties();
    String defaultPropertiesString = defaultProperties.getDefaultsAsString();
    Properties userProperties = WizardUtils.getUserProperties();
    int size = userProperties.size();
    if (size == 0) {
        echo(format("Found no %s file or file was empty!", SimulatorProperties.PROPERTIES_FILE_NAME));
        return;
    }
    echo("Defined user properties:");
    int unknownProperties = 0;
    int changedProperties = 0;
    for (String property : new TreeSet<String>(userProperties.stringPropertyNames())) {
        boolean commentedOutProperty = containsCommentedOutProperty(defaultPropertiesString, property);
        String userValue = userProperties.getProperty(property);
        String defaultValue = (commentedOutProperty ? getCommentedOutProperty(defaultPropertiesString, property) : defaultProperties.get(property));
        if (!defaultProperties.containsKey(property) && !commentedOutProperty) {
            echo("%s = %s [unknown property]", property, userValue);
            unknownProperties++;
        } else if (!userValue.equals(defaultValue)) {
            echo("%s = %s [default: %s]", property, userValue, defaultValue);
            changedProperties++;
        } else {
            echo("%s = %s", property, userValue);
        }
    }
    logResults(size, unknownProperties, changedProperties);
}
Also used : TreeSet(java.util.TreeSet) SimulatorProperties(com.hazelcast.simulator.common.SimulatorProperties) Properties(java.util.Properties) SimulatorProperties(com.hazelcast.simulator.common.SimulatorProperties)

Aggregations

SimulatorProperties (com.hazelcast.simulator.common.SimulatorProperties)21 Test (org.junit.Test)12 File (java.io.File)5 Before (org.junit.Before)4 Registry (com.hazelcast.simulator.coordinator.registry.Registry)3 Agent (com.hazelcast.simulator.agent.Agent)2 AgentsFile (com.hazelcast.simulator.common.AgentsFile)2 AgentData (com.hazelcast.simulator.coordinator.registry.AgentData)2 FileUtils.ensureExistingFile (com.hazelcast.simulator.utils.FileUtils.ensureExistingFile)2 SimulatorUtils.loadSimulatorProperties (com.hazelcast.simulator.utils.SimulatorUtils.loadSimulatorProperties)2 HazelcastDriver (com.hazelcast.simulator.vendors.HazelcastDriver)2 Bash (com.hazelcast.simulator.utils.Bash)1 FileUtils.newFile (com.hazelcast.simulator.utils.FileUtils.newFile)1 VendorDriver (com.hazelcast.simulator.vendors.VendorDriver)1 Map (java.util.Map)1 Properties (java.util.Properties)1 TreeSet (java.util.TreeSet)1 BeforeClass (org.junit.BeforeClass)1