Below are the 5 sections relating to this QC connector example:
<?xml version="1.0"?>
<!DOCTYPE config SYSTEM "config.dtd" [
<!ENTITY Encoded-Credentials-Rally SYSTEM "Encoded-Credentials-Rally-jpqc11.xml">
<!ENTITY Encoded-Credentials-QC11 SYSTEM "Encoded-Credentials-QC11.xml">
]>
<!-- **********************************************************************
FILE: RallyUsernameToQcUser.pxml
PURPOSE: An example of a custom field handler which can be used by the QC
connector to map QC's fields "BG_DETECTED_BY" and "BG_RESPONSIBLE"
to Rally's "SubmittedBy" and "Owner" fields on a Defect
(respectively). For example, this mapping will do a translation
as follows:
Rally to QC: "[email protected]" to "jpqc11"
QC to Rally: "jpqc11" to "[email protected]"
For this to work, one must put the Ruby code (below) into a file
named "rally_username_to_qc_user_field_handler.rb", within a
folder named "field_handlers", which must be in your working
folder (i.e. the folder from where the connector is invoked).
USAGE: Replace all the "Your-..." strings below with values appropriate
for your environment.
*********************************************************************** -->
<Config>
<RallyConnection>
<Url>rally1.rallydev.com</Url>
<WorkspaceName>JPKole-Test-WS</WorkspaceName>
<Projects>
<Project>JPKole-Test-Proj</Project>
</Projects>
<!-- <User>...</User>
<Password>...</Password> -->
&Encoded-Credentials-Rally;
<ArtifactType>Defect</ArtifactType>
<ExternalIDField>QCPR01ExtID</ExternalIDField>
<CopySelectors>
<CopySelector>FormattedID = DE372</CopySelector>
</CopySelectors>
</RallyConnection>
<QCConnection>
<Url>vmwin2008qc11.f4tech.com:8080</Url>
<Domain>DEFAULT</Domain>
<Project>JPproject11</Project>
<!-- <User>...</User>
<Password>...</Password> -->
&Encoded-Credentials-QC11;
<ArtifactType>BUG</ArtifactType>
<IDField>BG_BUG_ID</IDField>
<ExternalIDField>BG_USER_01</ExternalIDField>
<ExternalEndUserIDField>BG_USER_03</ExternalEndUserIDField>
<FieldDefaults>
<Field><Name>BG_DETECTION_DATE</Name> <Default>2014-11-04</Default></Field>
<Field><Name>BG_SEVERITY</Name> <Default>1-Low</Default></Field>
</FieldDefaults>
<CopySelectors>
<CopySelector>BG_BUG_ID = 94</CopySelector>
</CopySelectors>
</QCConnection>
<Connector>
<FieldMapping>
<Field><Rally>Name</Rally> <Other>BG_SUMMARY</Other></Field>
<Field><Rally>Description</Rally> <Other>BG_DESCRIPTION</Other></Field>
<Field><Rally>SubmittedBy</Rally> <Other>BG_DETECTED_BY</Other></Field>
<Field><Rally>Owner</Rally> <Other>BG_RESPONSIBLE</Other></Field>
</FieldMapping>
<RallyFieldHandlers>
<RallyUsernameToQcUserFieldHandler>
<FieldName>SubmittedBy</FieldName>
</RallyUsernameToQcUserFieldHandler>
<RallyUsernameToQcUserFieldHandler>
<FieldName>Owner</FieldName>
</RallyUsernameToQcUserFieldHandler>
</RallyFieldHandlers>
</Connector>
<ConnectorRunner>
<Preview>false</Preview>
<LogLevel>Debug</LogLevel>
<Services>COPY_QC_TO_RALLY, COPY_RALLY_TO_QC</Services>
</ConnectorRunner>
</Config>
<User>[email protected]</User>
<Password>encoded-s-e-c-r-e-t-p-w-=-</Password>
<User>jpqc11</User>
<Password>encoded-s-e-c-r-e-t-p-w-=-</Password>
require 'rallyeif/wrk/field_handlers/field_handler'
module RallyEIF
module WRK
module FieldHandlers
class RallyUsernameToQcUserFieldHandler < RallyFieldHandler #{
VALID_REFERENCES = [:Owner, :SubmittedBy]
def initialize(field_name = nil)
super(field_name)
end
def transform_out(artifact)
# "artifact" is a Rally Artifact object
value = @connection.get_value(artifact, @field_name.to_s)
if !value.nil?
usrobj = value.read
RallyLogger.debug(self, "usrobj.UserName: #{usrobj.UserName}")
RallyLogger.debug(self, "usrobj.DisplayName: #{usrobj.DisplayName}")
RallyLogger.debug(self, "usrobj.FirstName: #{usrobj.FirstName}")
RallyLogger.debug(self, "usrobj.MiddleName: #{usrobj.MiddleName}")
RallyLogger.debug(self, "usrobj.LastName: #{usrobj.LastName}")
RallyLogger.debug(self, "usrobj.NickName: #{usrobj.NickName}")
RallyLogger.debug(self, "usrobj.EmailAddress: #{usrobj.EmailAddress}")
# "value" is a "RallyObject" in QC connector versions after 2.8.8
# puts "DEBUG(RallyUsernameToQcUserFieldHandler.transform_out): value.to_s=#{value.to_s}"
myusername = usrobj.UserName
else
myusername = nil
end
if !myusername.nil?
retval = myusername.split("@").first
else
retval = myusername
end
return retval
end
def transform_in(value)
# The parameter "value" is a string containing the QC user name
RallyLogger.debug(self, "value.class=#{value.class}, value=#{value}")
if !value.nil?
retval = value.dup.concat("@rallydev.com")
else
retval = value
end
return retval
end
def read_config(fh_element)
super(fh_element)
fieldname_element_check(fh_element)
if (VALID_REFERENCES.index(@field_name) == nil)
raise UnrecoverableException.new("Field name for RallyUsernameToQcUserFieldHandler must be from " +
"the following set #{VALID_REFERENCES}", self)
end
end
end #} end of "class RallyUsernameToQcUserFieldHandler < RallyFieldHandler"
end
end
end
************************************************************************************************************
rally2_qc_connector version: 4.4.10-72
pid: 1044
starting at: 2014-11-04 18:32:55 Z
cwd: Z:/
configs: x090-rally_username_to_qc_user_field_handler.xml
interval: -1
Work Item Connector Hub version: 0.5.4-391-master/master
RallyConnection spoke version: 4.4.10 using rally_api gem version 1.1.2
QCConnection spoke version: 4.4.10-72-master
************************************************************************************************************
[2014-11-04 18:32:56 Z] INFO : RallyEIF::WRK::ConnectorRunner.show_logging_settings - Log file size set to 5242880
[2014-11-04 18:32:56 Z] INFO : RallyEIF::WRK::ConnectorRunner.show_logging_settings - Log files maximum count set to 10
[2014-11-04 18:32:57 Z] ANY : RallyEIF::WRK::ConnectorRunner.block in run - processing to commence using content from x090-rally_username_to_qc_user_field_handler.xml
[2014-11-04 18:32:58 Z] ANY : Class.read_config_file - x090-rally_username_to_qc_user_field_handler.xml last modified 2014-11-04 18:09:13 UTC, size: 3599 chars
[2014-11-04 18:32:59 Z] ANY : RallyEIF::WRK::RallyConnection.initialize - Initializing Rally connection version 4.4.10
[2014-11-04 18:32:59 Z] INFO : RallyEIF::WRK::RallyConnection.initialize - Rally Web Services version 1.42
[2014-11-04 18:32:59 Z] ANY : RallyEIF::WRK::QCConnection.initialize - Initializing Quality Center connection version 4.4.10
[2014-11-04 18:33:00 Z] INFO : RallyEIF::WRK::Connector.initialize - Ruby platform i386-mingw32
[2014-11-04 18:33:00 Z] INFO : RallyEIF::WRK::Connector.initialize - Ruby version 2.0.0
[2014-11-04 18:33:00 Z] INFO : RallyEIF::WRK::QCConnection.connect - Connecting to Quality Center at http://vmwin2008qc11.f4tech.com:8080/qcbin as user jpqc11
[2014-11-04 18:33:00 Z] DEBUG : RallyEIF::WRK::QCConnection.block in identify_qc_version - Preparing to open Registry to examine: Software\Classes\CLSID\{C5CBD7B2-490C-45f5-8C40-B8C3D108E6D7}\InprocServer32
[2014-11-04 18:33:01 Z] DEBUG : RallyEIF::WRK::QCConnection.block in identify_qc_version - Registry Software\Classes\CLSID\{C5CBD7B2-490C-45f5-8C40-B8C3D108E6D7}\InprocServer32 opened...
[2014-11-04 18:33:01 Z] DEBUG : RallyEIF::WRK::QCConnection.block (2 levels) in identify_qc_version - Registry path to HPQC OTAClient.dll ==> C:\PROGRA~2\COMMON~1\MERCUR~1\TDAPIC~1\OTACLI~1.DLL
[2014-11-04 18:33:01 Z] DEBUG : RallyEIF::WRK::QCConnection.win_path_expanded - expanded Registry path to DLL target: C:/Program Files (x86)/Common Files/Mercury Interactive/TDAPIClient/OTAClient.dll
[2014-11-04 18:33:01 Z] INFO : RallyEIF::WRK::QCConnection.connect - Connected to Quality Center at http://vmwin2008qc11.f4tech.com:8080/qcbin/wcomsrv.dll (version 11.0.0.8258)
[2014-11-04 18:33:02 Z] INFO : RallyEIF::WRK::QCConnection.connect - Domain: DEFAULT
[2014-11-04 18:33:03 Z] INFO : RallyEIF::WRK::QCConnection.connect - Project: JPproject11
[2014-11-04 18:33:03 Z] INFO : RallyEIF::WRK::RallyConnection.connect - Connecting to Rally
[2014-11-04 18:33:03 Z] DEBUG : RallyEIF::WRK::RallyConnection.connect - In connect begin clause - connecting to Rally via rally_api
[2014-11-04 18:33:08 Z] DEBUG : RallyEIF::WRK::RallyConnection.connect - Looking up projects
[2014-11-04 18:33:08 Z] INFO : RallyEIF::WRK::RallyConnection.connect - Connected to Rally at https://rally1.rallydev.com/slm - Workspace: JPKole-Test-WS
[2014-11-04 18:33:08 Z] INFO : RallyEIF::WRK::RallyConnection.connect - Projects: JPKole-Test-Proj
[2014-11-04 18:33:09 Z] INFO : RallyEIF::WRK::Connector.validate - Beginning validation
[2014-11-04 18:33:09 Z] DEBUG : RallyEIF::WRK::RallyConnection.validate - Rally Connection - user entry "[email protected]" detected in config file
[2014-11-04 18:33:10 Z] DEBUG : RallyEIF::WRK::RallyConnection.validate - Rally Connection - password entry detected in config file
[2014-11-04 18:33:10 Z] DEBUG : RallyEIF::WRK::RallyConnection.validate - Rally Connection - artifact type "defect" validated
[2014-11-04 18:33:10 Z] DEBUG : RallyEIF::WRK::RallyConnection.validate - Rally IDField name of "ObjectID" validated
[2014-11-04 18:33:11 Z] DEBUG : RallyEIF::WRK::RallyConnection.validate - Rally ExternalIDField name of "QCPR01ExtID" validated
[2014-11-04 18:33:11 Z] DEBUG : RallyEIF::WRK::RallyConnection.validate - Rally Connection - FieldHandler target fields existence validated
[2014-11-04 18:33:12 Z] DEBUG : RallyEIF::WRK::RallyConnection.validate - Rally Connection - Field Defaults settings validated
[2014-11-04 18:33:12 Z] DEBUG : RallyEIF::WRK::Connector.validate - RallyConnection validate succeeded
[2014-11-04 18:33:12 Z] DEBUG : RallyEIF::WRK::QCConnection.validate - Quality Center Connection - user entry "jpqc11" detected in config file
[2014-11-04 18:33:13 Z] DEBUG : RallyEIF::WRK::QCConnection.validate - Quality Center Connection - password entry detected in config file
[2014-11-04 18:33:13 Z] DEBUG : RallyEIF::WRK::QCConnection.validate - Quality Center Connection - artifact type "bug" validated
[2014-11-04 18:33:14 Z] DEBUG : RallyEIF::WRK::QCConnection.validate - Quality Center IDField name of "BG_BUG_ID" validated
[2014-11-04 18:33:14 Z] DEBUG : RallyEIF::WRK::QCConnection.validate - Quality Center ExternalIDField name of "BG_USER_01" validated
[2014-11-04 18:33:14 Z] DEBUG : RallyEIF::WRK::QCConnection.validate - Quality Center ExternalEndUserIDField name of "BG_USER_03" validated
[2014-11-04 18:33:15 Z] DEBUG : RallyEIF::WRK::QCConnection.validate - Quality Center Connection - FieldHandler target fields existence validated
[2014-11-04 18:33:15 Z] DEBUG : RallyEIF::WRK::QCConnection.validate - Quality Center Connection - Field Defaults settings validated
[2014-11-04 18:33:16 Z] DEBUG : RallyEIF::WRK::Connector.validate - Quality Center Connection validate succeeded
[2014-11-04 18:33:16 Z] DEBUG : RallyEIF::WRK::Connector.block in validate - RallyConnection field_mapping target "Name" existence validated
[2014-11-04 18:33:16 Z] DEBUG : RallyEIF::WRK::Connector.block in validate - Quality Center Connection field_mapping target "BG_SUMMARY" existence validated
[2014-11-04 18:33:17 Z] DEBUG : RallyEIF::WRK::Connector.block in validate - RallyConnection field_mapping target "Description" existence validated
[2014-11-04 18:33:17 Z] DEBUG : RallyEIF::WRK::Connector.block in validate - Quality Center Connection field_mapping target "BG_DESCRIPTION" existence validated
[2014-11-04 18:33:17 Z] DEBUG : RallyEIF::WRK::Connector.block in validate - RallyConnection field_mapping target "SubmittedBy" existence validated
[2014-11-04 18:33:18 Z] DEBUG : RallyEIF::WRK::Connector.block in validate - Quality Center Connection field_mapping target "BG_DETECTED_BY" existence validated
[2014-11-04 18:33:18 Z] DEBUG : RallyEIF::WRK::Connector.block in validate - RallyConnection field_mapping target "Owner" existence validated
[2014-11-04 18:33:18 Z] DEBUG : RallyEIF::WRK::Connector.block in validate - Quality Center Connection field_mapping target "BG_RESPONSIBLE" existence validated
[2014-11-04 18:33:19 Z] DEBUG : RallyEIF::WRK::Connector.block in validate - Rally Connection field_handler validation for "SubmittedBy" succeeded
[2014-11-04 18:33:19 Z] DEBUG : RallyEIF::WRK::Connector.block in validate - Rally Connection field_handler validation for "Owner" succeeded
[2014-11-04 18:33:19 Z] INFO : RallyEIF::WRK::Connector.validate - Validation complete
[2014-11-04 18:33:20 Z] ANY : RallyEIF::WRK::ConnectorRunner.run_services - Last Run 2014-11-04 18:30:47 UTC --- Now 2014-11-04 18:33:20 UTC
[2014-11-04 18:33:20 Z] ANY : RallyEIF::WRK::ConnectorRunner.process_service - Starting Service COPY_QUALITY CENTER_TO_RALLY
[2014-11-04 18:33:20 Z] INFO : RallyEIF::WRK::QCConnection.find_new - find_new query: BG_USER_01 ="" and BG_BUG_ID ="94"
[2014-11-04 18:33:21 Z] INFO : RallyEIF::WRK::QCConnection.find_new - Found 1 New bugs in QC
[2014-11-04 18:33:21 Z] INFO : RallyEIF::WRK::Connector.copy_to_rally - Copy Quality Center bug ID 94 to Rally
[2014-11-04 18:33:21 Z] DEBUG : RallyEIF::WRK::Connector.block in map_fields_to_rally - Mapping BG_SUMMARY(From QC; Test RallyUserNameToQcUserFieldHandler) - to - Name(From QC; Test RallyUserNameToQcUserFieldHandler)
[2014-11-04 18:33:21 Z] DEBUG : RallyEIF::WRK::Connector.block in map_fields_to_rally - Mapping BG_DESCRIPTION(<html>
<body>
<div align="left"><font face="Arial"><span style="font-size:9pt">desc in qc11</span></font></div>
</body>
</html>) - to - Description(<html>
<body>
<div align="left"><font face="Arial"><span style="font-size:9pt">desc in qc11</span></font></div>
</body>
</html>)
[2014-11-04 18:33:22 Z] DEBUG : RallyEIF::WRK::FieldHandlers::RallyUsernameToQcUserFieldHandler.transform_in - value.class=String, value=jpqc11
[2014-11-04 18:33:22 Z] DEBUG : RallyEIF::WRK::Connector.block in map_fields_to_rally - Mapping BG_DETECTED_BY(jpqc11) - to - SubmittedBy([email protected])
[2014-11-04 18:33:23 Z] DEBUG : RallyEIF::WRK::FieldHandlers::RallyUsernameToQcUserFieldHandler.transform_in - value.class=String, value=jpqc11
[2014-11-04 18:33:23 Z] DEBUG : RallyEIF::WRK::Connector.block in map_fields_to_rally - Mapping BG_RESPONSIBLE(jpqc11) - to - Owner([email protected])
[2014-11-04 18:33:24 Z] INFO : RallyEIF::WRK::RallyConnection.create_internal - Created DE536
[2014-11-04 18:33:24 Z] DEBUG : RallyEIF::WRK::QCConnection.update_external_id_fields - set QC Bug BG_BUG_ID: 94 external id field BG_USER_01 --> |24944055948|
[2014-11-04 18:33:25 Z] DEBUG : RallyEIF::WRK::QCConnection.update_external_id_fields - set QC Bug BG_BUG_ID: 94 external end user id field BG_USER_03 --> |DE536|
[2014-11-04 18:33:25 Z] INFO : RallyEIF::WRK::Connector.copy_to_rally - Quality Center bug 94 copied to Rally defect DE536
[2014-11-04 18:33:25 Z] ANY : RallyEIF::WRK::ConnectorRunner.process_service - Finished Service COPY_QUALITY CENTER_TO_RALLY
[2014-11-04 18:33:26 Z] ANY : RallyEIF::WRK::ConnectorRunner.process_service - Starting Service COPY_RALLY_TO_QUALITY CENTER
[2014-11-04 18:33:26 Z] INFO : RallyEIF::WRK::RallyConnection.find_new - Find New Rally defects
[2014-11-04 18:33:26 Z] DEBUG : RallyEIF::WRK::RallyConnection.find_new - Rally using find_new query: (((QCPR01ExtID = "") AND (Project.Name = "JPKole-Test-Proj")) AND (FormattedID = "DE372"))
[2014-11-04 18:33:27 Z] INFO : RallyEIF::WRK::RallyConnection.find_new - Found 1 new defects in Rally
[2014-11-04 18:33:28 Z] INFO : RallyEIF::WRK::Connector.copy_to_other - Copy DE372 to Quality Center
[2014-11-04 18:33:28 Z] DEBUG : RallyEIF::WRK::Connector.block in map_fields_to_other - Mapping Name(From Rally: Test RallyUsernameToQcUserFieldHandler) - to - BG_SUMMARY(From Rally: Test RallyUsernameToQcUserFieldHandler)
[2014-11-04 18:33:28 Z] DEBUG : RallyEIF::WRK::Connector.block in map_fields_to_other - Mapping Description(desc from rally) - to - BG_DESCRIPTION(desc from rally)
[2014-11-04 18:33:29 Z] DEBUG : RallyEIF::WRK::FieldHandlers::RallyUsernameToQcUserFieldHandler.transform_out - usrobj.UserName: [email protected]
[2014-11-04 18:33:29 Z] DEBUG : RallyEIF::WRK::FieldHandlers::RallyUsernameToQcUserFieldHandler.transform_out - usrobj.DisplayName: [email protected]
[2014-11-04 18:33:29 Z] DEBUG : RallyEIF::WRK::FieldHandlers::RallyUsernameToQcUserFieldHandler.transform_out - usrobj.FirstName: John
[2014-11-04 18:33:29 Z] DEBUG : RallyEIF::WRK::FieldHandlers::RallyUsernameToQcUserFieldHandler.transform_out - usrobj.MiddleName: Paul
[2014-11-04 18:33:30 Z] DEBUG : RallyEIF::WRK::FieldHandlers::RallyUsernameToQcUserFieldHandler.transform_out - usrobj.LastName: Kole
[2014-11-04 18:33:30 Z] DEBUG : RallyEIF::WRK::FieldHandlers::RallyUsernameToQcUserFieldHandler.transform_out - usrobj.NickName:
[2014-11-04 18:33:30 Z] DEBUG : RallyEIF::WRK::FieldHandlers::RallyUsernameToQcUserFieldHandler.transform_out - usrobj.EmailAddress: [email protected]
[2014-11-04 18:33:30 Z] DEBUG : RallyEIF::WRK::Connector.block in map_fields_to_other - Mapping SubmittedBy([email protected]) - to - BG_DETECTED_BY(jpqc11)
[2014-11-04 18:33:31 Z] DEBUG : RallyEIF::WRK::FieldHandlers::RallyUsernameToQcUserFieldHandler.transform_out - usrobj.UserName: [email protected]
[2014-11-04 18:33:31 Z] DEBUG : RallyEIF::WRK::FieldHandlers::RallyUsernameToQcUserFieldHandler.transform_out - usrobj.DisplayName: [email protected]
[2014-11-04 18:33:32 Z] DEBUG : RallyEIF::WRK::FieldHandlers::RallyUsernameToQcUserFieldHandler.transform_out - usrobj.FirstName: John
[2014-11-04 18:33:32 Z] DEBUG : RallyEIF::WRK::FieldHandlers::RallyUsernameToQcUserFieldHandler.transform_out - usrobj.MiddleName: Paul
[2014-11-04 18:33:33 Z] DEBUG : RallyEIF::WRK::FieldHandlers::RallyUsernameToQcUserFieldHandler.transform_out - usrobj.LastName: Kole
[2014-11-04 18:33:33 Z] DEBUG : RallyEIF::WRK::FieldHandlers::RallyUsernameToQcUserFieldHandler.transform_out - usrobj.NickName:
[2014-11-04 18:33:33 Z] DEBUG : RallyEIF::WRK::FieldHandlers::RallyUsernameToQcUserFieldHandler.transform_out - usrobj.EmailAddress: [email protected]
[2014-11-04 18:33:33 Z] DEBUG : RallyEIF::WRK::Connector.block in map_fields_to_other - Mapping Owner([email protected]) - to - BG_RESPONSIBLE(jpqc11)
[2014-11-04 18:33:34 Z] DEBUG : RallyEIF::WRK::QCConnection.create_internal - set all artifact fields
[2014-11-04 18:33:34 Z] INFO : RallyEIF::WRK::QCConnection.create_internal - Created bug 101 in QC
[2014-11-04 18:33:34 Z] DEBUG : RallyEIF::WRK::RallyConnection.block in has_changed? - QCPR01ExtID true [ current => || ] [ update => |101| ]
[2014-11-04 18:33:35 Z] INFO : RallyEIF::WRK::RallyConnection.update_internal - Updating DE372
[2014-11-04 18:33:35 Z] INFO : RallyEIF::WRK::Connector.copy_to_other - Rally defect DE372 copied to Quality Center bug 101
[2014-11-04 18:33:36 Z] ANY : RallyEIF::WRK::ConnectorRunner.process_service - Finished Service COPY_RALLY_TO_QUALITY CENTER
[2014-11-04 18:33:38 Z] INFO : RallyEIF::WRK::QCConnection.disconnect - Disconnected from Quality Center
[2014-11-04 18:33:39 Z] ANY : RallyEIF::WRK::ConnectorRunner.run_services - time file written with value of 2014-11-04 18:33:20 UTC
[2014-11-04 18:33:39 Z] ANY : RallyEIF::WRK::ConnectorRunner.block in log_service_statistics - x090-rally_username_to_qc_user_field_handler.xml: 1 items copied from Quality center to Rally
[2014-11-04 18:33:39 Z] ANY : RallyEIF::WRK::ConnectorRunner.block in log_service_statistics - x090-rally_username_to_qc_user_field_handler.xml: 1 items copied from Rally to Quality center
[2014-11-04 18:33:40 Z] ANY : RallyEIF::WRK::ConnectorRunner.log_service_statistics - x090-rally_username_to_qc_user_field_handler.xml: service run took 42 seconds