Carlos Umanzor

Web Developer – Automation Specialist

Introducing one of my projects: LinkCrawler


Crawls a Site and gather information about Internal and External Links

HTMLUnit allows LinkCrawler to explore your site dinamically.

Saves report in HTML, EXCEL and JSON Format

Once the job is done, you can choose the right file format for you.

Intuitive User Interface with JavaFX

At version 3.5, the UI was moved from Swing to JavaFX to improve usability.

Works on Windows, Linux and Mac

It runs without problems on any Operating System with Java 7 or greater.

JavaFX Logo
Open Source
Maven project


Take a look at my latest post

How to automate Virtual Machine reversion with bash

Vmware ESX(i) is an incredible dynamic IT infrastructure, you can do wonderful things with this product, the only problem is: the license. Why the license? Well, let’s put it simple, the expensive the license, the more things you can do, so the free license barely allows you to do almost nothing.

For automation purposes, the free license does not provides API access, so you don’t have the best way to perform tasks like:

  1. Shutdown
  2. Power on
  3. Revert
  4. Reset and so on.

Now, is there a way to overcome this limitation? Yes, there is a way, but you need know something… this is kinda insecure, but if you are a good engineer then you shouldn’t have any problems.


  1. You need a Jenkins server (properly configured with user authentication and disallow anonymous usage)
  2. An ESX(i) server, make sure you have root access to it via ssh (you probably need to enable it)
  3. An Ubuntu machine, this one will be a jenkins slave, make sure it’s connected properly with jenkins

1 . Create some virtual machines

On your ESX(i) server, create a virtual machine, with a nice name. Install whatever OS you need and the software that you need to start testing. Finally create two snapshots, one after the one, I will explain this later.

2. Install a SSH Key from your Jenkins Slave into the ESX(i) server

This could be kinda tricky, but this is how we can overcome the absence of the API, we are going to manually use vim-cmd in order to achieve our objective.

Once we have the key installed, we can ssh into the ESX(i) server without using the password. NOTE: You will make the ESX(i) server vulnerable because of the root user, so PROTECT the jenkins slave at all costs, make sure no one can access the slave freely.

3. Create bash script

Before we need to valuable information, the ID of the virtual machine and the ID of the snapshot, we can get this via vim-cmd on your ESX(i) via ssh as follows:

You will get a response like this:

Our VM ID is 96, now we need the ID of the snapshot in order to revert it:

You will get the following information:

Notice that we have two snapshots, a parent and a child snapshot and here is the magic trick: Use the ID of the child snapshot, the reason? Because ESX(i) will keep the VM powered on no matter what, if you use the parent ID it will be automatically turned off after reverting the virtual machine.

With this information let’s create the script and place it on your jenkins slave workspace:

 Configure your Jenkins Job

Add a new “Execute Shell” build step and run your bash script from there, then add additional steps to finish the job according to your scenario, in my case I do perform a revert on 3 different virtual machines and execute an automated test suite with java over a customer’s product that I install using the same bash script.

Example of where to run the bash script

As you can see, we can overcome the “free license” limitation of ESX(i) by placing a SSH key on it and run vim-cmd commands directly, but beware, if the ESX(i) is restarted by some reason, the key will be deleted and you have to place it again.


Get data from xml with XSLT and xsltproc

Sometimes, when you have a large XML file and you need to “obtain” certain values in order to create an HTML structure, doing it by hand is just a nightmare… fortunately there is XSLT to save you time.


  • Any Linux OS or cygwin
  • xsltproc installed

The XML Data

Let’s pick some XML example from somewhere in the web, like this one, it’s looks like Chemical data for medicines, it’s huge and it may pose some difficulty but it will do.

Our scenarios

A. How do we obtain the list of all chemicals in the XML, and create an HTML dropdown box from it?

First, take a look at the XML and find the path that contains the chemicals.

Looks like the path is /MedlineCitationSet/MedlineCitation/ChemicalList/Chemical, now let’s create the XSLT.


This small XSL will use a little of XPath, as you can see, the template starts the HTML select object then it uses a foreach based on the path that we need to read and since the path is not fully filtered, it will cycle all possible elements that matches that path. Now run the following command:

And you will get the following result:

This works smoothly and you didn’t have to create the HTML Select by hand.

B. I would like it to sort the HTML Select alphabetically, is it possible?

Yes, it is.

Just do that tiny adjustment and it will sort the nodes based on child “NameOfSubstance”.

 C. I see a lot of duplicated options, is there a way to clean the result and remove duplicates?

Yes, you can do the following adjustments:

This is a solution for XSLT 1.0, there are better solutions than this in 2.0, but the available XSLT Processor supports 1.0 only. As you can see on line 3, I’m declaring a key that matches all possible chemicals and the select on line 6 will create an ID for each cycle on which no more that 1 ID matches with the key, these makes all results unique.

D. Whoa! I forgot that we require the ID of the chemical as the value of the option, can we add it?

Yes and it’s easy to do:

You will have to tweak the select at the foreach section to grab the previous node after the filtering. With this, you can access the attribute UI (which it looks like the ID) and get the following results:

As you can see, XSL Transformations are really useful when you do manipulates huge XML files in order to obtain prepared structures like an HTML select.

Let me know if you find this post useful.

Check some testimonies about my work

Read Testimonials

Pin It on Pinterest