diff options
author | Thomas Lenz <tlenz@iaik.tugraz.at> | 2016-02-17 07:00:09 +0100 |
---|---|---|
committer | Thomas Lenz <tlenz@iaik.tugraz.at> | 2016-02-17 07:00:09 +0100 |
commit | 07c6114a266a67abd404bac8703c1a17e035d69d (patch) | |
tree | 893d8a4873566b2bf3d4dc8d35d02e636a9d38cd /DocumentService/src/eu/stork/documentservice/tests/DocumentServiceTests.java | |
parent | 274a85e53fa8c06a869f2bb3a7bd24300ee9b3fd (diff) | |
download | moa-id-spss-07c6114a266a67abd404bac8703c1a17e035d69d.tar.gz moa-id-spss-07c6114a266a67abd404bac8703c1a17e035d69d.tar.bz2 moa-id-spss-07c6114a266a67abd404bac8703c1a17e035d69d.zip |
remove STORK code --> MOA-ID >= 3.2 only supports eIDAS protocol
Diffstat (limited to 'DocumentService/src/eu/stork/documentservice/tests/DocumentServiceTests.java')
-rw-r--r-- | DocumentService/src/eu/stork/documentservice/tests/DocumentServiceTests.java | 123 |
1 files changed, 0 insertions, 123 deletions
diff --git a/DocumentService/src/eu/stork/documentservice/tests/DocumentServiceTests.java b/DocumentService/src/eu/stork/documentservice/tests/DocumentServiceTests.java deleted file mode 100644 index 0d27cf044..000000000 --- a/DocumentService/src/eu/stork/documentservice/tests/DocumentServiceTests.java +++ /dev/null @@ -1,123 +0,0 @@ -package eu.stork.documentservice.tests; - -import static org.junit.Assert.*; - -import java.net.MalformedURLException; -import java.net.URL; - -import javax.xml.namespace.QName; -import javax.xml.ws.BindingProvider; -import javax.xml.ws.Service; -import javax.xml.ws.soap.SOAPBinding; - -import org.junit.Test; - -import eu.stork.documentservice.DocumentService; -import eu.stork.documentservice.exceptions.DocumentServiceException; -import eu.stork.documentservice.utils.Utils; -import eu.stork.documentservice.utils.XmlHelper; - -public class DocumentServiceTests { - - private static String xmlrequest = "<dss:SignRequest xmlns:dss=\"urn:oasis:names:tc:dss:1.0:core:schema\" RequestID=\"_d96b62a87d18f1095180b1f44c90b5fd\"><dss:InputDocuments><dss:Document><dss:Base64Data MimeType=\"text/plain\">VGVzdCB0ZXh0</dss:Base64Data></dss:Document></dss:InputDocuments></dss:SignRequest>"; - private static String docRequstLoc = "C:/Temp/AttrQueryRequestSdoc.xml"; - private static String docRequstLocMod = "C:/Temp/AttrQueryRequestSdocMod.xml"; - private static String destCountry = "AT"; - private static String spID ="DEMO-SP"; - - @Test - public void testXmlParsing() { - String reqId = null; - try { - reqId = XmlHelper.getRequestId(xmlrequest); - } catch (DocumentServiceException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - assertNotNull(reqId); - } - - @Test - public void testXmlParsingDocument() { - String doc = null; - try { - doc = XmlHelper.getRequestDocumentData(xmlrequest); - } catch (DocumentServiceException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - assertNotNull(doc); - } - - @Test - public void testXmlParsingDocumentMime() { - String mime = null; - try { - mime = XmlHelper.getRequestDocumentMime(xmlrequest); - } catch (DocumentServiceException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - assertNotNull(mime); - } - - @Test - public void testCheckTransferrequest() - { - byte[] docBytes = Utils.readData(docRequstLoc); - try { - String docId = XmlHelper.verifyRequestByte(docBytes); - assertTrue(!docId.isEmpty()); - } catch (DocumentServiceException e) { - // TODO Auto-generated catch block - e.printStackTrace(); - } - } - - @Test - public void testCheckTransferrequestMod() - { - byte[] docBytes = Utils.readData(docRequstLocMod); - try { - XmlHelper.verifyRequestByte(docBytes); - fail("testCheckTransferrequestMod(...) should've thrown an DocumentServiceException!"); - } catch (DocumentServiceException e) { - e.printStackTrace(); - //success("Exception thrown."); - } - } - - @Test - public void testAddDocument() - { - URL url = null; - try { - url = new URL("http://localhost:8080/DocumentService/DocumentService?wsdl"); - } catch (MalformedURLException e) { - e.printStackTrace(); - } - QName qname = new QName("http://stork.eu", - "DocumentService"); - - Service service = Service.create(url, qname); - DocumentService docservice = service.getPort(DocumentService.class); - - BindingProvider bp = (BindingProvider) docservice; - SOAPBinding binding = (SOAPBinding) bp.getBinding(); - binding.setMTOMEnabled(true); - - try - { - String doc = XmlHelper.getRequestDocumentData(xmlrequest); - byte[] docData = Utils.decodeBase64String(doc, false); - String mime = XmlHelper.getRequestDocumentMime(xmlrequest); - String docid = docservice.addDocument(docData, xmlrequest, destCountry, spID, mime, ""); - assertNotNull(docid); - } - catch (Exception ex) - { - ex.printStackTrace(); - } - } - -} |