Search in sources :

Example 16 with AgentData

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

the class HazelcastDriver method createAddressConfig.

public static String createAddressConfig(String tagName, List<AgentData> agents, String port) {
    StringBuilder members = new StringBuilder();
    for (AgentData agent : agents) {
        String hostAddress = agent.getPrivateAddress();
        members.append(format("<%s>%s:%s</%s>%n", tagName, hostAddress, port, tagName));
    }
    return members.toString();
}
Also used : AgentData(com.hazelcast.simulator.coordinator.registry.AgentData)

Example 17 with AgentData

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

the class HazelcastUtilsTest method getComponentRegistryMock.

private Registry getComponentRegistryMock() {
    List<AgentData> agents = new ArrayList<AgentData>();
    for (int i = 1; i <= 5; i++) {
        AgentData agent = mock(AgentData.class);
        when(agent.getPrivateAddress()).thenReturn("192.168.0." + i);
        agents.add(agent);
    }
    Registry registry = mock(Registry.class);
    when(registry.getAgents()).thenReturn(agents);
    return registry;
}
Also used : ArrayList(java.util.ArrayList) AgentData(com.hazelcast.simulator.coordinator.registry.AgentData) Registry(com.hazelcast.simulator.coordinator.registry.Registry)

Example 18 with AgentData

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

the class InfinispanDriver method initialHosts.

private String initialHosts(boolean clientMode) {
    String port = clientMode ? "11222" : get("HAZELCAST_PORT");
    StringBuilder sb = new StringBuilder();
    boolean first = true;
    for (AgentData agent : agents) {
        if (first) {
            first = false;
        } else if (clientMode) {
            sb.append(';');
        } else {
            sb.append(',');
        }
        if (clientMode) {
            sb.append(agent.getPrivateAddress()).append(":").append(port);
        } else {
            sb.append(agent.getPrivateAddress()).append("[").append(port).append("]");
        }
    }
    return sb.toString();
}
Also used : AgentData(com.hazelcast.simulator.coordinator.registry.AgentData)

Example 19 with AgentData

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

the class JetDriver method createAddressConfig.

public static String createAddressConfig(String tagName, List<AgentData> agents, String port) {
    StringBuilder members = new StringBuilder();
    for (AgentData agent : agents) {
        String hostAddress = agent.getPrivateAddress();
        members.append(format("<%s>%s:%s</%s>%n", tagName, hostAddress, port, tagName));
    }
    return members.toString();
}
Also used : AgentData(com.hazelcast.simulator.coordinator.registry.AgentData)

Example 20 with AgentData

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

the class IgniteDriver method loadServerOrNativeClientConfig.

private String loadServerOrNativeClientConfig(boolean client) {
    String config = loadConfiguration("Ignite configuration", "ignite.xml");
    ConfigFileTemplate template = new ConfigFileTemplate(config).withAgents(agents);
    StringBuilder addresses = new StringBuilder();
    for (AgentData agent : agents) {
        addresses.append("<value>").append(agent.getPrivateAddress()).append("</value>");
    }
    template.addReplacement("<!--ADDRESSES-->", addresses.toString());
    template.addReplacement("<!--CLIENT_MODE-->", client);
    return template.render();
}
Also used : ConfigFileTemplate(com.hazelcast.simulator.coordinator.ConfigFileTemplate) AgentData(com.hazelcast.simulator.coordinator.registry.AgentData)

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