You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

RawServletTest.java 21KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675
  1. package com.gitblit.servlet;
  2. import com.gitblit.Constants;
  3. import com.gitblit.IStoredSettings;
  4. import com.gitblit.Keys;
  5. import com.gitblit.tests.mock.MockGitblitContext;
  6. import com.gitblit.tests.mock.MockRuntimeManager;
  7. import org.junit.Before;
  8. import org.junit.BeforeClass;
  9. import org.junit.Test;
  10. import static org.junit.Assert.*;
  11. public class RawServletTest
  12. {
  13. private final static String FSC = "!";
  14. private static IStoredSettings settings;
  15. @BeforeClass
  16. public static void init()
  17. {
  18. MockGitblitContext gitblitContext = new MockGitblitContext();
  19. MockRuntimeManager mockRuntimeManager = new MockRuntimeManager();
  20. gitblitContext.addManager(mockRuntimeManager);
  21. settings = mockRuntimeManager.getSettings();
  22. }
  23. @Before
  24. public void setUp()
  25. {
  26. settings.overrideSetting(Keys.web.forwardSlashCharacter, "/");
  27. }
  28. @Test
  29. public void asLink_HttpUrlRepo()
  30. {
  31. String baseUrl = "http://localhost";
  32. String repository = "test.git";
  33. String branch = null;
  34. String path = null;
  35. String link = RawServlet.asLink(baseUrl, repository, branch, path);
  36. assertNotNull(link);
  37. assertEquals(baseUrl + Constants.RAW_PATH + repository + "/", link);
  38. }
  39. @Test
  40. public void asLink_HttpUrlTrailingSlashRepo()
  41. {
  42. String baseUrl = "http://localhost/";
  43. String repository = "test.git";
  44. String branch = null;
  45. String path = null;
  46. String link = RawServlet.asLink(baseUrl, repository, branch, path);
  47. assertNotNull(link);
  48. assertEquals(baseUrl.substring(0, baseUrl.length()-1) + Constants.RAW_PATH + repository + "/", link);
  49. }
  50. @Test
  51. public void asLink_HttpUrlRepoLeadingSlash()
  52. {
  53. String baseUrl = "http://localhost";
  54. String repository = "/test.git";
  55. String branch = null;
  56. String path = null;
  57. String link = RawServlet.asLink(baseUrl, repository, branch, path);
  58. assertNotNull(link);
  59. assertEquals(baseUrl + Constants.RAW_PATH + repository.substring(1) + "/", link);
  60. }
  61. @Test
  62. public void asLink_HttpUrlTrailingSlashRepoLeadingSlash()
  63. {
  64. String baseUrl = "http://localhost/";
  65. String repository = "/test.git";
  66. String branch = null;
  67. String path = null;
  68. String link = RawServlet.asLink(baseUrl, repository, branch, path);
  69. assertNotNull(link);
  70. assertEquals(baseUrl.substring(0, baseUrl.length()-1) + Constants.RAW_PATH + repository.substring(1) + "/", link);
  71. }
  72. @Test
  73. public void asLink_HttpUrlRepoBranch()
  74. {
  75. String baseUrl = "http://localhost";
  76. String repository = "test.git";
  77. String branch = "b52";
  78. String path = null;
  79. String link = RawServlet.asLink(baseUrl, repository, branch, path);
  80. assertNotNull(link);
  81. assertEquals(baseUrl + Constants.RAW_PATH + repository + "/" + branch + "/", link);
  82. }
  83. @Test
  84. public void asLink_HttpUrlTrailingSlashRepoBranch()
  85. {
  86. String baseUrl = "http://localhost/";
  87. String repository = "test.git";
  88. String branch = "branch";
  89. String path = null;
  90. String link = RawServlet.asLink(baseUrl, repository, branch, path);
  91. assertNotNull(link);
  92. assertEquals(baseUrl.substring(0, baseUrl.length()-1) + Constants.RAW_PATH + repository + "/" + branch + "/", link);
  93. }
  94. @Test
  95. public void asLink_HttpUrlRepoLeadingSlashBranch()
  96. {
  97. String baseUrl = "http://localhost";
  98. String repository = "/test.git";
  99. String branch = "featureOne";
  100. String path = null;
  101. String link = RawServlet.asLink(baseUrl, repository, branch, path);
  102. assertNotNull(link);
  103. assertEquals(baseUrl + Constants.RAW_PATH + repository.substring(1) + "/" + branch + "/", link);
  104. }
  105. @Test
  106. public void asLink_HttpUrlTrailingSlashRepoLeadingSlashBranch()
  107. {
  108. String baseUrl = "http://localhost/";
  109. String repository = "/test.git";
  110. String branch = "b";
  111. String path = null;
  112. String link = RawServlet.asLink(baseUrl, repository, branch, path);
  113. assertNotNull(link);
  114. assertEquals(baseUrl.substring(0, baseUrl.length()-1) + Constants.RAW_PATH + repository.substring(1) + "/" + branch + "/", link);
  115. }
  116. @Test
  117. public void asLink_HttpUrlRepoBranchWithSlash()
  118. {
  119. String baseUrl = "http://localhost";
  120. String repository = "test.git";
  121. String branch = "feature/whatever";
  122. String path = null;
  123. String link = RawServlet.asLink(baseUrl, repository, branch, path);
  124. assertNotNull(link);
  125. assertEquals(baseUrl + Constants.RAW_PATH + repository + "/" + branch.replaceAll("/", FSC) + "/", link);
  126. }
  127. @Test
  128. public void asLink_HttpUrlTrailingSlashRepoBranchWithSlash()
  129. {
  130. String baseUrl = "http://localhost/";
  131. String repository = "test.git";
  132. String branch = "branch/for/issue/16";
  133. String path = null;
  134. String link = RawServlet.asLink(baseUrl, repository, branch, path);
  135. assertNotNull(link);
  136. assertEquals(baseUrl.substring(0, baseUrl.length()-1) + Constants.RAW_PATH + repository + "/"
  137. + branch.replaceAll("/", FSC) + "/", link);
  138. }
  139. @Test
  140. public void asLink_HttpUrlRepoLeadingSlashBranchWithSlash()
  141. {
  142. String baseUrl = "http://localhost";
  143. String repository = "/test.git";
  144. String branch = "releases/1.2.3";
  145. String path = null;
  146. String link = RawServlet.asLink(baseUrl, repository, branch, path);
  147. assertNotNull(link);
  148. assertEquals(baseUrl + Constants.RAW_PATH + repository.substring(1) + "/"
  149. + branch.replaceAll("/", FSC) + "/", link);
  150. }
  151. @Test
  152. public void asLink_HttpUrlTrailingSlashRepoLeadingSlashBranchWithSlash()
  153. {
  154. String baseUrl = "http://localhost/";
  155. String repository = "/test.git";
  156. String branch = "b/52";
  157. String path = null;
  158. String link = RawServlet.asLink(baseUrl, repository, branch, path);
  159. assertNotNull(link);
  160. assertEquals(baseUrl.substring(0, baseUrl.length()-1) + Constants.RAW_PATH + repository.substring(1) + "/"
  161. + branch.replaceAll("/", FSC) + "/", link);
  162. }
  163. @Test
  164. public void asLink_HttpUrlRepoBranchPathFile()
  165. {
  166. String baseUrl = "http://localhost";
  167. String repository = "test.git";
  168. String branch = "b52";
  169. String path = "file.txt";
  170. String link = RawServlet.asLink(baseUrl, repository, branch, path);
  171. assertNotNull(link);
  172. assertEquals(baseUrl + Constants.RAW_PATH + repository + "/" + branch + "/" + path, link);
  173. }
  174. @Test
  175. public void asLink_HttpUrlTrailingSlashRepoBranchPathFolderFile()
  176. {
  177. String baseUrl = "http://localhost/";
  178. String repository = "test.git";
  179. String branch = "branch";
  180. String path = "path/to/file.png";
  181. String link = RawServlet.asLink(baseUrl, repository, branch, path);
  182. assertNotNull(link);
  183. assertEquals(baseUrl.substring(0, baseUrl.length()-1) + Constants.RAW_PATH + repository + "/"
  184. + branch + "/" + path.replaceAll("/", FSC), link);
  185. }
  186. @Test
  187. public void asLink_HttpUrlRepoLeadingSlashBranchPathFolderLeadingSlash()
  188. {
  189. String baseUrl = "http://localhost";
  190. String repository = "/test.git";
  191. String branch = "featureOne";
  192. String path = "/folder";
  193. String link = RawServlet.asLink(baseUrl, repository, branch, path);
  194. assertNotNull(link);
  195. assertEquals(baseUrl + Constants.RAW_PATH + repository.substring(1) + "/" + branch + path, link);
  196. }
  197. @Test
  198. public void asLink_HttpUrlTrailingSlashRepoLeadingSlashBranchSubFolder()
  199. {
  200. String baseUrl = "http://localhost/";
  201. String repository = "/test.git";
  202. String branch = "b";
  203. String path = "sub/folder";
  204. String link = RawServlet.asLink(baseUrl, repository, branch, path);
  205. assertNotNull(link);
  206. assertEquals(baseUrl.substring(0, baseUrl.length()-1) + Constants.RAW_PATH + repository.substring(1) + "/"
  207. + branch + "/" + path.replaceAll("/", FSC), link);
  208. }
  209. @Test
  210. public void asLink_HttpUrlRepoBranchWithSlashPathFolder()
  211. {
  212. String baseUrl = "http://localhost";
  213. String repository = "test.git";
  214. String branch = "feature/whatever";
  215. String path = "folder";
  216. String link = RawServlet.asLink(baseUrl, repository, branch, path);
  217. assertNotNull(link);
  218. assertEquals(baseUrl + Constants.RAW_PATH + repository + "/"
  219. + branch.replaceAll("/", FSC) + "/" + path, link);
  220. }
  221. @Test
  222. public void asLink_HttpUrlTrailingSlashRepoBranchWithSlashPathFolderFile()
  223. {
  224. String baseUrl = "http://localhost/";
  225. String repository = "test.git";
  226. String branch = "branch/for/issue/16";
  227. String path = "a/file.gif";
  228. String link = RawServlet.asLink(baseUrl, repository, branch, path);
  229. assertNotNull(link);
  230. assertEquals(baseUrl.substring(0, baseUrl.length()-1) + Constants.RAW_PATH + repository + "/"
  231. + branch.replaceAll("/", FSC) + "/" + path.replaceAll("/", FSC), link);
  232. }
  233. @Test
  234. public void asLink_HttpUrlRepoLeadingSlashBranchWithSlashPathFile()
  235. {
  236. String baseUrl = "http://localhost";
  237. String repository = "/test.git";
  238. String branch = "releases/1.2.3";
  239. String path = "hurray.png";
  240. String link = RawServlet.asLink(baseUrl, repository, branch, path);
  241. assertNotNull(link);
  242. assertEquals(baseUrl + Constants.RAW_PATH + repository.substring(1) + "/"
  243. + branch.replaceAll("/", FSC) + "/" + path, link);
  244. }
  245. @Test
  246. public void asLink_HttpUrlTrailingSlashRepoLeadingSlashBranchWithSlashPathFolderFile()
  247. {
  248. String baseUrl = "http://localhost/";
  249. String repository = "/test.git";
  250. String branch = "b/52";
  251. String path = "go/to/f.k";
  252. String link = RawServlet.asLink(baseUrl, repository, branch, path);
  253. assertNotNull(link);
  254. assertEquals(baseUrl.substring(0, baseUrl.length()-1) + Constants.RAW_PATH + repository.substring(1) + "/"
  255. + branch.replaceAll("/", FSC) + "/" + path.replaceAll("/", FSC), link);
  256. }
  257. @Test
  258. public void asLink_HttpUrlRepoInFolder()
  259. {
  260. String baseUrl = "http://localhost";
  261. String repository = "project/repo.git";
  262. String branch = null;
  263. String path = null;
  264. String link = RawServlet.asLink(baseUrl, repository, branch, path);
  265. assertNotNull(link);
  266. assertEquals(baseUrl + Constants.RAW_PATH + repository + "/", link);
  267. }
  268. @Test
  269. public void asLink_HttpUrlRepoInSubFolder()
  270. {
  271. String baseUrl = "http://localhost";
  272. String repository = "some/project/repo.git";
  273. String branch = null;
  274. String path = null;
  275. String link = RawServlet.asLink(baseUrl, repository, branch, path);
  276. assertNotNull(link);
  277. assertEquals(baseUrl + Constants.RAW_PATH + repository + "/", link);
  278. }
  279. @Test
  280. public void asLink_HttpUrlRepoInSubFolderBranch()
  281. {
  282. String baseUrl = "http://localhost";
  283. String repository = "some/project/repo.git";
  284. String branch = "laluna";
  285. String path = null;
  286. String link = RawServlet.asLink(baseUrl, repository, branch, path);
  287. assertNotNull(link);
  288. assertEquals(baseUrl + Constants.RAW_PATH + repository + "/"
  289. + branch + "/", link);
  290. }
  291. @Test
  292. public void asLink_HttpUrlRepoInSubFolderBranchWithSlash()
  293. {
  294. String baseUrl = "http://localhost";
  295. String repository = "some/project/repo.git";
  296. String branch = "la/le/lu";
  297. String path = null;
  298. String link = RawServlet.asLink(baseUrl, repository, branch, path);
  299. assertNotNull(link);
  300. assertEquals(baseUrl + Constants.RAW_PATH + repository + "/"
  301. + branch.replaceAll("/", FSC) + "/", link);
  302. }
  303. @Test
  304. public void asLink_HttpUrlRepoInSubFolderBranchPathFile()
  305. {
  306. String baseUrl = "http://localhost";
  307. String repository = "some/project/repo.git";
  308. String branch = "laluna";
  309. String path = "elrtkx.fg";
  310. String link = RawServlet.asLink(baseUrl, repository, branch, path);
  311. assertNotNull(link);
  312. assertEquals(baseUrl + Constants.RAW_PATH + repository + "/"
  313. + branch + "/" + path, link);
  314. }
  315. @Test
  316. public void asLink_HttpUrlRepoInSubFolderLeadingSlashBranchWithSlashPathFolderFile()
  317. {
  318. String baseUrl = "http://localhost";
  319. String repository = "/some/project/repo.git";
  320. String branch = "la/le/lu";
  321. String path = "doremi/fa/SOLA/di.mp3";
  322. String link = RawServlet.asLink(baseUrl, repository, branch, path);
  323. assertNotNull(link);
  324. assertEquals(baseUrl + Constants.RAW_PATH + repository.substring(1) + "/"
  325. + branch.replaceAll("/", FSC) + "/" + path.replaceAll("/", FSC), link);
  326. }
  327. @Test
  328. public void asLink_HttpUrlRepoPathFolderFile()
  329. {
  330. String baseUrl = "http://localhost";
  331. String repository = "repo.git";
  332. String branch = null;
  333. String path = "doko/di.mp3";
  334. String link = RawServlet.asLink(baseUrl, repository, branch, path);
  335. assertNotNull(link);
  336. assertEquals(baseUrl + Constants.RAW_PATH + repository + "/", link);
  337. }
  338. @Test
  339. public void asLink_HttpUrlRepoTrailingSlashPathFileLeadingSlash()
  340. {
  341. String baseUrl = "http://localhost";
  342. String repository = "repo.git/";
  343. String branch = null;
  344. String path = "/di.mp3";
  345. String link = RawServlet.asLink(baseUrl, repository, branch, path);
  346. assertNotNull(link);
  347. assertEquals(baseUrl + Constants.RAW_PATH + repository, link);
  348. }
  349. @Test
  350. public void asLink_HttpUrlRepoBranchPathFileLeadingSlash()
  351. {
  352. String baseUrl = "http://localhost";
  353. String repository = "repo.git";
  354. String branch = "bee";
  355. String path = "/bop.mp3";
  356. String link = RawServlet.asLink(baseUrl, repository, branch, path);
  357. assertNotNull(link);
  358. assertEquals(baseUrl + Constants.RAW_PATH + repository + "/"
  359. + branch + path, link);
  360. }
  361. @Test
  362. public void asLink_HttpUrlRepoBranchPathFolderLeadingSlashTrailingSlash()
  363. {
  364. String baseUrl = "http://localhost";
  365. String repository = "repo.git";
  366. String branch = "bee";
  367. String path = "/bam/";
  368. String link = RawServlet.asLink(baseUrl, repository, branch, path);
  369. assertNotNull(link);
  370. assertEquals(baseUrl + Constants.RAW_PATH + repository + "/"
  371. + branch + "/bam" + FSC, link);
  372. }
  373. @Test
  374. public void asLink_HttpUrlRepoBranchPathSubFolderLeadingSlashTrailingSlash()
  375. {
  376. String baseUrl = "http://localhost";
  377. String repository = "repo.git";
  378. String branch = "bee";
  379. String path = "/bapedi/boo/";
  380. String link = RawServlet.asLink(baseUrl, repository, branch, path);
  381. assertNotNull(link);
  382. assertEquals(baseUrl + Constants.RAW_PATH + repository + "/"
  383. + branch + "/" + "bapedi" + FSC + "boo" + FSC, link);
  384. }
  385. @Test
  386. public void asLink_HttpUrlRepoCommitId()
  387. {
  388. String baseUrl = "http://localhost";
  389. String repository = "repo.git";
  390. String branch = "c7eef37bfe5ae246cdf5ca5c502e4b5471290cb1";
  391. String path = null;
  392. String link = RawServlet.asLink(baseUrl, repository, branch, path);
  393. assertNotNull(link);
  394. assertEquals(baseUrl + Constants.RAW_PATH + repository + "/"
  395. + branch + "/" , link);
  396. }
  397. @Test
  398. public void asLink_HttpUrlRepoCommitIdPathFile()
  399. {
  400. String baseUrl = "http://localhost";
  401. String repository = "repo.git";
  402. String branch = "c7eef37bfe5ae246cdf5ca5c502e4b5471290cb1";
  403. String path = "file";
  404. String link = RawServlet.asLink(baseUrl, repository, branch, path);
  405. assertNotNull(link);
  406. assertEquals(baseUrl + Constants.RAW_PATH + repository + "/"
  407. + branch + "/" + path, link);
  408. }
  409. @Test
  410. public void asLink_HttpUrlRepoCommitIdPathFolderFileFile()
  411. {
  412. String baseUrl = "http://localhost";
  413. String repository = "repo.git";
  414. String branch = "c7eef37bfe5ae246cdf5ca5c502e4b5471290cb1";
  415. String path = "file/in/folder";
  416. String link = RawServlet.asLink(baseUrl, repository, branch, path);
  417. assertNotNull(link);
  418. assertEquals(baseUrl + Constants.RAW_PATH + repository + "/"
  419. + branch + "/" + path.replaceAll("/", FSC), link);
  420. }
  421. @Test
  422. public void asLink_HttpUrlRepoBranchWithSlash_differentFsc()
  423. {
  424. settings.overrideSetting(Keys.web.forwardSlashCharacter, "|");
  425. String baseUrl = "http://localhost";
  426. String repository = "repo.git";
  427. String branch = "some/feature";
  428. String path = null;
  429. String link = RawServlet.asLink(baseUrl, repository, branch, path);
  430. assertNotNull(link);
  431. assertEquals(baseUrl + Constants.RAW_PATH + repository + "/"
  432. + branch.replaceAll("/", "|") + "/", link);
  433. }
  434. @Test
  435. public void asLink_HttpUrlRepoBranchWithSlashPathFolderFile_differentFsc()
  436. {
  437. settings.overrideSetting(Keys.web.forwardSlashCharacter, ";");
  438. String baseUrl = "http://localhost";
  439. String repository = "repo.git";
  440. String branch = "some/feature";
  441. String path = "file/in/folder";
  442. String link = RawServlet.asLink(baseUrl, repository, branch, path);
  443. assertNotNull(link);
  444. assertEquals(baseUrl + Constants.RAW_PATH + repository + "/"
  445. + branch.replaceAll("/", ";") + "/" + path.replaceAll("/", ";"), link);
  446. }
  447. @Test
  448. public void asLink_HttpUrlRepoBranchWithSlash_explicitFscSameAsDefault()
  449. {
  450. settings.overrideSetting(Keys.web.forwardSlashCharacter, "!");
  451. String baseUrl = "http://localhost";
  452. String repository = "repo.git";
  453. String branch = "some/feature";
  454. String path = null;
  455. String link = RawServlet.asLink(baseUrl, repository, branch, path);
  456. assertNotNull(link);
  457. assertEquals(baseUrl + Constants.RAW_PATH + repository + "/"
  458. + branch.replaceAll("/", "!") + "/", link);
  459. }
  460. @Test
  461. public void asLink_HttpUrlRepoBranchWithSlashPathFolderFile_explicitFscSameAsDefault()
  462. {
  463. settings.overrideSetting(Keys.web.forwardSlashCharacter, "!");
  464. String baseUrl = "http://localhost";
  465. String repository = "repo.git";
  466. String branch = "some/feature";
  467. String path = "file/in/folder";
  468. String link = RawServlet.asLink(baseUrl, repository, branch, path);
  469. assertNotNull(link);
  470. assertEquals(baseUrl + Constants.RAW_PATH + repository + "/"
  471. + branch.replaceAll("/", "!") + "/" + path.replaceAll("/", "!"), link);
  472. }
  473. @Test
  474. public void asLink_HttpUrlRepoBranchWithDefaultFsc_differentFsc()
  475. {
  476. settings.overrideSetting(Keys.web.forwardSlashCharacter, ":");
  477. String baseUrl = "http://localhost";
  478. String repository = "repo.git";
  479. String branch = "important" + FSC + "feature";
  480. String path = null;
  481. String link = RawServlet.asLink(baseUrl, repository, branch, path);
  482. assertNotNull(link);
  483. assertEquals(baseUrl + Constants.RAW_PATH + repository + "/"
  484. + branch + "/", link);
  485. }
  486. @Test
  487. public void asLink_HttpUrlRepoBranchWithSlashPathFileWithDefaultFsc_differentFsc()
  488. {
  489. settings.overrideSetting(Keys.web.forwardSlashCharacter, "|");
  490. String baseUrl = "http://localhost";
  491. String repository = "repo.git";
  492. String branch = "some/feature";
  493. String path = "large" + FSC + "file";
  494. String link = RawServlet.asLink(baseUrl, repository, branch, path);
  495. assertNotNull(link);
  496. assertEquals(baseUrl + Constants.RAW_PATH + repository + "/"
  497. + branch.replaceAll("/", "|") + "/" + path, link);
  498. }
  499. @Test
  500. public void asLink_HttpUrlRepoBranchWithDefaultFscAndSlash_differentFsc()
  501. {
  502. settings.overrideSetting(Keys.web.forwardSlashCharacter, ":");
  503. String baseUrl = "http://localhost";
  504. String repository = "repo.git";
  505. String branch = "hotf" + FSC + "x/issue/1234";
  506. String path = null;
  507. String link = RawServlet.asLink(baseUrl, repository, branch, path);
  508. assertNotNull(link);
  509. assertEquals(baseUrl + Constants.RAW_PATH + repository + "/"
  510. + branch.replaceAll("/", ":") + "/", link);
  511. }
  512. @Test
  513. public void asLink_HttpUrlRepoBranchWithDefaultFscAndSlashPathFolderFileWithDefaultFsc_differentFsc()
  514. {
  515. settings.overrideSetting(Keys.web.forwardSlashCharacter, "|");
  516. String baseUrl = "http://localhost";
  517. String repository = "repo.git";
  518. String branch = "some/feature" + FSC + "in/here";
  519. String path = "large" + FSC + "stuff/folder/file" + FSC + "16";
  520. String link = RawServlet.asLink(baseUrl, repository, branch, path);
  521. assertNotNull(link);
  522. assertEquals(baseUrl + Constants.RAW_PATH + repository + "/"
  523. + branch.replaceAll("/", "|") + "/" + path.replaceAll("/", "|"), link);
  524. }
  525. @Test
  526. public void getBranch()
  527. {
  528. }
  529. @Test
  530. public void getPath()
  531. {
  532. }
  533. }