Author: batosai
Date: 2008-09-04 12:41:26 +0000 (Thu, 04 Sep 2008)
New Revision: 22407

Removed:
   trunk/apps/WoT/src/plugins/WoT/WotTestDrive.java
Modified:
   trunk/apps/WoT/src/plugins/WoT/WebInterface.java
   trunk/apps/WoT/src/plugins/WoT/WoTplugin.java
Log:
Removed the testPage as I will use junit from now.

Modified: trunk/apps/WoT/src/plugins/WoT/WebInterface.java
===================================================================
--- trunk/apps/WoT/src/plugins/WoT/WebInterface.java    2008-09-04 12:13:40 UTC 
(rev 22406)
+++ trunk/apps/WoT/src/plugins/WoT/WebInterface.java    2008-09-04 12:41:26 UTC 
(rev 22407)
@@ -300,18 +300,6 @@
                return pm.getPageNode("Web of Trust", null);
        }

-       public String makeTestPage() {
-               HTMLNode pageNode = getPageNode();
-               HTMLNode contentNode = pm.getContentNode(pageNode);
-               HTMLNode box = pm.getInfobox("WoT test results");
-               HTMLNode boxContent = pm.getContentNode(box);
-               
-               boxContent.addChild("pre", new 
WotTestDrive(wot,db,client).fullTest());
-                               
-               contentNode.addChild(box);
-               return pageNode.generate();
-       }
-
        public String makeTestWarningPage() {
                HTMLNode pageNode = getPageNode();
                HTMLNode contentNode = pm.getContentNode(pageNode);

Modified: trunk/apps/WoT/src/plugins/WoT/WoTplugin.java
===================================================================
--- trunk/apps/WoT/src/plugins/WoT/WoTplugin.java       2008-09-04 12:13:40 UTC 
(rev 22406)
+++ trunk/apps/WoT/src/plugins/WoT/WoTplugin.java       2008-09-04 12:41:26 UTC 
(rev 22407)
@@ -171,9 +171,6 @@
                                setTrust(request);
                                return 
web.makeKnownIdentitiesPage(request.getPartAsString("truster", 1024));
                        }
-                       else if (page.equals("/wotTestDrive")) {
-                               return web.makeTestPage();
-                       }
                        else if(page.equals("/editIdentity")) {
                                return 
web.makeEditIdentityPage(request.getPartAsString("id", 1024));
                        }

