Search in sources :

Example 11 with SimulatorProperties

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

the class WorkerTest method before.

@Before
public void before() {
    setupFakeEnvironment();
    Registry registry = new Registry();
    AgentData agent = registry.addAgent(PUBLIC_ADDRESS, PUBLIC_ADDRESS);
    SimulatorProperties properties = new SimulatorProperties().set("MANAGEMENT_CENTER_URL", "none");
    VendorDriver driver = new HazelcastDriver().setAgents(registry.getAgents()).setAll(properties.asPublicMap()).set("CONFIG", fileAsText(localResourceDirectory() + "/hazelcast.xml"));
    workerAddress = workerAddress(AGENT_INDEX, WORKER_INDEX);
    parameters = driver.loadWorkerParameters("member", agent.getAddressIndex()).set("WORKER_ADDRESS", workerAddress).set("PUBLIC_ADDRESS", PUBLIC_ADDRESS);
    for (Map.Entry<String, String> entry : parameters.entrySet()) {
        String key = entry.getKey();
        if (key.startsWith("file:")) {
            FileUtils.writeText(entry.getValue(), new File(getUserDir(), key.substring(5, key.length())));
        }
    }
}
Also used : AgentData(com.hazelcast.simulator.coordinator.registry.AgentData) Registry(com.hazelcast.simulator.coordinator.registry.Registry) VendorDriver(com.hazelcast.simulator.vendors.VendorDriver) HazelcastDriver(com.hazelcast.simulator.vendors.HazelcastDriver) Map(java.util.Map) File(java.io.File) SimulatorProperties(com.hazelcast.simulator.common.SimulatorProperties) Before(org.junit.Before)

Example 12 with SimulatorProperties

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

the class WizardTest method before.

@Before
public void before() {
    setupFakeEnvironment();
    simulatorProperties = mock(SimulatorProperties.class);
    when(simulatorProperties.getUser()).thenReturn(SSH_USERNAME);
    when(simulatorProperties.getSshOptions()).thenReturn("");
    bash = mock(Bash.class);
    workDir = new File("wizardTestWorkDir").getAbsoluteFile();
    testPropertiesFile = new File(workDir, "test.properties");
    runScriptFile = new File(workDir, "run");
    prepareScriptFile = new File(workDir, "prepare");
    simulatorPropertiesFile = new File(workDir, SimulatorProperties.PROPERTIES_FILE_NAME);
    agentsFile = new File(workDir, AgentsFile.NAME);
    localSimulatorPropertiesFile = new File(SimulatorProperties.PROPERTIES_FILE_NAME).getAbsoluteFile();
    profileFile = ensureExistingFile("wizardTest.txt");
    wizard = new Wizard();
}
Also used : Bash(com.hazelcast.simulator.utils.Bash) AgentsFile(com.hazelcast.simulator.common.AgentsFile) File(java.io.File) FileUtils.ensureExistingFile(com.hazelcast.simulator.utils.FileUtils.ensureExistingFile) SimulatorProperties(com.hazelcast.simulator.common.SimulatorProperties) Before(org.junit.Before)

Example 13 with SimulatorProperties

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

the class WizardTest method testCompareSimulatorProperties.

@Test
public void testCompareSimulatorProperties() {
    SimulatorProperties defaultProperties = new SimulatorProperties();
    ensureExistingFile(localSimulatorPropertiesFile);
    appendText("invalid=unknown" + NEW_LINE, localSimulatorPropertiesFile);
    appendText(format("%s=changed%n", CLOUD_PROVIDER), localSimulatorPropertiesFile);
    appendText(format("%s=%s%n", CLOUD_IDENTITY, defaultProperties.get(CLOUD_IDENTITY)), localSimulatorPropertiesFile);
    wizard.compareSimulatorProperties();
}
Also used : SimulatorProperties(com.hazelcast.simulator.common.SimulatorProperties) Test(org.junit.Test)

Example 14 with SimulatorProperties

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

the class CoordinatorRunMonolithTest method setUp.

@Before
public void setUp() throws Exception {
    setupFakeEnvironment();
    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();
    registry.addAgent(localIp(), localIp());
    copy(new File(localResourceDirectory(), "hazelcast.xml"), new File(getUserDir(), "hazelcast.xml"));
    hazelcastDriver = new HazelcastDriver().setAgents(registry.getAgents()).setAll(simulatorProperties.asPublicMap()).set("SESSION_ID", coordinatorParameters.getSessionId());
    coordinator = new Coordinator(registry, coordinatorParameters);
    coordinator.start();
    run = new CoordinatorRunMonolith(coordinator, coordinatorParameters);
}
Also used : Agent(com.hazelcast.simulator.agent.Agent) Registry(com.hazelcast.simulator.coordinator.registry.Registry) File(java.io.File) HazelcastDriver(com.hazelcast.simulator.vendors.HazelcastDriver) SimulatorProperties(com.hazelcast.simulator.common.SimulatorProperties) SimulatorUtils.loadSimulatorProperties(com.hazelcast.simulator.utils.SimulatorUtils.loadSimulatorProperties) Before(org.junit.Before)

Example 15 with SimulatorProperties

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

the class ProvisionerUtilsTest method testEnsureIsCloudProviderSetup_withLocal.

@Test(expected = CommandLineExitException.class)
public void testEnsureIsCloudProviderSetup_withLocal() {
    SimulatorProperties properties = mock(SimulatorProperties.class);
    when(properties.getCloudProvider()).thenReturn(CloudProviderUtils.PROVIDER_LOCAL);
    ensureIsCloudProviderSetup(properties, "terminate");
}
Also used : SimulatorProperties(com.hazelcast.simulator.common.SimulatorProperties) Test(org.junit.Test)

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