/[projects]/android/TrainInfoService/src/dk/thoerup/traininfoservice/db/TestServlet.java
ViewVC logotype

Diff of /android/TrainInfoService/src/dk/thoerup/traininfoservice/db/TestServlet.java

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

revision 1255 by torben, Mon Apr 4 10:56:44 2011 UTC revision 1342 by torben, Wed Apr 20 15:31:47 2011 UTC
# Line 3  package dk.thoerup.traininfoservice.db; Line 3  package dk.thoerup.traininfoservice.db;
3  import java.io.IOException;  import java.io.IOException;
4  import java.sql.SQLException;  import java.sql.SQLException;
5  import java.util.Random;  import java.util.Random;
6    import java.util.logging.Logger;
7    
8  import javax.servlet.ServletException;  import javax.servlet.ServletException;
9  import javax.servlet.annotation.WebServlet;  import javax.servlet.annotation.WebServlet;
# Line 14  import javax.servlet.http.HttpServletRes Line 15  import javax.servlet.http.HttpServletRes
15  @WebServlet(urlPatterns={"/TestServlet"})  @WebServlet(urlPatterns={"/TestServlet"})
16  public class TestServlet extends HttpServlet {  public class TestServlet extends HttpServlet {
17          private static final long serialVersionUID = 1L;          private static final long serialVersionUID = 1L;
18            Logger log = Logger.getLogger(TestServlet.class.getName());
19                    
20          Random r = new Random();          Random r = new Random();
21    
# Line 31  public class TestServlet extends HttpSer Line 33  public class TestServlet extends HttpSer
33                          float lng = (r.nextFloat()*4.7F) + 8.0F;                          float lng = (r.nextFloat()*4.7F) + 8.0F;
34                          db.getByLocation(lat, lng);                          db.getByLocation(lat, lng);
35                  }                  }
   
   
   
36          }          }
37    
38          void testFindName(int count)  throws SQLException {          void testFindName(int count)  throws SQLException {
# Line 41  public class TestServlet extends HttpSer Line 40  public class TestServlet extends HttpSer
40                  StationDAO db = new StationDAO();                  StationDAO db = new StationDAO();
41                                    
42                  for (int i=0; i<count; i++) {                  for (int i=0; i<count; i++) {
43                          char c1 = ((char)r.nextInt(26));                          char c1 = getRandomCharacter();
44                          c1 += 'a';                          char c2 = getRandomCharacter();
                         char c2 = ((char)r.nextInt(26)) ;  
                         c2 += 'a';  
45    
46                          String search = "" + c1 + c2;                          String search = "" + c1 + c2;
47                          System.out.println(search);                          log.info(search);
48                                                    
49                          db.getByName(search);                          db.getByName(search);
50                  }                  }
51          }          }
52    
53            private char getRandomCharacter() {
54                    char c1 = ((char)r.nextInt(26));
55                    c1 += 'a';
56                    return c1;
57            }
58                    
59          void testFindFavorites(int count)  throws SQLException {          void testFindFavorites(int count)  throws SQLException {
60                                    

Legend:
Removed from v.1255  
changed lines
  Added in v.1342

  ViewVC Help
Powered by ViewVC 1.1.20