~ubuntu-branches/ubuntu/oneiric/libjboss-remoting-java/oneiric

« back to all changes in this revision

Viewing changes to src/tests/org/jboss/test/remoting/connection/ConnectionValidatorTestCase.java

  • Committer: Package Import Robot
  • Author(s): Torsten Werner
  • Date: 2011-09-09 14:01:03 UTC
  • mfrom: (1.1.6 upstream)
  • Revision ID: package-import@ubuntu.com-20110909140103-hqokx61534tas9rg
Tags: 2.5.3.SP1-1
* Newer but not newest upstream release. Do not build samples.
* Change debian/watch to upstream's svn repo.
* Add patch to fix compile error caused by tomcat update.
  (Closes: #628303)
* Switch to source format 3.0.
* Switch to debhelper level 7.
* Remove useless Depends.
* Update Standards-Version: 3.9.2.
* Update README.source.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
package org.jboss.test.remoting.connection;
 
2
 
 
3
import java.io.IOException;
 
4
import java.net.MalformedURLException;
 
5
import java.util.HashMap;
 
6
import java.util.Map;
 
7
 
 
8
import junit.framework.TestCase;
 
9
 
 
10
import org.jboss.remoting.Client;
 
11
import org.jboss.remoting.ConnectionFailedException;
 
12
import org.jboss.remoting.ConnectionValidator;
 
13
import org.jboss.remoting.InvokerLocator;
 
14
import org.jboss.remoting.MicroRemoteClientInvoker;
 
15
import org.jboss.remoting.marshal.Marshaller;
 
16
import org.jboss.remoting.marshal.UnMarshaller;
 
17
import org.jboss.remoting.transport.ClientInvoker;
 
18
 
 
19
public class ConnectionValidatorTestCase extends TestCase
 
20
{
 
21
 
 
22
   public void testShouldDisallowDirectRun()
 
23
   {
 
24
      ConnectionValidator cv = new ConnectionValidator(new Client() {
 
25
         public Map getConfiguration()
 
26
         {
 
27
            return new HashMap();
 
28
         }
 
29
 
 
30
         public ClientInvoker getInvoker()
 
31
         {
 
32
            try
 
33
            {
 
34
               return new MicroRemoteClientInvoker(
 
35
                     new InvokerLocator("http://dummy:65535/dummy/")) {
 
36
 
 
37
                  public String getSessionId()
 
38
                  {
 
39
                     return "dummyId";
 
40
                  }
 
41
 
 
42
                  protected String getDefaultDataType()
 
43
                  {
 
44
                     throw new UnsupportedOperationException();
 
45
                  }
 
46
 
 
47
                  protected void handleConnect() throws ConnectionFailedException
 
48
                  {
 
49
                     throw new UnsupportedOperationException();
 
50
                  }
 
51
 
 
52
                  protected void handleDisconnect()
 
53
                  {
 
54
                     throw new UnsupportedOperationException();
 
55
                  }
 
56
 
 
57
                  protected Object transport(String sessionId, Object invocation, Map metadata, Marshaller marshaller,
 
58
                        UnMarshaller unmarshaller) throws IOException, ConnectionFailedException, ClassNotFoundException
 
59
                  {
 
60
                     throw new UnsupportedOperationException();
 
61
                  }
 
62
               };
 
63
            }
 
64
            catch (MalformedURLException e)
 
65
            {
 
66
               throw new RuntimeException(e);
 
67
            }
 
68
         }
 
69
      });
 
70
 
 
71
      try
 
72
      {
 
73
         cv.run();
 
74
         fail("Should throw IllegalStateException");
 
75
      } catch (IllegalStateException e) {
 
76
         // Expected
 
77
      }
 
78
   }
 
79
}