CXF Overview

Apache CXF is an open source, fully featured Web services framework, its name CXF is originated from Celtix and XFire, the two projects are nicely combined work together to Apache. CXF supports JAX-WS, Binding, DataBinding and Transport implementation, the nice feature is its embeddable Web service component: (e.g. integrated Spring Framework and Geronimo), CXF has been designed to provide a pluggable architecture that supports not only XML but also non-XML type bindings, such as JSON and CORBA, in combination with any type of transport. in this how-to, we look though a step-by-step hello world example with CXF to start the first web service project.

Prerequisites

please hava JDK installed and download the CXF latest release version from apache website. Read the rest of this entry »

As a developer, we have to ensure that our codes are high-quality, fully tested and peer-reviewed before delivering. Today the topic is how to mock java socket server to test Socket related application.

Mock  Overview:

Mock technology is primarily used to mock applications which are not easily to build in the structure (such as HttpServletRequest object must from ServletContext) or some complex objects (such as JDBC’s ResultSet object) , It is configured to simulate the object that it replaces in a simple way. Read the rest of this entry »

Java Interview Questions and Answers

5May2010 In: Core Java

I have summarized some common java interview questions and answers as showed below, you may take a look if you are preparing an interview:

1, what’s  the difference for Error and Exception?

Error specifies system-level errors that you can’t handle it.
Exception specifies program-level exception that you can catch it.

2.  if A class is declared as final type, what this mean?

final keyword specifies the class can not be inherited.
Read the rest of this entry »

The goal of unit testing is to test the code behaved as exactly expected and smallest piece of testable software as possible, the approach to do so is use mock technology that code becomes independent, lets thing goes to easy. EasyMock provides Mock Objects for interfaces by generating them on the fly using Java’s proxy mechanism. In generic, it could be enough to do uniting test with EasyMock, but, at least I have met, it’s I wanted to mock static, private methods and even constructor, I did the research on the main standard mock frameworks, such as EasyMock, jmock and so on, they both don’t support this, the mock to static and final method is not allowed because these methods are invisible to users, it is a strong indicator for a bad design, I recommend it’s a good time to refactor your code, let’s more testable and stable. Read the rest of this entry »