Posts

Showing posts with the label JUnit

Spring 3 Part 7: Spring with Databases

Image
This is the 7 th part of the Spring 3 Series . Create MySQL 5.6 database ‘payroll’, CREATE DATABASE payroll; Next create a user for example, user ‘ojitha’ CREATE USER 'ojitha'@'localhost' IDENTIFIED BY 'ojitha'; Need to grant the ‘payroll’ access to user ‘ojitha’ as shown in the following. GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP ON payroll.* TO 'ojitha'@'localhost'; You can download freeware of TOAD for MySQL from here . Let create a first table, that contains all the states in Australia. You can create a table using visually using the icon given directly below the Tables tab in the Object Explorer as shown in the above diagram. CREATE TABLE payroll.STATE ( CODE CHAR(3) ASCII COMMENT 'State code', STATE VARCHAR(30), PRIMARY KEY (CODE) ) ENGINE = InnoDB COMMENT = 'Australian states' ROW_FORMAT = DEFAULT; In the my sql console you can the newly added table using the following command SHOW ...

SAAJ Unit testing client for JAX-WS web services

Image
JAX-WS is the simplest java web services. In this blog, I would like to use first example explained in the book Java Web Services: Up and Running , by Martin Kalin ( thanks Martin, great book). Here the SEI and SBI created from the above book. SEI package com.ojitha.ws.ex1; import javax.jws.WebMethod; import javax.jws.WebService; import javax.jws.soap.SOAPBinding; import javax.jws.soap.SOAPBinding.Style; @WebService @SOAPBinding(style=Style.RPC) public interface TimeServer { @WebMethod String getTimeAsString(); @WebMethod long getTimeAsElapsed(); } SBI package com.ojitha.ws.ex1; import java.util.Date; import javax.jws.WebService; @WebService(endpointInterface="com.ojitha.ws.ex1.TimeServer") public class TimeSeverImpl implements TimeServer { @Override public String getTimeAsString() { return new Date().toString(); } @Override public long getTimeAsElapsed() { return new Date().getTime(); } } The main objective of this blog is to introduce a SAA...