Commits

John Marsden committed e8c6029

Update

  • Participants
  • Parent commits 308a5f4

Comments (0)

Files changed (6)

File importlibs.sh

 mvn install:install-file -Dfile=lib/json-smart-1.0.6.jar -Dsources=lib/json-smart-1.0.6-sources.jar -DgroupId=net.minidev -DartifactId=json-smart -Dversion=1.0.6 -Dpackaging=jar -DgeneratePom=true
 mvn install:install-file -Dfile=lib/json-smart-1.0.6.2.jar -Dsources=lib/json-smart-1.0.6-sources.jar -DgroupId=net.minidev -DartifactId=json-smart -Dversion=1.0.6.2 -Dpackaging=jar -DgeneratePom=true
+mvn install:install-file -Dfile=lib/argo-2.8.jar -Dsources=lib/argo-2.8.jar -DgroupId=net.sourceforge -DartifactId=argo -Dversion=2.8 -Dpackaging=jar -DgeneratePom=true
+
         <dependency>
             <groupId>cc.plural</groupId>
             <artifactId>jsonij</artifactId>
-            <version>0.2.7-SNAPSHOT</version>
+            <version>0.2.8-SNAPSHOT</version>
         </dependency>
         <dependency>
             <groupId>org.json</groupId>

File src/main/java/cc/plural/json/JSONStringParsingTest.java

  **/
 package cc.plural.json;
 
