Friday, February 01, 2013

Testing using Selenium, Eclipse, JUnit

  1. Use firefox plugin for selenium to
    1. record in firefox
  2. Export test case as Java JUnit class
  3. Start Selenium standalone server
    1. C:\apps\selenium>java -jar selenium-server-standalone-2.28.0.jar
  4. Import test case into Java project
  5. Add jars in C:\apps\selenium\selenium-2.28.0\libs to JUnit test classpat
  6. Run Junit test 

GoF Design Patterns



Creational Patterns

  1.  Abstract Factory
  2.  Builder
  3.  Factory Method
  4.  Prototype
  5.  Singleton

Structural Patterns

  1.  Adapter
  2.  Bridge
  3.  Composite
  4.  Decorator
  5.  Façade
  6.  Flyweight
  7.  Proxy

Behavioral Patterns

  1.  Chain of Responsibility
  2.  Command
  3.  Interpreter
  4.  Iterator
  5.  Mediator
  6.  Memento
  7.  Observer
  8.  State
  9.  Strategy
  10.  Template Method
  11.  Visitor

Thursday, January 31, 2013

Axis 2 webservices in WebLogic 10.3.4

I have created a sample webservice using Axis 2 stack that works in my local WebLogic 10.3.4 instance. Here are the steps I have followed. I have attached a zip file that has Eclipse project.

1)      Downloaded axis 2 war
2)      Added weblogc.xml with wls:prefer-application-packages

3)      Created an Eclipse project with one class that implements the web service
4)      Added services.xml file that describes the service as Axis2 service

5)      Created a “.aar” file which includes the WebService implementation class and META-INF directory with services.xml

6)      Added the “.aar” file to WEB-INF/services directory of axis2.war

7)      Added the service to services.list file in WEB-INF/services of axis2.war

8)      Deployed axis2.war to weblogic

9)      Tested with following URLs:

a.       http://localhost:7001/axis2/services/listServices --> lists all hosted webservices
b.      http://localhost:7001/axis2/services/SampleService?wsdl à lists wsdl for the sample webservice

c.       http://localhost:7001/axis2/services/SampleService/getPrice?symbol=IBM à tests webservice operation

Wednesday, February 09, 2011

CPUs, Virtual Processors, Cores

In Solaris 10, if you want to find the processor type and the number of physical processors installed on the system and the number of Virtual Processors available on the system then the psrinfo command does job for you.

To simply display the number of Physical processors, simply run the command with the -p option as follows:

root@sunserver # psrinfo -p

2 --> where 2 implies that there are 2 physical processors installed on the system.

If you would like to check the number of Virtual Processors on each of these Physical processors then type the command with the “-pv” arguement as follows:

root@ server:/root$ uname -a

SunOS server 5.10 Generic_137111-02 sun4v sparc SUNW,SPARC-Enterprise-T5120

root@server:/root$ psrinfo -pv

The physical processor has 32 virtual processors (0-31)

UltraSPARC-T2 (cpuid 0 clock 1165 MHz)

The above indicates that there was only one physical processor (UltraSPARC-T2) on the T5120 server which has 32 Virtual processors. Each virtual processor is an entity with its own interrupt ID, capable of executing independent threads.

In simple terms, the number of Virtual Processors supported by a physical CPU is

“Number of Core” x “Number of threads”

For instance, the above is on a T5120 server with the UltraSPARC-T2. This CPU has 4 cores and each core can support 8 threads and that gives us 32 Virtual processors.

The number of Virtual processors on a Server is simply the total Virtual processors supported on each of the physical processor.

In the following T5140 server there are 2 Physical UltraSPARC-T2+ processors with 6 cores, each supporting 8 threads which means we get 48 Virtual processors per Physical processor and hence a total of 96 Virtual processors (sum of VPs on individual processors) for the server:

root@ bserver:/root$ uname -a

SunOS bserver 5.10 Generic_137111-02 sun4v sparc SUNW,T5140

root@ bserver:/root$ psrinfo -pv

The physical processor has 48 virtual processors (0-23 32-55)

UltraSPARC-T2+ (cpuid 0 clock 1167 MHz)

The physical processor has 48 virtual processors (64-71 80-119)

UltraSPARC-T2+ (cpuid 64 clock 1167 MHz)

In earlier versions of Solaris, the -p arguement is not supported and hence wouldn’t provide this summarised output on the counts of the physical and Virtual CPUs.

Monday, November 22, 2010

SOA



http://www.infoq.com/resource/articles/applied-soa/en/resources/Applied-SOA.pdf

Legacy
Applications are built with internal logic to call each remote application/service they need to use. Kind of point to point integrations. With this approach, there are proprietery APIs, custom integration links and tight coupling of data and implementation

EAI
Connectivity between each application is based on middleware or message bus using EAI vendor's API which is proprietery





Wednesday, November 03, 2010

Example of WS-Security

Public Key Infrastructure

Quartz - Scheduling jobs in java

Mock Objects

What is RowSet?

A ResultSet maintains a connection to a database and because
of that it can’t be serialized and also we cant pass the
Resultset object from one class to other class across the
network.

RowSet is a disconnected, serializable version of a JDBC
ResultSet and also the RowSet extends the ResultSet
interface so it has all the methods of ResultSet. The RowSet
can be serialized because it doesn’t have a connection to
any database and also it can be sent from one class to
another across the network.

Popular default ports

7 Echo request
20/21 File Transfer Protocol (FTP)
23 Telnet
25 Simple Mail Transfer Protocol (SMTP)
53 Domain Name Server
80 HTTP Server
1512 Database
1099 JNDI
1100 RMI

Threadlocal

This class provides thread-local variables. These variables differ from their normal counterparts in that each thread that accesses one (via its get or set method) has its own, independently initialized copy of the variable. ThreadLocal instances are typically private static fields in classes that wish to associate state with a thread (e.g., a user ID or Transaction ID).

This class allows you to put local data on a thread, so that every module running in the thread can access it

public class MyService {

private static ThreadLocal tLocal = new ThreadLocal();

public static void set(List list) {
tLocal.set(list);
}

public static List get() {
return (List) tLocal.get();
}

Client:

MyService.set(list);
.......
list = MyService.get();