From b1c8641a63a67e3c64d948f9e8dce5c01e11e2dd Mon Sep 17 00:00:00 2001 From: mcentner Date: Wed, 5 May 2010 15:29:01 +0000 Subject: Merged feature branch mocca-1.2.13-id@r724 back to trunk. git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@725 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4 --- .../slcommands/impl/InfoboxReadComandImplTest.java | 47 +++++++++++++--------- 1 file changed, 29 insertions(+), 18 deletions(-) (limited to 'bkucommon/src/test/java/at/gv/egiz/bku/slcommands/impl/InfoboxReadComandImplTest.java') diff --git a/bkucommon/src/test/java/at/gv/egiz/bku/slcommands/impl/InfoboxReadComandImplTest.java b/bkucommon/src/test/java/at/gv/egiz/bku/slcommands/impl/InfoboxReadComandImplTest.java index bfc784f7..814ef8a9 100644 --- a/bkucommon/src/test/java/at/gv/egiz/bku/slcommands/impl/InfoboxReadComandImplTest.java +++ b/bkucommon/src/test/java/at/gv/egiz/bku/slcommands/impl/InfoboxReadComandImplTest.java @@ -40,18 +40,20 @@ import at.gv.egiz.bku.slexceptions.SLCommandException; import at.gv.egiz.bku.slexceptions.SLRequestException; import at.gv.egiz.bku.slexceptions.SLRuntimeException; import at.gv.egiz.bku.slexceptions.SLVersionException; +import at.gv.egiz.bku.utils.urldereferencer.URLDereferencer; import at.gv.egiz.stal.STAL; -import at.gv.egiz.stal.dummy.DummySTAL; +import at.gv.egiz.stal.STALFactory; //@Ignore public class InfoboxReadComandImplTest { - private static ApplicationContext appCtx; + protected static ApplicationContext appCtx; + private SLCommandFactory factory; + + private STAL stal; + + private URLDereferencer urlDereferencer; - private SLCommandFactory factory; - - private STAL stal; - @BeforeClass public static void setUpClass() { appCtx = new ClassPathXmlApplicationContext("at/gv/egiz/bku/slcommands/testApplicationContext.xml"); @@ -59,8 +61,20 @@ public class InfoboxReadComandImplTest { @Before public void setUp() { - factory = SLCommandFactory.getInstance(); - stal = new DummySTAL(); + Object bean = appCtx.getBean("slCommandFactory"); + assertTrue(bean instanceof SLCommandFactory); + + factory = (SLCommandFactory) bean; + + bean = appCtx.getBean("stalFactory"); + assertTrue(bean instanceof STALFactory); + + stal = ((STALFactory) bean).createSTAL(); + + bean = appCtx.getBean("urlDereferencer"); + assertTrue(bean instanceof URLDereferencer); + + urlDereferencer = (URLDereferencer) bean; } @Test @@ -68,12 +82,12 @@ public class InfoboxReadComandImplTest { InputStream inputStream = getClass().getClassLoader().getResourceAsStream("at/gv/egiz/bku/slcommands/infoboxreadcommand/IdentityLink.Binary.xml"); assertNotNull(inputStream); - SLCommandContext context = new SLCommandContext(); + SLCommandContext context = new SLCommandContext(stal, urlDereferencer); context.setSTAL(stal); - SLCommand command = factory.createSLCommand(new StreamSource(inputStream), context); + SLCommand command = factory.createSLCommand(new StreamSource(inputStream)); assertTrue(command instanceof InfoboxReadCommand); - SLResult result = command.execute(); + SLResult result = command.execute(context); result.writeTo(new StreamResult(System.out), false); } @@ -82,9 +96,7 @@ public class InfoboxReadComandImplTest { InputStream inputStream = getClass().getClassLoader().getResourceAsStream("at/gv/egiz/bku/slcommands/infoboxreadcommand/IdentityLink.Binary.Invalid-1.xml"); assertNotNull(inputStream); - SLCommandContext context = new SLCommandContext(); - context.setSTAL(stal); - SLCommand command = factory.createSLCommand(new StreamSource(inputStream), context); + SLCommand command = factory.createSLCommand(new StreamSource(inputStream)); assertTrue(command instanceof InfoboxReadCommand); } @@ -92,12 +104,11 @@ public class InfoboxReadComandImplTest { InputStream inputStream = getClass().getClassLoader().getResourceAsStream("at/gv/egiz/bku/slcommands/infoboxreadcommand/IdentityLink.Binary.Invalid-2.xml"); assertNotNull(inputStream); - SLCommandContext context = new SLCommandContext(); - context.setSTAL(stal); - SLCommand command = factory.createSLCommand(new StreamSource(inputStream), context); + SLCommandContext context = new SLCommandContext(stal, urlDereferencer); + SLCommand command = factory.createSLCommand(new StreamSource(inputStream)); assertTrue(command instanceof InfoboxReadCommand); - SLResult result = command.execute(); + SLResult result = command.execute(context); assertTrue(result instanceof ErrorResult); } -- cgit v1.2.3