Search in sources :

Example 1 with AgentData

use of com.hazelcast.simulator.coordinator.registry.AgentData in project hazelcast-simulator by hazelcast.

the class Provisioner method installSimulator.

void installSimulator() {
    onlineCheckAgents(properties, registry);
    ensureIsRemoteSetup(properties, "install");
    long started = System.nanoTime();
    logWithRuler("Installing Simulator on %d machines...", registry.agentCount());
    ThreadSpawner spawner = new ThreadSpawner("installSimulator", true);
    for (final AgentData agent : registry.getAgents()) {
        spawner.spawn(new Runnable() {

            @Override
            public void run() {
                log("    Installing Simulator on %s", agent.getPublicAddress());
                installSimulator(agent.getPublicAddress());
                log("    Finished installing Simulator on %s", agent.getPublicAddress());
            }
        });
    }
    spawner.awaitCompletion();
    long elapsed = getElapsedSeconds(started);
    logWithRuler("Finished installing Simulator on %d machines (%s seconds)", registry.agentCount(), elapsed);
}
Also used : AgentData(com.hazelcast.simulator.coordinator.registry.AgentData) ThreadSpawner(com.hazelcast.simulator.utils.ThreadSpawner)

Example 2 with AgentData

use of com.hazelcast.simulator.coordinator.registry.AgentData in project hazelcast-simulator by hazelcast.

the class Provisioner method installJava.

void installJava() {
    onlineCheckAgents(properties, registry);
    ensureIsRemoteSetup(properties, "installJava");
    long started = System.nanoTime();
    logWithRuler("Installing Java on %d machines...", registry.agentCount());
    ThreadSpawner spawner = new ThreadSpawner("installJava", true);
    for (final AgentData agent : registry.getAgents()) {
        spawner.spawn(new Runnable() {

            @Override
            public void run() {
                log("Installing Java on %s", agent.getPublicAddress());
                installJava(agent.getPublicAddress());
            }
        });
    }
    spawner.awaitCompletion();
    long elapsed = getElapsedSeconds(started);
    logWithRuler("Finished installing Java on %d machines (%s seconds)", registry.agentCount(), elapsed);
}
Also used : AgentData(com.hazelcast.simulator.coordinator.registry.AgentData) ThreadSpawner(com.hazelcast.simulator.utils.ThreadSpawner)

Example 3 with AgentData

use of com.hazelcast.simulator.coordinator.registry.AgentData in project hazelcast-simulator by hazelcast.

the class CoordinatorCliTest method testInit_withLocalSetup.

@Test
public void testInit_withLocalSetup() {
    File simulatorProperties = new File(getUserDir(), "simulator.properties").getAbsoluteFile();
    writeText(format("%s=%s", CLOUD_PROVIDER, CloudProviderUtils.PROVIDER_LOCAL), simulatorProperties);
    writeText("COORDINATOR_PORT=5000\n", simulatorProperties);
    try {
        CoordinatorCli cli = createCoordinatorCli();
        Registry registry = cli.registry;
        assertEquals(1, registry.agentCount());
        AgentData firstAgent = registry.getFirstAgent();
        assertEquals("localhost", firstAgent.getPublicAddress());
        assertEquals("localhost", firstAgent.getPrivateAddress());
    } finally {
        deleteQuiet(simulatorProperties);
    }
}
Also used : AgentData(com.hazelcast.simulator.coordinator.registry.AgentData) Registry(com.hazelcast.simulator.coordinator.registry.Registry) File(java.io.File) FileUtils.ensureExistingFile(com.hazelcast.simulator.utils.FileUtils.ensureExistingFile) Test(org.junit.Test)

Example 4 with AgentData

use of com.hazelcast.simulator.coordinator.registry.AgentData in project hazelcast-simulator by hazelcast.

the class AgentsFileTest method testLoad_publicAndPrivateAddress.

@Test
public void testLoad_publicAndPrivateAddress() {
    writeText("192.168.1.1,10.10.10.10", agentsFile);
    registry = load(agentsFile);
    assertEquals(1, registry.agentCount());
    AgentData agentData = registry.getFirstAgent();
    assertEquals("192.168.1.1", agentData.getPublicAddress());
    assertEquals("10.10.10.10", agentData.getPrivateAddress());
}
Also used : AgentData(com.hazelcast.simulator.coordinator.registry.AgentData) Test(org.junit.Test)

Example 5 with AgentData

use of com.hazelcast.simulator.coordinator.registry.AgentData in project hazelcast-simulator by hazelcast.

the class AgentsFileTest method testLoad_fileContainsComments.

@Test
public void testLoad_fileContainsComments() {
    writeText("192.168.1.1#foo" + NEW_LINE + "#bar", agentsFile);
    registry = load(agentsFile);
    assertEquals(1, registry.agentCount());
    AgentData agentData = registry.getFirstAgent();
    assertEquals("192.168.1.1", agentData.getPublicAddress());
    assertEquals("192.168.1.1", agentData.getPrivateAddress());
}
Also used : AgentData(com.hazelcast.simulator.coordinator.registry.AgentData) Test(org.junit.Test)

Aggregations

AgentData (com.hazelcast.simulator.coordinator.registry.AgentData)32 Test (org.junit.Test)10 Registry (com.hazelcast.simulator.coordinator.registry.Registry)7 ThreadSpawner (com.hazelcast.simulator.utils.ThreadSpawner)5 CommandLineExitException (com.hazelcast.simulator.utils.CommandLineExitException)3 WorkerParameters (com.hazelcast.simulator.agent.workerprocess.WorkerParameters)2 SimulatorProperties (com.hazelcast.simulator.common.SimulatorProperties)2 AgentData.publicAddressesString (com.hazelcast.simulator.coordinator.registry.AgentData.publicAddressesString)2 BashCommand (com.hazelcast.simulator.utils.BashCommand)2 VendorDriver (com.hazelcast.simulator.vendors.VendorDriver)2 File (java.io.File)2 ArrayList (java.util.ArrayList)2 LinkedList (java.util.LinkedList)2 List (java.util.List)2 Map (java.util.Map)2 Before (org.junit.Before)2 ConfigFileTemplate (com.hazelcast.simulator.coordinator.ConfigFileTemplate)1 WorkerData (com.hazelcast.simulator.coordinator.registry.WorkerData)1 SimulatorAddress (com.hazelcast.simulator.protocol.core.SimulatorAddress)1 FileUtils.ensureExistingFile (com.hazelcast.simulator.utils.FileUtils.ensureExistingFile)1