Modified: manifoldcf/trunk/framework/pull-agent/src/test/java/org/apache/manifoldcf/crawler/tests/ConnectorBaseHSQLDB.java URL: http://svn.apache.org/viewvc/manifoldcf/trunk/framework/pull-agent/src/test/java/org/apache/manifoldcf/crawler/tests/ConnectorBaseHSQLDB.java?rev=1377435&r1=1377434&r2=1377435&view=diff ============================================================================== --- manifoldcf/trunk/framework/pull-agent/src/test/java/org/apache/manifoldcf/crawler/tests/ConnectorBaseHSQLDB.java (original) +++ manifoldcf/trunk/framework/pull-agent/src/test/java/org/apache/manifoldcf/crawler/tests/ConnectorBaseHSQLDB.java Sun Aug 26 13:37:45 2012 @@ -66,9 +66,10 @@ public class ConnectorBaseHSQLDB extends public void setUp() throws Exception { + initializeSystem(); try { - localCleanUp(); + localReset(); } catch (Exception e) { @@ -91,9 +92,6 @@ public class ConnectorBaseHSQLDB extends super.localSetUp(); - // Register the connector we're testing - initialize(); - ManifoldCF.initializeEnvironment(); IThreadContext tc = ThreadContextFactory.make(); IDBInterface database = DBInterfaceFactory.make(tc, @@ -186,145 +184,140 @@ public class ConnectorBaseHSQLDB extends e.printStackTrace(); throw e; } + cleanupSystem(); } protected void localCleanUp() throws Exception { - initialize(); - if (isInitialized()) - { - // Test the uninstall - ManifoldCF.initializeEnvironment(); - IThreadContext tc = ThreadContextFactory.make(); + IThreadContext tc = ThreadContextFactory.make(); - Exception currentException = null; - // First, tear down all jobs, connections, authority connections, and output connections. - try - { - IRepositoryConnectionManager connMgr = RepositoryConnectionManagerFactory.make(tc); - IAuthorityConnectionManager authConnMgr = AuthorityConnectionManagerFactory.make(tc); - IOutputConnectionManager outputMgr = OutputConnectionManagerFactory.make(tc); - - // Now, get a list of the repository connections - IRepositoryConnection[] connections = connMgr.getAllConnections(); - int i = 0; - while (i < connections.length) - { - connMgr.delete(connections[i++].getName()); - } - - // Get a list of authority connections - IAuthorityConnection[] authorities = authConnMgr.getAllConnections(); - i = 0; - while (i < authorities.length) - { - authConnMgr.delete(authorities[i++].getName()); - } + Exception currentException = null; + // First, tear down all jobs, connections, authority connections, and output connections. + try + { + IRepositoryConnectionManager connMgr = RepositoryConnectionManagerFactory.make(tc); + IAuthorityConnectionManager authConnMgr = AuthorityConnectionManagerFactory.make(tc); + IOutputConnectionManager outputMgr = OutputConnectionManagerFactory.make(tc); - // Finally, get rid of output connections - IOutputConnection[] outputs = outputMgr.getAllConnections(); - i = 0; - while (i < outputs.length) - { - outputMgr.delete(outputs[i++].getName()); - } - + // Now, get a list of the repository connections + IRepositoryConnection[] connections = connMgr.getAllConnections(); + int i = 0; + while (i < connections.length) + { + connMgr.delete(connections[i++].getName()); } - catch (Exception e) + + // Get a list of authority connections + IAuthorityConnection[] authorities = authConnMgr.getAllConnections(); + i = 0; + while (i < authorities.length) { - currentException = e; + authConnMgr.delete(authorities[i++].getName()); } - try + + // Finally, get rid of output connections + IOutputConnection[] outputs = outputMgr.getAllConnections(); + i = 0; + while (i < outputs.length) { - IDBInterface database = DBInterfaceFactory.make(tc, - ManifoldCF.getMasterDatabaseName(), - ManifoldCF.getMasterDatabaseUsername(), - ManifoldCF.getMasterDatabasePassword()); + outputMgr.delete(outputs[i++].getName()); + } + + } + catch (Exception e) + { + currentException = e; + } + try + { + IDBInterface database = DBInterfaceFactory.make(tc, + ManifoldCF.getMasterDatabaseName(), + ManifoldCF.getMasterDatabaseUsername(), + ManifoldCF.getMasterDatabasePassword()); - IConnectorManager mgr = ConnectorManagerFactory.make(tc); - IAuthorityConnectorManager authMgr = AuthorityConnectorManagerFactory.make(tc); - IOutputConnectorManager outputMgr = OutputConnectorManagerFactory.make(tc); - IOutputConnectionManager outputConnManager = OutputConnectionManagerFactory.make(tc); - IJobManager jobManager = JobManagerFactory.make(tc); - IRepositoryConnectionManager connManager = RepositoryConnectionManagerFactory.make(tc); + IConnectorManager mgr = ConnectorManagerFactory.make(tc); + IAuthorityConnectorManager authMgr = AuthorityConnectorManagerFactory.make(tc); + IOutputConnectorManager outputMgr = OutputConnectorManagerFactory.make(tc); + IOutputConnectionManager outputConnManager = OutputConnectionManagerFactory.make(tc); + IJobManager jobManager = JobManagerFactory.make(tc); + IRepositoryConnectionManager connManager = RepositoryConnectionManagerFactory.make(tc); - // Deregistration should be done in a transaction - database.beginTransaction(); - try - { - int i; + // Deregistration should be done in a transaction + database.beginTransaction(); + try + { + int i; - String[] connectorClasses = getConnectorClasses(); + String[] connectorClasses = getConnectorClasses(); - i = 0; - while (i < connectorClasses.length) - { - // Find the connection names that come with this class - String[] connectionNames = connManager.findConnectionsForConnector(connectorClasses[i]); - // For each connection name, modify the jobs to note that the connector is no longer installed - jobManager.noteConnectorDeregistration(connectionNames); - // Now that all jobs have been placed into an appropriate state, actually do the deregistration itself. - mgr.unregisterConnector(connectorClasses[i]); - i++; - } - - String[] authorityClasses = getAuthorityClasses(); - - i = 0; - while (i < authorityClasses.length) - { - authMgr.unregisterConnector(authorityClasses[i]); - i++; - } - - String[] outputClasses = getOutputClasses(); - - i = 0; - while (i < outputClasses.length) - { - // Find the connection names that come with this class - String[] connectionNames = outputConnManager.findConnectionsForConnector(outputClasses[i]); - // For all connection names, notify all agents of the deregistration - AgentManagerFactory.noteOutputConnectorDeregistration(tc,connectionNames); - // Now that all jobs have been placed into an appropriate state, actually do the deregistration itself. - outputMgr.unregisterConnector(outputClasses[i]); - i++; - } - - } - catch (ManifoldCFException e) + i = 0; + while (i < connectorClasses.length) { - database.signalRollback(); - throw e; + // Find the connection names that come with this class + String[] connectionNames = connManager.findConnectionsForConnector(connectorClasses[i]); + // For each connection name, modify the jobs to note that the connector is no longer installed + jobManager.noteConnectorDeregistration(connectionNames); + // Now that all jobs have been placed into an appropriate state, actually do the deregistration itself. + mgr.unregisterConnector(connectorClasses[i]); + i++; } - catch (Error e) + + String[] authorityClasses = getAuthorityClasses(); + + i = 0; + while (i < authorityClasses.length) { - database.signalRollback(); - throw e; + authMgr.unregisterConnector(authorityClasses[i]); + i++; } - finally + + String[] outputClasses = getOutputClasses(); + + i = 0; + while (i < outputClasses.length) { - database.endTransaction(); + // Find the connection names that come with this class + String[] connectionNames = outputConnManager.findConnectionsForConnector(outputClasses[i]); + // For all connection names, notify all agents of the deregistration + AgentManagerFactory.noteOutputConnectorDeregistration(tc,connectionNames); + // Now that all jobs have been placed into an appropriate state, actually do the deregistration itself. + outputMgr.unregisterConnector(outputClasses[i]); + i++; } + } - catch (Exception e) + catch (ManifoldCFException e) { - if (currentException != null) - currentException = e; + database.signalRollback(); + throw e; } - try + catch (Error e) { - super.localCleanUp(); + database.signalRollback(); + throw e; } - catch (Exception e) + finally { - if (currentException != null) - currentException = e; + database.endTransaction(); } + } + catch (Exception e) + { if (currentException != null) - throw currentException; + currentException = e; + } + try + { + super.localCleanUp(); + } + catch (Exception e) + { + if (currentException != null) + currentException = e; } + if (currentException != null) + throw currentException; } }
Modified: manifoldcf/trunk/framework/pull-agent/src/test/java/org/apache/manifoldcf/crawler/tests/ConnectorBaseHSQLDBext.java URL: http://svn.apache.org/viewvc/manifoldcf/trunk/framework/pull-agent/src/test/java/org/apache/manifoldcf/crawler/tests/ConnectorBaseHSQLDBext.java?rev=1377435&r1=1377434&r2=1377435&view=diff ============================================================================== --- manifoldcf/trunk/framework/pull-agent/src/test/java/org/apache/manifoldcf/crawler/tests/ConnectorBaseHSQLDBext.java (original) +++ manifoldcf/trunk/framework/pull-agent/src/test/java/org/apache/manifoldcf/crawler/tests/ConnectorBaseHSQLDBext.java Sun Aug 26 13:37:45 2012 @@ -66,9 +66,10 @@ public class ConnectorBaseHSQLDBext exte public void setUp() throws Exception { + initializeSystem(); try { - localCleanUp(); + localReset(); } catch (Exception e) { @@ -91,9 +92,6 @@ public class ConnectorBaseHSQLDBext exte super.localSetUp(); - // Register the connector we're testing - initialize(); - ManifoldCF.initializeEnvironment(); IThreadContext tc = ThreadContextFactory.make(); IDBInterface database = DBInterfaceFactory.make(tc, @@ -186,145 +184,140 @@ public class ConnectorBaseHSQLDBext exte e.printStackTrace(); throw e; } + cleanupSystem(); } protected void localCleanUp() throws Exception { - initialize(); - if (isInitialized()) + IThreadContext tc = ThreadContextFactory.make(); + + Exception currentException = null; + // First, tear down all jobs, connections, authority connections, and output connections. + try { - // Test the uninstall - ManifoldCF.initializeEnvironment(); - IThreadContext tc = ThreadContextFactory.make(); + IRepositoryConnectionManager connMgr = RepositoryConnectionManagerFactory.make(tc); + IAuthorityConnectionManager authConnMgr = AuthorityConnectionManagerFactory.make(tc); + IOutputConnectionManager outputMgr = OutputConnectionManagerFactory.make(tc); - Exception currentException = null; - // First, tear down all jobs, connections, authority connections, and output connections. - try + // Now, get a list of the repository connections + IRepositoryConnection[] connections = connMgr.getAllConnections(); + int i = 0; + while (i < connections.length) { - IRepositoryConnectionManager connMgr = RepositoryConnectionManagerFactory.make(tc); - IAuthorityConnectionManager authConnMgr = AuthorityConnectionManagerFactory.make(tc); - IOutputConnectionManager outputMgr = OutputConnectionManagerFactory.make(tc); - - // Now, get a list of the repository connections - IRepositoryConnection[] connections = connMgr.getAllConnections(); - int i = 0; - while (i < connections.length) - { - connMgr.delete(connections[i++].getName()); - } - - // Get a list of authority connections - IAuthorityConnection[] authorities = authConnMgr.getAllConnections(); - i = 0; - while (i < authorities.length) - { - authConnMgr.delete(authorities[i++].getName()); - } - - // Finally, get rid of output connections - IOutputConnection[] outputs = outputMgr.getAllConnections(); - i = 0; - while (i < outputs.length) - { - outputMgr.delete(outputs[i++].getName()); - } + connMgr.delete(connections[i++].getName()); + } + // Get a list of authority connections + IAuthorityConnection[] authorities = authConnMgr.getAllConnections(); + i = 0; + while (i < authorities.length) + { + authConnMgr.delete(authorities[i++].getName()); } - catch (Exception e) + + // Finally, get rid of output connections + IOutputConnection[] outputs = outputMgr.getAllConnections(); + i = 0; + while (i < outputs.length) { - currentException = e; + outputMgr.delete(outputs[i++].getName()); } + + } + catch (Exception e) + { + currentException = e; + } + try + { + IDBInterface database = DBInterfaceFactory.make(tc, + ManifoldCF.getMasterDatabaseName(), + ManifoldCF.getMasterDatabaseUsername(), + ManifoldCF.getMasterDatabasePassword()); + + IConnectorManager mgr = ConnectorManagerFactory.make(tc); + IAuthorityConnectorManager authMgr = AuthorityConnectorManagerFactory.make(tc); + IOutputConnectorManager outputMgr = OutputConnectorManagerFactory.make(tc); + IOutputConnectionManager outputConnManager = OutputConnectionManagerFactory.make(tc); + IJobManager jobManager = JobManagerFactory.make(tc); + IRepositoryConnectionManager connManager = RepositoryConnectionManagerFactory.make(tc); + + // Deregistration should be done in a transaction + database.beginTransaction(); try { - IDBInterface database = DBInterfaceFactory.make(tc, - ManifoldCF.getMasterDatabaseName(), - ManifoldCF.getMasterDatabaseUsername(), - ManifoldCF.getMasterDatabasePassword()); - - IConnectorManager mgr = ConnectorManagerFactory.make(tc); - IAuthorityConnectorManager authMgr = AuthorityConnectorManagerFactory.make(tc); - IOutputConnectorManager outputMgr = OutputConnectorManagerFactory.make(tc); - IOutputConnectionManager outputConnManager = OutputConnectionManagerFactory.make(tc); - IJobManager jobManager = JobManagerFactory.make(tc); - IRepositoryConnectionManager connManager = RepositoryConnectionManagerFactory.make(tc); + int i; - // Deregistration should be done in a transaction - database.beginTransaction(); - try - { - int i; - - String[] connectorClasses = getConnectorClasses(); + String[] connectorClasses = getConnectorClasses(); - i = 0; - while (i < connectorClasses.length) - { - // Find the connection names that come with this class - String[] connectionNames = connManager.findConnectionsForConnector(connectorClasses[i]); - // For each connection name, modify the jobs to note that the connector is no longer installed - jobManager.noteConnectorDeregistration(connectionNames); - // Now that all jobs have been placed into an appropriate state, actually do the deregistration itself. - mgr.unregisterConnector(connectorClasses[i]); - i++; - } - - String[] authorityClasses = getAuthorityClasses(); - - i = 0; - while (i < authorityClasses.length) - { - authMgr.unregisterConnector(authorityClasses[i]); - i++; - } - - String[] outputClasses = getOutputClasses(); - - i = 0; - while (i < outputClasses.length) - { - // Find the connection names that come with this class - String[] connectionNames = outputConnManager.findConnectionsForConnector(outputClasses[i]); - // For all connection names, notify all agents of the deregistration - AgentManagerFactory.noteOutputConnectorDeregistration(tc,connectionNames); - // Now that all jobs have been placed into an appropriate state, actually do the deregistration itself. - outputMgr.unregisterConnector(outputClasses[i]); - i++; - } - - } - catch (ManifoldCFException e) + i = 0; + while (i < connectorClasses.length) { - database.signalRollback(); - throw e; + // Find the connection names that come with this class + String[] connectionNames = connManager.findConnectionsForConnector(connectorClasses[i]); + // For each connection name, modify the jobs to note that the connector is no longer installed + jobManager.noteConnectorDeregistration(connectionNames); + // Now that all jobs have been placed into an appropriate state, actually do the deregistration itself. + mgr.unregisterConnector(connectorClasses[i]); + i++; } - catch (Error e) + + String[] authorityClasses = getAuthorityClasses(); + + i = 0; + while (i < authorityClasses.length) { - database.signalRollback(); - throw e; + authMgr.unregisterConnector(authorityClasses[i]); + i++; } - finally + + String[] outputClasses = getOutputClasses(); + + i = 0; + while (i < outputClasses.length) { - database.endTransaction(); + // Find the connection names that come with this class + String[] connectionNames = outputConnManager.findConnectionsForConnector(outputClasses[i]); + // For all connection names, notify all agents of the deregistration + AgentManagerFactory.noteOutputConnectorDeregistration(tc,connectionNames); + // Now that all jobs have been placed into an appropriate state, actually do the deregistration itself. + outputMgr.unregisterConnector(outputClasses[i]); + i++; } + } - catch (Exception e) + catch (ManifoldCFException e) { - if (currentException != null) - currentException = e; + database.signalRollback(); + throw e; } - try + catch (Error e) { - super.localCleanUp(); + database.signalRollback(); + throw e; } - catch (Exception e) + finally { - if (currentException != null) - currentException = e; + database.endTransaction(); } + } + catch (Exception e) + { if (currentException != null) - throw currentException; + currentException = e; + } + try + { + super.localCleanUp(); + } + catch (Exception e) + { + if (currentException != null) + currentException = e; } + if (currentException != null) + throw currentException; } } Modified: manifoldcf/trunk/framework/pull-agent/src/test/java/org/apache/manifoldcf/crawler/tests/ConnectorBaseMySQL.java URL: http://svn.apache.org/viewvc/manifoldcf/trunk/framework/pull-agent/src/test/java/org/apache/manifoldcf/crawler/tests/ConnectorBaseMySQL.java?rev=1377435&r1=1377434&r2=1377435&view=diff ============================================================================== --- manifoldcf/trunk/framework/pull-agent/src/test/java/org/apache/manifoldcf/crawler/tests/ConnectorBaseMySQL.java (original) +++ manifoldcf/trunk/framework/pull-agent/src/test/java/org/apache/manifoldcf/crawler/tests/ConnectorBaseMySQL.java Sun Aug 26 13:37:45 2012 @@ -66,9 +66,10 @@ public class ConnectorBaseMySQL extends public void setUp() throws Exception { + initializeSystem(); try { - localCleanUp(); + localReset(); } catch (Exception e) { @@ -91,9 +92,6 @@ public class ConnectorBaseMySQL extends super.localSetUp(); - // Register the connector we're testing - initialize(); - ManifoldCF.initializeEnvironment(); IThreadContext tc = ThreadContextFactory.make(); IDBInterface database = DBInterfaceFactory.make(tc, @@ -186,145 +184,140 @@ public class ConnectorBaseMySQL extends e.printStackTrace(); throw e; } + cleanupSystem(); } protected void localCleanUp() throws Exception { - initialize(); - if (isInitialized()) + IThreadContext tc = ThreadContextFactory.make(); + + Exception currentException = null; + // First, tear down all jobs, connections, authority connections, and output connections. + try { - // Test the uninstall - ManifoldCF.initializeEnvironment(); - IThreadContext tc = ThreadContextFactory.make(); + IRepositoryConnectionManager connMgr = RepositoryConnectionManagerFactory.make(tc); + IAuthorityConnectionManager authConnMgr = AuthorityConnectionManagerFactory.make(tc); + IOutputConnectionManager outputMgr = OutputConnectionManagerFactory.make(tc); - Exception currentException = null; - // First, tear down all jobs, connections, authority connections, and output connections. - try + // Now, get a list of the repository connections + IRepositoryConnection[] connections = connMgr.getAllConnections(); + int i = 0; + while (i < connections.length) { - IRepositoryConnectionManager connMgr = RepositoryConnectionManagerFactory.make(tc); - IAuthorityConnectionManager authConnMgr = AuthorityConnectionManagerFactory.make(tc); - IOutputConnectionManager outputMgr = OutputConnectionManagerFactory.make(tc); - - // Now, get a list of the repository connections - IRepositoryConnection[] connections = connMgr.getAllConnections(); - int i = 0; - while (i < connections.length) - { - connMgr.delete(connections[i++].getName()); - } - - // Get a list of authority connections - IAuthorityConnection[] authorities = authConnMgr.getAllConnections(); - i = 0; - while (i < authorities.length) - { - authConnMgr.delete(authorities[i++].getName()); - } - - // Finally, get rid of output connections - IOutputConnection[] outputs = outputMgr.getAllConnections(); - i = 0; - while (i < outputs.length) - { - outputMgr.delete(outputs[i++].getName()); - } + connMgr.delete(connections[i++].getName()); + } + // Get a list of authority connections + IAuthorityConnection[] authorities = authConnMgr.getAllConnections(); + i = 0; + while (i < authorities.length) + { + authConnMgr.delete(authorities[i++].getName()); } - catch (Exception e) + + // Finally, get rid of output connections + IOutputConnection[] outputs = outputMgr.getAllConnections(); + i = 0; + while (i < outputs.length) { - currentException = e; + outputMgr.delete(outputs[i++].getName()); } + + } + catch (Exception e) + { + currentException = e; + } + try + { + IDBInterface database = DBInterfaceFactory.make(tc, + ManifoldCF.getMasterDatabaseName(), + ManifoldCF.getMasterDatabaseUsername(), + ManifoldCF.getMasterDatabasePassword()); + + IConnectorManager mgr = ConnectorManagerFactory.make(tc); + IAuthorityConnectorManager authMgr = AuthorityConnectorManagerFactory.make(tc); + IOutputConnectorManager outputMgr = OutputConnectorManagerFactory.make(tc); + IOutputConnectionManager outputConnManager = OutputConnectionManagerFactory.make(tc); + IJobManager jobManager = JobManagerFactory.make(tc); + IRepositoryConnectionManager connManager = RepositoryConnectionManagerFactory.make(tc); + + // Deregistration should be done in a transaction + database.beginTransaction(); try { - IDBInterface database = DBInterfaceFactory.make(tc, - ManifoldCF.getMasterDatabaseName(), - ManifoldCF.getMasterDatabaseUsername(), - ManifoldCF.getMasterDatabasePassword()); - - IConnectorManager mgr = ConnectorManagerFactory.make(tc); - IAuthorityConnectorManager authMgr = AuthorityConnectorManagerFactory.make(tc); - IOutputConnectorManager outputMgr = OutputConnectorManagerFactory.make(tc); - IOutputConnectionManager outputConnManager = OutputConnectionManagerFactory.make(tc); - IJobManager jobManager = JobManagerFactory.make(tc); - IRepositoryConnectionManager connManager = RepositoryConnectionManagerFactory.make(tc); + int i; - // Deregistration should be done in a transaction - database.beginTransaction(); - try - { - int i; - - String[] connectorClasses = getConnectorClasses(); + String[] connectorClasses = getConnectorClasses(); - i = 0; - while (i < connectorClasses.length) - { - // Find the connection names that come with this class - String[] connectionNames = connManager.findConnectionsForConnector(connectorClasses[i]); - // For each connection name, modify the jobs to note that the connector is no longer installed - jobManager.noteConnectorDeregistration(connectionNames); - // Now that all jobs have been placed into an appropriate state, actually do the deregistration itself. - mgr.unregisterConnector(connectorClasses[i]); - i++; - } - - String[] authorityClasses = getAuthorityClasses(); - - i = 0; - while (i < authorityClasses.length) - { - authMgr.unregisterConnector(authorityClasses[i]); - i++; - } - - String[] outputClasses = getOutputClasses(); - - i = 0; - while (i < outputClasses.length) - { - // Find the connection names that come with this class - String[] connectionNames = outputConnManager.findConnectionsForConnector(outputClasses[i]); - // For all connection names, notify all agents of the deregistration - AgentManagerFactory.noteOutputConnectorDeregistration(tc,connectionNames); - // Now that all jobs have been placed into an appropriate state, actually do the deregistration itself. - outputMgr.unregisterConnector(outputClasses[i]); - i++; - } - - } - catch (ManifoldCFException e) + i = 0; + while (i < connectorClasses.length) { - database.signalRollback(); - throw e; + // Find the connection names that come with this class + String[] connectionNames = connManager.findConnectionsForConnector(connectorClasses[i]); + // For each connection name, modify the jobs to note that the connector is no longer installed + jobManager.noteConnectorDeregistration(connectionNames); + // Now that all jobs have been placed into an appropriate state, actually do the deregistration itself. + mgr.unregisterConnector(connectorClasses[i]); + i++; } - catch (Error e) + + String[] authorityClasses = getAuthorityClasses(); + + i = 0; + while (i < authorityClasses.length) { - database.signalRollback(); - throw e; + authMgr.unregisterConnector(authorityClasses[i]); + i++; } - finally + + String[] outputClasses = getOutputClasses(); + + i = 0; + while (i < outputClasses.length) { - database.endTransaction(); + // Find the connection names that come with this class + String[] connectionNames = outputConnManager.findConnectionsForConnector(outputClasses[i]); + // For all connection names, notify all agents of the deregistration + AgentManagerFactory.noteOutputConnectorDeregistration(tc,connectionNames); + // Now that all jobs have been placed into an appropriate state, actually do the deregistration itself. + outputMgr.unregisterConnector(outputClasses[i]); + i++; } + } - catch (Exception e) + catch (ManifoldCFException e) { - if (currentException != null) - currentException = e; + database.signalRollback(); + throw e; } - try + catch (Error e) { - super.localCleanUp(); + database.signalRollback(); + throw e; } - catch (Exception e) + finally { - if (currentException != null) - currentException = e; + database.endTransaction(); } + } + catch (Exception e) + { if (currentException != null) - throw currentException; + currentException = e; + } + try + { + super.localCleanUp(); + } + catch (Exception e) + { + if (currentException != null) + currentException = e; } + if (currentException != null) + throw currentException; } } Modified: manifoldcf/trunk/framework/pull-agent/src/test/java/org/apache/manifoldcf/crawler/tests/ConnectorBasePostgresql.java URL: http://svn.apache.org/viewvc/manifoldcf/trunk/framework/pull-agent/src/test/java/org/apache/manifoldcf/crawler/tests/ConnectorBasePostgresql.java?rev=1377435&r1=1377434&r2=1377435&view=diff ============================================================================== --- manifoldcf/trunk/framework/pull-agent/src/test/java/org/apache/manifoldcf/crawler/tests/ConnectorBasePostgresql.java (original) +++ manifoldcf/trunk/framework/pull-agent/src/test/java/org/apache/manifoldcf/crawler/tests/ConnectorBasePostgresql.java Sun Aug 26 13:37:45 2012 @@ -66,9 +66,10 @@ public class ConnectorBasePostgresql ext public void setUp() throws Exception { + initializeSystem(); try { - localCleanUp(); + localReset(); } catch (Exception e) { @@ -91,9 +92,6 @@ public class ConnectorBasePostgresql ext super.localSetUp(); - // Register the connector we're testing - initialize(); - ManifoldCF.initializeEnvironment(); IThreadContext tc = ThreadContextFactory.make(); IDBInterface database = DBInterfaceFactory.make(tc, @@ -186,145 +184,140 @@ public class ConnectorBasePostgresql ext e.printStackTrace(); throw e; } + cleanupSystem(); } protected void localCleanUp() throws Exception { - initialize(); - if (isInitialized()) + IThreadContext tc = ThreadContextFactory.make(); + + Exception currentException = null; + // First, tear down all jobs, connections, authority connections, and output connections. + try { - // Test the uninstall - ManifoldCF.initializeEnvironment(); - IThreadContext tc = ThreadContextFactory.make(); + IRepositoryConnectionManager connMgr = RepositoryConnectionManagerFactory.make(tc); + IAuthorityConnectionManager authConnMgr = AuthorityConnectionManagerFactory.make(tc); + IOutputConnectionManager outputMgr = OutputConnectionManagerFactory.make(tc); - Exception currentException = null; - // First, tear down all jobs, connections, authority connections, and output connections. - try + // Now, get a list of the repository connections + IRepositoryConnection[] connections = connMgr.getAllConnections(); + int i = 0; + while (i < connections.length) { - IRepositoryConnectionManager connMgr = RepositoryConnectionManagerFactory.make(tc); - IAuthorityConnectionManager authConnMgr = AuthorityConnectionManagerFactory.make(tc); - IOutputConnectionManager outputMgr = OutputConnectionManagerFactory.make(tc); - - // Now, get a list of the repository connections - IRepositoryConnection[] connections = connMgr.getAllConnections(); - int i = 0; - while (i < connections.length) - { - connMgr.delete(connections[i++].getName()); - } - - // Get a list of authority connections - IAuthorityConnection[] authorities = authConnMgr.getAllConnections(); - i = 0; - while (i < authorities.length) - { - authConnMgr.delete(authorities[i++].getName()); - } - - // Finally, get rid of output connections - IOutputConnection[] outputs = outputMgr.getAllConnections(); - i = 0; - while (i < outputs.length) - { - outputMgr.delete(outputs[i++].getName()); - } + connMgr.delete(connections[i++].getName()); + } + // Get a list of authority connections + IAuthorityConnection[] authorities = authConnMgr.getAllConnections(); + i = 0; + while (i < authorities.length) + { + authConnMgr.delete(authorities[i++].getName()); } - catch (Exception e) + + // Finally, get rid of output connections + IOutputConnection[] outputs = outputMgr.getAllConnections(); + i = 0; + while (i < outputs.length) { - currentException = e; + outputMgr.delete(outputs[i++].getName()); } + + } + catch (Exception e) + { + currentException = e; + } + try + { + IDBInterface database = DBInterfaceFactory.make(tc, + ManifoldCF.getMasterDatabaseName(), + ManifoldCF.getMasterDatabaseUsername(), + ManifoldCF.getMasterDatabasePassword()); + + IConnectorManager mgr = ConnectorManagerFactory.make(tc); + IAuthorityConnectorManager authMgr = AuthorityConnectorManagerFactory.make(tc); + IOutputConnectorManager outputMgr = OutputConnectorManagerFactory.make(tc); + IOutputConnectionManager outputConnManager = OutputConnectionManagerFactory.make(tc); + IJobManager jobManager = JobManagerFactory.make(tc); + IRepositoryConnectionManager connManager = RepositoryConnectionManagerFactory.make(tc); + + // Deregistration should be done in a transaction + database.beginTransaction(); try { - IDBInterface database = DBInterfaceFactory.make(tc, - ManifoldCF.getMasterDatabaseName(), - ManifoldCF.getMasterDatabaseUsername(), - ManifoldCF.getMasterDatabasePassword()); - - IConnectorManager mgr = ConnectorManagerFactory.make(tc); - IAuthorityConnectorManager authMgr = AuthorityConnectorManagerFactory.make(tc); - IOutputConnectorManager outputMgr = OutputConnectorManagerFactory.make(tc); - IOutputConnectionManager outputConnManager = OutputConnectionManagerFactory.make(tc); - IJobManager jobManager = JobManagerFactory.make(tc); - IRepositoryConnectionManager connManager = RepositoryConnectionManagerFactory.make(tc); + int i; - // Deregistration should be done in a transaction - database.beginTransaction(); - try - { - int i; - - String[] connectorClasses = getConnectorClasses(); + String[] connectorClasses = getConnectorClasses(); - i = 0; - while (i < connectorClasses.length) - { - // Find the connection names that come with this class - String[] connectionNames = connManager.findConnectionsForConnector(connectorClasses[i]); - // For each connection name, modify the jobs to note that the connector is no longer installed - jobManager.noteConnectorDeregistration(connectionNames); - // Now that all jobs have been placed into an appropriate state, actually do the deregistration itself. - mgr.unregisterConnector(connectorClasses[i]); - i++; - } - - String[] authorityClasses = getAuthorityClasses(); - - i = 0; - while (i < authorityClasses.length) - { - authMgr.unregisterConnector(authorityClasses[i]); - i++; - } - - String[] outputClasses = getOutputClasses(); - - i = 0; - while (i < outputClasses.length) - { - // Find the connection names that come with this class - String[] connectionNames = outputConnManager.findConnectionsForConnector(outputClasses[i]); - // For all connection names, notify all agents of the deregistration - AgentManagerFactory.noteOutputConnectorDeregistration(tc,connectionNames); - // Now that all jobs have been placed into an appropriate state, actually do the deregistration itself. - outputMgr.unregisterConnector(outputClasses[i]); - i++; - } - - } - catch (ManifoldCFException e) + i = 0; + while (i < connectorClasses.length) { - database.signalRollback(); - throw e; + // Find the connection names that come with this class + String[] connectionNames = connManager.findConnectionsForConnector(connectorClasses[i]); + // For each connection name, modify the jobs to note that the connector is no longer installed + jobManager.noteConnectorDeregistration(connectionNames); + // Now that all jobs have been placed into an appropriate state, actually do the deregistration itself. + mgr.unregisterConnector(connectorClasses[i]); + i++; } - catch (Error e) + + String[] authorityClasses = getAuthorityClasses(); + + i = 0; + while (i < authorityClasses.length) { - database.signalRollback(); - throw e; + authMgr.unregisterConnector(authorityClasses[i]); + i++; } - finally + + String[] outputClasses = getOutputClasses(); + + i = 0; + while (i < outputClasses.length) { - database.endTransaction(); + // Find the connection names that come with this class + String[] connectionNames = outputConnManager.findConnectionsForConnector(outputClasses[i]); + // For all connection names, notify all agents of the deregistration + AgentManagerFactory.noteOutputConnectorDeregistration(tc,connectionNames); + // Now that all jobs have been placed into an appropriate state, actually do the deregistration itself. + outputMgr.unregisterConnector(outputClasses[i]); + i++; } + } - catch (Exception e) + catch (ManifoldCFException e) { - if (currentException != null) - currentException = e; + database.signalRollback(); + throw e; } - try + catch (Error e) { - super.localCleanUp(); + database.signalRollback(); + throw e; } - catch (Exception e) + finally { - if (currentException != null) - currentException = e; + database.endTransaction(); } + } + catch (Exception e) + { if (currentException != null) - throw currentException; + currentException = e; + } + try + { + super.localCleanUp(); + } + catch (Exception e) + { + if (currentException != null) + currentException = e; } + if (currentException != null) + throw currentException; } } Modified: manifoldcf/trunk/tests/alfresco/build.xml URL: http://svn.apache.org/viewvc/manifoldcf/trunk/tests/alfresco/build.xml?rev=1377435&r1=1377434&r2=1377435&view=diff ============================================================================== --- manifoldcf/trunk/tests/alfresco/build.xml (original) +++ manifoldcf/trunk/tests/alfresco/build.xml Sun Aug 26 13:37:45 2012 @@ -35,7 +35,7 @@ <!--include name="xercesImpl*.jar"/--> <include name="xmlsec*.jar"/> </fileset> - <fileset dir="../../connectors/alfresco/dist/lib-proprietary"> + <fileset dir="../../connectors/alfresco/dist/lib-proprietary-only"> <include name="*.jar"/> </fileset> </path> Modified: manifoldcf/trunk/tests/jcifs/build.xml URL: http://svn.apache.org/viewvc/manifoldcf/trunk/tests/jcifs/build.xml?rev=1377435&r1=1377434&r2=1377435&view=diff ============================================================================== --- manifoldcf/trunk/tests/jcifs/build.xml (original) +++ manifoldcf/trunk/tests/jcifs/build.xml Sun Aug 26 13:37:45 2012 @@ -21,7 +21,7 @@ <path id="test-classpath"> <path refid="mcf-ino-test-build.test-classpath"/> - <fileset dir="../../connectors/jcifs/dist/lib-proprietary"> + <fileset dir="../../connectors/jcifs/dist/lib-proprietary-only"> <include name="*.jar"/> </fileset> </path>
