Wednesday Feb 10, 2010

Using Selenium TestNG/JUnit and XPath Checker to Automate GlassFish v3 AdminGUI Server

It's been almost 2 years since I first use Selenium/TestNG to automate test cases for SocialSite Project. At that time, I'm not aware of using XPath checker or DOM inspector to identify a web element locator ID.

The Selenium APIs and TestNG harness are much more improving and robust now. Writers should be able to search for any answers from the web since more testers/developers are writing Selenium. My long time headache problem which to open a single browser for running with multiple classes is resolved in TestNG interface ITestContext - put it before and after you start/stop your test class

public void startBrowser(ITestContext context){
        browser = new DefaultSelenium();
        browser.start(); }

public void stopBrowser(ITestContext context) {
       browser = (DefaultSelenium) context.getAttribute("browser",browser);
       browser.stop(); }

I'm writing test for both JUnit and testNG frameworks.  JUnit harness has been widely using in developers community so if one doesn't often share the workspace with developers, I suggest using TestNG frameworks

TestNG has more annotations which provides more flexibility, less test depedency, advanced parametric and re-runable features. In addition, TestNG result is automatically reported in xml/html format.

Click here for my GlassFish V3 Acceptance Test Model

My preferences to the xpath links

Tuesday Feb 09, 2010

Add GlassFish v2/v3 Servers for Eclipse Bundle with Oracle Enterprise 11gR1 Package

There are few extra steps needed to add GlassFish V3 server to the Eclipse bunlde with Oracle WebLogic Server 11gR1 (10.3.2) Package

1. From the Eclipse IDE, select Help-> Install New Software menu tab

2. Click Add button then enter  to the add site (please, see the attached figure) -> click OK button -> continue with the procedure.

3. After restart the Eclipse IDE, change to Java EE Perspective -> select Servers tab -> right-click, select New-> Server menu -> expand GlassFish node, select a right GlassFish Server to add.

Note: If you are located inside a proxy domain please, configure the proxy server before downloading the GlassFish Plugin for the Eclipse bundle with Oracle WebLogic Server 11gR1 (10.3.2) Package.

Monday Jul 13, 2009

Install Ubuntu 9.04 with Sun VirtualBox 3.0

To Install Ubunto 9.04 version on VirtualBox 3.0

Hardware Preparation:
-Memory: 4G: 2G for host machine and 2G for Ubuntu
-Spaces: 15G or more for Ubuntu
Installation Preperation:
-From VirtualBox, change CD/DVD-ROM to mount the CD/DVD or ISO file
-Change the Network so it can read PCnet-FAST III, Bridge Adapter, nge1 (Assume Host is Ultra machine)
Install The software:
-Use default installation
Post Configuration:
-Configure Full Screen
   (From Ubuntu Devices menu, select to "Install Guess Addition" driver) -> go to the /cdrom menu to execute the \*.sh driver
-Allow to run system as root
   Execute command: sudo passwd root

Monday Jun 29, 2009

Running Netbean GlassFish V3 qa-functional Test

The GlassFish V3 plugin qa-functional test is running a little bit different than its previous GlassFish V2.x version which uses XTest for the harness.
Below is the procedure to check out the Netbean web-main, build and run with GlassFish V3 plugin qa-functional test.
Software requirements:
Mercurial hg, ant1.7.1, jdk1.5.0_17, jdk1.6.0_13. GlassFish V3 promoted build
Install Software (Solaris x86): 
Checkout, build and run-test
%hg clone
%cd web-main; ant
%ant -f glassfish.javaee/build.xml -Dtest-qa-functional-sys-prop.v3.server.path=/root/V3-B51-SDK/glassfish -Dtest-qa-functional-sys-prop.v3.server.javaExe=/usr/jdk/jdk1.6.0_12/bin/java test-qa-functional
Where: /root/V3-B51-SDK/glassfish is GlassFish V3 Server installed location
Generate report
%cd glassfish.javaee; ant test-generate-html
Fix the PermGem Memory Problem:
export ANT_OPTS="-Xmx512m -XX:MaxPermSize=128m"

Thursday Jun 25, 2009

GlassFish Eclipse Tools Bundle Hands on Lab Experience

It was my privilege and unforgivable experience to present the GlassFish Eclipse Tools Bundle 1.0 at JavaOne 2009 Conferrence

Click Here to download the Lab Exercise

Thursday Sep 04, 2008

PHP with Glassfish V3 and Netbean 6.5

Today I try configure and run PHP files with Glassfish V3 for both Quercus and Joomla (JavaBridge), and here is how I see.

1.  Joomla (JavaBridge) PHP
The simplest way for Joomla (JavaBridge) is just deploy the JavaBridege.war file to V3 server after unzip the file as shown in figure below:

Then, click launch to execute the JavaBridge PHP Sample index file as shown in the figurre below

