Some thougths about mobileok checker

Hello,

 From my brief experience using it, I would like to share some thougths 
about the checker, mainly about the code extensibility.

1. Request headers

I think support for overriding those headers not defined by mobileOK 
Basic will be very useful, not only to extend it, but for other purposes 
like validating if a website is mobileOk in different languages...

2. Package-visibility

A lot of methods are only visible from classes in the package 
org.w3c.mwi.mobileok.basic
That makes it hard to reuse classes from third party developments (like 
mine :)

For example, DOMUtils is generic enough to define its methods as 
public.  At least domToStream and domToStrings that are used from the 
Tester class.  You can simply move DOMUtils to a new 
org.w3c.mwi.mobileok.utils package, and see how that "brokes" the code...

The same with the class Preprocessor that is not public and for the 
following methods used if you want to run the tests from your own class:
    public interface TestImplementation
    public TestResults()
    public void addTestResult(final TestResult result)
    public static TestImplementation getImplementation(final TestType type)

Now it works only because the Tester class is included into the package 
org.w3c.mwi.mobileok.basic.

3. Maybe all AbstractTestImplementation classes should be moved to a new 
package "org.w3c.mwi.mobileok.basic.tests", to improve the code 
understandability to new arrived developers :)

4. Not sure about this, but in the class HTTPResource you could use a 
MultiThreadedHttpConnectionManager

MultiThreadedHttpConnectionManager connectionManager = new 
MultiThreadedHttpConnectionManager();
HttpClient client = new HttpClient(connectionManager);

and the call to method.releaseConnection(); should go in a finally block

More info here : 
http://jakarta.apache.org/httpcomponents/httpclient-3.x/threading.html

5. The class HTTPRedirect uses the getResponseBody method, that may 
result on java.lang.OutOfMemoryError exceptions. This is important when 
the code follows a link to a big resource (like a PDF file...).
Not sure about if this is important in mobileOk tests.  Right now I have 
added a list of Content-Types that I do not want to follow, like 
"application/pdf".

final class HTTPRedirect {
    HTTPRedirect(final HttpMethod httpMethod) throws IOException {
        ...
        rawBody = httpMethod.getResponseBody();
        ...
    }
}

Best regards,

--
Guido García Bernardo
ITDeusto

Received on Monday, 15 October 2007 10:48:10 UTC