Assert.assertEquals(inputProcessorChain.getProcessors().get(5), inputProcessor2);
}
@Test
public void testAddProcessorBefore1() {
InputProcessorChainImpl inputProcessorChain = new InputProcessorChainImpl(new InboundSecurityContextImpl());
AbstractInputProcessor inputProcessor1 = new AbstractInputProcessor() {
};
inputProcessorChain.addProcessor(inputProcessor1);
AbstractInputProcessor inputProcessor2 = new AbstractInputProcessor() {
};
inputProcessor2.setPhase(XMLSecurityConstants.Phase.PREPROCESSING);
inputProcessorChain.addProcessor(inputProcessor2);
AbstractInputProcessor inputProcessor3 = new AbstractInputProcessor() {
};
inputProcessor3.setPhase(XMLSecurityConstants.Phase.POSTPROCESSING);
inputProcessorChain.addProcessor(inputProcessor3);
AbstractInputProcessor inputProcessor4 = new AbstractInputProcessor() {
};
inputProcessor4.setPhase(XMLSecurityConstants.Phase.POSTPROCESSING);
inputProcessor4.addBeforeProcessor(inputProcessor3.getClass().getName());
inputProcessorChain.addProcessor(inputProcessor4);
AbstractInputProcessor inputProcessor5 = new AbstractInputProcessor() {
};
inputProcessor5.setPhase(XMLSecurityConstants.Phase.PREPROCESSING);
inputProcessor5.addBeforeProcessor(inputProcessor2.getClass().getName());
inputProcessorChain.addProcessor(inputProcessor5);
AbstractInputProcessor inputProcessor6 = new AbstractInputProcessor() {
};
inputProcessor6.addBeforeProcessor(inputProcessor1.getClass().getName());
inputProcessorChain.addProcessor(inputProcessor6);
Assert.assertEquals(inputProcessorChain.getProcessors().get(0), inputProcessor3);
Assert.assertEquals(inputProcessorChain.getProcessors().get(1), inputProcessor4);
Assert.assertEquals(inputProcessorChain.getProcessors().get(2), inputProcessor1);
Assert.assertEquals(inputProcessorChain.getProcessors().get(3), inputProcessor6);
Assert.assertEquals(inputProcessorChain.getProcessors().get(4), inputProcessor2);
Assert.assertEquals(inputProcessorChain.getProcessors().get(5), inputProcessor5);
}