working on test for common siging test
authorJohn Kern <johnk@symbian.org>
Wed, 12 May 2010 11:54:19 -0700
changeset 18 5707b75503d5
parent 17 cad8819de653
child 19 e4b6ee329501
working on test for common siging test
SigningTS/client/client.pro
SigningTS/client/main.cpp
SigningTS/client/signingcommoncase.cpp
SigningTS/client/signingcommoncase.h
SigningTS/client/test.h
--- a/SigningTS/client/client.pro	Wed May 12 09:44:30 2010 -0700
+++ b/SigningTS/client/client.pro	Wed May 12 11:54:19 2010 -0700
@@ -16,7 +16,10 @@
 
 
 SOURCES += main.cpp \
-    buffer.cpp
+    buffer.cpp \
+    signingcommoncase.cpp
 
 HEADERS += \
-    buffer.h
+    buffer.h \
+    test.h \
+    signingcommoncase.h
--- a/SigningTS/client/main.cpp	Wed May 12 09:44:30 2010 -0700
+++ b/SigningTS/client/main.cpp	Wed May 12 11:54:19 2010 -0700
@@ -8,9 +8,11 @@
 
 #include "buffer.h"
 
+const QString BaseURL = "http://localhost:8080/?key=853b128a-0c18-42f2-835f-db9f5b6f7fb9&api=1&cmd=";
+
 QNetworkReply *addIMEI(QNetworkAccessManager *mgr)
 {
-    QString reqPOST = "http://localhost:8080/?key=853b128a-0c18-42f2-835f-db9f5b6f7fb9&api=1&cmd=addIMEI";
+    QString reqPOST = BaseURL + "addIMEI";
     QNetworkRequest request(QUrl(reqPOST.toUtf8()));
     request.setHeader(QNetworkRequest::ContentTypeHeader,"application/xhtml+xml");
 
@@ -31,16 +33,16 @@
 
 QNetworkReply *getDevCert(QNetworkAccessManager *mgr)
 {
-    QString reqPOST = "http://localhost:8080/?key=853b128a-0c18-42f2-835f-db9f5b6f7fb9&api=1&cmd=getDevCert&genID=456723322";
+    QString reqPOST = BaseURL + "getDevCert&genID=456723322";
     QNetworkRequest request(QUrl(reqPOST.toUtf8()));
     request.setHeader(QNetworkRequest::ContentTypeHeader,"application/xhtml+xml");
 
     return mgr->get(request);
 }
 
-QNetworkReply *getSubmission()
+QNetworkReply *getSubmission(QNetworkAccessManager *mgr)
 {
-    QString reqGET = "http://localhost:8080/?key=853b128a-0c18-42f2-835f-db9f5b6f7fb9&api=1&cmd=getSubmission&genID=456723322";
+    QString reqGET = BaseURL + "getSubmission&genID=456723322";
     QNetworkRequest request(QUrl(reqGET.toUtf8()));
 
     return mgr->get(request);
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SigningTS/client/signingcommoncase.cpp	Wed May 12 11:54:19 2010 -0700
@@ -0,0 +1,31 @@
+
+#include "signingcommoncase.h"
+
+SigningCommonCase::SigningCommonCase(QNetworkAccessManager &aMgr, QObject *parent) :
+    QObject(parent), mgr(aMgr)
+{
+    testBaseURL = ::BaseURL + "?key=" + ::DefaultKey + "&api=" + ApiVersion + "&cmd=";
+}
+
+void SigningCommonCase::run()
+{
+
+}
+
+void SigningCommonCase::uploadSIS()
+{
+    QString reqPOST = BaseURL + "uploadSIS";
+    QNetworkRequest request(QUrl(reqPOST.toUtf8()));
+    request.setHeader(QNetworkRequest::ContentTypeHeader,"x-epoc/x-sisx-app");
+
+    // connect this request to a method for reply.
+
+    // here is the sis file which we will post to the server.
+
+    //mgr.post(request);
+}
+
+TestInterface::TRESULT_STATE  SigningCommonCase::getResult()
+{
+   return TestInterface::INPROGESS;
+}
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SigningTS/client/signingcommoncase.h	Wed May 12 11:54:19 2010 -0700
@@ -0,0 +1,76 @@
+#ifndef SIGNINGCOMMONCASE_H
+#define SIGNINGCOMMONCASE_H
+
+#include <QObject>
+#include <QtCore/QUrl>
+
+#include <QtDebug>
+
+#include <QtNetwork/QNetworkAccessManager>
+#include <QtNetwork/QNetworkReply>
+#include <QtNetwork/QNetworkRequest>
+
+
+
+#include "test.h"
+
+/**
+  This is the original puesdo-code for this test.
+ This walks through signing.  Express and Certified signing are very similar.
+
+ sign sis file with publisher ID
+
+ type is one of express or certified.
+submissionID,type = uploadSIS(sisfile)
+
+createSigningRequest(submissionID, type, description)
+
+done = false
+do {
+    status = getSubmissionStatus(submissionID)
+    switch (status)
+    {
+        case SIGNED:
+            done = true
+            break;
+        case SCAN_FAILED:
+            done = true
+            break;
+        case TEST_FAILED:
+            done = true
+            break;
+        case TESTING_IN_PROGRESS:
+        case AUDIT_IN_PROGRESS:
+            // This take awhile. Probably don't want to poll. IDEs may want to check for outstanding
+            // submissions when IDE is started. see enumerateSubmissions
+            break;
+        default:
+            sleep(2000);
+    }
+
+} while (!done)
+
+if (status == SIGNED) getSubmission(submissionID)
+  */
+
+class SigningCommonCase : public QObject, public TestInterface
+{
+    Q_OBJECT
+public:
+    explicit SigningCommonCase(QNetworkAccessManager &mgr, QObject *parent = 0);
+
+    void run();
+    TRESULT_STATE getResult();
+
+signals:
+
+public slots:
+
+
+private:
+    void uploadSIS();
+    QString testBaseURL;
+    QNetworkAccessManager &mgr;
+};
+
+#endif // SIGNINGCOMMONCASE_H
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/SigningTS/client/test.h	Wed May 12 11:54:19 2010 -0700
@@ -0,0 +1,29 @@
+#ifndef TEST_H
+#define TEST_H
+
+#include <qstring.h>
+
+// Each test will be a subclass of this abstract class.
+// A test has a sequence of steps. Each step is composed of
+// a request and reply.
+
+const QString BaseURL = "http://localhost:8080/";
+const QString DefaultKey = "853b128a-0c18-42f2-835f-db9f5b6f7fb9";
+const int ApiVersion = 1;
+
+class TestInterface
+{
+
+public:
+    virtual void  run () = 0 ; // run the test.
+
+    enum TRESULT_STATE { PASS=0, FAIL, INPROGESS} ;
+    virtual TRESULT_STATE getResult() = 0;
+
+
+    enum TAPI_SIGNING_STATE { SUBMITTED=0, SCANNED, FAILED_SCAN, SIGNED,
+                              AUDIT_IN_PROGRESS, FAILED_TESTING,
+                              TESTING_IN_PROGRESS};
+};
+
+#endif // TEST_H