You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commons-dev@ws.apache.org by ve...@apache.org on 2008/11/03 22:07:21 UTC
svn commit: r710158 [17/20] - in
/webservices/commons/trunk/modules/transport: ./ modules/base/
modules/base/src/main/java/org/apache/axis2/format/
modules/base/src/main/java/org/apache/axis2/transport/base/
modules/base/src/main/java/org/apache/axis2/...
Modified: webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/tests/async/XMLAsyncMessageTestCase.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/tests/async/XMLAsyncMessageTestCase.java?rev=710158&r1=710157&r2=710158&view=diff
==============================================================================
--- webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/tests/async/XMLAsyncMessageTestCase.java (original)
+++ webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/tests/async/XMLAsyncMessageTestCase.java Mon Nov 3 13:07:13 2008
@@ -1,72 +1,72 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.axis2.transport.testkit.tests.async;
-
-import javax.xml.namespace.QName;
-
-import org.apache.axiom.om.OMAbstractFactory;
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMFactory;
-import org.apache.axis2.transport.testkit.MessageTestData;
-import org.apache.axis2.transport.testkit.channel.AsyncChannel;
-import org.apache.axis2.transport.testkit.client.AsyncTestClient;
-import org.apache.axis2.transport.testkit.endpoint.AsyncEndpoint;
-import org.apache.axis2.transport.testkit.message.XMLMessage;
-import org.apache.axis2.transport.testkit.name.Key;
-import org.apache.axis2.transport.testkit.name.Name;
-import org.apache.axis2.transport.testkit.name.Named;
-
-@Name("AsyncXML")
-public class XMLAsyncMessageTestCase extends AsyncMessageTestCase<XMLMessage> {
- private final XMLMessage.Type xmlMessageType;
- private final MessageTestData data;
-
- public XMLAsyncMessageTestCase(AsyncChannel channel, AsyncTestClient<XMLMessage> client, AsyncEndpoint<XMLMessage> endpoint, XMLMessage.Type xmlMessageType, MessageTestData data, Object... resources) {
- super(channel, client, endpoint, xmlMessageType.getContentType(), data.getCharset(), resources);
- this.xmlMessageType = xmlMessageType;
- this.data = data;
- }
-
- @Key("messageType")
- public XMLMessage.Type getXmlMessageType() {
- return xmlMessageType;
- }
-
- @Named
- public MessageTestData getData() {
- return data;
- }
-
- @Override
- protected XMLMessage prepareMessage() throws Exception {
- OMFactory factory = OMAbstractFactory.getOMFactory();
- OMElement orgElement = factory.createOMElement(new QName("root"));
- orgElement.setText(data.getText());
- return new XMLMessage(orgElement, xmlMessageType);
- }
-
- @Override
- protected void checkMessageData(XMLMessage expected, XMLMessage actual) throws Exception {
- OMElement element = actual.getPayload();
- OMElement orgElement = expected.getPayload();
- assertEquals(orgElement.getQName(), element.getQName());
- assertEquals(data.getText(), element.getText());
- }
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.axis2.transport.testkit.tests.async;
+
+import javax.xml.namespace.QName;
+
+import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMFactory;
+import org.apache.axis2.transport.testkit.MessageTestData;
+import org.apache.axis2.transport.testkit.channel.AsyncChannel;
+import org.apache.axis2.transport.testkit.client.AsyncTestClient;
+import org.apache.axis2.transport.testkit.endpoint.AsyncEndpoint;
+import org.apache.axis2.transport.testkit.message.XMLMessage;
+import org.apache.axis2.transport.testkit.name.Key;
+import org.apache.axis2.transport.testkit.name.Name;
+import org.apache.axis2.transport.testkit.name.Named;
+
+@Name("AsyncXML")
+public class XMLAsyncMessageTestCase extends AsyncMessageTestCase<XMLMessage> {
+ private final XMLMessage.Type xmlMessageType;
+ private final MessageTestData data;
+
+ public XMLAsyncMessageTestCase(AsyncChannel channel, AsyncTestClient<XMLMessage> client, AsyncEndpoint<XMLMessage> endpoint, XMLMessage.Type xmlMessageType, MessageTestData data, Object... resources) {
+ super(channel, client, endpoint, xmlMessageType.getContentType(), data.getCharset(), resources);
+ this.xmlMessageType = xmlMessageType;
+ this.data = data;
+ }
+
+ @Key("messageType")
+ public XMLMessage.Type getXmlMessageType() {
+ return xmlMessageType;
+ }
+
+ @Named
+ public MessageTestData getData() {
+ return data;
+ }
+
+ @Override
+ protected XMLMessage prepareMessage() throws Exception {
+ OMFactory factory = OMAbstractFactory.getOMFactory();
+ OMElement orgElement = factory.createOMElement(new QName("root"));
+ orgElement.setText(data.getText());
+ return new XMLMessage(orgElement, xmlMessageType);
+ }
+
+ @Override
+ protected void checkMessageData(XMLMessage expected, XMLMessage actual) throws Exception {
+ OMElement element = actual.getPayload();
+ OMElement orgElement = expected.getPayload();
+ assertEquals(orgElement.getQName(), element.getQName());
+ assertEquals(data.getText(), element.getText());
+ }
}
\ No newline at end of file
Propchange: webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/tests/async/XMLAsyncMessageTestCase.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/tests/echo/InterruptingEndpointErrorListener.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/tests/echo/RequestResponseMessageTestCase.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/tests/echo/RequestResponseMessageTestCase.java?rev=710158&r1=710157&r2=710158&view=diff
==============================================================================
--- webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/tests/echo/RequestResponseMessageTestCase.java (original)
+++ webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/tests/echo/RequestResponseMessageTestCase.java Mon Nov 3 13:07:13 2008
@@ -1,64 +1,64 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.axis2.transport.testkit.tests.echo;
-
-import javax.mail.internet.ContentType;
-
-import org.apache.axis2.transport.testkit.channel.RequestResponseChannel;
-import org.apache.axis2.transport.testkit.client.RequestResponseTestClient;
-import org.apache.axis2.transport.testkit.endpoint.InOutEndpoint;
-import org.apache.axis2.transport.testkit.tests.MessageTestCase;
-
-public abstract class RequestResponseMessageTestCase<M,N> extends MessageTestCase {
- private final RequestResponseTestClient<M,N> client;
- private final InOutEndpoint endpoint;
-
- // TODO: maybe we don't need an explicit RequestResponseChannel
- public RequestResponseMessageTestCase(RequestResponseChannel channel, RequestResponseTestClient<M,N> client, InOutEndpoint endpoint, ContentType contentType, String charset, Object... resources) {
- super(client, contentType, charset, resources);
- this.client = client;
- this.endpoint = endpoint;
- addResource(channel);
- addResource(endpoint);
- }
-
- @Override
- protected void doRunTest() throws Throwable {
- M request = prepareRequest();
- InterruptingEndpointErrorListener listener = new InterruptingEndpointErrorListener(Thread.currentThread());
- N response;
- endpoint.addEndpointErrorListener(listener);
- try {
- response = client.sendMessage(options, contentType, request).getData();
- } catch (Throwable ex) {
- if (listener.getException() != null) {
- throw listener.getException();
- } else {
- throw ex;
- }
- } finally {
- endpoint.removeEndpointErrorListener(listener);
- }
- checkResponse(request, response);
- }
-
- protected abstract M prepareRequest() throws Exception;
- protected abstract void checkResponse(M request, N response) throws Exception;
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.axis2.transport.testkit.tests.echo;
+
+import javax.mail.internet.ContentType;
+
+import org.apache.axis2.transport.testkit.channel.RequestResponseChannel;
+import org.apache.axis2.transport.testkit.client.RequestResponseTestClient;
+import org.apache.axis2.transport.testkit.endpoint.InOutEndpoint;
+import org.apache.axis2.transport.testkit.tests.MessageTestCase;
+
+public abstract class RequestResponseMessageTestCase<M,N> extends MessageTestCase {
+ private final RequestResponseTestClient<M,N> client;
+ private final InOutEndpoint endpoint;
+
+ // TODO: maybe we don't need an explicit RequestResponseChannel
+ public RequestResponseMessageTestCase(RequestResponseChannel channel, RequestResponseTestClient<M,N> client, InOutEndpoint endpoint, ContentType contentType, String charset, Object... resources) {
+ super(client, contentType, charset, resources);
+ this.client = client;
+ this.endpoint = endpoint;
+ addResource(channel);
+ addResource(endpoint);
+ }
+
+ @Override
+ protected void doRunTest() throws Throwable {
+ M request = prepareRequest();
+ InterruptingEndpointErrorListener listener = new InterruptingEndpointErrorListener(Thread.currentThread());
+ N response;
+ endpoint.addEndpointErrorListener(listener);
+ try {
+ response = client.sendMessage(options, contentType, request).getData();
+ } catch (Throwable ex) {
+ if (listener.getException() != null) {
+ throw listener.getException();
+ } else {
+ throw ex;
+ }
+ } finally {
+ endpoint.removeEndpointErrorListener(listener);
+ }
+ checkResponse(request, response);
+ }
+
+ protected abstract M prepareRequest() throws Exception;
+ protected abstract void checkResponse(M request, N response) throws Exception;
+}
Propchange: webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/tests/echo/RequestResponseMessageTestCase.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/tests/echo/XMLRequestResponseMessageTestCase.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/tests/echo/XMLRequestResponseMessageTestCase.java?rev=710158&r1=710157&r2=710158&view=diff
==============================================================================
--- webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/tests/echo/XMLRequestResponseMessageTestCase.java (original)
+++ webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/tests/echo/XMLRequestResponseMessageTestCase.java Mon Nov 3 13:07:13 2008
@@ -1,72 +1,72 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.axis2.transport.testkit.tests.echo;
-
-import javax.xml.namespace.QName;
-
-import org.apache.axiom.om.OMAbstractFactory;
-import org.apache.axiom.om.OMElement;
-import org.apache.axiom.om.OMFactory;
-import org.apache.axis2.transport.testkit.MessageTestData;
-import org.apache.axis2.transport.testkit.channel.RequestResponseChannel;
-import org.apache.axis2.transport.testkit.client.RequestResponseTestClient;
-import org.apache.axis2.transport.testkit.endpoint.InOutEndpoint;
-import org.apache.axis2.transport.testkit.message.XMLMessage;
-import org.apache.axis2.transport.testkit.name.Key;
-import org.apache.axis2.transport.testkit.name.Name;
-import org.apache.axis2.transport.testkit.name.Named;
-
-@Name("EchoXML")
-public class XMLRequestResponseMessageTestCase extends RequestResponseMessageTestCase<XMLMessage,XMLMessage> {
- private final XMLMessage.Type xmlMessageType;
- private final MessageTestData data;
-
- public XMLRequestResponseMessageTestCase(RequestResponseChannel channel, RequestResponseTestClient<XMLMessage,XMLMessage> client, InOutEndpoint endpoint, XMLMessage.Type xmlMessageType, MessageTestData data, Object... resources) {
- super(channel, client, endpoint, xmlMessageType.getContentType(), data.getCharset(), resources);
- this.xmlMessageType = xmlMessageType;
- this.data = data;
- }
-
- @Key("messageType")
- public XMLMessage.Type getXmlMessageType() {
- return xmlMessageType;
- }
-
- @Named
- public MessageTestData getData() {
- return data;
- }
-
- @Override
- protected XMLMessage prepareRequest() throws Exception {
- OMFactory factory = OMAbstractFactory.getOMFactory();
- OMElement orgElement = factory.createOMElement(new QName("root"));
- orgElement.setText(data.getText());
- return new XMLMessage(orgElement, xmlMessageType);
- }
-
- @Override
- protected void checkResponse(XMLMessage request, XMLMessage response) throws Exception {
- OMElement orgElement = request.getPayload();
- OMElement element = response.getPayload();
- assertEquals(orgElement.getQName(), element.getQName());
- assertEquals(orgElement.getText(), element.getText());
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.axis2.transport.testkit.tests.echo;
+
+import javax.xml.namespace.QName;
+
+import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.om.OMElement;
+import org.apache.axiom.om.OMFactory;
+import org.apache.axis2.transport.testkit.MessageTestData;
+import org.apache.axis2.transport.testkit.channel.RequestResponseChannel;
+import org.apache.axis2.transport.testkit.client.RequestResponseTestClient;
+import org.apache.axis2.transport.testkit.endpoint.InOutEndpoint;
+import org.apache.axis2.transport.testkit.message.XMLMessage;
+import org.apache.axis2.transport.testkit.name.Key;
+import org.apache.axis2.transport.testkit.name.Name;
+import org.apache.axis2.transport.testkit.name.Named;
+
+@Name("EchoXML")
+public class XMLRequestResponseMessageTestCase extends RequestResponseMessageTestCase<XMLMessage,XMLMessage> {
+ private final XMLMessage.Type xmlMessageType;
+ private final MessageTestData data;
+
+ public XMLRequestResponseMessageTestCase(RequestResponseChannel channel, RequestResponseTestClient<XMLMessage,XMLMessage> client, InOutEndpoint endpoint, XMLMessage.Type xmlMessageType, MessageTestData data, Object... resources) {
+ super(channel, client, endpoint, xmlMessageType.getContentType(), data.getCharset(), resources);
+ this.xmlMessageType = xmlMessageType;
+ this.data = data;
+ }
+
+ @Key("messageType")
+ public XMLMessage.Type getXmlMessageType() {
+ return xmlMessageType;
+ }
+
+ @Named
+ public MessageTestData getData() {
+ return data;
+ }
+
+ @Override
+ protected XMLMessage prepareRequest() throws Exception {
+ OMFactory factory = OMAbstractFactory.getOMFactory();
+ OMElement orgElement = factory.createOMElement(new QName("root"));
+ orgElement.setText(data.getText());
+ return new XMLMessage(orgElement, xmlMessageType);
+ }
+
+ @Override
+ protected void checkResponse(XMLMessage request, XMLMessage response) throws Exception {
+ OMElement orgElement = request.getPayload();
+ OMElement element = response.getPayload();
+ assertEquals(orgElement.getQName(), element.getQName());
+ assertEquals(orgElement.getText(), element.getText());
+ }
+}
Propchange: webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/tests/echo/XMLRequestResponseMessageTestCase.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/tests/misc/MinConcurrencyTest.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/tests/misc/MinConcurrencyTest.java?rev=710158&r1=710157&r2=710158&view=diff
==============================================================================
--- webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/tests/misc/MinConcurrencyTest.java (original)
+++ webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/tests/misc/MinConcurrencyTest.java Mon Nov 3 13:07:13 2008
@@ -1,156 +1,156 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.axis2.transport.testkit.tests.misc;
-
-import java.util.concurrent.CountDownLatch;
-import java.util.concurrent.TimeUnit;
-
-import javax.mail.internet.ContentType;
-import javax.xml.namespace.QName;
-
-import org.apache.axiom.om.OMAbstractFactory;
-import org.apache.axiom.soap.SOAP11Constants;
-import org.apache.axiom.soap.SOAPEnvelope;
-import org.apache.axiom.soap.SOAPFactory;
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.context.MessageContext;
-import org.apache.axis2.description.AxisOperation;
-import org.apache.axis2.description.InOnlyAxisOperation;
-import org.apache.axis2.engine.MessageReceiver;
-import org.apache.axis2.transport.testkit.axis2.client.AxisAsyncTestClient;
-import org.apache.axis2.transport.testkit.axis2.client.AxisTestClientContext;
-import org.apache.axis2.transport.testkit.axis2.endpoint.AxisTestEndpoint;
-import org.apache.axis2.transport.testkit.axis2.endpoint.AxisTestEndpointContext;
-import org.apache.axis2.transport.testkit.channel.AsyncChannel;
-import org.apache.axis2.transport.testkit.client.ClientOptions;
-import org.apache.axis2.transport.testkit.message.AxisMessage;
-import org.apache.axis2.transport.testkit.name.Name;
-import org.apache.axis2.transport.testkit.tests.TestResourceSet;
-import org.apache.axis2.transport.testkit.tests.ManagedTestCase;
-
-/**
- * Generic test case to check whether a transport listener processes messages with the expected
- * level of concurrency. This test case is used to verify that the listener is able to
- * process messages simultaneously.
- * <p>
- * The test case deploys a given number of services and sends a configurable number of messages
- * to each of these services. The services are configured with a custom message receiver that
- * blocks until the expected level of concurrency (given by the number of endpoints times the
- * number of messages) is reached. If after some timeout the concurrency level is not reached,
- * the test fails.
- */
-@Name("MinConcurrency")
-public class MinConcurrencyTest extends ManagedTestCase {
- private final AsyncChannel[] channels;
- private final int messages;
- private final boolean preloadMessages;
-
- public MinConcurrencyTest(AsyncChannel[] channels, int messages,
- boolean preloadMessages, Object... resources) {
- super(resources);
- addResource(AxisTestClientContext.INSTANCE);
- addResource(AxisTestEndpointContext.INSTANCE);
- this.channels = channels;
- this.messages = messages;
- this.preloadMessages = preloadMessages;
- }
-
- @Override
- protected void runTest() throws Throwable {
- int endpointCount = channels.length;
- int expectedConcurrency = endpointCount * messages;
-
- final CountDownLatch shutdownLatch = new CountDownLatch(1);
- final CountDownLatch concurrencyReachedLatch = new CountDownLatch(expectedConcurrency);
-
- final MessageReceiver messageReceiver = new MessageReceiver() {
- public void receive(MessageContext msgContext) throws AxisFault {
- concurrencyReachedLatch.countDown();
- try {
- shutdownLatch.await();
- } catch (InterruptedException ex) {
- }
- }
- };
-
- TestResourceSet[] clientResourceSets = new TestResourceSet[endpointCount];
- TestResourceSet[] endpointResourceSets = new TestResourceSet[endpointCount];
- try {
- for (int i=0; i<endpointCount; i++) {
- TestResourceSet clientResourceSet = new TestResourceSet(getResourceSet());
- AsyncChannel channel = channels[i];
- clientResourceSet.addResource(channel);
- AxisAsyncTestClient client = new AxisAsyncTestClient(false);
- clientResourceSet.addResource(client);
- clientResourceSet.setUp();
- clientResourceSets[i] = clientResourceSet;
-
- TestResourceSet endpointResourceSet = new TestResourceSet(clientResourceSet);
- endpointResourceSet.addResource(new AxisTestEndpoint() {
- @Override
- protected AxisOperation createOperation() {
- AxisOperation operation = new InOnlyAxisOperation(new QName("in"));
- operation.setMessageReceiver(messageReceiver);
- return operation;
- }
-
- @Override
- protected void onTransportError(Throwable ex) {
- // TODO Auto-generated method stub
- }
- });
-
- if (!preloadMessages) {
- endpointResourceSet.setUp();
- endpointResourceSets[i] = endpointResourceSet;
- }
- for (int j=0; j<messages; j++) {
- ClientOptions options = new ClientOptions(client, new ContentType(SOAP11Constants.SOAP_11_CONTENT_TYPE), "UTF-8");
- AxisMessage message = new AxisMessage();
- message.setMessageType(SOAP11Constants.SOAP_11_CONTENT_TYPE);
- SOAPFactory factory = OMAbstractFactory.getSOAP11Factory();
- SOAPEnvelope envelope = factory.getDefaultEnvelope();
- message.setEnvelope(envelope);
- client.sendMessage(options, new ContentType(message.getMessageType()), message);
- }
- if (preloadMessages) {
- endpointResourceSet.setUp();
- endpointResourceSets[i] = endpointResourceSet;
- }
- }
-
- if (!concurrencyReachedLatch.await(5, TimeUnit.SECONDS)) {
- fail("Concurrency reached is " + (expectedConcurrency -
- concurrencyReachedLatch.getCount()) + ", but expected " +
- expectedConcurrency);
- }
- } finally {
- shutdownLatch.countDown();
- for (int i=0; i<endpointCount; i++) {
- if (endpointResourceSets[i] != null) {
- endpointResourceSets[i].tearDown();
- }
- if (clientResourceSets[i] != null) {
- clientResourceSets[i].tearDown();
- }
- }
- }
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.axis2.transport.testkit.tests.misc;
+
+import java.util.concurrent.CountDownLatch;
+import java.util.concurrent.TimeUnit;
+
+import javax.mail.internet.ContentType;
+import javax.xml.namespace.QName;
+
+import org.apache.axiom.om.OMAbstractFactory;
+import org.apache.axiom.soap.SOAP11Constants;
+import org.apache.axiom.soap.SOAPEnvelope;
+import org.apache.axiom.soap.SOAPFactory;
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.description.AxisOperation;
+import org.apache.axis2.description.InOnlyAxisOperation;
+import org.apache.axis2.engine.MessageReceiver;
+import org.apache.axis2.transport.testkit.axis2.client.AxisAsyncTestClient;
+import org.apache.axis2.transport.testkit.axis2.client.AxisTestClientContext;
+import org.apache.axis2.transport.testkit.axis2.endpoint.AxisTestEndpoint;
+import org.apache.axis2.transport.testkit.axis2.endpoint.AxisTestEndpointContext;
+import org.apache.axis2.transport.testkit.channel.AsyncChannel;
+import org.apache.axis2.transport.testkit.client.ClientOptions;
+import org.apache.axis2.transport.testkit.message.AxisMessage;
+import org.apache.axis2.transport.testkit.name.Name;
+import org.apache.axis2.transport.testkit.tests.TestResourceSet;
+import org.apache.axis2.transport.testkit.tests.ManagedTestCase;
+
+/**
+ * Generic test case to check whether a transport listener processes messages with the expected
+ * level of concurrency. This test case is used to verify that the listener is able to
+ * process messages simultaneously.
+ * <p>
+ * The test case deploys a given number of services and sends a configurable number of messages
+ * to each of these services. The services are configured with a custom message receiver that
+ * blocks until the expected level of concurrency (given by the number of endpoints times the
+ * number of messages) is reached. If after some timeout the concurrency level is not reached,
+ * the test fails.
+ */
+@Name("MinConcurrency")
+public class MinConcurrencyTest extends ManagedTestCase {
+ private final AsyncChannel[] channels;
+ private final int messages;
+ private final boolean preloadMessages;
+
+ public MinConcurrencyTest(AsyncChannel[] channels, int messages,
+ boolean preloadMessages, Object... resources) {
+ super(resources);
+ addResource(AxisTestClientContext.INSTANCE);
+ addResource(AxisTestEndpointContext.INSTANCE);
+ this.channels = channels;
+ this.messages = messages;
+ this.preloadMessages = preloadMessages;
+ }
+
+ @Override
+ protected void runTest() throws Throwable {
+ int endpointCount = channels.length;
+ int expectedConcurrency = endpointCount * messages;
+
+ final CountDownLatch shutdownLatch = new CountDownLatch(1);
+ final CountDownLatch concurrencyReachedLatch = new CountDownLatch(expectedConcurrency);
+
+ final MessageReceiver messageReceiver = new MessageReceiver() {
+ public void receive(MessageContext msgContext) throws AxisFault {
+ concurrencyReachedLatch.countDown();
+ try {
+ shutdownLatch.await();
+ } catch (InterruptedException ex) {
+ }
+ }
+ };
+
+ TestResourceSet[] clientResourceSets = new TestResourceSet[endpointCount];
+ TestResourceSet[] endpointResourceSets = new TestResourceSet[endpointCount];
+ try {
+ for (int i=0; i<endpointCount; i++) {
+ TestResourceSet clientResourceSet = new TestResourceSet(getResourceSet());
+ AsyncChannel channel = channels[i];
+ clientResourceSet.addResource(channel);
+ AxisAsyncTestClient client = new AxisAsyncTestClient(false);
+ clientResourceSet.addResource(client);
+ clientResourceSet.setUp();
+ clientResourceSets[i] = clientResourceSet;
+
+ TestResourceSet endpointResourceSet = new TestResourceSet(clientResourceSet);
+ endpointResourceSet.addResource(new AxisTestEndpoint() {
+ @Override
+ protected AxisOperation createOperation() {
+ AxisOperation operation = new InOnlyAxisOperation(new QName("in"));
+ operation.setMessageReceiver(messageReceiver);
+ return operation;
+ }
+
+ @Override
+ protected void onTransportError(Throwable ex) {
+ // TODO Auto-generated method stub
+ }
+ });
+
+ if (!preloadMessages) {
+ endpointResourceSet.setUp();
+ endpointResourceSets[i] = endpointResourceSet;
+ }
+ for (int j=0; j<messages; j++) {
+ ClientOptions options = new ClientOptions(client, new ContentType(SOAP11Constants.SOAP_11_CONTENT_TYPE), "UTF-8");
+ AxisMessage message = new AxisMessage();
+ message.setMessageType(SOAP11Constants.SOAP_11_CONTENT_TYPE);
+ SOAPFactory factory = OMAbstractFactory.getSOAP11Factory();
+ SOAPEnvelope envelope = factory.getDefaultEnvelope();
+ message.setEnvelope(envelope);
+ client.sendMessage(options, new ContentType(message.getMessageType()), message);
+ }
+ if (preloadMessages) {
+ endpointResourceSet.setUp();
+ endpointResourceSets[i] = endpointResourceSet;
+ }
+ }
+
+ if (!concurrencyReachedLatch.await(5, TimeUnit.SECONDS)) {
+ fail("Concurrency reached is " + (expectedConcurrency -
+ concurrencyReachedLatch.getCount()) + ", but expected " +
+ expectedConcurrency);
+ }
+ } finally {
+ shutdownLatch.countDown();
+ for (int i=0; i<endpointCount; i++) {
+ if (endpointResourceSets[i] != null) {
+ endpointResourceSets[i].tearDown();
+ }
+ if (clientResourceSets[i] != null) {
+ clientResourceSets[i].tearDown();
+ }
+ }
+ }
+ }
+}
Propchange: webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/tests/misc/MinConcurrencyTest.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/util/ContentTypeUtil.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/util/LifecycleFixTransportListenerProxy.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/util/LifecycleFixTransportListenerProxy.java?rev=710158&r1=710157&r2=710158&view=diff
==============================================================================
--- webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/util/LifecycleFixTransportListenerProxy.java (original)
+++ webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/util/LifecycleFixTransportListenerProxy.java Mon Nov 3 13:07:13 2008
@@ -1,75 +1,75 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.axis2.transport.testkit.util;
-
-import org.apache.axis2.AxisFault;
-import org.apache.axis2.addressing.EndpointReference;
-import org.apache.axis2.context.ConfigurationContext;
-import org.apache.axis2.context.MessageContext;
-import org.apache.axis2.context.SessionContext;
-import org.apache.axis2.description.TransportInDescription;
-import org.apache.axis2.transport.TransportListener;
-
-public class LifecycleFixTransportListenerProxy implements TransportListener {
- private final TransportListener target;
- private final int port;
-
- public LifecycleFixTransportListenerProxy(TransportListener target, int port) {
- this.target = target;
- this.port = port;
- }
-
- public void destroy() {
- target.destroy();
- }
-
- @SuppressWarnings("deprecation")
- public EndpointReference getEPRForService(String arg0, String arg1)
- throws AxisFault {
- return target.getEPRForService(arg0, arg1);
- }
-
- public EndpointReference[] getEPRsForService(String arg0, String arg1)
- throws AxisFault {
- return target.getEPRsForService(arg0, arg1);
- }
-
- public SessionContext getSessionContext(MessageContext arg0) {
- return target.getSessionContext(arg0);
- }
-
- public void init(ConfigurationContext arg0, TransportInDescription arg1)
- throws AxisFault {
- target.init(arg0, arg1);
- }
-
- public void start() throws AxisFault {
- target.start();
- try {
- ServerUtil.waitForServer(port);
- } catch (Exception ex) {
- throw new AxisFault("Unable to start server", ex);
- }
- }
-
- public void stop() throws AxisFault {
- target.stop();
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.axis2.transport.testkit.util;
+
+import org.apache.axis2.AxisFault;
+import org.apache.axis2.addressing.EndpointReference;
+import org.apache.axis2.context.ConfigurationContext;
+import org.apache.axis2.context.MessageContext;
+import org.apache.axis2.context.SessionContext;
+import org.apache.axis2.description.TransportInDescription;
+import org.apache.axis2.transport.TransportListener;
+
+public class LifecycleFixTransportListenerProxy implements TransportListener {
+ private final TransportListener target;
+ private final int port;
+
+ public LifecycleFixTransportListenerProxy(TransportListener target, int port) {
+ this.target = target;
+ this.port = port;
+ }
+
+ public void destroy() {
+ target.destroy();
+ }
+
+ @SuppressWarnings("deprecation")
+ public EndpointReference getEPRForService(String arg0, String arg1)
+ throws AxisFault {
+ return target.getEPRForService(arg0, arg1);
+ }
+
+ public EndpointReference[] getEPRsForService(String arg0, String arg1)
+ throws AxisFault {
+ return target.getEPRsForService(arg0, arg1);
+ }
+
+ public SessionContext getSessionContext(MessageContext arg0) {
+ return target.getSessionContext(arg0);
+ }
+
+ public void init(ConfigurationContext arg0, TransportInDescription arg1)
+ throws AxisFault {
+ target.init(arg0, arg1);
+ }
+
+ public void start() throws AxisFault {
+ target.start();
+ try {
+ ServerUtil.waitForServer(port);
+ } catch (Exception ex) {
+ throw new AxisFault("Unable to start server", ex);
+ }
+ }
+
+ public void stop() throws AxisFault {
+ target.stop();
+ }
+}
Propchange: webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/util/LifecycleFixTransportListenerProxy.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/util/LogManager.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/util/LogManager.java?rev=710158&r1=710157&r2=710158&view=diff
==============================================================================
--- webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/util/LogManager.java (original)
+++ webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/util/LogManager.java Mon Nov 3 13:07:13 2008
@@ -1,79 +1,79 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.axis2.transport.testkit.util;
-
-import java.io.File;
-import java.io.FileOutputStream;
-import java.io.IOException;
-import java.io.OutputStream;
-import java.util.LinkedList;
-import java.util.List;
-
-import org.apache.axis2.transport.testkit.tests.ManagedTestCase;
-import org.apache.commons.io.IOUtils;
-import org.apache.commons.lang.StringUtils;
-import org.apache.log4j.Logger;
-import org.apache.log4j.TTCCLayout;
-import org.apache.log4j.WriterAppender;
-
-public class LogManager {
- public static final LogManager INSTANCE = new LogManager();
-
- private final File logDir;
- private File testCaseDir;
- private WriterAppender appender;
- private int sequence;
- private List<OutputStream> logs;
-
- private LogManager() {
- logDir = new File("target" + File.separator + "testkit-logs");
- }
-
- public void setTestCase(ManagedTestCase testCase) throws IOException {
- if (appender != null) {
- Logger.getRootLogger().removeAppender(appender);
- appender.close();
- appender = null;
- }
- if (logs != null) {
- for (OutputStream log : logs) {
- IOUtils.closeQuietly(log);
- }
- logs = null;
- }
- if (testCase == null) {
- testCaseDir = null;
- } else {
- File testSuiteDir = new File(logDir, testCase.getTestClass().getName());
- testCaseDir = new File(testSuiteDir, testCase.getId());
- logs = new LinkedList<OutputStream>();
- sequence = 1;
- appender = new WriterAppender(new TTCCLayout(), createLog("debug"));
- Logger.getRootLogger().addAppender(appender);
- }
- }
-
- public synchronized OutputStream createLog(String name) throws IOException {
- testCaseDir.mkdirs();
- OutputStream log = new FileOutputStream(new File(testCaseDir, StringUtils.leftPad(String.valueOf(sequence++), 2, '0') + "-" + name + ".log"));
- logs.add(log);
- return log;
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.axis2.transport.testkit.util;
+
+import java.io.File;
+import java.io.FileOutputStream;
+import java.io.IOException;
+import java.io.OutputStream;
+import java.util.LinkedList;
+import java.util.List;
+
+import org.apache.axis2.transport.testkit.tests.ManagedTestCase;
+import org.apache.commons.io.IOUtils;
+import org.apache.commons.lang.StringUtils;
+import org.apache.log4j.Logger;
+import org.apache.log4j.TTCCLayout;
+import org.apache.log4j.WriterAppender;
+
+public class LogManager {
+ public static final LogManager INSTANCE = new LogManager();
+
+ private final File logDir;
+ private File testCaseDir;
+ private WriterAppender appender;
+ private int sequence;
+ private List<OutputStream> logs;
+
+ private LogManager() {
+ logDir = new File("target" + File.separator + "testkit-logs");
+ }
+
+ public void setTestCase(ManagedTestCase testCase) throws IOException {
+ if (appender != null) {
+ Logger.getRootLogger().removeAppender(appender);
+ appender.close();
+ appender = null;
+ }
+ if (logs != null) {
+ for (OutputStream log : logs) {
+ IOUtils.closeQuietly(log);
+ }
+ logs = null;
+ }
+ if (testCase == null) {
+ testCaseDir = null;
+ } else {
+ File testSuiteDir = new File(logDir, testCase.getTestClass().getName());
+ testCaseDir = new File(testSuiteDir, testCase.getId());
+ logs = new LinkedList<OutputStream>();
+ sequence = 1;
+ appender = new WriterAppender(new TTCCLayout(), createLog("debug"));
+ Logger.getRootLogger().addAppender(appender);
+ }
+ }
+
+ public synchronized OutputStream createLog(String name) throws IOException {
+ testCaseDir.mkdirs();
+ OutputStream log = new FileOutputStream(new File(testCaseDir, StringUtils.leftPad(String.valueOf(sequence++), 2, '0') + "-" + name + ".log"));
+ logs.add(log);
+ return log;
+ }
+}
Propchange: webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/util/LogManager.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/util/ServerUtil.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/util/tcpmon/Acceptor.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/util/tcpmon/Acceptor.java?rev=710158&r1=710157&r2=710158&view=diff
==============================================================================
--- webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/util/tcpmon/Acceptor.java (original)
+++ webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/util/tcpmon/Acceptor.java Mon Nov 3 13:07:13 2008
@@ -1,62 +1,62 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.axis2.transport.testkit.util.tcpmon;
-
-import java.io.IOException;
-import java.net.InetSocketAddress;
-import java.net.ServerSocket;
-import java.net.Socket;
-import java.util.concurrent.ExecutorService;
-
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-public class Acceptor implements Runnable {
- private static final Log log = LogFactory.getLog(Acceptor.class);
-
- private final ServerSocket serverSocket;
- private final ExecutorService executorService;
- private final InetSocketAddress target;
-
- public Acceptor(ServerSocket serverSocket, ExecutorService executorService, InetSocketAddress target) {
- this.serverSocket = serverSocket;
- this.executorService = executorService;
- this.target = target;
- }
-
- public void run() {
- while (true) {
- Socket socket;
- try {
- socket = serverSocket.accept();
- } catch (IOException ex) {
- break;
- }
- try {
- Socket targetSocket = new Socket(target.getAddress(), target.getPort());
- executorService.execute(new Relay("SENT", socket, targetSocket));
- executorService.execute(new Relay("RECEIVED", targetSocket, socket));
- } catch (IOException ex) {
- log.error(ex);
- }
- }
- }
-
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.axis2.transport.testkit.util.tcpmon;
+
+import java.io.IOException;
+import java.net.InetSocketAddress;
+import java.net.ServerSocket;
+import java.net.Socket;
+import java.util.concurrent.ExecutorService;
+
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+public class Acceptor implements Runnable {
+ private static final Log log = LogFactory.getLog(Acceptor.class);
+
+ private final ServerSocket serverSocket;
+ private final ExecutorService executorService;
+ private final InetSocketAddress target;
+
+ public Acceptor(ServerSocket serverSocket, ExecutorService executorService, InetSocketAddress target) {
+ this.serverSocket = serverSocket;
+ this.executorService = executorService;
+ this.target = target;
+ }
+
+ public void run() {
+ while (true) {
+ Socket socket;
+ try {
+ socket = serverSocket.accept();
+ } catch (IOException ex) {
+ break;
+ }
+ try {
+ Socket targetSocket = new Socket(target.getAddress(), target.getPort());
+ executorService.execute(new Relay("SENT", socket, targetSocket));
+ executorService.execute(new Relay("RECEIVED", targetSocket, socket));
+ } catch (IOException ex) {
+ log.error(ex);
+ }
+ }
+ }
+
+}
Propchange: webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/util/tcpmon/Acceptor.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/util/tcpmon/Relay.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/util/tcpmon/Relay.java?rev=710158&r1=710157&r2=710158&view=diff
==============================================================================
--- webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/util/tcpmon/Relay.java (original)
+++ webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/util/tcpmon/Relay.java Mon Nov 3 13:07:13 2008
@@ -1,68 +1,68 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.axis2.transport.testkit.util.tcpmon;
-
-import java.io.IOException;
-import java.io.InputStream;
-import java.io.OutputStream;
-import java.net.Socket;
-
-import org.apache.axis2.transport.base.datagram.Utils;
-import org.apache.commons.io.IOUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-
-public class Relay implements Runnable {
- private static final Log log = LogFactory.getLog(Relay.class);
-
- private final String tag;
- private final Socket inSocket;
- private final InputStream in;
- private final OutputStream out;
-
- public Relay(String tag, Socket inSocket, Socket outSocket) throws IOException {
- this.tag = tag;
- this.inSocket = inSocket;
- this.in = inSocket.getInputStream();
- this.out = outSocket.getOutputStream();
- }
-
- public void run() {
- byte buf[] = new byte[4096];
- try {
- int n;
- while ((n = in.read(buf)) > 0) {
- StringBuilder dump = new StringBuilder(tag);
- dump.append('\n');
- Utils.hexDump(dump, buf, n);
- log.debug(dump);
- out.write(buf, 0, n);
- out.flush();
- }
- } catch (IOException ex) {
- if (!inSocket.isClosed()) {
- log.error(ex);
- }
- } finally {
- IOUtils.closeQuietly(in);
- IOUtils.closeQuietly(out);
- }
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.axis2.transport.testkit.util.tcpmon;
+
+import java.io.IOException;
+import java.io.InputStream;
+import java.io.OutputStream;
+import java.net.Socket;
+
+import org.apache.axis2.transport.base.datagram.Utils;
+import org.apache.commons.io.IOUtils;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+public class Relay implements Runnable {
+ private static final Log log = LogFactory.getLog(Relay.class);
+
+ private final String tag;
+ private final Socket inSocket;
+ private final InputStream in;
+ private final OutputStream out;
+
+ public Relay(String tag, Socket inSocket, Socket outSocket) throws IOException {
+ this.tag = tag;
+ this.inSocket = inSocket;
+ this.in = inSocket.getInputStream();
+ this.out = outSocket.getOutputStream();
+ }
+
+ public void run() {
+ byte buf[] = new byte[4096];
+ try {
+ int n;
+ while ((n = in.read(buf)) > 0) {
+ StringBuilder dump = new StringBuilder(tag);
+ dump.append('\n');
+ Utils.hexDump(dump, buf, n);
+ log.debug(dump);
+ out.write(buf, 0, n);
+ out.flush();
+ }
+ } catch (IOException ex) {
+ if (!inSocket.isClosed()) {
+ log.error(ex);
+ }
+ } finally {
+ IOUtils.closeQuietly(in);
+ IOUtils.closeQuietly(out);
+ }
+ }
+}
Propchange: webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/util/tcpmon/Relay.java
------------------------------------------------------------------------------
svn:eol-style = native
Modified: webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/util/tcpmon/Tunnel.java
URL: http://svn.apache.org/viewvc/webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/util/tcpmon/Tunnel.java?rev=710158&r1=710157&r2=710158&view=diff
==============================================================================
--- webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/util/tcpmon/Tunnel.java (original)
+++ webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/util/tcpmon/Tunnel.java Mon Nov 3 13:07:13 2008
@@ -1,51 +1,51 @@
-/*
- * Licensed to the Apache Software Foundation (ASF) under one
- * or more contributor license agreements. See the NOTICE file
- * distributed with this work for additional information
- * regarding copyright ownership. The ASF licenses this file
- * to you under the Apache License, Version 2.0 (the
- * "License"); you may not use this file except in compliance
- * with the License. You may obtain a copy of the License at
- *
- * http://www.apache.org/licenses/LICENSE-2.0
- *
- * Unless required by applicable law or agreed to in writing,
- * software distributed under the License is distributed on an
- * * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
- * KIND, either express or implied. See the License for the
- * specific language governing permissions and limitations
- * under the License.
- */
-
-package org.apache.axis2.transport.testkit.util.tcpmon;
-
-import java.io.IOException;
-import java.net.InetSocketAddress;
-import java.net.ServerSocket;
-import java.util.concurrent.ExecutorService;
-import java.util.concurrent.Executors;
-
-public class Tunnel {
- private final ServerSocket serverSocket;
- private final InetSocketAddress target;
- private ExecutorService executorService;
-
- public Tunnel(InetSocketAddress target) throws IOException {
- serverSocket = new ServerSocket(0);
- this.target = target;
- }
-
- public int getPort() {
- return serverSocket.getLocalPort();
- }
-
- public void start() {
- executorService = Executors.newCachedThreadPool();
- executorService.execute(new Acceptor(serverSocket, executorService, target));
- }
-
- public void stop() throws IOException {
- serverSocket.close();
- executorService.shutdown();
- }
-}
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one
+ * or more contributor license agreements. See the NOTICE file
+ * distributed with this work for additional information
+ * regarding copyright ownership. The ASF licenses this file
+ * to you under the Apache License, Version 2.0 (the
+ * "License"); you may not use this file except in compliance
+ * with the License. You may obtain a copy of the License at
+ *
+ * http://www.apache.org/licenses/LICENSE-2.0
+ *
+ * Unless required by applicable law or agreed to in writing,
+ * software distributed under the License is distributed on an
+ * * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
+ * KIND, either express or implied. See the License for the
+ * specific language governing permissions and limitations
+ * under the License.
+ */
+
+package org.apache.axis2.transport.testkit.util.tcpmon;
+
+import java.io.IOException;
+import java.net.InetSocketAddress;
+import java.net.ServerSocket;
+import java.util.concurrent.ExecutorService;
+import java.util.concurrent.Executors;
+
+public class Tunnel {
+ private final ServerSocket serverSocket;
+ private final InetSocketAddress target;
+ private ExecutorService executorService;
+
+ public Tunnel(InetSocketAddress target) throws IOException {
+ serverSocket = new ServerSocket(0);
+ this.target = target;
+ }
+
+ public int getPort() {
+ return serverSocket.getLocalPort();
+ }
+
+ public void start() {
+ executorService = Executors.newCachedThreadPool();
+ executorService.execute(new Acceptor(serverSocket, executorService, target));
+ }
+
+ public void stop() throws IOException {
+ serverSocket.close();
+ executorService.shutdown();
+ }
+}
Propchange: webservices/commons/trunk/modules/transport/modules/testkit/src/main/java/org/apache/axis2/transport/testkit/util/tcpmon/Tunnel.java
------------------------------------------------------------------------------
svn:eol-style = native
Propchange: webservices/commons/trunk/modules/transport/modules/testkit/src/main/resources/META-INF/aop.xml
------------------------------------------------------------------------------
svn:eol-style = native