You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@servicemix.apache.org by gn...@apache.org on 2007/08/10 16:38:14 UTC
svn commit: r564607 [8/12] - in
/incubator/servicemix/trunk/core/servicemix-core/src:
main/java/org/apache/servicemix/ main/java/org/apache/servicemix/jbi/
main/java/org/apache/servicemix/jbi/framework/
main/java/org/apache/servicemix/jbi/framework/sup...
Modified: incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/util/IntrospectionSupport.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/util/IntrospectionSupport.java?view=diff&rev=564607&r1=564606&r2=564607
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/util/IntrospectionSupport.java (original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/util/IntrospectionSupport.java Fri Aug 10 07:37:46 2007
@@ -28,24 +28,28 @@
import java.util.Iterator;
import java.util.LinkedHashMap;
import java.util.Map;
-import java.util.Set;
import java.util.Map.Entry;
+import java.util.Set;
+
+public final class IntrospectionSupport {
+
+ private IntrospectionSupport() {
+ }
-public class IntrospectionSupport {
-
- static public boolean setProperties(Object target, Map props, String optionPrefix) {
+ public static boolean setProperties(Object target, Map props, String optionPrefix) {
boolean rc = false;
- if( target == null )
+ if (target == null) {
throw new IllegalArgumentException("target was null.");
- if( props == null )
+ }
+ if (props == null) {
throw new IllegalArgumentException("props was null.");
-
+ }
for (Iterator iter = props.keySet().iterator(); iter.hasNext();) {
String name = (String) iter.next();
- if( name.startsWith(optionPrefix) ) {
+ if (name.startsWith(optionPrefix)) {
Object value = props.get(name);
name = name.substring(optionPrefix.length());
- if( setProperty(target, name, value) ) {
+ if (setProperty(target, name, value)) {
iter.remove();
rc = true;
}
@@ -53,35 +57,34 @@
}
return rc;
}
-
+
public static Map extractProperties(Map props, String optionPrefix) {
- if( props == null )
+ if (props == null) {
throw new IllegalArgumentException("props was null.");
-
- HashMap rc = new HashMap(props.size());
-
+ }
+ Map rc = new HashMap(props.size());
for (Iterator iter = props.keySet().iterator(); iter.hasNext();) {
String name = (String) iter.next();
- if( name.startsWith(optionPrefix) ) {
+ if (name.startsWith(optionPrefix)) {
Object value = props.get(name);
name = name.substring(optionPrefix.length());
rc.put(name, value);
iter.remove();
}
}
-
return rc;
}
-
+
public static void setProperties(Object target, Map props) {
- if( target == null )
+ if (target == null) {
throw new IllegalArgumentException("target was null.");
- if( props == null )
+ }
+ if (props == null) {
throw new IllegalArgumentException("props was null.");
-
+ }
for (Iterator iter = props.entrySet().iterator(); iter.hasNext();) {
Map.Entry entry = (Entry) iter.next();
- if( setProperty(target, (String) entry.getKey(), entry.getValue()) ) {
+ if (setProperty(target, (String) entry.getKey(), entry.getValue())) {
iter.remove();
}
}
@@ -91,15 +94,16 @@
try {
Class clazz = target.getClass();
Method setter = findSetterMethod(clazz, name);
- if( setter == null )
+ if (setter == null) {
return false;
-
- // If the type is null or it matches the needed type, just use the value directly
- if( value == null || value.getClass()==setter.getParameterTypes()[0] ) {
- setter.invoke(target, new Object[]{value});
+ }
+ // If the type is null or it matches the needed type, just use the
+ // value directly
+ if (value == null || value.getClass() == setter.getParameterTypes()[0]) {
+ setter.invoke(target, new Object[] {value });
} else {
// We need to convert it
- setter.invoke(target, new Object[]{ convert(value, setter.getParameterTypes()[0]) });
+ setter.invoke(target, new Object[] {convert(value, setter.getParameterTypes()[0]) });
}
return true;
} catch (Throwable ignore) {
@@ -109,11 +113,11 @@
private static Object convert(Object value, Class type) throws URISyntaxException {
PropertyEditor editor = PropertyEditorManager.findEditor(type);
- if( editor != null ) {
+ if (editor != null) {
editor.setAsText(value.toString());
return editor.getValue();
}
- if( type == URI.class ) {
+ if (type == URI.class) {
return new URI(value.toString());
}
return null;
@@ -121,14 +125,12 @@
private static Method findSetterMethod(Class clazz, String name) {
// Build the method name.
- name = "set"+name.substring(0,1).toUpperCase()+name.substring(1);
+ name = "set" + name.substring(0, 1).toUpperCase() + name.substring(1);
Method[] methods = clazz.getMethods();
for (int i = 0; i < methods.length; i++) {
Method method = methods[i];
Class params[] = method.getParameterTypes();
- if( method.getName().equals(name)
- && params.length==1
- && isSettableType(params[0])) {
+ if (method.getName().equals(name) && params.length == 1 && isSettableType(params[0])) {
return method;
}
}
@@ -136,19 +138,21 @@
}
private static boolean isSettableType(Class clazz) {
- if( PropertyEditorManager.findEditor(clazz)!=null )
+ if (PropertyEditorManager.findEditor(clazz) != null) {
return true;
- if( clazz == URI.class )
+ }
+ if (clazz == URI.class) {
return true;
+ }
return false;
}
- static public String toString(Object target) {
+ public static String toString(Object target) {
return toString(target, Object.class);
}
- static public String toString(Object target, Class stopClass) {
- LinkedHashMap map = new LinkedHashMap();
+ public static String toString(Object target, Class stopClass) {
+ Map map = new LinkedHashMap();
addFields(target, target.getClass(), stopClass, map);
StringBuffer buffer = new StringBuffer(simpleName(target.getClass()));
buffer.append(" {");
@@ -158,8 +162,7 @@
Map.Entry entry = (Map.Entry) iter.next();
if (first) {
first = false;
- }
- else {
+ } else {
buffer.append(", ");
}
buffer.append(entry.getKey());
@@ -170,37 +173,34 @@
return buffer.toString();
}
- static public String simpleName(Class clazz) {
+ public static String simpleName(Class clazz) {
String name = clazz.getName();
int p = name.lastIndexOf(".");
- if( p >= 0 ) {
- name = name.substring(p+1);
+ if (p >= 0) {
+ name = name.substring(p + 1);
}
return name;
}
-
- static private void addFields(Object target, Class startClass, Class stopClass, LinkedHashMap map) {
-
- if( startClass!=stopClass )
- addFields( target, startClass.getSuperclass(), stopClass, map );
-
+ private static void addFields(Object target, Class startClass, Class stopClass, Map map) {
+ if (startClass != stopClass) {
+ addFields(target, startClass.getSuperclass(), stopClass, map);
+ }
Field[] fields = startClass.getDeclaredFields();
for (int i = 0; i < fields.length; i++) {
Field field = fields[i];
- if( Modifier.isStatic(field.getModifiers()) ||
- Modifier.isTransient(field.getModifiers()) ||
- Modifier.isPrivate(field.getModifiers()) ) {
+ if (Modifier.isStatic(field.getModifiers()) || Modifier.isTransient(field.getModifiers())
+ || Modifier.isPrivate(field.getModifiers())) {
continue;
}
-
try {
field.setAccessible(true);
Object o = field.get(target);
- if( o!=null && o.getClass().isArray() ) {
+ if (o != null && o.getClass().isArray()) {
try {
o = Arrays.asList((Object[]) o);
} catch (Throwable e) {
+ // Ignore
}
}
map.put(field.getName(), o);
@@ -208,8 +208,7 @@
e.printStackTrace();
}
}
-
+
}
-
}
Modified: incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/util/LazyDOMSource.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/util/LazyDOMSource.java?view=diff&rev=564607&r1=564606&r2=564607
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/util/LazyDOMSource.java (original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/util/LazyDOMSource.java Fri Aug 10 07:37:46 2007
@@ -16,23 +16,24 @@
*/
package org.apache.servicemix.jbi.util;
-import org.w3c.dom.Node;
-
import javax.xml.transform.dom.DOMSource;
+import org.w3c.dom.Node;
+
/**
* A lazily created source which is only created if its required.
- *
+ *
* @version $Revision$
*/
public abstract class LazyDOMSource extends DOMSource {
+
private boolean initialized;
public LazyDOMSource() {
}
public Node getNode() {
- if (! initialized) {
+ if (!initialized) {
setNode(loadNode());
initialized = true;
}
@@ -40,4 +41,5 @@
}
protected abstract Node loadNode();
+
}
Modified: incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/util/MessageCopier.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/util/MessageCopier.java?view=diff&rev=564607&r1=564606&r2=564607
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/util/MessageCopier.java (original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/util/MessageCopier.java Fri Aug 10 07:37:46 2007
@@ -109,7 +109,7 @@
to.setSecuritySubject(from.getSecuritySubject());
}
- private static void copyContent(NormalizedMessage from, NormalizedMessage to) throws MessagingException{
+ private static void copyContent(NormalizedMessage from, NormalizedMessage to) throws MessagingException {
String str = null;
try {
str = new SourceTransformer().toString(from.getContent());
@@ -127,11 +127,11 @@
}
}
- private static void copyAttachments(NormalizedMessage from, NormalizedMessage to) throws MessagingException{
+ private static void copyAttachments(NormalizedMessage from, NormalizedMessage to) throws MessagingException {
for (Object name : from.getAttachmentNames()) {
DataHandler handler = from.getAttachment((String)name);
DataSource source = handler.getDataSource();
- if (source instanceof ByteArrayDataSource == false) {
+ if (!(source instanceof ByteArrayDataSource)) {
DataSource copy = copyDataSource(source);
handler = new DataHandler(copy);
}
Modified: incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/util/MessageUtil.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/util/MessageUtil.java?view=diff&rev=564607&r1=564606&r2=564607
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/util/MessageUtil.java (original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/util/MessageUtil.java Fri Aug 10 07:37:46 2007
@@ -45,7 +45,10 @@
* @author gnodet
* @version $Revision: 376451 $
*/
-public class MessageUtil {
+public final class MessageUtil {
+
+ private MessageUtil() {
+ }
public static void transfer(NormalizedMessage source, NormalizedMessage dest) throws MessagingException {
dest.setContent(source.getContent());
@@ -112,8 +115,7 @@
transferTo(fault, dest, "fault");
}
- public static void transferTo(NormalizedMessage sourceMsg, MessageExchange dest, String name)
- throws MessagingException {
+ public static void transferTo(NormalizedMessage sourceMsg, MessageExchange dest, String name) throws MessagingException {
NormalizedMessage destMsg = (sourceMsg instanceof Fault) ? dest.createFault() : dest.createMessage();
transfer(sourceMsg, destMsg);
dest.setMessage(destMsg, name);
@@ -179,7 +181,7 @@
String name = (String) it.next();
DataHandler dh = message.getAttachment(name);
DataSource ds = dh.getDataSource();
- if (ds instanceof ByteArrayDataSource == false) {
+ if (!(ds instanceof ByteArrayDataSource)) {
ByteArrayOutputStream baos = new ByteArrayOutputStream();
FileUtil.copyInputStream(ds.getInputStream(), baos);
ByteArrayDataSource bads = new ByteArrayDataSource(baos.toByteArray(), ds.getContentType());
@@ -196,8 +198,8 @@
}
}
- public void addAttachment(String id, DataHandler content) throws MessagingException {
- this.attachments.put(id, content);
+ public void addAttachment(String id, DataHandler data) throws MessagingException {
+ this.attachments.put(id, data);
}
public Source getContent() {
@@ -224,8 +226,8 @@
this.properties.put(name, value);
}
- public void setSecuritySubject(Subject subject) {
- this.subject = subject;
+ public void setSecuritySubject(Subject sub) {
+ this.subject = sub;
}
public Set getPropertyNames() {
Modified: incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/util/MultiplexOutputStream.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/util/MultiplexOutputStream.java?view=diff&rev=564607&r1=564606&r2=564607
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/util/MultiplexOutputStream.java (original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/util/MultiplexOutputStream.java Fri Aug 10 07:37:46 2007
@@ -16,12 +16,11 @@
*/
package org.apache.servicemix.jbi.util;
-import java.util.concurrent.CopyOnWriteArrayList;
-
import java.io.IOException;
import java.io.OutputStream;
import java.util.Iterator;
import java.util.List;
+import java.util.concurrent.CopyOnWriteArrayList;
/**
* Write to multiple OutputStreams
@@ -29,14 +28,15 @@
* @version $Revision$
*/
public class MultiplexOutputStream extends OutputStream {
- List streams = new CopyOnWriteArrayList();
+ List streams = new CopyOnWriteArrayList();
+
/**
* Add an Output Stream
* @param os
*/
- public void add(OutputStream os){
+ public void add(OutputStream os) {
streams.add(os);
}
@@ -44,7 +44,7 @@
* Remove an OutputStream
* @param os
*/
- public void remove(OutputStream os){
+ public void remove(OutputStream os) {
streams.remove(os);
}
@@ -54,7 +54,7 @@
* @throws IOException
*/
public synchronized void write(int b) throws IOException {
- for (Iterator i = streams.iterator();i.hasNext();) {
+ for (Iterator i = streams.iterator(); i.hasNext();) {
OutputStream s = (OutputStream) i.next();
s.write(b);
}
@@ -68,7 +68,7 @@
* @throws IOException
*/
public synchronized void write(byte b[], int off, int len) throws IOException {
- for (Iterator i = streams.iterator();i.hasNext();) {
+ for (Iterator i = streams.iterator(); i.hasNext();) {
OutputStream s = (OutputStream) i.next();
s.write(b, off, len);
}
@@ -79,7 +79,7 @@
* @throws IOException
*/
public void flush() throws IOException {
- for (Iterator i = streams.iterator();i.hasNext();) {
+ for (Iterator i = streams.iterator(); i.hasNext();) {
OutputStream s = (OutputStream) i.next();
s.flush();
}
@@ -90,7 +90,7 @@
* @throws IOException
*/
public void close() throws IOException {
- for (Iterator i = streams.iterator();i.hasNext();) {
+ for (Iterator i = streams.iterator(); i.hasNext();) {
OutputStream s = (OutputStream) i.next();
s.close();
}
Modified: incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/util/QNameUtil.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/util/QNameUtil.java?view=diff&rev=564607&r1=564606&r2=564607
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/util/QNameUtil.java (original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/util/QNameUtil.java Fri Aug 10 07:37:46 2007
@@ -31,7 +31,10 @@
* @version $Revision: 1.5 $
* @since 3.0
*/
-public class QNameUtil {
+public final class QNameUtil {
+
+ private QNameUtil() {
+ }
/**
* Convert QName to the Clark notation, e.g., {namespace}localName
Modified: incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/util/StreamDataSource.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/util/StreamDataSource.java?view=diff&rev=564607&r1=564606&r2=564607
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/util/StreamDataSource.java (original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/util/StreamDataSource.java Fri Aug 10 07:37:46 2007
@@ -24,52 +24,57 @@
/**
* Stream DataSource for Mail and message attachments .
+ *
* @author <a href="mailto:gnodet@logicblaze.com"> Guillaume Nodet</a>
* @since 3.0
*/
public class StreamDataSource implements DataSource {
- private InputStream in;
- private String contentType;
- private String name;
-
- public StreamDataSource(InputStream in) {
- this(in, null, null);
- }
-
- public StreamDataSource(InputStream in, String contentType) {
- this(in, contentType, null);
- }
-
- public StreamDataSource(InputStream in, String contentType, String name) {
- this.in = in;
- this.contentType = contentType;
- this.name = name;
- }
-
- public InputStream getInputStream() throws IOException {
- if (in == null) throw new IOException("no data");
- return in;
- }
-
- public OutputStream getOutputStream() throws IOException {
- throw new IOException("getOutputStream() not supported");
- }
-
- public String getContentType() {
- return contentType;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public void setContentType(String contentType) {
- this.contentType = contentType;
- }
+ private InputStream in;
+
+ private String contentType;
+
+ private String name;
+
+ public StreamDataSource(InputStream in) {
+ this(in, null, null);
+ }
+
+ public StreamDataSource(InputStream in, String contentType) {
+ this(in, contentType, null);
+ }
+
+ public StreamDataSource(InputStream in, String contentType, String name) {
+ this.in = in;
+ this.contentType = contentType;
+ this.name = name;
+ }
+
+ public InputStream getInputStream() throws IOException {
+ if (in == null) {
+ throw new IOException("no data");
+ }
+ return in;
+ }
+
+ public OutputStream getOutputStream() throws IOException {
+ throw new IOException("getOutputStream() not supported");
+ }
+
+ public String getContentType() {
+ return contentType;
+ }
+
+ public String getName() {
+ return name;
+ }
+
+ public void setName(String name) {
+ this.name = name;
+ }
+
+ public void setContentType(String contentType) {
+ this.contentType = contentType;
+ }
}
Modified: incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/util/URISupport.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/util/URISupport.java?view=diff&rev=564607&r1=564606&r2=564607
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/util/URISupport.java (original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/util/URISupport.java Fri Aug 10 07:37:46 2007
@@ -25,68 +25,80 @@
import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
+import java.util.List;
import java.util.Map;
/**
* @version $Revision$
*/
public class URISupport {
-
+
public static class CompositeData {
String scheme;
+
String path;
+
URI components[];
+
Map parameters;
+
String fragment;
- public String host;
-
+
+ String host;
+
public URI[] getComponents() {
return components;
}
+
public String getFragment() {
return fragment;
}
+
public Map getParameters() {
return parameters;
}
+
public String getScheme() {
return scheme;
}
+
public String getPath() {
return path;
}
+
public String getHost() {
return host;
}
-
+
public URI toURI() throws URISyntaxException {
StringBuffer sb = new StringBuffer();
- if( scheme!=null ) {
+ if (scheme != null) {
sb.append(scheme);
sb.append(':');
}
-
- if( host!=null && host.length()!=0 ) {
+
+ if (host != null && host.length() != 0) {
sb.append(host);
} else {
sb.append('(');
for (int i = 0; i < components.length; i++) {
- if( i!=0 )
+ if (i != 0) {
sb.append(',');
+ }
sb.append(components[i].toString());
}
sb.append(')');
}
-
- if( path !=null ) {
+
+ if (path != null) {
sb.append('/');
sb.append(path);
}
- if(!parameters.isEmpty()) {
+ if (!parameters.isEmpty()) {
sb.append("?");
sb.append(createQueryString(parameters));
}
- if( fragment!=null ) {
+ if (fragment != null) {
sb.append("#");
sb.append(fragment);
}
@@ -94,30 +106,30 @@
}
}
- public static Map parseQuery(String uri) throws URISyntaxException{
- try{
- Map rc=new HashMap();
- if(uri!=null){
- String[] parameters=uri.split("&");
- for(int i=0;i<parameters.length;i++){
- int p=parameters[i].indexOf("=");
- if(p>=0){
- String name=URLDecoder.decode(parameters[i].substring(0,p),"UTF-8");
- String value=URLDecoder.decode(parameters[i].substring(p+1),"UTF-8");
- rc.put(name,value);
- }else{
- rc.put(parameters[i],null);
+ public static Map parseQuery(String uri) throws URISyntaxException {
+ try {
+ Map rc = new HashMap();
+ if (uri != null) {
+ String[] parameters = uri.split("&");
+ for (int i = 0; i < parameters.length; i++) {
+ int p = parameters[i].indexOf("=");
+ if (p >= 0) {
+ String name = URLDecoder.decode(parameters[i].substring(0, p), "UTF-8");
+ String value = URLDecoder.decode(parameters[i].substring(p + 1), "UTF-8");
+ rc.put(name, value);
+ } else {
+ rc.put(parameters[i], null);
}
}
}
return rc;
- }catch(UnsupportedEncodingException e){
- throw (URISyntaxException) new URISyntaxException(e.toString(),"Invalid encoding").initCause(e);
+ } catch (UnsupportedEncodingException e) {
+ throw (URISyntaxException) new URISyntaxException(e.toString(), "Invalid encoding").initCause(e);
}
}
-
+
public static Map parseParamters(URI uri) throws URISyntaxException {
- return uri.getQuery()==null ? Collections.EMPTY_MAP : parseQuery(stripPrefix(uri.getQuery(), "?"));
+ return uri.getQuery() == null ? Collections.EMPTY_MAP : parseQuery(stripPrefix(uri.getQuery(), "?"));
}
/**
@@ -133,15 +145,15 @@
public static URI createURIWithQuery(URI uri, String query) throws URISyntaxException {
return new URI(uri.getScheme(), uri.getUserInfo(), uri.getHost(), uri.getPort(), uri.getPath(), query, uri.getFragment());
}
-
+
public static CompositeData parseComposite(URI uri) throws URISyntaxException {
-
+
CompositeData rc = new CompositeData();
rc.scheme = uri.getScheme();
String ssp = stripPrefix(uri.getSchemeSpecificPart().trim(), "//").trim();
parseComposite(uri, rc, ssp);
-
+
rc.fragment = uri.getFragment();
return rc;
}
@@ -156,44 +168,45 @@
private static void parseComposite(URI uri, CompositeData rc, String ssp) throws URISyntaxException {
String componentString;
String params;
-
- if(!checkParenthesis(ssp)){
+
+ if (!checkParenthesis(ssp)) {
throw new URISyntaxException(uri.toString(), "Not a matching number of '(' and ')' parenthesis");
}
-
+
int p;
int intialParen = ssp.indexOf("(");
- if( intialParen==0 ) {
+ if (intialParen == 0) {
rc.host = ssp.substring(0, intialParen);
p = rc.host.indexOf("/");
- if( p >= 0 ) {
+ if (p >= 0) {
rc.path = rc.host.substring(p);
- rc.host = rc.host.substring(0,p);
+ rc.host = rc.host.substring(0, p);
}
p = ssp.lastIndexOf(")");
- componentString = ssp.substring(intialParen+1,p);
- params = ssp.substring(p+1).trim();
-
+ componentString = ssp.substring(intialParen + 1, p);
+ params = ssp.substring(p + 1).trim();
+
} else {
componentString = ssp;
- params="";
+ params = "";
}
String components[] = splitComponents(componentString);
- rc.components=new URI[components.length];
+ rc.components = new URI[components.length];
for (int i = 0; i < components.length; i++) {
rc.components[i] = new URI(components[i].trim());
}
-
+
p = params.indexOf("?");
- if( p >= 0 ) {
- if( p > 0) {
+ if (p >= 0) {
+ if (p > 0) {
rc.path = stripPrefix(params.substring(0, p), "/");
}
- rc.parameters = parseQuery(params.substring(p+1));
+ rc.parameters = parseQuery(params.substring(p + 1));
} else {
- if( params.length() > 0 )
+ if (params.length() > 0) {
rc.path = stripPrefix(params, "/");
+ }
rc.parameters = Collections.EMPTY_MAP;
}
}
@@ -203,13 +216,13 @@
* @return
*/
private static String[] splitComponents(String str) {
- ArrayList l = new ArrayList();
-
- int last=0;
+ List<String> l = new ArrayList<String>();
+
+ int last = 0;
int depth = 0;
char chars[] = str.toCharArray();
- for( int i=0; i < chars.length; i ++ ) {
- switch( chars[i] ) {
+ for (int i = 0; i < chars.length; i++) {
+ switch (chars[i]) {
case '(':
depth++;
break;
@@ -217,46 +230,51 @@
depth--;
break;
case ',':
- if( depth == 0 ) {
+ if (depth == 0) {
String s = str.substring(last, i);
l.add(s);
- last=i+1;
+ last = i + 1;
}
+ break;
+ default:
+ break;
}
}
-
+
String s = str.substring(last);
- if( s.length() !=0 )
- l.add(s);
-
+ if (s.length() != 0) {
+ l.add(s);
+ }
+
String rc[] = new String[l.size()];
l.toArray(rc);
return rc;
}
-
+
public static String stripPrefix(String value, String prefix) {
- if( value.startsWith(prefix) )
+ if (value.startsWith(prefix)) {
return value.substring(prefix.length());
+ }
return value;
}
-
+
public static URI stripScheme(URI uri) throws URISyntaxException {
- return new URI(stripPrefix(uri.getSchemeSpecificPart().trim(), "//"));
+ return new URI(stripPrefix(uri.getSchemeSpecificPart().trim(), "//"));
}
public static String createQueryString(Map options) throws URISyntaxException {
try {
- if(options.size()>0) {
+ if (options.size() > 0) {
StringBuffer rc = new StringBuffer();
- boolean first=true;
+ boolean first = true;
for (Iterator iter = options.keySet().iterator(); iter.hasNext();) {
- if( first )
- first=false;
- else
+ if (first) {
+ first = false;
+ } else {
rc.append("&");
-
+ }
String key = (String) iter.next();
- String value = (String)options.get(key);
+ String value = (String) options.get(key);
rc.append(URLEncoder.encode(key, "UTF-8"));
rc.append("=");
rc.append(URLEncoder.encode(value, "UTF-8"));
@@ -266,38 +284,41 @@
return "";
}
} catch (UnsupportedEncodingException e) {
- throw (URISyntaxException)new URISyntaxException(e.toString(), "Invalid encoding").initCause(e);
+ throw (URISyntaxException) new URISyntaxException(e.toString(), "Invalid encoding").initCause(e);
}
}
/**
* Creates a URI from the original URI and the remaining paramaters
- * @throws URISyntaxException
+ *
+ * @throws URISyntaxException
*/
public static URI createRemainingURI(URI originalURI, Map params) throws URISyntaxException {
String s = createQueryString(params);
- if( s.length()==0 )
+ if (s.length() == 0) {
s = null;
+ }
return createURIWithQuery(originalURI, s);
}
- static public URI changeScheme(URI bindAddr, String scheme) throws URISyntaxException {
- return new URI(scheme, bindAddr.getUserInfo(), bindAddr.getHost(), bindAddr.getPort(), bindAddr.getPath(), bindAddr.getQuery(), bindAddr.getFragment());
+ public static URI changeScheme(URI bindAddr, String scheme) throws URISyntaxException {
+ return new URI(scheme, bindAddr.getUserInfo(), bindAddr.getHost(), bindAddr.getPort(),
+ bindAddr.getPath(), bindAddr.getQuery(), bindAddr.getFragment());
}
-
- public static boolean checkParenthesis(String str){
- boolean result=true;
- if(str!=null){
- int open=0;
- int closed=0;
-
- int i=0;
- while((i=str.indexOf('(',i)) >=0 ){
+
+ public static boolean checkParenthesis(String str) {
+ boolean result = true;
+ if (str != null) {
+ int open = 0;
+ int closed = 0;
+
+ int i = 0;
+ while ((i = str.indexOf('(', i)) >= 0) {
i++;
open++;
}
- i=0;
- while((i=str.indexOf(')',i)) >=0 ){
+ i = 0;
+ while ((i = str.indexOf(')', i)) >= 0) {
i++;
closed++;
}
@@ -305,10 +326,10 @@
}
return result;
}
-
- public int indexOfParenthesisMatch(String str){
+
+ public int indexOfParenthesisMatch(String str) {
int result = -1;
-
+
return result;
}
Modified: incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/util/WSAddressingConstants.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/util/WSAddressingConstants.java?view=diff&rev=564607&r1=564606&r2=564607
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/util/WSAddressingConstants.java (original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/util/WSAddressingConstants.java Fri Aug 10 07:37:46 2007
@@ -18,22 +18,22 @@
public interface WSAddressingConstants {
- public static final String WSA_NAMESPACE_200303 = "http://schemas.xmlsoap.org/ws/2003/03/addressing";
- public static final String WSA_NAMESPACE_200403 = "http://schemas.xmlsoap.org/ws/2004/03/addressing";
- public static final String WSA_NAMESPACE_200408 = "http://schemas.xmlsoap.org/ws/2004/08/addressing";
- public static final String WSA_NAMESPACE_200508 = "http://www.w3.org/2005/08/addressing";
+ String WSA_NAMESPACE_200303 = "http://schemas.xmlsoap.org/ws/2003/03/addressing";
+ String WSA_NAMESPACE_200403 = "http://schemas.xmlsoap.org/ws/2004/03/addressing";
+ String WSA_NAMESPACE_200408 = "http://schemas.xmlsoap.org/ws/2004/08/addressing";
+ String WSA_NAMESPACE_200508 = "http://www.w3.org/2005/08/addressing";
- public static final String WSA_PREFIX = "wsa";
+ String WSA_PREFIX = "wsa";
- public static final String EL_ACTION = "Action";
- public static final String EL_ADDRESS = "Address";
- public static final String EL_FAULT_TO = "FaultTo";
- public static final String EL_FROM = "From";
- public static final String EL_MESSAGE_ID = "MessageID";
- public static final String EL_METADATA = "Metadata";
- public static final String EL_REFERENCE_PARAMETERS = "ReferenceParameters";
- public static final String EL_RELATES_TO = "RelatesTo";
- public static final String EL_REPLY_TO = "ReplyTo";
- public static final String EL_TO = "To";
+ String EL_ACTION = "Action";
+ String EL_ADDRESS = "Address";
+ String EL_FAULT_TO = "FaultTo";
+ String EL_FROM = "From";
+ String EL_MESSAGE_ID = "MessageID";
+ String EL_METADATA = "Metadata";
+ String EL_REFERENCE_PARAMETERS = "ReferenceParameters";
+ String EL_RELATES_TO = "RelatesTo";
+ String EL_REPLY_TO = "ReplyTo";
+ String EL_TO = "To";
}
Modified: incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/util/XmlPersistenceSupport.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/util/XmlPersistenceSupport.java?view=diff&rev=564607&r1=564606&r2=564607
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/util/XmlPersistenceSupport.java (original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/util/XmlPersistenceSupport.java Fri Aug 10 07:37:46 2007
@@ -26,9 +26,12 @@
import com.thoughtworks.xstream.XStream;
import com.thoughtworks.xstream.io.xml.DomDriver;
-public class XmlPersistenceSupport {
+public final class XmlPersistenceSupport {
private static XStream xstream = new XStream(new DomDriver());
+
+ private XmlPersistenceSupport() {
+ }
public static Object read(File file) throws IOException {
Reader r = new FileReader(file);
Modified: incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/view/DotViewEndpointListener.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/view/DotViewEndpointListener.java?view=diff&rev=564607&r1=564606&r2=564607
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/view/DotViewEndpointListener.java (original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/view/DotViewEndpointListener.java Fri Aug 10 07:37:46 2007
@@ -16,6 +16,12 @@
*/
package org.apache.servicemix.jbi.view;
+import java.io.FileWriter;
+import java.io.PrintWriter;
+import java.util.ArrayList;
+import java.util.Collection;
+import java.util.List;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.servicemix.jbi.container.JBIContainer;
@@ -24,12 +30,6 @@
import org.apache.servicemix.jbi.framework.Endpoint;
import org.apache.servicemix.jbi.framework.Registry;
-import java.io.FileWriter;
-import java.io.PrintWriter;
-import java.util.ArrayList;
-import java.util.Collection;
-import java.util.List;
-
/**
* Creates a <a href="http://www.graphviz.org/">DOT</a> file showing the various components
* and endpoints within ServiceMix
@@ -41,7 +41,7 @@
*/
public class DotViewEndpointListener extends EndpointViewRenderer implements ContainerAware {
- private static final Log log = LogFactory.getLog(DotViewEndpointListener.class);
+ private static final Log LOG = LogFactory.getLog(DotViewEndpointListener.class);
private JBIContainer container;
private String file = "ServiceMixComponents.dot";
@@ -67,14 +67,13 @@
// -------------------------------------------------------------------------
protected void doRender() throws Exception {
- if (log.isDebugEnabled()) {
- log.debug("Creating DOT file at: " + file);
+ if (LOG.isDebugEnabled()) {
+ LOG.debug("Creating DOT file at: " + file);
}
PrintWriter writer = new PrintWriter(new FileWriter(file));
try {
generateFile(writer);
- }
- finally {
+ } finally {
writer.close();
}
}
@@ -109,10 +108,10 @@
List<String> componentEndpointLinks = new ArrayList<String>();
Collection<Endpoint> endpointMBeans = registry.getEndpointRegistry().getEndpointMBeans();
for (Endpoint endpoint : endpointMBeans) {
- String key = endpoint.getSubType().toLowerCase() + ":{" +
- endpoint.getServiceName().getNamespaceURI() + "}" +
- endpoint.getServiceName().getLocalPart() + ":" +
- endpoint.getEndpointName();
+ String key = endpoint.getSubType().toLowerCase() + ":{"
+ + endpoint.getServiceName().getNamespaceURI() + "}"
+ + endpoint.getServiceName().getLocalPart() + ":"
+ + endpoint.getEndpointName();
String componentName = encode(endpoint.getComponentName());
String id = encode(key);
writer.print(id);
@@ -179,12 +178,11 @@
*/
protected String encode(String name) {
StringBuffer buffer = new StringBuffer();
- for (int i = 0, size = name.length(); i < size; i++) {
+ for (int i = 0; i < name.length(); i++) {
char ch = name.charAt(i);
if (Character.isLetterOrDigit(ch) || ch == '_') {
buffer.append(ch);
- }
- else {
+ } else {
buffer.append('_');
}
}
Modified: incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/view/EndpointViewRenderer.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/view/EndpointViewRenderer.java?view=diff&rev=564607&r1=564606&r2=564607
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/view/EndpointViewRenderer.java (original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/jbi/view/EndpointViewRenderer.java Fri Aug 10 07:37:46 2007
@@ -16,13 +16,13 @@
*/
package org.apache.servicemix.jbi.view;
+import javax.jbi.servicedesc.ServiceEndpoint;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.servicemix.jbi.event.EndpointEvent;
import org.apache.servicemix.jbi.event.EndpointListener;
-import javax.jbi.servicedesc.ServiceEndpoint;
-
/**
* A base class for renderings of endpoints which can re-render whenever something
* changes or mark things as dirty so that they can be re-rendered on demand or in a time based way
@@ -31,7 +31,7 @@
*/
public abstract class EndpointViewRenderer implements EndpointListener {
- private static final Log log = LogFactory.getLog(EndpointViewRenderer.class);
+ private static final Log LOG = LogFactory.getLog(EndpointViewRenderer.class);
private boolean dirty;
private boolean rerenderOnChange = true;
@@ -96,9 +96,8 @@
if (rerenderOnChange) {
try {
render();
- }
- catch (Exception e) {
- log.warn("Failed to render view: " + e, e);
+ } catch (Exception e) {
+ LOG.warn("Failed to render view: " + e, e);
}
}
}
Modified: incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/tck/AsyncReceiverPojo.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/tck/AsyncReceiverPojo.java?view=diff&rev=564607&r1=564606&r2=564607
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/tck/AsyncReceiverPojo.java (original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/tck/AsyncReceiverPojo.java Fri Aug 10 07:37:46 2007
@@ -16,9 +16,6 @@
*/
package org.apache.servicemix.tck;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
import javax.jbi.JBIException;
import javax.jbi.component.ComponentContext;
import javax.jbi.component.ComponentLifeCycle;
@@ -30,6 +27,9 @@
import javax.management.ObjectName;
import javax.xml.namespace.QName;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
/**
* A simple POJO which just implements the {@link javax.jbi.component.ComponentLifeCycle}
* interface and is not dependent on any ServiceMix code.
@@ -41,7 +41,7 @@
public static final QName SERVICE = ReceiverPojo.SERVICE;
public static final String ENDPOINT = ReceiverPojo.ENDPOINT;
- private static final Log log = LogFactory.getLog(AsyncReceiverPojo.class);
+ private static final Log LOG = LogFactory.getLog(AsyncReceiverPojo.class);
private ComponentContext context;
private MessageList messageList = new MessageList();
@@ -51,9 +51,9 @@
// ComponentLifeCycle interface
//-------------------------------------------------------------------------
- public void init(ComponentContext context) throws JBIException {
- this.context = context;
- context.activateEndpoint(SERVICE, ENDPOINT);
+ public void init(ComponentContext ctx) throws JBIException {
+ this.context = ctx;
+ ctx.activateEndpoint(SERVICE, ENDPOINT);
}
public void shutDown() throws JBIException {
@@ -88,13 +88,12 @@
while (running) {
try {
DeliveryChannel deliveryChannel = context.getDeliveryChannel();
- log.info("about to do an accept on deliveryChannel: " + deliveryChannel);
+ LOG.info("about to do an accept on deliveryChannel: " + deliveryChannel);
MessageExchange messageExchange = deliveryChannel.accept();
- log.info("received me: " + messageExchange);
+ LOG.info("received me: " + messageExchange);
onMessageExchange(messageExchange);
- }
- catch (MessagingException e) {
- log.error("Failed to process inbound messages: " + e, e);
+ } catch (MessagingException e) {
+ LOG.error("Failed to process inbound messages: " + e, e);
}
}
}
@@ -106,7 +105,7 @@
context.getDeliveryChannel().send(exchange);
}
- public ComponentContext getContext() {
- return context;
- }
+ public ComponentContext getContext() {
+ return context;
+ }
}
Modified: incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/tck/MessageList.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/tck/MessageList.java?view=diff&rev=564607&r1=564606&r2=564607
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/tck/MessageList.java (original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/tck/MessageList.java Fri Aug 10 07:37:46 2007
@@ -16,29 +16,29 @@
*/
package org.apache.servicemix.tck;
+import java.util.ArrayList;
+import java.util.List;
+
import javax.jbi.messaging.MessageExchange;
import javax.jbi.messaging.MessagingException;
import javax.jbi.messaging.NormalizedMessage;
+import junit.framework.Assert;
+
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.apache.servicemix.client.Message;
import org.apache.servicemix.client.MessageListener;
-import java.util.ArrayList;
-import java.util.List;
-
-import junit.framework.Assert;
-
/**
* A simple container for performing testing and rendezvous style code.
- *
+ *
* @version $Revision$
*/
public class MessageList extends Assert implements MessageListener {
-
- private static final Log log = LogFactory.getLog(MessageList.class);
-
+
+ private static final Log LOG = LogFactory.getLog(MessageList.class);
+
private List messages = new ArrayList();
private Object semaphore;
@@ -93,7 +93,7 @@
}
public void waitForMessagesToArrive(int messageCount, long baseTimeout) {
- log.info("Waiting for message to arrive");
+ LOG.info("Waiting for message to arrive");
long start = System.currentTimeMillis();
@@ -105,20 +105,19 @@
synchronized (semaphore) {
semaphore.wait(4000);
}
- }
- catch (InterruptedException e) {
- log.info("Caught: " + e);
+ } catch (InterruptedException e) {
+ LOG.info("Caught: " + e);
}
}
long end = System.currentTimeMillis() - start;
- log.info("End of wait for " + end + " millis");
+ LOG.info("End of wait for " + end + " millis");
}
-
/**
- * Performs a testing assertion that the correct number of messages have been received
- *
+ * Performs a testing assertion that the correct number of messages have
+ * been received
+ *
* @param messageCount
*/
public void assertMessagesReceived(int messageCount) {
Modified: incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/tck/Receiver.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/tck/Receiver.java?view=diff&rev=564607&r1=564606&r2=564607
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/tck/Receiver.java (original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/tck/Receiver.java Fri Aug 10 07:37:46 2007
@@ -26,5 +26,6 @@
/**
* Return access to the list of messages being received
*/
- public MessageList getMessageList();
+ MessageList getMessageList();
+
}
Modified: incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/tck/SenderComponent.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/tck/SenderComponent.java?view=diff&rev=564607&r1=564606&r2=564607
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/tck/SenderComponent.java (original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/tck/SenderComponent.java Fri Aug 10 07:37:46 2007
@@ -16,11 +16,6 @@
*/
package org.apache.servicemix.tck;
-import org.apache.servicemix.components.util.ComponentSupport;
-import org.apache.servicemix.jbi.jaxp.StringSource;
-import org.apache.servicemix.jbi.resolver.EndpointResolver;
-import org.apache.servicemix.jbi.resolver.NullEndpointFilter;
-
import javax.jbi.JBIException;
import javax.jbi.component.ComponentContext;
import javax.jbi.messaging.InOnly;
@@ -29,15 +24,25 @@
import javax.jbi.servicedesc.ServiceEndpoint;
import javax.xml.namespace.QName;
+import org.apache.servicemix.components.util.ComponentSupport;
+import org.apache.servicemix.jbi.jaxp.StringSource;
+import org.apache.servicemix.jbi.resolver.EndpointResolver;
+import org.apache.servicemix.jbi.resolver.NullEndpointFilter;
+
/**
* @version $Revision$
*/
public class SenderComponent extends ComponentSupport implements Sender {
+
public static final QName SERVICE = new QName("http://servicemix.org/example/", "sender");
public static final String ENDPOINT = "sender";
private EndpointResolver resolver;
- private String message = "<s12:Envelope xmlns:s12='http://www.w3.org/2003/05/soap-envelope'><s12:Body> <foo>Hello!</foo> </s12:Body></s12:Envelope>";
+ private String message = "<s12:Envelope xmlns:s12='http://www.w3.org/2003/05/soap-envelope'>"
+ + " <s12:Body>"
+ + " <foo>Hello!</foo>"
+ + " </s12:Body>"
+ + "</s12:Envelope>";
public SenderComponent() {
super(SERVICE, ENDPOINT);
@@ -52,15 +57,15 @@
}
public void sendMessages(int messageCount) throws JBIException {
- sendMessages(messageCount, false);
+ sendMessages(messageCount, false);
}
-
+
public void sendMessages(int messageCount, boolean sync) throws JBIException {
ComponentContext context = getContext();
for (int i = 0; i < messageCount; i++) {
InOnly exchange = context.getDeliveryChannel().createExchangeFactory().createInOnlyExchange();
- NormalizedMessage message = exchange.createMessage();
+ NormalizedMessage msg = exchange.createMessage();
ServiceEndpoint destination = null;
if (resolver != null) {
@@ -72,26 +77,26 @@
exchange.setEndpoint(destination);
}
- exchange.setInMessage(message);
+ exchange.setInMessage(msg);
// lets set the XML as a byte[], String or DOM etc
- message.setContent(new StringSource(this.message));
+ msg.setContent(new StringSource(this.message));
if (sync) {
- boolean result = context.getDeliveryChannel().sendSync(exchange, 1000);
+ boolean result = context.getDeliveryChannel().sendSync(exchange, 1000);
if (!result) {
throw new MessagingException("Message delivery using sendSync has timed out");
}
} else {
- context.getDeliveryChannel().send(exchange);
+ context.getDeliveryChannel().send(exchange);
}
}
}
- public String getMessage() {
- return message;
- }
-
- public void setMessage(String message) {
- this.message = message;
- }
+ public String getMessage() {
+ return message;
+ }
+
+ public void setMessage(String message) {
+ this.message = message;
+ }
}
Modified: incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/tck/SenderPojo.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/tck/SenderPojo.java?view=diff&rev=564607&r1=564606&r2=564607
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/tck/SenderPojo.java (original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/tck/SenderPojo.java Fri Aug 10 07:37:46 2007
@@ -16,10 +16,8 @@
*/
package org.apache.servicemix.tck;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.servicemix.components.util.PojoSupport;
-import org.apache.servicemix.jbi.jaxp.StringSource;
+import java.util.ArrayList;
+import java.util.List;
import javax.jbi.JBIException;
import javax.jbi.component.ComponentContext;
@@ -31,8 +29,10 @@
import javax.jbi.servicedesc.ServiceEndpoint;
import javax.xml.namespace.QName;
-import java.util.ArrayList;
-import java.util.List;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.servicemix.components.util.PojoSupport;
+import org.apache.servicemix.jbi.jaxp.StringSource;
/**
* @version $Revision$
@@ -40,15 +40,16 @@
public class SenderPojo extends PojoSupport implements ComponentLifeCycle, Sender {
public static final QName SERVICE = new QName("http://servicemix.org/example/", "sender");
+
public static final String ENDPOINT = "sender";
- private static final Log log = LogFactory.getLog(SenderPojo.class);
+ private static final Log LOG = LogFactory.getLog(SenderPojo.class);
- private QName interfaceName;
- private int numMessages = 10;
- private ComponentContext context;
- private List messages = new ArrayList();
- boolean done = false;
+ protected QName interfaceName;
+ protected int numMessages = 10;
+ protected ComponentContext context;
+ protected List messages = new ArrayList();
+ protected boolean done;
public SenderPojo() {
this(ReceiverPojo.SERVICE);
@@ -58,9 +59,9 @@
this.interfaceName = interfaceName;
}
- public void init(ComponentContext context) throws JBIException {
- this.context = context;
- context.activateEndpoint(SERVICE, ENDPOINT);
+ public void init(ComponentContext ctx) throws JBIException {
+ this.context = ctx;
+ ctx.activateEndpoint(SERVICE, ENDPOINT);
}
public int messagesReceived() {
@@ -72,43 +73,43 @@
}
public void sendMessages(int messageCount) throws MessagingException {
- sendMessages(messageCount, true);
+ sendMessages(messageCount, true);
}
-
+
public void sendMessages(int messageCount, boolean sync) throws MessagingException {
- log.info("Looking for services for interface: " + interfaceName);
+ LOG.info("Looking for services for interface: " + interfaceName);
ServiceEndpoint[] endpoints = context.getEndpointsForService(interfaceName);
if (endpoints.length > 0) {
ServiceEndpoint endpoint = endpoints[0];
- log.info("Sending to endpoint: " + endpoint);
-
+ LOG.info("Sending to endpoint: " + endpoint);
+
for (int i = 0; i < messageCount; i++) {
InOnly exchange = context.getDeliveryChannel().createExchangeFactory().createInOnlyExchange();
NormalizedMessage message = exchange.createMessage();
exchange.setEndpoint(endpoint);
exchange.setInMessage(message);
// lets set the XML as a byte[], String or DOM etc
- String xml = "<s12:Envelope xmlns:s12='http://www.w3.org/2003/05/soap-envelope'><s12:Body> <foo>Hello!</foo> </s12:Body></s12:Envelope>";
+ String xml = "<s12:Envelope xmlns:s12='http://www.w3.org/2003/05/soap-envelope'>"
+ + " <s12:Body><foo>Hello!</foo> </s12:Body>"
+ + "</s12:Envelope>";
message.setContent(new StringSource(xml));
- log.info("sending message: " + i);
+ LOG.info("sending message: " + i);
DeliveryChannel deliveryChannel = context.getDeliveryChannel();
- log.info("sync send on deliverychannel: " + deliveryChannel);
+ LOG.info("sync send on deliverychannel: " + deliveryChannel);
if (sync) {
- deliveryChannel.sendSync(exchange);
+ deliveryChannel.sendSync(exchange);
} else {
- deliveryChannel.send(exchange);
+ deliveryChannel.send(exchange);
}
}
- }
- else {
- log.warn("No endpoints available for interface: " + interfaceName);
+ } else {
+ LOG.warn("No endpoints available for interface: " + interfaceName);
}
}
-
// Properties
- //-------------------------------------------------------------------------
+ // -------------------------------------------------------------------------
public QName getInterfaceName() {
return interfaceName;
}
Modified: incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/tck/SpringTestSupport.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/tck/SpringTestSupport.java?view=diff&rev=564607&r1=564606&r2=564607
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/tck/SpringTestSupport.java (original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/tck/SpringTestSupport.java Fri Aug 10 07:37:46 2007
@@ -16,34 +16,36 @@
*/
package org.apache.servicemix.tck;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.servicemix.jbi.container.SpringJBIContainer;
-import org.apache.servicemix.jbi.jaxp.SourceTransformer;
-import org.apache.servicemix.jbi.util.DOMUtil;
-import org.apache.xpath.CachedXPathAPI;
-import org.springframework.context.support.AbstractXmlApplicationContext;
-import org.w3c.dom.Element;
-import org.w3c.dom.Node;
-import org.w3c.dom.traversal.NodeIterator;
-import org.xml.sax.SAXException;
+import java.io.IOException;
+import java.io.InputStream;
+import java.util.Iterator;
+import java.util.List;
+import javax.jbi.messaging.ExchangeStatus;
+import javax.jbi.messaging.MessageExchange;
import javax.jbi.messaging.MessagingException;
import javax.jbi.messaging.NormalizedMessage;
-import javax.jbi.messaging.MessageExchange;
-import javax.jbi.messaging.ExchangeStatus;
import javax.xml.parsers.ParserConfigurationException;
import javax.xml.transform.Source;
import javax.xml.transform.TransformerException;
import javax.xml.transform.stream.StreamSource;
-import java.io.IOException;
-import java.io.InputStream;
-import java.util.Iterator;
-import java.util.List;
+import org.w3c.dom.Element;
+import org.w3c.dom.Node;
+import org.w3c.dom.traversal.NodeIterator;
+
+import org.xml.sax.SAXException;
import junit.framework.TestCase;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.servicemix.jbi.container.SpringJBIContainer;
+import org.apache.servicemix.jbi.jaxp.SourceTransformer;
+import org.apache.servicemix.jbi.util.DOMUtil;
+import org.apache.xpath.CachedXPathAPI;
+import org.springframework.context.support.AbstractXmlApplicationContext;
+
/**
* @version $Revision$
*/
@@ -51,8 +53,11 @@
protected transient Log log = LogFactory.getLog(getClass());
protected AbstractXmlApplicationContext context;
+
protected SourceTransformer transformer;
+
protected int messageCount = 20;
+
protected SpringJBIContainer jbi;
protected void setUp() throws Exception {
@@ -84,8 +89,9 @@
protected abstract AbstractXmlApplicationContext createBeanFactory();
/**
- * Performs an XPath expression and returns the Text content of the root node.
- *
+ * Performs an XPath expression and returns the Text content of the root
+ * node.
+ *
* @param node
* @param xpath
* @return
@@ -102,8 +108,7 @@
}
String text = DOMUtil.getElementText(element);
return text;
- }
- else if (root != null) {
+ } else if (root != null) {
return root.getNodeValue();
} else {
return null;
@@ -117,8 +122,9 @@
return content;
}
- protected void assertMessagesReceived(MessageList messageList, int messageCount) throws MessagingException, TransformerException, ParserConfigurationException, IOException, SAXException {
- messageList.assertMessagesReceived(messageCount);
+ protected void assertMessagesReceived(MessageList messageList, int count) throws MessagingException, TransformerException,
+ ParserConfigurationException, IOException, SAXException {
+ messageList.assertMessagesReceived(count);
List list = messageList.getMessages();
int counter = 0;
for (Iterator iter = list.iterator(); iter.hasNext();) {
@@ -128,17 +134,14 @@
}
}
-
protected void assertExchangeWorked(MessageExchange me) throws Exception {
if (me.getStatus() == ExchangeStatus.ERROR) {
if (me.getError() != null) {
throw me.getError();
- }
- else {
+ } else {
fail("Received ERROR status");
}
- }
- else if (me.getFault() != null) {
+ } else if (me.getFault() != null) {
fail("Received fault: " + new SourceTransformer().toString(me.getFault().getContent()));
}
}
Modified: incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/tck/TestSupport.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/tck/TestSupport.java?view=diff&rev=564607&r1=564606&r2=564607
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/tck/TestSupport.java (original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/main/java/org/apache/servicemix/tck/TestSupport.java Fri Aug 10 07:37:46 2007
@@ -16,14 +16,9 @@
*/
package org.apache.servicemix.tck;
-import org.apache.servicemix.client.ServiceMixClient;
-import org.apache.servicemix.jbi.container.SpringJBIContainer;
-import org.apache.servicemix.jbi.jaxp.StringSource;
-import org.apache.servicemix.jbi.resolver.ServiceNameEndpointResolver;
-import org.w3c.dom.Node;
-import org.xml.sax.SAXException;
+import java.io.IOException;
+import java.util.Date;
-import javax.jbi.JBIException;
import javax.jbi.messaging.Fault;
import javax.jbi.messaging.InOnly;
import javax.jbi.messaging.NormalizedMessage;
@@ -32,14 +27,21 @@
import javax.xml.transform.Source;
import javax.xml.transform.TransformerException;
-import java.io.IOException;
-import java.util.Date;
+import org.w3c.dom.Node;
+
+import org.xml.sax.SAXException;
+
+import org.apache.servicemix.client.ServiceMixClient;
+import org.apache.servicemix.jbi.container.SpringJBIContainer;
+import org.apache.servicemix.jbi.jaxp.StringSource;
+import org.apache.servicemix.jbi.resolver.ServiceNameEndpointResolver;
/**
* @version $Revision$
*/
public abstract class TestSupport extends SpringTestSupport {
protected ServiceMixClient client;
+
protected Receiver receiver;
protected void setUp() throws Exception {
@@ -50,8 +52,9 @@
}
/**
- * Sends messages to the given service and asserts that the receiver gets them all
- *
+ * Sends messages to the given service and asserts that the receiver gets
+ * them all
+ *
* @param service
* @throws javax.jbi.messaging.MessagingException
*/
@@ -61,16 +64,16 @@
}
protected void sendMessages(QName service, int messageCount) throws Exception {
- sendMessages(service, messageCount, true, null);
+ sendMessages(service, messageCount, true, null);
}
protected void sendMessages(QName service, int messageCount, String message) throws Exception {
- sendMessages(service, messageCount, true, message);
+ sendMessages(service, messageCount, true, message);
}
/**
* Sends the given number of messages to the given service
- *
+ *
* @param service
* @throws javax.jbi.messaging.MessagingException
*/
@@ -90,9 +93,9 @@
exchange.setService(service);
if (sync) {
- client.sendSync(exchange);
+ client.sendSync(exchange);
} else {
- client.send(exchange);
+ client.send(exchange);
}
// lets assert that we have no failure
@@ -122,17 +125,18 @@
}
protected MessageList assertMessagesReceived(String receiverName, int messageCount) throws Exception {
- Receiver receiver = (Receiver) getBean(receiverName);
- assertNotNull("receiver: " + receiverName + " not found in JBI container", receiver);
+ Receiver rcv = (Receiver) getBean(receiverName);
+ assertNotNull("receiver: " + receiverName + " not found in JBI container", rcv);
- MessageList messageList = receiver.getMessageList();
+ MessageList messageList = rcv.getMessageList();
assertMessagesReceived(messageList, messageCount);
return messageList;
}
/**
- * Performs a request using the given file from the classpath as the request body and return the answer
- *
+ * Performs a request using the given file from the classpath as the request
+ * body and return the answer
+ *
* @param serviceName
* @param fileOnClassPath
* @return
@@ -149,8 +153,9 @@
}
/**
- * Performs a request using the given file from the classpath as the request body and return the answer
- *
+ * Performs a request using the given file from the classpath as the request
+ * body and return the answer
+ *
* @param serviceName
* @param fileOnClassPath
* @return
@@ -167,7 +172,7 @@
assertNotNull("Message: " + index + " is null!", message);
Object value = message.getProperty(propertyName);
- assertEquals("property: " + propertyName, expectedValue, value);
+ assertEquals("property: " + propertyName, expectedValue, value);
}
protected void assertMessageBody(MessageList messageList, int index, String expectedXml) throws TransformerException {
@@ -181,7 +186,8 @@
assertEquals("message XML for: " + index, expectedXml, value);
}
- protected void assertMessageXPath(MessageList messageList, int index, String xpath, String expectedValue) throws TransformerException, ParserConfigurationException, IOException, SAXException {
+ protected void assertMessageXPath(MessageList messageList, int index, String xpath, String expectedValue) throws TransformerException,
+ ParserConfigurationException, IOException, SAXException {
NormalizedMessage message = (NormalizedMessage) messageList.getMessages().get(index);
assertNotNull("Message: " + index + " is null!", message);
@@ -191,11 +197,11 @@
String value = textValueOfXPath(node, xpath);
String xmlText = transformer.toString(node);
-
+
if (log.isTraceEnabled()) {
log.trace("Message: " + index + " received XML: " + xmlText);
}
-
+
assertEquals("message XML: " + index + " for xpath: " + xpath + " body was: " + xmlText, expectedValue, value);
}
}
Modified: incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/client/ClientDestinationTest.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/client/ClientDestinationTest.java?view=diff&rev=564607&r1=564606&r2=564607
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/client/ClientDestinationTest.java (original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/client/ClientDestinationTest.java Fri Aug 10 07:37:46 2007
@@ -38,7 +38,8 @@
* @version $Revision$
*/
public class ClientDestinationTest extends TestCase {
- private static final transient Log log = LogFactory.getLog(ClientDestinationTest.class);
+
+ private static final transient Log LOG = LogFactory.getLog(ClientDestinationTest.class);
protected AbstractXmlApplicationContext context;
protected ServiceMixClient client;
@@ -87,7 +88,7 @@
assertNotNull("Should have returned a non-null response!", response);
- log.info("Received result: " + response);
+ LOG.info("Received result: " + response);
}
@@ -95,7 +96,7 @@
TestBean bean = new TestBean();
bean.setName("James");
bean.setLength(12);
- bean.getAddresses().addAll(Arrays.asList(new String[] { "London", "LA" }));
+ bean.getAddresses().addAll(Arrays.asList(new String[] {"London", "LA" }));
Destination destination = client.createDestination("service:http://servicemix.org/cheese/receiver");
Message message = destination.createInOnlyMessage();
Modified: incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/client/ServiceMixClientTest.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/client/ServiceMixClientTest.java?view=diff&rev=564607&r1=564606&r2=564607
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/client/ServiceMixClientTest.java (original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/client/ServiceMixClientTest.java Fri Aug 10 07:37:46 2007
@@ -16,15 +16,10 @@
*/
package org.apache.servicemix.client;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.apache.servicemix.client.ServiceMixClient;
-import org.apache.servicemix.jbi.container.SpringJBIContainer;
-import org.apache.servicemix.jbi.jaxp.SourceTransformer;
-import org.apache.servicemix.jbi.resolver.EndpointResolver;
-import org.apache.servicemix.tck.Receiver;
-import org.springframework.context.support.AbstractXmlApplicationContext;
-import org.apache.xbean.spring.context.ClassPathXmlApplicationContext;
+import java.io.StringReader;
+import java.util.Arrays;
+import java.util.HashMap;
+import java.util.Map;
import javax.jbi.JBIException;
import javax.jbi.messaging.InOnly;
@@ -33,18 +28,23 @@
import javax.xml.namespace.QName;
import javax.xml.transform.stream.StreamSource;
-import java.io.StringReader;
-import java.util.Arrays;
-import java.util.HashMap;
-import java.util.Map;
-
import junit.framework.TestCase;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.servicemix.jbi.container.SpringJBIContainer;
+import org.apache.servicemix.jbi.jaxp.SourceTransformer;
+import org.apache.servicemix.jbi.resolver.EndpointResolver;
+import org.apache.servicemix.tck.Receiver;
+import org.apache.xbean.spring.context.ClassPathXmlApplicationContext;
+import org.springframework.context.support.AbstractXmlApplicationContext;
+
/**
* @version $Revision$
*/
public class ServiceMixClientTest extends TestCase {
- private static final transient Log log = LogFactory.getLog(ServiceMixClientTest.class);
+
+ private static final transient Log LOG = LogFactory.getLog(ServiceMixClientTest.class);
protected AbstractXmlApplicationContext context;
protected ServiceMixClient client;
@@ -103,9 +103,8 @@
client.send(null, null, properties, "<hello>world</hello>");
fail("Should have thrown an exception as we have not wired in any container routing information to this client");
- }
- catch (JBIException e) {
- log.info("Caught expected exception as we have specified no endpoint resolver: " + e);
+ } catch (JBIException e) {
+ LOG.info("Caught expected exception as we have specified no endpoint resolver: " + e);
assertNotNull(e);
}
}
@@ -126,22 +125,22 @@
public void testRequestUsingPOJOWithXStreamMarshaling() throws Exception {
QName service = new QName("http://servicemix.org/cheese", "myService");
- ServiceMixClient client = (ServiceMixClient) context.getBean("clientWithXStream");
+ ServiceMixClient clientWithXStream = (ServiceMixClient) context.getBean("clientWithXStream");
Map properties = new HashMap();
properties.put("name", "James");
- EndpointResolver resolver = client.createResolverForService(service);
+ EndpointResolver resolver = clientWithXStream.createResolverForService(service);
TestBean bean = new TestBean();
bean.setName("James");
bean.setLength(12);
bean.getAddresses().addAll(Arrays.asList(new String[] {"London", "LA"}));
- Object response = client.request(resolver, null, properties, bean);
+ Object response = clientWithXStream.request(resolver, null, properties, bean);
assertNotNull("Should have returned a non-null response!", response);
- log.info("Received result: " + response);
+ LOG.info("Received result: " + response);
}
@@ -163,8 +162,8 @@
assertNotNull("outMessage is null!", outMessage);
assertEquals("foo header", "hello", outMessage.getProperty("foo"));
- log.info("Received result: " + outMessage.getContent());
- log.info("XML is: " + transformer.toString(outMessage.getContent()));
+ LOG.info("Received result: " + outMessage.getContent());
+ LOG.info("XML is: " + transformer.toString(outMessage.getContent()));
}
protected void assertRequestUsingMapAndPOJOByServiceName(QName service) throws Exception {
@@ -176,7 +175,7 @@
assertNotNull("Should have returned a non-null response!", response);
- log.info("Received result: " + response);
+ LOG.info("Received result: " + response);
}
protected void setUp() throws Exception {
Modified: incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/client/SimpleClientTest.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/client/SimpleClientTest.java?view=diff&rev=564607&r1=564606&r2=564607
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/client/SimpleClientTest.java (original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/client/SimpleClientTest.java Fri Aug 10 07:37:46 2007
@@ -16,13 +16,7 @@
*/
package org.apache.servicemix.client;
-import org.apache.servicemix.client.DefaultServiceMixClient;
-import org.apache.servicemix.client.ServiceMixClient;
-import org.apache.servicemix.components.util.OutBinding;
-import org.apache.servicemix.jbi.container.ActivationSpec;
-import org.apache.servicemix.jbi.container.JBIContainer;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
+import java.io.StringReader;
import javax.jbi.messaging.InOnly;
import javax.jbi.messaging.MessageExchange;
@@ -31,16 +25,20 @@
import javax.xml.namespace.QName;
import javax.xml.transform.stream.StreamSource;
-import java.io.StringReader;
-
import junit.framework.TestCase;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.servicemix.components.util.OutBinding;
+import org.apache.servicemix.jbi.container.ActivationSpec;
+import org.apache.servicemix.jbi.container.JBIContainer;
+
/**
* @version $Revision$
*/
public class SimpleClientTest extends TestCase {
- private static final Log log = LogFactory.getLog(SimpleClientTest.class);
+ private static final Log LOG = LogFactory.getLog(SimpleClientTest.class);
protected JBIContainer container;
protected OutBinding out;
@@ -53,11 +51,11 @@
container.start();
out = new OutBinding() {
protected void process(MessageExchange exchange, NormalizedMessage message) throws MessagingException {
- log.info("Received: " + message);
+ LOG.info("Received: " + message);
done(exchange);
}
};
- ActivationSpec as = new ActivationSpec("out",out);
+ ActivationSpec as = new ActivationSpec("out", out);
as.setService(new QName("out"));
container.activateComponent(as);
client = new DefaultServiceMixClient(container);
Modified: incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/components/util/ChainedComponentTest.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/components/util/ChainedComponentTest.java?view=diff&rev=564607&r1=564606&r2=564607
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/components/util/ChainedComponentTest.java (original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/components/util/ChainedComponentTest.java Fri Aug 10 07:37:46 2007
@@ -16,16 +16,15 @@
*/
package org.apache.servicemix.components.util;
+import java.util.Iterator;
+
+import javax.jbi.messaging.NormalizedMessage;
+
import org.apache.servicemix.examples.AbstractSpringTestSupport;
import org.apache.servicemix.jbi.config.DebugClassPathXmlApplicationContext;
import org.apache.servicemix.tck.MessageList;
import org.springframework.context.support.AbstractXmlApplicationContext;
-import javax.jbi.messaging.NormalizedMessage;
-
-import java.util.Iterator;
-
-
public class ChainedComponentTest extends AbstractSpringTestSupport {
public void testSendingAndReceivingMessagesUsingSpring() throws Exception {
@@ -35,9 +34,9 @@
NormalizedMessage msg = (NormalizedMessage) iter.next();
assertNotNull(msg.getProperty("prop1"));
assertNotNull(msg.getProperty("prop2"));
- }
+ }
}
-
+
protected AbstractXmlApplicationContext createBeanFactory() {
return new DebugClassPathXmlApplicationContext("org/apache/servicemix/components/util/chained-router.xml");
}
Modified: incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/components/util/CopyTransformerTest.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/components/util/CopyTransformerTest.java?view=diff&rev=564607&r1=564606&r2=564607
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/components/util/CopyTransformerTest.java (original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/components/util/CopyTransformerTest.java Fri Aug 10 07:37:46 2007
@@ -24,11 +24,12 @@
import javax.xml.transform.sax.SAXSource;
import javax.xml.transform.stream.StreamSource;
+import org.xml.sax.InputSource;
+
import junit.framework.TestCase;
import org.apache.servicemix.jbi.jaxp.SourceTransformer;
import org.apache.servicemix.jbi.messaging.NormalizedMessageImpl;
-import org.xml.sax.InputSource;
public class CopyTransformerTest extends TestCase {
Modified: incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/components/util/PropertyAddTransformer.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/components/util/PropertyAddTransformer.java?view=diff&rev=564607&r1=564606&r2=564607
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/components/util/PropertyAddTransformer.java (original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/components/util/PropertyAddTransformer.java Fri Aug 10 07:37:46 2007
@@ -20,8 +20,6 @@
import javax.jbi.messaging.MessagingException;
import javax.jbi.messaging.NormalizedMessage;
-import org.apache.servicemix.components.util.CopyTransformer;
-
public class PropertyAddTransformer extends CopyTransformer {
String name;
Modified: incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/components/util/SimpleFlatFileMarshalerTest.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/components/util/SimpleFlatFileMarshalerTest.java?view=diff&rev=564607&r1=564606&r2=564607
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/components/util/SimpleFlatFileMarshalerTest.java (original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/components/util/SimpleFlatFileMarshalerTest.java Fri Aug 10 07:37:46 2007
@@ -24,16 +24,16 @@
import java.util.ArrayList;
import java.util.List;
-import org.apache.commons.lang.StringUtils;
-
import junit.framework.TestCase;
+import org.apache.commons.lang.StringUtils;
+
public class SimpleFlatFileMarshalerTest extends TestCase {
public void testFixedLengthMarshalling() throws FileNotFoundException, IOException {
SimpleFlatFileMarshaler marshaler = new SimpleFlatFileMarshaler();
marshaler.setLineFormat(SimpleFlatFileMarshaler.LINEFORMAT_FIXLENGTH);
- marshaler.setColumnLengths(new String[] { "2", "3", "5" });
+ marshaler.setColumnLengths(new String[] {"2", "3", "5" });
String path = "./src/test/resources/org/apache/servicemix/components/util/fixedlength.txt";
String result = marshaler.convertLinesToString(null, new FileInputStream(new File(path)), path);
@@ -50,8 +50,8 @@
public void testFixedLengthWithColNamesMarshalling() throws FileNotFoundException, IOException {
SimpleFlatFileMarshaler marshaler = new SimpleFlatFileMarshaler();
marshaler.setLineFormat(SimpleFlatFileMarshaler.LINEFORMAT_FIXLENGTH);
- marshaler.setColumnLengths(new String[] { "2", "3", "5" });
- marshaler.setColumnNames(new String[] { "First", "Second", "Third" });
+ marshaler.setColumnLengths(new String[] {"2", "3", "5" });
+ marshaler.setColumnNames(new String[] {"First", "Second", "Third" });
String path = "./src/test/resources/org/apache/servicemix/components/util/fixedlength.txt";
String result = marshaler.convertLinesToString(null, new FileInputStream(new File(path)), path);
@@ -71,8 +71,8 @@
public void testFixedLengthWithConversionMarshalling() throws FileNotFoundException, IOException {
SimpleFlatFileMarshaler marshaler = new SimpleFlatFileMarshaler();
marshaler.setLineFormat(SimpleFlatFileMarshaler.LINEFORMAT_FIXLENGTH);
- marshaler.setColumnLengths(new String[] { "2", "3", "5", "8" });
- marshaler.setColumnNames(new String[] { "Number", "Text1", "Text2", "Date" });
+ marshaler.setColumnLengths(new String[] {"2", "3", "5", "8" });
+ marshaler.setColumnNames(new String[] {"Number", "Text1", "Text2", "Date" });
List columnConverters = new ArrayList();
columnConverters.add(new NumberConverter());
Modified: incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/expression/ExpressionTestSupport.java
URL: http://svn.apache.org/viewvc/incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/expression/ExpressionTestSupport.java?view=diff&rev=564607&r1=564606&r2=564607
==============================================================================
--- incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/expression/ExpressionTestSupport.java (original)
+++ incubator/servicemix/trunk/core/servicemix-core/src/test/java/org/apache/servicemix/expression/ExpressionTestSupport.java Fri Aug 10 07:37:46 2007
@@ -16,8 +16,6 @@
*/
package org.apache.servicemix.expression;
-import org.apache.servicemix.expression.Expression;
-
public class ExpressionTestSupport {
private Expression expression;