Notice: This Wiki is now read only and edits are no longer possible. Please see: https://gitlab.eclipse.org/eclipsefdn/helpdesk/-/wikis/Wiki-shutdown-plan for the plan.
Difference between revisions of "EclipseLink/Development/Testing/DBWS"
Line 4: | Line 4: | ||
===DBWS core tests=== | ===DBWS core tests=== | ||
In the SVN repository under the DBWS component's high-level directory, there is a project <b><code>eclipselink.dbws.test</code></b> <br /> | In the SVN repository under the DBWS component's high-level directory, there is a project <b><code>eclipselink.dbws.test</code></b> <br /> | ||
− | This project contains test classes that test DBWS in its | + | This project contains test classes that test DBWS in its XRM mode - no Web service deployment artifacts, no container - <br /> |
− | just a bridge between | + | just a bridge between OXM and ORM projects: |
<source lang="text" enclose="div"> | <source lang="text" enclose="div"> | ||
Eclipselink Tree | Eclipselink Tree | ||
Line 42: | Line 42: | ||
<br /> | <br /> | ||
The setup required to run these tests is running the appropriately named <code>dbsetup_xxx.sql</code> script | 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>). | + | (and conversely <code>dbteardown_xxx.sql</code> - <br /> |
+ | where <code>xxx</code> = <code>keymappings</code> or <code>relationships</code>). | ||
The test code is in the (related) <code>xxxTestSuite</code> class - let's look at <code>KeyMappingsTestSuite</code>: | The test code is in the (related) <code>xxxTestSuite</code> class - let's look at <code>KeyMappingsTestSuite</code>: | ||
Line 76: | Line 77: | ||
</source> | </source> | ||
<br /> | <br /> | ||
− | One of the notable things about this test class is the use of static Strings that contain all of the required XRM meta-data: schema, | + | One of the notable things about this test class is the use of static Strings that contain all of the required XRM meta-data: <br /> |
− | ORM and OXM projects and the DBWS service descriptor file. For this test, these have been pre-built by hand and assembled | + | schema, ORM and OXM projects and the DBWS service descriptor file. For this test, these have been pre-built by hand and assembled <br /> |
− | follow the rules and styles of DBWS runtime processing. In fact, to be more accurate, these tests pre-date the existence of the | + | to follow the rules and styles of DBWS runtime processing. In fact, to be more accurate, these tests pre-date the existence of the <br /> |
<code>DBWSBuilder</code> utility - that knows the rules and styles of DBWS runtime processing and produces meta-data to match. | <code>DBWSBuilder</code> utility - that knows the rules and styles of DBWS runtime processing and produces meta-data to match. | ||
− | We can see the static JUnit4 test fixtures for this testsuite: OX helper objects that will be used for comparing XML documents | + | We can see the static JUnit4 test fixtures for this testsuite: OX helper objects that will be used for comparing XML documents and an <br /> |
− | and an <code>xrService</code> of type <code>XRServiceAdapter</code>. The <code>XRServiceAdapter</code> is a sub-class of | + | <code>xrService</code> of type <code>XRServiceAdapter</code>. The <code>XRServiceAdapter</code> is a sub-class of |
− | <code>XRServiceModel</code>, the model object for the DBWS service descriptor (name, session-name and a | + | <code>XRServiceModel</code>, the model object for the DBWS service descriptor (<code>name</code>, <code>session-name</code> and a |
<code>Map<String, Operation></code> of <code>operations</code>). The <code>XRServiceAdapter</code> object has additional fields: | <code>Map<String, Operation></code> of <code>operations</code>). The <code>XRServiceAdapter</code> object has additional fields: | ||
schemaNamespace, orSession (built from the ORM project), oxSession (built from the OXM project), xmlContext (built from the OXM project), | schemaNamespace, orSession (built from the ORM project), oxSession (built from the OXM project), xmlContext (built from the OXM project), | ||
schema and a <code>Map<QName, XMLDescriptor></code> of <code>descriptorsByQName</code>. | schema and a <code>Map<QName, XMLDescriptor></code> of <code>descriptorsByQName</code>. |
Revision as of 13:47, 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
This project contains test classes that test DBWS in its XRM mode - no Web service deployment artifacts, no container -
just a bridge between OXM and ORM projects:
\---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" + ... // test fixtures public static XMLComparer comparer = new XMLComparer(); public static XMLPlatform xmlPlatform = XMLPlatformFactory.getInstance().getXMLPlatform(); public static XMLParser xmlParser = xmlPlatform.newXMLParser(); public static XRServiceAdapter xrService = null; @BeforeClass public static void setUp() { final String username = System.getProperty(DATABASE_USERNAME_KEY); if (username == null) { fail("error retrieving database username"); }
One of the notable things about this test class is the use of static Strings that contain all of the required XRM meta-data:
schema, ORM and OXM projects and the DBWS service descriptor file. For this test, these have been pre-built by hand and assembled
to follow the rules and styles of DBWS runtime processing. In fact, to be more accurate, these tests pre-date the existence of the
DBWSBuilder
utility - that knows the rules and styles of DBWS runtime processing and produces meta-data to match.
We can see the static JUnit4 test fixtures for this testsuite: OX helper objects that will be used for comparing XML documents and an
xrService
of type XRServiceAdapter
. The XRServiceAdapter
is a sub-class of
XRServiceModel
, the model object for the DBWS service descriptor (name
, session-name
and a
Map<String, Operation>
of operations
). The XRServiceAdapter
object has additional fields:
schemaNamespace, orSession (built from the ORM project), oxSession (built from the OXM project), xmlContext (built from the OXM project),
schema and a Map<QName, XMLDescriptor>
of descriptorsByQName
.