diff testing/utp_1.1/utp_fcns/utpCloseConnection.m @ 44:409a22968d5e default

Add unit tests
author Daniele Nicolodi <nicolodi@science.unitn.it>
date Tue, 06 Dec 2011 18:42:11 +0100
parents
children 7d2e2e065cf1
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/testing/utp_1.1/utp_fcns/utpCloseConnection.m	Tue Dec 06 18:42:11 2011 +0100
@@ -0,0 +1,26 @@
+% UTPCLOSECONNECTION closes the connection.
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+%
+% DESCRIPTION: UTPCLOSECONNECTION closes the connection.
+%
+% CALL:        utpGetConnection(conn)
+%
+% VERSION:     $Id: utpCloseConnection.m,v 1.2 2009/09/20 15:38:53 ingo Exp $
+%
+%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
+
+function utpCloseConnection(conn)
+  
+  if isa(conn, 'database')
+    % MATLAB connection
+    if isconnection(conn)
+      close(conn);
+    end
+  elseif isa(conn, 'mpipeline.repository.RepositoryConnection')
+    % java connection
+    conn.closeConnection();
+  else
+    error('### Unknown connection [%s]. Can not close the connection', class(conn));
+  end
+  
+end