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 "OSEE/Developers Guide"

(Custom Data Model)
(Base Eclipse for OSEE)
Line 3: Line 3:
  
 
== Base Eclipse for OSEE ==
 
== Base Eclipse for OSEE ==
# Start with base install of Eclipse classic (http://www.eclipse.org/downloads/).
+
* Base Eclipse for OSEE Client
# Copy in 1.6 jre.
+
** Start with base install of Eclipse classic (http://www.eclipse.org/downloads/).
# Install "Subversive SVN Team Provider (Inducation)" from http://download.eclipse.org/technology/subversive/0.7/update-site/
+
** Copy in 1.6 jre.
# http://www.eclipse.org/gef/downloads/ -> Select "Draw2D, GEF and Zest" ->  "All-In-One Update Site"
+
** http://www.eclipse.org/gef/downloads/ -> Select "Draw2D, GEF and Zest" ->  "All-In-One Update Site"
# extract GEF-zest-3.4.2.zip
+
** extract GEF-zest-3.4.2.zip
# Ganymede Update Site -> Enabling Features -> Lowagie iText Feature
+
** Ganymede Update Site -> Enabling Features -> Lowagie iText Feature
# http://download.eclipse.org/birt/downloads/ -> org.eclipse.birt.chart.runtime
+
** http://download.eclipse.org/birt/downloads/ -> org.eclipse.birt.chart.runtime
# extract birt-report-framework-2_3_2_1.zip
+
** extract birt-report-framework-2_3_2_1.zip
 +
 
 +
* Base Eclipse for OSEE for Building OSEE
 +
** First complete the above steps for Base Eclipse for OSEE Client
 +
** Install "Subversive SVN Team Provider (Inducation)" from http://download.eclipse.org/technology/subversive/0.7/update-site/
  
 
== Architecture ==
 
== Architecture ==

Revision as of 13:44, 24 June 2009

Documentation

Base Eclipse for OSEE

Architecture

Client Architecture

Although there is quite a bit to understand about the Architecture of OSEE, the main thing to understand right away is that OSEE provides an Extensible Framework called the OSEE Application Framework and also provides some Exemplary Applications built on this framework in the form of OSEE Define (the Requirements Management application) and OSEE ATS (Action Tracking System; the Configuration Management application).

The Application Framework provides all the necessary services to allow the application(s) to persist and share data in a common-version controlled object database.

Just like Eclipse provides the ability to add a plugin to the existing Eclipse environment, so OSEE allows other applications to add plugins and share the common data storage.

And just like Eclipse RCP allows an application to be built and deployed using the Eclipse framework but not include all the Exemplary applications like JDT, OSEE allows an application to be built and deployed using the OSEE Application Framework without including such applications as OSEE Define and OSEE ATS.

OSEEArchitecture.gif

Client/Server Architecture

In order to be a scalable system, the Open System Engineering Environment (OSEE) has been slowly migrating into a distributed architecture where clients interact with an application server in-charge of managing access to an OSEE data store. Additionally, in an effort to provide load balancing, failure recovery, and code compatibility, clients consult an arbitration server before connecting to an application server. The arbitration server's responsibility is to keep track of all the application servers interacting with a common data store and direct clients to a healthy application server compatible with the client’s OSEE code version. In this arrangement, arbitration servers act as the initial access points into the OSEE server cloud where a collection of application servers manage client requests to access and operate on a common OSEE data store. Figure 1 shows an example of the OSEE Client/Server network.


Client server view.png

In the figure above, three application servers interact with a single OSEE data store. The data store is comprised of a relational database and a remote file system used to store binary data. It is not necessary for the database and the binary data to exist on the same machine. The only requirement is that the application servers have access to both resources. Upon start-up, each application server registers himself on the data store’s server lookup table by entering its host address, port, supported code versions, and its unique id. When the arbitration server receives a request to find an application server to support a client connection, the arbitration server reads the data store’s server lookup table and selects the best match for the client. The client requests this information from the arbitration server upon start-up or whenever it can’t communicate with an application server. It is important to note that the arbitration server does not have to be a different server thanan application server. All application servers are able to act as an arbitration server. An application server is referred as an arbitration server when clients interact with it in this context. Figure 2 depicts the sequence of events involved in the arbitration process.


Arbitration sequence.png

Once a client receives an application server's address and port information, the client must authenticate with the application server before it can gain access to the OSEE data store. During the authentication process, a client submits to the application server the current user's credential information and the authentication protocol id to use during the process. The application server verifies the user via the selected protocol and grants access to the data store by creating a session for the user. From this point forward, the application server will be responsible for managing access to the data store by identifying the user via the session id. Whenever a client wants to interact with the application server, it will need to submit its session id in order to gain access to the OSEE data store. Figure 3 shows the sequence of events involved in the authentication process.


Authentication sequence.png

Data Model

The OSEE framework is built around a user configurable and extensible data model comprised of attributes, artifacts, and relations. An attribute is a key value pair representing a single data element such as a description, a date, a number, or a file. These basic data elements are grouped into artifacts. Artifacts can be configured to have any number of attributes. By default, an artifact will always have an attribute of type name. In addition, artifacts can be related to one another via relations. By default, an artifact will always have a default hierarchy relation type. This allows artifacts to be connected together in a tree like fashion. In the example below, two instances of the basic artifact type are shown. Artifact 1 has an attribute of type name set to string data "X". Artifact 2 has an attribute of type name set to string data "Y". These two artifact instances are related via the default hierarchy relation type. Artifact 1 is Artifact 2's parent artifact.


Basic artifact.png

Now that we have a basic understanding of the model, lets take a closer look at attributes and how they are defined. An attribute is defined through its attribute type. The attribute type is a blue print for constructing attribute instances. It defines the type of data the will be held by the attribute, the data source or who provides it, how many instances can be created, default value to use during creation, whether the attribute can be tagged for word searches, and if the attribute holds file data, its file extension. By default, data contained in the attribute can be represented through OSEE's basic data types:

  • String Attribute
  • Boolean Attribute
  • Integer Attribute
  • Floating Point Attribute
  • Date Attribute
  • Enumerated Attribute

OSEE provides 3 attribute data providers: the default attribute data provider, URI attribute data provider, and the Clob attribute data provider. The default attribute data provider is used for data containing less than 4000 characters in length. Data is stored and retrieved from the OSEE relational database. Most attribute types will use this data provider to handle its data content. The URI attribute data provider is used for large data. The provider communicates to the OSEE application server to store and retrieve data. The Clob attribute data provider is a hybrid provider using both the OSEE relational database and the application server to retrieve and store data. When the data contained by the attribute has less than 4000 characters, the provider uses the relational database. If the data exceeds the 4000 character limit, then the application server is used.


AttributeType.png

SQL Examples

-- create a trigger that runs each time rows are deleted from osee_server_lookup
 
CREATE OR REPLACE TRIGGER osee_server_lookup_brd
BEFORE DELETE ON osee_server_lookup
 
FOR each ROW
   BEGIN
      INSERT INTO find_user( user_name, chg_date) VALUES (USER, sysdate );
   END;
 
-- create a synonym in the osee_client scheme to the table osee_enum_type_def owned by scheme osee and then give osee_client privileges to actually use it
CREATE OR REPLACE SYNONYM osee_client.osee_enum_type_def FOR osee.osee_enum_type_def;
GRANT SELECT, UPDATE, INSERT ON osee_enum_type_def TO osee_client;
 
-- an update statement that involves another table
UPDATE osee_attribute_type aty SET enum_type_id = (SELECT et.enum_type_id FROM osee_enum_type et WHERE aty.name = et.enum_type_name) WHERE validity_xml IS NOT NULL; 
 
-- retrieve duplicate HRIDS, its GUID and Artifact Type name:
SELECT t1.guid,
  t1.human_readable_id,
  t3.name
FROM osee_artifact t1,
  osee_artifact_type t3
WHERE t1.human_readable_id IN
  (SELECT t2.human_readable_id
   FROM osee_artifact t2
   GROUP BY t2.human_readable_id HAVING COUNT(t2.human_readable_id) > 1)
AND t3.art_type_id = t1.art_type_id
ORDER BY t1.human_readable_id;
 
-- retrieve the number of attributes with the specified value: 
-- (Note: COUNT function returns the number of rows in a query, COUNT(1) is for better performance;
-- In the below example, the COUNT function does not need to retrieve all fields from the osee attribute table 
-- as it would if you used the COUNT(*) syntax. It will merely retrieve the numeric value of 1 for each record
-- that meets your criteria)
SELECT COUNT(1) FROM osee_attribute WHERE VALUE LIKE ?, WHERE ? == '%<value>%'
 
-- retrieve the number of commit comments with the specified value:
SELECT COUNT(1) FROM osee_tx_details WHERE osee_comment LIKE ?, WHERE ? == '%value>%'
 
-- retrieve the number of branch names with the specified value:
SELECT COUNT(1) FROM osee_branch WHERE branch_name LIKE ?, WHERE ? == '%value>%'
 
-- retrieve all data from the specified tables on a specific artifact 
SELECT *
FROM osee_artifact_version arv,
  osee_txs txs,
  osee_tx_details txd
WHERE art_id = <value>
 AND arv.gamma_id = txs.gamma_id
 AND txs.transaction_id = txd.transaction_id
 
-- retrieve all data from the osee artifact table for the specified artifact 
SELECT * FROM osee_artifact WHERE art_id=<value>

Configuration Properties

OSEE can be configured by setting the following Java system properties when launching Eclipse. Java system properties are key/value pairs and can be passed as launch arguments in the form of -D<key>=<value> (i.e. -Dosee.authentication.protocol=trustAll). These -D options can be specified directly in the command to launch Eclipse or in the corresponding ini file for the eclipse executable used.

Osee System Properties

System Property Name Values Default Description
osee.connection.info.uri [FILE SYSTEM PATH] File system path or uri containing custom database connection information.
osee.db.connection.id <db identifier> Default from db.connection file Specifies which database OSEE should connect to. This id references connection information specified in the ...db.connection.xml file. See #Database Connection Information file for more information.
osee.jini.forced.reggie.search true, false false If true, adds the lookupList to the global lookup list such that a refresh will try to locate the service again
osee.jini.lookup.groups user defined group name the Jini Group that all OSEE provided Jini services will register with
osee.log.default FINE, INFO, WARNING, SEVERE WARNING the default logging level for all loggers
osee.port.scanner.start.port 1 - 65535 18000 the first port number to test for availability when a new port is needed

Osee Application Server Properties

System Property Name Values Default Description
org.osgi.service.http.port 1 - 65535 -1 Port the client will use to communicate with the OSEE Application Server
osee.application.server.data [FILE SYSTEM PATH] User Home A directory on the file system to be used by the application server to store and serve artifact binary data.
osee.derby.server [<address>:<port>] When specified, this system property sets the URL used to launch a derby database server.
osee.application.server.data [FILE SYSTEM PATH] User Home A directory on the file system to be used by the application server to store and serve artifact binary data.
osee.version [<"version 1">;<"version 2">] When specified, this system property sets the application server's supported client versions. NOTE: version string can use regular expressions
osee.check.tag.queue.on.startup true, false false When specified, this system property allows the application server to check the tag queue and begin tagging and pending tag jobs.

Osee Client Properties

System Property Name Values Default Description
osee.application.server <address>:<port> When specified, this system property sets the URL used to reference the application server and arbitration is bypassed.
osee.arbitration.server <address>:<port> The arbitration server address and port to use. This system property must be specified for the system to gain access to OSEE data. If the application server property is set then that address takes precedence and arbitration is bypassed.
osee.authentication.protocol protocol name protocol to be used by the client to authenticate with the server
osee.choice.on.db.init choice name the predefined database initialization choice
osee.file.specified.schema.names.on.db.init true, false false Specifies whether OSEE database initialization should use the schema names specified in the schema.xml files instead of using the connection schema. Using the connection specified schema is the default behavior.
osee.import.from.connection.id.on.db.init [FILE SYSTEM PATH] Specifies where table data should be imported from during OSEE database initialization. The default is to use the database connection id specified in the schema.xml files.
osee.import.on.db.init true, false false Specifies whether OSEE database initialization should import database data as part of its tasks.
osee.local.application.server true, false false When set to true launches an application server upon start up. Uses org.osgi.service.http.port arg to determine port to use.
osee.local.http.worker.port <port> Port Scan starting from 18000 Port to use for local worker server.
osee.prompt.on.db.init true, false true Specifies whether to interactively prompt the user during database initialization for init choice
osee.record.activity true, false true Specifies whether user activity should be logged
osee.ote.benchmark true, false
osee.ote.cmd.console true, false Specifies whether to enable the OTE command console
osee.ote.server.title free text name name given to the OTE server which is displayed in the test manager
osee.ote.timing.log.path
osee.ats.ignore.config.upgrades true, false

Database Connection Information

To define a custom database connection for the application server, a path to an xml with the following format is required when launching the application server. This path will need to be specified using the osee.connection.info.uri and osee.db.connection.id jvm arguments on launch. See Configuration_and_Arguments for more information.

<?xml version="1.0" encoding="UTF-8" ?>
<DbConnection>
 
<DatabaseInfo id="postgresqlInfo" >
   <DatabaseHome key="#DBHOME#" value="DATABASE HOME LOCATION" />
   <DatabaseName key="#DBNAME#" value="DATABASE NAME" />
   <DatabaseType key="#TYPE#" value="postgresql" />
   <Prefix key="#PREFIX#" value="jdbc:postgresql" />
   <UserName key="#USERNAME#" value="DATABASE USERNAME" />
   <Password key="#PASSWORD#" value="DATABASE PASSWORD" />
   <Host key="#HOST#" value="@AvailableDbServices.hostAddress" />
   <Port key="#PORT#" value="@AvailableDbServices.port" />
</DatabaseInfo>
 
<ConnectionDescription id="postgresql" >
   <Driver>org.postgresql.Driver</Driver>
   <Url>#PREFIX#://#HOST#:#PORT#/#DBHOME##DBNAME#</Url>
</ConnectionDescription>
 
<AvailableDbServices>
   <Server id="ANY NAME" dbInfo="postgresqlInfo" 
           hostAddress="DATABASE IP ADDRESS" port="DATABASE PORT" 
           connectsWith="postgresql" isProduction="false" />
</AvailableDbServices>
</DbConnection>

The sample file above defines PostgreSql connections but it can be changed easily to define oracle or derby connections.

The file is divided as follows:

  • Database Info: This entry describes the database to connect to by defining the database name, database home location and user name (or schema) and password to use during connection. When using the OSEE PostgreSql installation instructions, the fields should be set to the following:
    • DATABASE HOME LOCATION: not used therefore remove the value field from this attribute
    • DATABASE NAME: OSEE
    • DATABASE USERNAME: osee
    • DATABASE PASSWORD: osee
  • Connection Description: This entry describes how the database connection url should be assembled. At connection time, the fields enclosed in ## are substituted with the information defined in the database info section. There shouldn't be a need to change this unless you want to connect to a database other than PostgreSQL.
  • Available Database Services: This section contains entries for each database server and connection option needed at launch time. An entry is referenced at launch time by calling out the entry id in the osee.db.connection.id argument. When using a local OSEE PostgreSql install, the attributes on a server entry should be set to the following:
    • id: any meaningful name to identify this entry
    • hostAddress: localhost
    • port: 5432 (the default PostgreSql port)
    • isProduction: false unless you want to prevent clients from initializing the database

Custom Data Model

The data model in OSEE is extensible and user configurable. Users can define new artifact, attribute, and relation types and their constraints such as multiplicity and applicability. Type inheritance allows similar types to be defined and modified without tedious redundancy because similar types inherit what is common from their super type.

The OSEE data model is defined using a tabular format involving 5 tables. See the following xml spreadsheet ProgramAndCommon.xml for an example.

The full data model can be defined using a single spreadsheet or be divided among multiple spreadsheets that can reference types defined in any spreadsheet.

Artifact Type Table

Column Name Description
Factory Class The factory that is responsible for constructing instances of this artifact type at runtime. Fully qualified java class name of a class that extends org.eclipse.osee.framework.skynet.core.artifact.ArtifactFactory.

The standard and simplest case is to specify org.eclipse.osee.framework.skynet.core.artifact.factory.BasicArtifactFactory which will cause the java type org.eclipse.osee.framework.skynet.core.artifact.Artifact to be instantiated at runtime. If a custom java type that extends Artifact is needed, then the corresponding custom artifact factory should be specified here.

Artifact Type Name any valid UTF-8 characters with a max length of 75 bytes
Super Type Name The super artifact type from which this type will inherit associated attributes and relations. Another concrete artifact type or an abstract one that exists only in data model definition.

Attribute Type Table

Column Name Description
Attribute Base Type

Fully qualified java class name of a class that extends org.eclipse.osee.framework.skynet.core.attribute. The typical and simplest case is to specify one of the built-in types:

  • org.eclipse.osee.framework.skynet.core.BooleanAttribute
  • org.eclipse.osee.framework.skynet.core.CompressedContentAttribute
  • org.eclipse.osee.framework.skynet.core.JavaObjectAttribute
  • org.eclipse.osee.framework.skynet.core.DateAttribute
  • org.eclipse.osee.framework.skynet.core.FloatingPointAttribute
  • org.eclipse.osee.framework.skynet.core.IntegerAttribute
  • org.eclipse.osee.framework.skynet.core.StringAttribute
  • org.eclipse.osee.framework.skynet.core.EnumeratedAttribute
  • org.eclipse.osee.framework.skynet.core.WordTemplateAttribute
  • org.eclipse.osee.framework.skynet.core.WordWholeDocumentAttribute

If a custom java type that extends Attribute is needed, then that type should be specified here.

Attribute Data Provider The attribute data provider is responsible for storing and retrieving attribute data. Fully qualified java class name of a class that implements org.eclipse.osee.framework.skynet.core.attribute.providers.IAttributeDataProvider. org.eclipse.osee.framework.skynet.core.DefaultAttributeDataProvider may be used when the data to be stored does not exceeded 4000 bytes, otherwise org.eclipse.osee.framework.skynet.core.UriAttributeDataProvider may be used.
Attribute Type Name Any valid UTF-8 characters with a max length of 500 bytes
File Extension Any valid UTF-8 characters with a max length of 50 bytes; only applies when using the org.eclipse.osee.framework.skynet.core.UriAttributeDataProvider
Tagger ID If the attrbiute&#146;s content is to be included in the search index for the quick search, use DefaultAttributeTaggerProvider, otherwise leave blank.
Default Value The initial value given an attribute upon initialization, this may be left blank
Validity Xml For the attribute base type org.eclipse.osee.framework.skynet.core.EnumeratedAttribute, specifies the valid enumerations. For example, <Page_Type><Enum>Portrait</Enum><Enum>Landscape</Enum></Page_Type>
Min Occurrence The framework with prevent having lest than this number of this attribute type on a single artifact
Max Occurrence The framework with prevent adding more than this number of this attribute type to a single artifact
Tip Text Text to describe an attribute. Any valid UTF-8 characters with a max length of 4000 bytes

Artifact Type / Attribute Type Mapping Table

Column Name Description
Artifact Type Name Exact name of an artifact type defined above (or previously)
Attribute Type Name Exact name of an attribute type defined above (or previously) to be associated with the corresponding artifact type

Relation Type Table

Column Name Description
Relation Type Name Any valid UTF-8 characters with a max length of 50 bytes
Side A Name Descriptive name for the A side of the relation. Any valid UTF-8 characters with a max length of 50 bytes
A to B Phrase An optional phrase that describe the relation between the artifacts from the side A perspective. Any valid UTF-8 characters with a max length of 50 bytes
Side B Name Descriptive name for the B side of the relation. Any valid UTF-8 characters with a max length of 50 bytes
B to A Phrase An optional phrase that describe the relation between the artifacts from the side B perspective. Any valid UTF-8 characters with a max length of 50 bytes
Short Name Five or less characters is typical. This abbreviated name is used in the user interface when space is at a premium
Ordered Yes to have artifacts on the same side of this relation type use a user defined ordered, otherwise No

Artifact Type / Relation Type Mapping Table

Column Name Description
Artifact Type Exact name of an artifact type defined above (or previously)
Relation Type Exact name of an relation type defined above (or previously)
Side A Max An artifact of type "Artifact Type" can be on side "A", "Side A Max" number of times for relation links of type "Relation Type"
Side B Max An artifact of type "Artifact Type" can be on side "B", "Side B Max" number of times for relation links of type "Relation Type"

Import OSEE Data Model

To import changes to the data model for an existing OSEE database:

  1. Navigate to the Project Explorer (Resource Perspective) or the Package Explorer (Java Perspective)
  2. Select a file or folder containing the OSEE data model
  3. Right click and select Import...
  4. Under the OSEE category, select OSEE Types

To automatically import the data model during database initialization use the extension point org.eclipse.osee.framework.skynet.core.OseeTypes

Configure a Development Runtime

Using an SVN client such as <a href="http://www.eclipse.org/subversive/">Subversive</a>, check out into your Eclipse workspace all the projects from https://dev.eclipse.org/svnroot/technology/org.eclipse.osee/trunk/. When configuring this SVN repository leave the user name and password blank in order to get anonymous, read-only access.

  1. <a href="http://www.eclipse.org/osee/documentation/installation/postgresql_install.php">PostgreSQL Installation</a>
  2. Use the configuration \org.eclipse.osee.framework.resource.management\OseeApplicationServer [postgresql localhost].launch to run an OSEE application server
  3. Use the configuration \osee.runConfigs.db.postgres\DB Config [postgresql localhost].launch to run an OSEE database initialization
  4. Use the configuration \osee.runConfigs.db.postgres\OSEE product [postgresql localhost].launch to run a local OSEE client

Configuring ATS for Change Tracking

Configuring ATS for Change Tracking

Coding Standards

Utility Classes

In order to optimize reuse of code, OSEE developers have adopted a set of standards.

Utility classes should:

  1. Be named xxxUtil. This allows for each searching and location by looking for *Util. This excludes stand-alone utility classes like HashCollection or CountingMap.
  2. As much as possible, be located in a package postfix'd with .util. eg. org.eclipse.osee.ats.util
  3. Should contain static methods


Cleanup of existing utility methods

The following needs to be done:

  1. Create set of common utility class names
  2. Move utilities to their respective places
  3. Either deprecate or replace uses of old locations

OSEE Master Test Suite

OSEE uses JUnit 4 for it's test suites. Some links to get started.

Use Cases

Requirements of the OSEE test suite:

  1. Single button press to run all tests
  2. Don't want to maintain numerous launch configurations
  3. Ability for any user, internal/external, to easily run a suite of tests before commit
  4. Continuous integration (checkout, build, test, report)
  5. Use JUnit framework for all testing
  6. Enable health checks against production database to be part of test suite
  7. Easy ability to add new test cases

Running the OSEE Test Suite

The OSEE test suite uses the "org.eclipse.osee.ats.config.demo" plugin to initialize a demo database, populate it with demo data and run the majority of the OSEE test against this common data set.

These tests are contributed to the MasterTestSuite groups using Eclipse's extension point framework. Any Test Suite can implement IOseeTest and extend the OseeTest extension point to be contributed to the appropriate test suite(s).

Steps to test

  1. Checkout org.eclipse.osee.ats.config.demo
  2. Checkout org.eclipse.osee.support.test
  3. Run the following tests in order and resolve any errors:
    1. Run the Demo database tests:
      1. Run the OSEE Demo Application Server launch config
      2. Run the MasterTestSuite_DemoDbInit launch config. This initializes the postgres database for demo populate and tests
      3. Run the MasterTestSuite_DemoDbPopulate launch config. This loads the database with branches, actions and sets conditions for populate tests.
      4. Run the MasterTestSuite_DemoDbTests launch config. This runs tests against the DemoDb Populated database.
      5. Stop the OSEE Demo Application Server if still running
    2. Run the Production TestDb tests:
      1. Run the OSEE Application Server launch config.
      2. Run the MasterTestSuite_TestDbInit launch config. This initializes the postgres database for production testdb tests
      3. Run the MasterTestSuite_TestDbTests launch config. - This runs production specific tests using a TestDb.
    3. Run the Production tests and health checks against the current production release
      1. Run the MasterTestSuite_ProductionTests launch config. This runs tests and health checks against the current production released database.

Common test utility plugin

The plugin org.eclipse.osee.support.test.util is in support of our testing framework. It has a number of common enums and a TestUtil class that should be used by any junit tests. The intent is to keep this plugin lightweight and without many dependencies cause all the testing fragments "should" include it. In addition, it should not be included by any production plugins, only test fragments.

Adding new Tests to MasterTestSuite

To create test fragment off plugin to be tested

All OSEE JUnit tests should live in a fragment of the plugin to be tested.

  1. Select plugin to be tested
  2. Right-click -> New Project -> Plugin Project -> Plugin Fragment
  3. Enter plugin to be tested as Host plugin
  4. Complete wizard
  5. In plugin to be tested (eg org.eclipse.osee.ats)
    1. Add "Eclipse-ExtensibleAPI: true" to MANIFEST.MF of plugin to be tested. This allows test suites to see tests in this plugin
  6. In new fragment (eg org.eclipse.osee.ats.test)
    1. Add org.junit4 (make sure junit4, not junit) to dependencies
    2. Add the common test utility plugin org.eclipse.osee.support.test.util plugin to dependencies
    3. Export packages containing TestCases and TestSuites
  7. In MasterTestSuite plugin (eg org.eclipse.osee.support.test)
    1. Add dependency on plugin to be tested (ge org.eclipse.osee.ats)
    2. Add test cases and suites from fragment to appropriate MasterTestSuite java Test Suites

To add a new JUnit TestCase

  1. Write the TestCase to run against a database populated with DemoDbInit and DemoDbPopulate
  2. Add the TestCase to an existing MasterTestSuite_DemoDbTests test suite

Things to consider

  1. Your tests must clean-up after themselves to ensure that the entire test suite can be run.
  2. Do not assume order of execution except within your own Test Suite

To add a new JUnit TestSuite =

  1. Create a fragment for the plugin (see above)
  2. Create new JUnit TestCases as above
  3. Create a new JUnit TestSuite
  4. Add new TestSuite to one of the MasterTestSuite java test suites

Framework Regression Tests

  1. Health Checks
    1. Database Health
  2. Change Report
    1. Open With
      1. MS Word Preview - covered
      2. MS Word Preview with Children - covered
      3. MS Word Edit (include Saving Edits) - covered
      4. Artifact Editor - covered
    2. Reveal Artifact in Explorer
    3. Resource History - covered
    4. Single Native Diff
    5. View Word Change Report (diffs) - covered
    6. View Viewer Report
    7. Refreshing - covered
  3. Artifact Explorer
    1. Open With
      1. MS Word Preview - covered
      2. MS Word Preview with Children - covered
      3. Artifact Editor
    2. Reveal on Another Branch
    3. Go Into
    4. Mass Edit - covered
    5. Sky Walker - covered
    6. Delete Artifact - covered
    7. Purge Artifact(s) - covered
    8. Rename Artifact - covered
    9. Show Resource History - covered
    10. Removal of Smart Tags - covered
    11. Detect Track Changes - covered
    12. Drag and Drop - covered
  4. Branch Manager
    1. Explore
    2. Change Report - covered
    3. Branch - covered
    4. Update Branch - covered
    5. Commit Into - covered
    6. Delete Branch - covered
    7. Purge Branch - covered
    8. Open Associated Artifact - covered
    9. Set Associated Artifact - covered
    10. Archive
    11. AccessControl
    12. Rename
    13. Mark as Favorite
    14. Open Osee Data Model Editor - covered
    15. Open Branch Graph - covered
    16. Merge Manager - covered

Master Test Suite - Frequently Asked Questions

What do I need for every test case?

  • import static org.junit.Assert.*;
  • In setup method (@Before), always assert that you are on correct database by adding one of these
assertTrue("Should be run on production datbase.", TestUtil.isProductionDb());
assertTrue("Should be run on test datbase.", TestUtil.isTestDb());
assertTrue("Should be run on demo datbase.", TestUtil.isDemoDb());
  • In setup method (@Before), always assert that you have correct app server running *
assertTrue("Demo Application Server must be running.",
  ClientSessionManager.getAuthenticationProtocols().contains("demo"));
assertTrue("Client must authenticate using demo protocol",
   ClientSessionManager.getSession().getAuthenticationProtocol().equals("demo"));
 
assertFalse("Application Server must be running.",
   ClientSessionManager.getAuthenticationProtocols().contains("demo"));
assertFalse("Client can't authenticate using demo protocol",
   ClientSessionManager.getSession().getAuthenticationProtocol().equals("demo"));
}

