diff geo-backend/src/test/java/de/intevation/gnv/geobackend/sde/datasources/ArcSDEConnectionPoolTestCase.java @ 132:5a583cff97ea

Implementation of the Datainfrastructure for fetching Data from different DataStores. geo-backend/trunk@12 c6561f87-3c4e-4783-a992-168aeb5c3f6f
author Tim Englich <tim.englich@intevation.de>
date Fri, 04 Sep 2009 08:11:30 +0000
parents e4eacd613356
children 1c3efbd2fc5a
line wrap: on
line diff
--- a/geo-backend/src/test/java/de/intevation/gnv/geobackend/sde/datasources/ArcSDEConnectionPoolTestCase.java	Wed Sep 02 15:28:51 2009 +0000
+++ b/geo-backend/src/test/java/de/intevation/gnv/geobackend/sde/datasources/ArcSDEConnectionPoolTestCase.java	Fri Sep 04 08:11:30 2009 +0000
@@ -27,97 +27,94 @@
  */
 public class ArcSDEConnectionPoolTestCase extends TestCase {
 
-	/**
+    /**
      * the logger, used to log exceptions and additonaly information
      */
     private static Logger log = null;
     
     static {
-    	BasicConfigurator.configure();
-    	log = Logger.getLogger(ArcSDEPoolableObjectFactory.class);
+        BasicConfigurator.configure();
+        log = Logger.getLogger(ArcSDEPoolableObjectFactory.class);
     }
-	
-	
-	
-	/**
-	 * 
-	 */
-	public ArcSDEConnectionPoolTestCase() {
-		super();
-	}
-
-	/**
-	 * 
-	 * @param name
-	 */
-	public ArcSDEConnectionPoolTestCase(String name) {
-		super(name);
-	}
-	
-	public void testArcSDEConnectionPool(){
-		log.debug("ArcSDEConnectionPoolTestCase.testArcSDEConnectionPool");
-		try {
-			InputStream inputStream = new FileInputStream("src/test/ressources/ArcSDEConnectionPoolTestCase.properties");
-			Properties properties = new Properties();
-			properties.load(inputStream);
-			
-			ConnectionPoolFactory cpf = ConnectionPoolFactory.getInstance();
-			cpf.initializeConnectionPool(properties);
-			
-			assertTrue(cpf.isInitialized());
-			log.debug("ConnectionPoolFactory ist initialisiert.");
-			
-			ConnectionPool cp = cpf.getConnectionPool();
-			assertNotNull(cp);
-			log.debug("ConnectionPool ist initialisiert.");			
-			
-			Connection connection = null; 
-			try{
-				try {
-					connection = cp.getConnection("N/N");
-					assertNotNull(connection);
-					log.debug("Connection ist initialisiert.");
-				} catch (ConnectionException e) {
-					log.error("Es traten Probleme bei der Verbinung zur Datenbank auf.");
-					fail();
-				}
-				
-				
-				try {
-		            Statement stmt = connection.createStatement();
-		            ResultSet rs = stmt.executeQuery("Select MESHID, NAME from MEDIAN.MESH");
-		            
-		            while (rs.next()){
-		            	log.debug(rs.getInt(1));
-		            	log.debug(rs.getString(2));
-		            	
-		            	log.debug(rs.getInt("MESHID"));
-		            	log.debug(rs.getString("NAME"));
-		            }
-		            
-	            } catch (SQLException e) {
-		            log.error(e,e);
-	            }
-			}finally{
-				if (connection != null){
-					try {
-	                    connection.close();
+    /**
+     * 
+     */
+    public ArcSDEConnectionPoolTestCase() {
+        super();
+    }
+    
+    /**
+     * 
+     * @param name
+     */
+    public ArcSDEConnectionPoolTestCase(String name) {
+        super(name);
+    }
+    
+    /**
+     * Test if the ArcSDEConnectionPool can be established
+     * and if a Request could be done.
+     */
+    public void testArcSDEConnectionPool(){
+        log.debug("ArcSDEConnectionPoolTestCase.testArcSDEConnectionPool");
+        try {
+            InputStream inputStream = new FileInputStream("src/test/ressources/ArcSDEConnectionPoolTestCase.properties");
+            Properties properties = new Properties();
+            properties.load(inputStream);
+            
+            ConnectionPoolFactory cpf = ConnectionPoolFactory.getInstance();
+            cpf.initializeConnectionPool(properties);
+            
+            assertTrue(cpf.isInitialized());
+            log.debug("ConnectionPoolFactory ist initialisiert.");
+            
+            ConnectionPool cp = cpf.getConnectionPool();
+            assertNotNull(cp);
+            log.debug("ConnectionPool ist initialisiert.");			
+            
+            Connection connection = null; 
+            try{
+                try {
+                    connection = cp.getConnection("N/N");
+                    assertNotNull(connection);
+                    log.debug("Connection ist initialisiert.");
+                } catch (ConnectionException e) {
+                    log.error("Es traten Probleme bei der Verbinung zur Datenbank auf.");
+                    fail();
+                }
+                
+                
+                try {
+                    Statement stmt = connection.createStatement();
+                    ResultSet rs = stmt.executeQuery("Select MESHID, NAME from MEDIAN.MESH");
+                    
+                    while (rs.next()){
+                        log.debug(rs.getInt(1));
+                        log.debug(rs.getString(2));
+                        
+                        log.debug(rs.getInt("MESHID"));
+                        log.debug(rs.getString("NAME"));
+                    }
+                    
+                } catch (SQLException e) {
+                    log.error(e,e);
+                }
+            }finally{
+                if (connection != null){
+                    try {
+                            connection.close();
                     } catch (SQLException e) {
-	                    log.error(e,e);
-	                    fail();
+                        log.error(e,e);
+                        fail();
                     }
-				}
-			}
-			
-			
-			
-		} catch (FileNotFoundException e) {
-			log.error(e,e);
-			fail();
-		} catch (IOException e) {
-			log.error(e,e);
-			fail();
-		}	
-	}
-	
+                }
+            }
+        } catch (FileNotFoundException e) {
+            log.error(e,e);
+            fail();
+        } catch (IOException e) {
+            log.error(e,e);
+            fail();
+        }
+    }
 }

http://dive4elements.wald.intevation.org