Author: elecharny
Date: Wed Aug 5 12:06:59 2009
New Revision: 801156
URL: http://svn.apache.org/viewvc?rev=801156&view=rev
Log:
Removed ^M from those files
Modified:
mina/trunk/core/src/test/java/org/apache/mina/transport/socket/nio/DatagramPortUnreachableTest.java
mina/trunk/core/src/test/java/org/apache/mina/transport/socket/nio/PollingIoProcessorTest.java
Modified:
mina/trunk/core/src/test/java/org/apache/mina/transport/socket/nio/DatagramPortUnreachableTest.java
URL:
http://svn.apache.org/viewvc/mina/trunk/core/src/test/java/org/apache/mina/transport/socket/nio/DatagramPortUnreachableTest.java?rev=801156&r1=801155&r2=801156&view=diff
==============================================================================
---
mina/trunk/core/src/test/java/org/apache/mina/transport/socket/nio/DatagramPortUnreachableTest.java
(original)
+++
mina/trunk/core/src/test/java/org/apache/mina/transport/socket/nio/DatagramPortUnreachableTest.java
Wed Aug 5 12:06:59 2009
@@ -1,90 +1,90 @@
-/*
- * 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.mina.transport.socket.nio;
-
-import java.net.InetSocketAddress;
-import java.net.PortUnreachableException;
-
-import junit.framework.TestCase;
-
-import org.apache.mina.core.buffer.IoBuffer;
-import org.apache.mina.core.future.ConnectFuture;
-import org.apache.mina.core.service.IoConnector;
-import org.apache.mina.core.service.IoHandlerAdapter;
-import org.apache.mina.core.session.IoSession;
-import org.apache.mina.transport.socket.DatagramSessionConfig;
-import org.apache.mina.util.AvailablePortFinder;
-
-/**
- * Tests {...@link DatagramSessionConfig#setCloseOnPortUnreachable(boolean)}.
- *
- * @author <a href="http://mina.apache.org">Apache MINA Project</a>
- */
-public class DatagramPortUnreachableTest extends TestCase {
-
- Object mutex = new Object();
-
- private void runTest(boolean closeOnPortUnreachable) throws Exception {
- IoConnector connector = new NioDatagramConnector();
- connector.setHandler(new IoHandlerAdapter() {
-
- @Override
- public void exceptionCaught(IoSession session, Throwable cause)
- throws Exception {
- if (cause instanceof PortUnreachableException) {
- synchronized(mutex) {
- mutex.notify();
- }
- }
- }
-
- });
- ConnectFuture future = connector.connect(new
InetSocketAddress("localhost",
- AvailablePortFinder.getNextAvailable(20000)));
- future.awaitUninterruptibly();
- IoSession session = future.getSession();
-
- DatagramSessionConfig cfg = ((DatagramSessionConfig) session
- .getConfig());
- cfg.setUseReadOperation(true);
- cfg.setCloseOnPortUnreachable(closeOnPortUnreachable);
-
- synchronized(mutex) {
-
session.write(IoBuffer.allocate(1)).awaitUninterruptibly().isWritten();
- session.read();
- mutex.wait();
- }
-
- Thread.sleep(500);
-
- assertEquals(closeOnPortUnreachable, session.isClosing());
- connector.dispose();
- }
-
- public void testPortUnreachableClosesSession() throws Exception {
- // session should be closing
- runTest(true);
- }
-
- public void testNormal() throws Exception {
- // test that session is not closed on port unreachable exception
- runTest(false);
- }
-}
\ No newline at end of file
+/*
+ * 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.mina.transport.socket.nio;
+
+import java.net.InetSocketAddress;
+import java.net.PortUnreachableException;
+
+import junit.framework.TestCase;
+
+import org.apache.mina.core.buffer.IoBuffer;
+import org.apache.mina.core.future.ConnectFuture;
+import org.apache.mina.core.service.IoConnector;
+import org.apache.mina.core.service.IoHandlerAdapter;
+import org.apache.mina.core.session.IoSession;
+import org.apache.mina.transport.socket.DatagramSessionConfig;
+import org.apache.mina.util.AvailablePortFinder;
+
+/**
+ * Tests {...@link DatagramSessionConfig#setCloseOnPortUnreachable(boolean)}.
+ *
+ * @author <a href="http://mina.apache.org">Apache MINA Project</a>
+ */
+public class DatagramPortUnreachableTest extends TestCase {
+
+ Object mutex = new Object();
+
+ private void runTest(boolean closeOnPortUnreachable) throws Exception {
+ IoConnector connector = new NioDatagramConnector();
+ connector.setHandler(new IoHandlerAdapter() {
+
+ @Override
+ public void exceptionCaught(IoSession session, Throwable cause)
+ throws Exception {
+ if (cause instanceof PortUnreachableException) {
+ synchronized(mutex) {
+ mutex.notify();
+ }
+ }
+ }
+
+ });
+ ConnectFuture future = connector.connect(new
InetSocketAddress("localhost",
+ AvailablePortFinder.getNextAvailable(20000)));
+ future.awaitUninterruptibly();
+ IoSession session = future.getSession();
+
+ DatagramSessionConfig cfg = ((DatagramSessionConfig) session
+ .getConfig());
+ cfg.setUseReadOperation(true);
+ cfg.setCloseOnPortUnreachable(closeOnPortUnreachable);
+
+ synchronized(mutex) {
+
session.write(IoBuffer.allocate(1)).awaitUninterruptibly().isWritten();
+ session.read();
+ mutex.wait();
+ }
+
+ Thread.sleep(500);
+
+ assertEquals(closeOnPortUnreachable, session.isClosing());
+ connector.dispose();
+ }
+
+ public void testPortUnreachableClosesSession() throws Exception {
+ // session should be closing
+ runTest(true);
+ }
+
+ public void testNormal() throws Exception {
+ // test that session is not closed on port unreachable exception
+ runTest(false);
+ }
+}
Modified:
mina/trunk/core/src/test/java/org/apache/mina/transport/socket/nio/PollingIoProcessorTest.java
URL:
http://svn.apache.org/viewvc/mina/trunk/core/src/test/java/org/apache/mina/transport/socket/nio/PollingIoProcessorTest.java?rev=801156&r1=801155&r2=801156&view=diff
==============================================================================
---
mina/trunk/core/src/test/java/org/apache/mina/transport/socket/nio/PollingIoProcessorTest.java
(original)
+++
mina/trunk/core/src/test/java/org/apache/mina/transport/socket/nio/PollingIoProcessorTest.java
Wed Aug 5 12:06:59 2009
@@ -1,178 +1,178 @@
-/*
- * 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.mina.transport.socket.nio;
-
-import java.net.InetSocketAddress;
-import java.net.NoRouteToHostException;
-import java.util.Iterator;
-import java.util.concurrent.Executor;
-import java.util.concurrent.Executors;
-
-import junit.framework.TestCase;
-
-import org.apache.mina.core.buffer.IoBuffer;
-import org.apache.mina.core.file.FileRegion;
-import org.apache.mina.core.future.ConnectFuture;
-import org.apache.mina.core.future.WriteFuture;
-import org.apache.mina.core.polling.AbstractPollingIoProcessor;
-import org.apache.mina.core.service.IoAcceptor;
-import org.apache.mina.core.service.IoConnector;
-import org.apache.mina.core.service.IoHandlerAdapter;
-import org.apache.mina.core.session.IoSession;
-import org.apache.mina.core.session.SessionState;
-import org.apache.mina.util.AvailablePortFinder;
-
-/**
- * Tests non regression on issue DIRMINA-632.
- *
- * @author <a href="http://mina.apache.org">Apache MINA Project</a>
- */
-public class PollingIoProcessorTest extends TestCase {
-
- public void testExceptionOnWrite() throws Exception {
- final Executor ex = Executors.newFixedThreadPool(1);
-
- IoConnector connector = new NioSocketConnector(
- new AbstractPollingIoProcessor<NioSession>(ex) {
-
- private NioProcessor proc = new NioProcessor(ex);
-
- @Override
- protected Iterator<NioSession> allSessions() {
- return proc.allSessions();
- }
-
- @Override
- protected void destroy(NioSession session) throws
Exception {
- proc.destroy(session);
- }
-
- @Override
- protected void dispose0() throws Exception {
- proc.dispose0();
- }
-
- @Override
- protected void init(NioSession session) throws Exception {
- proc.init(session);
- }
-
- @Override
- protected boolean isInterestedInRead(NioSession session) {
- return proc.isInterestedInRead(session);
- }
-
- @Override
- protected boolean isInterestedInWrite(NioSession session) {
- return proc.isInterestedInWrite(session);
- }
-
- @Override
- protected boolean isReadable(NioSession session) {
- return proc.isReadable(session);
- }
-
- @Override
- protected boolean isSelectorEmpty() {
- return proc.isSelectorEmpty();
- }
-
- @Override
- protected boolean isWritable(NioSession session) {
- return proc.isWritable(session);
- }
-
- @Override
- protected int read(NioSession session, IoBuffer buf)
- throws Exception {
- return proc.read(session, buf);
- }
-
- @Override
- protected int select(long timeout) throws Exception {
- return proc.select(timeout);
- }
-
- @Override
- protected int select() throws Exception {
- return proc.select();
- }
-
- @Override
- protected Iterator<NioSession> selectedSessions() {
- return proc.selectedSessions();
- }
-
- @Override
- protected void setInterestedInRead(NioSession session,
- boolean interested) throws Exception {
- proc.setInterestedInRead(session, interested);
- }
-
- @Override
- protected void setInterestedInWrite(NioSession session,
- boolean interested) throws Exception {
- proc.setInterestedInWrite(session, interested);
- }
-
- @Override
- protected SessionState getState(
- NioSession session) {
- return proc.getState(session);
- }
-
- @Override
- protected int transferFile(NioSession session,
- FileRegion region, int length) throws Exception {
- return proc.transferFile(session, region, length);
- }
-
- @Override
- protected void wakeup() {
- proc.wakeup();
- }
-
- @Override
- protected int write(NioSession session, IoBuffer buf,
- int length) throws Exception {
- throw new NoRouteToHostException(
- "No Route To Host Test");
- }
-
- });
- connector.setHandler(new IoHandlerAdapter());
-
- IoAcceptor acceptor = new NioSocketAcceptor();
- acceptor.setHandler(new IoHandlerAdapter());
-
- InetSocketAddress addr = new InetSocketAddress("localhost",
- AvailablePortFinder.getNextAvailable(20000));
-
- acceptor.bind(addr);
- ConnectFuture future = connector.connect(addr);
- future.awaitUninterruptibly();
- IoSession session = future.getSession();
- WriteFuture wf =
session.write(IoBuffer.allocate(1)).awaitUninterruptibly();
- assertNotNull(wf.getException());
-
- connector.dispose();
- acceptor.dispose();
- }
-}
\ No newline at end of file
+/*
+ * 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.mina.transport.socket.nio;
+
+import java.net.InetSocketAddress;
+import java.net.NoRouteToHostException;
+import java.util.Iterator;
+import java.util.concurrent.Executor;
+import java.util.concurrent.Executors;
+
+import junit.framework.TestCase;
+
+import org.apache.mina.core.buffer.IoBuffer;
+import org.apache.mina.core.file.FileRegion;
+import org.apache.mina.core.future.ConnectFuture;
+import org.apache.mina.core.future.WriteFuture;
+import org.apache.mina.core.polling.AbstractPollingIoProcessor;
+import org.apache.mina.core.service.IoAcceptor;
+import org.apache.mina.core.service.IoConnector;
+import org.apache.mina.core.service.IoHandlerAdapter;
+import org.apache.mina.core.session.IoSession;
+import org.apache.mina.core.session.SessionState;
+import org.apache.mina.util.AvailablePortFinder;
+
+/**
+ * Tests non regression on issue DIRMINA-632.
+ *
+ * @author <a href="http://mina.apache.org">Apache MINA Project</a>
+ */
+public class PollingIoProcessorTest extends TestCase {
+
+ public void testExceptionOnWrite() throws Exception {
+ final Executor ex = Executors.newFixedThreadPool(1);
+
+ IoConnector connector = new NioSocketConnector(
+ new AbstractPollingIoProcessor<NioSession>(ex) {
+
+ private NioProcessor proc = new NioProcessor(ex);
+
+ @Override
+ protected Iterator<NioSession> allSessions() {
+ return proc.allSessions();
+ }
+
+ @Override
+ protected void destroy(NioSession session) throws
Exception {
+ proc.destroy(session);
+ }
+
+ @Override
+ protected void dispose0() throws Exception {
+ proc.dispose0();
+ }
+
+ @Override
+ protected void init(NioSession session) throws Exception {
+ proc.init(session);
+ }
+
+ @Override
+ protected boolean isInterestedInRead(NioSession session) {
+ return proc.isInterestedInRead(session);
+ }
+
+ @Override
+ protected boolean isInterestedInWrite(NioSession session) {
+ return proc.isInterestedInWrite(session);
+ }
+
+ @Override
+ protected boolean isReadable(NioSession session) {
+ return proc.isReadable(session);
+ }
+
+ @Override
+ protected boolean isSelectorEmpty() {
+ return proc.isSelectorEmpty();
+ }
+
+ @Override
+ protected boolean isWritable(NioSession session) {
+ return proc.isWritable(session);
+ }
+
+ @Override
+ protected int read(NioSession session, IoBuffer buf)
+ throws Exception {
+ return proc.read(session, buf);
+ }
+
+ @Override
+ protected int select(long timeout) throws Exception {
+ return proc.select(timeout);
+ }
+
+ @Override
+ protected int select() throws Exception {
+ return proc.select();
+ }
+
+ @Override
+ protected Iterator<NioSession> selectedSessions() {
+ return proc.selectedSessions();
+ }
+
+ @Override
+ protected void setInterestedInRead(NioSession session,
+ boolean interested) throws Exception {
+ proc.setInterestedInRead(session, interested);
+ }
+
+ @Override
+ protected void setInterestedInWrite(NioSession session,
+ boolean interested) throws Exception {
+ proc.setInterestedInWrite(session, interested);
+ }
+
+ @Override
+ protected SessionState getState(
+ NioSession session) {
+ return proc.getState(session);
+ }
+
+ @Override
+ protected int transferFile(NioSession session,
+ FileRegion region, int length) throws Exception {
+ return proc.transferFile(session, region, length);
+ }
+
+ @Override
+ protected void wakeup() {
+ proc.wakeup();
+ }
+
+ @Override
+ protected int write(NioSession session, IoBuffer buf,
+ int length) throws Exception {
+ throw new NoRouteToHostException(
+ "No Route To Host Test");
+ }
+
+ });
+ connector.setHandler(new IoHandlerAdapter());
+
+ IoAcceptor acceptor = new NioSocketAcceptor();
+ acceptor.setHandler(new IoHandlerAdapter());
+
+ InetSocketAddress addr = new InetSocketAddress("localhost",
+ AvailablePortFinder.getNextAvailable(20000));
+
+ acceptor.bind(addr);
+ ConnectFuture future = connector.connect(addr);
+ future.awaitUninterruptibly();
+ IoSession session = future.getSession();
+ WriteFuture wf =
session.write(IoBuffer.allocate(1)).awaitUninterruptibly();
+ assertNotNull(wf.getException());
+
+ connector.dispose();
+ acceptor.dispose();
+ }
+}