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

minor changes

parent cdc72e42
Branches
Tags
No related merge requests found
...@@ -310,7 +310,7 @@ public abstract class AbstractStage { ...@@ -310,7 +310,7 @@ public abstract class AbstractStage {
Class<?> targetType = port.getType(); Class<?> targetType = port.getType();
Class<?> sourceType = port.pipe.getSourcePort().getType(); Class<?> sourceType = port.pipe.getSourcePort().getType();
if (targetType != null && sourceType != null) { if (targetType != null && sourceType != null) {
if (!targetType.isAssignableFrom(sourceType)) { // TODO: Is this correct? // kinda instanceof, but for Class class if (!targetType.isAssignableFrom(sourceType)) { // if targetType is not superclass of sourceType
invalidPortConnections.add(new InvalidPortConnection(port.pipe.getSourcePort(), port)); invalidPortConnections.add(new InvalidPortConnection(port.pipe.getSourcePort(), port));
// throw new IllegalStateException("2002 - Invalid pipe at " + port.toString() + ": " + targetType + " is not a superclass/type of " + // throw new IllegalStateException("2002 - Invalid pipe at " + port.toString() + ": " + targetType + " is not a superclass/type of " +
// sourceType); // sourceType);
......
...@@ -103,15 +103,18 @@ public class AbstractStageTest { ...@@ -103,15 +103,18 @@ public class AbstractStageTest {
@Test(expected = AnalysisNotValidException.class) @Test(expected = AnalysisNotValidException.class)
public void testCheckTypeCompliance() throws Exception { public void testCheckTypeCompliance() throws Exception {
try { try {
// Correct connection
new Execution<Configuration>(new TestConnectionsConfig(false), true).executeBlocking(); new Execution<Configuration>(new TestConnectionsConfig(false), true).executeBlocking();
} catch (AnalysisNotValidException e) { } catch (AnalysisNotValidException e) {
fail(); fail();
} }
// Incorrect connection should fail!
new Execution<Configuration>(new TestConnectionsConfig(true), true).executeBlocking(); new Execution<Configuration>(new TestConnectionsConfig(true), true).executeBlocking();
} }
private class TestConnectionsConfig extends Configuration { private class TestConnectionsConfig extends Configuration {
@SuppressWarnings({ "unchecked", "rawtypes" })
TestConnectionsConfig(final boolean fails) { TestConnectionsConfig(final boolean fails) {
EmptyStage stage = new EmptyStage(); EmptyStage stage = new EmptyStage();
if (fails) { if (fails) {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please to comment