Author: aco
Date: Fri Feb 23 21:54:10 2007
New Revision: 511220
URL: http://svn.apache.org/viewvc?view=rev&rev=511220
Log:
- Change System.outs and System.errs to log.info
Modified:
incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-http/src/test/java/org/apache/servicemix/http/HttpConsumerTest.java
incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-http/src/test/java/org/apache/servicemix/http/HttpManagedTest.java
incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-http/src/test/java/org/apache/servicemix/http/HttpProviderTest.java
incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-http/src/test/java/org/apache/servicemix/http/HttpSoapTest.java
incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-http/src/test/java/org/apache/servicemix/http/HttpSpringTest.java
incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-http/src/test/java/org/apache/servicemix/http/HttpURITest.java
incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-http/src/test/java/org/apache/servicemix/http/security/HttpSecurityTest.java
Modified:
incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-http/src/test/java/org/apache/servicemix/http/HttpConsumerTest.java
URL:
http://svn.apache.org/viewvc/incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-http/src/test/java/org/apache/servicemix/http/HttpConsumerTest.java?view=diff&rev=511220&r1=511219&r2=511220
==============================================================================
---
incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-http/src/test/java/org/apache/servicemix/http/HttpConsumerTest.java
(original)
+++
incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-http/src/test/java/org/apache/servicemix/http/HttpConsumerTest.java
Fri Feb 23 21:54:10 2007
@@ -40,11 +40,14 @@
import org.apache.servicemix.jbi.jaxp.SourceTransformer;
import org.apache.servicemix.tck.Receiver;
import org.apache.servicemix.tck.ReceiverComponent;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
public class HttpConsumerTest extends TestCase {
+ private static Log logger = LogFactory.getLog(HttpConsumerTest.class);
protected JBIContainer container;
-
+
protected void setUp() throws Exception {
container = new JBIContainer();
container.setUseMBeanServer(false);
@@ -52,25 +55,25 @@
container.setEmbedded(true);
container.init();
}
-
+
protected void tearDown() throws Exception {
if (container != null) {
container.shutDown();
}
}
-
+
protected long testInOnly(String msg, boolean streaming) throws Exception {
// HTTP Component
HttpComponent component = new HttpComponent();
component.getConfiguration().setStreamingEnabled(streaming);
container.activateComponent(component, "HTTPComponent");
-
+
// Add a receiver component
Receiver receiver = new ReceiverComponent();
ActivationSpec asReceiver = new ActivationSpec("receiver", receiver);
asReceiver.setService(new QName("http://http.servicemix.org/Test",
"ConsumerInOnly"));
container.activateComponent(asReceiver);
-
+
// Add the http invoker
HttpInvoker invoker = new HttpInvoker();
invoker.setDefaultInOut(false);
@@ -79,7 +82,7 @@
ActivationSpec asInvoker = new ActivationSpec("invoker", invoker);
asInvoker.setService(new QName("urn:test", "invoker"));
container.activateComponent(asInvoker);
-
+
// Start container
container.start();
@@ -89,37 +92,37 @@
path = path.getParentFile();
component.getServiceUnitManager().deploy("consumer",
path.getAbsolutePath());
component.getServiceUnitManager().start("consumer");
-
+
// Call it
DefaultServiceMixClient client = new
DefaultServiceMixClient(container);
RobustInOnly in = client.createRobustInOnlyExchange();
in.setService(new QName("urn:test", "invoker"));
in.getInMessage().setContent(new StreamSource(new
ByteArrayInputStream(msg.getBytes())));
-
+
long t0 = System.currentTimeMillis();
client.sendSync(in);
long t1 = System.currentTimeMillis();
assertEquals(ExchangeStatus.DONE, in.getStatus());
-
+
// Check we received the message
receiver.getMessageList().assertMessagesReceived(1);
-
+
return t1 - t0;
}
-
+
protected long testInOut(String msg, boolean streaming) throws Exception {
// HTTP Component
HttpComponent component = new HttpComponent();
component.getConfiguration().setStreamingEnabled(streaming);
container.activateComponent(component, "HTTPComponent");
-
+
// Add a receiver component
EchoComponent echo = new EchoComponent();
ActivationSpec asReceiver = new ActivationSpec("echo", echo);
asReceiver.setService(new QName("http://http.servicemix.org/Test",
"ConsumerInOut"));
container.activateComponent(asReceiver);
-
+
// Add the http invoker
HttpInvoker invoker = new HttpInvoker();
invoker.setDefaultInOut(true);
@@ -127,7 +130,7 @@
ActivationSpec asInvoker = new ActivationSpec("invoker", invoker);
asInvoker.setService(new QName("urn:test", "invoker"));
container.activateComponent(asInvoker);
-
+
// Start container
container.start();
@@ -141,44 +144,44 @@
// Retrieve WSDL
Definition def =
WSDLFactory.newInstance().newWSDLReader().readWSDL("http://localhost:8192/InOut/?wsdl");
assertNotNull(def);
-
+
// Call it
DefaultServiceMixClient client = new
DefaultServiceMixClient(container);
InOut inout = client.createInOutExchange();
inout.setService(new QName("urn:test", "invoker"));
inout.getInMessage().setContent(new StreamSource(new
ByteArrayInputStream(msg.getBytes())));
-
+
long t0 = System.currentTimeMillis();
client.sendSync(inout);
long t1 = System.currentTimeMillis();
assertTrue(inout.getStatus() == ExchangeStatus.ACTIVE);
-
+
// Check we received the message
assertNotNull(inout.getOutMessage());
assertNotNull(inout.getOutMessage().getContent());
- System.out.println(new
SourceTransformer().toString(inout.getOutMessage().getContent()));
-
+ logger.info(new
SourceTransformer().toString(inout.getOutMessage().getContent()));
+
return t1 - t0;
}
-
+
public void testInOnly() throws Exception {
testInOnly("<hello>world</hello>", false);
// Pause to avoid reusing the same http connection
// to read the wsdl, has the server has changed
Thread.sleep(1000);
}
-
+
public void testInOut() throws Exception {
testInOut("<hello>world</hello>", true);
// Pause to avoid reusing the same http connection
// to read the wsdl, has the server has changed
Thread.sleep(1000);
}
-
+
public void testPerfInOnlyWithBigMessage() throws Exception {
int nbRuns = 2;
int sizeInKb = 64;
-
+
StringBuffer sb = new StringBuffer();
sb.append("<hello>");
for (int i = 0; i < sizeInKb; i++) {
@@ -190,22 +193,22 @@
}
sb.append("</hello>");
String str = sb.toString();
-
- for(int i = 0; i < nbRuns; i++) {
+
+ for(int i = 0; i < nbRuns; i++) {
System.gc();
long dt = testInOnly(str, false);
- System.err.println("No Streaming: " + dt);
+ logger.info("No Streaming: " + dt);
tearDown();
setUp();
}
-
- for(int i = 0; i < nbRuns; i++) {
+
+ for(int i = 0; i < nbRuns; i++) {
System.gc();
long dt = testInOnly(str, true);
- System.err.println("Streaming: " + dt);
+ logger.info("Streaming: " + dt);
tearDown();
setUp();
}
}
-
+
}
Modified:
incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-http/src/test/java/org/apache/servicemix/http/HttpManagedTest.java
URL:
http://svn.apache.org/viewvc/incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-http/src/test/java/org/apache/servicemix/http/HttpManagedTest.java?view=diff&rev=511220&r1=511219&r2=511220
==============================================================================
---
incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-http/src/test/java/org/apache/servicemix/http/HttpManagedTest.java
(original)
+++
incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-http/src/test/java/org/apache/servicemix/http/HttpManagedTest.java
Fri Feb 23 21:54:10 2007
@@ -25,6 +25,8 @@
import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.methods.PostMethod;
import org.apache.commons.httpclient.methods.StringRequestEntity;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.apache.servicemix.components.http.InvalidStatusResponseException;
import org.apache.xbean.spring.context.XmlWebApplicationContext;
import org.mortbay.jetty.Connector;
@@ -40,6 +42,7 @@
import org.springframework.web.context.ContextLoaderListener;
public class HttpManagedTest extends TestCase {
+ private static Log logger = LogFactory.getLog(HttpManagedTest.class);
private Server server;
@@ -82,7 +85,7 @@
server.setHandler(handlers);
server.start();
- System.err.println("Started");
+ logger.info("Started");
PostMethod post = new
PostMethod("http://localhost:8190/test/jbi/Service/");
post.setRequestEntity(new StringRequestEntity("<soap:Envelope
xmlns:soap='http://www.w3.org/2003/05/soap-envelope'><soap:Body><hello>world</hello></soap:Body></soap:Envelope>"));
@@ -90,7 +93,7 @@
if (post.getStatusCode() != 200) {
throw new InvalidStatusResponseException(post.getStatusCode());
}
- System.err.println(post.getResponseBodyAsString());
+ logger.info(post.getResponseBodyAsString());
}
}
Modified:
incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-http/src/test/java/org/apache/servicemix/http/HttpProviderTest.java
URL:
http://svn.apache.org/viewvc/incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-http/src/test/java/org/apache/servicemix/http/HttpProviderTest.java?view=diff&rev=511220&r1=511219&r2=511220
==============================================================================
---
incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-http/src/test/java/org/apache/servicemix/http/HttpProviderTest.java
(original)
+++
incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-http/src/test/java/org/apache/servicemix/http/HttpProviderTest.java
Fri Feb 23 21:54:10 2007
@@ -38,8 +38,11 @@
import org.apache.servicemix.tck.Receiver;
import org.apache.servicemix.tck.ReceiverComponent;
import org.apache.servicemix.JbiConstants;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
public class HttpProviderTest extends TestCase {
+ private static Log logger = LogFactory.getLog(HttpProviderTest.class);
protected JBIContainer container;
@@ -229,8 +232,8 @@
.getContent());
String inputMesage = sourceTransformer.toString(new StreamSource(
new ByteArrayInputStream(msg.getBytes())));
- System.out.println("Msg Sent [" + inputMesage + "]");
- System.out.println("Msg Recieved [" + reply + "]");
+ logger.info("Msg Sent [" + inputMesage + "]");
+ logger.info("Msg Recieved [" + reply + "]");
assertEquals(inputMesage.length(), reply.length());
assertEquals(inputMesage, reply);
@@ -240,7 +243,7 @@
component.getServiceUnitManager().undeploy("provider",
path.getAbsolutePath());
- System.out.println("Executed in " + (t1 - t0) + "ms");
+ logger.info("Executed in " + (t1 - t0) + "ms");
return reply;
}
@@ -263,51 +266,51 @@
testInOut("<hello>world</hello>", true);
}
- public void testPerfInOnlyWithBigMessage() throws Exception {
- int nbRuns = 10;
- int sizeInKb = 64;
-
- StringBuffer sb = new StringBuffer();
- sb.append("<hello>\n");
- for (int i = 0; i < sizeInKb; i++) {
- sb.append("\t<hello>");
- for (int j = 0; j < 1024 - 15; j++) {
- sb
- .append((char) ('A' + (int)
(Math.random() * ('Z' - 'A' + 1))));
- }
- sb.append("</hello>\n");
- }
- sb.append("</hello>\n");
- String str = sb.toString();
-
- /*
- * for(int i = 0; i < nbRuns; i++) { System.gc(); long dt =
- * testInOnly(str, false); System.err.println("No Streaming: "
+ dt);
- * tearDown(); setUp(); }
- */
-
- for (int i = 0; i < nbRuns; i++) {
- System.gc();
- long dt = testInOnly(str, true);
- System.err.println("Streaming: " + dt);
- tearDown();
- setUp();
- }
- }
-
- public void testInOutWithBigMessage() throws Exception {
- int sizeInKb = 640*1024;
-
- StringBuffer sb = new StringBuffer();
- sb.append("<hello>\n");
-
- for (int j = 0; j < sizeInKb - 15; j++) {
- sb.append((char) ('A' + (int) (Math.random() * ('Z' -
'A' + 1))));
- }
+ public void testPerfInOnlyWithBigMessage() throws Exception {
+ int nbRuns = 10;
+ int sizeInKb = 64;
+
+ StringBuffer sb = new StringBuffer();
+ sb.append("<hello>\n");
+ for (int i = 0; i < sizeInKb; i++) {
+ sb.append("\t<hello>");
+ for (int j = 0; j < 1024 - 15; j++) {
+ sb
+ .append((char) ('A' + (int) (Math.random() * ('Z' -
'A' + 1))));
+ }
+ sb.append("</hello>\n");
+ }
+ sb.append("</hello>\n");
+ String str = sb.toString();
+
+ /*
+ * for(int i = 0; i < nbRuns; i++) { System.gc(); long dt =
+ * testInOnly(str, false); System.err.println("No Streaming: " + dt);
+ * tearDown(); setUp(); }
+ */
+
+ for (int i = 0; i < nbRuns; i++) {
+ System.gc();
+ long dt = testInOnly(str, true);
+ logger.info("Streaming: " + dt);
+ tearDown();
+ setUp();
+ }
+ }
+
+ public void testInOutWithBigMessage() throws Exception {
+ int sizeInKb = 640*1024;
- sb.append("</hello>\n");
- String str = sb.toString();
+ StringBuffer sb = new StringBuffer();
+ sb.append("<hello>\n");
- testInOut(str, true);
- }
+ for (int j = 0; j < sizeInKb - 15; j++) {
+ sb.append((char) ('A' + (int) (Math.random() * ('Z' - 'A' + 1))));
+ }
+
+ sb.append("</hello>\n");
+ String str = sb.toString();
+
+ testInOut(str, true);
+ }
}
Modified:
incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-http/src/test/java/org/apache/servicemix/http/HttpSoapTest.java
URL:
http://svn.apache.org/viewvc/incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-http/src/test/java/org/apache/servicemix/http/HttpSoapTest.java?view=diff&rev=511220&r1=511219&r2=511220
==============================================================================
---
incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-http/src/test/java/org/apache/servicemix/http/HttpSoapTest.java
(original)
+++
incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-http/src/test/java/org/apache/servicemix/http/HttpSoapTest.java
Fri Feb 23 21:54:10 2007
@@ -44,6 +44,8 @@
import org.apache.commons.httpclient.methods.PostMethod;
import org.apache.commons.httpclient.methods.StringRequestEntity;
import org.apache.commons.httpclient.params.HttpMethodParams;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.apache.servicemix.client.DefaultServiceMixClient;
import org.apache.servicemix.client.Destination;
import org.apache.servicemix.client.ServiceMixClient;
@@ -67,6 +69,7 @@
import com.ibm.wsdl.util.xml.DOMUtils;
public class HttpSoapTest extends TestCase {
+ private static Log logger = LogFactory.getLog(HttpSoapTest.class);
protected JBIContainer container;
@@ -177,7 +180,7 @@
assertEquals(ExchangeStatus.ACTIVE, me.getStatus());
String str = new
SourceTransformer().contentToString(me.getOutMessage());
client.done(me);
- System.err.println(str);
+ logger.info(str);
}
public void testSoapRoundtripProviderConsumerProvider() throws Exception {
@@ -230,7 +233,7 @@
assertEquals(HttpServletResponse.SC_OK, state);
ByteArrayOutputStream baos = new ByteArrayOutputStream();
FileUtil.copyInputStream(method.getResponseBodyAsStream(), baos);
- System.err.println(baos.toString());
+ logger.info(baos.toString());
}
public void testSoapFault12() throws Exception {
@@ -286,7 +289,7 @@
assertEquals(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, state);
SourceTransformer st = new SourceTransformer();
Node node = st.toDOMNode(new
StreamSource(method.getResponseBodyAsStream()));
- System.err.println(st.toString(node));
+ logger.info(st.toString(node));
Element e = ((Document) node).getDocumentElement();
assertEquals(new QName(SoapMarshaler.SOAP_12_URI,
SoapMarshaler.ENVELOPE), DOMUtil.getQName(e));
@@ -347,7 +350,7 @@
method.setRequestEntity(new
InputStreamRequestEntity(getClass().getResourceAsStream("soap-request.xml")));
int state = new HttpClient().executeMethod(method);
String str = method.getResponseBodyAsString();
- System.err.println(str);
+ logger.info(str);
assertEquals(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, state);
SourceTransformer st = new SourceTransformer();
Node node = st.toDOMNode(new StringSource(str));
@@ -410,7 +413,7 @@
SourceTransformer st = new SourceTransformer();
Element e = st.toDOMElement(msg);
String strMsg = DOMUtil.asXML(e);
- System.err.println(strMsg);
+ logger.info(strMsg);
assertEquals(new QName(SoapMarshaler.SOAP_12_URI,
SoapMarshaler.ENVELOPE), DOMUtil.getQName(e));
e = DOMUtil.getFirstChildElement(e);
Modified:
incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-http/src/test/java/org/apache/servicemix/http/HttpSpringTest.java
URL:
http://svn.apache.org/viewvc/incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-http/src/test/java/org/apache/servicemix/http/HttpSpringTest.java?view=diff&rev=511220&r1=511219&r2=511220
==============================================================================
---
incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-http/src/test/java/org/apache/servicemix/http/HttpSpringTest.java
(original)
+++
incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-http/src/test/java/org/apache/servicemix/http/HttpSpringTest.java
Fri Feb 23 21:54:10 2007
@@ -44,7 +44,9 @@
private static Log logger = LogFactory.getLog(HttpSpringTest.class);
protected void setUp() throws Exception {
- System.setProperty("javax.net.debug", "all");
+ if (logger.isDebugEnabled()) {
+ System.setProperty("javax.net.debug", "all");
+ }
super.setUp();
}
Modified:
incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-http/src/test/java/org/apache/servicemix/http/HttpURITest.java
URL:
http://svn.apache.org/viewvc/incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-http/src/test/java/org/apache/servicemix/http/HttpURITest.java?view=diff&rev=511220&r1=511219&r2=511220
==============================================================================
---
incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-http/src/test/java/org/apache/servicemix/http/HttpURITest.java
(original)
+++
incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-http/src/test/java/org/apache/servicemix/http/HttpURITest.java
Fri Feb 23 21:54:10 2007
@@ -33,10 +33,13 @@
import org.apache.servicemix.jbi.messaging.MessageExchangeSupport;
import org.apache.servicemix.jbi.resolver.URIResolver;
import org.apache.servicemix.tck.ReceiverComponent;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.w3c.dom.DocumentFragment;
import org.w3c.dom.Element;
public class HttpURITest extends TestCase {
+ private static Log logger = LogFactory.getLog(HttpURITest.class);
private JBIContainer jbi;
@@ -83,7 +86,7 @@
Element elem = new SourceTransformer().toDOMElement(msg);
assertEquals("http://www.w3.org/2003/05/soap-envelope",
elem.getNamespaceURI());
assertEquals("env:Envelope", elem.getNodeName());
- System.out.println(new SourceTransformer().contentToString(msg));
+ logger.info(new SourceTransformer().contentToString(msg));
}
}
Modified:
incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-http/src/test/java/org/apache/servicemix/http/security/HttpSecurityTest.java
URL:
http://svn.apache.org/viewvc/incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-http/src/test/java/org/apache/servicemix/http/security/HttpSecurityTest.java?view=diff&rev=511220&r1=511219&r2=511220
==============================================================================
---
incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-http/src/test/java/org/apache/servicemix/http/security/HttpSecurityTest.java
(original)
+++
incubator/servicemix/trunk/deployables/bindingcomponents/servicemix-http/src/test/java/org/apache/servicemix/http/security/HttpSecurityTest.java
Fri Feb 23 21:54:10 2007
@@ -27,6 +27,8 @@
import org.apache.commons.httpclient.auth.AuthScope;
import org.apache.commons.httpclient.methods.PostMethod;
import org.apache.commons.httpclient.methods.StringRequestEntity;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
import org.apache.servicemix.jbi.jaxp.SourceTransformer;
import org.apache.servicemix.jbi.jaxp.StringSource;
import org.apache.servicemix.jbi.util.FileUtil;
@@ -36,7 +38,8 @@
import org.w3c.dom.Element;
public class HttpSecurityTest extends SpringTestSupport {
-
+ private static Log logger = LogFactory.getLog(HttpSecurityTest.class);
+
static {
String path = System.getProperty("java.security.auth.login.config");
if (path == null) {
@@ -46,7 +49,7 @@
System.setProperty("java.security.auth.login.config", path);
}
}
- System.err.println("Path to login config: " + path);
+ logger.info("Path to login config: " + path);
}
protected void setUp() throws Exception {
@@ -130,7 +133,7 @@
method.setRequestEntity(new StringRequestEntity(request));
int state = client.executeMethod(method);
String str = method.getResponseBodyAsString();
- System.err.println(str);
+ logger.info(str);
assertEquals(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, state);
Element e = new SourceTransformer().toDOMElement(new
StringSource(str));
assertEquals("Envelope", e.getLocalName());
@@ -154,7 +157,7 @@
method.setRequestEntity(new StringRequestEntity(request));
int state = client.executeMethod(method);
String str = method.getResponseBodyAsString();
- System.err.println(str);
+ logger.info(str);
assertEquals(HttpServletResponse.SC_INTERNAL_SERVER_ERROR, state);
Element e = new SourceTransformer().toDOMElement(new
StringSource(str));
assertEquals("Envelope", e.getLocalName());