Jump to: navigation, search

Difference between revisions of "CDO Development Guidelines"

(Guideline for writing test cases)
(Legacy Mode)
Line 21: Line 21:
 
In the CDO Suite the Legacy Mode is always activated. This means that you do not need set this mode for every test case. But this also means that you need to deactivate it if you want to execute tests without legacy.
 
In the CDO Suite the Legacy Mode is always activated. This means that you do not need set this mode for every test case. But this also means that you need to deactivate it if you want to execute tests without legacy.
  
Please always use CDOUti.getCDObject and CDOUtil.getEObject() to get either the CDOObject or the expected interal instance, no matter whethter you are using legay or not. The will make the test compatible to all legacy test cases and avoids ugly ClassCastExceptions.
+
Please always use CDOUtil.getCDOObject() and CDOUtil.getEObject() to get either the CDOObject or the expected internal instance, no matter whether you are using legacy or not. This will make the test compatible to all legacy test cases and avoids ugly ClassCastExceptions.
 +
 
 +
When using dynamic packages please do not use <b>CDOUtil.prepareDynamicEPackage(dynamicMapEPackage)</b> if you want to make this test legacy aware. Otherwise the package will be native even if the Legacy test suite is executed. Please use somtehing like the following statement to make sure that you have prepared dynamic legacy objects.
 +
 
 +
<code>
 +
if(!CDOUtil.isLegacyModeDefault())
 +
{
 +
CDOUtil.prepareDynamicEPackage(dynamicMapEPackage);
 +
}
 +
</code>

Revision as of 05:20, 26 April 2010

Coding Guidlines

This page is not yet finished. Do not take these guidelines for granted until the note is removed!

Basic Coding Guidelines

The following Guide describes the basic requirements for creating CDO source code. Not all of these guidlines can be coverred by the auto-format for Java source Code (Strg+Shift+F). If you like to write an extension that allows comfortably adjusting the code regarding these Guidelines you are welcome.

Members

Methods

Getter and Setter

Guideline for writing test cases

General Requirements

Legacy Mode

In the CDO Suite the Legacy Mode is always activated. This means that you do not need set this mode for every test case. But this also means that you need to deactivate it if you want to execute tests without legacy.

Please always use CDOUtil.getCDOObject() and CDOUtil.getEObject() to get either the CDOObject or the expected internal instance, no matter whether you are using legacy or not. This will make the test compatible to all legacy test cases and avoids ugly ClassCastExceptions.

When using dynamic packages please do not use CDOUtil.prepareDynamicEPackage(dynamicMapEPackage) if you want to make this test legacy aware. Otherwise the package will be native even if the Legacy test suite is executed. Please use somtehing like the following statement to make sure that you have prepared dynamic legacy objects.

if(!CDOUtil.isLegacyModeDefault()) { CDOUtil.prepareDynamicEPackage(dynamicMapEPackage); }