Chapter 8. Verification and Validation

8.1. Red Hat Developer Studio Verification

As you are developing your project, Red Hat Developer Studio Verification constantly provides dynamic validation, consistency checking and error checking. This greatly reduces your development time as it allows you to catch many of the errors during development. Red Hat Developer Studio provides dynamic verification for both JSF and Struts projects.

8.1.1. JSF Project Verification

Red Hat Developer Studio checks for many different rules for a JSF project that can be configured by selecting Window > Preferences from the menu bar, selecting Red Hat > Verification from the Preferences dialog box and then expanding the JSF Rules node.

JSF Rules

Figure 8.1. JSF Rules

Suppose you are working in the Source viewer for a JSF configuration file as shown below:

Faces-config.xml File

Figure 8.2. Faces-config.xml File

While typing a class name, you might make a minor typo (like "jsfHello.PersonBean9" instead of "jsfHello.PersonBean"). After saving the file, verification checks to make sure everything is correct and finds the error below:

Error In Source View

Figure 8.3. Error In Source View

You can place the cursor over the line with an error message and get a detailed error message:

Error Message

Figure 8.4. Error Message

Verification also checks navigation rules:

Checking Navigation Rules

Figure 8.5. Checking Navigation Rules

If you provide a page name that does not exist, verification will let you know about that:

Page Name Verification

Figure 8.6. Page Name Verification

You can always call up verification explicitly by right-clicking and selecting Verify from the context menu. This works from both the Tree and Diagram viewers for the JSF configuration file editor. You can also invoke verification from the Web Projects view. Below we are checking all of the elements in the configuration file.

Verify Command

Figure 8.7. Verify Command

Applying Verification Rules

Figure 8.8. Applying Verification Rules

8.1.2. Struts Project Verification

Red Hat Developer Studio provides the same functionality for Struts projects. To configure Struts project verification select Window/Preferences from the menu bar, select Red Hat/Verification from the Preferences dialog box and then expand the Struts Rules node.

Struts Rules

Figure 8.9. Struts Rules

Suppose you are working in the Source viewer for a Struts configuration file as shown below:

Struts Configuration File

Figure 8.10. Struts Configuration File

While typing a class name or entering it from the graphical editor, you might make a minor typo (like "sample.GreetingAction1" instead of "sample.GreetingAction"). After saving the file, verification checks to make sure everything is correct and finds the error below:

Error Reporting

Figure 8.11. Error Reporting

You can place the cursor over the line with the error to view a detailed error message:

Error Message

Figure 8.12. Error Message

The verification also checks to make sure you have specified the correct JSP page for the forward:

JSP Page Verification

Figure 8.13. JSP Page Verification

Once you place the cursor over the line, you can see the error message:

Error Message

Figure 8.14. Error Message

You can always invoke the verification by switching to the Diagram viewer, right-clicking and selecting Verify from the context menu:

Verify Command

Figure 8.15. Verify Command