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;
}
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);
}
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());
}
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());
}
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());
}
Aggregations