comparison geo-backend/src/test/java/de/intevation/gnv/geobackend/sde/datasources/ArcSDEConnectionPoolTestCase.java @ 885:1c3efbd2fc5a

Removes trailing whitespace. geo-backend/trunk@850 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Sascha L. Teichmann <sascha.teichmann@intevation.de>
date Mon, 29 Mar 2010 07:49:16 +0000
parents 5a583cff97ea
children 8b442223741c
comparison
equal deleted inserted replaced
884:12f88239fb33 885:1c3efbd2fc5a
29 29
30 /** 30 /**
31 * the logger, used to log exceptions and additonaly information 31 * the logger, used to log exceptions and additonaly information
32 */ 32 */
33 private static Logger log = null; 33 private static Logger log = null;
34 34
35 static { 35 static {
36 BasicConfigurator.configure(); 36 BasicConfigurator.configure();
37 log = Logger.getLogger(ArcSDEPoolableObjectFactory.class); 37 log = Logger.getLogger(ArcSDEPoolableObjectFactory.class);
38 } 38 }
39 /** 39 /**
40 * 40 *
41 */ 41 */
42 public ArcSDEConnectionPoolTestCase() { 42 public ArcSDEConnectionPoolTestCase() {
43 super(); 43 super();
44 } 44 }
45 45
46 /** 46 /**
47 * 47 *
48 * @param name 48 * @param name
49 */ 49 */
50 public ArcSDEConnectionPoolTestCase(String name) { 50 public ArcSDEConnectionPoolTestCase(String name) {
51 super(name); 51 super(name);
52 } 52 }
53 53
54 /** 54 /**
55 * Test if the ArcSDEConnectionPool can be established 55 * Test if the ArcSDEConnectionPool can be established
56 * and if a Request could be done. 56 * and if a Request could be done.
57 */ 57 */
58 public void testArcSDEConnectionPool(){ 58 public void testArcSDEConnectionPool(){
59 log.debug("ArcSDEConnectionPoolTestCase.testArcSDEConnectionPool"); 59 log.debug("ArcSDEConnectionPoolTestCase.testArcSDEConnectionPool");
60 try { 60 try {
61 InputStream inputStream = new FileInputStream("src/test/ressources/ArcSDEConnectionPoolTestCase.properties"); 61 InputStream inputStream = new FileInputStream("src/test/ressources/ArcSDEConnectionPoolTestCase.properties");
62 Properties properties = new Properties(); 62 Properties properties = new Properties();
63 properties.load(inputStream); 63 properties.load(inputStream);
64 64
65 ConnectionPoolFactory cpf = ConnectionPoolFactory.getInstance(); 65 ConnectionPoolFactory cpf = ConnectionPoolFactory.getInstance();
66 cpf.initializeConnectionPool(properties); 66 cpf.initializeConnectionPool(properties);
67 67
68 assertTrue(cpf.isInitialized()); 68 assertTrue(cpf.isInitialized());
69 log.debug("ConnectionPoolFactory ist initialisiert."); 69 log.debug("ConnectionPoolFactory ist initialisiert.");
70 70
71 ConnectionPool cp = cpf.getConnectionPool(); 71 ConnectionPool cp = cpf.getConnectionPool();
72 assertNotNull(cp); 72 assertNotNull(cp);
73 log.debug("ConnectionPool ist initialisiert."); 73 log.debug("ConnectionPool ist initialisiert.");
74 74
75 Connection connection = null; 75 Connection connection = null;
76 try{ 76 try{
77 try { 77 try {
78 connection = cp.getConnection("N/N"); 78 connection = cp.getConnection("N/N");
79 assertNotNull(connection); 79 assertNotNull(connection);
80 log.debug("Connection ist initialisiert."); 80 log.debug("Connection ist initialisiert.");
81 } catch (ConnectionException e) { 81 } catch (ConnectionException e) {
82 log.error("Es traten Probleme bei der Verbinung zur Datenbank auf."); 82 log.error("Es traten Probleme bei der Verbinung zur Datenbank auf.");
83 fail(); 83 fail();
84 } 84 }
85 85
86 86
87 try { 87 try {
88 Statement stmt = connection.createStatement(); 88 Statement stmt = connection.createStatement();
89 ResultSet rs = stmt.executeQuery("Select MESHID, NAME from MEDIAN.MESH"); 89 ResultSet rs = stmt.executeQuery("Select MESHID, NAME from MEDIAN.MESH");
90 90
91 while (rs.next()){ 91 while (rs.next()){
92 log.debug(rs.getInt(1)); 92 log.debug(rs.getInt(1));
93 log.debug(rs.getString(2)); 93 log.debug(rs.getString(2));
94 94
95 log.debug(rs.getInt("MESHID")); 95 log.debug(rs.getInt("MESHID"));
96 log.debug(rs.getString("NAME")); 96 log.debug(rs.getString("NAME"));
97 } 97 }
98 98
99 } catch (SQLException e) { 99 } catch (SQLException e) {
100 log.error(e,e); 100 log.error(e,e);
101 } 101 }
102 }finally{ 102 }finally{
103 if (connection != null){ 103 if (connection != null){

http://dive4elements.wald.intevation.org