Author: ron.sigal(a)jboss.com
Date: 2008-12-27 22:19:14 -0500 (Sat, 27 Dec 2008)
New Revision: 4764
Added:
remoting2/branches/2.x/src/tests/org/jboss/test/remoting/connection/ConnectionValidatorTestCase.java
Log:
JBREM-1055, JBREM-1070: Renamed ConnectionValidatorTest to ConnectionValidatorTestCase and
moved to org.jboss.test.remoting.connection.
Added:
remoting2/branches/2.x/src/tests/org/jboss/test/remoting/connection/ConnectionValidatorTestCase.java
===================================================================
---
remoting2/branches/2.x/src/tests/org/jboss/test/remoting/connection/ConnectionValidatorTestCase.java
(rev 0)
+++
remoting2/branches/2.x/src/tests/org/jboss/test/remoting/connection/ConnectionValidatorTestCase.java 2008-12-28
03:19:14 UTC (rev 4764)
@@ -0,0 +1,78 @@
+package org.jboss.test.remoting.connection;
+
+import java.io.IOException;
+import java.net.MalformedURLException;
+import java.util.Map;
+
+import junit.framework.TestCase;
+
+import org.jboss.remoting.Client;
+import org.jboss.remoting.ConnectionFailedException;
+import org.jboss.remoting.ConnectionValidator;
+import org.jboss.remoting.InvokerLocator;
+import org.jboss.remoting.MicroRemoteClientInvoker;
+import org.jboss.remoting.marshal.Marshaller;
+import org.jboss.remoting.marshal.UnMarshaller;
+import org.jboss.remoting.transport.ClientInvoker;
+
+public class ConnectionValidatorTestCase extends TestCase
+{
+
+ public void testShouldDisallowDirectRun()
+ {
+ ConnectionValidator cv = new ConnectionValidator(new Client() {
+ public Map getConfiguration()
+ {
+ return null;
+ }
+
+ public ClientInvoker getInvoker()
+ {
+ try
+ {
+ return new MicroRemoteClientInvoker(
+ new InvokerLocator("http://dummy:65535/dummy/")) {
+
+ public String getSessionId()
+ {
+ return "dummyId";
+ }
+
+ protected String getDefaultDataType()
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ protected void handleConnect() throws ConnectionFailedException
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ protected void handleDisconnect()
+ {
+ throw new UnsupportedOperationException();
+ }
+
+ protected Object transport(String sessionId, Object invocation, Map
metadata, Marshaller marshaller,
+ UnMarshaller unmarshaller) throws IOException,
ConnectionFailedException, ClassNotFoundException
+ {
+ throw new UnsupportedOperationException();
+ }
+ };
+ }
+ catch (MalformedURLException e)
+ {
+ throw new RuntimeException(e);
+ }
+ }
+ });
+
+ try
+ {
+ cv.run();
+ fail("Should throw IllegalStateException");
+ } catch (IllegalStateException e) {
+ // Expected
+ }
+ }
+}
Show replies by date