Search in sources :

Example 1 with Agent

use of com.hazelcast.simulator.agent.Agent 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 2 with Agent

use of com.hazelcast.simulator.agent.Agent 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)

Aggregations

Agent (com.hazelcast.simulator.agent.Agent)2 SimulatorProperties (com.hazelcast.simulator.common.SimulatorProperties)2 Registry (com.hazelcast.simulator.coordinator.registry.Registry)2 SimulatorUtils.loadSimulatorProperties (com.hazelcast.simulator.utils.SimulatorUtils.loadSimulatorProperties)2 File (java.io.File)2 HazelcastDriver (com.hazelcast.simulator.vendors.HazelcastDriver)1 Before (org.junit.Before)1 BeforeClass (org.junit.BeforeClass)1