use of com.robo4j.core.configuration.Configuration 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;
}
use of com.robo4j.core.configuration.Configuration in project robo4j by Robo4J.
the class SchedulePeriodUnitTest method basicScheudlePeriodUnitTest.
@Test
public void basicScheudlePeriodUnitTest() throws ConfigurationException {
RoboSystem system = new RoboSystem();
Configuration config = ConfigurationFactory.createEmptyConfiguration();
SchedulePeriodUnit unit = new SchedulePeriodUnit(system, "schedulePeriodUnit");
config.setString("unit", "test");
config.setInteger("delay", 1);
config.setInteger("period", 1);
config.setString("timeUnit", "SECONDS");
unit.initialize(config);
Assert.assertTrue(unit.getState().equals(LifecycleState.INITIALIZED));
}
Aggregations