Submitting a bug report

# Submitting a bug report

## Submitting a problem report

### Driver

Most of the traffic on the Castor Users mailing list is about people asking for help on various features of Castor (whether JDO or XML). Whilst there is nothing wrong about asking questions and looking for help if you are stuck, it seems that there is room to improve the structure of this 'conversation'.

If you have a look at some of these threads (e.g. at the searchable mailing list archive), it's quite easy to see that most of the time ...

1. An initial question is posted.

2. An initial reply is posted with some follow-up questions, e.g. request for code fragments, mapping files, etc.

3. One or more code fragments, mapping files, etc. are being posted.

4. etc.

This document will establish guidelines with regards to step 3) above.

### Introduction

This document provides step-by-step instructions on how to submit a problem report (when being asked to do so). It does so by walking you through a fictive problem and its resulting bug report, and providing instructions based upon this scenario.

Per definition, any problem report submitted (in other words, most likely attached to a bug report at http://jira.codehaus.org/browse/CASTOR) by the means of a patch has to include the following artefacts:

- A JUnit test case that 'showcases' your problem.

- Castor JDO configuration file.

- Castor JDO mapping file.

- One or more 'entity' classes required to run your test case.

- A SQL schema file (to help in the creation of required tables).

- A `README` file (with any additional information/instructions required to understand /run your test case.

Whilst we can and will not impose these guidelines in their strictest sense, I think that the use of technologies such as JUnit will simplify problem resolution and as a result lead to shorter turn-around times. Which is ultimately where you, the user, gains..

### Templates

To facilitate creation of a fully featured patch as discussed above, we have provided you with an already existing bug template at '`src/bugs/jdo/template`'.

Please note that this directory is distributed only as part of the source archive(s).

This directory holds all artefacts mentioned above, as is structured as follows:

bug template artefacts

`src` | Source code
`src/bugs` | Common root for bug reports
`src/bugs/jdo` | Common root for JDO bug reports
`src/bugs/jdo/template` | Patch template
`src/bugs/jdo/template/TestTemplate.java` | JUnit test case.
`src/bugs/jdo/template/EntityOne.java` | Entity required by the test case
`src/bugs/jdo/template/jdo-conf.xml` | Castor JDO configuration
`src/bugs/jdo/template/mapping.xml` | Castor mapping file
`src/bugs/jdo/template/create.sql` | SQL schema to create database table(s)
`src/bugs/jdo/template/README` | Test instructions

To create you own bug report, please copy '`template`' to e.g. `bug1820`, assuming that 1820 is the number assigned to your BugZilla problem report). Subsequently, please amend the files provided to match your own requirements. After you have consolidated your changes, the original directory structure in `src/bugs` could look as follows:

directory structure of `src/bugs`

`src` | Source code
`src/bugs` | Common root for bug reports
`src/bugs/jdo` | Common root for JDO bug reports
`src/bugs/jdo/template` | Patch template
`src/bugs/jdo/template/TestTemplate.java` | JUnit test case.
`src/bugs/jdo/template/EntityOne.java` | Entity required by the test case
`src/bugs/jdo/template/jdo-conf.xml` | Castor JDO configuration
`src/bugs/jdo/template/mapping.xml` | Castor mapping file
`src/bugs/jdo/template/create.sql` | SQL schema to create database table(s)
`src/bugs/jdo/template/README` | Test instructions
`src/bugs/jdo/bug1820` | Your specific bug (as per BugZilla bug number)
`src/bugs/jdo/bug1820/TestCase.java` | JUnit test case.
`src/bugs/jdo/bug1820/Entity1.java` | Entity required
`src/bugs/jdo/bug1820/Entity2.java` | Entity required
`src/bugs/jdo/bug1820/jdo-conf.xml` | Castor JDO configuration
`src/bugs/jdo/bug1820/mapping.xml` | Castor mapping file
`src/bugs/jdo/bug1820/schema.sql` | SQL schema to create database table(s)
`src/bugs/jdo/bug1820/README` | Test instructions

### Add your test case to the master test suite

Once you have successfully executed your JUnit test case, please add this test to the master test suite available in `src/bugs/AllTests.java` as follows. To add a test to this suite, please duplicate the line

        suite.addTestSuite(template.TestTemplate.class);

and replace the term '`jdo.template.TestTemplate.class`' with '`jdo.bug1820.TestCase`'.

This will allow us to run all tests related to all open bugs in one go by executing just this test suite.

### Creating the patch

As explained in Guidelines For Code Contribution, we ask you to submit your code changes in the form of a unified patch by attaching it to the relevant bug report.

To create a unified patch for submission, you can either use the command line SVN client (which you find instructions to download for at http://subversion.tigris.org/ or any IDE that offers support or SVN (such as Eclipse with Subclipse plugin)

In any case, please note that we are trying to standardize on the use of unified patches only, and that you should always update your code (against the SVN repository) before creating the patch. If you have never used SVN before, there will be ways to convince us to accept e.g. a Zip file includig your changes.

### References

Whilst we cannot assume that every Castor (JDO) user is an expert in the use of JUnit, we do believe that they are quite easy to get acquainted with. As a starting point, please find below some references:

- JUnit - A well-known framework for writing integration-level and functional tests.

- SVN Home - many usefulSVN related items