Search in sources :

Example 1 with StringProducer

use of com.robo4j.core.StringProducer in project robo4j by Robo4J.

the class RoboHttpPingPongTest method configurePingSystem.

private RoboSystem configurePingSystem() throws Exception {
    final RoboSystem result = new RoboSystem();
    Configuration config = ConfigurationFactory.createEmptyConfiguration();
    HttpClientUnit httpClient = new HttpClientUnit(result, "http_client");
    config.setString("address", HOST_SYSTEM);
    config.setInteger("port", PORT);
    /* specific configuration */
    Configuration targetUnits = config.createChildConfiguration(RoboHttpUtils.HTTP_TARGET_UNITS);
    targetUnits.setString(CONTROLLER_PING_PONG, "POST");
    httpClient.initialize(config);
    StringProducer producer = new StringProducer(result, "http_producer");
    config = ConfigurationFactory.createEmptyConfiguration();
    config.setString("target", "http_client");
    config.setString("method", "POST");
    config.setString("uri", "/controller");
    config.setString("targetAddress", HOST_SYSTEM);
    producer.initialize(config);
    result.addUnits(producer, httpClient);
    return result;
}
Also used : RoboSystem(com.robo4j.core.RoboSystem) Configuration(com.robo4j.core.configuration.Configuration) StringProducer(com.robo4j.core.StringProducer)

Aggregations

RoboSystem (com.robo4j.core.RoboSystem)1 StringProducer (com.robo4j.core.StringProducer)1 Configuration (com.robo4j.core.configuration.Configuration)1