Search in sources :

Example 11 with Registry

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

the class SimulatorUtils method loadComponentRegister.

public static Registry loadComponentRegister(File agentsFile, boolean sizeCheck) {
    ensureExistingFile(agentsFile);
    Registry registry = AgentsFile.load(agentsFile);
    if (sizeCheck && registry.agentCount() == 0) {
        throw new CommandLineExitException("Agents file " + agentsFile + " is empty.");
    }
    return registry;
}
Also used : Registry(com.hazelcast.simulator.coordinator.registry.Registry)

Example 12 with Registry

use of com.hazelcast.simulator.coordinator.registry.Registry 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 13 with Registry

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

the class DeploymentPlanTest method testGetVersionSpecs.

private void testGetVersionSpecs(List<AgentData> agents, int memberCount, int clientCount) {
    Registry registry = new Registry();
    for (AgentData agent : agents) {
        registry.addAgent(agent.getPublicAddress(), agent.getPrivateAddress());
    }
    vendorDriver.set("VERSION_SPEC", "outofthebox");
    DeploymentPlan deploymentPlan = new DeploymentPlan(vendorDriver, registry).addToPlan(memberCount, "member").addToPlan(clientCount, "javaclient");
    assertEquals(singleton("outofthebox"), deploymentPlan.getVersionSpecs());
}
Also used : AgentData(com.hazelcast.simulator.coordinator.registry.AgentData) Registry(com.hazelcast.simulator.coordinator.registry.Registry)

Example 14 with Registry

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

the class ProvisionerCliTest method testInit.

@Test
public void testInit() {
    ProvisionerCli cli = new ProvisionerCli(getArgs());
    Registry registry = cli.getProvisioner().getRegistry();
    assertEquals(1, registry.agentCount());
    assertEquals("127.0.0.1", registry.getFirstAgent().getPublicAddress());
}
Also used : Registry(com.hazelcast.simulator.coordinator.registry.Registry) Test(org.junit.Test)

Example 15 with Registry

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

the class Wizard method createSshCopyIdScript.

void createSshCopyIdScript(SimulatorProperties simulatorProperties) {
    Registry registry = loadComponentRegister(agentFile, true);
    String userName = simulatorProperties.getUser();
    ensureExistingFile(SSH_COPY_ID_FILE);
    writeText("#!/bin/bash" + NEW_LINE + NEW_LINE, SSH_COPY_ID_FILE);
    for (AgentData agent : registry.getAgents()) {
        String publicAddress = agent.getPublicAddress();
        appendText(format("ssh-copy-id -i ~/.ssh/id_rsa.pub %s@%s%n", userName, publicAddress), SSH_COPY_ID_FILE);
    }
    execute(format("chmod u+x %s", SSH_COPY_ID_FILE.getAbsoluteFile()));
    echo("Please execute './%s' to copy your public RSA key to all remote machines.", SSH_COPY_ID_FILE.getName());
}
Also used : AgentData(com.hazelcast.simulator.coordinator.registry.AgentData) Registry(com.hazelcast.simulator.coordinator.registry.Registry)

Aggregations

Registry (com.hazelcast.simulator.coordinator.registry.Registry)15 AgentData (com.hazelcast.simulator.coordinator.registry.AgentData)7 File (java.io.File)5 SimulatorProperties (com.hazelcast.simulator.common.SimulatorProperties)3 Before (org.junit.Before)3 Test (org.junit.Test)3 Agent (com.hazelcast.simulator.agent.Agent)2 CommandLineExitException (com.hazelcast.simulator.utils.CommandLineExitException)2 SimulatorUtils.loadSimulatorProperties (com.hazelcast.simulator.utils.SimulatorUtils.loadSimulatorProperties)2 HazelcastDriver (com.hazelcast.simulator.vendors.HazelcastDriver)2 WorkerParameters (com.hazelcast.simulator.agent.workerprocess.WorkerParameters)1 Coordinator (com.hazelcast.simulator.coordinator.Coordinator)1 CoordinatorParameters (com.hazelcast.simulator.coordinator.CoordinatorParameters)1 FailureOperation (com.hazelcast.simulator.coordinator.operations.FailureOperation)1 FileUtils.ensureExistingFile (com.hazelcast.simulator.utils.FileUtils.ensureExistingFile)1 TagUtils.tagsToString (com.hazelcast.simulator.utils.TagUtils.tagsToString)1 VendorDriver (com.hazelcast.simulator.vendors.VendorDriver)1 ArrayList (java.util.ArrayList)1 Map (java.util.Map)1 BeforeClass (org.junit.BeforeClass)1