forked from frankframework/frankframework
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add test for ResultSetIteratingPipe (frankframework#2071)
- Loading branch information
Showing
15 changed files
with
374 additions
and
70 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
90 changes: 90 additions & 0 deletions
90
core/src/test/java/nl/nn/adapterframework/jdbc/JdbcEnabledPipeTestBase.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
package nl.nn.adapterframework.jdbc; | ||
|
||
import org.junit.After; | ||
import org.junit.Before; | ||
|
||
import nl.nn.adapterframework.configuration.ConfigurationException; | ||
import nl.nn.adapterframework.configuration.ConfigurationWarnings; | ||
import nl.nn.adapterframework.core.Adapter; | ||
import nl.nn.adapterframework.core.IPipe; | ||
import nl.nn.adapterframework.core.PipeForward; | ||
import nl.nn.adapterframework.core.PipeLine; | ||
import nl.nn.adapterframework.core.PipeLineExit; | ||
import nl.nn.adapterframework.core.PipeLineSession; | ||
import nl.nn.adapterframework.core.PipeRunException; | ||
import nl.nn.adapterframework.core.PipeRunResult; | ||
import nl.nn.adapterframework.stream.Message; | ||
import nl.nn.adapterframework.testutil.TestConfiguration; | ||
|
||
public abstract class JdbcEnabledPipeTestBase<P extends IPipe> extends JdbcTestBase { | ||
|
||
protected PipeLineSession session = new PipeLineSession(); | ||
|
||
protected P pipe; | ||
protected PipeLine pipeline; | ||
protected Adapter adapter; | ||
private static TestConfiguration configuration; | ||
|
||
private TestConfiguration getConfiguration() { | ||
if(configuration == null) { | ||
configuration = new TestConfiguration(); | ||
} | ||
return configuration; | ||
} | ||
|
||
public abstract P createPipe(); | ||
|
||
@Override | ||
@Before | ||
public void setup() throws Exception { | ||
super.setup(); | ||
pipe = createPipe(); | ||
autowireByType(pipe); | ||
pipe.registerForward(new PipeForward("success", "exit")); | ||
pipe.setName(pipe.getClass().getSimpleName()+" under test"); | ||
pipeline = getConfiguration().createBean(PipeLine.class); | ||
pipeline.addPipe(pipe); | ||
PipeLineExit exit = new PipeLineExit(); | ||
exit.setPath("exit"); | ||
exit.setState("success"); | ||
pipeline.registerPipeLineExit(exit); | ||
adapter = getConfiguration().createBean(Adapter.class); | ||
adapter.setName("TestAdapter-for-".concat(pipe.getClass().getSimpleName())); | ||
adapter.setPipeLine(pipeline); | ||
} | ||
|
||
@After | ||
public void tearDown() throws Exception { | ||
getConfigurationWarnings().destroy(); | ||
getConfigurationWarnings().afterPropertiesSet(); | ||
pipe = null; | ||
pipeline = null; | ||
adapter = null; | ||
} | ||
|
||
protected void autowireByType(Object bean) { | ||
getConfiguration().autowireByType(bean); | ||
} | ||
|
||
protected void autowireByName(Object bean) { | ||
getConfiguration().autowireByName(bean); | ||
} | ||
|
||
protected ConfigurationWarnings getConfigurationWarnings() { | ||
return getConfiguration().getConfigurationWarnings(); | ||
} | ||
|
||
/** | ||
* Configure the pipe, don't forget to call {@link IPipe#start()} after configuring! | ||
*/ | ||
protected void configurePipe() throws ConfigurationException { | ||
pipeline.configure(); | ||
} | ||
|
||
protected PipeRunResult doPipe(String input) throws PipeRunException { | ||
return doPipe(new Message(input)); | ||
} | ||
protected PipeRunResult doPipe(Message input) throws PipeRunException { | ||
return pipe.doPipe(input, session); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.