diff options
author | clemenso <clemenso@8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4> | 2009-01-22 13:21:50 +0000 |
---|---|---|
committer | clemenso <clemenso@8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4> | 2009-01-22 13:21:50 +0000 |
commit | 212bbffc24ccc1cd909cabdc9650491dd221cd60 (patch) | |
tree | 8dcd8b042ed6fab53cfecd5df251acf1da8b5d04 /STALService/src/test/java/at/gv | |
parent | 041e02b585ff5f90e806dfb96c3065620aa655b1 (diff) | |
download | mocca-212bbffc24ccc1cd909cabdc9650491dd221cd60.tar.gz mocca-212bbffc24ccc1cd909cabdc9650491dd221cd60.tar.bz2 mocca-212bbffc24ccc1cd909cabdc9650491dd221cd60.zip |
STALTranslator
git-svn-id: https://joinup.ec.europa.eu/svn/mocca/trunk@283 8a26b1a7-26f0-462f-b9ef-d0e30c41f5a4
Diffstat (limited to 'STALService/src/test/java/at/gv')
-rw-r--r-- | STALService/src/test/java/at/gv/egiz/stal/service/translator/STALTranslatorTest.java | 146 |
1 files changed, 146 insertions, 0 deletions
diff --git a/STALService/src/test/java/at/gv/egiz/stal/service/translator/STALTranslatorTest.java b/STALService/src/test/java/at/gv/egiz/stal/service/translator/STALTranslatorTest.java new file mode 100644 index 00000000..1dad7973 --- /dev/null +++ b/STALService/src/test/java/at/gv/egiz/stal/service/translator/STALTranslatorTest.java @@ -0,0 +1,146 @@ +/* + * To change this template, choose Tools | Templates + * and open the template in the editor. + */ + +package at.gv.egiz.stal.service.translator; + +import at.gv.egiz.stal.STALRequest; +import at.gv.egiz.stal.STALResponse; +import at.gv.egiz.stal.SignRequest; +import at.gv.egiz.stal.service.translator.STALTranslator.TranslationHandler; +import at.gv.egiz.stal.service.types.ObjectFactory; +import at.gv.egiz.stal.service.types.RequestType; +import at.gv.egiz.stal.service.types.ResponseType; +import at.gv.egiz.stal.service.types.SignRequestType; +import javax.xml.bind.JAXBElement; +import javax.xml.namespace.QName; +import org.junit.After; +import org.junit.AfterClass; +import org.junit.Before; +import org.junit.BeforeClass; +import org.junit.Ignore; +import org.junit.Test; +import static org.junit.Assert.*; + +/** + * + * @author clemens + */ +public class STALTranslatorTest { + + static ObjectFactory of; + + public STALTranslatorTest() { + } + + @BeforeClass + public static void setUpClass() throws Exception { + of = new ObjectFactory(); + } + + @AfterClass + public static void tearDownClass() throws Exception { + } + + @Before + public void setUp() { + } + + @After + public void tearDown() { + } + + /** + * Test of registerTranslationHandler method, of class STALTranslator. + */ + @Test + @Ignore + public void testRegisterTranslationHandler() { + System.out.println("registerTranslationHandler"); + TranslationHandler handler = null; + STALTranslator instance = new STALTranslator(); + instance.registerTranslationHandler(handler); + + // TODO review the generated test code and remove the default call to fail. + fail("The test case is a prototype."); + } + + /** + * Test of translate method, of class STALTranslator. + */ + @Test + public void testTranslate_STALRequest() throws Exception { + System.out.println("translate"); + SignRequest request = new SignRequest(); + request.setKeyIdentifier("kid"); + request.setSignedInfo("signedinfo".getBytes()); + STALTranslator instance = new STALTranslator(); + JAXBElement<? extends RequestType> result = instance.translate(request); + assertEquals(SignRequestType.class, result.getValue().getClass()); + SignRequestType resultT = (SignRequestType) result.getValue(); + assertEquals(request.getKeyIdentifier(), resultT.getKeyIdentifier()); + assertEquals(request.getSignedInfo(), resultT.getSignedInfo()); + } + + /** + * Test of translate method, of class STALTranslator. + */ + @Test + public void testTranslate_1args_1() throws Exception { + System.out.println("translate"); + SignRequestType req = of.createSignRequestType(); + req.setKeyIdentifier("kid"); + req.setSignedInfo("signedinfo".getBytes()); + JAXBElement<? extends RequestType> request = of.createGetNextRequestResponseTypeSignRequest(req); + STALTranslator instance = new STALTranslator(); + STALRequest result = instance.translate(request); + assertEquals(SignRequest.class, result.getClass()); + assertEquals(req.getKeyIdentifier(), ((SignRequest) result).getKeyIdentifier()); + assertEquals(req.getSignedInfo(), ((SignRequest) result).getSignedInfo()); + } + + @Test(expected=RuntimeException.class) + public void testTranslate_invalidInput() throws Exception { + System.out.println("translate"); + QName n = new QName("http://www.egiz.gv.at/stal", "SignRequest"); + JAXBElement<? extends RequestType> request = new JAXBElement<SignRequestType>(n, SignRequestType.class, null); + STALTranslator instance = new STALTranslator(); + STALRequest result = instance.translate(request); + assertEquals(SignRequest.class, result.getClass()); + } + + + /** + * Test of translate method, of class STALTranslator. + */ + @Test + @Ignore + public void testTranslate_STALResponse() throws Exception { + System.out.println("translate"); + STALResponse response = null; + STALTranslator instance = new STALTranslator(); + JAXBElement<? extends ResponseType> expResult = null; + JAXBElement<? extends ResponseType> result = instance.translate(response); + assertEquals(expResult, result); + // TODO review the generated test code and remove the default call to fail. + fail("The test case is a prototype."); + } + + /** + * Test of translate method, of class STALTranslator. + */ + @Test + @Ignore + public void testTranslate_1args_2() throws Exception { + System.out.println("translate"); + JAXBElement<? extends ResponseType> response = null; + STALTranslator instance = new STALTranslator(); + STALResponse expResult = null; + STALResponse result = instance.translate(response); + assertEquals(expResult, result); + // TODO review the generated test code and remove the default call to fail. + fail("The test case is a prototype."); + } + +}
\ No newline at end of file |