package org.opennms.netmgt.dao.db;

import java.io.ByteArrayOutputStream;
import java.io.PrintStream;

public class PopulatedTemporaryDatabaseTestCase extends
        TemporaryDatabaseTestCase {
    
    private InstallerDb installerDb;
    
    private ByteArrayOutputStream m_outputStream;
    
    protected void setUp() throws Exception {
        super.setUp();
        
        initializeDatabase();
    }

    protected void initializeDatabase() throws Exception {
        if (!isEnabled()) {
            return;
        }
        
        installerDb = new InstallerDb();

        // Create a ByteArrayOutputSteam to effectively throw away output.
        resetOutputStream();
        installerDb.setDatabaseName(getTestDatabase());
        installerDb.setDataSource(getDataSource());
        
        installerDb.setCreateSqlLocation(
            "../opennms-daemon/src/main/filtered/etc/create.sql");

        installerDb.setStoredProcedureDirectory(
            "../opennms-daemon/src/main/filtered/etc");

        //installerDb.setDebug(true);

        installerDb.readTables();
        
        installerDb.createSequences();
        installerDb.updatePlPgsql();
        installerDb.addStoredProcedures();
        
        installerDb.createTables();

        installerDb.closeConnection();
    }

    public ByteArrayOutputStream getOutputStream() {
        return m_outputStream;
    }
    
    public void resetOutputStream() {
        m_outputStream = new ByteArrayOutputStream();
        installerDb.setOutputStream(new PrintStream(m_outputStream));
    }
}

@@ -217,16 +217,18 @@
 allerDb 
+m_
 installe
@@ -533,32 +533,34 @@
        %0A        
+m_
 installerDb = ne
@@ -681,32 +681,34 @@
 ream();%0A        
+m_
 installerDb.setD
@@ -739,32 +739,34 @@
 ase());%0A        
+m_
 installerDb.setD
@@ -802,32 +802,34 @@
        %0A        
+m_
 installerDb.setC
@@ -914,32 +914,34 @@
 sql%22);%0A%0A        
+m_
 installerDb.setS
@@ -1061,32 +1061,34 @@
 true);%0A%0A        
+m_
 installerDb.read
@@ -1106,32 +1106,34 @@
        %0A        
+m_
 installerDb.crea
@@ -1147,32 +1147,34 @@
 nces();%0A        
+m_
 installerDb.upda
@@ -1186,32 +1186,34 @@
 gsql();%0A        
+m_
 installerDb.addS
@@ -1240,32 +1240,34 @@
        %0A        
+m_
 installerDb.crea
@@ -1279,32 +1279,34 @@
 les();%0A%0A        
+m_
 installerDb.clos
@@ -1522,16 +1522,18 @@
         
+m_
 installe

Fix the name for the installerDb field to match our conventions.