Skip to content
Snippets Groups Projects
Commit 3c77564c authored by Nelson Tavares de Sousa's avatar Nelson Tavares de Sousa
Browse files

compliance check is run by the ValidatingSignal now

parent 16dcf601
No related branches found
No related tags found
No related merge requests found
...@@ -29,7 +29,6 @@ import org.slf4j.LoggerFactory; ...@@ -29,7 +29,6 @@ import org.slf4j.LoggerFactory;
import teetime.framework.exceptionHandling.AbstractExceptionListener; import teetime.framework.exceptionHandling.AbstractExceptionListener;
import teetime.framework.exceptionHandling.AbstractExceptionListener.FurtherExecution; import teetime.framework.exceptionHandling.AbstractExceptionListener.FurtherExecution;
import teetime.framework.exceptionHandling.TerminateException; import teetime.framework.exceptionHandling.TerminateException;
import teetime.framework.pipe.IPipe;
import teetime.framework.signal.ISignal; import teetime.framework.signal.ISignal;
import teetime.framework.signal.StartingSignal; import teetime.framework.signal.StartingSignal;
import teetime.framework.signal.TerminatingSignal; import teetime.framework.signal.TerminatingSignal;
...@@ -279,7 +278,7 @@ public abstract class AbstractStage { ...@@ -279,7 +278,7 @@ public abstract class AbstractStage {
} }
public void onValidating(final List<InvalidPortConnection> invalidPortConnections) { public void onValidating(final List<InvalidPortConnection> invalidPortConnections) {
this.validateOutputPorts(invalidPortConnections); this.checkTypeCompliance();
changeState(StageState.VALIDATED); changeState(StageState.VALIDATED);
} }
...@@ -292,7 +291,6 @@ public abstract class AbstractStage { ...@@ -292,7 +291,6 @@ public abstract class AbstractStage {
*/ */
@SuppressWarnings("PMD.SignatureDeclareThrowsException") @SuppressWarnings("PMD.SignatureDeclareThrowsException")
public void onStarting() throws Exception { public void onStarting() throws Exception {
checkTypeCompliance();
if (logger.isDebugEnabled()) { if (logger.isDebugEnabled()) {
logger.debug("Stage {} within thread {}", getId(), getOwningThread().getId()); logger.debug("Stage {} within thread {}", getId(), getOwningThread().getId());
} }
...@@ -446,26 +444,6 @@ public abstract class AbstractStage { ...@@ -446,26 +444,6 @@ public abstract class AbstractStage {
return outputPort; return outputPort;
} }
/**
* This should check, if the OutputPorts are connected correctly. This is needed to avoid NullPointerExceptions and other errors.
*
* @param invalidPortConnections
* <i>(Passed as parameter for performance reasons)</i>
*/
@SuppressWarnings("PMD.DataflowAnomalyAnalysis")
public void validateOutputPorts(final List<InvalidPortConnection> invalidPortConnections) {
for (OutputPort<?> outputPort : outputPorts.getOpenedPorts()) {
final IPipe<?> pipe = outputPort.getPipe();
final Class<?> sourcePortType = outputPort.getType();
final Class<?> targetPortType = pipe.getTargetPort().getType();
if (null == sourcePortType || !sourcePortType.equals(targetPortType)) {
final InvalidPortConnection invalidPortConnection = new InvalidPortConnection(outputPort, pipe.getTargetPort());
invalidPortConnections.add(invalidPortConnection);
}
}
}
protected void terminate() { protected void terminate() {
changeState(StageState.TERMINATING); changeState(StageState.TERMINATING);
} }
......
...@@ -95,7 +95,7 @@ public class AbstractStageTest { ...@@ -95,7 +95,7 @@ public class AbstractStageTest {
@Test @Test
public void testCheckTypeCompliance() throws Exception { public void testCheckTypeCompliance() throws Exception {
new Execution<Configuration>(new TestConnectionsConfig(false)); new Execution<Configuration>(new TestConnectionsConfig(false), true);
} }
private class TestConnectionsConfig extends Configuration { private class TestConnectionsConfig extends Configuration {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment