Skip to main content

Notice: this Wiki will be going read only early in 2024 and edits will no longer be possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.

Jump to: navigation, search

Difference between revisions of "EclipseLink/Development/Testing/DBWS"

(DBWS core tests)
Line 37: Line 37:
 
     |  |                      RelationshipsPhone.java
 
     |  |                      RelationshipsPhone.java
 
     |  |                      RelationshipsTestSuite.java
 
     |  |                      RelationshipsTestSuite.java
 +
</source>
 +
<br />
 +
The setup required to run these tests is running the appropriately named <code>dbsetup_xxx.sql</code> script
 +
(and conversely <code>dbteardown_xxx.sql</code> - where <code>xxx</code> = <code>keymappings</code> or <code>relationships</code>).
 +
 +
The test code is in the (related) xxxTestSuite class - let's look at <code>KeyMappingsTestSuite</code>:
 +
<source lang="java5" enclose="div">
 +
public class KeyMappingsTestSuite {
 +
 +
    static final String KEYMAPPINGS_SCHEMA =
 +
        "<?xml version='1.0' encoding='UTF-8'?>" +
 +
        "<xsd:schema targetNamespace=\"urn:keymappings\" xmlns=\"urn:keymappings\" elementFormDefault=\"qualified\"\n" +
 +
          "xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"\n" +
 +
          ">\n" +
 +
          "<xsd:complexType name=\"phone\">\n" +
 +
            "<xsd:sequence>\n" +
 +
              "<xsd:element name=\"area-code\" type=\"xsd:string\" />\n" +
 +
              "<xsd:element name=\"phone-number\" type=\"xsd:string\" />\n" +
 +
              "<xsd:element name=\"type\" type=\"xsd:string\" />\n" +
 +
            "</xsd:sequence>\n" +
 +
            "<xsd:attribute name=\"phone-id\" type=\"xsd:int\" use=\"required\" />\n" +
 +
            "<xsd:attribute name=\"owner-ref-id\" type=\"xsd:int\" use=\"required\" />\n" +
 +
          "</xsd:complexType>\n" +
 +
...
 
</source>
 
</source>

Revision as of 13:13, 23 March 2009

Summary

DBWS has a number of test suites, all written using JUnit4. This page outlines the various testsuites and the types of testing in each suite.

DBWS core tests

In the SVN repository under the DBWS component's high-level directory, there is a project eclipselink.dbws.test:

Eclipselink Tree
\---trunk
    |   about.html
    |   ...
    |  
    +---dbws
    |   +---eclipselink.dbws.test
    |   |   |   .classpath
    |   |   |   .project
    |   |   |   build.properties
    |   |   |   build.xml
    |   |   |
    |   |   +---etc
    |   |   |       dbsetup_keymappings.sql
    |   |   |       dbsetup_relationships.sql
    |   |   |       dbteardown_keymappings.sql
    |   |   |       dbteardown_relationships.sql
    |   |   |
    |   |   \---src
    |   |       \---dbws
    |   |           \---testing
    |   |               |   DBWSTestHelper.java
    |   |               |   RootHelper.java
    |   |               |
    |   |               +---keymappings
    |   |               |       KeyMappingsTestSuite.java
    |   |               |
    |   |               \---relationships
    |   |                       RelationshipsAddress.java
    |   |                       RelationshipsEmployee.java
    |   |                       RelationshipsPhone.java
    |   |                       RelationshipsTestSuite.java


The setup required to run these tests is running the appropriately named dbsetup_xxx.sql script (and conversely dbteardown_xxx.sql - where xxx = keymappings or relationships).

The test code is in the (related) xxxTestSuite class - let's look at KeyMappingsTestSuite:

public class KeyMappingsTestSuite {

    static final String KEYMAPPINGS_SCHEMA =
        "<?xml version='1.0' encoding='UTF-8'?>" +
        "<xsd:schema targetNamespace=\"urn:keymappings\" xmlns=\"urn:keymappings\" elementFormDefault=\"qualified\"\n" +
          "xmlns:xsd=\"http://www.w3.org/2001/XMLSchema\"\n" +
          ">\n" +
          "<xsd:complexType name=\"phone\">\n" +
            "<xsd:sequence>\n" +
              "<xsd:element name=\"area-code\" type=\"xsd:string\" />\n" +
              "<xsd:element name=\"phone-number\" type=\"xsd:string\" />\n" +
              "<xsd:element name=\"type\" type=\"xsd:string\" />\n" +
            "</xsd:sequence>\n" +
            "<xsd:attribute name=\"phone-id\" type=\"xsd:int\" use=\"required\" />\n" +
            "<xsd:attribute name=\"owner-ref-id\" type=\"xsd:int\" use=\"required\" />\n" +
          "</xsd:complexType>\n" +
...

Back to the top