Deleted: trunk/apps/WoT/src/plugins/WoT/WotTestDrive.java
===================================================================
--- trunk/apps/WoT/src/plugins/WoT/WotTestDrive.java    2008-09-04 12:13:40 UTC 
(rev 22406)
+++ trunk/apps/WoT/src/plugins/WoT/WotTestDrive.java    2008-09-04 12:41:26 UTC 
(rev 22407)
@@ -1,191 +0,0 @@
-/**
- * This code is part of WoT, a plugin for Freenet. It is distributed 
- * under the GNU General Public License, version 2 (or at your option
- * any later version). See http://www.gnu.org/ for details of the GPL.
- */
-package plugins.WoT;
-
-import com.db4o.ObjectContainer;
-import com.db4o.ObjectSet;
-
-import freenet.client.HighLevelSimpleClient;
-import freenet.keys.FreenetURI;
-
-/**
- * A local Identity (it belongs to the user)
- * 
- * @author Julien Cornuwel (batosai at freenetproject.org)
- *
- */
-public class WotTestDrive {
-
-       WoT wot;
-       ObjectContainer db;
-       HighLevelSimpleClient client;
-       
-       public WotTestDrive(WoT wot, ObjectContainer db, HighLevelSimpleClient 
client) {
-               this.wot = wot;
-               this.db = db;
-               this.client = client;
-       }
-       
-       public String fullTest() {
-               
-               StringBuffer out = new StringBuffer();
-               
-               out.append("Empty the database ");
-               ObjectSet<Object> all = db.queryByExample(new Object());
-               while(all.hasNext()) db.delete(all.next());
-               ObjectSet<Object> all2 = db.queryByExample(new Object());
-               if(all2.size() == 0) out.append("OK\n");
-               else out.append("NOK (" + all2.size() + ")\n");
-               
-       
-               out.append("* Create 3 identities:");
-               OwnIdentity a = createIdentity(out,"a");
-               OwnIdentity b = createIdentity(out,"b");
-               OwnIdentity c = createIdentity(out,"c");
-               out.append("\n");
-               
-               out.append("* Make a trust b:");
-               try {
-                       wot.setTrust(new Trust(a,b,100));
-                       
-                       ObjectSet<Trust> trusts = 
db.queryByExample(Trust.class);
-                       if(trusts.size() != 1) {
-                               out.append("NOK\n");
-                               while (trusts.hasNext()) 
out.append(trusts.next().toString() + "\n"); 
-                       }
-                       
-                       ObjectSet<Score> scores = 
db.queryByExample(Score.class);
-                       if(scores.size() != 4) {
-                               out.append("NOK\n");
-                               while (scores.hasNext()) 
out.append(scores.next().toString() + "\n"); 
-                       }
-               } catch (Exception e) {
-                       out.append(e.getMessage());
-               }
-               out.append("OK\n");
-               
-               out.append("* Make b trust c:");
-               try {
-                       wot.setTrust(new Trust(b,c,100));
-                       
-                       ObjectSet<Trust> trusts = 
db.queryByExample(Trust.class);
-                       if(trusts.size() != 2) {
-                               out.append("NOK\n");
-                               while (trusts.hasNext()) 
out.append(trusts.next().toString() + "\n"); 
-                       }
-                       
-                       ObjectSet<Score> scores = 
db.queryByExample(Score.class);
-                       if(scores.size() != 6) {
-                               out.append("NOK\n");
-                               while (scores.hasNext()) 
out.append(scores.next().toString() + "\n"); 
-                       }
-               } catch (Exception e) {
-                       out.append(e.getMessage());
-               }
-               out.append("OK\n");
-       
-               out.append("* Make c trust a:");
-               try {
-                       wot.setTrust(new Trust(c,a,100));
-                       
-                       ObjectSet<Trust> trusts = 
db.queryByExample(Trust.class);
-                       if(trusts.size() != 3) {
-                               out.append("NOK\n");
-                               while (trusts.hasNext()) 
out.append(trusts.next().toString() + "\n"); 
-                       }
-                       
-                       ObjectSet<Score> scores = 
db.queryByExample(Score.class);
-                       if(scores.size() != 9) {
-                               out.append("NOK\n");
-                               while (scores.hasNext()) 
out.append(scores.next().toString() + "\n"); 
-                       }
-               } catch (Exception e) {
-                       out.append(e.getMessage());
-               }
-               out.append("OK\n");             
-               
-               out.append("* Make a trust b again (different value):");
-               try {
-                       wot.setTrust(new Trust(a,b,90));
-                       
-                       ObjectSet<Trust> trusts = 
db.queryByExample(Trust.class);
-                       if(trusts.size() != 3) {
-                               out.append("NOK\n");
-                               while (trusts.hasNext()) 
out.append(trusts.next().toString() + "\n"); 
-                       }
-                       
-                       ObjectSet<Score> scores = 
db.queryByExample(Score.class);
-                       if(scores.size() != 9) {
-                               out.append("NOK\n");
-                               while (scores.hasNext()) 
out.append(scores.next().toString() + "\n"); 
-                       }
-               } catch (Exception e) {
-                       out.append(e.getMessage());
-               }
-               out.append("OK\n");     
-               
-               Identity storedA = null;
-               out.append("* Try to fetch existing identity (a):");
-               try {
-                       storedA = Identity.getByURI(db, a.getRequestURI());
-                       out.append("OK\n");
-               } catch (UnknownIdentityException e) {
-                       out.append("NOK\n");
-               } catch (Exception e) {
-                       out.append("\n"+e.getMessage());
-               }
-               
-               Identity storedB = null;
-               out.append("* Try to fetch existing identity (b):");
-               try {
-                       storedB = Identity.getByURI(db, b.getRequestURI());
-                       out.append("OK\n");
-               } catch (UnknownIdentityException e) {
-                       out.append("NOK\n");
-               } catch (Exception e) {
-                       out.append("\n"+e.getMessage());
-               }
-               
-               out.append("* Try to fetch existing trust relationship (a -> 
b):");
-               try {
-                       ObjectSet<Trust> trustResult = db.queryByExample(new 
Trust(storedA, storedB, 0, null));
-                       if(trustResult.size() == 1) out.append("OK\n");
-                       else out.append("NOK\n");
-               } catch (Exception e) {
-                       out.append("\n" + e.getMessage());
-               }
-
-               
-               
-               // Empty the database after tests
-               ObjectSet<Object> remaining = db.queryByExample(new Object());
-               while(remaining.hasNext()) db.delete(remaining.next());
-               
-               return out.toString();
-       }
-       
-       private OwnIdentity createIdentity(StringBuffer out, String nickName) {
-               
-               OwnIdentity id = null;
-               FreenetURI[] keypair = client.generateKeyPair("WoT");
-               try {
-                       id = new OwnIdentity(keypair[0].toString(), 
keypair[1].toString(), nickName, "true", "testing");
-                       
-                       id.addContext("Testing", db);
-                       db.store(id);
-
-                       Score score = new Score(id, id, 100, 0, 100); // We 
need to initialize the trust tree 
-                       db.store(score);
-                                               
-                       out.append("OK");
-               } catch (Exception e) {
-                       out.append("NOK\n");
-                       out.append(e.getMessage());
-               }
-               return id;
-       }
-       
-}


Reply via email to