Hi,
we are using the mentioned ITS and would like to find out if an interface to Gemini ITS from TL could be considered for a future version.
Thanks for a great tool!
Paul
Interface to Gemini ITS (CounterSoft)
Gemini and Testlink
Has anyone managed to get Gemini and Testlink talking to each other?
Interface Gemini working in mssql
Hi,
I'm not a very good programmer but I've make it works with database mssql. My code may can you to make it work on your side.
** Carreful: STATUS & RESOLUTIONS Name(index) are modified in my company **
As you can see, I've started from "int_mantis.php" v1.12
<?php
/**
* TestLink Open Source Project - http://testlink.sourceforge.net/
*
* Filename $RCSfile: int_mantis.php,v $
*
* @version $Revision: 1.12 $
* @modified $Date: 2007/12/19 18:27:06 $ $Author: schlundus $
*
* @author Andreas Morsing
*
* Constants used throughout TestLink are defined within this file
* they should be changed for your environment
*
* 20070304 - franciscom -
* 1. added an specialized version of checkBugID
* 2. added new method checkBugID_existence()
*
*
* 20070302 - BUGID
* Problems on getBugSummaryString($id), when DB is MS SQL
* On MS-SQL fetch_array() does not returns numeric indexes, then
* only choice is accessing my field name (IMHO better)
*
* Removed also DBNAME on Queries because causes problems with MS-SQL
*
**/
/** Interface name */
define('BUG_INTERFACE_CLASSNAME',"geminiInterface");
class geminiInterface extends bugtrackingInterface
{
//members to store the bugtracking information
var $dbHost = BUG_TRACK_DB_HOST;
var $dbName = BUG_TRACK_DB_NAME;
var $dbUser = BUG_TRACK_DB_USER;
var $dbPass = BUG_TRACK_DB_PASS;
var $dbType = BUG_TRACK_DB_TYPE;
var $showBugURL = BUG_TRACK_HREF;
var $enterBugURL = BUG_TRACK_ENTER_BUG_HREF;
private $code_status = array(1 => 'NEW',
2 => 'ASSIGNED',
4 => 'CLOSED',
5 => 'REOPENED',
6 => 'IN TEST',
7 => 'UNASSIGNED',
8 => 'POSTPONED');
private $status_color = array('NEW' => '#ff0000', # red
'ASSIGNED' => '#ffffb0', # yellow
'CLOSED' => '#e8e8e8', # light gray
'REOPENED' => '#ff0000', # red
'IN TEST' => '#c8c8ff', # blue
'UNASSIGNED' => '#ffd850', # orange
'POSTPONED' => '#e8e8e8'); # light gray
/**
* Return the URL to the bugtracking page for viewing
* the bug with the given id.
*
* @param int id the bug id
*
* @return string returns a complete URL to view the bug
**/
function buildViewBugURL($id)
{
return $this->showBugURL.urlencode($id);
}
/**
* Returns the status of the bug with the given id
* this function is not directly called by TestLink.
*
* @return string returns the status of the given bug (if found in the db), or false else
**/
function getBugStatus($id)
{
if (!$this->isConnected())
return false;
$status = false;
// 20070302 - {$this->dbName}.mantis_bug_table -> mantis_bug_table
// Problems with MS-SQL
$query = "SELECT issstatus FROM issues WHERE issueid='$id'";
$result = mssql_query($query);
if ($result)
{
$status = mssql_fetch_array($result);
if ($status)
{
$status = $status['issstatus'];
$status = $this->code_status[$status];
}
else
{
$status = null;
}
}
return $status;
}
/**
* Returns the resolution of the bug with the given id
* this function is not directly called by TestLink.
*
* @return string returns the resolution of the given bug (if found in the db), or false else
**/
function getBugResolution($id)
{
if (!$this->isConnected())
return false;
$status = false;
// 20070302 - {$this->dbName}.mantis_bug_table -> mantis_bug_table
// Problems with MS-SQL
$query = "SELECT issueresolutionlut.resdesc FROM issueresolutionlut INNER JOIN issues ON issueresolutionlut.resid = issues.issresolution WHERE issueid='$id'";
$result = mssql_query($query);
if ($result)
{
$resolution = mssql_fetch_array($result);
if ($resolution)
{
$resolution = $resolution['resdesc'];
//$resolution = $this->code_status[$status];
}
else
{
$resolution = null;
}
}
return $resolution;
}
/**
* Returns the status in a readable form (HTML context) for the bug with the given id
*
* @param int id the bug id
*
* @return string returns the status (in a readable form) of the given bug if the bug
* was found , else false
**/
function getBugStatusString($id)
{
$status = $this->getBugStatus($id);
$resolution = $this->getBugResolution($id);
$str = htmlspecialchars($id);
//if the bug wasn't found the status is null and we simply display the bugID
if ($status !== false)
{
if (($status == 'CLOSED') || ($status == 'POSTPONED'))
$str = "<del>" . $id . "</del>";
else
{
if (($resolution == 'Complete') || ($resolution == 'Not A Bug') || ($resolution == 'Duplicate'))
$str = "<del>" . "[" . $resolution . "] " . $id . "</del>";
else
$str = "[" . $status . "] " . $id . "";
}
}
$color = $this->status_color[$status];
return "<div style=\"display: inline; background: $color;\">$str</div>";
// return $str;
}
/**
* Fetches the bug summary from the matnis db
*
* @param int id the bug id
*
* @return string returns the bug summary if bug is found, else false
**/
function getBugSummaryString($id)
{
if (!$this->isConnected())
return false;
$query = "SELECT summary FROM issues WHERE issueid='$id.'";
$result = mssql_query($query);
if ($result)
{
$summary = mssql_fetch_array($result);
if ($summary)
$summary = $summary['summary'];
else
$summary = null;
}
return $summary;
}
/**
* checks a bug id for validity
*
* @return bool returns true if the bugid has the right format, false else
**/
function checkBugID($id)
{
$status_ok=1;
$ereg_forbidden_chars='[a-zA-Z,$-+]';
if (eregi($ereg_forbidden_chars, $id))
{
$status_ok=0;
}
else
{
$status_ok=(intval($id) > 0);
}
return $status_ok;
}
/**
* checks is bug id is present on BTS
*
* @return bool
**/
function checkBugID_existence($id)
{
$status_ok=0;
$query = "SELECT issstatus FROM issues WHERE issueid='$id'";
$result = mssql_query($query);
if ($result && (mssql_num_rows($result) == 1) )
{
$status_ok=1;
}
return $status_ok;
}
}
?>
******** File2 started from bugzilla.cfg.php,v 1.8 **************************
<?php
/**
* TestLink Open Source Project - http://testlink.sourceforge.net/
* $Id: bugzilla.cfg.php,v 1.8 2008/03/31 14:04:30 franciscom Exp $
*
* Currently the only bug tracking system is bugzilla.
* TestLink uses bugzilla to check if displayed bugs resolved, verified,
* and closed bugs. If they are it will strike through them
*
*/
//Set the bug tracking system Interface
/** DB host to use when connecting to the Gemini db */
define('BUG_TRACK_DB_HOST', 'srvgemini');
/** name of the database that contains the Gemini tables */
define('BUG_TRACK_DB_NAME', 'gemini');
/** useful if you have several schemas see BUGID 1444*/
// define('BUG_TRACK_DB_SCHEMA', '[CONFIGURE_BUG_TRACK_DB_SCHEMA]');
/** DB type used for the bugtracking db */
define('BUG_TRACK_DB_TYPE','mssql');
/** DB user and password to use for connecting to the Gemini db */
define('BUG_TRACK_DB_USER', 'xxxuserxxx');
define('BUG_TRACK_DB_PASS', 'xxxpswxxxx');
/** link of the web server */
define('BUG_TRACK_HREF', "http://srvgemini/gemini/issue/ViewIssue.aspx?id=");
/** link to the bugtracking system, for entering new bugs */
define('BUG_TRACK_ENTER_BUG_HREF',"http://srvgemini/gemini/");
?>
Hope it can help someone!
Nicolas.
I'm not a very good programmer but I've make it works with database mssql. My code may can you to make it work on your side.
** Carreful: STATUS & RESOLUTIONS Name(index) are modified in my company **
As you can see, I've started from "int_mantis.php" v1.12
<?php
/**
* TestLink Open Source Project - http://testlink.sourceforge.net/
*
* Filename $RCSfile: int_mantis.php,v $
*
* @version $Revision: 1.12 $
* @modified $Date: 2007/12/19 18:27:06 $ $Author: schlundus $
*
* @author Andreas Morsing
*
* Constants used throughout TestLink are defined within this file
* they should be changed for your environment
*
* 20070304 - franciscom -
* 1. added an specialized version of checkBugID
* 2. added new method checkBugID_existence()
*
*
* 20070302 - BUGID
* Problems on getBugSummaryString($id), when DB is MS SQL
* On MS-SQL fetch_array() does not returns numeric indexes, then
* only choice is accessing my field name (IMHO better)
*
* Removed also DBNAME on Queries because causes problems with MS-SQL
*
**/
/** Interface name */
define('BUG_INTERFACE_CLASSNAME',"geminiInterface");
class geminiInterface extends bugtrackingInterface
{
//members to store the bugtracking information
var $dbHost = BUG_TRACK_DB_HOST;
var $dbName = BUG_TRACK_DB_NAME;
var $dbUser = BUG_TRACK_DB_USER;
var $dbPass = BUG_TRACK_DB_PASS;
var $dbType = BUG_TRACK_DB_TYPE;
var $showBugURL = BUG_TRACK_HREF;
var $enterBugURL = BUG_TRACK_ENTER_BUG_HREF;
private $code_status = array(1 => 'NEW',
2 => 'ASSIGNED',
4 => 'CLOSED',
5 => 'REOPENED',
6 => 'IN TEST',
7 => 'UNASSIGNED',
8 => 'POSTPONED');
private $status_color = array('NEW' => '#ff0000', # red
'ASSIGNED' => '#ffffb0', # yellow
'CLOSED' => '#e8e8e8', # light gray
'REOPENED' => '#ff0000', # red
'IN TEST' => '#c8c8ff', # blue
'UNASSIGNED' => '#ffd850', # orange
'POSTPONED' => '#e8e8e8'); # light gray
/**
* Return the URL to the bugtracking page for viewing
* the bug with the given id.
*
* @param int id the bug id
*
* @return string returns a complete URL to view the bug
**/
function buildViewBugURL($id)
{
return $this->showBugURL.urlencode($id);
}
/**
* Returns the status of the bug with the given id
* this function is not directly called by TestLink.
*
* @return string returns the status of the given bug (if found in the db), or false else
**/
function getBugStatus($id)
{
if (!$this->isConnected())
return false;
$status = false;
// 20070302 - {$this->dbName}.mantis_bug_table -> mantis_bug_table
// Problems with MS-SQL
$query = "SELECT issstatus FROM issues WHERE issueid='$id'";
$result = mssql_query($query);
if ($result)
{
$status = mssql_fetch_array($result);
if ($status)
{
$status = $status['issstatus'];
$status = $this->code_status[$status];
}
else
{
$status = null;
}
}
return $status;
}
/**
* Returns the resolution of the bug with the given id
* this function is not directly called by TestLink.
*
* @return string returns the resolution of the given bug (if found in the db), or false else
**/
function getBugResolution($id)
{
if (!$this->isConnected())
return false;
$status = false;
// 20070302 - {$this->dbName}.mantis_bug_table -> mantis_bug_table
// Problems with MS-SQL
$query = "SELECT issueresolutionlut.resdesc FROM issueresolutionlut INNER JOIN issues ON issueresolutionlut.resid = issues.issresolution WHERE issueid='$id'";
$result = mssql_query($query);
if ($result)
{
$resolution = mssql_fetch_array($result);
if ($resolution)
{
$resolution = $resolution['resdesc'];
//$resolution = $this->code_status[$status];
}
else
{
$resolution = null;
}
}
return $resolution;
}
/**
* Returns the status in a readable form (HTML context) for the bug with the given id
*
* @param int id the bug id
*
* @return string returns the status (in a readable form) of the given bug if the bug
* was found , else false
**/
function getBugStatusString($id)
{
$status = $this->getBugStatus($id);
$resolution = $this->getBugResolution($id);
$str = htmlspecialchars($id);
//if the bug wasn't found the status is null and we simply display the bugID
if ($status !== false)
{
if (($status == 'CLOSED') || ($status == 'POSTPONED'))
$str = "<del>" . $id . "</del>";
else
{
if (($resolution == 'Complete') || ($resolution == 'Not A Bug') || ($resolution == 'Duplicate'))
$str = "<del>" . "[" . $resolution . "] " . $id . "</del>";
else
$str = "[" . $status . "] " . $id . "";
}
}
$color = $this->status_color[$status];
return "<div style=\"display: inline; background: $color;\">$str</div>";
// return $str;
}
/**
* Fetches the bug summary from the matnis db
*
* @param int id the bug id
*
* @return string returns the bug summary if bug is found, else false
**/
function getBugSummaryString($id)
{
if (!$this->isConnected())
return false;
$query = "SELECT summary FROM issues WHERE issueid='$id.'";
$result = mssql_query($query);
if ($result)
{
$summary = mssql_fetch_array($result);
if ($summary)
$summary = $summary['summary'];
else
$summary = null;
}
return $summary;
}
/**
* checks a bug id for validity
*
* @return bool returns true if the bugid has the right format, false else
**/
function checkBugID($id)
{
$status_ok=1;
$ereg_forbidden_chars='[a-zA-Z,$-+]';
if (eregi($ereg_forbidden_chars, $id))
{
$status_ok=0;
}
else
{
$status_ok=(intval($id) > 0);
}
return $status_ok;
}
/**
* checks is bug id is present on BTS
*
* @return bool
**/
function checkBugID_existence($id)
{
$status_ok=0;
$query = "SELECT issstatus FROM issues WHERE issueid='$id'";
$result = mssql_query($query);
if ($result && (mssql_num_rows($result) == 1) )
{
$status_ok=1;
}
return $status_ok;
}
}
?>
******** File2 started from bugzilla.cfg.php,v 1.8 **************************
<?php
/**
* TestLink Open Source Project - http://testlink.sourceforge.net/
* $Id: bugzilla.cfg.php,v 1.8 2008/03/31 14:04:30 franciscom Exp $
*
* Currently the only bug tracking system is bugzilla.
* TestLink uses bugzilla to check if displayed bugs resolved, verified,
* and closed bugs. If they are it will strike through them
*
*/
//Set the bug tracking system Interface
/** DB host to use when connecting to the Gemini db */
define('BUG_TRACK_DB_HOST', 'srvgemini');
/** name of the database that contains the Gemini tables */
define('BUG_TRACK_DB_NAME', 'gemini');
/** useful if you have several schemas see BUGID 1444*/
// define('BUG_TRACK_DB_SCHEMA', '[CONFIGURE_BUG_TRACK_DB_SCHEMA]');
/** DB type used for the bugtracking db */
define('BUG_TRACK_DB_TYPE','mssql');
/** DB user and password to use for connecting to the Gemini db */
define('BUG_TRACK_DB_USER', 'xxxuserxxx');
define('BUG_TRACK_DB_PASS', 'xxxpswxxxx');
/** link of the web server */
define('BUG_TRACK_HREF', "http://srvgemini/gemini/issue/ViewIssue.aspx?id=");
/** link to the bugtracking system, for entering new bugs */
define('BUG_TRACK_ENTER_BUG_HREF',"http://srvgemini/gemini/");
?>
Hope it can help someone!
Nicolas.