The P4DTG test application (p4dtg-test) is a utility used to test the basic operation of the P4DTG system. You will find p4dtg-test located in the home directory of a P4DTG installation. It can be a valuable tool when attempting to debug replication problems, or if you are building your own plug-in using the P4DTG SDK. You can use the test application to directly query and test the various plug-in interfaces.
The interfaces provided by p4dtg-test fall into the following categories:
Library
Exercise the plug-in specific functions. These do not require a connection to any specific server.
Attribute
Functions available for listing, validating, and setting data source attributes prior to connection.
Server
Functions that are available after a base connection to a Defect Tracking Source (DTS) server has been established.
Project
Functions that are available after a connection to a specific project on a connected server has been made.
Defect
Functions that are available after a specific defect from a specific project on a connected server has been retrieved from the DTS server.
For a full list of supported commands, see the online help by starting p4dtg-test then entering help at the prompt:
C:> p4dtg-test.exe> helpMost invocations of p4dtg-test will follow a simple pattern:
Load the plug-in library (LL)You can either start p4dtg-test with no parameters, and then use LL to load the plug-in:
WINDOWS:
C:> p4dtg-test.exe> LL .\plugins\p4jobdt.dllLoading module: [.\plugins\p4jobdt.dll]Module loaded: .\plugins\p4jobdt.dll>LINUX/BSD:
$ p4dtg-test> LL ./plugins/p4jobdt.soLoading module: [./plugins/p4jobdt.so]Module loaded: ./plugins/p4jobdt.so>or pass the plug-in you want to load when starting p4dtg-test: C:> p4dtg-test.exe .\plugins\p4jobdt.dllLoading module: [.\plugins\p4jobdt.dll]Module loaded: .\plugins\p4jobdt.dll>$ p4dtg-test ./plugins/p4jobdt.soLoading module: [./plugins/p4jobdt.so]Module loaded: ./plugins/p4jobdt.so>Connect to a data source (LC) > LC server.com:1666 dtguser dtguserConnecting: [server.com:1666:dtguser:dtguser]Connected.
List available projects, and then load a project (SL, SP) > SLProjects: [Jobs]> SP JobsLoading project: [Jobs]Project loaded.For a Perforce data source, the only project is Jobs. For Bugzilla, the only project is Bugs. For Quality Center and possibly other data sources, you will get a list of defined projects in that data source.
Perform Project and Defect Functions
Some possibilities include:
List the project fields (PS). When connected to a Perforce data source, this is the contents of the job spec. > PSFields: [Job]:[word][4] [Status]:[select][0] [UNCONFIRMED] [NEW] [ASSIGNED] [REOPENED] . . .>Get a list of defects that have changed since some date/time (PL) > PL 10 2010/07/22/00/00/00 ModDate ModBy dtguserDefects: [job000074] [job000075]
Load a defect and get its contents (PD, DL) > PD job000075Defect loaded:[job000075]> DLDefectFields: [Job]:[job000075] [Status]:[UNCONFIRMED] [Assigned_To]:[bruno] [Date]:[2009/07/13 14:02:57] [Summary]:[Summarize the prize] [Resolution]:[NONE] [Priority]:[P5] [Severity]:[normal] [ModDate]:[2009/07/13 14:02:57] [ModBy]:[bruno] [DTGConfig-User]:[dtguser] [DTGConfig-Server]:[10.0.10.100:1666] [DTGAttribute-Unicode server]:[n] [DTGAttribute-Wait time]:[10] [DTGConfig-Project]:[jobs] [DTGConfig-Project]:[Jobs]
Update a defect (DW) > DW Status ASSIGNEDdefect_set_field(Status):[ASSIGNED]> DLDefectFields: [Job]:[job000075] [ModBy]:[bruno] [Assigned_To]:[bruno] [Date]:[2009/07/22 16:10:13] [Summary]:[Summarize the prize] [Resolution]:[NONE] [Priority]:[P5] [Severity]:[normal] [ModDate]:[2009/07/22 16:10:13] [Status]:[ASSIGNED] [DTGConfig-User]:[dtguser] [DTGConfig-Server]:[10.0.10.100:1666] [DTGAttribute-Unicode server]:[n] [DTGAttribute-Wait time]:[10] [DTGConfig-Project]:[jobs] [DTGConfig-Project]:[Jobs]Clean up and exit
This is dependent on exactly what commands you have run up to this point. For example:
> DFDefect freed.> PFProject freed.> SFDisconnected from server.> LFModule freed> QCommands can be added to a text file and passed to p4dtg-test, with output redirected to a file. For example, a file called "commands.txt" with the following contents:
LL .\plugins\p4jobdt.dllLC server.perforce.com:1666 dtguser dtguserSP JobsPSPL 10 2009/07/22/00/00/00 ModDate ModBy dtguserPD job000075DLDFPFSFLFQcan be passed to p4dtg-test as follows, producing output to "output.txt":
p4dtg-test < commands.txt > output.txtUnicode-enabled servers
When P4DTG is run against a Unicode-enabled server, you may get a message similar to the below. Error(1): [UsageError]Unicode server permits only unicode enabled clients.This indicates that the plug-in needs to be in Unicode mode and "AS unicode y" needs to be added in the beginning of the test script.
For example: LL .\plugins\p4jobdt.dllAS unicode yLC server.perforce.com:1666 dtguser dtguser (connect to your server)SP Jobs (load projects)PSPL 10 2009/07/22/00/00/00 ModDate ModBy dtguser (list of defects that have changes since some date/time)PD job000075 (load some defect and get its contents)DLDFPFSFLFQ
No comments:
Post a Comment