diff options
author | mcentner <mcentner@8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4> | 2010-05-05 15:29:01 +0000 |
---|---|---|
committer | mcentner <mcentner@8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4> | 2010-05-05 15:29:01 +0000 |
commit | b1c8641a63a67e3c64d948f9e8dce5c01e11e2dd (patch) | |
tree | 0883f08a408f89f758e9a1be629232e3dd055c3a /bkucommon/src/test/java/at/gv/egiz/bku/slcommands/impl/SVPersonendatenInfoboxImplTest.java | |
parent | 83a9b613836910f7edc370c2fe60fa2268dc4461 (diff) | |
download | mocca-b1c8641a63a67e3c64d948f9e8dce5c01e11e2dd.tar.gz mocca-b1c8641a63a67e3c64d948f9e8dce5c01e11e2dd.tar.bz2 mocca-b1c8641a63a67e3c64d948f9e8dce5c01e11e2dd.zip |
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
Diffstat (limited to 'bkucommon/src/test/java/at/gv/egiz/bku/slcommands/impl/SVPersonendatenInfoboxImplTest.java')
-rw-r--r-- | bkucommon/src/test/java/at/gv/egiz/bku/slcommands/impl/SVPersonendatenInfoboxImplTest.java | 66 |
1 files changed, 39 insertions, 27 deletions
diff --git a/bkucommon/src/test/java/at/gv/egiz/bku/slcommands/impl/SVPersonendatenInfoboxImplTest.java b/bkucommon/src/test/java/at/gv/egiz/bku/slcommands/impl/SVPersonendatenInfoboxImplTest.java index a17f0797..2627de72 100644 --- a/bkucommon/src/test/java/at/gv/egiz/bku/slcommands/impl/SVPersonendatenInfoboxImplTest.java +++ b/bkucommon/src/test/java/at/gv/egiz/bku/slcommands/impl/SVPersonendatenInfoboxImplTest.java @@ -19,6 +19,7 @@ package at.gv.egiz.bku.slcommands.impl; import static org.junit.Assert.assertNotNull; import static org.junit.Assert.assertTrue; import iaik.asn1.CodingException; +import iaik.xml.crypto.XSecProvider; import java.io.IOException; import java.io.InputStream; @@ -29,7 +30,8 @@ import javax.xml.bind.Marshaller; import javax.xml.transform.stream.StreamResult; import javax.xml.transform.stream.StreamSource; -import org.junit.Ignore; +import org.junit.Before; +import org.junit.BeforeClass; import org.junit.Test; import org.springframework.context.ApplicationContext; import org.springframework.context.support.ClassPathXmlApplicationContext; @@ -47,8 +49,9 @@ 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 SVPersonendatenInfoboxImplTest {
@@ -70,22 +73,37 @@ public class SVPersonendatenInfoboxImplTest { (byte) 0x30, (byte) 0x30, (byte) 0x30, (byte) 0x30, (byte) 0x5a }; - private static ApplicationContext appCtx; + protected static ApplicationContext appCtx; + private SLCommandFactory factory; + + private STAL stal; - private SLCommandFactory factory;
-
- private STAL stal;
-
-// @BeforeClass + private URLDereferencer urlDereferencer; + + @BeforeClass public static void setUpClass() { appCtx = new ClassPathXmlApplicationContext("at/gv/egiz/bku/slcommands/testApplicationContext.xml"); + XSecProvider.addAsProvider(true); } + + @Before + public void setUp() { + 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; -// @Before
- public void setUp() {
- factory = SLCommandFactory.getInstance();
- stal = new DummySTAL();
- }
+ } @Test public void testEHIC() throws SLCommandException, JAXBException, CodingException, IOException { @@ -102,44 +120,38 @@ public class SVPersonendatenInfoboxImplTest { } - @Ignore
@Test
public void testInfboxReadRequest() throws SLCommandException, SLRuntimeException, SLRequestException, SLVersionException {
InputStream inputStream = getClass().getClassLoader().getResourceAsStream("at/gv/egiz/bku/slcommands/infoboxreadcommand/IdentityLink.Binary.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);
result.writeTo(new StreamResult(System.out), false);
}
- @Ignore
@Test(expected=SLCommandException.class)
public void testInfboxReadRequestInvalid1() throws SLCommandException, SLRuntimeException, SLRequestException, SLVersionException {
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);
}
- @Ignore
+ @Test
public void testInfboxReadRequestInvalid2() throws SLCommandException, SLRuntimeException, SLRequestException, SLVersionException {
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);
}
|