iShare
The IntelliCorp Community Site
Java Impact Analysis (Part 2)

In this post I'm going to walk through a complete example using LiveCompare 2.2's new Java Impact Analylsis functionality.  To begin we need some Java code.  Here's a simple calculator class:

/* V1 */

public class Calculator

{

        public int Add(int x, int y)

        {

                return x + y;

        }

 

        public int Sub(int x, int y)

        {

                return x - y;

        }

 

        public int Div(int x, int y)

        {

                return x / y;

        }

 

        public int Mul(int x, int y)

        {

                return x * y;

        }

}

 

That was version 1.  Here's version 2: 

/* V2 */

public class Calculator

{

        public int Add(int x, int y)

        {

                return x + y;

        }

 

        public int Sub(int x, int y, int z)

        {

                return x - y - z;

        }

 

        public int Div(int x, int y)

        {

                return x / y;

        }

 

        public double Div(double x, double y)

        {

                return x / y;

        }

 

        public double Mod(double x, double y)

        {

                return x + y;

        }

}

Just by looking at the two classes I can see that there are differences (albeit somewhat artificial).  LiveCompare doesn't work with Java source code files, it works with the compiled binary format.  We need a Java compiler to turn our source files into classfiles.

Once I have the classfiles I zip each version up (v1.zip and v2.zip) before uploading both of them to the LiveCompare server through the new Java Files administration hierarchy.  See below for the steps:

 

Now I need to build a LiveCompare template (don't worry, LiveCompare 2.2 will ship with it in-the-box) to analyze my two packages of classefiles.  Here's the completed template:

 

The Create Java Impact Analysis Report has several parameters.  In this example we need to use: Lefts, Rights, Object Status to Keep, Report Url and Report Name.

In the Lefts stringlist we type the name of the v1.zip package.  In the Rights stringlist we type the name of the v2.zip package.  We set the Object Status to Keep to Same, Different, In1, In2.  The Report Name is JIA-DEMO and the Report Url is left empty - it's an output parameter that LiveCompare will fill in for us.

Now it's just a case of running the template.  Given that packages we're analyzing are very small (one class in each remember) it takes about a second to run.

The output is a report (accessed either via the Report Url dataset) or form the Workspace's Reports folder that looks like:

 

You can navigate the report by clicking on the class to get a detailed view of the differences.

 

Next time I'll show how we can use this action and via the Tops parameter actually do some impact analysis.

Here's a video of the comparison functionality in action:

Comments welcomed.

See the other parts in this series:

Part 1


Posted 01-22-2009 8:44 AM by Chris Trueman
Filed under: , ,

Comments

Chris Trueman's Blog wrote SAP Experience Day
on 04-30-2009 11:46 AM

This past week one of our customers in Chicago hosted an 'SAP Experience Day' at which they presented

Chris Trueman's Blog wrote Enhanced Java Analysis
on 06-24-2010 12:27 AM

LiveCompare 2.4 sees the first major enhancement to our Java analysis that debuted in LiveCompare 2.2