~trond-norbye/gearmanij/client

« back to all changes in this revision

Viewing changes to test/gearmanij/client/GearmanClientTest.java

  • Committer: elambert
  • Date: 2009-05-16 17:59:15 UTC
  • Revision ID: elambert-20090516175915-p4kgx9qa5kwosrnw
new and improved testing

Show diffs side-by-side

added added

removed removed

Lines of Context:
60
60
          listback.contains(new InetSocketAddress("localhost",port + i)));
61
61
    }
62
62
  }
 
63
  
 
64
  @Test
 
65
  /*
 
66
   * Attempt to use invalid host and port number as jobServers. All cases should
 
67
   * result in a IllegalArgumentException
 
68
   */
 
69
  public void addBadServer() throws GearmanClient.ClientShutDown, IOException{
 
70
    //invalid host
 
71
    GearmanClient gc = new GearmanClient();
 
72
    try {
 
73
      gc.addJobServer(null);
 
74
      Assert.fail("Was able to add a null job server to the client.");
 
75
    } catch (IllegalArgumentException expected) { }
 
76
    
 
77
    try {
 
78
      gc.addJobServer(null, Constants.GEARMAN_DEFAULT_TCP_PORT);
 
79
      Assert.fail("Was able to add a null job server to the client using the verbose addJobServer method.");
 
80
    } catch (IllegalArgumentException expected) { }
 
81
    
 
82
    try {
 
83
      gc.addJobServer("localhost", -1);
 
84
      Assert.fail("Was able to add a jobServer to the client using an invalid port.");
 
85
    } catch (IllegalArgumentException expected) { }
 
86
  }
63
87
 
64
88
  @Test
65
89
  /*