Click the 1st link to execute test PHP info file, please see the result figure below:

If you want to customize the PHP application, unwar the JavaBridge.war file, do some cleanup then war the file back. For more instruction, please visist S├ębastien Dionne's article

2. For Quercus PHP
The same procedure applies to Quercus. Download Quercus zip file, unzip the file then war it. Use Glassfish Admin GUI console to deploy the app (in my case, I named it as Quercus.war). Please see figure below

3. If you want to use Netbean 6.5 IDE to write PHP files for mutiple applications, you can visit Arun Gupta's Blog for configuration steps. EXCEPT, copy all jars files to "GLASSFISH_HOME/glassfish/lib" directory" instead of "GLASSFISH_HOME/domains/domain/lib" likes in V2.

Friday Aug 29, 2008

Glassfish V3 Prelude Server with Netbean 6.5

Below is the simple steps to create and execute a sample Servlet Web Module with NB 6.5 for Glasfish V3 Server.

1.  Go to  download the latest 6.5 bits
2.  Install the Netbean IDE - by default Glassfish V2 and V3 sevrers were bunbdled with NB 6.5 as described in the figure below:

3. Start Netbean IDE (you can start from command line or from the Desktop icon)
    -If you click at Services tab > expand  the Servers node, you should see Glassfish V3 prelude server listed there
    -Right-click at Glassfish V3 node should allow you to start the server or view the server log or launch the  admin GUI console as described in the figure below:

4. To deploy a simple Servlet Web Project, click Project Tab > from File menu, select New Project > expand Samples > Java Web > select Servlets Example > click Next > choose a location for the project > click Finish button

