Updated DDR Simple API test class

Previous Topic Next Topic
 
classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Updated DDR Simple API test class

Rotan Hanrahan

Following feedback, I now provide [1] an updated test class for the DDR
Simple API (for Java implementations) that takes a set of parameters to
tailor the test according to a preferred vocabulary, several test
properties and corresponding values. This will permit implementations to
use this test class with any vocabulary (including the DDR Core
Vocabulary) and with values for device descriptions that correspond to
actual or "invented" devices.

The test requires that the chosen vocabulary supports at least one of
each of the following types of value: Boolean, Enumeration, Integer and
String. I have not included tests for Double/Float/Long at this time,
though I note that a test that relied solely on the Core Vocabulary
could not pass the tests if these Real types were included because these
types are not used by the Core. (Feel free to extend the tests to cover
Reals if you wish.)

I must also re-iterate that this test has no normative status with
respect to the DDR Simple API, and the source might still be updated by
the group. Its sole purpose is to provide a common
implementation-neutral test of implementations that are based on the API
specification language (Java), which the presenters of such
implementations may use to support their claims of conformance to the
API specification.

I must also emphasise that while the test gives reasonable coverage of
functionality, it is not a complete test of an implementation, states
nothing about the performance of such an implementation nor makes any
claim regarding the quality of the data being queried via the API. Such
characteristics of an implementation are out of scope for the API.

Instantiation parameters are detailed in the embedded Javadoc.

The following code snippet shows how to invoke and report the test:
    java.util.Hashtable report = (new DDRSimpleAPITester(
        s, e,
        "http://www.w3.org/TR/ddr-core-vocabulary/","webBrowser",
"device", 123,
        "vendor", "model", "device", "device", "Acme Co.",
        "displayWidth", "device", 120,
        "cookieSupport", "webBrowser", true,
        "markupSupport", "webBrowser", new String[]
{"xhtmlBasic10","xhtmlMP10"}
        )).getReport();
    Enumeration<Object> en = report.keys();
    List keyList = Collections.list(en);
    Collections.sort(keyList);
    Enumeration sorted = Collections.enumeration(keyList);
    while (sorted.hasMoreElements()) {
      String k = (String)sorted.nextElement();
      System.out.println((String)report.get(k)+ " " + k);
    }


A successful test will produce the following report*.

Pass #sec-Evidence
Pass #sec-Evidence-exists
Pass #sec-Evidence-get
Pass #sec-Evidence-put
Pass #sec-PropertyName
Pass #sec-PropertyName-getLocalPropertyName
Pass #sec-PropertyName-getNamespace
Pass #sec-PropertyRef
Pass #sec-PropertyRef-getAspectName
Pass #sec-PropertyRef-getLocalPropertyName
Pass #sec-PropertyRef-getNamespace
Pass #sec-PropertyValue
Pass #sec-PropertyValue-exists
Pass #sec-PropertyValue-getPropertyRef
Pass #sec-PropertyValue-getXXX Boolean
???? #sec-PropertyValue-getXXX Double
Pass #sec-PropertyValue-getXXX Enumeration
???? #sec-PropertyValue-getXXX Float
Pass #sec-PropertyValue-getXXX Integer
???? #sec-PropertyValue-getXXX Long
Pass #sec-PropertyValue-getXXX String
Pass #sec-PropertyValues
Pass #sec-PropertyValues-getAll
Pass #sec-PropertyValues-getValue
Pass #sec-Service
Pass #sec-Service-getDataVersion
Pass #sec-Service-getImplementationVersion
Pass #sec-Service-getPropertyValue-1
Pass #sec-Service-getPropertyValue-2
Pass #sec-Service-getPropertyValue-3
Pass #sec-Service-getPropertyValue-4
Pass #sec-Service-getPropertyValues-1
Pass #sec-Service-getPropertyValues-2
Pass #sec-Service-getPropertyValues-3
Pass #sec-Service-getPropertyValues-4
Pass #sec-Service-initialize
Pass #sec-Service-listPropertyRefs
Pass #sec-Service-newHTTPEvidence-1
Pass #sec-Service-newHTTPEvidence-2
Pass #sec-Service-newPropertyName-1
Pass #sec-Service-newPropertyName-2
Pass #sec-Service-newPropertyRef-1
Pass #sec-Service-newPropertyRef-2
Pass #sec-Service-newPropertyRef-3

* This is an actual test run.

---Rotan (chair)



[1]
http://www.w3.org/2005/MWI/DDWG/drafts/api/simple/java/src/test/DDRSimpl
eAPITester.java