Search in sources :

Example 1 with HazelcastDriver

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

use of com.hazelcast.simulator.vendors.HazelcastDriver 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

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