5. Change server run time to Glassfish V3 Prelude (by default it's set to V2), right-click at ServletsExample project > select Run > change server from Glassfish V2 to Glassfish V3 > click OK

6. Right-click at ServletExamples project > select Run menu
       Glassfish V3 Server will be started (if not) > ServletExamples project is deployed and executed as shown in the figure below

Wednesday Jul 09, 2008

Eclipse Plugin for Glassfish Version 1.0.4 Release

The Plugin was published yesterday (July 08, 2008)

Release note and bugs fixed in this release.
The GF Plugin can be downloaded from within the Eclipse for Java EE Developers using the download additional server adapters link on the New Server Wizard.

Download Eclipse 3.4 Ganymede version

To Configure Eclipse 3.4 with Glassfish, please follow the instruction from Arun's Blog

For questions and comments:

For issues:

Thursday Jun 12, 2008

How to Connect Glassfish Derby from Eclipse IDE

Below is the steps to connect Glassfish V2 "sun-appserv-samples" Derby database from Eclipse JEE 3.3 version: (Please, use Eclipse IDE for Java EE Developer version and the instruction from this document to have GF server setup)

From IDE Window menu,  select Open Perspective > Other > choose Database Development

On the Database Development panel (figure below), righ-click Databases > select New from the menu
to create a New Connection Profile and choose 'Generic JDBC Conenction' from the list.

Click Next to enter a name for the
connection profile, name it as 'TestDerbyPool' > click Next and click ...

From Driver Definition panel, select Derby > 10.2 > click Add to add a new driver

From the New Driver Definition panel, select Derby > 10.2 > Derby Client JDBC Driver > click OK

From Edit Driver Denifition panel, remove the default derbyclient.jar file > click Add Jar/Zip to add the derbyclient.jar file from Glassfish directory > edit the properties as described in the following figure:
        Connection URL:      jdbc:derby://localhost:1527/sample;create=true
        Database Name:       sun-appserv-samples
        Driver Class:             org.apache.derby.jdbc.ClientDriver
        Password:                APP
        User ID:                   APP

Click OK > OK button to go back to the New JDBC Connection Profile panel. Now you should have all the fields values configured

Start the Derby database and click  Test Connection button. You should receive the Success and tables dialogs below:

For information to connect to Derby by using DTP please, click here

Wednesday Jun 04, 2008

Testing Sun N1 Service Provisioning System

Last week, I have a chance to test the N1SPS6.x Application Server Plugin. The steps to config and setup N1 system is more complicated than I thought since it requires a comprehensive software preparation. Please, see the figure below for the software components requirement 

Howerver, after the system was setup and ready to use, I was thrilled to learn that N1 can easily handle many different tasks that would require extremely amount of time to perform. Some of the main tasks that N1 can help users to do is including installation of Application Server package base, installation of load balancer plug-in on a remote machine, installation of HADB server, creation of node agent management, creation of clustermanagement, application deployment and much more. Please, visit the N1 article to learn more about the N1 system.

This is one of the examples I think first patient will pay off. After onetime patient setup, everything would become much easier.

Thursday Apr 17, 2008

Glassfish V3 with Netbean 6.1

Today, I just download Netbean 6.1 RC and try to see if it works with Glassfish V3 server. I'm impressed. It took me <5 minutes to have Glassfish V3 installed and configured with Netbean IDE. The procedure is so much simple and fast now.

It's required only 2 steps to configure Glassfish V3 with Netbean IDE. The Glassfish server was installed during the adding server process. View the screencast below to see how simple it is.
Steps to add Glassfish V3 to Netbean 6.x IDE

Thursday Mar 20, 2008

Create MySQL jdbc Connection Pool from Glassfish Admin GUI

To create a mySQL dbc connection pool from Glassfish V2 Admin GUI console, please follow 2 steps below
    1. Create a new mysql test account
    2. Create jdbc connection pool

1. Create a new mysql user account
    a. Start database from a command prompt
        $../<GlassFish-Installed>/mysql/bin/mysqld-nt.exe --defaults-file=../<GlassFish-Installed>/mysql/mysql.ini
         (For Solaris machine replace mysqld-nt.exe by mysqld_safe)
    b. Login as database admin to create a testUser account
        $../<GlassFish-Installed>/mysql/bin/mysql -u root
         mysql> grant all privileges on \*.\* to 'testUser'@'localhost' identified by 'testPassword';
2. Create jdbc connection pool and test the connection
     a. Start domain1
        ../<GlassFish-Installed>bin/asadmin start-domain
     b. Create jdbc connection pool for mySQL
          -From Admin GUI Console > expand Resources node > JDBC > Connection Pools > click New button and enter information below:
                Name: testMYSQL
                Resources Type: javax.sql.DataSource
                Database Vendor: MySQL
            Click Next to proceed to the next panel
            Go to Additional Properties and enter:
                databaseName: test
                User: testUser
                Password: testPassword
                ServerName: localhost
           Click Finish button
           Click testMYSQL > select ping to test the connection

Wednesday Mar 19, 2008

Run Netbean Plugin Automation test with Glassfish V2 by using Jemmy/Jelly and XTest Tools

1. Requirements
      a. Software: Glassfish V2, Python 2.2.4 or later version and Mercurial 0.9.5
          Note: for Mercurial if you need to build it, please click here
      b. Netbean account (userID/password)
2. Getting a Copy of Netbean Repository
      a. Create a template working directory (nb_all)
          $mkdir nb_all
          $cd nb_all
      b. Run the mercurial command below to check out all netbean modules
         $hg clone http://hg.netbeans-DOT-org/main
     c. Configure your user name and write access to configuration files
         Edit ../main/.hg/hgrc and add lines
            username =
            host =
            default =
            default-push =
         (Replace jhacker with your username. Replace secretpass with your password and with your proxy server if you have one)
         For full mercurial instruction please visit
3. Build Netbean j2ee and xtest Modules
       To build  j2ee module
            $cd main
            $ant -f  nbbuild/build.xml  -Dcluster.config=j2ee
            $cd xtest
    Note: to fix the outOfMemory problem, for bash/ksh shell set (export ANT_OPTS="-Xms256m -Xmx256m";)
                fix PermGen OutOfMemory problem (export ANT_OPTS="-Xmx512m -XX:MaxPermSize=128m"
4. Execute Test (resources, webapp and ejb/jfs) Module
$cd  /opt/SUNWappserver/bin  (assume you installed Glassfish server at that directory)
$./asadmin start-domain domain1
           $copy  cfg-qa-functional.xml.cfg-res  to cfg-qa-functional.xml  (to run only resources and configuration test suite)
$cd ../main/j2ee.sun.appsrv81/test
           $ant  -Dsjsas.server.path=/opt/SUNWappserver

Tuesday Feb 19, 2008

Record a Simple Glassfish Test Case with Selenium

This screencast shows you steps to record a simple glassfish deployment test case with selenium.

After click Play, please wait for the screencast to load

Wednesday Jun 27, 2007

glassfish roller

Today I try to install the roller with glassfish Beta build by using the asadmin install-addon command. The installation went smoothly. The procedure is much simpler than installed with Tomcat server which I did sometime ago. The database configuration and setup is straight forward since it was done by the installer. It took me ~5 minutes to have the roller setup and ready to use in AppServer 9.1 while it took me ~3 hours to install and configure for tomcat container!

Thursday May 17, 2007

Steps Sharing NFS directories

I have a hard time remembering steps to configure an NFS sharing directory. Every time having a new machine, I have to go back to my note and search for the page which lists the steps below:

1. cd /etc/dfs
2. vi dfstab file and add the sharing directory (eg sharing NFS directory is /export/home1 then the syntax would be)
share -F nfs /export/home1
3. Execute command /usr/sbin/shareall
4. cd /etc/init.d and execute command
./nfs.server stop/start


Many thanks to Sean who just told me that all the commands above are being replaced with just one command:
sharemgr share -F nfs -p /export/home1




« April 2014