Why do I get an exception on synchronized-lock when I launch the tests

The launch configuration does not have all plugins necessary to run.

  1. Open Debug Configurations for that launch item
  2. Go to plugins tab and select "Validate Plugins". This will show if any plugins are missing from selected items.
  3. Select "Add Required Plugins" to add them.
  4. Re-launch.

Why do I get exceptions that cycle was detected when I add things to the org.eclipse.osee.test.util plugin

This plugin is meant to be extremely light-weight and only provide simple statics and methods to all the test plugins. Because it has to be included in all test fragments from jdk.core all the way up to framework.ui (skynet.ui), it can not depend on any of the higher level plugins or cycles will occur. Remove these dependencies and cycles will be fixed.

How do I timeout a test?

Define a timeout period in miliseconds with “timeout” parameter. The test fails when the timeout period exceeds. view

@Test(timeout = 1000)  
public void infinity() {  
    while (true);  
}

How do I test exception handling

Exception Handling Use “expected” paramater with @Test annotation for test cases that expect exception. Write the class name of the exception that will be thrown. view plainprint?

@Test(expected = ArithmeticException.class)  
public void divisionWithException() {  
   // divide by zero  
   simpleMath.divide(1, 0);  
}

Things needing to be done

  1. Convert "Skynet Core Tests NonProduction" to MasterTestSuite framework
  2. Convert "Skynet Core Tests Production" to MasterTestSuite framework
  3. Convert "11g Performance Tests" to MasterTestSuite framework
  4. Investigate CruiseControl to figure out the continuous integration concept of checkout, build, test and report

Helpful links

Back to the top