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/DatabaseTests.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/DatabaseTests.java')
-rw-r--r-- | DocumentService/src/eu/stork/documentservice/tests/DatabaseTests.java | 265 |
1 files changed, 0 insertions, 265 deletions
diff --git a/DocumentService/src/eu/stork/documentservice/tests/DatabaseTests.java b/DocumentService/src/eu/stork/documentservice/tests/DatabaseTests.java deleted file mode 100644 index a888f0737..000000000 --- a/DocumentService/src/eu/stork/documentservice/tests/DatabaseTests.java +++ /dev/null @@ -1,265 +0,0 @@ -package eu.stork.documentservice.tests; - -import static org.junit.Assert.*; - -import java.util.Date; -import java.util.UUID; - -import org.junit.Test; - -import eu.stork.documentservice.data.DatabaseConnector; -import eu.stork.documentservice.data.DatabaseConnectorMySQLImpl; -import eu.stork.documentservice.exceptions.DatabaseException; -import eu.stork.documentservice.model.DocumentModel; -import eu.stork.documentservice.model.RequestModel; -import eu.stork.documentservice.model.TempDocumentModel; -import eu.stork.documentservice.utils.Utils; - -public class DatabaseTests { - - private String user = "stork"; - private String password = "stork"; - private String database = "stork"; - private String server = "localhost:3306"; - private String pdfLoc = "C:/Temp/temp.pdf"; - private String destCountry = "AT"; - private String spCountry = "IS"; - private String spId = "Demo-SP"; - private String xmlrequest = "<xml><data>foo</data>"; - private String xmlresponse = "<xml><data>foo_signed</data>"; - private static String docId = ""; - private static String docId2 = ""; - private static String reqId = ""; - - public DatabaseTests() - { - if (docId.isEmpty()) - docId = UUID.randomUUID().toString(); - if (docId2.isEmpty()) - docId2 = UUID.randomUUID().toString(); - if (reqId.isEmpty()) - reqId = UUID.randomUUID().toString(); - } - - @Test - //Test adding document - public void test1() { - DatabaseConnector conn = new DatabaseConnectorMySQLImpl(user, password, server, database); - DocumentModel document = new DocumentModel(); - document.setDocid(docId); - document.setDocument(Utils.readData(pdfLoc)); - document.setFilename("pdfdoc.pdf"); - document.setMimetype("application/pdf"); - - try - { - boolean ok = conn.addDocument(document); - assertTrue(ok); - } - catch (DatabaseException ex) - { - ex.printStackTrace(); - } - } - - @Test - //Test getting document - public void test2() - { - DatabaseConnector conn = new DatabaseConnectorMySQLImpl(user, password, server, database); - try - { - DocumentModel document = conn.getDocument(docId); - assertNotNull(document); - } - catch (DatabaseException ex) - { - ex.printStackTrace(); - } - } - - @Test - //Test updating document - public void test3() - { - DatabaseConnector conn = new DatabaseConnectorMySQLImpl(user, password, server, database); - try - { - DocumentModel document = conn.getDocument(docId); - boolean ok = conn.updateDocument(document); - assertTrue(ok); - } - catch (DatabaseException ex) - { - ex.printStackTrace(); - } - } - - @Test - //Test deleting document - public void test4() - { - DatabaseConnector conn = new DatabaseConnectorMySQLImpl(user, password, server, database); - try - { - boolean ok = conn.deleteDocument(docId); - assertTrue(ok); - } - catch (DatabaseException ex) - { - ex.printStackTrace(); - } - } - - @Test - //Test adding new request - public void test5() - { - DatabaseConnector conn = new DatabaseConnectorMySQLImpl(user, password, server, database); - RequestModel request = new RequestModel(); - request.setRequestid(reqId); - request.setDestcountry(destCountry); - request.setSpcountry(spCountry); - request.setSpid(spId); - request.setXmlrequest(xmlrequest); - - try - { - boolean ok = conn.addRequest(request); - assertTrue(ok); - } - catch (DatabaseException ex) - { - ex.printStackTrace(); - } - } - - @Test - //Test getting request - public void test6() - { - DatabaseConnector conn = new DatabaseConnectorMySQLImpl(user, password, server, database); - - try - { - RequestModel request = conn.getRequest(reqId); - assertNotNull(request); - } - catch (DatabaseException ex) - { - ex.printStackTrace(); - } - } - - @Test - //Test updating request - public void test7() - { - DatabaseConnector conn = new DatabaseConnectorMySQLImpl(user, password, server, database); - - try - { - RequestModel request = conn.getRequest(reqId); - request.setDocid(docId); - boolean ok = conn.updateRequest(request); - assertTrue(ok); - } - catch (DatabaseException ex) - { - ex.printStackTrace(); - } - } - - @Test - //Test getting new request - public void test8() - { - DatabaseConnector conn = new DatabaseConnectorMySQLImpl(user, password, server, database); - - try - { - RequestModel request = conn.getRequest(reqId); - request.setXmlresponse(xmlresponse); - request.setRestimestamp(new Date()); - boolean ok = conn.updateRequest(request); - assertTrue(ok); - } - catch (DatabaseException ex) - { - ex.printStackTrace(); - } - } - - - @Test - //Test add temp document - public void test10() - { - DatabaseConnector conn = new DatabaseConnectorMySQLImpl(user, password, server, database); - TempDocumentModel document = new TempDocumentModel(); - document.setDocid(docId2); - document.setDocument(Utils.readData(pdfLoc)); - document.setSpid(spId); - //document.setFilename("pdfdoc.pdf"); - document.setMimetype("application/pdf"); - - try - { - boolean ok = conn.addTempDocument(document); - assertTrue(ok); - } - catch (DatabaseException ex) - { - ex.printStackTrace(); - } - } - - @Test - //Test getting temp document - public void test11() - { - DatabaseConnector conn = new DatabaseConnectorMySQLImpl(user, password, server, database); - try - { - TempDocumentModel document = conn.getTempDocument(docId2); - assertNotNull(document); - } - catch (DatabaseException ex) - { - ex.printStackTrace(); - } - } - - @Test - //Test updating temp document - public void test12() - { - DatabaseConnector conn = new DatabaseConnectorMySQLImpl(user, password, server, database); - try - { - TempDocumentModel document = conn.getTempDocument(docId2); - boolean ok = conn.updateTempDocument(document); - assertTrue(ok); - } - catch (DatabaseException ex) - { - ex.printStackTrace(); - } - } - - @Test - //Test delete temp document - public void test13() - { - DatabaseConnector conn = new DatabaseConnectorMySQLImpl(user, password, server, database); - try - { - boolean ok = conn.deleteTempDocument(docId2); - assertTrue(ok); - } - catch (DatabaseException ex) - { - ex.printStackTrace(); - } - } -} |