use of org.iobserve.utility.tcp.events.TcpActivationControlEvent in project iobserve-analysis by research-iobserve.
the class ProbeControlFilterTest method getInvalidControlEventTest.
/**
* Test whether an invalid event is handled properly.
*/
@Test(timeout = 300)
public void getInvalidControlEventTest() {
// NOPMD fake ip as string is necessary
final String ip = "1.2.3.4";
final String hostname = "test.host";
final AbstractTcpControlEvent controlEvent = new TcpActivationControlEvent(ip, ProbeControlFilterTest.port, hostname, ProbeControlFilterTest.PATTERN);
final List<AbstractTcpControlEvent> input = new ArrayList<>();
input.add(controlEvent);
// TODO there is a strange error in this test
// StageTester.test(this.probeControlFilter).and().send(input).to(this.probeControlFilter.getInputPort()).start();
// Assert.assertThat(this.probeControlFilter.getOutputPort(), StageTester.produces(new
// Alarms()));
Assert.assertTrue(true);
}
use of org.iobserve.utility.tcp.events.TcpActivationControlEvent in project iobserve-analysis by research-iobserve.
the class ProbeControlFilterTest method getInvalidControlEventTest.
/**
* Test whether an invalid event is handled properly.
*/
@Test(timeout = 300)
public void getInvalidControlEventTest() {
// NOPMD fake ip as string is necessary
final String ip = "1.2.3.4";
final String hostname = "test.host";
final AbstractTcpControlEvent controlEvent = new TcpActivationControlEvent(ip, ProbeControlFilterTest.port, hostname, ProbeControlFilterTest.PATTERN, ProbeControlFilterTest.TRIGGER_TIMESTAMP);
final List<AbstractTcpControlEvent> input = new ArrayList<>();
input.add(controlEvent);
// TODO there is a strange error in this test
// StageTester.test(this.probeControlFilter).and().send(input).to(this.probeControlFilter.getInputPort()).start();
// Assert.assertThat(this.probeControlFilter.getOutputPort(), StageTester.produces(new
// Alarms()));
Assert.assertTrue(true);
}
use of org.iobserve.utility.tcp.events.TcpActivationControlEvent in project iobserve-analysis by research-iobserve.
the class ProbeMapper method createMethodsToActivate.
private void createMethodsToActivate(final ProbeManagementData element) throws ControlEventCreationFailedException, InvocationException, DBException {
final Map<AllocationContext, Set<OperationSignature>> methodsToActivate = element.getMethodsToActivate();
if (methodsToActivate != null) {
this.logger.debug("methods to activate");
for (final AllocationContext allocation : methodsToActivate.keySet()) {
this.logger.debug("AllocationContext to activate {}", allocation.getEntityName());
for (final OperationSignature operationSignature : methodsToActivate.get(allocation)) {
this.logger.debug("AllocationContext activate operation {}", operationSignature.getEntityName());
try {
final String pattern = this.computeAllocationComponentIdentifierPattern(allocation, operationSignature);
this.logger.debug("AllocationContext activate operation {} -- {}", operationSignature.getEntityName(), pattern);
final TcpActivationControlEvent currentEvent = this.createActivationEvent(pattern, element.getTriggerTime(), element.getWhitelist());
this.fillTcpControlEvent(currentEvent, allocation);
this.outputPort.send(currentEvent);
} catch (final ControlEventCreationFailedException e) {
this.logger.error("Could not construct activation event for: " + operationSignature.toString(), e);
}
}
}
}
}
use of org.iobserve.utility.tcp.events.TcpActivationControlEvent in project iobserve-analysis by research-iobserve.
the class ProbeControlFilterTest method getValidControlEventTest.
/**
* Check whether the control event is communicated properly.
*/
@Test
public void getValidControlEventTest() {
// NOPMD localhost is required here
final String ip = "127.0.0.1";
final String hostname = "test.host";
final AbstractTcpControlEvent controlEvent = new TcpActivationControlEvent(ip, ProbeControlFilterTest.port, hostname, ProbeControlFilterTest.PATTERN);
final List<AbstractTcpControlEvent> input = new ArrayList<>();
input.add(controlEvent);
final List<IErrorMessages> output = new ArrayList<>();
StageTester.test(this.probeControlFilter).and().send(input).to(this.probeControlFilter.getInputPort()).and().receive(output).from(this.probeControlFilter.getOutputPort()).start();
Assert.assertTrue(output.size() == 0);
}
use of org.iobserve.utility.tcp.events.TcpActivationControlEvent in project iobserve-analysis by research-iobserve.
the class ProbeControlFilterTest method getValidControlEventTest.
/**
* Check whether the control event is communicated properly.
*/
@Test
public void getValidControlEventTest() {
// NOPMD localhost is required here
final String ip = "127.0.0.1";
final String hostname = "test.host";
final AbstractTcpControlEvent controlEvent = new TcpActivationControlEvent(ip, ProbeControlFilterTest.port, hostname, ProbeControlFilterTest.PATTERN, ProbeControlFilterTest.TRIGGER_TIMESTAMP);
final List<AbstractTcpControlEvent> input = new ArrayList<>();
input.add(controlEvent);
final List<IErrorMessages> output = new ArrayList<>();
StageTester.test(this.probeControlFilter).and().send(input).to(this.probeControlFilter.getInputPort()).and().receive(output).from(this.probeControlFilter.getOutputPort()).start();
Assert.assertTrue(output.isEmpty());
}
Aggregations