test.xts 27 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559
  1. <?xml version="1.0" encoding="UTF-8"?>
  2. <!--
  3. Licensed Materials - Property of IBM
  4. IBM Cognos Products: ps
  5. (C) Copyright IBM Corp. 2005, 2014
  6. US Government Users Restricted Rights - Use, duplication or disclosure restricted by GSA ADP Schedule Contract with IBM Corp.
  7. -->
  8. <!--
  9. Copyright (C) 2008 Cognos ULC, an IBM Company. All rights reserved.
  10. Cognos (R) is a trademark of Cognos ULC, (formerly Cognos Incorporated).
  11. -->
  12. <xts:morphlet xmlns:xts="http://developer.cognos.com/schemas/xts/" messageBase="messages/portal.xml, messages/portalRL.xml" requiredCapability="canUseDataSourcesTool">
  13. <xts:block id="loadMetadata" type="exec" mode="interpret" processor="XML" nodelist="">
  14. <xts:sequence>
  15. <xts:append>
  16. <xts:transform src="/transforms/portal/dataSource/generateDatasourceMetadata.xslt" processor="XSLT">
  17. <xts:param name="messageBase">/messages/portal.xml</xts:param>
  18. <root/>
  19. </xts:transform>
  20. <installedComponents>
  21. <xts:function name="getConfiguration">
  22. <xts:param name="installedComponents"/>
  23. </xts:function>
  24. </installedComponents>
  25. </xts:append>
  26. </xts:sequence>
  27. </xts:block>
  28. <xts:block id="splitConnectionString" dependency="loadMetadata" processor="XSLT" type="exec" nodelist="datasources,command">
  29. <xsl:stylesheet version="1.0"
  30. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  31. xmlns:test="http://developer.cognos.com/schemas/xts/portal/iTestDataSource/1/"
  32. exclude-result-prefixes="xsl test">
  33. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  34. <xsl:key name="connectionMetadata" match="/root/datasources/datasource" use="code"/>
  35. <xsl:template match="/root">
  36. <xts:sequence>
  37. <xts:replace select="/root/command/*/connectionString">
  38. <xsl:for-each select="/root/command/*/connectionString">
  39. <xsl:call-template name="split-connectionString">
  40. <xsl:with-param name="connectionString" select="."/>
  41. </xsl:call-template>
  42. </xsl:for-each>
  43. </xts:replace>
  44. </xts:sequence>
  45. </xsl:template>
  46. <xsl:template name="split-connectionString">
  47. <xsl:param name="connectionString"/>
  48. <xsl:variable name="seperatorSequence" select="'IBM_JD_CNX_STR:'"/>
  49. <!-- Split the connection strings -->
  50. <xsl:variable name="firstPart">
  51. <xsl:choose>
  52. <xsl:when test="contains($connectionString, $seperatorSequence)">
  53. <xsl:value-of select="substring-before($connectionString, $seperatorSequence)"/>
  54. </xsl:when>
  55. <xsl:otherwise>
  56. <xsl:value-of select="$connectionString"/>
  57. </xsl:otherwise>
  58. </xsl:choose>
  59. </xsl:variable>
  60. <xsl:variable name="secondPart">
  61. <xsl:value-of select="substring-after($connectionString, $seperatorSequence)"/>
  62. </xsl:variable>
  63. <!-- Lookup the metadata for each connection string -->
  64. <xsl:variable name="firstPart-metadata">
  65. <xsl:call-template name="get-metadataEntry">
  66. <xsl:with-param name="connectionString" select="$firstPart"/>
  67. </xsl:call-template>
  68. </xsl:variable>
  69. <xsl:variable name="secondPart-metadata">
  70. <xsl:call-template name="get-metadataEntry">
  71. <xsl:with-param name="connectionString" select="$secondPart"/>
  72. </xsl:call-template>
  73. </xsl:variable>
  74. <!-- Generate the replacement connectionString elements using information from the metadata -->
  75. <xsl:if test="$firstPart-metadata">
  76. <xsl:for-each select="$firstPart-metadata/datasource/testConnectionProvider">
  77. <connectionString target="{string(.)}" code="{$firstPart-metadata/datasource/code}">
  78. <xsl:value-of select="$firstPart"/>
  79. </connectionString>
  80. </xsl:for-each>
  81. </xsl:if>
  82. <xsl:if test="$secondPart != ''">
  83. <xsl:for-each select="$secondPart-metadata/datasource/testConnectionProvider">
  84. <connectionString target="{string(.)}" code="{$secondPart-metadata/datasource/code}">
  85. <xsl:value-of select="$secondPart"/>
  86. </connectionString>
  87. </xsl:for-each>
  88. </xsl:if>
  89. </xsl:template>
  90. <!-- looks up the metadata entry for the specified connection string. -->
  91. <xsl:template name="get-metadataEntry">
  92. <xsl:param name="connectionString"/>
  93. <xsl:if test="$connectionString != ''">
  94. <xsl:variable name="connectionType" select="substring-before(substring-after($connectionString, ';LOCAL;'),';')"/>
  95. <xsl:choose>
  96. <xsl:when test="key('connectionMetadata',$connectionType)[not(patternMatch)]">
  97. <xsl:copy-of select="key('connectionMetadata',$connectionType)[testConnectionProvider]"/>
  98. </xsl:when>
  99. <xsl:when test="count(key('connectionMetadata',$connectionType)[patternMatch])>0">
  100. <xsl:for-each select="key('connectionMetadata',$connectionType)[testConnectionProvider and patternMatch]">
  101. <xsl:choose>
  102. <xsl:when test="patternMatch/@match='contains' and contains($connectionString, patternMatch)">
  103. <xsl:copy-of select="."/>
  104. </xsl:when>
  105. <xsl:when test="patternMatch/@match='excludes' and not(contains($connectionString, patternMatch))">
  106. <xsl:copy-of select="."/>
  107. </xsl:when>
  108. </xsl:choose>
  109. </xsl:for-each>
  110. </xsl:when>
  111. <xsl:when test="count(key('connectionMetadata',substring-before($connectionType,'-')))=1">
  112. <!-- A special case for generic jdbc. The generic jdbc data source use the code JDBC, but each sub-type uses it's own code like JDBC-XX. -->
  113. <xsl:copy-of select="key('connectionMetadata',substring-before($connectionType,'-'))[testConnectionProvider]"/>
  114. </xsl:when>
  115. <xsl:otherwise>
  116. <!-- We don't know the type, so generate metadata that will cause it to be tested on both stacks -->
  117. <datasource>
  118. <code><xsl:value-of select="$connectionType"/></code>
  119. <testConnectionProvider>metadataService</testConnectionProvider>
  120. <testConnectionProvider>queryService</testConnectionProvider>
  121. </datasource>
  122. </xsl:otherwise>
  123. </xsl:choose>
  124. </xsl:if>
  125. </xsl:template>
  126. </xsl:stylesheet>
  127. </xts:block>
  128. <xts:block id="getDispatcherDetails" processor="XSLT" type="exec" condition="count(/root/command/*[local-name()='testDataSourceConnection']/dispatcher) > 0" mandatory="false">
  129. <xts:logicsheet path="logicsheets/buslogic.xslt"/>
  130. <xsl:stylesheet version="1.0"
  131. xmlns:xsl="http://www.w3.org/1999/XSL/Transform"
  132. xmlns:send="http://developer.cognos.com/schemas/xts/logic-sheet/xslt/brl/1/"
  133. xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt"
  134. xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/">
  135. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  136. <xsl:template match="/">
  137. <xts:sequence>
  138. <xts:append>
  139. <content>
  140. <xts:transform src="transforms/CM/post-process.xslt" processor="XSLT">
  141. <send:request provider="cm">
  142. <xts:transform src="transforms/CM/pre-process.xslt" processor="XSLT">
  143. <!-- We need dispatchers that use the metadataService separately from those that use the query service -->
  144. <cm:query>
  145. <cm:requests>
  146. <cm:query>
  147. <cm:search>/configuration//*[@objectClass='metadataService']/parent::*</cm:search>
  148. <cm:properties>
  149. <cm:property name="defaultName"/>
  150. <cm:property name="ancestors"/>
  151. <cm:property name="dispatcherID"/>
  152. <cm:property name="iconURI"/>
  153. <cm:property name="defaultScreenTip"/>
  154. </cm:properties>
  155. </cm:query>
  156. <cm:query>
  157. <cm:search>/configuration//*[@objectClass='queryService']/parent::*</cm:search>
  158. <cm:properties>
  159. <cm:property name="defaultName"/>
  160. <cm:property name="ancestors"/>
  161. <cm:property name="dispatcherID"/>
  162. <cm:property name="iconURI"/>
  163. <cm:property name="defaultScreenTip"/>
  164. </cm:properties>
  165. </cm:query>
  166. <cm:query>
  167. <cm:search>/configuration//*[@objectClass='contentManagerService']/parent::*</cm:search>
  168. <cm:properties>
  169. <cm:property name="defaultName"/>
  170. <cm:property name="ancestors"/>
  171. <cm:property name="dispatcherID"/>
  172. <cm:property name="iconURI"/>
  173. <cm:property name="defaultScreenTip"/>
  174. </cm:properties>
  175. </cm:query>
  176. </cm:requests>
  177. </cm:query>
  178. </xts:transform>
  179. </send:request>
  180. </xts:transform>
  181. </content>
  182. </xts:append>
  183. <!-- Historically, when displaying the path to the dispather we do not include the Configuration object. -->
  184. <xts:delete select="/root/content/*[local-name() = 'queryResponse']/*[local-name()='queryReply']/*[local-name() = 'dispatcher']/*[local-name() = 'ancestors']/*[local-name() = 'ancestorInfo'][1]"/>
  185. </xts:sequence>
  186. </xsl:template>
  187. </xsl:stylesheet>
  188. </xts:block>
  189. <xts:block id="doTest" processor="XSLT" type="exec" dependency="splitConnectionString getDispatcherDetails">
  190. <xts:logicsheet path="logicsheets/portal.xsl"/>
  191. <xts:logicsheet path="logicsheets/buslogic.xslt"/>
  192. <xts:logicsheet path="logicsheets/presentation/controls/framework.xsl"/>
  193. <xts:logicsheet path="logicsheets/presentation/controls/presentation.xsl"/>
  194. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
  195. xmlns:pf="http://developer.cognos.com/schemas/xts/pf"
  196. xmlns:test="http://developer.cognos.com/schemas/xts/portal/iTestDataSource/1/"
  197. xmlns:send="http://developer.cognos.com/schemas/xts/logic-sheet/xslt/brl/1/"
  198. xmlns:cf="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/controls/framework/"
  199. xmlns:cp="http://developer.cognos.com/schemas/xts/logicsheets/xslt/presentation/controls/presentation/"
  200. xmlns:md1="http://developer.cognos.com/schemas/metadataService/1"
  201. xmlns:qs1="http://developer.cognos.com/schemas/queryService/1"
  202. xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
  203. xmlns:bus="http://developer.cognos.com/schemas/bibus/3/"
  204. xmlns:cm="http://developer.cognos.com/schemas/xts-cm/1/"
  205. xmlns:xts="http://developer.cognos.com/schemas/xts/"
  206. xmlns:xtsext="xalan://com.cognos.xts.ext.XTSExt"
  207. exclude-result-prefixes="xts xsl pf test send md1 qs1 xsi bus cm cf cp xtsext">
  208. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  209. <xsl:key name="dispatchers" match="/root/content/cm:queryResponse/cm:queryReply/cm:dispatcher" use="cm:dispatcherID"/>
  210. <xsl:key name="mdsDispatchers" match="/root/content/cm:queryResponse/cm:queryReply[1]/cm:dispatcher" use="cm:dispatcherID"/>
  211. <xsl:key name="qsDispatchers" match="/root/content/cm:queryResponse/cm:queryReply[2]/cm:dispatcher" use="cm:dispatcherID"/>
  212. <xsl:key name="cmDispatchers" match="/root/content/cm:queryResponse/cm:queryReply[3]/cm:dispatcher" use="cm:dispatcherID"/>
  213. <xsl:key name="connectionMetadata" match="/root/datasources/datasource[testConnectionProvider]" use="code"/>
  214. <xsl:variable name="queryServiceIsInstalled" select="/root/installedComponents/configuration/property/component[string(.)='queryService']"/>
  215. <pf:variables/>
  216. <xsl:template match="/root">
  217. <xsl:variable name="connectionStrings" select="command/test:testDataSourceConnection/connectionString"/>
  218. <xsl:variable name="dispatchers" select="command/test:testDataSourceConnection/dispatcher"/>
  219. <xsl:variable name="credentials" select="command/test:testDataSourceConnection/credentials"/>
  220. <xts:sequence>
  221. <xts:append>
  222. <testResults>
  223. <xsl:for-each select="$connectionStrings">
  224. <xsl:variable name="connectionString" select="."/>
  225. <xsl:variable name="target" select="$connectionString/@target"/>
  226. <xsl:if test="$target != 'queryService' or $queryServiceIsInstalled">
  227. <xsl:choose>
  228. <xsl:when test="$dispatchers[@id != '']">
  229. <xsl:for-each select="$dispatchers[@id != '']">
  230. <dispatcher id="{@id}">
  231. <connectionString><xsl:value-of select="$connectionString"/></connectionString>
  232. <displayName><xsl:value-of select="key('dispatchers', @id)[1]/cm:defaultName"/></displayName>
  233. <displayPath>
  234. <cf:do-the-path-link>
  235. <cf:param name="familytree">key('dispatchers', @id)[1]/cm:ancestors</cf:param>
  236. <cf:param name="familymember">key('dispatchers', @id)[1]/cm:defaultName</cf:param>
  237. <cf:param name="onlyAncestors">true</cf:param>
  238. </cf:do-the-path-link>
  239. </displayPath>
  240. <displayIcon>
  241. <xsl:call-template name="gen-dispatcher-icon">
  242. <xsl:with-param name="id" select="@id"/>
  243. </xsl:call-template>
  244. </displayIcon>
  245. <displayScreenTip>
  246. <xsl:value-of select="key('dispatchers', @id)[1]/cm:defaultName"/>
  247. <xsl:if test="key('dispatchers', @id)[1]/cm:defaultScreenTip != '' ">
  248. <xsl:text/> - <xsl:value-of select="key('dispatchers', @id)[1]/cm:defaultScreenTip"/>
  249. </xsl:if>
  250. </displayScreenTip>
  251. <connectionType>
  252. <xsl:call-template name="gen-displayType">
  253. <xsl:with-param name="connectionString" select="$connectionString"/>
  254. </xsl:call-template>
  255. </connectionType>
  256. <xsl:choose>
  257. <xsl:when test="$target='metadataService'">
  258. <connectionStack><xts:string id="IDS_TEST_CONNECTION_STACK_CLASSIC"/></connectionStack>
  259. <send:request provider="metadataService" affinity=".server" faultBlock="faultHandler" directedRequest="@id">
  260. <xsl:call-template name="buildTestConnectionRequestWrapper">
  261. <xsl:with-param name="connectionString" select="$connectionString"/>
  262. <xsl:with-param name="credentials" select="$credentials"/>
  263. <xsl:with-param name="target" select="$target"/>
  264. </xsl:call-template>
  265. </send:request>
  266. </xsl:when>
  267. <xsl:when test="$target='queryService'">
  268. <connectionStack><xts:string id="IDS_TEST_CONNECTION_STACK_V5"/></connectionStack>
  269. <send:request provider="queryService" affinity=".server" faultBlock="faultHandler" directedRequest="@id">
  270. <xsl:call-template name="buildTestConnectionRequestWrapper">
  271. <xsl:with-param name="connectionString" select="$connectionString"/>
  272. <xsl:with-param name="credentials" select="$credentials"/>
  273. <xsl:with-param name="target" select="$target"/>
  274. </xsl:call-template>
  275. </send:request>
  276. </xsl:when>
  277. <xsl:when test="$target='contentManagerService'">
  278. <xsl:choose>
  279. <xsl:when test="contains($connectionString, 'com.ibm.cognos.cm.fileSystemPlugin.FileSystemArchivePlugin')">
  280. <connectionStack><xts:string id="IDS_PROP_CONN_FILESYSTEM"/></connectionStack>
  281. </xsl:when>
  282. <xsl:when test="contains($connectionString, 'com.ibm.cognos.cm.CMISRepository.CMISRepositoryPlugin')">
  283. <xsl:choose>
  284. <xsl:when test="contains($connectionString, 'PROVIDER=CM8')">
  285. <connectionStack><xts:string id="IDS_PROP_CONN_CM"/></connectionStack>
  286. </xsl:when>
  287. <xsl:otherwise>
  288. <connectionStack><xts:string id="IDS_PROP_CONN_FILENET"/></connectionStack>
  289. </xsl:otherwise>
  290. </xsl:choose>
  291. </xsl:when>
  292. <xsl:otherwise>
  293. <connectionStack><xts:string id="IDS_TEST_CONNECTION_STACK_REPOSITORY"/></connectionStack>
  294. </xsl:otherwise>
  295. </xsl:choose>
  296. <send:request provider="cm" faultBlock="faultHandler">
  297. <xsl:call-template name="buildTestConnectionRequestWrapper">
  298. <xsl:with-param name="connectionString" select="$connectionString"/>
  299. <xsl:with-param name="credentials" select="$credentials"/>
  300. <xsl:with-param name="target" select="$target"/>
  301. </xsl:call-template>
  302. </send:request>
  303. </xsl:when>
  304. </xsl:choose>
  305. </dispatcher>
  306. </xsl:for-each>
  307. </xsl:when>
  308. <xsl:otherwise>
  309. <dispatcher>
  310. <connectionString><xsl:value-of select="$connectionString"/></connectionString>
  311. <connectionType>
  312. <xsl:call-template name="gen-displayType">
  313. <xsl:with-param name="connectionString" select="$connectionString"/>
  314. </xsl:call-template>
  315. </connectionType>
  316. <xsl:choose>
  317. <xsl:when test="$connectionString/@target='metadataService'">
  318. <connectionStack><xts:string id="IDS_TEST_CONNECTION_STACK_CLASSIC"/></connectionStack>
  319. <send:request provider="metadataService" faultBlock="faultHandler">
  320. <xsl:call-template name="buildTestConnectionRequestWrapper">
  321. <xsl:with-param name="connectionString" select="$connectionString"/>
  322. <xsl:with-param name="credentials" select="$credentials"/>
  323. <xsl:with-param name="target" select="$target"/>
  324. </xsl:call-template>
  325. </send:request>
  326. </xsl:when>
  327. <xsl:when test="$connectionString/@target='queryService'">
  328. <connectionStack><xts:string id="IDS_TEST_CONNECTION_STACK_V5"/></connectionStack>
  329. <send:request provider="queryService" faultBlock="faultHandler">
  330. <xsl:call-template name="buildTestConnectionRequestWrapper">
  331. <xsl:with-param name="connectionString" select="$connectionString"/>
  332. <xsl:with-param name="credentials" select="$credentials"/>
  333. <xsl:with-param name="target" select="$target"/>
  334. </xsl:call-template>
  335. </send:request>
  336. </xsl:when>
  337. <xsl:when test="$connectionString/@target='contentManagerService'">
  338. <xsl:choose>
  339. <xsl:when test="contains($connectionString, 'com.ibm.cognos.cm.fileSystemPlugin.FileSystemArchivePlugin')">
  340. <connectionStack><xts:string id="IDS_PROP_CONN_FILESYSTEM"/></connectionStack>
  341. </xsl:when>
  342. <xsl:when test="contains($connectionString, 'com.ibm.cognos.cm.CMISRepository.CMISRepositoryPlugin')">
  343. <xsl:choose>
  344. <xsl:when test="contains($connectionString, 'PROVIDER=CM8')">
  345. <connectionStack><xts:string id="IDS_PROP_CONN_CM"/></connectionStack>
  346. </xsl:when>
  347. <xsl:otherwise>
  348. <connectionStack><xts:string id="IDS_PROP_CONN_FILENET"/></connectionStack>
  349. </xsl:otherwise>
  350. </xsl:choose>
  351. </xsl:when>
  352. <xsl:otherwise>
  353. <connectionStack><xts:string id="IDS_TEST_CONNECTION_STACK_REPOSITORY"/></connectionStack>
  354. </xsl:otherwise>
  355. </xsl:choose>
  356. <send:request provider="contentManagerService" faultBlock="faultHandler">
  357. <xsl:call-template name="buildTestConnectionRequestWrapper">
  358. <xsl:with-param name="connectionString" select="$connectionString"/>
  359. <xsl:with-param name="credentials" select="$credentials"/>
  360. <xsl:with-param name="target" select="$target"/>
  361. </xsl:call-template>
  362. </send:request>
  363. </xsl:when>
  364. </xsl:choose>
  365. </dispatcher>
  366. </xsl:otherwise>
  367. </xsl:choose>
  368. </xsl:if>
  369. </xsl:for-each>
  370. </testResults>
  371. </xts:append>
  372. </xts:sequence>
  373. </xsl:template>
  374. <xsl:template name="buildTestConnectionRequestWrapper">
  375. <xsl:param name="connectionString"/>
  376. <xsl:param name="credentials"/>
  377. <xsl:param name="target"/>
  378. <!-- The preferred way would be to use <xsl:element namespace="TARGET NAMESPACE"/>, but a
  379. jd bug prevents us from using it because child nodes end up in null namespace. -->
  380. <xsl:choose>
  381. <xsl:when test="$target = 'metadataService'">
  382. <md1:testDataSourceConnection>
  383. <xsl:call-template name="buildTestConnectionRequest">
  384. <xsl:with-param name="connectionString" select="$connectionString"/>
  385. <xsl:with-param name="credentials" select="$credentials"/>
  386. </xsl:call-template>
  387. </md1:testDataSourceConnection>
  388. </xsl:when>
  389. <xsl:when test="$target = 'queryService'">
  390. <qs1:testDataSourceConnectionWithInfo>
  391. <xsl:call-template name="buildTestConnectionRequest">
  392. <xsl:with-param name="connectionString" select="$connectionString"/>
  393. <xsl:with-param name="credentials" select="$credentials"/>
  394. </xsl:call-template>
  395. </qs1:testDataSourceConnectionWithInfo>
  396. </xsl:when>
  397. <xsl:when test="$target = 'contentManagerService'">
  398. <bus:testDataSourceConnection>
  399. <xsl:call-template name="buildTestConnectionRequest">
  400. <xsl:with-param name="connectionString" select="$connectionString"/>
  401. <xsl:with-param name="credentials" select="$credentials"/>
  402. </xsl:call-template>
  403. </bus:testDataSourceConnection>
  404. </xsl:when>
  405. </xsl:choose>
  406. </xsl:template>
  407. <xsl:template name="buildTestConnectionRequest">
  408. <xsl:param name="connectionString"/>
  409. <xsl:param name="credentials"/>
  410. <connectionString xsi:type="xsd:string">
  411. <xsl:value-of select="$connectionString"/>
  412. <!--
  413. if we're testing an XML connection we need to add validate=on to the connection string. That
  414. how it's documented in docs. Trakker bug 480520
  415. -->
  416. <xsl:if test="contains($connectionString, ';LOCAL;XML;')">
  417. <xsl:text>;validate=on</xsl:text>
  418. </xsl:if>
  419. </connectionString>
  420. <credentials xsi:type="bus:xmlEncodedXML">
  421. <xsl:value-of select="$credentials"/>
  422. </credentials>
  423. </xsl:template>
  424. <!-- this is a simplified version of gen-icon that works just for dispatchers. It also generates just the iconURI instead of the whole img tag. -->
  425. <xsl:template name="gen-dispatcher-icon">
  426. <xsl:param name="id"/>
  427. <xsl:variable name="cmIconURI" select="string(key('dispatchers', $id)[1]/cm:iconURI)"/>
  428. <xsl:choose>
  429. <xsl:when test="$cmIconURI != ''">
  430. <xsl:choose>
  431. <!-- Ignore external URLs -->
  432. <xsl:when test="contains($cmIconURI,':/') or contains($cmIconURI,'\\') or contains($cmIconURI,'//')">
  433. <!-- blank -->
  434. </xsl:when>
  435. <!-- Relative / Absolute URLs - Checking for \ is probably useless in this case -->
  436. <xsl:when test="contains($cmIconURI, '/') or contains($cmIconURI, '\')">
  437. <xsl:choose>
  438. <!-- Doesn't start with / -->
  439. <xsl:when test="not(starts-with($cmIconURI, '/'))">
  440. <xsl:value-of select="$webRoot"/>/<xsl:value-of select="$cmIconURI"/>
  441. </xsl:when>
  442. <!-- Starts with / -->
  443. <xsl:otherwise>
  444. <xsl:value-of select="$webRoot"/><xsl:value-of select="$cmIconURI"/>
  445. </xsl:otherwise>
  446. </xsl:choose>
  447. </xsl:when>
  448. <!-- image file -->
  449. <xsl:otherwise>
  450. <xsl:value-of select="$image_root"/><xsl:value-of select="$cmIconURI"/>
  451. </xsl:otherwise>
  452. </xsl:choose>
  453. </xsl:when>
  454. <xsl:otherwise>
  455. <xsl:value-of select="concat($image_root, 'icon_', key( 'ui-object', key('dispatchers', $id)[1]/cm:objectClass )/@icon,'.gif')"/>
  456. </xsl:otherwise>
  457. </xsl:choose>
  458. </xsl:template>
  459. <!-- Searches the metadata for the type name for the provided connection string. -->
  460. <xsl:template name="gen-displayType">
  461. <xsl:param name="connectionString"/>
  462. <xsl:choose>
  463. <xsl:when test="count(key('connectionMetadata',$connectionString/@code))=1">
  464. <xsl:value-of select="key('connectionMetadata',$connectionString/@code)/name"/>
  465. </xsl:when>
  466. <xsl:when test="count(key('connectionMetadata',$connectionString/@code)[patternMatch])>0">
  467. <xsl:for-each select="key('connectionMetadata',$connectionString/@code)[patternMatch]">
  468. <xsl:choose>
  469. <xsl:when test="patternMatch/@match='contains' and contains($connectionString, patternMatch)">
  470. <xsl:text/><xsl:value-of select="name"/><xsl:text/>
  471. </xsl:when>
  472. <xsl:when test="patternMatch/@match='excludes' and not(contains($connectionString, patternMatch))">
  473. <xsl:text/><xsl:value-of select="name"/><xsl:text/>
  474. </xsl:when>
  475. </xsl:choose>
  476. </xsl:for-each>
  477. </xsl:when>
  478. <xsl:otherwise><xts:string ID="IDS_TEST_CONNECTION_TYPE_UNKNOWN"/></xsl:otherwise>
  479. </xsl:choose>
  480. </xsl:template>
  481. </xsl:stylesheet>
  482. </xts:block>
  483. <!--
  484. ===============================================================================================
  485. Fault handler
  486. ===============================================================================================
  487. -->
  488. <xts:block id="faultHandler" type="fault" processor="XSLT">
  489. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0"
  490. xmlns:bus="http://developer.cognos.com/schemas/bibus/3/"
  491. exclude-result-prefixes="xsl bus">
  492. <xsl:output method="xml"/>
  493. <xsl:template match="/root/fault">
  494. <errors>
  495. <xsl:for-each select="xts:exception/xts:exceptionDetail/bus:exception/bus:message">
  496. <message level="{*[local-name()='nestingLevel']}">
  497. <xsl:value-of select="*[local-name()='messageString']"/>
  498. </message>
  499. </xsl:for-each>
  500. </errors>
  501. </xsl:template>
  502. <xsl:template match="text()"/>
  503. </xsl:stylesheet>
  504. </xts:block>
  505. <!-- operation results -->
  506. <xts:block id="commandResults" processor="XSLT" type="exec" mode="output" mimeType="text/xml" dependency="doTest" nodelist="testResults,user">
  507. <xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0" exclude-result-prefixes="xts xsl">
  508. <xsl:output method="xml" version="1.0" encoding="UTF-8" indent="no"/>
  509. <xsl:template match="/root">
  510. <test:testDataSourceConnectionResponse xmlns:test="http://developer.cognos.com/schemas/xts/portal/iTestDataSource/1/">
  511. <xsl:for-each select="/root/testResults/dispatcher">
  512. <xsl:sort select="displayName" order="ascending" lang="{/root/user/contentLocale}"/>
  513. <xsl:copy>
  514. <xsl:copy-of select="@*|connectionString|displayName|displayPath|displayIcon|displayScreenTip|connectionType|connectionStack|ancestors"/>
  515. <xsl:choose>
  516. <xsl:when test="errors">
  517. <status>failed</status>
  518. <displayStatus><xts:string id="IDS_JOB_STATUS_FAILED"/></displayStatus>
  519. <xsl:copy-of select="errors"/>
  520. </xsl:when>
  521. <xsl:otherwise>
  522. <status>succeeded</status>
  523. <displayStatus><xts:string id="IDS_JOB_STATUS_SUCCEEDED"/></displayStatus>
  524. <xsl:copy-of select="*[local-name() = 'response']/*"/>
  525. </xsl:otherwise>
  526. </xsl:choose>
  527. </xsl:copy>
  528. </xsl:for-each>
  529. </test:testDataSourceConnectionResponse>
  530. </xsl:template>
  531. <xsl:template match="text()"/>
  532. </xsl:stylesheet>
  533. </xts:block>
  534. </xts:morphlet>