On this page:

Summary: creating an example Quality Rule Model and viewing live results

This page shows the creation of a hypothetical Quality Rule Model to check for a specific situation. This example will produce a Quality Rule Model that tests whether any Java Methods in your Application directly access Stored Procedures in your database. This example assumes that a front end Java application and a back end database have already been analyzed. 

A new Quality Rule Model is created with the two default sets, Scope and Violations:

Step 1 - Define Java Set and content

We want to test whether the Java Methods access Stored Procedures, therefore we first need to define the Scope set: this set will contain the Java Methods. To achieve this, we will add an additional set (called Java Methods) and then define a "block" in the Java Methods set that matches all Java Methods. Finally, we need to ensure that the Scope set re-uses the Java Method set.

Click here to expand...

Right click blank space in the Layers and Sets window and choose New Set:

Give the new set a name:

Drag the set into the Main window:

Click to enlarge

Define the content for the set: in this example we will re-use the Java Set in the default Scope set, therefore we just need to define a block that matches all Java Methods. The easiest way to do this is to drag the object type from the Types and Properties window:

Finally, we need to ensure that the Scope set re-uses the Java Method set. The easiest way to do this is to drag the Java Method set from the Layers and Sets window and drop it in the Scope set:

...and then choose the "member-of" block when prompted:

...to give you this configuration:

Click to enlarge

Step 2 - Define the Data Set

We want to test whether the Java Methods access Stored Procedures, therefore we now need to define the Violations set: this set will contain the criteria that define the objects that will be returned as violations. To achieve this, we will add an additional set (called Data) and then define an additional "block" in the Data set that matches all Stored Procedures. Finally, we need to ensure that the Violations set defines the Data Set via a caller-of block:

Click here to expand...

Right click blank space in the Layers and Sets window and choose New Set:

Give the new set a name:

Drag the set into the Main window:

Click to enlarge

Define the content for the set: in this example we will re-use the Data Set in the default Violations set, therefore we just need to define a block that matches all Stored Procedures. The easiest way to do this is to drag the object type from the Types and Properties window:

Click to enlarge

Finally, we need to ensure that the Violations set re-uses the Data set through a "caller-of" block The easiest way to do this is to drag the Data set from the Layers and Sets window and drop it in the "All objects matching" block that will already be present in the Violations set:

...and then choose the "caller-of" block when prompted, since the check we want to perform is Java Methods accessing Stored Procedures:

...choose the type of caller you require - in this example we are choosing a simple "Call" type link between Java Methods and Stored Procedures. We have left the Depth Level at the default value "1":

...to give you this configuration:

Click to enlarge

Note that the Violations set now uses an AND conjunction to define the objects that can be returned as violation:

All objects matching:

  • Member of set Scope (i.e. all Java Methods)
  • AND
  • Caller of objects matching this condition using Call links (i.e. Stored Procedures)

In other words, only Java Methods that call a Stored Procedure via a Call link.

Step 3 - Connect, check content and view results

Once the model has been created, you can use the "live" connection to the CAST AIP schemas to check the results, or "violations":

Click here to expand...

Use the Action > Compute all content menu option. If you are not already connected to a CAST Storage Service/postgreSQL instance on which your CAST AIP schemas are hosted (the schemas that contain your Application analysis results), you will be prompted to connect using the CAST Management Studio Database Connection Manager which will offer you the option to connect with one of your existing CAST Management Studio connection profiles:

Select the connection your require and click connect. If your current workstation does not have any CAST Management Studio connection profiles stored on it (i.e. CAST Management Studio has never been installed/run) then you can use the Quick Connection button to define a temporary connection. See CAST Architecture Checker - Connect and select application for more information.

Once connected, select the Application that you want to use to check your Quality Rule Model:

CAST Architecture Checker will now connect and retrieve the required data. Results are displayed with a numerical indication in the title bar of your Sets. This number refers to the number of objects that exactly match the selection criteria defined for your Set:

Click to enlarge

In this example we have the following details

  • The two custom sets match the following number of objects:
    • Java Methods = 78
    • Stored Procedures = 34
  • The two default sets match the following number of objects:
    • Scope = 78 (same as the Java Methods custom set)
    • Violations = 2

Therefore in this model we have 2 objects that are classed as violating the model: two Java Methods that directly call a database Stored Procedure.