+import java.io.BufferedWriter;
+import java.io.File;
+import java.io.FileWriter;
 import java.io.IOException;
 import java.math.BigDecimal;
 import jsonij.json.JSON;
 
     public void setExpectedOutputError(boolean expectedOutputError) {
         this.expectedOutputError = expectedOutputError;
-    }   
-    
+    }
+
     @Override
     public JSONParsingTestResult createRestResult() {
         return new JSONParsingTestResult(this);
     }
 
     public void evaluate(JSONLibrary jsonPackage, JSONTestResult jsonResult) throws JSONTestException {
-        
+
         JSONParseStringInputStringOutput jsonPackageParseStringInputOutput = null;
         JSONParsingTestResult jsonParsingTestResult = null;
-        
-        if(jsonPackage instanceof JSONParseStringInputStringOutput) {
+
+        if (jsonPackage instanceof JSONParseStringInputStringOutput) {
             jsonPackageParseStringInputOutput = (JSONParseStringInputStringOutput) jsonPackage;
         }
-        if(jsonResult instanceof JSONParsingTestResult) {
+        if (jsonResult instanceof JSONParsingTestResult) {
             jsonParsingTestResult = (JSONParsingTestResult) jsonResult;
         }
-        
+
         try {
             String output = evaluatePayload(jsonPackage, jsonResult);
             jsonResult.setOutput(output);
             jsonResult.description = description;
             jsonResult.input = input;
         }
-        
-        if(!expectedOutputError) { 
+
+        if (!expectedOutputError) {
             long timeSum = 0;
             long parseTimeSum = 0;
             long toJSONTimeSum = 0;
             for (int i = 0; i < loopCount; i++) {
                 evaluatePayload(jsonPackage, jsonResult);
                 timeSum += jsonPackage.getTotalTimeNano();
-                if(jsonPackageParseStringInputOutput != null) { 
+                if (jsonPackageParseStringInputOutput != null) {
                     parseTimeSum += jsonPackageParseStringInputOutput.getParseTime();
                     toJSONTimeSum += jsonPackageParseStringInputOutput.getToJSONStringTime();
                 }
             }
             jsonResult.executionTimeAverage = new BigDecimal(timeSum).divide(new BigDecimal((double) loopCount)).longValue();
-            if(jsonParsingTestResult != null) {
+            if (jsonParsingTestResult != null) {
                 jsonParsingTestResult.parseTimeAverage = new BigDecimal(parseTimeSum).divide(new BigDecimal((double) loopCount)).longValue();
                 jsonParsingTestResult.toJSONTimeAverage = new BigDecimal(toJSONTimeSum).divide(new BigDecimal((double) loopCount)).longValue();
             }
         if (expectedOutputError == true) {
             result = jsonResult.exception != null;
         } else {
-            if(jsonResult.output == null) {
+            if (jsonResult.output == null) {
                 return false;
             }
             try {

File src/main/java/cc/plural/json/JSONTestRunner.java

     public static void main(String[] args) {
         // Library Classes
         Class[] libraryClasses = new Class[]{
-            ArgoLibrary.class, GSONLibrary.class, JacksonLibrary.class, JSONDotOrgLibrary.class, JSONiJLibrary.class, JSONSimpleLibrary.class,
-            JSONSmartLibrary.class};
+            ArgoLibrary.class, GSONLibrary.class, JacksonLibrary.class, JSONDotOrgLibrary.class, JSONiJLibrary.class, JSONSimpleLibrary.class, JSONSmartLibrary.class
+        };
         JSONLibrarySet<JSONLibrary> jsonLibrarySet = new JSONLibrarySet<JSONLibrary>();
         try {
             jsonLibrarySet.addJSONLibraryClasses(libraryClasses);
 
         // Set up all tests into the suite
         JSONTestSuite<JSONTestSet<JSONTest>> jsonTestSuite = new JSONTestSuite<JSONTestSet<JSONTest>>();
-        //jsonTestSuite.add(new StrictRFC4627ParsingJSONTestSet<JSONTest>());
-        //jsonTestSuite.add(new StrictRFC4627WhiteSpaceParsingJSONTestSet<JSONTest>());
-        //jsonTestSuite.add(new StrictRFC4627ErrorConditions<JSONTest>());
+        jsonTestSuite.add(new StrictRFC4627ParsingJSONTestSet<JSONTest>());
+        jsonTestSuite.add(new StrictRFC4627WhiteSpaceParsingJSONTestSet<JSONTest>());
+        jsonTestSuite.add(new StrictRFC4627ErrorConditions<JSONTest>());
         jsonTestSuite.add(new StrictRFDC4627RealExamples<JSONTest>());
         jsonTestSuite.primeAllTestSets();
 
         Iterator<JSONLibrary> librarySetIterator = jsonLibrarySet.iterator();
         while (librarySetIterator.hasNext()) {
             // Fully Measured Run
-            testResultsList.add(jsonTestSuite.runTestSuite(librarySetIterator.next()));
+            JSONLibrary library = librarySetIterator.next();
+            testResultsList.add(jsonTestSuite.runTestSuite(library));
+            System.out.println("Finished:" + library.getName());
         }
 
         ConsoleDumpOutput consoleDumpOutput = new ConsoleDumpOutput(jsonTestSuite);

File src/main/java/cc/plural/json/JSONTestSet.java

                     Thread.sleep(10);
                     sleepCount += 10;
                 } catch (InterruptedException ex) {}
-                if(sleepCount > 10000) {
+                if(sleepCount > 1000000) {
                     testThread.interrupt();
                     testResult.result = RESULT.HANG;
                     break;

File src/main/java/cc/plural/json/test/StrictRFDC4627RealExamples.java

                 + "}\r\n"
                 + "]\r\n"
                 + "}\r\n";
-        
-        final String googleJSONExample = "[]";
+
+        final String googleJSONExample = "{\r\n"
+                + "  \"version\": \"1.0\",\r\n"
+                + "  \"encoding\": \"UTF-8\",\r\n"
+                + "  \"feed\": {\r\n"
+                + "    \"xmlns\": \"http://www.w3.org/2005/Atom\",\r\n"
+                + "    \"xmlns$openSearch\": \"http://a9.com/-/spec/opensearchrss/1.0/\",\r\n"
+                + "    \"xmlns$gd\": \"http://schemas.google.com/g/2005\",\r\n"
+                + "    \"xmlns$gCal\": \"http://schemas.google.com/gCal/2005\",\r\n"
+                + "    \"id\": {\"$t\": \"...\"},\r\n"
+                + "    \"updated\": {\"$t\": \"2006-11-12T21:25:30.000Z\"},\r\n"
+                + "    \"title\": {\r\n"
+                + "      \"type\": \"text\",\r\n"
+                + "      \"$t\": \"Google Developer Events\"\r\n"
+                + "    },\r\n"
+                + "    \"subtitle\": {\r\n"
+                + "      \"type\": \"text\",\r\n"
+                + "      \"$t\": \"The calendar contains information about upcoming developer conferences at which Google will be speaking, along with other developer-related events.\"\r\n"
+                + "    },\r\n"
+                + "    \"link\": [{\r\n"
+                + "      \"rel\": \"...\",\r\n"
+                + "      \"type\": \"application/atom+xml\",\r\n"
+                + "      \"href\": \"...\"\r\n"
+                + "      },{\r\n"
+                + "      \"rel\": \"self\",\r\n"
+                + "      \"type\": \"application/atom+xml\",\r\n"
+                + "      \"href\": \"...\"\r\n"
+                + "    }],\r\n"
+                + "    \"author\": [{\r\n"
+                + "      \"name\": {\"$t\": \"Google Developer Calendar\"},\r\n"
+                + "      \"email\": {\"$t\": \"developer-calendar@google.com\"}\r\n"
+                + "    }],\r\n"
+                + "    \"generator\":{\r\n"
+                + "      \"version\": \"1.0\",\r\n"
+                + "      \"uri\": \"http://www.google.com/calendar\",\r\n"
+                + "      \"$t\": \"Google Calendar\"\r\n"
+                + "    },\r\n"
+                + "    \"openSearch$startIndex\": {\"$t\": \"1\"},\r\n"
+                + "    \"openSearch$itemsPerPage\": {\"$t\": \"25\"},\r\n"
+                + "    \"gCal$timezone\": {\"value\": \"America/Los_Angeles\"},\r\n"
+                + "\r\n"
+                + "    \"entry\": [{\r\n"
+                + "      \"id\": {\"$t\": \"...\"},\r\n"
+                + "      \"published\": {\"$t\": \"2006-11-12T21:25:30.000Z\"},\r\n"
+                + "      \"updated\": {\"$t\": \"2006-11-12T21:25:30.000Z\"},\r\n"
+                + "      \"category\": [{\r\n"
+                + "        \"scheme\": \"...\",\r\n"
+                + "        \"term\": \"...\"\r\n"
+                + "      }],\r\n"
+                + "      \"title\":{\r\n"
+                + "        \"type\": \"text\",\r\n"
+                + "        \"$t\": \"WebmasterWorld PubCon 2006: Google Developer Tools in General\"\r\n"
+                + "      },\r\n"
+                + "      \"content\": {\r\n"
+                + "        \"type\": \"text\",\r\n"
+                + "        \"$t\": \"Google is sponsoring at <a href=\\\"http://www.pubcon.com/\\\">WebmasterWorld PubCon 2006</a>. \\nCome and visit us at the booth or join us for an evening demo reception where we will be talking \\\"5 ways to enhance your website with Google Code\\\".\\nAfter all,\\nit is Vegas, baby! See you soon.\"\r\n"
+                + "      },\r\n"
+                + "      \"link\": [{\r\n"
+                + "        \"rel\": \"alternate\",\r\n"
+                + "        \"type\": \"text/html\",\r\n"
+                + "        \"href\": \"...\",\r\n"
+                + "        \"title\": \"alternate\"\r\n"
+                + "        },{\r\n"
+                + "        \"rel\": \"self\",\r\n"
+                + "        \"type\": \"application/atom+xml\",\r\n"
+                + "	    \"href\": \"...\"\r\n"
+                + "      }],\r\n"
+                + "      \"author\": [{\r\n"
+                + "        \"name\": {\"$t\": \"Google Developer Calendar\"},\r\n"
+                + "        \"email\": {\"$t\": \"developer-calendar@google.com\"}\r\n"
+                + "      }],\r\n"
+                + "      \"gd$transparency\": {\"value\": \"http://schemas.google.com/g/2005#event.opaque\"},\r\n"
+                + "      \"gd$eventStatus\": {\"value\": \"http://schemas.google.com/g/2005#event.confirmed\"},\r\n"
+                + "      \"gd$comments\": {\"gd$feedLink\": {\"href\": \"...\"}},\r\n"
+                + "      \"gCal$sendEventNotifications\": {\"value\": \"true\"},\r\n"
+                + "      \"gd$when\": [{\r\n"
+                + "        \"startTime\": \"2006-11-15\",\r\n"
+                + "        \"endTime\": \"2006-11-17\",\r\n"
+                + "        \"gd$reminder\": [{\"minutes\": \"10\"}]\r\n"
+                + "      }],\r\n"
+                + "      \"gd$where\": [{\"valueString\": \"3150 Paradise Road,Las Vegas,NV 89109\"}]}\r\n"
+                + "     ]\r\n"
+                + "  }\r\n"
+                + "}";
         
         add(new JSONStringParsingTest() {
 
             }
         });
 
-
         add(new JSONStringParsingTest() {
 
             @Override