DfaMatcherBuilderTest.cs 219 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994995996997998999100010011002100310041005100610071008100910101011101210131014101510161017101810191020102110221023102410251026102710281029103010311032103310341035103610371038103910401041104210431044104510461047104810491050105110521053105410551056105710581059106010611062106310641065106610671068106910701071107210731074107510761077107810791080108110821083108410851086108710881089109010911092109310941095109610971098109911001101110211031104110511061107110811091110111111121113111411151116111711181119112011211122112311241125112611271128112911301131113211331134113511361137113811391140114111421143114411451146114711481149115011511152115311541155115611571158115911601161116211631164116511661167116811691170117111721173117411751176117711781179118011811182118311841185118611871188118911901191119211931194119511961197119811991200120112021203120412051206120712081209121012111212121312141215121612171218121912201221122212231224122512261227122812291230123112321233123412351236123712381239124012411242124312441245124612471248124912501251125212531254125512561257125812591260126112621263126412651266126712681269127012711272127312741275127612771278127912801281128212831284128512861287128812891290129112921293129412951296129712981299130013011302130313041305130613071308130913101311131213131314131513161317131813191320132113221323132413251326132713281329133013311332133313341335133613371338133913401341134213431344134513461347134813491350135113521353135413551356135713581359136013611362136313641365136613671368136913701371137213731374137513761377137813791380138113821383138413851386138713881389139013911392139313941395139613971398139914001401140214031404140514061407140814091410141114121413141414151416141714181419142014211422142314241425142614271428142914301431143214331434143514361437143814391440144114421443144414451446144714481449145014511452145314541455145614571458145914601461146214631464146514661467146814691470147114721473147414751476147714781479148014811482148314841485148614871488148914901491149214931494149514961497149814991500150115021503150415051506150715081509151015111512151315141515151615171518151915201521152215231524152515261527152815291530153115321533153415351536153715381539154015411542154315441545154615471548154915501551155215531554155515561557155815591560156115621563156415651566156715681569157015711572157315741575157615771578157915801581158215831584158515861587158815891590159115921593159415951596159715981599160016011602160316041605160616071608160916101611161216131614161516161617161816191620162116221623162416251626162716281629163016311632163316341635163616371638163916401641164216431644164516461647164816491650165116521653165416551656165716581659166016611662166316641665166616671668166916701671167216731674167516761677167816791680168116821683168416851686168716881689169016911692169316941695169616971698169917001701170217031704170517061707170817091710171117121713171417151716171717181719172017211722172317241725172617271728172917301731173217331734173517361737173817391740174117421743174417451746174717481749175017511752175317541755175617571758175917601761176217631764176517661767176817691770177117721773177417751776177717781779178017811782178317841785178617871788178917901791179217931794179517961797179817991800180118021803180418051806180718081809181018111812181318141815181618171818181918201821182218231824182518261827182818291830183118321833183418351836183718381839184018411842184318441845184618471848184918501851185218531854185518561857185818591860186118621863186418651866186718681869187018711872187318741875187618771878187918801881188218831884188518861887188818891890189118921893189418951896189718981899190019011902190319041905190619071908190919101911191219131914191519161917191819191920192119221923192419251926192719281929193019311932193319341935193619371938193919401941194219431944194519461947194819491950195119521953195419551956195719581959196019611962196319641965196619671968196919701971197219731974197519761977197819791980198119821983198419851986198719881989199019911992199319941995199619971998199920002001200220032004200520062007200820092010201120122013201420152016201720182019202020212022202320242025202620272028202920302031203220332034203520362037203820392040204120422043204420452046204720482049205020512052205320542055205620572058205920602061206220632064206520662067206820692070207120722073207420752076207720782079208020812082208320842085208620872088208920902091209220932094209520962097209820992100210121022103210421052106210721082109211021112112211321142115211621172118211921202121212221232124212521262127212821292130213121322133213421352136213721382139214021412142214321442145214621472148214921502151215221532154215521562157215821592160216121622163216421652166216721682169217021712172217321742175217621772178217921802181218221832184218521862187218821892190219121922193219421952196219721982199220022012202220322042205220622072208220922102211221222132214221522162217221822192220222122222223222422252226222722282229223022312232223322342235223622372238223922402241224222432244224522462247224822492250225122522253225422552256225722582259226022612262226322642265226622672268226922702271227222732274227522762277227822792280228122822283228422852286228722882289229022912292229322942295229622972298229923002301230223032304230523062307230823092310231123122313231423152316231723182319232023212322232323242325232623272328232923302331233223332334233523362337233823392340234123422343234423452346234723482349235023512352235323542355235623572358235923602361236223632364236523662367236823692370237123722373237423752376237723782379238023812382238323842385238623872388238923902391239223932394239523962397239823992400240124022403240424052406240724082409241024112412241324142415241624172418241924202421242224232424242524262427242824292430243124322433243424352436243724382439244024412442244324442445244624472448244924502451245224532454245524562457245824592460246124622463246424652466246724682469247024712472247324742475247624772478247924802481248224832484248524862487248824892490249124922493249424952496249724982499250025012502250325042505250625072508250925102511251225132514251525162517251825192520252125222523252425252526252725282529253025312532253325342535253625372538253925402541254225432544254525462547254825492550255125522553255425552556255725582559256025612562256325642565256625672568256925702571257225732574257525762577257825792580258125822583258425852586258725882589259025912592259325942595259625972598259926002601260226032604260526062607260826092610261126122613261426152616261726182619262026212622262326242625262626272628262926302631263226332634263526362637263826392640264126422643264426452646264726482649265026512652265326542655265626572658265926602661266226632664266526662667266826692670267126722673267426752676267726782679268026812682268326842685268626872688268926902691269226932694269526962697269826992700270127022703270427052706270727082709271027112712271327142715271627172718271927202721272227232724272527262727272827292730273127322733273427352736273727382739274027412742274327442745274627472748274927502751275227532754275527562757275827592760276127622763276427652766276727682769277027712772277327742775277627772778277927802781278227832784278527862787278827892790279127922793279427952796279727982799280028012802280328042805280628072808280928102811281228132814281528162817281828192820282128222823282428252826282728282829283028312832283328342835283628372838283928402841284228432844284528462847284828492850285128522853285428552856285728582859286028612862286328642865286628672868286928702871287228732874287528762877287828792880288128822883288428852886288728882889289028912892289328942895289628972898289929002901290229032904290529062907290829092910291129122913291429152916291729182919292029212922292329242925292629272928292929302931293229332934293529362937293829392940294129422943294429452946294729482949295029512952295329542955295629572958295929602961296229632964296529662967296829692970297129722973297429752976297729782979298029812982298329842985298629872988298929902991299229932994299529962997299829993000300130023003300430053006300730083009301030113012301330143015301630173018301930203021302230233024302530263027302830293030303130323033303430353036303730383039304030413042304330443045304630473048304930503051305230533054305530563057305830593060306130623063306430653066306730683069307030713072307330743075307630773078307930803081308230833084308530863087308830893090309130923093309430953096309730983099310031013102310331043105310631073108310931103111311231133114311531163117311831193120312131223123312431253126312731283129313031313132313331343135313631373138313931403141314231433144314531463147314831493150315131523153315431553156315731583159316031613162316331643165316631673168316931703171317231733174317531763177317831793180318131823183318431853186318731883189319031913192319331943195319631973198319932003201320232033204320532063207320832093210321132123213321432153216321732183219322032213222322332243225322632273228322932303231323232333234323532363237323832393240324132423243324432453246324732483249325032513252325332543255325632573258325932603261326232633264326532663267326832693270327132723273327432753276327732783279328032813282328332843285328632873288328932903291329232933294329532963297329832993300330133023303330433053306330733083309331033113312331333143315331633173318331933203321332233233324332533263327332833293330333133323333333433353336333733383339334033413342334333443345334633473348334933503351335233533354335533563357335833593360336133623363336433653366336733683369337033713372337333743375337633773378337933803381338233833384338533863387338833893390339133923393339433953396339733983399340034013402340334043405340634073408340934103411341234133414341534163417341834193420342134223423342434253426342734283429343034313432343334343435343634373438343934403441344234433444344534463447344834493450345134523453345434553456345734583459346034613462346334643465346634673468346934703471347234733474347534763477347834793480348134823483348434853486348734883489349034913492349334943495349634973498349935003501350235033504350535063507350835093510351135123513351435153516351735183519352035213522352335243525352635273528352935303531353235333534353535363537353835393540354135423543354435453546354735483549355035513552355335543555355635573558355935603561356235633564356535663567356835693570357135723573357435753576357735783579358035813582358335843585358635873588358935903591359235933594359535963597359835993600360136023603360436053606360736083609361036113612
  1. // Licensed to the .NET Foundation under one or more agreements.
  2. // The .NET Foundation licenses this file to you under the MIT license.
  3. using Microsoft.AspNetCore.Http;
  4. using Microsoft.AspNetCore.Routing.Constraints;
  5. using Microsoft.AspNetCore.Routing.Patterns;
  6. using Microsoft.AspNetCore.Routing.TestObjects;
  7. using Microsoft.Extensions.DependencyInjection;
  8. using Microsoft.Extensions.Logging.Abstractions;
  9. using Microsoft.Extensions.Options;
  10. using Moq;
  11. namespace Microsoft.AspNetCore.Routing.Matching;
  12. public class DfaMatcherBuilderTest
  13. {
  14. [Fact]
  15. public void BuildDfaTree_SingleEndpoint_Empty()
  16. {
  17. // Arrange
  18. var builder = CreateDfaMatcherBuilder();
  19. var endpoint = CreateEndpoint("/");
  20. builder.AddEndpoint(endpoint);
  21. // Act
  22. var root = builder.BuildDfaTree();
  23. // Assert
  24. Assert.Same(endpoint, Assert.Single(root.Matches));
  25. Assert.Null(root.Parameters);
  26. Assert.Null(root.Literals);
  27. }
  28. [Fact]
  29. public void BuildDfaTree_SingleEndpoint_Literals()
  30. {
  31. // Arrange
  32. var builder = CreateDfaMatcherBuilder();
  33. var endpoint = CreateEndpoint("a/b/c");
  34. builder.AddEndpoint(endpoint);
  35. // Act
  36. var root = builder.BuildDfaTree();
  37. // Assert
  38. Assert.Null(root.Matches);
  39. Assert.Null(root.Parameters);
  40. var next = Assert.Single(root.Literals);
  41. Assert.Equal("a", next.Key);
  42. var a = next.Value;
  43. Assert.Null(a.Matches);
  44. Assert.Null(a.Parameters);
  45. next = Assert.Single(a.Literals);
  46. Assert.Equal("b", next.Key);
  47. var b = next.Value;
  48. Assert.Null(b.Matches);
  49. Assert.Null(b.Parameters);
  50. next = Assert.Single(b.Literals);
  51. Assert.Equal("c", next.Key);
  52. var c = next.Value;
  53. Assert.Same(endpoint, Assert.Single(c.Matches));
  54. Assert.Null(c.Parameters);
  55. Assert.Null(c.Literals);
  56. }
  57. [Fact]
  58. public void BuildDfaTree_SingleEndpoint_Parameters()
  59. {
  60. // Arrange
  61. var builder = CreateDfaMatcherBuilder();
  62. var endpoint = CreateEndpoint("{a}/{b}/{c}");
  63. builder.AddEndpoint(endpoint);
  64. // Act
  65. var root = builder.BuildDfaTree();
  66. // Assert
  67. Assert.Null(root.Matches);
  68. Assert.Null(root.Literals);
  69. var a = root.Parameters;
  70. Assert.Null(a.Matches);
  71. Assert.Null(a.Literals);
  72. var b = a.Parameters;
  73. Assert.Null(b.Matches);
  74. Assert.Null(b.Literals);
  75. var c = b.Parameters;
  76. Assert.Same(endpoint, Assert.Single(c.Matches));
  77. Assert.Null(c.Parameters);
  78. Assert.Null(c.Literals);
  79. }
  80. [Fact]
  81. public void BuildDfaTree_SingleEndpoint_CatchAll()
  82. {
  83. // Arrange
  84. var builder = CreateDfaMatcherBuilder();
  85. var endpoint = CreateEndpoint("{a}/{*b}");
  86. builder.AddEndpoint(endpoint);
  87. // Act
  88. var root = builder.BuildDfaTree();
  89. // Assert
  90. Assert.Null(root.Matches);
  91. Assert.Null(root.Literals);
  92. var a = root.Parameters;
  93. // The catch all can match a path like '/a'
  94. Assert.Same(endpoint, Assert.Single(a.Matches));
  95. Assert.Null(a.Literals);
  96. Assert.Null(a.Parameters);
  97. // Catch-all nodes include an extra transition that loops to process
  98. // extra segments.
  99. var catchAll = a.CatchAll;
  100. Assert.Same(endpoint, Assert.Single(catchAll.Matches));
  101. Assert.Null(catchAll.Literals);
  102. Assert.Same(catchAll, catchAll.Parameters);
  103. Assert.Same(catchAll, catchAll.CatchAll);
  104. }
  105. [Fact]
  106. public void BuildDfaTree_SingleEndpoint_CatchAllAtRoot()
  107. {
  108. // Arrange
  109. var builder = CreateDfaMatcherBuilder();
  110. var endpoint = CreateEndpoint("{*a}");
  111. builder.AddEndpoint(endpoint);
  112. // Act
  113. var root = builder.BuildDfaTree();
  114. // Assert
  115. Assert.Same(endpoint, Assert.Single(root.Matches));
  116. Assert.Null(root.Literals);
  117. // Catch-all nodes include an extra transition that loops to process
  118. // extra segments.
  119. var catchAll = root.CatchAll;
  120. Assert.Same(endpoint, Assert.Single(catchAll.Matches));
  121. Assert.Null(catchAll.Literals);
  122. Assert.Same(catchAll, catchAll.Parameters);
  123. }
  124. [Fact]
  125. public void BuildDfaTree_MultipleEndpoint_LiteralAndLiteral()
  126. {
  127. // Arrange
  128. var builder = CreateDfaMatcherBuilder();
  129. var endpoint1 = CreateEndpoint("a/b1/c");
  130. builder.AddEndpoint(endpoint1);
  131. var endpoint2 = CreateEndpoint("a/b2/c");
  132. builder.AddEndpoint(endpoint2);
  133. // Act
  134. var root = builder.BuildDfaTree();
  135. // Assert
  136. Assert.Null(root.Matches);
  137. Assert.Null(root.Parameters);
  138. var next = Assert.Single(root.Literals);
  139. Assert.Equal("a", next.Key);
  140. var a = next.Value;
  141. Assert.Null(a.Matches);
  142. Assert.Equal(2, a.Literals.Count);
  143. var b1 = a.Literals["b1"];
  144. Assert.Null(b1.Matches);
  145. Assert.Null(b1.Parameters);
  146. next = Assert.Single(b1.Literals);
  147. Assert.Equal("c", next.Key);
  148. var c1 = next.Value;
  149. Assert.Same(endpoint1, Assert.Single(c1.Matches));
  150. Assert.Null(c1.Parameters);
  151. Assert.Null(c1.Literals);
  152. var b2 = a.Literals["b2"];
  153. Assert.Null(b2.Matches);
  154. Assert.Null(b2.Parameters);
  155. next = Assert.Single(b2.Literals);
  156. Assert.Equal("c", next.Key);
  157. var c2 = next.Value;
  158. Assert.Same(endpoint2, Assert.Single(c2.Matches));
  159. Assert.Null(c2.Parameters);
  160. Assert.Null(c2.Literals);
  161. }
  162. [Fact]
  163. public void BuildDfaTree_MultipleEndpoint_LiteralDifferentCase()
  164. {
  165. // Arrange
  166. var builder = CreateDfaMatcherBuilder();
  167. var endpoint1 = CreateEndpoint("a/b1/c");
  168. builder.AddEndpoint(endpoint1);
  169. var endpoint2 = CreateEndpoint("A/b2/c");
  170. builder.AddEndpoint(endpoint2);
  171. // Act
  172. var root = builder.BuildDfaTree();
  173. // Assert
  174. Assert.Null(root.Matches);
  175. Assert.Null(root.Parameters);
  176. var next = Assert.Single(root.Literals);
  177. Assert.Equal("a", next.Key);
  178. var a = next.Value;
  179. Assert.Null(a.Matches);
  180. Assert.Equal(2, a.Literals.Count);
  181. var b1 = a.Literals["b1"];
  182. Assert.Null(b1.Matches);
  183. Assert.Null(b1.Parameters);
  184. next = Assert.Single(b1.Literals);
  185. Assert.Equal("c", next.Key);
  186. var c1 = next.Value;
  187. Assert.Same(endpoint1, Assert.Single(c1.Matches));
  188. Assert.Null(c1.Parameters);
  189. Assert.Null(c1.Literals);
  190. var b2 = a.Literals["b2"];
  191. Assert.Null(b2.Matches);
  192. Assert.Null(b2.Parameters);
  193. next = Assert.Single(b2.Literals);
  194. Assert.Equal("c", next.Key);
  195. var c2 = next.Value;
  196. Assert.Same(endpoint2, Assert.Single(c2.Matches));
  197. Assert.Null(c2.Parameters);
  198. Assert.Null(c2.Literals);
  199. }
  200. [Fact]
  201. public void BuildDfaTree_MultipleEndpoint_LiteralAndParameter()
  202. {
  203. // Arrange
  204. var builder = CreateDfaMatcherBuilder();
  205. var endpoint1 = CreateEndpoint("a/b/c");
  206. builder.AddEndpoint(endpoint1);
  207. var endpoint2 = CreateEndpoint("a/{b}/c");
  208. builder.AddEndpoint(endpoint2);
  209. // Act
  210. var root = builder.BuildDfaTree();
  211. // Assert
  212. Assert.Null(root.Matches);
  213. Assert.Null(root.Parameters);
  214. var next = Assert.Single(root.Literals);
  215. Assert.Equal("a", next.Key);
  216. var a = next.Value;
  217. Assert.Null(a.Matches);
  218. next = Assert.Single(a.Literals);
  219. Assert.Equal("b", next.Key);
  220. var b = next.Value;
  221. Assert.Null(b.Matches);
  222. Assert.Null(b.Parameters);
  223. next = Assert.Single(b.Literals);
  224. Assert.Equal("c", next.Key);
  225. var c1 = next.Value;
  226. Assert.Collection(
  227. c1.Matches,
  228. e => Assert.Same(endpoint1, e),
  229. e => Assert.Same(endpoint2, e));
  230. Assert.Null(c1.Parameters);
  231. Assert.Null(c1.Literals);
  232. var b2 = a.Parameters;
  233. Assert.Null(b2.Matches);
  234. Assert.Null(b2.Parameters);
  235. next = Assert.Single(b2.Literals);
  236. Assert.Equal("c", next.Key);
  237. var c2 = next.Value;
  238. Assert.Same(endpoint2, Assert.Single(c2.Matches));
  239. Assert.Null(c2.Parameters);
  240. Assert.Null(c2.Literals);
  241. }
  242. [Fact]
  243. public void BuildDfaTree_MultipleEndpoint_ParameterAndParameter()
  244. {
  245. // Arrange
  246. var builder = CreateDfaMatcherBuilder();
  247. var endpoint1 = CreateEndpoint("a/{b1}/c");
  248. builder.AddEndpoint(endpoint1);
  249. var endpoint2 = CreateEndpoint("a/{b2}/c");
  250. builder.AddEndpoint(endpoint2);
  251. // Act
  252. var root = builder.BuildDfaTree();
  253. // Assert
  254. Assert.Null(root.Matches);
  255. Assert.Null(root.Parameters);
  256. var next = Assert.Single(root.Literals);
  257. Assert.Equal("a", next.Key);
  258. var a = next.Value;
  259. Assert.Null(a.Matches);
  260. Assert.Null(a.Literals);
  261. var b = a.Parameters;
  262. Assert.Null(b.Matches);
  263. Assert.Null(b.Parameters);
  264. next = Assert.Single(b.Literals);
  265. Assert.Equal("c", next.Key);
  266. var c = next.Value;
  267. Assert.Collection(
  268. c.Matches,
  269. e => Assert.Same(endpoint1, e),
  270. e => Assert.Same(endpoint2, e));
  271. Assert.Null(c.Parameters);
  272. Assert.Null(c.Literals);
  273. }
  274. [Fact]
  275. public void BuildDfaTree_MultipleEndpoint_LiteralAndCatchAll()
  276. {
  277. // Arrange
  278. var builder = CreateDfaMatcherBuilder();
  279. var endpoint1 = CreateEndpoint("a/b/c");
  280. builder.AddEndpoint(endpoint1);
  281. var endpoint2 = CreateEndpoint("a/{*b}");
  282. builder.AddEndpoint(endpoint2);
  283. // Act
  284. var root = builder.BuildDfaTree();
  285. // Assert
  286. Assert.Null(root.Matches);
  287. Assert.Null(root.Parameters);
  288. var next = Assert.Single(root.Literals);
  289. Assert.Equal("a", next.Key);
  290. var a = next.Value;
  291. Assert.Same(endpoint2, Assert.Single(a.Matches));
  292. next = Assert.Single(a.Literals);
  293. Assert.Equal("b", next.Key);
  294. var b1 = next.Value;
  295. Assert.Same(endpoint2, Assert.Single(a.Matches));
  296. Assert.Null(b1.Parameters);
  297. next = Assert.Single(b1.Literals);
  298. Assert.Equal("c", next.Key);
  299. var c1 = next.Value;
  300. Assert.Collection(
  301. c1.Matches,
  302. e => Assert.Same(endpoint1, e),
  303. e => Assert.Same(endpoint2, e));
  304. Assert.Null(c1.Parameters);
  305. Assert.Null(c1.Literals);
  306. var catchAll = a.CatchAll;
  307. Assert.Same(endpoint2, Assert.Single(catchAll.Matches));
  308. Assert.Same(catchAll, catchAll.Parameters);
  309. Assert.Same(catchAll, catchAll.CatchAll);
  310. }
  311. [Fact]
  312. public void BuildDfaTree_MultipleEndpoint_ParameterAndCatchAll()
  313. {
  314. // Arrange
  315. var builder = CreateDfaMatcherBuilder();
  316. var endpoint1 = CreateEndpoint("a/{b}/c");
  317. builder.AddEndpoint(endpoint1);
  318. var endpoint2 = CreateEndpoint("a/{*b}");
  319. builder.AddEndpoint(endpoint2);
  320. // Act
  321. var root = builder.BuildDfaTree();
  322. // Assert
  323. Assert.Null(root.Matches);
  324. Assert.Null(root.Parameters);
  325. var next = Assert.Single(root.Literals);
  326. Assert.Equal("a", next.Key);
  327. var a = next.Value;
  328. Assert.Same(endpoint2, Assert.Single(a.Matches));
  329. Assert.Null(a.Literals);
  330. var b1 = a.Parameters;
  331. Assert.Same(endpoint2, Assert.Single(a.Matches));
  332. Assert.Null(b1.Parameters);
  333. next = Assert.Single(b1.Literals);
  334. Assert.Equal("c", next.Key);
  335. var c1 = next.Value;
  336. Assert.Collection(
  337. c1.Matches,
  338. e => Assert.Same(endpoint1, e),
  339. e => Assert.Same(endpoint2, e));
  340. Assert.Null(c1.Parameters);
  341. Assert.Null(c1.Literals);
  342. var catchAll = a.CatchAll;
  343. Assert.Same(endpoint2, Assert.Single(catchAll.Matches));
  344. Assert.Same(catchAll, catchAll.Parameters);
  345. Assert.Same(catchAll, catchAll.CatchAll);
  346. }
  347. [Fact]
  348. public void BuildDfaTree_MultipleEndpoint_ConstrainedParameterTrimming_DoesNotMeetConstraint()
  349. {
  350. // Arrange
  351. var builder = CreateDfaMatcherBuilder();
  352. var endpoint1 = CreateEndpoint("a/c");
  353. builder.AddEndpoint(endpoint1);
  354. var endpoint2 = CreateEndpoint("{a:length(2)}/b/c");
  355. builder.AddEndpoint(endpoint2);
  356. // Act
  357. var root = builder.BuildDfaTree();
  358. // Assert
  359. Assert.Null(root.Matches);
  360. Assert.NotNull(root.Parameters);
  361. var aNodeKvp = Assert.Single(root.Literals);
  362. Assert.Equal("a", aNodeKvp.Key);
  363. var aNodeValue = aNodeKvp.Value;
  364. var cNodeKvp = Assert.Single(aNodeValue.Literals);
  365. Assert.Equal("c", cNodeKvp.Key);
  366. var cNode = cNodeKvp.Value;
  367. Assert.Same(endpoint1, Assert.Single(cNode.Matches));
  368. Assert.Null(cNode.Literals);
  369. Assert.Null(cNode.Parameters);
  370. var bNodeKvp = Assert.Single(root.Parameters.Literals);
  371. Assert.Equal("b", bNodeKvp.Key);
  372. var bNode = bNodeKvp.Value;
  373. Assert.Null(bNode.Parameters);
  374. Assert.Null(bNode.Matches);
  375. var paramCNodeKvp = Assert.Single(bNode.Literals);
  376. Assert.Equal("c", paramCNodeKvp.Key);
  377. var paramCNode = paramCNodeKvp.Value;
  378. Assert.Same(endpoint2, Assert.Single(paramCNode.Matches));
  379. Assert.Null(paramCNode.Literals);
  380. Assert.Null(paramCNode.Parameters);
  381. }
  382. [Theory]
  383. [InlineData("aa/c", "aa", "c")]
  384. [InlineData("1/c", "1", "c")]
  385. public void BuildDfaTree_MultipleEndpoint_ConstrainedParameterTrimming_EvaluatesAllConstraints(string candidate, string firstSegment, string secondSegment)
  386. {
  387. // Arrange
  388. var builder = CreateDfaMatcherBuilder();
  389. var endpoint1 = CreateEndpoint(candidate);
  390. builder.AddEndpoint(endpoint1);
  391. var endpoint2 = CreateEndpoint("{a:int:length(2)}/b/c");
  392. builder.AddEndpoint(endpoint2);
  393. // Act
  394. var root = builder.BuildDfaTree();
  395. // Assert
  396. Assert.Null(root.Matches);
  397. Assert.NotNull(root.Parameters);
  398. var aNodeKvp = Assert.Single(root.Literals);
  399. Assert.Equal(firstSegment, aNodeKvp.Key);
  400. var aNodeValue = aNodeKvp.Value;
  401. var cNodeKvp = Assert.Single(aNodeValue.Literals);
  402. Assert.Equal(secondSegment, cNodeKvp.Key);
  403. var cNode = cNodeKvp.Value;
  404. Assert.Same(endpoint1, Assert.Single(cNode.Matches));
  405. Assert.Null(cNode.Literals);
  406. Assert.Null(cNode.Parameters);
  407. var bNodeKvp = Assert.Single(root.Parameters.Literals);
  408. Assert.Equal("b", bNodeKvp.Key);
  409. var bNode = bNodeKvp.Value;
  410. Assert.Null(bNode.Parameters);
  411. Assert.Null(bNode.Matches);
  412. var paramCNodeKvp = Assert.Single(bNode.Literals);
  413. Assert.Equal("c", paramCNodeKvp.Key);
  414. var paramCNode = paramCNodeKvp.Value;
  415. Assert.Same(endpoint2, Assert.Single(paramCNode.Matches));
  416. Assert.Null(paramCNode.Literals);
  417. Assert.Null(paramCNode.Parameters);
  418. }
  419. [Fact]
  420. public void BuildDfaTree_MultipleEndpoint_ConstrainedParameterTrimming_MeetsConstraint()
  421. {
  422. // Arrange
  423. var builder = CreateDfaMatcherBuilder();
  424. var endpoint1 = CreateEndpoint("aa/c");
  425. builder.AddEndpoint(endpoint1);
  426. var endpoint2 = CreateEndpoint("{a:length(2)}/b/c");
  427. builder.AddEndpoint(endpoint2);
  428. // Act
  429. var root = builder.BuildDfaTree();
  430. // Assert
  431. Assert.Null(root.Matches);
  432. Assert.NotNull(root.Parameters);
  433. // Branch aa -> c = (aa/c)
  434. var aNodeKvp = Assert.Single(root.Literals);
  435. Assert.Equal("aa", aNodeKvp.Key);
  436. var aNodeValue = aNodeKvp.Value;
  437. Assert.True(aNodeValue.Literals.TryGetValue("c", out var cNode));
  438. Assert.Same(endpoint1, Assert.Single(cNode.Matches));
  439. Assert.Null(cNode.Literals);
  440. Assert.Null(cNode.Parameters);
  441. // Branch (aa) -> b -> c = ({a:length(2)}/b/c)
  442. Assert.True(aNodeValue.Literals.TryGetValue("b", out var bNode));
  443. Assert.Null(bNode.Parameters);
  444. Assert.Null(bNode.Matches);
  445. var paramBCNodeKvp = Assert.Single(bNode.Literals);
  446. Assert.Equal("c", paramBCNodeKvp.Key);
  447. var paramBCNode = paramBCNodeKvp.Value;
  448. Assert.Same(endpoint2, Assert.Single(paramBCNode.Matches));
  449. Assert.Null(cNode.Literals);
  450. Assert.Null(cNode.Parameters);
  451. // Branch {param} -> b -> c = ({a:length(2)}/b/c)
  452. var bParamNodeKvp = Assert.Single(root.Parameters.Literals);
  453. Assert.Equal("b", bParamNodeKvp.Key);
  454. var bParamNode = bParamNodeKvp.Value;
  455. Assert.Null(bParamNode.Parameters);
  456. Assert.Null(bParamNode.Matches);
  457. var paramCNodeKvp = Assert.Single(bParamNode.Literals);
  458. Assert.Equal("c", paramCNodeKvp.Key);
  459. var paramCNode = paramCNodeKvp.Value;
  460. Assert.Same(endpoint2, Assert.Single(paramCNode.Matches));
  461. Assert.Null(paramCNode.Literals);
  462. Assert.Null(paramCNode.Parameters);
  463. }
  464. [Fact]
  465. public void BuildDfaTree_MultipleEndpoint_ConstrainedParameterTrimming_BothCandidates_WhenLitteralPatternMeetsConstraintAndRoutePattern()
  466. {
  467. // Arrange
  468. var builder = CreateDfaMatcherBuilder();
  469. var endpoint1 = CreateEndpoint("aa/b/c");
  470. builder.AddEndpoint(endpoint1);
  471. var endpoint2 = CreateEndpoint("{a:length(2)}/b/c");
  472. builder.AddEndpoint(endpoint2);
  473. var endpoint3 = CreateEndpoint("aa/c");
  474. builder.AddEndpoint(endpoint3);
  475. // Act
  476. var root = builder.BuildDfaTree();
  477. // Assert
  478. Assert.Null(root.Matches);
  479. Assert.NotNull(root.Parameters);
  480. // Branch aa -> c = (aa/c)
  481. var aNodeKvp = Assert.Single(root.Literals);
  482. Assert.Equal("aa", aNodeKvp.Key);
  483. var aNodeValue = aNodeKvp.Value;
  484. Assert.True(aNodeValue.Literals.TryGetValue("c", out var cNode));
  485. Assert.Same(endpoint3, Assert.Single(cNode.Matches));
  486. Assert.Null(cNode.Literals);
  487. Assert.Null(cNode.Parameters);
  488. // Branch (aa) -> b -> c = (aa/b/c, {a:length(2)}/b/c)
  489. Assert.True(aNodeValue.Literals.TryGetValue("b", out var bNode));
  490. Assert.Null(bNode.Parameters);
  491. Assert.Null(bNode.Matches);
  492. var paramBCNodeKvp = Assert.Single(bNode.Literals);
  493. Assert.Equal("c", paramBCNodeKvp.Key);
  494. var paramBCNode = paramBCNodeKvp.Value;
  495. Assert.Equal(new[] { endpoint1, endpoint2 }, paramBCNode.Matches.ToArray());
  496. Assert.Null(cNode.Literals);
  497. Assert.Null(cNode.Parameters);
  498. // Branch {param} -> b -> c = ({a:length(2)}/b/c)
  499. var bParamNodeKvp = Assert.Single(root.Parameters.Literals);
  500. Assert.Equal("b", bParamNodeKvp.Key);
  501. var bParamNode = bParamNodeKvp.Value;
  502. Assert.Null(bParamNode.Parameters);
  503. Assert.Null(bParamNode.Matches);
  504. var paramCNodeKvp = Assert.Single(bParamNode.Literals);
  505. Assert.Equal("c", paramCNodeKvp.Key);
  506. var paramCNode = paramCNodeKvp.Value;
  507. Assert.Same(endpoint2, Assert.Single(paramCNode.Matches));
  508. Assert.Null(paramCNode.Literals);
  509. Assert.Null(paramCNode.Parameters);
  510. }
  511. [Fact]
  512. public void BuildDfaTree_MultipleEndpoint_ComplexParameter_LiteralDoesNotMatchComplexParameter()
  513. {
  514. // Arrange
  515. var builder = CreateDfaMatcherBuilder();
  516. var endpoint1 = CreateEndpoint("a/c");
  517. builder.AddEndpoint(endpoint1);
  518. var endpoint2 = CreateEndpoint("a{value}/b/c");
  519. builder.AddEndpoint(endpoint2);
  520. // Act
  521. var root = builder.BuildDfaTree();
  522. // Assert
  523. Assert.Null(root.Matches);
  524. Assert.NotNull(root.Parameters);
  525. var aNodeKvp = Assert.Single(root.Literals);
  526. Assert.Equal("a", aNodeKvp.Key);
  527. var aNodeValue = aNodeKvp.Value;
  528. var cNodeKvp = Assert.Single(aNodeValue.Literals);
  529. Assert.Equal("c", cNodeKvp.Key);
  530. var cNode = cNodeKvp.Value;
  531. Assert.Same(endpoint1, Assert.Single(cNode.Matches));
  532. Assert.Null(cNode.Literals);
  533. Assert.Null(cNode.Parameters);
  534. var bNodeKvp = Assert.Single(root.Parameters.Literals);
  535. Assert.Equal("b", bNodeKvp.Key);
  536. var bNode = bNodeKvp.Value;
  537. Assert.Null(bNode.Parameters);
  538. Assert.Null(bNode.Matches);
  539. var paramCNodeKvp = Assert.Single(bNode.Literals);
  540. Assert.Equal("c", paramCNodeKvp.Key);
  541. var paramCNode = paramCNodeKvp.Value;
  542. Assert.Same(endpoint2, Assert.Single(paramCNode.Matches));
  543. Assert.Null(paramCNode.Literals);
  544. Assert.Null(paramCNode.Parameters);
  545. }
  546. [Fact]
  547. public void BuildDfaTree_MultipleEndpoint_ComplexParameter_LiteralMatchesComplexParameter()
  548. {
  549. // Arrange
  550. var builder = CreateDfaMatcherBuilder();
  551. var endpoint1 = CreateEndpoint("aa/c");
  552. builder.AddEndpoint(endpoint1);
  553. var endpoint2 = CreateEndpoint("a{value}/b/c");
  554. builder.AddEndpoint(endpoint2);
  555. // Act
  556. var root = builder.BuildDfaTree();
  557. // Assert
  558. Assert.Null(root.Matches);
  559. Assert.NotNull(root.Parameters);
  560. // Branch aa -> c = (aa/c)
  561. var aNodeKvp = Assert.Single(root.Literals);
  562. Assert.Equal("aa", aNodeKvp.Key);
  563. var aNodeValue = aNodeKvp.Value;
  564. Assert.True(aNodeValue.Literals.TryGetValue("c", out var cNode));
  565. Assert.Same(endpoint1, Assert.Single(cNode.Matches));
  566. Assert.Null(cNode.Literals);
  567. Assert.Null(cNode.Parameters);
  568. // Branch (aa) -> b -> c = (a{value}/b/c)
  569. Assert.True(aNodeValue.Literals.TryGetValue("b", out var bNode));
  570. Assert.Null(bNode.Parameters);
  571. Assert.Null(bNode.Matches);
  572. var paramBCNodeKvp = Assert.Single(bNode.Literals);
  573. Assert.Equal("c", paramBCNodeKvp.Key);
  574. var paramBCNode = paramBCNodeKvp.Value;
  575. Assert.Same(endpoint2, Assert.Single(paramBCNode.Matches));
  576. Assert.Null(cNode.Literals);
  577. Assert.Null(cNode.Parameters);
  578. // Branch {param} -> b -> c = (a{value}/b/c)
  579. var bParamNodeKvp = Assert.Single(root.Parameters.Literals);
  580. Assert.Equal("b", bParamNodeKvp.Key);
  581. var bParamNode = bParamNodeKvp.Value;
  582. Assert.Null(bParamNode.Parameters);
  583. Assert.Null(bParamNode.Matches);
  584. var paramCNodeKvp = Assert.Single(bParamNode.Literals);
  585. Assert.Equal("c", paramCNodeKvp.Key);
  586. var paramCNode = paramCNodeKvp.Value;
  587. Assert.Same(endpoint2, Assert.Single(paramCNode.Matches));
  588. Assert.Null(paramCNode.Literals);
  589. Assert.Null(paramCNode.Parameters);
  590. }
  591. [Fact]
  592. public void BuildDfaTree_MultipleEndpoint_ConstrainedComplexParameter_LiteralMatchesComplexParameterButNotConstraint()
  593. {
  594. // Arrange
  595. var builder = CreateDfaMatcherBuilder();
  596. var endpoint1 = CreateEndpoint("aa/c");
  597. builder.AddEndpoint(endpoint1);
  598. var endpoint2 = CreateEndpoint("a{value:int}/b/c");
  599. builder.AddEndpoint(endpoint2);
  600. // Act
  601. var root = builder.BuildDfaTree();
  602. // Assert
  603. Assert.Null(root.Matches);
  604. Assert.NotNull(root.Parameters);
  605. var aNodeKvp = Assert.Single(root.Literals);
  606. Assert.Equal("aa", aNodeKvp.Key);
  607. var aNodeValue = aNodeKvp.Value;
  608. var cNodeKvp = Assert.Single(aNodeValue.Literals);
  609. Assert.Equal("c", cNodeKvp.Key);
  610. var cNode = cNodeKvp.Value;
  611. Assert.Same(endpoint1, Assert.Single(cNode.Matches));
  612. Assert.Null(cNode.Literals);
  613. Assert.Null(cNode.Parameters);
  614. var bNodeKvp = Assert.Single(root.Parameters.Literals);
  615. Assert.Equal("b", bNodeKvp.Key);
  616. var bNode = bNodeKvp.Value;
  617. Assert.Null(bNode.Parameters);
  618. Assert.Null(bNode.Matches);
  619. var paramCNodeKvp = Assert.Single(bNode.Literals);
  620. Assert.Equal("c", paramCNodeKvp.Key);
  621. var paramCNode = paramCNodeKvp.Value;
  622. Assert.Same(endpoint2, Assert.Single(paramCNode.Matches));
  623. Assert.Null(paramCNode.Literals);
  624. Assert.Null(paramCNode.Parameters);
  625. }
  626. [Fact]
  627. public void BuildDfaTree_MultipleEndpoint_ComplexParameter_LiteralMatchesComplexParameterAndPartConstraint()
  628. {
  629. // Arrange
  630. var builder = CreateDfaMatcherBuilder();
  631. var endpoint1 = CreateEndpoint("a1/c");
  632. builder.AddEndpoint(endpoint1);
  633. var endpoint2 = CreateEndpoint("a{value:int}/b/c");
  634. builder.AddEndpoint(endpoint2);
  635. // Act
  636. var root = builder.BuildDfaTree();
  637. // Assert
  638. Assert.Null(root.Matches);
  639. Assert.NotNull(root.Parameters);
  640. // Branch aa -> c = (a1/c)
  641. var aNodeKvp = Assert.Single(root.Literals);
  642. Assert.Equal("a1", aNodeKvp.Key);
  643. var aNodeValue = aNodeKvp.Value;
  644. Assert.True(aNodeValue.Literals.TryGetValue("c", out var cNode));
  645. Assert.Same(endpoint1, Assert.Single(cNode.Matches));
  646. Assert.Null(cNode.Literals);
  647. Assert.Null(cNode.Parameters);
  648. // Branch (a1) -> b -> c = (a{value:int}/b/c)
  649. Assert.True(aNodeValue.Literals.TryGetValue("b", out var bNode));
  650. Assert.Null(bNode.Parameters);
  651. Assert.Null(bNode.Matches);
  652. var paramBCNodeKvp = Assert.Single(bNode.Literals);
  653. Assert.Equal("c", paramBCNodeKvp.Key);
  654. var paramBCNode = paramBCNodeKvp.Value;
  655. Assert.Same(endpoint2, Assert.Single(paramBCNode.Matches));
  656. Assert.Null(cNode.Literals);
  657. Assert.Null(cNode.Parameters);
  658. // Branch {param} -> b -> c = (a{value:int}/b/c)
  659. var bParamNodeKvp = Assert.Single(root.Parameters.Literals);
  660. Assert.Equal("b", bParamNodeKvp.Key);
  661. var bParamNode = bParamNodeKvp.Value;
  662. Assert.Null(bParamNode.Parameters);
  663. Assert.Null(bParamNode.Matches);
  664. var paramCNodeKvp = Assert.Single(bParamNode.Literals);
  665. Assert.Equal("c", paramCNodeKvp.Key);
  666. var paramCNode = paramCNodeKvp.Value;
  667. Assert.Same(endpoint2, Assert.Single(paramCNode.Matches));
  668. Assert.Null(paramCNode.Literals);
  669. Assert.Null(paramCNode.Parameters);
  670. }
  671. [Fact]
  672. public void BuildDfaTree_MultipleEndpoint_ComplexParameter_EvaluatesAllPartsAndConstraints()
  673. {
  674. // Arrange
  675. var builder = CreateDfaMatcherBuilder();
  676. var endpoint1 = CreateEndpoint("a-11-b-true/c");
  677. builder.AddEndpoint(endpoint1);
  678. var endpoint2 = CreateEndpoint("a-{value:int:length(2)}-b-{other:bool}/b/c");
  679. builder.AddEndpoint(endpoint2);
  680. // Act
  681. var root = builder.BuildDfaTree();
  682. // Assert
  683. Assert.Null(root.Matches);
  684. Assert.NotNull(root.Parameters);
  685. // Branch a11-b-true -> c = (a11-b-true/c)
  686. var aNodeKvp = Assert.Single(root.Literals);
  687. Assert.Equal("a-11-b-true", aNodeKvp.Key);
  688. var aNodeValue = aNodeKvp.Value;
  689. Assert.True(aNodeValue.Literals.TryGetValue("c", out var cNode));
  690. Assert.Same(endpoint1, Assert.Single(cNode.Matches));
  691. Assert.Null(cNode.Literals);
  692. Assert.Null(cNode.Parameters);
  693. // Branch (a-11-b-true) -> b -> c = (a-{value:int:length(2)}-b-{other:bool}/b/c)
  694. Assert.True(aNodeValue.Literals.TryGetValue("b", out var bNode));
  695. Assert.Null(bNode.Parameters);
  696. Assert.Null(bNode.Matches);
  697. var paramBCNodeKvp = Assert.Single(bNode.Literals);
  698. Assert.Equal("c", paramBCNodeKvp.Key);
  699. var paramBCNode = paramBCNodeKvp.Value;
  700. Assert.Same(endpoint2, Assert.Single(paramBCNode.Matches));
  701. Assert.Null(cNode.Literals);
  702. Assert.Null(cNode.Parameters);
  703. // Branch {param} -> b -> c = (a-{value:int:length(2)}-b-{other:bool}/b/c)
  704. var bParamNodeKvp = Assert.Single(root.Parameters.Literals);
  705. Assert.Equal("b", bParamNodeKvp.Key);
  706. var bParamNode = bParamNodeKvp.Value;
  707. Assert.Null(bParamNode.Parameters);
  708. Assert.Null(bParamNode.Matches);
  709. var paramCNodeKvp = Assert.Single(bParamNode.Literals);
  710. Assert.Equal("c", paramCNodeKvp.Key);
  711. var paramCNode = paramCNodeKvp.Value;
  712. Assert.Same(endpoint2, Assert.Single(paramCNode.Matches));
  713. Assert.Null(paramCNode.Literals);
  714. Assert.Null(paramCNode.Parameters);
  715. }
  716. [Theory]
  717. [InlineData("a-11-b-true/c", "a-11-b-true", "c")]
  718. [InlineData("a-ddd-b-true/c", "a-ddd-b-true", "c")]
  719. [InlineData("a-111-b-0/c", "a-111-b-0", "c")]
  720. public void BuildDfaTree_MultipleEndpoint_ComplexParameter_Trims_When_OneConstraintFails(string candidate, string firstSegment, string secondSegment)
  721. {
  722. // Arrange
  723. var builder = CreateDfaMatcherBuilder();
  724. var endpoint1 = CreateEndpoint(candidate);
  725. builder.AddEndpoint(endpoint1);
  726. var endpoint2 = CreateEndpoint("a-{value:int:length(3)}-b-{other:bool}/b/c");
  727. builder.AddEndpoint(endpoint2);
  728. // Act
  729. var root = builder.BuildDfaTree();
  730. // Assert
  731. Assert.Null(root.Matches);
  732. Assert.NotNull(root.Parameters);
  733. // Branch a-11-b-true -> c = (a11-b-true/c)
  734. var aNodeKvp = Assert.Single(root.Literals);
  735. Assert.Equal(firstSegment, aNodeKvp.Key);
  736. var aNodeValue = aNodeKvp.Value;
  737. var cNodeKvp = aNodeValue.Literals.Single();
  738. Assert.Equal(secondSegment, cNodeKvp.Key);
  739. var cNode = cNodeKvp.Value;
  740. Assert.Same(endpoint1, Assert.Single(cNode.Matches));
  741. Assert.Null(cNode.Literals);
  742. Assert.Null(cNode.Parameters);
  743. // Branch {param} -> b -> c = (a-{value:int:length(2)}-b-{other:bool}/b/c)
  744. var bParamNodeKvp = Assert.Single(root.Parameters.Literals);
  745. Assert.Equal("b", bParamNodeKvp.Key);
  746. var bParamNode = bParamNodeKvp.Value;
  747. Assert.Null(bParamNode.Parameters);
  748. Assert.Null(bParamNode.Matches);
  749. var paramCNodeKvp = Assert.Single(bParamNode.Literals);
  750. Assert.Equal("c", paramCNodeKvp.Key);
  751. var paramCNode = paramCNodeKvp.Value;
  752. Assert.Same(endpoint2, Assert.Single(paramCNode.Matches));
  753. Assert.Null(paramCNode.Literals);
  754. Assert.Null(paramCNode.Parameters);
  755. }
  756. [Fact]
  757. public void BuildDfaTree_MultipleEndpoint_ComplexParameter_BothCandidates_WhenLitteralPatternMatchesComplexParameterAndRoutePattern()
  758. {
  759. // Arrange
  760. var builder = CreateDfaMatcherBuilder();
  761. var endpoint1 = CreateEndpoint("aa/b/c");
  762. builder.AddEndpoint(endpoint1);
  763. var endpoint2 = CreateEndpoint("a{value}/b/c");
  764. builder.AddEndpoint(endpoint2);
  765. var endpoint3 = CreateEndpoint("aa/c");
  766. builder.AddEndpoint(endpoint3);
  767. // Act
  768. var root = builder.BuildDfaTree();
  769. // Assert
  770. Assert.Null(root.Matches);
  771. Assert.NotNull(root.Parameters);
  772. // Branch aa -> c = (aa/c)
  773. var aNodeKvp = Assert.Single(root.Literals);
  774. Assert.Equal("aa", aNodeKvp.Key);
  775. var aNodeValue = aNodeKvp.Value;
  776. Assert.True(aNodeValue.Literals.TryGetValue("c", out var cNode));
  777. Assert.Same(endpoint3, Assert.Single(cNode.Matches));
  778. Assert.Null(cNode.Literals);
  779. Assert.Null(cNode.Parameters);
  780. // Branch (aa) -> b -> c = (aa/b/c, a{value}/b/c)
  781. Assert.True(aNodeValue.Literals.TryGetValue("b", out var bNode));
  782. Assert.Null(bNode.Parameters);
  783. Assert.Null(bNode.Matches);
  784. var paramBCNodeKvp = Assert.Single(bNode.Literals);
  785. Assert.Equal("c", paramBCNodeKvp.Key);
  786. var paramBCNode = paramBCNodeKvp.Value;
  787. Assert.Equal(new[] { endpoint1, endpoint2 }, paramBCNode.Matches.ToArray());
  788. Assert.Null(cNode.Literals);
  789. Assert.Null(cNode.Parameters);
  790. // Branch {param} -> b -> c = (a{value}/b/c)
  791. var bParamNodeKvp = Assert.Single(root.Parameters.Literals);
  792. Assert.Equal("b", bParamNodeKvp.Key);
  793. var bParamNode = bParamNodeKvp.Value;
  794. Assert.Null(bParamNode.Parameters);
  795. Assert.Null(bParamNode.Matches);
  796. var paramCNodeKvp = Assert.Single(bParamNode.Literals);
  797. Assert.Equal("c", paramCNodeKvp.Key);
  798. var paramCNode = paramCNodeKvp.Value;
  799. Assert.Same(endpoint2, Assert.Single(paramCNode.Matches));
  800. Assert.Null(paramCNode.Literals);
  801. Assert.Null(paramCNode.Parameters);
  802. }
  803. // Regression test for excessive memory usage https://github.com/dotnet/aspnetcore/issues/23850
  804. [Fact]
  805. public void BuildDfaTree_CanHandle_LargeAmountOfRoutes_WithConstraints()
  806. {
  807. // Arrange
  808. var builder = CreateDfaMatcherBuilder();
  809. var endpoints = new[]{
  810. CreateEndpoint("test1/method-1", new HttpMethodMetadata(new[] { "GET" })),
  811. CreateEndpoint("{language:length(2)}/test1/method-1", new HttpMethodMetadata(new[] { "GET" })),
  812. CreateEndpoint("{version:int}/{language:length(2)}/test1/method-1", new HttpMethodMetadata(new[] { "GET" })),
  813. CreateEndpoint("test1/method-2", new HttpMethodMetadata(new[] { "POST" })),
  814. CreateEndpoint("{language:length(2)}/test1/method-2", new HttpMethodMetadata(new[] { "POST" })),
  815. CreateEndpoint("{version:int}/{language:length(2)}/test1/method-2", new HttpMethodMetadata(new[] { "POST" })),
  816. CreateEndpoint("test1/method-3", new HttpMethodMetadata(new[] { "POST" })),
  817. CreateEndpoint("{language:length(2)}/test1/method-3", new HttpMethodMetadata(new[] { "POST" })),
  818. CreateEndpoint("{version:int}/{language:length(2)}/test1/method-3", new HttpMethodMetadata(new[] { "POST" })),
  819. CreateEndpoint("test2/method-1", new HttpMethodMetadata(new[] { "GET" })),
  820. CreateEndpoint("{language:length(2)}/test2/method-1", new HttpMethodMetadata(new[] { "GET" })),
  821. CreateEndpoint("{version:int}/{language:length(2)}/test2/method-1", new HttpMethodMetadata(new[] { "GET" })),
  822. CreateEndpoint("test2/method-2", new HttpMethodMetadata(new[] { "POST" })),
  823. CreateEndpoint("{language:length(2)}/test2/method-2", new HttpMethodMetadata(new[] { "POST" })),
  824. CreateEndpoint("{version:int}/{language:length(2)}/test2/method-2", new HttpMethodMetadata(new[] { "POST" })),
  825. CreateEndpoint("test2/method-3", new HttpMethodMetadata(new[] { "POST" })),
  826. CreateEndpoint("{language:length(2)}/test2/method-3", new HttpMethodMetadata(new[] { "POST" })),
  827. CreateEndpoint("{version:int}/{language:length(2)}/test2/method-3", new HttpMethodMetadata(new[] { "POST" })),
  828. CreateEndpoint("test3/method-1", new HttpMethodMetadata(new[] { "GET" })),
  829. CreateEndpoint("{language:length(2)}/test3/method-1", new HttpMethodMetadata(new[] { "GET" })),
  830. CreateEndpoint("{version:int}/{language:length(2)}/test3/method-1", new HttpMethodMetadata(new[] { "GET" })),
  831. CreateEndpoint("test3/method-2", new HttpMethodMetadata(new[] { "POST" })),
  832. CreateEndpoint("{language:length(2)}/test3/method-2", new HttpMethodMetadata(new[] { "POST" })),
  833. CreateEndpoint("{version:int}/{language:length(2)}/test3/method-2", new HttpMethodMetadata(new[] { "POST" })),
  834. CreateEndpoint("test3/method-3", new HttpMethodMetadata(new[] { "POST" })),
  835. CreateEndpoint("{language:length(2)}/test3/method-3", new HttpMethodMetadata(new[] { "POST" })),
  836. CreateEndpoint("{version:int}/{language:length(2)}/test3/method-3", new HttpMethodMetadata(new[] { "POST" })),
  837. CreateEndpoint("test4/method-1", new HttpMethodMetadata(new[] { "GET" })),
  838. CreateEndpoint("{language:length(2)}/test4/method-1", new HttpMethodMetadata(new[] { "GET" })),
  839. CreateEndpoint("{version:int}/{language:length(2)}/test4/method-1", new HttpMethodMetadata(new[] { "GET" })),
  840. CreateEndpoint("test4/method-2", new HttpMethodMetadata(new[] { "POST" })),
  841. CreateEndpoint("{language:length(2)}/test4/method-2", new HttpMethodMetadata(new[] { "POST" })),
  842. CreateEndpoint("{version:int}/{language:length(2)}/test4/method-2", new HttpMethodMetadata(new[] { "POST" })),
  843. CreateEndpoint("test4/method-3", new HttpMethodMetadata(new[] { "POST" })),
  844. CreateEndpoint("{language:length(2)}/test4/method-3", new HttpMethodMetadata(new[] { "POST" })),
  845. CreateEndpoint("{version:int}/{language:length(2)}/test4/method-3", new HttpMethodMetadata(new[] { "POST" })),
  846. CreateEndpoint("test5/method-1", new HttpMethodMetadata(new[] { "GET" })),
  847. CreateEndpoint("{language:length(2)}/test5/method-1", new HttpMethodMetadata(new[] { "GET" })),
  848. CreateEndpoint("{version:int}/{language:length(2)}/test5/method-1", new HttpMethodMetadata(new[] { "GET" })),
  849. CreateEndpoint("test5/method-2", new HttpMethodMetadata(new[] { "POST" })),
  850. CreateEndpoint("{language:length(2)}/test5/method-2", new HttpMethodMetadata(new[] { "POST" })),
  851. CreateEndpoint("{version:int}/{language:length(2)}/test5/method-2", new HttpMethodMetadata(new[] { "POST" })),
  852. CreateEndpoint("test5/method-3", new HttpMethodMetadata(new[] { "POST" })),
  853. CreateEndpoint("{language:length(2)}/test5/method-3", new HttpMethodMetadata(new[] { "POST" })),
  854. CreateEndpoint("{version:int}/{language:length(2)}/test5/method-3", new HttpMethodMetadata(new[] { "POST" })),
  855. CreateEndpoint("test6/method-1", new HttpMethodMetadata(new[] { "GET" })),
  856. CreateEndpoint("{language:length(2)}/test6/method-1", new HttpMethodMetadata(new[] { "GET" })),
  857. CreateEndpoint("{version:int}/{language:length(2)}/test6/method-1", new HttpMethodMetadata(new[] { "GET" })),
  858. CreateEndpoint("test6/method-2", new HttpMethodMetadata(new[] { "POST" })),
  859. CreateEndpoint("{language:length(2)}/test6/method-2", new HttpMethodMetadata(new[] { "POST" })),
  860. CreateEndpoint("{version:int}/{language:length(2)}/test6/method-2", new HttpMethodMetadata(new[] { "POST" })),
  861. CreateEndpoint("test6/method-3", new HttpMethodMetadata(new[] { "POST" })),
  862. CreateEndpoint("{language:length(2)}/test6/method-3", new HttpMethodMetadata(new[] { "POST" })),
  863. CreateEndpoint("{version:int}/{language:length(2)}/test6/method-3", new HttpMethodMetadata(new[] { "POST" })),
  864. CreateEndpoint("test7/method-1", new HttpMethodMetadata(new[] { "GET" })),
  865. CreateEndpoint("{language:length(2)}/test7/method-1", new HttpMethodMetadata(new[] { "GET" })),
  866. CreateEndpoint("{version:int}/{language:length(2)}/test7/method-1", new HttpMethodMetadata(new[] { "GET" })),
  867. CreateEndpoint("test7/method-2", new HttpMethodMetadata(new[] { "POST" })),
  868. CreateEndpoint("{language:length(2)}/test7/method-2", new HttpMethodMetadata(new[] { "POST" })),
  869. CreateEndpoint("{version:int}/{language:length(2)}/test7/method-2", new HttpMethodMetadata(new[] { "POST" })),
  870. CreateEndpoint("test7/method-3", new HttpMethodMetadata(new[] { "POST" })),
  871. CreateEndpoint("{language:length(2)}/test7/method-3", new HttpMethodMetadata(new[] { "POST" })),
  872. CreateEndpoint("{version:int}/{language:length(2)}/test7/method-3", new HttpMethodMetadata(new[] { "POST" })),
  873. CreateEndpoint("test8/method-1", new HttpMethodMetadata(new[] { "GET" })),
  874. CreateEndpoint("{language:length(2)}/test8/method-1", new HttpMethodMetadata(new[] { "GET" })),
  875. CreateEndpoint("{version:int}/{language:length(2)}/test8/method-1", new HttpMethodMetadata(new[] { "GET" })),
  876. CreateEndpoint("test8/method-2", new HttpMethodMetadata(new[] { "POST" })),
  877. CreateEndpoint("{language:length(2)}/test8/method-2", new HttpMethodMetadata(new[] { "POST" })),
  878. CreateEndpoint("{version:int}/{language:length(2)}/test8/method-2", new HttpMethodMetadata(new[] { "POST" })),
  879. CreateEndpoint("test8/method-3", new HttpMethodMetadata(new[] { "POST" })),
  880. CreateEndpoint("{language:length(2)}/test8/method-3", new HttpMethodMetadata(new[] { "POST" })),
  881. CreateEndpoint("{version:int}/{language:length(2)}/test8/method-3", new HttpMethodMetadata(new[] { "POST" })),
  882. CreateEndpoint("test9/method-1", new HttpMethodMetadata(new[] { "GET" })),
  883. CreateEndpoint("{language:length(2)}/test9/method-1", new HttpMethodMetadata(new[] { "GET" })),
  884. CreateEndpoint("{version:int}/{language:length(2)}/test9/method-1", new HttpMethodMetadata(new[] { "GET" })),
  885. CreateEndpoint("test9/method-2", new HttpMethodMetadata(new[] { "POST" })),
  886. CreateEndpoint("{language:length(2)}/test9/method-2", new HttpMethodMetadata(new[] { "POST" })),
  887. CreateEndpoint("{version:int}/{language:length(2)}/test9/method-2", new HttpMethodMetadata(new[] { "POST" })),
  888. CreateEndpoint("test9/method-3", new HttpMethodMetadata(new[] { "POST" })),
  889. CreateEndpoint("{language:length(2)}/test9/method-3", new HttpMethodMetadata(new[] { "POST" })),
  890. CreateEndpoint("{version:int}/{language:length(2)}/test9/method-3", new HttpMethodMetadata(new[] { "POST" })),
  891. CreateEndpoint("test10/method-1", new HttpMethodMetadata(new[] { "GET" })),
  892. CreateEndpoint("{language:length(2)}/test10/method-1", new HttpMethodMetadata(new[] { "GET" })),
  893. CreateEndpoint("{version:int}/{language:length(2)}/test10/method-1", new HttpMethodMetadata(new[] { "GET" })),
  894. CreateEndpoint("test10/method-2", new HttpMethodMetadata(new[] { "POST" })),
  895. CreateEndpoint("{language:length(2)}/test10/method-2", new HttpMethodMetadata(new[] { "POST" })),
  896. CreateEndpoint("{version:int}/{language:length(2)}/test10/method-2", new HttpMethodMetadata(new[] { "POST" })),
  897. CreateEndpoint("test10/method-3", new HttpMethodMetadata(new[] { "POST" })),
  898. CreateEndpoint("{language:length(2)}/test10/method-3", new HttpMethodMetadata(new[] { "POST" })),
  899. CreateEndpoint("{version:int}/{language:length(2)}/test10/method-3", new HttpMethodMetadata(new[] { "POST" })),
  900. CreateEndpoint("test11/method-1", new HttpMethodMetadata(new[] { "GET" })),
  901. CreateEndpoint("{language:length(2)}/test11/method-1", new HttpMethodMetadata(new[] { "GET" })),
  902. CreateEndpoint("{version:int}/{language:length(2)}/test11/method-1", new HttpMethodMetadata(new[] { "GET" })),
  903. CreateEndpoint("test11/method-2", new HttpMethodMetadata(new[] { "POST" })),
  904. CreateEndpoint("{language:length(2)}/test11/method-2", new HttpMethodMetadata(new[] { "POST" })),
  905. CreateEndpoint("{version:int}/{language:length(2)}/test11/method-2", new HttpMethodMetadata(new[] { "POST" })),
  906. CreateEndpoint("test11/method-3", new HttpMethodMetadata(new[] { "POST" })),
  907. CreateEndpoint("{language:length(2)}/test11/method-3", new HttpMethodMetadata(new[] { "POST" })),
  908. CreateEndpoint("{version:int}/{language:length(2)}/test11/method-3", new HttpMethodMetadata(new[] { "POST" })),
  909. CreateEndpoint("test12/method-1", new HttpMethodMetadata(new[] { "GET" })),
  910. CreateEndpoint("{language:length(2)}/test12/method-1", new HttpMethodMetadata(new[] { "GET" })),
  911. CreateEndpoint("{version:int}/{language:length(2)}/test12/method-1", new HttpMethodMetadata(new[] { "GET" })),
  912. CreateEndpoint("test12/method-2", new HttpMethodMetadata(new[] { "POST" })),
  913. CreateEndpoint("{language:length(2)}/test12/method-2", new HttpMethodMetadata(new[] { "POST" })),
  914. CreateEndpoint("{version:int}/{language:length(2)}/test12/method-2", new HttpMethodMetadata(new[] { "POST" })),
  915. CreateEndpoint("test12/method-3", new HttpMethodMetadata(new[] { "POST" })),
  916. CreateEndpoint("{language:length(2)}/test12/method-3", new HttpMethodMetadata(new[] { "POST" })),
  917. CreateEndpoint("{version:int}/{language:length(2)}/test12/method-3", new HttpMethodMetadata(new[] { "POST" })),
  918. CreateEndpoint("test13/method-1", new HttpMethodMetadata(new[] { "GET" })),
  919. CreateEndpoint("{language:length(2)}/test13/method-1", new HttpMethodMetadata(new[] { "GET" })),
  920. CreateEndpoint("{version:int}/{language:length(2)}/test13/method-1", new HttpMethodMetadata(new[] { "GET" })),
  921. CreateEndpoint("test13/method-2", new HttpMethodMetadata(new[] { "POST" })),
  922. CreateEndpoint("{language:length(2)}/test13/method-2", new HttpMethodMetadata(new[] { "POST" })),
  923. CreateEndpoint("{version:int}/{language:length(2)}/test13/method-2", new HttpMethodMetadata(new[] { "POST" })),
  924. CreateEndpoint("test13/method-3", new HttpMethodMetadata(new[] { "POST" })),
  925. CreateEndpoint("{language:length(2)}/test13/method-3", new HttpMethodMetadata(new[] { "POST" })),
  926. CreateEndpoint("{version:int}/{language:length(2)}/test13/method-3", new HttpMethodMetadata(new[] { "POST" })),
  927. CreateEndpoint("test14/method-1", new HttpMethodMetadata(new[] { "GET" })),
  928. CreateEndpoint("{language:length(2)}/test14/method-1", new HttpMethodMetadata(new[] { "GET" })),
  929. CreateEndpoint("{version:int}/{language:length(2)}/test14/method-1", new HttpMethodMetadata(new[] { "GET" })),
  930. CreateEndpoint("test14/method-2", new HttpMethodMetadata(new[] { "POST" })),
  931. CreateEndpoint("{language:length(2)}/test14/method-2", new HttpMethodMetadata(new[] { "POST" })),
  932. CreateEndpoint("{version:int}/{language:length(2)}/test14/method-2", new HttpMethodMetadata(new[] { "POST" })),
  933. CreateEndpoint("test14/method-3", new HttpMethodMetadata(new[] { "POST" })),
  934. CreateEndpoint("{language:length(2)}/test14/method-3", new HttpMethodMetadata(new[] { "POST" })),
  935. CreateEndpoint("{version:int}/{language:length(2)}/test14/method-3", new HttpMethodMetadata(new[] { "POST" })),
  936. CreateEndpoint("test15/method-1", new HttpMethodMetadata(new[] { "GET" })),
  937. CreateEndpoint("{language:length(2)}/test15/method-1", new HttpMethodMetadata(new[] { "GET" })),
  938. CreateEndpoint("{version:int}/{language:length(2)}/test15/method-1", new HttpMethodMetadata(new[] { "GET" })),
  939. CreateEndpoint("test15/method-2", new HttpMethodMetadata(new[] { "POST" })),
  940. CreateEndpoint("{language:length(2)}/test15/method-2", new HttpMethodMetadata(new[] { "POST" })),
  941. CreateEndpoint("{version:int}/{language:length(2)}/test15/method-2", new HttpMethodMetadata(new[] { "POST" })),
  942. CreateEndpoint("test15/method-3", new HttpMethodMetadata(new[] { "POST" })),
  943. CreateEndpoint("{language:length(2)}/test15/method-3", new HttpMethodMetadata(new[] { "POST" })),
  944. CreateEndpoint("{version:int}/{language:length(2)}/test15/method-3", new HttpMethodMetadata(new[] { "POST" })),
  945. CreateEndpoint("test16/method-1", new HttpMethodMetadata(new[] { "GET" })),
  946. CreateEndpoint("{language:length(2)}/test16/method-1", new HttpMethodMetadata(new[] { "GET" })),
  947. CreateEndpoint("{version:int}/{language:length(2)}/test16/method-1", new HttpMethodMetadata(new[] { "GET" })),
  948. CreateEndpoint("test16/method-2", new HttpMethodMetadata(new[] { "POST" })),
  949. CreateEndpoint("{language:length(2)}/test16/method-2", new HttpMethodMetadata(new[] { "POST" })),
  950. CreateEndpoint("{version:int}/{language:length(2)}/test16/method-2", new HttpMethodMetadata(new[] { "POST" })),
  951. CreateEndpoint("test16/method-3", new HttpMethodMetadata(new[] { "POST" })),
  952. CreateEndpoint("{language:length(2)}/test16/method-3", new HttpMethodMetadata(new[] { "POST" })),
  953. CreateEndpoint("{version:int}/{language:length(2)}/test16/method-3", new HttpMethodMetadata(new[] { "POST" })),
  954. CreateEndpoint("test17/method-1", new HttpMethodMetadata(new[] { "GET" })),
  955. CreateEndpoint("{language:length(2)}/test17/method-1", new HttpMethodMetadata(new[] { "GET" })),
  956. CreateEndpoint("{version:int}/{language:length(2)}/test17/method-1", new HttpMethodMetadata(new[] { "GET" })),
  957. CreateEndpoint("test17/method-2", new HttpMethodMetadata(new[] { "POST" })),
  958. CreateEndpoint("{language:length(2)}/test17/method-2", new HttpMethodMetadata(new[] { "POST" })),
  959. CreateEndpoint("{version:int}/{language:length(2)}/test17/method-2", new HttpMethodMetadata(new[] { "POST" })),
  960. CreateEndpoint("test17/method-3", new HttpMethodMetadata(new[] { "POST" })),
  961. CreateEndpoint("{language:length(2)}/test17/method-3", new HttpMethodMetadata(new[] { "POST" })),
  962. CreateEndpoint("{version:int}/{language:length(2)}/test17/method-3", new HttpMethodMetadata(new[] { "POST" })),
  963. CreateEndpoint("test18/method-1", new HttpMethodMetadata(new[] { "GET" })),
  964. CreateEndpoint("{language:length(2)}/test18/method-1", new HttpMethodMetadata(new[] { "GET" })),
  965. CreateEndpoint("{version:int}/{language:length(2)}/test18/method-1", new HttpMethodMetadata(new[] { "GET" })),
  966. CreateEndpoint("test18/method-2", new HttpMethodMetadata(new[] { "POST" })),
  967. CreateEndpoint("{language:length(2)}/test18/method-2", new HttpMethodMetadata(new[] { "POST" })),
  968. CreateEndpoint("{version:int}/{language:length(2)}/test18/method-2", new HttpMethodMetadata(new[] { "POST" })),
  969. CreateEndpoint("test18/method-3", new HttpMethodMetadata(new[] { "POST" })),
  970. CreateEndpoint("{language:length(2)}/test18/method-3", new HttpMethodMetadata(new[] { "POST" })),
  971. CreateEndpoint("{version:int}/{language:length(2)}/test18/method-3", new HttpMethodMetadata(new[] { "POST" })),
  972. CreateEndpoint("test19/method-1", new HttpMethodMetadata(new[] { "GET" })),
  973. CreateEndpoint("{language:length(2)}/test19/method-1", new HttpMethodMetadata(new[] { "GET" })),
  974. CreateEndpoint("{version:int}/{language:length(2)}/test19/method-1", new HttpMethodMetadata(new[] { "GET" })),
  975. CreateEndpoint("test19/method-2", new HttpMethodMetadata(new[] { "POST" })),
  976. CreateEndpoint("{language:length(2)}/test19/method-2", new HttpMethodMetadata(new[] { "POST" })),
  977. CreateEndpoint("{version:int}/{language:length(2)}/test19/method-2", new HttpMethodMetadata(new[] { "POST" })),
  978. CreateEndpoint("test19/method-3", new HttpMethodMetadata(new[] { "POST" })),
  979. CreateEndpoint("{language:length(2)}/test19/method-3", new HttpMethodMetadata(new[] { "POST" })),
  980. CreateEndpoint("{version:int}/{language:length(2)}/test19/method-3", new HttpMethodMetadata(new[] { "POST" })),
  981. CreateEndpoint("test20/method-1", new HttpMethodMetadata(new[] { "GET" })),
  982. CreateEndpoint("{language:length(2)}/test20/method-1", new HttpMethodMetadata(new[] { "GET" })),
  983. CreateEndpoint("{version:int}/{language:length(2)}/test20/method-1", new HttpMethodMetadata(new[] { "GET" })),
  984. CreateEndpoint("test20/method-2", new HttpMethodMetadata(new[] { "POST" })),
  985. CreateEndpoint("{language:length(2)}/test20/method-2", new HttpMethodMetadata(new[] { "POST" })),
  986. CreateEndpoint("{version:int}/{language:length(2)}/test20/method-2", new HttpMethodMetadata(new[] { "POST" })),
  987. CreateEndpoint("test20/method-3", new HttpMethodMetadata(new[] { "POST" })),
  988. CreateEndpoint("{language:length(2)}/test20/method-3", new HttpMethodMetadata(new[] { "POST" })),
  989. CreateEndpoint("{version:int}/{language:length(2)}/test20/method-3", new HttpMethodMetadata(new[] { "POST" })),
  990. CreateEndpoint("test21/method-1", new HttpMethodMetadata(new[] { "GET" })),
  991. CreateEndpoint("{language:length(2)}/test21/method-1", new HttpMethodMetadata(new[] { "GET" })),
  992. CreateEndpoint("{version:int}/{language:length(2)}/test21/method-1", new HttpMethodMetadata(new[] { "GET" })),
  993. CreateEndpoint("test21/method-2", new HttpMethodMetadata(new[] { "POST" })),
  994. CreateEndpoint("{language:length(2)}/test21/method-2", new HttpMethodMetadata(new[] { "POST" })),
  995. CreateEndpoint("{version:int}/{language:length(2)}/test21/method-2", new HttpMethodMetadata(new[] { "POST" })),
  996. CreateEndpoint("test21/method-3", new HttpMethodMetadata(new[] { "POST" })),
  997. CreateEndpoint("{language:length(2)}/test21/method-3", new HttpMethodMetadata(new[] { "POST" })),
  998. CreateEndpoint("{version:int}/{language:length(2)}/test21/method-3", new HttpMethodMetadata(new[] { "POST" })),
  999. CreateEndpoint("test22/method-1", new HttpMethodMetadata(new[] { "GET" })),
  1000. CreateEndpoint("{language:length(2)}/test22/method-1", new HttpMethodMetadata(new[] { "GET" })),
  1001. CreateEndpoint("{version:int}/{language:length(2)}/test22/method-1", new HttpMethodMetadata(new[] { "GET" })),
  1002. CreateEndpoint("test22/method-2", new HttpMethodMetadata(new[] { "POST" })),
  1003. CreateEndpoint("{language:length(2)}/test22/method-2", new HttpMethodMetadata(new[] { "POST" })),
  1004. CreateEndpoint("{version:int}/{language:length(2)}/test22/method-2", new HttpMethodMetadata(new[] { "POST" })),
  1005. CreateEndpoint("test22/method-3", new HttpMethodMetadata(new[] { "POST" })),
  1006. CreateEndpoint("{language:length(2)}/test22/method-3", new HttpMethodMetadata(new[] { "POST" })),
  1007. CreateEndpoint("{version:int}/{language:length(2)}/test22/method-3", new HttpMethodMetadata(new[] { "POST" })),
  1008. CreateEndpoint("test23/method-1", new HttpMethodMetadata(new[] { "GET" })),
  1009. CreateEndpoint("{language:length(2)}/test23/method-1", new HttpMethodMetadata(new[] { "GET" })),
  1010. CreateEndpoint("{version:int}/{language:length(2)}/test23/method-1", new HttpMethodMetadata(new[] { "GET" })),
  1011. CreateEndpoint("test23/method-2", new HttpMethodMetadata(new[] { "POST" })),
  1012. CreateEndpoint("{language:length(2)}/test23/method-2", new HttpMethodMetadata(new[] { "POST" })),
  1013. CreateEndpoint("{version:int}/{language:length(2)}/test23/method-2", new HttpMethodMetadata(new[] { "POST" })),
  1014. CreateEndpoint("test23/method-3", new HttpMethodMetadata(new[] { "POST" })),
  1015. CreateEndpoint("{language:length(2)}/test23/method-3", new HttpMethodMetadata(new[] { "POST" })),
  1016. CreateEndpoint("{version:int}/{language:length(2)}/test23/method-3", new HttpMethodMetadata(new[] { "POST" })),
  1017. CreateEndpoint("test24/method-1", new HttpMethodMetadata(new[] { "GET" })),
  1018. CreateEndpoint("{language:length(2)}/test24/method-1", new HttpMethodMetadata(new[] { "GET" })),
  1019. CreateEndpoint("{version:int}/{language:length(2)}/test24/method-1", new HttpMethodMetadata(new[] { "GET" })),
  1020. CreateEndpoint("test24/method-2", new HttpMethodMetadata(new[] { "POST" })),
  1021. CreateEndpoint("{language:length(2)}/test24/method-2", new HttpMethodMetadata(new[] { "POST" })),
  1022. CreateEndpoint("{version:int}/{language:length(2)}/test24/method-2", new HttpMethodMetadata(new[] { "POST" })),
  1023. CreateEndpoint("test24/method-3", new HttpMethodMetadata(new[] { "POST" })),
  1024. CreateEndpoint("{language:length(2)}/test24/method-3", new HttpMethodMetadata(new[] { "POST" })),
  1025. CreateEndpoint("{version:int}/{language:length(2)}/test24/method-3", new HttpMethodMetadata(new[] { "POST" })),
  1026. CreateEndpoint("test25/method-1", new HttpMethodMetadata(new[] { "GET" })),
  1027. CreateEndpoint("{language:length(2)}/test25/method-1", new HttpMethodMetadata(new[] { "GET" })),
  1028. CreateEndpoint("{version:int}/{language:length(2)}/test25/method-1", new HttpMethodMetadata(new[] { "GET" })),
  1029. CreateEndpoint("test25/method-2", new HttpMethodMetadata(new[] { "POST" })),
  1030. CreateEndpoint("{language:length(2)}/test25/method-2", new HttpMethodMetadata(new[] { "POST" })),
  1031. CreateEndpoint("{version:int}/{language:length(2)}/test25/method-2", new HttpMethodMetadata(new[] { "POST" })),
  1032. CreateEndpoint("test25/method-3", new HttpMethodMetadata(new[] { "POST" })),
  1033. CreateEndpoint("{language:length(2)}/test25/method-3", new HttpMethodMetadata(new[] { "POST" })),
  1034. CreateEndpoint("{version:int}/{language:length(2)}/test25/method-3", new HttpMethodMetadata(new[] { "POST" })),
  1035. CreateEndpoint("test26/method-1", new HttpMethodMetadata(new[] { "GET" })),
  1036. CreateEndpoint("{language:length(2)}/test26/method-1", new HttpMethodMetadata(new[] { "GET" })),
  1037. CreateEndpoint("{version:int}/{language:length(2)}/test26/method-1", new HttpMethodMetadata(new[] { "GET" })),
  1038. CreateEndpoint("test26/method-2", new HttpMethodMetadata(new[] { "POST" })),
  1039. CreateEndpoint("{language:length(2)}/test26/method-2", new HttpMethodMetadata(new[] { "POST" })),
  1040. CreateEndpoint("{version:int}/{language:length(2)}/test26/method-2", new HttpMethodMetadata(new[] { "POST" })),
  1041. CreateEndpoint("test26/method-3", new HttpMethodMetadata(new[] { "POST" })),
  1042. CreateEndpoint("{language:length(2)}/test26/method-3", new HttpMethodMetadata(new[] { "POST" })),
  1043. CreateEndpoint("{version:int}/{language:length(2)}/test26/method-3", new HttpMethodMetadata(new[] { "POST" })),
  1044. CreateEndpoint("test27/method-1", new HttpMethodMetadata(new[] { "GET" })),
  1045. CreateEndpoint("{language:length(2)}/test27/method-1", new HttpMethodMetadata(new[] { "GET" })),
  1046. CreateEndpoint("{version:int}/{language:length(2)}/test27/method-1", new HttpMethodMetadata(new[] { "GET" })),
  1047. CreateEndpoint("test27/method-2", new HttpMethodMetadata(new[] { "POST" })),
  1048. CreateEndpoint("{language:length(2)}/test27/method-2", new HttpMethodMetadata(new[] { "POST" })),
  1049. CreateEndpoint("{version:int}/{language:length(2)}/test27/method-2", new HttpMethodMetadata(new[] { "POST" })),
  1050. CreateEndpoint("test27/method-3", new HttpMethodMetadata(new[] { "POST" })),
  1051. CreateEndpoint("{language:length(2)}/test27/method-3", new HttpMethodMetadata(new[] { "POST" })),
  1052. CreateEndpoint("{version:int}/{language:length(2)}/test27/method-3", new HttpMethodMetadata(new[] { "POST" })),
  1053. CreateEndpoint("test28/method-1", new HttpMethodMetadata(new[] { "GET" })),
  1054. CreateEndpoint("{language:length(2)}/test28/method-1", new HttpMethodMetadata(new[] { "GET" })),
  1055. CreateEndpoint("{version:int}/{language:length(2)}/test28/method-1", new HttpMethodMetadata(new[] { "GET" })),
  1056. CreateEndpoint("test28/method-2", new HttpMethodMetadata(new[] { "POST" })),
  1057. CreateEndpoint("{language:length(2)}/test28/method-2", new HttpMethodMetadata(new[] { "POST" })),
  1058. CreateEndpoint("{version:int}/{language:length(2)}/test28/method-2", new HttpMethodMetadata(new[] { "POST" })),
  1059. CreateEndpoint("test28/method-3", new HttpMethodMetadata(new[] { "POST" })),
  1060. CreateEndpoint("{language:length(2)}/test28/method-3", new HttpMethodMetadata(new[] { "POST" })),
  1061. CreateEndpoint("{version:int}/{language:length(2)}/test28/method-3", new HttpMethodMetadata(new[] { "POST" })),
  1062. CreateEndpoint("test29/method-1", new HttpMethodMetadata(new[] { "GET" })),
  1063. CreateEndpoint("{language:length(2)}/test29/method-1", new HttpMethodMetadata(new[] { "GET" })),
  1064. CreateEndpoint("{version:int}/{language:length(2)}/test29/method-1", new HttpMethodMetadata(new[] { "GET" })),
  1065. CreateEndpoint("test29/method-2", new HttpMethodMetadata(new[] { "POST" })),
  1066. CreateEndpoint("{language:length(2)}/test29/method-2", new HttpMethodMetadata(new[] { "POST" })),
  1067. CreateEndpoint("{version:int}/{language:length(2)}/test29/method-2", new HttpMethodMetadata(new[] { "POST" })),
  1068. CreateEndpoint("test29/method-3", new HttpMethodMetadata(new[] { "POST" })),
  1069. CreateEndpoint("{language:length(2)}/test29/method-3", new HttpMethodMetadata(new[] { "POST" })),
  1070. CreateEndpoint("{version:int}/{language:length(2)}/test29/method-3", new HttpMethodMetadata(new[] { "POST" })),
  1071. CreateEndpoint("test30/method-1", new HttpMethodMetadata(new[] { "GET" })),
  1072. CreateEndpoint("{language:length(2)}/test30/method-1", new HttpMethodMetadata(new[] { "GET" })),
  1073. CreateEndpoint("{version:int}/{language:length(2)}/test30/method-1", new HttpMethodMetadata(new[] { "GET" })),
  1074. CreateEndpoint("test30/method-2", new HttpMethodMetadata(new[] { "POST" })),
  1075. CreateEndpoint("{language:length(2)}/test30/method-2", new HttpMethodMetadata(new[] { "POST" })),
  1076. CreateEndpoint("{version:int}/{language:length(2)}/test30/method-2", new HttpMethodMetadata(new[] { "POST" })),
  1077. CreateEndpoint("test30/method-3", new HttpMethodMetadata(new[] { "POST" })),
  1078. CreateEndpoint("{language:length(2)}/test30/method-3", new HttpMethodMetadata(new[] { "POST" })),
  1079. CreateEndpoint("{version:int}/{language:length(2)}/test30/method-3", new HttpMethodMetadata(new[] { "POST" })),
  1080. CreateEndpoint("test31/method-1", new HttpMethodMetadata(new[] { "GET" })),
  1081. CreateEndpoint("{language:length(2)}/test31/method-1", new HttpMethodMetadata(new[] { "GET" })),
  1082. CreateEndpoint("{version:int}/{language:length(2)}/test31/method-1", new HttpMethodMetadata(new[] { "GET" })),
  1083. CreateEndpoint("test31/method-2", new HttpMethodMetadata(new[] { "POST" })),
  1084. CreateEndpoint("{language:length(2)}/test31/method-2", new HttpMethodMetadata(new[] { "POST" })),
  1085. CreateEndpoint("{version:int}/{language:length(2)}/test31/method-2", new HttpMethodMetadata(new[] { "POST" })),
  1086. CreateEndpoint("test31/method-3", new HttpMethodMetadata(new[] { "POST" })),
  1087. CreateEndpoint("{language:length(2)}/test31/method-3", new HttpMethodMetadata(new[] { "POST" })),
  1088. CreateEndpoint("{version:int}/{language:length(2)}/test31/method-3", new HttpMethodMetadata(new[] { "POST" })),
  1089. CreateEndpoint("test32/method-1", new HttpMethodMetadata(new[] { "GET" })),
  1090. CreateEndpoint("{language:length(2)}/test32/method-1", new HttpMethodMetadata(new[] { "GET" })),
  1091. CreateEndpoint("{version:int}/{language:length(2)}/test32/method-1", new HttpMethodMetadata(new[] { "GET" })),
  1092. CreateEndpoint("test32/method-2", new HttpMethodMetadata(new[] { "POST" })),
  1093. CreateEndpoint("{language:length(2)}/test32/method-2", new HttpMethodMetadata(new[] { "POST" })),
  1094. CreateEndpoint("{version:int}/{language:length(2)}/test32/method-2", new HttpMethodMetadata(new[] { "POST" })),
  1095. CreateEndpoint("test32/method-3", new HttpMethodMetadata(new[] { "POST" })),
  1096. CreateEndpoint("{language:length(2)}/test32/method-3", new HttpMethodMetadata(new[] { "POST" })),
  1097. CreateEndpoint("{version:int}/{language:length(2)}/test32/method-3", new HttpMethodMetadata(new[] { "POST" })),
  1098. CreateEndpoint("test33/method-1", new HttpMethodMetadata(new[] { "GET" })),
  1099. CreateEndpoint("{language:length(2)}/test33/method-1", new HttpMethodMetadata(new[] { "GET" })),
  1100. CreateEndpoint("{version:int}/{language:length(2)}/test33/method-1", new HttpMethodMetadata(new[] { "GET" })),
  1101. CreateEndpoint("test33/method-2", new HttpMethodMetadata(new[] { "POST" })),
  1102. CreateEndpoint("{language:length(2)}/test33/method-2", new HttpMethodMetadata(new[] { "POST" })),
  1103. CreateEndpoint("{version:int}/{language:length(2)}/test33/method-2", new HttpMethodMetadata(new[] { "POST" })),
  1104. CreateEndpoint("test33/method-3", new HttpMethodMetadata(new[] { "POST" })),
  1105. CreateEndpoint("{language:length(2)}/test33/method-3", new HttpMethodMetadata(new[] { "POST" })),
  1106. CreateEndpoint("{version:int}/{language:length(2)}/test33/method-3", new HttpMethodMetadata(new[] { "POST" })),
  1107. CreateEndpoint("test34/method-1", new HttpMethodMetadata(new[] { "GET" })),
  1108. CreateEndpoint("{language:length(2)}/test34/method-1", new HttpMethodMetadata(new[] { "GET" })),
  1109. CreateEndpoint("{version:int}/{language:length(2)}/test34/method-1", new HttpMethodMetadata(new[] { "GET" })),
  1110. CreateEndpoint("test34/method-2", new HttpMethodMetadata(new[] { "POST" })),
  1111. CreateEndpoint("{language:length(2)}/test34/method-2", new HttpMethodMetadata(new[] { "POST" })),
  1112. CreateEndpoint("{version:int}/{language:length(2)}/test34/method-2", new HttpMethodMetadata(new[] { "POST" })),
  1113. CreateEndpoint("test34/method-3", new HttpMethodMetadata(new[] { "POST" })),
  1114. CreateEndpoint("{language:length(2)}/test34/method-3", new HttpMethodMetadata(new[] { "POST" })),
  1115. CreateEndpoint("{version:int}/{language:length(2)}/test34/method-3", new HttpMethodMetadata(new[] { "POST" })),
  1116. CreateEndpoint("test35/method-1", new HttpMethodMetadata(new[] { "GET" })),
  1117. CreateEndpoint("{language:length(2)}/test35/method-1", new HttpMethodMetadata(new[] { "GET" })),
  1118. CreateEndpoint("{version:int}/{language:length(2)}/test35/method-1", new HttpMethodMetadata(new[] { "GET" })),
  1119. CreateEndpoint("test35/method-2", new HttpMethodMetadata(new[] { "POST" })),
  1120. CreateEndpoint("{language:length(2)}/test35/method-2", new HttpMethodMetadata(new[] { "POST" })),
  1121. CreateEndpoint("{version:int}/{language:length(2)}/test35/method-2", new HttpMethodMetadata(new[] { "POST" })),
  1122. CreateEndpoint("test35/method-3", new HttpMethodMetadata(new[] { "POST" })),
  1123. CreateEndpoint("{language:length(2)}/test35/method-3", new HttpMethodMetadata(new[] { "POST" })),
  1124. CreateEndpoint("{version:int}/{language:length(2)}/test35/method-3", new HttpMethodMetadata(new[] { "POST" })),
  1125. CreateEndpoint("test36/method-1", new HttpMethodMetadata(new[] { "GET" })),
  1126. CreateEndpoint("{language:length(2)}/test36/method-1", new HttpMethodMetadata(new[] { "GET" })),
  1127. CreateEndpoint("{version:int}/{language:length(2)}/test36/method-1", new HttpMethodMetadata(new[] { "GET" })),
  1128. CreateEndpoint("test36/method-2", new HttpMethodMetadata(new[] { "POST" })),
  1129. CreateEndpoint("{language:length(2)}/test36/method-2", new HttpMethodMetadata(new[] { "POST" })),
  1130. CreateEndpoint("{version:int}/{language:length(2)}/test36/method-2", new HttpMethodMetadata(new[] { "POST" })),
  1131. CreateEndpoint("test36/method-3", new HttpMethodMetadata(new[] { "POST" })),
  1132. CreateEndpoint("{language:length(2)}/test36/method-3", new HttpMethodMetadata(new[] { "POST" })),
  1133. CreateEndpoint("{version:int}/{language:length(2)}/test36/method-3", new HttpMethodMetadata(new[] { "POST" })),
  1134. CreateEndpoint("test37/method-1", new HttpMethodMetadata(new[] { "GET" })),
  1135. CreateEndpoint("{language:length(2)}/test37/method-1", new HttpMethodMetadata(new[] { "GET" })),
  1136. CreateEndpoint("{version:int}/{language:length(2)}/test37/method-1", new HttpMethodMetadata(new[] { "GET" })),
  1137. CreateEndpoint("test37/method-2", new HttpMethodMetadata(new[] { "POST" })),
  1138. CreateEndpoint("{language:length(2)}/test37/method-2", new HttpMethodMetadata(new[] { "POST" })),
  1139. CreateEndpoint("{version:int}/{language:length(2)}/test37/method-2", new HttpMethodMetadata(new[] { "POST" })),
  1140. CreateEndpoint("test37/method-3", new HttpMethodMetadata(new[] { "POST" })),
  1141. CreateEndpoint("{language:length(2)}/test37/method-3", new HttpMethodMetadata(new[] { "POST" })),
  1142. CreateEndpoint("{version:int}/{language:length(2)}/test37/method-3", new HttpMethodMetadata(new[] { "POST" })),
  1143. CreateEndpoint("test38/method-1", new HttpMethodMetadata(new[] { "GET" })),
  1144. CreateEndpoint("{language:length(2)}/test38/method-1", new HttpMethodMetadata(new[] { "GET" })),
  1145. CreateEndpoint("{version:int}/{language:length(2)}/test38/method-1", new HttpMethodMetadata(new[] { "GET" })),
  1146. CreateEndpoint("test38/method-2", new HttpMethodMetadata(new[] { "POST" })),
  1147. CreateEndpoint("{language:length(2)}/test38/method-2", new HttpMethodMetadata(new[] { "POST" })),
  1148. CreateEndpoint("{version:int}/{language:length(2)}/test38/method-2", new HttpMethodMetadata(new[] { "POST" })),
  1149. CreateEndpoint("test38/method-3", new HttpMethodMetadata(new[] { "POST" })),
  1150. CreateEndpoint("{language:length(2)}/test38/method-3", new HttpMethodMetadata(new[] { "POST" })),
  1151. CreateEndpoint("{version:int}/{language:length(2)}/test38/method-3", new HttpMethodMetadata(new[] { "POST" })),
  1152. CreateEndpoint("test39/method-1", new HttpMethodMetadata(new[] { "GET" })),
  1153. CreateEndpoint("{language:length(2)}/test39/method-1", new HttpMethodMetadata(new[] { "GET" })),
  1154. CreateEndpoint("{version:int}/{language:length(2)}/test39/method-1", new HttpMethodMetadata(new[] { "GET" })),
  1155. CreateEndpoint("test39/method-2", new HttpMethodMetadata(new[] { "POST" })),
  1156. CreateEndpoint("{language:length(2)}/test39/method-2", new HttpMethodMetadata(new[] { "POST" })),
  1157. CreateEndpoint("{version:int}/{language:length(2)}/test39/method-2", new HttpMethodMetadata(new[] { "POST" })),
  1158. CreateEndpoint("test39/method-3", new HttpMethodMetadata(new[] { "POST" })),
  1159. CreateEndpoint("{language:length(2)}/test39/method-3", new HttpMethodMetadata(new[] { "POST" })),
  1160. CreateEndpoint("{version:int}/{language:length(2)}/test39/method-3", new HttpMethodMetadata(new[] { "POST" })),
  1161. CreateEndpoint("test40/method-1", new HttpMethodMetadata(new[] { "GET" })),
  1162. CreateEndpoint("{language:length(2)}/test40/method-1", new HttpMethodMetadata(new[] { "GET" })),
  1163. CreateEndpoint("{version:int}/{language:length(2)}/test40/method-1", new HttpMethodMetadata(new[] { "GET" })),
  1164. CreateEndpoint("test40/method-2", new HttpMethodMetadata(new[] { "POST" })),
  1165. CreateEndpoint("{language:length(2)}/test40/method-2", new HttpMethodMetadata(new[] { "POST" })),
  1166. CreateEndpoint("{version:int}/{language:length(2)}/test40/method-2", new HttpMethodMetadata(new[] { "POST" })),
  1167. CreateEndpoint("test40/method-3", new HttpMethodMetadata(new[] { "POST" })),
  1168. CreateEndpoint("{language:length(2)}/test40/method-3", new HttpMethodMetadata(new[] { "POST" })),
  1169. CreateEndpoint("{version:int}/{language:length(2)}/test40/method-3", new HttpMethodMetadata(new[] { "POST" })),
  1170. CreateEndpoint("test41/method-1", new HttpMethodMetadata(new[] { "GET" })),
  1171. CreateEndpoint("{language:length(2)}/test41/method-1", new HttpMethodMetadata(new[] { "GET" })),
  1172. CreateEndpoint("{version:int}/{language:length(2)}/test41/method-1", new HttpMethodMetadata(new[] { "GET" })),
  1173. CreateEndpoint("test41/method-2", new HttpMethodMetadata(new[] { "POST" })),
  1174. CreateEndpoint("{language:length(2)}/test41/method-2", new HttpMethodMetadata(new[] { "POST" })),
  1175. CreateEndpoint("{version:int}/{language:length(2)}/test41/method-2", new HttpMethodMetadata(new[] { "POST" })),
  1176. CreateEndpoint("test41/method-3", new HttpMethodMetadata(new[] { "POST" })),
  1177. CreateEndpoint("{language:length(2)}/test41/method-3", new HttpMethodMetadata(new[] { "POST" })),
  1178. CreateEndpoint("{version:int}/{language:length(2)}/test41/method-3", new HttpMethodMetadata(new[] { "POST" })),
  1179. CreateEndpoint("test42/method-1", new HttpMethodMetadata(new[] { "GET" })),
  1180. CreateEndpoint("{language:length(2)}/test42/method-1", new HttpMethodMetadata(new[] { "GET" })),
  1181. CreateEndpoint("{version:int}/{language:length(2)}/test42/method-1", new HttpMethodMetadata(new[] { "GET" })),
  1182. CreateEndpoint("test42/method-2", new HttpMethodMetadata(new[] { "POST" })),
  1183. CreateEndpoint("{language:length(2)}/test42/method-2", new HttpMethodMetadata(new[] { "POST" })),
  1184. CreateEndpoint("{version:int}/{language:length(2)}/test42/method-2", new HttpMethodMetadata(new[] { "POST" })),
  1185. CreateEndpoint("test42/method-3", new HttpMethodMetadata(new[] { "POST" })),
  1186. CreateEndpoint("{language:length(2)}/test42/method-3", new HttpMethodMetadata(new[] { "POST" })),
  1187. CreateEndpoint("{version:int}/{language:length(2)}/test42/method-3", new HttpMethodMetadata(new[] { "POST" })),
  1188. CreateEndpoint("test43/method-1", new HttpMethodMetadata(new[] { "GET" })),
  1189. CreateEndpoint("{language:length(2)}/test43/method-1", new HttpMethodMetadata(new[] { "GET" })),
  1190. CreateEndpoint("{version:int}/{language:length(2)}/test43/method-1", new HttpMethodMetadata(new[] { "GET" })),
  1191. CreateEndpoint("test43/method-2", new HttpMethodMetadata(new[] { "POST" })),
  1192. CreateEndpoint("{language:length(2)}/test43/method-2", new HttpMethodMetadata(new[] { "POST" })),
  1193. CreateEndpoint("{version:int}/{language:length(2)}/test43/method-2", new HttpMethodMetadata(new[] { "POST" })),
  1194. CreateEndpoint("test43/method-3", new HttpMethodMetadata(new[] { "POST" })),
  1195. CreateEndpoint("{language:length(2)}/test43/method-3", new HttpMethodMetadata(new[] { "POST" })),
  1196. CreateEndpoint("{version:int}/{language:length(2)}/test43/method-3", new HttpMethodMetadata(new[] { "POST" })),
  1197. CreateEndpoint("test44/method-1", new HttpMethodMetadata(new[] { "GET" })),
  1198. CreateEndpoint("{language:length(2)}/test44/method-1", new HttpMethodMetadata(new[] { "GET" })),
  1199. CreateEndpoint("{version:int}/{language:length(2)}/test44/method-1", new HttpMethodMetadata(new[] { "GET" })),
  1200. CreateEndpoint("test44/method-2", new HttpMethodMetadata(new[] { "POST" })),
  1201. CreateEndpoint("{language:length(2)}/test44/method-2", new HttpMethodMetadata(new[] { "POST" })),
  1202. CreateEndpoint("{version:int}/{language:length(2)}/test44/method-2", new HttpMethodMetadata(new[] { "POST" })),
  1203. CreateEndpoint("test44/method-3", new HttpMethodMetadata(new[] { "POST" })),
  1204. CreateEndpoint("{language:length(2)}/test44/method-3", new HttpMethodMetadata(new[] { "POST" })),
  1205. CreateEndpoint("{version:int}/{language:length(2)}/test44/method-3", new HttpMethodMetadata(new[] { "POST" })),
  1206. CreateEndpoint("test45/method-1", new HttpMethodMetadata(new[] { "GET" })),
  1207. CreateEndpoint("{language:length(2)}/test45/method-1", new HttpMethodMetadata(new[] { "GET" })),
  1208. CreateEndpoint("{version:int}/{language:length(2)}/test45/method-1", new HttpMethodMetadata(new[] { "GET" })),
  1209. CreateEndpoint("test45/method-2", new HttpMethodMetadata(new[] { "POST" })),
  1210. CreateEndpoint("{language:length(2)}/test45/method-2", new HttpMethodMetadata(new[] { "POST" })),
  1211. CreateEndpoint("{version:int}/{language:length(2)}/test45/method-2", new HttpMethodMetadata(new[] { "POST" })),
  1212. CreateEndpoint("test45/method-3", new HttpMethodMetadata(new[] { "POST" })),
  1213. CreateEndpoint("{language:length(2)}/test45/method-3", new HttpMethodMetadata(new[] { "POST" })),
  1214. CreateEndpoint("{version:int}/{language:length(2)}/test45/method-3", new HttpMethodMetadata(new[] { "POST" })),
  1215. CreateEndpoint("test46/method-1", new HttpMethodMetadata(new[] { "GET" })),
  1216. CreateEndpoint("{language:length(2)}/test46/method-1", new HttpMethodMetadata(new[] { "GET" })),
  1217. CreateEndpoint("{version:int}/{language:length(2)}/test46/method-1", new HttpMethodMetadata(new[] { "GET" })),
  1218. CreateEndpoint("test46/method-2", new HttpMethodMetadata(new[] { "POST" })),
  1219. CreateEndpoint("{language:length(2)}/test46/method-2", new HttpMethodMetadata(new[] { "POST" })),
  1220. CreateEndpoint("{version:int}/{language:length(2)}/test46/method-2", new HttpMethodMetadata(new[] { "POST" })),
  1221. CreateEndpoint("test46/method-3", new HttpMethodMetadata(new[] { "POST" })),
  1222. CreateEndpoint("{language:length(2)}/test46/method-3", new HttpMethodMetadata(new[] { "POST" })),
  1223. CreateEndpoint("{version:int}/{language:length(2)}/test46/method-3", new HttpMethodMetadata(new[] { "POST" })),
  1224. CreateEndpoint("test47/method-1", new HttpMethodMetadata(new[] { "GET" })),
  1225. CreateEndpoint("{language:length(2)}/test47/method-1", new HttpMethodMetadata(new[] { "GET" })),
  1226. CreateEndpoint("{version:int}/{language:length(2)}/test47/method-1", new HttpMethodMetadata(new[] { "GET" })),
  1227. CreateEndpoint("test47/method-2", new HttpMethodMetadata(new[] { "POST" })),
  1228. CreateEndpoint("{language:length(2)}/test47/method-2", new HttpMethodMetadata(new[] { "POST" })),
  1229. CreateEndpoint("{version:int}/{language:length(2)}/test47/method-2", new HttpMethodMetadata(new[] { "POST" })),
  1230. CreateEndpoint("test47/method-3", new HttpMethodMetadata(new[] { "POST" })),
  1231. CreateEndpoint("{language:length(2)}/test47/method-3", new HttpMethodMetadata(new[] { "POST" })),
  1232. CreateEndpoint("{version:int}/{language:length(2)}/test47/method-3", new HttpMethodMetadata(new[] { "POST" })),
  1233. CreateEndpoint("test48/method-1", new HttpMethodMetadata(new[] { "GET" })),
  1234. CreateEndpoint("{language:length(2)}/test48/method-1", new HttpMethodMetadata(new[] { "GET" })),
  1235. CreateEndpoint("{version:int}/{language:length(2)}/test48/method-1", new HttpMethodMetadata(new[] { "GET" })),
  1236. CreateEndpoint("test48/method-2", new HttpMethodMetadata(new[] { "POST" })),
  1237. CreateEndpoint("{language:length(2)}/test48/method-2", new HttpMethodMetadata(new[] { "POST" })),
  1238. CreateEndpoint("{version:int}/{language:length(2)}/test48/method-2", new HttpMethodMetadata(new[] { "POST" })),
  1239. CreateEndpoint("test48/method-3", new HttpMethodMetadata(new[] { "POST" })),
  1240. CreateEndpoint("{language:length(2)}/test48/method-3", new HttpMethodMetadata(new[] { "POST" })),
  1241. CreateEndpoint("{version:int}/{language:length(2)}/test48/method-3", new HttpMethodMetadata(new[] { "POST" })),
  1242. CreateEndpoint("test49/method-1", new HttpMethodMetadata(new[] { "GET" })),
  1243. CreateEndpoint("{language:length(2)}/test49/method-1", new HttpMethodMetadata(new[] { "GET" })),
  1244. CreateEndpoint("{version:int}/{language:length(2)}/test49/method-1", new HttpMethodMetadata(new[] { "GET" })),
  1245. CreateEndpoint("test49/method-2", new HttpMethodMetadata(new[] { "POST" })),
  1246. CreateEndpoint("{language:length(2)}/test49/method-2", new HttpMethodMetadata(new[] { "POST" })),
  1247. CreateEndpoint("{version:int}/{language:length(2)}/test49/method-2", new HttpMethodMetadata(new[] { "POST" })),
  1248. CreateEndpoint("test49/method-3", new HttpMethodMetadata(new[] { "POST" })),
  1249. CreateEndpoint("{language:length(2)}/test49/method-3", new HttpMethodMetadata(new[] { "POST" })),
  1250. CreateEndpoint("{version:int}/{language:length(2)}/test49/method-3", new HttpMethodMetadata(new[] { "POST" })),
  1251. CreateEndpoint("test50/method-1", new HttpMethodMetadata(new[] { "GET" })),
  1252. CreateEndpoint("{language:length(2)}/test50/method-1", new HttpMethodMetadata(new[] { "GET" })),
  1253. CreateEndpoint("{version:int}/{language:length(2)}/test50/method-1", new HttpMethodMetadata(new[] { "GET" })),
  1254. CreateEndpoint("test50/method-2", new HttpMethodMetadata(new[] { "POST" })),
  1255. CreateEndpoint("{language:length(2)}/test50/method-2", new HttpMethodMetadata(new[] { "POST" })),
  1256. CreateEndpoint("{version:int}/{language:length(2)}/test50/method-2", new HttpMethodMetadata(new[] { "POST" })),
  1257. CreateEndpoint("test50/method-3", new HttpMethodMetadata(new[] { "POST" })),
  1258. CreateEndpoint("{language:length(2)}/test50/method-3", new HttpMethodMetadata(new[] { "POST" })),
  1259. CreateEndpoint("{version:int}/{language:length(2)}/test50/method-3", new HttpMethodMetadata(new[] { "POST" })),
  1260. CreateEndpoint("test51/method-1", new HttpMethodMetadata(new[] { "GET" })),
  1261. CreateEndpoint("{language:length(2)}/test51/method-1", new HttpMethodMetadata(new[] { "GET" })),
  1262. CreateEndpoint("{version:int}/{language:length(2)}/test51/method-1", new HttpMethodMetadata(new[] { "GET" })),
  1263. CreateEndpoint("test51/method-2", new HttpMethodMetadata(new[] { "POST" })),
  1264. CreateEndpoint("{language:length(2)}/test51/method-2", new HttpMethodMetadata(new[] { "POST" })),
  1265. CreateEndpoint("{version:int}/{language:length(2)}/test51/method-2", new HttpMethodMetadata(new[] { "POST" })),
  1266. CreateEndpoint("test51/method-3", new HttpMethodMetadata(new[] { "POST" })),
  1267. CreateEndpoint("{language:length(2)}/test51/method-3", new HttpMethodMetadata(new[] { "POST" })),
  1268. CreateEndpoint("{version:int}/{language:length(2)}/test51/method-3", new HttpMethodMetadata(new[] { "POST" })),
  1269. CreateEndpoint("test52/method-1", new HttpMethodMetadata(new[] { "GET" })),
  1270. CreateEndpoint("{language:length(2)}/test52/method-1", new HttpMethodMetadata(new[] { "GET" })),
  1271. CreateEndpoint("{version:int}/{language:length(2)}/test52/method-1", new HttpMethodMetadata(new[] { "GET" })),
  1272. CreateEndpoint("test52/method-2", new HttpMethodMetadata(new[] { "POST" })),
  1273. CreateEndpoint("{language:length(2)}/test52/method-2", new HttpMethodMetadata(new[] { "POST" })),
  1274. CreateEndpoint("{version:int}/{language:length(2)}/test52/method-2", new HttpMethodMetadata(new[] { "POST" })),
  1275. CreateEndpoint("test52/method-3", new HttpMethodMetadata(new[] { "POST" })),
  1276. CreateEndpoint("{language:length(2)}/test52/method-3", new HttpMethodMetadata(new[] { "POST" })),
  1277. CreateEndpoint("{version:int}/{language:length(2)}/test52/method-3", new HttpMethodMetadata(new[] { "POST" })),
  1278. CreateEndpoint("test53/method-1", new HttpMethodMetadata(new[] { "GET" })),
  1279. CreateEndpoint("{language:length(2)}/test53/method-1", new HttpMethodMetadata(new[] { "GET" })),
  1280. CreateEndpoint("{version:int}/{language:length(2)}/test53/method-1", new HttpMethodMetadata(new[] { "GET" })),
  1281. CreateEndpoint("test53/method-2", new HttpMethodMetadata(new[] { "POST" })),
  1282. CreateEndpoint("{language:length(2)}/test53/method-2", new HttpMethodMetadata(new[] { "POST" })),
  1283. CreateEndpoint("{version:int}/{language:length(2)}/test53/method-2", new HttpMethodMetadata(new[] { "POST" })),
  1284. CreateEndpoint("test53/method-3", new HttpMethodMetadata(new[] { "POST" })),
  1285. CreateEndpoint("{language:length(2)}/test53/method-3", new HttpMethodMetadata(new[] { "POST" })),
  1286. CreateEndpoint("{version:int}/{language:length(2)}/test53/method-3", new HttpMethodMetadata(new[] { "POST" })),
  1287. CreateEndpoint("test54/method-1", new HttpMethodMetadata(new[] { "GET" })),
  1288. CreateEndpoint("{language:length(2)}/test54/method-1", new HttpMethodMetadata(new[] { "GET" })),
  1289. CreateEndpoint("{version:int}/{language:length(2)}/test54/method-1", new HttpMethodMetadata(new[] { "GET" })),
  1290. CreateEndpoint("test54/method-2", new HttpMethodMetadata(new[] { "POST" })),
  1291. CreateEndpoint("{language:length(2)}/test54/method-2", new HttpMethodMetadata(new[] { "POST" })),
  1292. CreateEndpoint("{version:int}/{language:length(2)}/test54/method-2", new HttpMethodMetadata(new[] { "POST" })),
  1293. CreateEndpoint("test54/method-3", new HttpMethodMetadata(new[] { "POST" })),
  1294. CreateEndpoint("{language:length(2)}/test54/method-3", new HttpMethodMetadata(new[] { "POST" })),
  1295. CreateEndpoint("{version:int}/{language:length(2)}/test54/method-3", new HttpMethodMetadata(new[] { "POST" })),
  1296. CreateEndpoint("test55/method-1", new HttpMethodMetadata(new[] { "GET" })),
  1297. CreateEndpoint("{language:length(2)}/test55/method-1", new HttpMethodMetadata(new[] { "GET" })),
  1298. CreateEndpoint("{version:int}/{language:length(2)}/test55/method-1", new HttpMethodMetadata(new[] { "GET" })),
  1299. CreateEndpoint("test55/method-2", new HttpMethodMetadata(new[] { "POST" })),
  1300. CreateEndpoint("{language:length(2)}/test55/method-2", new HttpMethodMetadata(new[] { "POST" })),
  1301. CreateEndpoint("{version:int}/{language:length(2)}/test55/method-2", new HttpMethodMetadata(new[] { "POST" })),
  1302. CreateEndpoint("test55/method-3", new HttpMethodMetadata(new[] { "POST" })),
  1303. CreateEndpoint("{language:length(2)}/test55/method-3", new HttpMethodMetadata(new[] { "POST" })),
  1304. CreateEndpoint("{version:int}/{language:length(2)}/test55/method-3", new HttpMethodMetadata(new[] { "POST" })),
  1305. CreateEndpoint("test56/method-1", new HttpMethodMetadata(new[] { "GET" })),
  1306. CreateEndpoint("{language:length(2)}/test56/method-1", new HttpMethodMetadata(new[] { "GET" })),
  1307. CreateEndpoint("{version:int}/{language:length(2)}/test56/method-1", new HttpMethodMetadata(new[] { "GET" })),
  1308. CreateEndpoint("test56/method-2", new HttpMethodMetadata(new[] { "POST" })),
  1309. CreateEndpoint("{language:length(2)}/test56/method-2", new HttpMethodMetadata(new[] { "POST" })),
  1310. CreateEndpoint("{version:int}/{language:length(2)}/test56/method-2", new HttpMethodMetadata(new[] { "POST" })),
  1311. CreateEndpoint("test56/method-3", new HttpMethodMetadata(new[] { "POST" })),
  1312. CreateEndpoint("{language:length(2)}/test56/method-3", new HttpMethodMetadata(new[] { "POST" })),
  1313. CreateEndpoint("{version:int}/{language:length(2)}/test56/method-3", new HttpMethodMetadata(new[] { "POST" })),
  1314. CreateEndpoint("test57/method-1", new HttpMethodMetadata(new[] { "GET" })),
  1315. CreateEndpoint("{language:length(2)}/test57/method-1", new HttpMethodMetadata(new[] { "GET" })),
  1316. CreateEndpoint("{version:int}/{language:length(2)}/test57/method-1", new HttpMethodMetadata(new[] { "GET" })),
  1317. CreateEndpoint("test57/method-2", new HttpMethodMetadata(new[] { "POST" })),
  1318. CreateEndpoint("{language:length(2)}/test57/method-2", new HttpMethodMetadata(new[] { "POST" })),
  1319. CreateEndpoint("{version:int}/{language:length(2)}/test57/method-2", new HttpMethodMetadata(new[] { "POST" })),
  1320. CreateEndpoint("test57/method-3", new HttpMethodMetadata(new[] { "POST" })),
  1321. CreateEndpoint("{language:length(2)}/test57/method-3", new HttpMethodMetadata(new[] { "POST" })),
  1322. CreateEndpoint("{version:int}/{language:length(2)}/test57/method-3", new HttpMethodMetadata(new[] { "POST" })),
  1323. CreateEndpoint("test58/method-1", new HttpMethodMetadata(new[] { "GET" })),
  1324. CreateEndpoint("{language:length(2)}/test58/method-1", new HttpMethodMetadata(new[] { "GET" })),
  1325. CreateEndpoint("{version:int}/{language:length(2)}/test58/method-1", new HttpMethodMetadata(new[] { "GET" })),
  1326. CreateEndpoint("test58/method-2", new HttpMethodMetadata(new[] { "POST" })),
  1327. CreateEndpoint("{language:length(2)}/test58/method-2", new HttpMethodMetadata(new[] { "POST" })),
  1328. CreateEndpoint("{version:int}/{language:length(2)}/test58/method-2", new HttpMethodMetadata(new[] { "POST" })),
  1329. CreateEndpoint("test58/method-3", new HttpMethodMetadata(new[] { "POST" })),
  1330. CreateEndpoint("{language:length(2)}/test58/method-3", new HttpMethodMetadata(new[] { "POST" })),
  1331. CreateEndpoint("{version:int}/{language:length(2)}/test58/method-3", new HttpMethodMetadata(new[] { "POST" })),
  1332. CreateEndpoint("test59/method-1", new HttpMethodMetadata(new[] { "GET" })),
  1333. CreateEndpoint("{language:length(2)}/test59/method-1", new HttpMethodMetadata(new[] { "GET" })),
  1334. CreateEndpoint("{version:int}/{language:length(2)}/test59/method-1", new HttpMethodMetadata(new[] { "GET" })),
  1335. CreateEndpoint("test59/method-2", new HttpMethodMetadata(new[] { "POST" })),
  1336. CreateEndpoint("{language:length(2)}/test59/method-2", new HttpMethodMetadata(new[] { "POST" })),
  1337. CreateEndpoint("{version:int}/{language:length(2)}/test59/method-2", new HttpMethodMetadata(new[] { "POST" })),
  1338. CreateEndpoint("test59/method-3", new HttpMethodMetadata(new[] { "POST" })),
  1339. CreateEndpoint("{language:length(2)}/test59/method-3", new HttpMethodMetadata(new[] { "POST" })),
  1340. CreateEndpoint("{version:int}/{language:length(2)}/test59/method-3", new HttpMethodMetadata(new[] { "POST" })),
  1341. CreateEndpoint("test60/method-1", new HttpMethodMetadata(new[] { "GET" })),
  1342. CreateEndpoint("{language:length(2)}/test60/method-1", new HttpMethodMetadata(new[] { "GET" })),
  1343. CreateEndpoint("{version:int}/{language:length(2)}/test60/method-1", new HttpMethodMetadata(new[] { "GET" })),
  1344. CreateEndpoint("test60/method-2", new HttpMethodMetadata(new[] { "POST" })),
  1345. CreateEndpoint("{language:length(2)}/test60/method-2", new HttpMethodMetadata(new[] { "POST" })),
  1346. CreateEndpoint("{version:int}/{language:length(2)}/test60/method-2", new HttpMethodMetadata(new[] { "POST" })),
  1347. CreateEndpoint("test60/method-3", new HttpMethodMetadata(new[] { "POST" })),
  1348. CreateEndpoint("{language:length(2)}/test60/method-3", new HttpMethodMetadata(new[] { "POST" })),
  1349. CreateEndpoint("{version:int}/{language:length(2)}/test60/method-3", new HttpMethodMetadata(new[] { "POST" })),
  1350. CreateEndpoint("test61/method-1", new HttpMethodMetadata(new[] { "GET" })),
  1351. CreateEndpoint("{language:length(2)}/test61/method-1", new HttpMethodMetadata(new[] { "GET" })),
  1352. CreateEndpoint("{version:int}/{language:length(2)}/test61/method-1", new HttpMethodMetadata(new[] { "GET" })),
  1353. CreateEndpoint("test61/method-2", new HttpMethodMetadata(new[] { "POST" })),
  1354. CreateEndpoint("{language:length(2)}/test61/method-2", new HttpMethodMetadata(new[] { "POST" })),
  1355. CreateEndpoint("{version:int}/{language:length(2)}/test61/method-2", new HttpMethodMetadata(new[] { "POST" })),
  1356. CreateEndpoint("test61/method-3", new HttpMethodMetadata(new[] { "POST" })),
  1357. CreateEndpoint("{language:length(2)}/test61/method-3", new HttpMethodMetadata(new[] { "POST" })),
  1358. CreateEndpoint("{version:int}/{language:length(2)}/test61/method-3", new HttpMethodMetadata(new[] { "POST" })),
  1359. CreateEndpoint("test62/method-1", new HttpMethodMetadata(new[] { "GET" })),
  1360. CreateEndpoint("{language:length(2)}/test62/method-1", new HttpMethodMetadata(new[] { "GET" })),
  1361. CreateEndpoint("{version:int}/{language:length(2)}/test62/method-1", new HttpMethodMetadata(new[] { "GET" })),
  1362. CreateEndpoint("test62/method-2", new HttpMethodMetadata(new[] { "POST" })),
  1363. CreateEndpoint("{language:length(2)}/test62/method-2", new HttpMethodMetadata(new[] { "POST" })),
  1364. CreateEndpoint("{version:int}/{language:length(2)}/test62/method-2", new HttpMethodMetadata(new[] { "POST" })),
  1365. CreateEndpoint("test62/method-3", new HttpMethodMetadata(new[] { "POST" })),
  1366. CreateEndpoint("{language:length(2)}/test62/method-3", new HttpMethodMetadata(new[] { "POST" })),
  1367. CreateEndpoint("{version:int}/{language:length(2)}/test62/method-3", new HttpMethodMetadata(new[] { "POST" })),
  1368. CreateEndpoint("test63/method-1", new HttpMethodMetadata(new[] { "GET" })),
  1369. CreateEndpoint("{language:length(2)}/test63/method-1", new HttpMethodMetadata(new[] { "GET" })),
  1370. CreateEndpoint("{version:int}/{language:length(2)}/test63/method-1", new HttpMethodMetadata(new[] { "GET" })),
  1371. CreateEndpoint("test63/method-2", new HttpMethodMetadata(new[] { "POST" })),
  1372. CreateEndpoint("{language:length(2)}/test63/method-2", new HttpMethodMetadata(new[] { "POST" })),
  1373. CreateEndpoint("{version:int}/{language:length(2)}/test63/method-2", new HttpMethodMetadata(new[] { "POST" })),
  1374. CreateEndpoint("test63/method-3", new HttpMethodMetadata(new[] { "POST" })),
  1375. CreateEndpoint("{language:length(2)}/test63/method-3", new HttpMethodMetadata(new[] { "POST" })),
  1376. CreateEndpoint("{version:int}/{language:length(2)}/test63/method-3", new HttpMethodMetadata(new[] { "POST" }))
  1377. };
  1378. foreach (var endpoint in endpoints)
  1379. {
  1380. builder.AddEndpoint(endpoint);
  1381. }
  1382. // Act
  1383. var root = builder.BuildDfaTree();
  1384. // Assert
  1385. Assert.NotNull(root);
  1386. var count = 0;
  1387. root.Visit(node => count++);
  1388. // Without filtering it would have resulted in millions of nodes, several GB of memory and minutes
  1389. Assert.Equal(759, count);
  1390. }
  1391. // Regression test for excessive memory usage https://github.com/dotnet/aspnetcore/issues/33735
  1392. [Fact]
  1393. public void BuildDfaTree_Regression_33735()
  1394. {
  1395. // Arrange
  1396. var builder = CreateDfaMatcherBuilder();
  1397. var endpoints = new[]
  1398. {
  1399. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/workers/{id}", new HttpMethodMetadata(new[] { "DELETE" })),
  1400. CreateEndpoint("api/workers/{id}", new HttpMethodMetadata(new[] { "DELETE" })),
  1401. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/workers/all", new HttpMethodMetadata(new[] { "GET" })),
  1402. CreateEndpoint("api/workers/all", new HttpMethodMetadata(new[] { "GET" })),
  1403. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/workers/{id:regex((?!(discover)))}", new HttpMethodMetadata(new[] { "GET" })),
  1404. CreateEndpoint("api/workers/{id:regex((?!(discover)))}", new HttpMethodMetadata(new[] { "GET" })),
  1405. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/workerpools", new HttpMethodMetadata(new[] { "POST" })),
  1406. CreateEndpoint("api/workerpools", new HttpMethodMetadata(new[] { "POST" })),
  1407. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/workerpools/{id}", new HttpMethodMetadata(new[] { "DELETE" })),
  1408. CreateEndpoint("api/workerpools/{id}", new HttpMethodMetadata(new[] { "DELETE" })),
  1409. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/workerpools/all", new HttpMethodMetadata(new[] { "GET" })),
  1410. CreateEndpoint("api/workerpools/all", new HttpMethodMetadata(new[] { "GET" })),
  1411. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/workerpools/{id:regex((?!(all|summary|supportedtypes|dynamicworkertypes)))}", new HttpMethodMetadata(new[] { "GET" })),
  1412. CreateEndpoint("api/workerpools/{id:regex((?!(all|summary|supportedtypes|dynamicworkertypes)))}", new HttpMethodMetadata(new[] { "GET" })),
  1413. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/workerpools", new HttpMethodMetadata(new[] { "GET" })),
  1414. CreateEndpoint("api/workerpools", new HttpMethodMetadata(new[] { "GET" })),
  1415. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/variables/all", new HttpMethodMetadata(new[] { "GET" })),
  1416. CreateEndpoint("api/variables/all", new HttpMethodMetadata(new[] { "GET" })),
  1417. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/variables/{id}", new HttpMethodMetadata(new[] { "PUT" })),
  1418. CreateEndpoint("api/variables/{id}", new HttpMethodMetadata(new[] { "PUT" })),
  1419. CreateEndpoint("api/users/{id}", new HttpMethodMetadata(new[] { "DELETE" })),
  1420. CreateEndpoint("api/users/all", new HttpMethodMetadata(new[] { "GET" })),
  1421. CreateEndpoint("api/users/{id:regex((?!(all|authentication|external-search|identity-metadata|me)))}", new HttpMethodMetadata(new[] { "GET" })),
  1422. CreateEndpoint("api/users", new HttpMethodMetadata(new[] { "GET" })),
  1423. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/users/invitations/{id}", new HttpMethodMetadata(new[] { "GET" })),
  1424. CreateEndpoint("api/users/invitations/{id}", new HttpMethodMetadata(new[] { "GET" })),
  1425. CreateEndpoint("api/userroles/{id}", new HttpMethodMetadata(new[] { "DELETE" })),
  1426. CreateEndpoint("api/userroles/all", new HttpMethodMetadata(new[] { "GET" })),
  1427. CreateEndpoint("api/userroles/{id}", new HttpMethodMetadata(new[] { "GET" })),
  1428. CreateEndpoint("api/userroles", new HttpMethodMetadata(new[] { "GET" })),
  1429. CreateEndpoint("api/userroles/{id}", new HttpMethodMetadata(new[] { "PUT" })),
  1430. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/users/{id}/permissions/export", new HttpMethodMetadata(new[] { "GET" })),
  1431. CreateEndpoint("api/users/{id}/permissions/export", new HttpMethodMetadata(new[] { "GET" })),
  1432. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/tenants", new HttpMethodMetadata(new[] { "POST" })),
  1433. CreateEndpoint("api/tenants", new HttpMethodMetadata(new[] { "POST" })),
  1434. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/tenants/{id:regex(^Tenants-\\d\u002B$)}", new HttpMethodMetadata(new[] { "DELETE" })),
  1435. CreateEndpoint("api/tenants/{id:regex(^Tenants-\\d\u002B$)}", new HttpMethodMetadata(new[] { "DELETE" })),
  1436. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/tenants/all", new HttpMethodMetadata(new[] { "GET" })),
  1437. CreateEndpoint("api/tenants/all", new HttpMethodMetadata(new[] { "GET" })),
  1438. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/tenants/{id:regex(^Tenants-\\d\u002B$)}", new HttpMethodMetadata(new[] { "GET" })),
  1439. CreateEndpoint("api/tenants/{id:regex(^Tenants-\\d\u002B$)}", new HttpMethodMetadata(new[] { "GET" })),
  1440. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/tenants/{id:regex(^Tenants-\\d\u002B$)}/logo", new HttpMethodMetadata(new[] { "GET" })),
  1441. CreateEndpoint("api/tenants/{id:regex(^Tenants-\\d\u002B$)}/logo", new HttpMethodMetadata(new[] { "GET" })),
  1442. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/tenants/variables-missing", new HttpMethodMetadata(new[] { "GET" })),
  1443. CreateEndpoint("api/tenants/variables-missing", new HttpMethodMetadata(new[] { "GET" })),
  1444. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/tenants", new HttpMethodMetadata(new[] { "GET" })),
  1445. CreateEndpoint("api/tenants", new HttpMethodMetadata(new[] { "GET" })),
  1446. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/tenants/status", new HttpMethodMetadata(new[] { "GET" })),
  1447. CreateEndpoint("api/tenants/status", new HttpMethodMetadata(new[] { "GET" })),
  1448. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/tenants/{id:regex(^Tenants-\\d\u002B$)}/variables", new HttpMethodMetadata(new[] { "GET" })),
  1449. CreateEndpoint("api/tenants/{id:regex(^Tenants-\\d\u002B$)}/variables", new HttpMethodMetadata(new[] { "GET" })),
  1450. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/tenants/{id}", new HttpMethodMetadata(new[] { "PUT" })),
  1451. CreateEndpoint("api/tenants/{id}", new HttpMethodMetadata(new[] { "PUT" })),
  1452. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/tenants/{id:regex(^Tenants-\\d\u002B$)}/variables", new HttpMethodMetadata(new[] { "PUT" })),
  1453. CreateEndpoint("api/tenants/{id:regex(^Tenants-\\d\u002B$)}/variables", new HttpMethodMetadata(new[] { "PUT" })),
  1454. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/tenants/{id:regex(^Tenants-\\d\u002B$)}/variables", new HttpMethodMetadata(new[] { "POST" })),
  1455. CreateEndpoint("api/tenants/{id:regex(^Tenants-\\d\u002B$)}/variables", new HttpMethodMetadata(new[] { "POST" })),
  1456. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/tenants/{id:regex(^Tenants-\\d\u002B$)}/logo", new HttpMethodMetadata(new[] { "POST" })),
  1457. CreateEndpoint("api/tenants/{id:regex(^Tenants-\\d\u002B$)}/logo", new HttpMethodMetadata(new[] { "POST" })),
  1458. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/tenants/{id:regex(^Tenants-\\d\u002B$)}/logo", new HttpMethodMetadata(new[] { "PUT" })),
  1459. CreateEndpoint("api/tenants/{id:regex(^Tenants-\\d\u002B$)}/logo", new HttpMethodMetadata(new[] { "PUT" })),
  1460. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/tenants/tag-test", new HttpMethodMetadata(new[] { "GET" })),
  1461. CreateEndpoint("api/tenants/tag-test", new HttpMethodMetadata(new[] { "GET" })),
  1462. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/teams", new HttpMethodMetadata(new[] { "POST" })),
  1463. CreateEndpoint("api/teams", new HttpMethodMetadata(new[] { "POST" })),
  1464. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/teams/{id}", new HttpMethodMetadata(new[] { "DELETE" })),
  1465. CreateEndpoint("api/teams/{id}", new HttpMethodMetadata(new[] { "DELETE" })),
  1466. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/teams/all", new HttpMethodMetadata(new[] { "GET" })),
  1467. CreateEndpoint("api/teams/all", new HttpMethodMetadata(new[] { "GET" })),
  1468. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/teams/{id}", new HttpMethodMetadata(new[] { "GET" })),
  1469. CreateEndpoint("api/teams/{id}", new HttpMethodMetadata(new[] { "GET" })),
  1470. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/teams", new HttpMethodMetadata(new[] { "GET" })),
  1471. CreateEndpoint("api/teams", new HttpMethodMetadata(new[] { "GET" })),
  1472. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/teams/{id}/scopeduserroles", new HttpMethodMetadata(new[] { "GET" })),
  1473. CreateEndpoint("api/teams/{id}/scopeduserroles", new HttpMethodMetadata(new[] { "GET" })),
  1474. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/teams/{id}", new HttpMethodMetadata(new[] { "PUT" })),
  1475. CreateEndpoint("api/teams/{id}", new HttpMethodMetadata(new[] { "PUT" })),
  1476. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/teammembership", new HttpMethodMetadata(new[] { "GET" })),
  1477. CreateEndpoint("api/teammembership", new HttpMethodMetadata(new[] { "GET" })),
  1478. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/teammembership/previewteam", new HttpMethodMetadata(new[] { "POST" })),
  1479. CreateEndpoint("api/teammembership/previewteam", new HttpMethodMetadata(new[] { "POST" })),
  1480. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/tagsets/{id}", new HttpMethodMetadata(new[] { "DELETE" })),
  1481. CreateEndpoint("api/tagsets/{id}", new HttpMethodMetadata(new[] { "DELETE" })),
  1482. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/tagsets/all", new HttpMethodMetadata(new[] { "GET" })),
  1483. CreateEndpoint("api/tagsets/all", new HttpMethodMetadata(new[] { "GET" })),
  1484. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/tagsets/{id}", new HttpMethodMetadata(new[] { "GET" })),
  1485. CreateEndpoint("api/tagsets/{id}", new HttpMethodMetadata(new[] { "GET" })),
  1486. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/tagsets", new HttpMethodMetadata(new[] { "GET" })),
  1487. CreateEndpoint("api/tagsets", new HttpMethodMetadata(new[] { "GET" })),
  1488. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/subscriptions/{id}", new HttpMethodMetadata(new[] { "DELETE" })),
  1489. CreateEndpoint("api/subscriptions/{id}", new HttpMethodMetadata(new[] { "DELETE" })),
  1490. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/subscriptions/all", new HttpMethodMetadata(new[] { "GET" })),
  1491. CreateEndpoint("api/subscriptions/all", new HttpMethodMetadata(new[] { "GET" })),
  1492. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/subscriptions/{id}", new HttpMethodMetadata(new[] { "GET" })),
  1493. CreateEndpoint("api/subscriptions/{id}", new HttpMethodMetadata(new[] { "GET" })),
  1494. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/subscriptions", new HttpMethodMetadata(new[] { "GET" })),
  1495. CreateEndpoint("api/subscriptions", new HttpMethodMetadata(new[] { "GET" })),
  1496. CreateEndpoint("api/steps/{stepId}/{version}/logo", new HttpMethodMetadata(new[] { "GET" })),
  1497. CreateEndpoint("api/steps/deploymenttargets/{stepId}/{version}/logo", new HttpMethodMetadata(new[] { "GET" })),
  1498. CreateEndpoint("api/steps/{stepId}/{version}/schema", new HttpMethodMetadata(new[] { "GET" })),
  1499. CreateEndpoint("api/steps/deploymenttargets/{stepId}/{version}/schema", new HttpMethodMetadata(new[] { "GET" })),
  1500. CreateEndpoint("api/steps/{stepId}/latest-version", new HttpMethodMetadata(new[] { "GET" })),
  1501. CreateEndpoint("api/steps/{stepId}/{version}.js", new HttpMethodMetadata(new[] { "GET" })),
  1502. CreateEndpoint("api/steps/deploymenttargets/{stepId}/{version}.js", new HttpMethodMetadata(new[] { "GET" })),
  1503. CreateEndpoint("api/steps/deploymenttargets", new HttpMethodMetadata(new[] { "GET" })),
  1504. CreateEndpoint("api/spaces/all", new HttpMethodMetadata(new[] { "GET" })),
  1505. CreateEndpoint("api/spaces/{id}", new HttpMethodMetadata(new[] { "GET" })),
  1506. CreateEndpoint("api/spaces", new HttpMethodMetadata(new[] { "GET" })),
  1507. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/spaces/{id:regex(^Spaces-\\d\u002B$)}/search", new HttpMethodMetadata(new[] { "GET" })),
  1508. CreateEndpoint("api/spaces/{id:regex(^Spaces-\\d\u002B$)}/search", new HttpMethodMetadata(new[] { "GET" })),
  1509. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/scopeduserroles/{id}", new HttpMethodMetadata(new[] { "DELETE" })),
  1510. CreateEndpoint("api/scopeduserroles/{id}", new HttpMethodMetadata(new[] { "DELETE" })),
  1511. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/scopeduserroles/{id}", new HttpMethodMetadata(new[] { "GET" })),
  1512. CreateEndpoint("api/scopeduserroles/{id}", new HttpMethodMetadata(new[] { "GET" })),
  1513. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/runbooks", new HttpMethodMetadata(new[] { "POST" })),
  1514. CreateEndpoint("api/runbooks", new HttpMethodMetadata(new[] { "POST" })),
  1515. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/projects/{projectId}/runbooks", new HttpMethodMetadata(new[] { "POST" })),
  1516. CreateEndpoint("api/projects/{projectId}/runbooks", new HttpMethodMetadata(new[] { "POST" })),
  1517. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/projects/{projectId}/{gitRef}/runbooks", new HttpMethodMetadata(new[] { "POST" })),
  1518. CreateEndpoint("api/projects/{projectId}/{gitRef}/runbooks", new HttpMethodMetadata(new[] { "POST" })),
  1519. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/runbooks/{id}", new HttpMethodMetadata(new[] { "DELETE" })),
  1520. CreateEndpoint("api/runbooks/{id}", new HttpMethodMetadata(new[] { "DELETE" })),
  1521. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/projects/{projectId}/runbooks/{id}", new HttpMethodMetadata(new[] { "DELETE" })),
  1522. CreateEndpoint("api/projects/{projectId}/runbooks/{id}", new HttpMethodMetadata(new[] { "DELETE" })),
  1523. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/projects/{projectId}/{gitRef}/runbooks/{id}", new HttpMethodMetadata(new[] { "DELETE" })),
  1524. CreateEndpoint("api/projects/{projectId}/{gitRef}/runbooks/{id}", new HttpMethodMetadata(new[] { "DELETE" })),
  1525. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/runbooks/all", new HttpMethodMetadata(new[] { "GET" })),
  1526. CreateEndpoint("api/runbooks/all", new HttpMethodMetadata(new[] { "GET" })),
  1527. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/projects/{projectId}/runbooks/all", new HttpMethodMetadata(new[] { "GET" })),
  1528. CreateEndpoint("api/projects/{projectId}/runbooks/all", new HttpMethodMetadata(new[] { "GET" })),
  1529. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/projects/{projectId}/{gitRef}/runbooks/all", new HttpMethodMetadata(new[] { "GET" })),
  1530. CreateEndpoint("api/projects/{projectId}/{gitRef}/runbooks/all", new HttpMethodMetadata(new[] { "GET" })),
  1531. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/runbooks/{id}", new HttpMethodMetadata(new[] { "GET" })),
  1532. CreateEndpoint("api/runbooks/{id}", new HttpMethodMetadata(new[] { "GET" })),
  1533. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/projects/{projectId}/runbooks/{id}", new HttpMethodMetadata(new[] { "GET" })),
  1534. CreateEndpoint("api/projects/{projectId}/runbooks/{id}", new HttpMethodMetadata(new[] { "GET" })),
  1535. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/projects/{projectId}/{gitRef}/runbooks/{id}", new HttpMethodMetadata(new[] { "GET" })),
  1536. CreateEndpoint("api/projects/{projectId}/{gitRef}/runbooks/{id}", new HttpMethodMetadata(new[] { "GET" })),
  1537. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/runbooks/{id}/environments", new HttpMethodMetadata(new[] { "GET" })),
  1538. CreateEndpoint("api/runbooks/{id}/environments", new HttpMethodMetadata(new[] { "GET" })),
  1539. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/projects/{projectId}/runbooks/{id}/environments", new HttpMethodMetadata(new[] { "GET" })),
  1540. CreateEndpoint("api/projects/{projectId}/runbooks/{id}/environments", new HttpMethodMetadata(new[] { "GET" })),
  1541. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/projects/{projectId}/{gitRef}/runbooks/{id}/environments", new HttpMethodMetadata(new[] { "GET" })),
  1542. CreateEndpoint("api/projects/{projectId}/{gitRef}/runbooks/{id}/environments", new HttpMethodMetadata(new[] { "GET" })),
  1543. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/projects/{projectId}/runbooks/{id}/runbookRuns/preview/{environment}/{tenant}", new HttpMethodMetadata(new[] { "GET" })),
  1544. CreateEndpoint("api/projects/{projectId}/runbooks/{id}/runbookRuns/preview/{environment}/{tenant}", new HttpMethodMetadata(new[] { "GET" })),
  1545. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/projects/{projectId}/{gitRef}/runbooks/{id}/runbookRuns/preview/{environment}/{tenant}", new HttpMethodMetadata(new[] { "GET" })),
  1546. CreateEndpoint("api/projects/{projectId}/{gitRef}/runbooks/{id}/runbookRuns/preview/{environment}/{tenant}", new HttpMethodMetadata(new[] { "GET" })),
  1547. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/runbooks/{id}/runbookRuns/preview/{environment}/{tenant}", new HttpMethodMetadata(new[] { "GET" })),
  1548. CreateEndpoint("api/runbooks/{id}/runbookRuns/preview/{environment}/{tenant}", new HttpMethodMetadata(new[] { "GET" })),
  1549. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/projects/{projectId}/runbooks/{id}/runbookRuns/preview/{environment}", new HttpMethodMetadata(new[] { "GET" })),
  1550. CreateEndpoint("api/projects/{projectId}/runbooks/{id}/runbookRuns/preview/{environment}", new HttpMethodMetadata(new[] { "GET" })),
  1551. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/projects/{projectId}/{gitRef}/runbooks/{id}/runbookRuns/preview/{environment}", new HttpMethodMetadata(new[] { "GET" })),
  1552. CreateEndpoint("api/projects/{projectId}/{gitRef}/runbooks/{id}/runbookRuns/preview/{environment}", new HttpMethodMetadata(new[] { "GET" })),
  1553. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/runbooks/{id}/runbookRuns/preview/{environment}", new HttpMethodMetadata(new[] { "GET" })),
  1554. CreateEndpoint("api/runbooks/{id}/runbookRuns/preview/{environment}", new HttpMethodMetadata(new[] { "GET" })),
  1555. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/runbooks", new HttpMethodMetadata(new[] { "GET" })),
  1556. CreateEndpoint("api/runbooks", new HttpMethodMetadata(new[] { "GET" })),
  1557. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/projects/{projectId}/runbooks", new HttpMethodMetadata(new[] { "GET" })),
  1558. CreateEndpoint("api/projects/{projectId}/runbooks", new HttpMethodMetadata(new[] { "GET" })),
  1559. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/projects/{projectId}/{gitRef}/runbooks", new HttpMethodMetadata(new[] { "GET" })),
  1560. CreateEndpoint("api/projects/{projectId}/{gitRef}/runbooks", new HttpMethodMetadata(new[] { "GET" })),
  1561. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/projects/{projectId}/runbooks/{id}/runbookSnapshotTemplate", new HttpMethodMetadata(new[] { "GET" })),
  1562. CreateEndpoint("api/projects/{projectId}/runbooks/{id}/runbookSnapshotTemplate", new HttpMethodMetadata(new[] { "GET" })),
  1563. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/projects/{projectId}/{gitRef}/runbooks/{id}/runbookSnapshotTemplate", new HttpMethodMetadata(new[] { "GET" })),
  1564. CreateEndpoint("api/projects/{projectId}/{gitRef}/runbooks/{id}/runbookSnapshotTemplate", new HttpMethodMetadata(new[] { "GET" })),
  1565. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/runbooks/{id}/runbookSnapshotTemplate", new HttpMethodMetadata(new[] { "GET" })),
  1566. CreateEndpoint("api/runbooks/{id}/runbookSnapshotTemplate", new HttpMethodMetadata(new[] { "GET" })),
  1567. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/projects/{projectId}/runbooks/{id}/runbookRunTemplate", new HttpMethodMetadata(new[] { "GET" })),
  1568. CreateEndpoint("api/projects/{projectId}/runbooks/{id}/runbookRunTemplate", new HttpMethodMetadata(new[] { "GET" })),
  1569. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/projects/{projectId}/{gitRef}/runbooks/{id}/runbookRunTemplate", new HttpMethodMetadata(new[] { "GET" })),
  1570. CreateEndpoint("api/projects/{projectId}/{gitRef}/runbooks/{id}/runbookRunTemplate", new HttpMethodMetadata(new[] { "GET" })),
  1571. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/runbooks/{id}/runbookRunTemplate", new HttpMethodMetadata(new[] { "GET" })),
  1572. CreateEndpoint("api/runbooks/{id}/runbookRunTemplate", new HttpMethodMetadata(new[] { "GET" })),
  1573. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/runbooks/{id}", new HttpMethodMetadata(new[] { "PUT" })),
  1574. CreateEndpoint("api/runbooks/{id}", new HttpMethodMetadata(new[] { "PUT" })),
  1575. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/projects/{projectId}/runbooks/{id}", new HttpMethodMetadata(new[] { "PUT" })),
  1576. CreateEndpoint("api/projects/{projectId}/runbooks/{id}", new HttpMethodMetadata(new[] { "PUT" })),
  1577. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/projects/{projectId}/{gitRef}/runbooks/{id}", new HttpMethodMetadata(new[] { "PUT" })),
  1578. CreateEndpoint("api/projects/{projectId}/{gitRef}/runbooks/{id}", new HttpMethodMetadata(new[] { "PUT" })),
  1579. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/projects/{projectId}/runbooks/{id}/run", new HttpMethodMetadata(new[] { "POST" })),
  1580. CreateEndpoint("api/projects/{projectId}/runbooks/{id}/run", new HttpMethodMetadata(new[] { "POST" })),
  1581. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/projects/{projectId}/{gitRef}/runbooks/{id}/run", new HttpMethodMetadata(new[] { "POST" })),
  1582. CreateEndpoint("api/projects/{projectId}/{gitRef}/runbooks/{id}/run", new HttpMethodMetadata(new[] { "POST" })),
  1583. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/runbooks/{id}/run", new HttpMethodMetadata(new[] { "POST" })),
  1584. CreateEndpoint("api/runbooks/{id}/run", new HttpMethodMetadata(new[] { "POST" })),
  1585. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/runbooksnapshots/{id}", new HttpMethodMetadata(new[] { "DELETE" })),
  1586. CreateEndpoint("api/runbooksnapshots/{id}", new HttpMethodMetadata(new[] { "DELETE" })),
  1587. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/projects/{projectId}/runbooksnapshots/{id}", new HttpMethodMetadata(new[] { "DELETE" })),
  1588. CreateEndpoint("api/projects/{projectId}/runbooksnapshots/{id}", new HttpMethodMetadata(new[] { "DELETE" })),
  1589. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/projects/{projectId}/{gitRef}/runbooksnapshots/{id}", new HttpMethodMetadata(new[] { "DELETE" })),
  1590. CreateEndpoint("api/projects/{projectId}/{gitRef}/runbooksnapshots/{id}", new HttpMethodMetadata(new[] { "DELETE" })),
  1591. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/runbookSnapshots/{id}", new HttpMethodMetadata(new[] { "GET" })),
  1592. CreateEndpoint("api/runbookSnapshots/{id}", new HttpMethodMetadata(new[] { "GET" })),
  1593. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/projects/{projectId}/runbookSnapshots/{idOrName}", new HttpMethodMetadata(new[] { "GET" })),
  1594. CreateEndpoint("api/projects/{projectId}/runbookSnapshots/{idOrName}", new HttpMethodMetadata(new[] { "GET" })),
  1595. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/projects/{projectId}/{gitRef}/runbookSnapshots/{idOrName}", new HttpMethodMetadata(new[] { "GET" })),
  1596. CreateEndpoint("api/projects/{projectId}/{gitRef}/runbookSnapshots/{idOrName}", new HttpMethodMetadata(new[] { "GET" })),
  1597. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/runbookSnapshots", new HttpMethodMetadata(new[] { "GET" })),
  1598. CreateEndpoint("api/runbookSnapshots", new HttpMethodMetadata(new[] { "GET" })),
  1599. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/projects/{projectId}/runbookSnapshots", new HttpMethodMetadata(new[] { "GET" })),
  1600. CreateEndpoint("api/projects/{projectId}/runbookSnapshots", new HttpMethodMetadata(new[] { "GET" })),
  1601. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/projects/{projectId}/{gitRef}/runbookSnapshots", new HttpMethodMetadata(new[] { "GET" })),
  1602. CreateEndpoint("api/projects/{projectId}/{gitRef}/runbookSnapshots", new HttpMethodMetadata(new[] { "GET" })),
  1603. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/runbooks/{id}/runbookSnapshots", new HttpMethodMetadata(new[] { "GET" })),
  1604. CreateEndpoint("api/runbooks/{id}/runbookSnapshots", new HttpMethodMetadata(new[] { "GET" })),
  1605. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/projects/{projectId}/runbooks/{id}/runbookSnapshots", new HttpMethodMetadata(new[] { "GET" })),
  1606. CreateEndpoint("api/projects/{projectId}/runbooks/{id}/runbookSnapshots", new HttpMethodMetadata(new[] { "GET" })),
  1607. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/projects/{projectId}/{gitRef}/runbooks/{id}/runbookSnapshots", new HttpMethodMetadata(new[] { "GET" })),
  1608. CreateEndpoint("api/projects/{projectId}/{gitRef}/runbooks/{id}/runbookSnapshots", new HttpMethodMetadata(new[] { "GET" })),
  1609. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/runbookRuns", new HttpMethodMetadata(new[] { "POST" })),
  1610. CreateEndpoint("api/runbookRuns", new HttpMethodMetadata(new[] { "POST" })),
  1611. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/projects/{projectId}/runbookRuns", new HttpMethodMetadata(new[] { "POST" })),
  1612. CreateEndpoint("api/projects/{projectId}/runbookRuns", new HttpMethodMetadata(new[] { "POST" })),
  1613. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/projects/{projectId}/{gitRef}/runbookRuns", new HttpMethodMetadata(new[] { "POST" })),
  1614. CreateEndpoint("api/projects/{projectId}/{gitRef}/runbookRuns", new HttpMethodMetadata(new[] { "POST" })),
  1615. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/runbookruns/{id}", new HttpMethodMetadata(new[] { "DELETE" })),
  1616. CreateEndpoint("api/runbookruns/{id}", new HttpMethodMetadata(new[] { "DELETE" })),
  1617. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/projects/{projectId}/runbookruns/{id}", new HttpMethodMetadata(new[] { "DELETE" })),
  1618. CreateEndpoint("api/projects/{projectId}/runbookruns/{id}", new HttpMethodMetadata(new[] { "DELETE" })),
  1619. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/projects/{projectId}/{gitRef}/runbookruns/{id}", new HttpMethodMetadata(new[] { "DELETE" })),
  1620. CreateEndpoint("api/projects/{projectId}/{gitRef}/runbookruns/{id}", new HttpMethodMetadata(new[] { "DELETE" })),
  1621. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/runbookRuns/{id}", new HttpMethodMetadata(new[] { "GET" })),
  1622. CreateEndpoint("api/runbookRuns/{id}", new HttpMethodMetadata(new[] { "GET" })),
  1623. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/projects/{projectId}/runbookRuns/{id}", new HttpMethodMetadata(new[] { "GET" })),
  1624. CreateEndpoint("api/projects/{projectId}/runbookRuns/{id}", new HttpMethodMetadata(new[] { "GET" })),
  1625. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/projects/{projectId}/{gitRef}/runbookRuns/{id}", new HttpMethodMetadata(new[] { "GET" })),
  1626. CreateEndpoint("api/projects/{projectId}/{gitRef}/runbookRuns/{id}", new HttpMethodMetadata(new[] { "GET" })),
  1627. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/runbookRuns", new HttpMethodMetadata(new[] { "GET" })),
  1628. CreateEndpoint("api/runbookRuns", new HttpMethodMetadata(new[] { "GET" })),
  1629. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/projects/{projectId}/runbookRuns", new HttpMethodMetadata(new[] { "GET" })),
  1630. CreateEndpoint("api/projects/{projectId}/runbookRuns", new HttpMethodMetadata(new[] { "GET" })),
  1631. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/projects/{projectId}/{gitRef}/runbookRuns", new HttpMethodMetadata(new[] { "GET" })),
  1632. CreateEndpoint("api/projects/{projectId}/{gitRef}/runbookRuns", new HttpMethodMetadata(new[] { "GET" })),
  1633. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/runbookProcesses/{id}", new HttpMethodMetadata(new[] { "GET" })),
  1634. CreateEndpoint("api/runbookProcesses/{id}", new HttpMethodMetadata(new[] { "GET" })),
  1635. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/projects/{projectId}/runbookProcesses/{id}", new HttpMethodMetadata(new[] { "GET" })),
  1636. CreateEndpoint("api/projects/{projectId}/runbookProcesses/{id}", new HttpMethodMetadata(new[] { "GET" })),
  1637. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/projects/{projectId}/{gitRef}/runbookProcesses/{id}", new HttpMethodMetadata(new[] { "GET" })),
  1638. CreateEndpoint("api/projects/{projectId}/{gitRef}/runbookProcesses/{id}", new HttpMethodMetadata(new[] { "GET" })),
  1639. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/runbookProcesses", new HttpMethodMetadata(new[] { "GET" })),
  1640. CreateEndpoint("api/runbookProcesses", new HttpMethodMetadata(new[] { "GET" })),
  1641. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/projects/{projectId}/runbookProcesses", new HttpMethodMetadata(new[] { "GET" })),
  1642. CreateEndpoint("api/projects/{projectId}/runbookProcesses", new HttpMethodMetadata(new[] { "GET" })),
  1643. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/projects/{projectId}/{gitRef}/runbookProcesses", new HttpMethodMetadata(new[] { "GET" })),
  1644. CreateEndpoint("api/projects/{projectId}/{gitRef}/runbookProcesses", new HttpMethodMetadata(new[] { "GET" })),
  1645. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/projects/{projectId}/runbookProcesses/{id}/runbookSnapshotTemplate", new HttpMethodMetadata(new[] { "GET" })),
  1646. CreateEndpoint("api/projects/{projectId}/runbookProcesses/{id}/runbookSnapshotTemplate", new HttpMethodMetadata(new[] { "GET" })),
  1647. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/projects/{projectId}/{gitRef}/runbookProcesses/{id}/runbookSnapshotTemplate", new HttpMethodMetadata(new[] { "GET" })),
  1648. CreateEndpoint("api/projects/{projectId}/{gitRef}/runbookProcesses/{id}/runbookSnapshotTemplate", new HttpMethodMetadata(new[] { "GET" })),
  1649. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/runbookProcesses/{id}/runbookSnapshotTemplate", new HttpMethodMetadata(new[] { "GET" })),
  1650. CreateEndpoint("api/runbookProcesses/{id}/runbookSnapshotTemplate", new HttpMethodMetadata(new[] { "GET" })),
  1651. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/runbookSnapshots/{id}/runbookRuns", new HttpMethodMetadata(new[] { "GET" })),
  1652. CreateEndpoint("api/runbookSnapshots/{id}/runbookRuns", new HttpMethodMetadata(new[] { "GET" })),
  1653. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/projects/{projectId}/runbookSnapshots/{id}/runbookRuns", new HttpMethodMetadata(new[] { "GET" })),
  1654. CreateEndpoint("api/projects/{projectId}/runbookSnapshots/{id}/runbookRuns", new HttpMethodMetadata(new[] { "GET" })),
  1655. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/projects/{projectId}/{gitRef}/runbookSnapshots/{id}/runbookRuns", new HttpMethodMetadata(new[] { "GET" })),
  1656. CreateEndpoint("api/projects/{projectId}/{gitRef}/runbookSnapshots/{id}/runbookRuns", new HttpMethodMetadata(new[] { "GET" })),
  1657. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/runbookProcesses/{id}", new HttpMethodMetadata(new[] { "PUT" })),
  1658. CreateEndpoint("api/runbookProcesses/{id}", new HttpMethodMetadata(new[] { "PUT" })),
  1659. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/projects/{projectId}/runbookProcesses/{id}", new HttpMethodMetadata(new[] { "PUT" })),
  1660. CreateEndpoint("api/projects/{projectId}/runbookProcesses/{id}", new HttpMethodMetadata(new[] { "PUT" })),
  1661. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/projects/{projectId}/{gitRef}/runbookProcesses/{id}", new HttpMethodMetadata(new[] { "PUT" })),
  1662. CreateEndpoint("api/projects/{projectId}/{gitRef}/runbookProcesses/{id}", new HttpMethodMetadata(new[] { "PUT" })),
  1663. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/reporting/deployments/xml", new HttpMethodMetadata(new[] { "GET" })),
  1664. CreateEndpoint("api/reporting/deployments/xml", new HttpMethodMetadata(new[] { "GET" })),
  1665. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/releases/{id}", new HttpMethodMetadata(new[] { "GET" })),
  1666. CreateEndpoint("api/releases/{id}", new HttpMethodMetadata(new[] { "GET" })),
  1667. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/releases/{id}/deployments", new HttpMethodMetadata(new[] { "GET" })),
  1668. CreateEndpoint("api/releases/{id}/deployments", new HttpMethodMetadata(new[] { "GET" })),
  1669. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/releases", new HttpMethodMetadata(new[] { "GET" })),
  1670. CreateEndpoint("api/releases", new HttpMethodMetadata(new[] { "GET" })),
  1671. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/channels/{id}/releases", new HttpMethodMetadata(new[] { "GET" })),
  1672. CreateEndpoint("api/channels/{id}/releases", new HttpMethodMetadata(new[] { "GET" })),
  1673. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/projects/{projectId}/channels/{id}/releases", new HttpMethodMetadata(new[] { "GET" })),
  1674. CreateEndpoint("api/projects/{projectId}/channels/{id}/releases", new HttpMethodMetadata(new[] { "GET" })),
  1675. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/projects/{projectId}/{gitRef}/channels/{id}/releases", new HttpMethodMetadata(new[] { "GET" })),
  1676. CreateEndpoint("api/projects/{projectId}/{gitRef}/channels/{id}/releases", new HttpMethodMetadata(new[] { "GET" })),
  1677. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/projects/{projectId}/releases", new HttpMethodMetadata(new[] { "GET" })),
  1678. CreateEndpoint("api/projects/{projectId}/releases", new HttpMethodMetadata(new[] { "GET" })),
  1679. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/proxies/{id}", new HttpMethodMetadata(new[] { "DELETE" })),
  1680. CreateEndpoint("api/proxies/{id}", new HttpMethodMetadata(new[] { "DELETE" })),
  1681. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/proxies/all", new HttpMethodMetadata(new[] { "GET" })),
  1682. CreateEndpoint("api/proxies/all", new HttpMethodMetadata(new[] { "GET" })),
  1683. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/proxies", new HttpMethodMetadata(new[] { "GET" })),
  1684. CreateEndpoint("api/proxies", new HttpMethodMetadata(new[] { "GET" })),
  1685. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/proxies/{id}", new HttpMethodMetadata(new[] { "GET" })),
  1686. CreateEndpoint("api/proxies/{id}", new HttpMethodMetadata(new[] { "GET" })),
  1687. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/projecttriggers/{triggerId}", new HttpMethodMetadata(new[] { "DELETE" })),
  1688. CreateEndpoint("api/projecttriggers/{triggerId}", new HttpMethodMetadata(new[] { "DELETE" })),
  1689. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/projects/{projectId}/triggers/{triggerId}", new HttpMethodMetadata(new[] { "DELETE" })),
  1690. CreateEndpoint("api/projects/{projectId}/triggers/{triggerId}", new HttpMethodMetadata(new[] { "DELETE" })),
  1691. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/projects/{projectId}/{gitRef}/triggers/{triggerId}", new HttpMethodMetadata(new[] { "DELETE" })),
  1692. CreateEndpoint("api/projects/{projectId}/{gitRef}/triggers/{triggerId}", new HttpMethodMetadata(new[] { "DELETE" })),
  1693. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/projecttriggers/{triggerId}", new HttpMethodMetadata(new[] { "GET" })),
  1694. CreateEndpoint("api/projecttriggers/{triggerId}", new HttpMethodMetadata(new[] { "GET" })),
  1695. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/projects/{projectId}/triggers/{triggerId}", new HttpMethodMetadata(new[] { "GET" })),
  1696. CreateEndpoint("api/projects/{projectId}/triggers/{triggerId}", new HttpMethodMetadata(new[] { "GET" })),
  1697. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/projects/{projectId}/{gitRef}/triggers/{triggerId}", new HttpMethodMetadata(new[] { "GET" })),
  1698. CreateEndpoint("api/projects/{projectId}/{gitRef}/triggers/{triggerId}", new HttpMethodMetadata(new[] { "GET" })),
  1699. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/projecttriggers", new HttpMethodMetadata(new[] { "GET" })),
  1700. CreateEndpoint("api/projecttriggers", new HttpMethodMetadata(new[] { "GET" })),
  1701. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/projects/{projectId}/triggers", new HttpMethodMetadata(new[] { "GET" })),
  1702. CreateEndpoint("api/projects/{projectId}/triggers", new HttpMethodMetadata(new[] { "GET" })),
  1703. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/projects/{projectId}/{gitRef}/triggers", new HttpMethodMetadata(new[] { "GET" })),
  1704. CreateEndpoint("api/projects/{projectId}/{gitRef}/triggers", new HttpMethodMetadata(new[] { "GET" })),
  1705. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/projects/{id}", new HttpMethodMetadata(new[] { "DELETE" })),
  1706. CreateEndpoint("api/projects/{id}", new HttpMethodMetadata(new[] { "DELETE" })),
  1707. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/projects/experimental/summaries", new HttpMethodMetadata(new[] { "GET" })),
  1708. CreateEndpoint("api/projects/experimental/summaries", new HttpMethodMetadata(new[] { "GET" })),
  1709. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/projects/{projectId}/vcs/modified", new HttpMethodMetadata(new[] { "POST" })),
  1710. CreateEndpoint("api/projects/{projectId}/vcs/modified", new HttpMethodMetadata(new[] { "POST" })),
  1711. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/projectgroups/{id}", new HttpMethodMetadata(new[] { "DELETE" })),
  1712. CreateEndpoint("api/projectgroups/{id}", new HttpMethodMetadata(new[] { "DELETE" })),
  1713. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/projectgroups/all", new HttpMethodMetadata(new[] { "GET" })),
  1714. CreateEndpoint("api/projectgroups/all", new HttpMethodMetadata(new[] { "GET" })),
  1715. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/projectgroups/{id}", new HttpMethodMetadata(new[] { "GET" })),
  1716. CreateEndpoint("api/projectgroups/{id}", new HttpMethodMetadata(new[] { "GET" })),
  1717. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/projectgroups/{id}/projects", new HttpMethodMetadata(new[] { "GET" })),
  1718. CreateEndpoint("api/projectgroups/{id}/projects", new HttpMethodMetadata(new[] { "GET" })),
  1719. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/projectgroups", new HttpMethodMetadata(new[] { "GET" })),
  1720. CreateEndpoint("api/projectgroups", new HttpMethodMetadata(new[] { "GET" })),
  1721. CreateEndpoint("api/octopusservernodes/{id}", new HttpMethodMetadata(new[] { "DELETE" })),
  1722. CreateEndpoint("api/octopusservernodes/all", new HttpMethodMetadata(new[] { "GET" })),
  1723. CreateEndpoint("api/octopusservernodes/{id:regex((?!(ping|summary)))}", new HttpMethodMetadata(new[] { "GET" })),
  1724. CreateEndpoint("api/octopusservernodes", new HttpMethodMetadata(new[] { "GET" })),
  1725. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/machines/{id}", new HttpMethodMetadata(new[] { "DELETE" })),
  1726. CreateEndpoint("api/machines/{id}", new HttpMethodMetadata(new[] { "DELETE" })),
  1727. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/machines/all", new HttpMethodMetadata(new[] { "GET" })),
  1728. CreateEndpoint("api/machines/all", new HttpMethodMetadata(new[] { "GET" })),
  1729. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/machines/{id:regex((?!(discover)))}", new HttpMethodMetadata(new[] { "GET" })),
  1730. CreateEndpoint("api/machines/{id:regex((?!(discover)))}", new HttpMethodMetadata(new[] { "GET" })),
  1731. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/machinepolicies/{id}", new HttpMethodMetadata(new[] { "DELETE" })),
  1732. CreateEndpoint("api/machinepolicies/{id}", new HttpMethodMetadata(new[] { "DELETE" })),
  1733. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/machinepolicies/all", new HttpMethodMetadata(new[] { "GET" })),
  1734. CreateEndpoint("api/machinepolicies/all", new HttpMethodMetadata(new[] { "GET" })),
  1735. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/machinepolicies", new HttpMethodMetadata(new[] { "GET" })),
  1736. CreateEndpoint("api/machinepolicies", new HttpMethodMetadata(new[] { "GET" })),
  1737. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/machinepolicies/{id:regex((?!(template)))}", new HttpMethodMetadata(new[] { "GET" })),
  1738. CreateEndpoint("api/machinepolicies/{id:regex((?!(template)))}", new HttpMethodMetadata(new[] { "GET" })),
  1739. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/machinepolicies/{id}/machines", new HttpMethodMetadata(new[] { "GET" })),
  1740. CreateEndpoint("api/machinepolicies/{id}/machines", new HttpMethodMetadata(new[] { "GET" })),
  1741. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/machinepolicies/template", new HttpMethodMetadata(new[] { "GET" })),
  1742. CreateEndpoint("api/machinepolicies/template", new HttpMethodMetadata(new[] { "GET" })),
  1743. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/machinepolicies/{id}/workers", new HttpMethodMetadata(new[] { "GET" })),
  1744. CreateEndpoint("api/machinepolicies/{id}/workers", new HttpMethodMetadata(new[] { "GET" })),
  1745. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/lifecycles/{id}", new HttpMethodMetadata(new[] { "DELETE" })),
  1746. CreateEndpoint("api/lifecycles/{id}", new HttpMethodMetadata(new[] { "DELETE" })),
  1747. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/lifecycles/all", new HttpMethodMetadata(new[] { "GET" })),
  1748. CreateEndpoint("api/lifecycles/all", new HttpMethodMetadata(new[] { "GET" })),
  1749. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/lifecycles/{id}", new HttpMethodMetadata(new[] { "GET" })),
  1750. CreateEndpoint("api/lifecycles/{id}", new HttpMethodMetadata(new[] { "GET" })),
  1751. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/lifecycles", new HttpMethodMetadata(new[] { "GET" })),
  1752. CreateEndpoint("api/lifecycles", new HttpMethodMetadata(new[] { "GET" })),
  1753. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/libraryvariablesets/{id}", new HttpMethodMetadata(new[] { "DELETE" })),
  1754. CreateEndpoint("api/libraryvariablesets/{id}", new HttpMethodMetadata(new[] { "DELETE" })),
  1755. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/libraryvariablesets/all", new HttpMethodMetadata(new[] { "GET" })),
  1756. CreateEndpoint("api/libraryvariablesets/all", new HttpMethodMetadata(new[] { "GET" })),
  1757. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/libraryvariablesets/{id}", new HttpMethodMetadata(new[] { "GET" })),
  1758. CreateEndpoint("api/libraryvariablesets/{id}", new HttpMethodMetadata(new[] { "GET" })),
  1759. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/interruptions/{id}", new HttpMethodMetadata(new[] { "GET" })),
  1760. CreateEndpoint("api/interruptions/{id}", new HttpMethodMetadata(new[] { "GET" })),
  1761. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/feeds/{id}", new HttpMethodMetadata(new[] { "DELETE" })),
  1762. CreateEndpoint("api/feeds/{id}", new HttpMethodMetadata(new[] { "DELETE" })),
  1763. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/environments/{id}", new HttpMethodMetadata(new[] { "DELETE" })),
  1764. CreateEndpoint("api/environments/{id}", new HttpMethodMetadata(new[] { "DELETE" })),
  1765. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/environments/all", new HttpMethodMetadata(new[] { "GET" })),
  1766. CreateEndpoint("api/environments/all", new HttpMethodMetadata(new[] { "GET" })),
  1767. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/environments/{id:regex((?!(summary)))}", new HttpMethodMetadata(new[] { "GET" })),
  1768. CreateEndpoint("api/environments/{id:regex((?!(summary)))}", new HttpMethodMetadata(new[] { "GET" })),
  1769. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/environments", new HttpMethodMetadata(new[] { "GET" })),
  1770. CreateEndpoint("api/environments", new HttpMethodMetadata(new[] { "GET" })),
  1771. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/deployments", new HttpMethodMetadata(new[] { "POST" })),
  1772. CreateEndpoint("api/deployments", new HttpMethodMetadata(new[] { "POST" })),
  1773. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/deployments/{id}", new HttpMethodMetadata(new[] { "DELETE" })),
  1774. CreateEndpoint("api/deployments/{id}", new HttpMethodMetadata(new[] { "DELETE" })),
  1775. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/deployments/{id}", new HttpMethodMetadata(new[] { "GET" })),
  1776. CreateEndpoint("api/deployments/{id}", new HttpMethodMetadata(new[] { "GET" })),
  1777. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/deployments", new HttpMethodMetadata(new[] { "GET" })),
  1778. CreateEndpoint("api/deployments", new HttpMethodMetadata(new[] { "GET" })),
  1779. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/projects/{projectId:regex(^Projects-\\d\u002B$)}/{gitRef}/deploymentsettings/ocl/raw", new HttpMethodMetadata(new[] { "GET" })),
  1780. CreateEndpoint("api/projects/{projectId:regex(^Projects-\\d\u002B$)}/{gitRef}/deploymentsettings/ocl/raw", new HttpMethodMetadata(new[] { "GET" })),
  1781. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/deploymentsettings/{id}", new HttpMethodMetadata(new[] { "GET" })),
  1782. CreateEndpoint("api/deploymentsettings/{id}", new HttpMethodMetadata(new[] { "GET" })),
  1783. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/projects/{projectId:regex(^Projects-\\d\u002B$)}/{gitRef}/deploymentsettings", new HttpMethodMetadata(new[] { "GET" })),
  1784. CreateEndpoint("api/projects/{projectId:regex(^Projects-\\d\u002B$)}/{gitRef}/deploymentsettings", new HttpMethodMetadata(new[] { "GET" })),
  1785. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/projects/{projectId:regex(^Projects-\\d\u002B$)}/deploymentsettings", new HttpMethodMetadata(new[] { "GET" })),
  1786. CreateEndpoint("api/projects/{projectId:regex(^Projects-\\d\u002B$)}/deploymentsettings", new HttpMethodMetadata(new[] { "GET" })),
  1787. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/projects/{projectId:regex(^Projects-\\d\u002B$)}/{gitRef}/deploymentsettings/ocl/raw", new HttpMethodMetadata(new[] { "PUT" })),
  1788. CreateEndpoint("api/projects/{projectId:regex(^Projects-\\d\u002B$)}/{gitRef}/deploymentsettings/ocl/raw", new HttpMethodMetadata(new[] { "PUT" })),
  1789. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/deploymentsettings/{id}", new HttpMethodMetadata(new[] { "PUT" })),
  1790. CreateEndpoint("api/deploymentsettings/{id}", new HttpMethodMetadata(new[] { "PUT" })),
  1791. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/projects/{projectId:regex(^Projects-\\d\u002B$)}/deploymentsettings", new HttpMethodMetadata(new[] { "PUT" })),
  1792. CreateEndpoint("api/projects/{projectId:regex(^Projects-\\d\u002B$)}/deploymentsettings", new HttpMethodMetadata(new[] { "PUT" })),
  1793. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/projects/{projectId:regex(^Projects-\\d\u002B$)}/{gitRef}/deploymentsettings", new HttpMethodMetadata(new[] { "PUT" })),
  1794. CreateEndpoint("api/projects/{projectId:regex(^Projects-\\d\u002B$)}/{gitRef}/deploymentsettings", new HttpMethodMetadata(new[] { "PUT" })),
  1795. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/deploymentprocesses", new HttpMethodMetadata(new[] { "GET" })),
  1796. CreateEndpoint("api/deploymentprocesses", new HttpMethodMetadata(new[] { "GET" })),
  1797. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/projects/{projectId:regex(^Projects-\\d\u002B$)}/deploymentprocesses", new HttpMethodMetadata(new[] { "GET" })),
  1798. CreateEndpoint("api/projects/{projectId:regex(^Projects-\\d\u002B$)}/deploymentprocesses", new HttpMethodMetadata(new[] { "GET" })),
  1799. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/projects/{projectId:regex(^Projects-\\d\u002B$)}/{gitRef}/deploymentprocesses", new HttpMethodMetadata(new[] { "GET" })),
  1800. CreateEndpoint("api/projects/{projectId:regex(^Projects-\\d\u002B$)}/{gitRef}/deploymentprocesses", new HttpMethodMetadata(new[] { "GET" })),
  1801. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/projects/{projectId:regex(^Projects-\\d\u002B$)}/{gitRef}/deploymentprocesses/ocl/raw", new HttpMethodMetadata(new[] { "GET" })),
  1802. CreateEndpoint("api/projects/{projectId:regex(^Projects-\\d\u002B$)}/{gitRef}/deploymentprocesses/ocl/raw", new HttpMethodMetadata(new[] { "GET" })),
  1803. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/deploymentprocesses/{deploymentProcessId}/template", new HttpMethodMetadata(new[] { "GET" })),
  1804. CreateEndpoint("api/deploymentprocesses/{deploymentProcessId}/template", new HttpMethodMetadata(new[] { "GET" })),
  1805. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/projects/{projectId:regex(^Projects-\\d\u002B$)}/{gitRef}/deploymentprocesses/template", new HttpMethodMetadata(new[] { "GET" })),
  1806. CreateEndpoint("api/projects/{projectId:regex(^Projects-\\d\u002B$)}/{gitRef}/deploymentprocesses/template", new HttpMethodMetadata(new[] { "GET" })),
  1807. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/projects/{projectId:regex(^Projects-\\d\u002B$)}/deploymentprocesses/template", new HttpMethodMetadata(new[] { "GET" })),
  1808. CreateEndpoint("api/projects/{projectId:regex(^Projects-\\d\u002B$)}/deploymentprocesses/template", new HttpMethodMetadata(new[] { "GET" })),
  1809. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/deploymentprocesses/{id}", new HttpMethodMetadata(new[] { "GET" })),
  1810. CreateEndpoint("api/deploymentprocesses/{id}", new HttpMethodMetadata(new[] { "GET" })),
  1811. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/projects/{projectId:regex(^Projects-\\d\u002B$)}/{gitRef}/deploymentprocesses/ocl/raw", new HttpMethodMetadata(new[] { "PUT" })),
  1812. CreateEndpoint("api/projects/{projectId:regex(^Projects-\\d\u002B$)}/{gitRef}/deploymentprocesses/ocl/raw", new HttpMethodMetadata(new[] { "PUT" })),
  1813. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/deploymentprocesses/{id}", new HttpMethodMetadata(new[] { "PUT" })),
  1814. CreateEndpoint("api/deploymentprocesses/{id}", new HttpMethodMetadata(new[] { "PUT" })),
  1815. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/projects/{projectId:regex(^Projects-\\d\u002B$)}/{gitRef}/deploymentprocesses", new HttpMethodMetadata(new[] { "PUT" })),
  1816. CreateEndpoint("api/projects/{projectId:regex(^Projects-\\d\u002B$)}/{gitRef}/deploymentprocesses", new HttpMethodMetadata(new[] { "PUT" })),
  1817. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/projects/{projectId:regex(^Projects-\\d\u002B$)}/deploymentprocesses", new HttpMethodMetadata(new[] { "PUT" })),
  1818. CreateEndpoint("api/projects/{projectId:regex(^Projects-\\d\u002B$)}/deploymentprocesses", new HttpMethodMetadata(new[] { "PUT" })),
  1819. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/projects/{projectId:regex(^Projects-\\d\u002B$)}/deploymentprocess/validate", new HttpMethodMetadata(new[] { "POST" })),
  1820. CreateEndpoint("api/projects/{projectId:regex(^Projects-\\d\u002B$)}/deploymentprocess/validate", new HttpMethodMetadata(new[] { "POST" })),
  1821. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/projects/{projectId:regex(^Projects-\\d\u002B$)}/{gitRef}/deploymentprocesses/validate", new HttpMethodMetadata(new[] { "POST" })),
  1822. CreateEndpoint("api/projects/{projectId:regex(^Projects-\\d\u002B$)}/{gitRef}/deploymentprocesses/validate", new HttpMethodMetadata(new[] { "POST" })),
  1823. CreateEndpoint("api/configuration/retention-default", new HttpMethodMetadata(new[] { "GET" })),
  1824. CreateEndpoint("api/configuration/retention-default", new HttpMethodMetadata(new[] { "PUT" })),
  1825. CreateEndpoint("api/configuration/certificates/{id}", new HttpMethodMetadata(new[] { "GET" })),
  1826. CreateEndpoint("api/communityactiontemplates/{id}", new HttpMethodMetadata(new[] { "GET" })),
  1827. CreateEndpoint("api/communityactiontemplates", new HttpMethodMetadata(new[] { "GET" })),
  1828. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/channels", new HttpMethodMetadata(new[] { "POST" })),
  1829. CreateEndpoint("api/channels", new HttpMethodMetadata(new[] { "POST" })),
  1830. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/projects/{projectId}/channels", new HttpMethodMetadata(new[] { "POST" })),
  1831. CreateEndpoint("api/projects/{projectId}/channels", new HttpMethodMetadata(new[] { "POST" })),
  1832. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/projects/{projectId}/{gitRef}/channels", new HttpMethodMetadata(new[] { "POST" })),
  1833. CreateEndpoint("api/projects/{projectId}/{gitRef}/channels", new HttpMethodMetadata(new[] { "POST" })),
  1834. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/channels/{id}", new HttpMethodMetadata(new[] { "DELETE" })),
  1835. CreateEndpoint("api/channels/{id}", new HttpMethodMetadata(new[] { "DELETE" })),
  1836. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/projects/{projectId:regex(^Projects-\\d\u002B$)}/channels/{id}", new HttpMethodMetadata(new[] { "DELETE" })),
  1837. CreateEndpoint("api/projects/{projectId:regex(^Projects-\\d\u002B$)}/channels/{id}", new HttpMethodMetadata(new[] { "DELETE" })),
  1838. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/projects/{projectId:regex(^Projects-\\d\u002B$)}/{gitRef}/channels/{id}", new HttpMethodMetadata(new[] { "DELETE" })),
  1839. CreateEndpoint("api/projects/{projectId:regex(^Projects-\\d\u002B$)}/{gitRef}/channels/{id}", new HttpMethodMetadata(new[] { "DELETE" })),
  1840. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/channels/all", new HttpMethodMetadata(new[] { "GET" })),
  1841. CreateEndpoint("api/channels/all", new HttpMethodMetadata(new[] { "GET" })),
  1842. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/channels/{id:regex((?!(rule-test)))}", new HttpMethodMetadata(new[] { "GET" })),
  1843. CreateEndpoint("api/channels/{id:regex((?!(rule-test)))}", new HttpMethodMetadata(new[] { "GET" })),
  1844. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/projects/{projectId:regex(^Projects-\\d\u002B$)}/channels/{id}", new HttpMethodMetadata(new[] { "GET" })),
  1845. CreateEndpoint("api/projects/{projectId:regex(^Projects-\\d\u002B$)}/channels/{id}", new HttpMethodMetadata(new[] { "GET" })),
  1846. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/projects/{projectId:regex(^Projects-\\d\u002B$)}/{gitRef}/channels/{id}", new HttpMethodMetadata(new[] { "GET" })),
  1847. CreateEndpoint("api/projects/{projectId:regex(^Projects-\\d\u002B$)}/{gitRef}/channels/{id}", new HttpMethodMetadata(new[] { "GET" })),
  1848. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/channels", new HttpMethodMetadata(new[] { "GET" })),
  1849. CreateEndpoint("api/channels", new HttpMethodMetadata(new[] { "GET" })),
  1850. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/projects/{projectId:regex(^Projects-\\d\u002B$)}/channels", new HttpMethodMetadata(new[] { "GET" })),
  1851. CreateEndpoint("api/projects/{projectId:regex(^Projects-\\d\u002B$)}/channels", new HttpMethodMetadata(new[] { "GET" })),
  1852. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/projects/{projectId:regex(^Projects-\\d\u002B$)}/{gitRef}/channels", new HttpMethodMetadata(new[] { "GET" })),
  1853. CreateEndpoint("api/projects/{projectId:regex(^Projects-\\d\u002B$)}/{gitRef}/channels", new HttpMethodMetadata(new[] { "GET" })),
  1854. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/projects/{projectId}/channels/{id}", new HttpMethodMetadata(new[] { "PUT" })),
  1855. CreateEndpoint("api/projects/{projectId}/channels/{id}", new HttpMethodMetadata(new[] { "PUT" })),
  1856. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/projects/{projectId}/{gitRef}/channels/{id}", new HttpMethodMetadata(new[] { "PUT" })),
  1857. CreateEndpoint("api/projects/{projectId}/{gitRef}/channels/{id}", new HttpMethodMetadata(new[] { "PUT" })),
  1858. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/channels/{id}", new HttpMethodMetadata(new[] { "PUT" })),
  1859. CreateEndpoint("api/channels/{id}", new HttpMethodMetadata(new[] { "PUT" })),
  1860. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/channels/rule-test", new HttpMethodMetadata(new[] { "GET" })),
  1861. CreateEndpoint("api/channels/rule-test", new HttpMethodMetadata(new[] { "GET" })),
  1862. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/channels/rule-test", new HttpMethodMetadata(new[] { "POST" })),
  1863. CreateEndpoint("api/channels/rule-test", new HttpMethodMetadata(new[] { "POST" })),
  1864. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/certificates/{id}", new HttpMethodMetadata(new[] { "DELETE" })),
  1865. CreateEndpoint("api/certificates/{id}", new HttpMethodMetadata(new[] { "DELETE" })),
  1866. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/certificates/all", new HttpMethodMetadata(new[] { "GET" })),
  1867. CreateEndpoint("api/certificates/all", new HttpMethodMetadata(new[] { "GET" })),
  1868. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/build-information/bulk", new HttpMethodMetadata(new[] { "DELETE" })),
  1869. CreateEndpoint("api/build-information/bulk", new HttpMethodMetadata(new[] { "DELETE" })),
  1870. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/build-information/{id}", new HttpMethodMetadata(new[] { "DELETE" })),
  1871. CreateEndpoint("api/build-information/{id}", new HttpMethodMetadata(new[] { "DELETE" })),
  1872. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/artifacts/{id}", new HttpMethodMetadata(new[] { "DELETE" })),
  1873. CreateEndpoint("api/artifacts/{id}", new HttpMethodMetadata(new[] { "DELETE" })),
  1874. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/artifacts/{id}", new HttpMethodMetadata(new[] { "GET" })),
  1875. CreateEndpoint("api/artifacts/{id}", new HttpMethodMetadata(new[] { "GET" })),
  1876. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/actiontemplates/{id:regex((?!(search|categories)))}", new HttpMethodMetadata(new[] { "GET" })),
  1877. CreateEndpoint("api/actiontemplates/{id:regex((?!(search|categories)))}", new HttpMethodMetadata(new[] { "GET" })),
  1878. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/actiontemplates", new HttpMethodMetadata(new[] { "GET" })),
  1879. CreateEndpoint("api/actiontemplates", new HttpMethodMetadata(new[] { "GET" })),
  1880. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/actiontemplates/all", new HttpMethodMetadata(new[] { "GET" })),
  1881. CreateEndpoint("api/actiontemplates/all", new HttpMethodMetadata(new[] { "GET" })),
  1882. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/accounts/{id}", new HttpMethodMetadata(new[] { "DELETE" })),
  1883. CreateEndpoint("api/accounts/{id}", new HttpMethodMetadata(new[] { "DELETE" })),
  1884. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/accounts/{id}/pk", new HttpMethodMetadata(new[] { "GET" })),
  1885. CreateEndpoint("api/accounts/{id}/pk", new HttpMethodMetadata(new[] { "GET" })),
  1886. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/accounts/{id:regex((?!(azureenvironments)))}", new HttpMethodMetadata(new[] { "GET" })),
  1887. CreateEndpoint("api/accounts/{id:regex((?!(azureenvironments)))}", new HttpMethodMetadata(new[] { "GET" })),
  1888. CreateEndpoint("api/{baseSpaceId:regex(Spaces-\\d\u002B)}/accounts/all", new HttpMethodMetadata(new[] { "GET" })),
  1889. CreateEndpoint("api/accounts/all", new HttpMethodMetadata(new[] { "GET" })),
  1890. CreateEndpoint("api/diagnostics/throw", new HttpMethodMetadata(new[] { "GET" })),
  1891. };
  1892. foreach (var endpoint in endpoints)
  1893. {
  1894. builder.AddEndpoint(endpoint);
  1895. }
  1896. // Act
  1897. var root = builder.BuildDfaTree();
  1898. // Assert
  1899. Assert.NotNull(root);
  1900. var count = 0;
  1901. root.Visit(node => count++);
  1902. // Without filtering it would have resulted in several order of magnitudes more nodes and much more memory
  1903. Assert.Equal(2964, count);
  1904. }
  1905. // Another regression test based on OData models
  1906. [Fact]
  1907. public void BuildDfaTree_CanHandle_LargeAmountOfRoutes_WithComplexParameters()
  1908. {
  1909. // Arrange
  1910. var builder = CreateDfaMatcherBuilder();
  1911. var endpoints = new[]{
  1912. CreateEndpoint("Student", new HttpMethodMetadata(new[] { "GET" })),
  1913. CreateEndpoint("{contextToken}/Student", new HttpMethodMetadata(new[] { "GET" })),
  1914. CreateEndpoint("{contextToken}/Student/$count", new HttpMethodMetadata(new[] { "GET" })),
  1915. CreateEndpoint("{contextToken}/Student", new HttpMethodMetadata(new[] { "PATCH" })),
  1916. CreateEndpoint("Student({propName}={propValue})", new HttpMethodMetadata(new[] { "DELETE" })),
  1917. CreateEndpoint("Student({key})", new HttpMethodMetadata(new[] { "DELETE" })),
  1918. CreateEndpoint("Student/{key}", new HttpMethodMetadata(new[] { "DELETE" })),
  1919. CreateEndpoint("{contextToken}/Student({key})", new HttpMethodMetadata(new[] { "DELETE" })),
  1920. CreateEndpoint("{contextToken}/Student/{key}", new HttpMethodMetadata(new[] { "DELETE" })),
  1921. CreateEndpoint("Student1", new HttpMethodMetadata(new[] { "GET" })),
  1922. CreateEndpoint("{contextToken}/Student1", new HttpMethodMetadata(new[] { "GET" })),
  1923. CreateEndpoint("{contextToken}/Student1/$count", new HttpMethodMetadata(new[] { "GET" })),
  1924. CreateEndpoint("{contextToken}/Student1", new HttpMethodMetadata(new[] { "PATCH" })),
  1925. CreateEndpoint("Student1({propName}={propValue})", new HttpMethodMetadata(new[] { "DELETE" })),
  1926. CreateEndpoint("Student1({key})", new HttpMethodMetadata(new[] { "DELETE" })),
  1927. CreateEndpoint("Student1/{key}", new HttpMethodMetadata(new[] { "DELETE" })),
  1928. CreateEndpoint("{contextToken}/Student1({key})", new HttpMethodMetadata(new[] { "DELETE" })),
  1929. CreateEndpoint("{contextToken}/Student1/{key}", new HttpMethodMetadata(new[] { "DELETE" })),
  1930. CreateEndpoint("Student2", new HttpMethodMetadata(new[] { "GET" })),
  1931. CreateEndpoint("{contextToken}/Student2", new HttpMethodMetadata(new[] { "GET" })),
  1932. CreateEndpoint("{contextToken}/Student2/$count", new HttpMethodMetadata(new[] { "GET" })),
  1933. CreateEndpoint("{contextToken}/Student2", new HttpMethodMetadata(new[] { "PATCH" })),
  1934. CreateEndpoint("Student2({propName}={propValue})", new HttpMethodMetadata(new[] { "DELETE" })),
  1935. CreateEndpoint("Student2({key})", new HttpMethodMetadata(new[] { "DELETE" })),
  1936. CreateEndpoint("Student2/{key}", new HttpMethodMetadata(new[] { "DELETE" })),
  1937. CreateEndpoint("{contextToken}/Student2({key})", new HttpMethodMetadata(new[] { "DELETE" })),
  1938. CreateEndpoint("{contextToken}/Student2/{key}", new HttpMethodMetadata(new[] { "DELETE" })),
  1939. CreateEndpoint("Student3", new HttpMethodMetadata(new[] { "GET" })),
  1940. CreateEndpoint("{contextToken}/Student3", new HttpMethodMetadata(new[] { "GET" })),
  1941. CreateEndpoint("{contextToken}/Student3/$count", new HttpMethodMetadata(new[] { "GET" })),
  1942. CreateEndpoint("{contextToken}/Student3", new HttpMethodMetadata(new[] { "PATCH" })),
  1943. CreateEndpoint("Student3({propName}={propValue})", new HttpMethodMetadata(new[] { "DELETE" })),
  1944. CreateEndpoint("Student3({key})", new HttpMethodMetadata(new[] { "DELETE" })),
  1945. CreateEndpoint("Student3/{key}", new HttpMethodMetadata(new[] { "DELETE" })),
  1946. CreateEndpoint("{contextToken}/Student3({key})", new HttpMethodMetadata(new[] { "DELETE" })),
  1947. CreateEndpoint("{contextToken}/Student3/{key}", new HttpMethodMetadata(new[] { "DELETE" })),
  1948. CreateEndpoint("Student4", new HttpMethodMetadata(new[] { "GET" })),
  1949. CreateEndpoint("{contextToken}/Student4", new HttpMethodMetadata(new[] { "GET" })),
  1950. CreateEndpoint("{contextToken}/Student4/$count", new HttpMethodMetadata(new[] { "GET" })),
  1951. CreateEndpoint("{contextToken}/Student4", new HttpMethodMetadata(new[] { "PATCH" })),
  1952. CreateEndpoint("Student4({propName}={propValue})", new HttpMethodMetadata(new[] { "DELETE" })),
  1953. CreateEndpoint("Student4({key})", new HttpMethodMetadata(new[] { "DELETE" })),
  1954. CreateEndpoint("Student4/{key}", new HttpMethodMetadata(new[] { "DELETE" })),
  1955. CreateEndpoint("{contextToken}/Student4({key})", new HttpMethodMetadata(new[] { "DELETE" })),
  1956. CreateEndpoint("{contextToken}/Student4/{key}", new HttpMethodMetadata(new[] { "DELETE" })),
  1957. CreateEndpoint("Student5", new HttpMethodMetadata(new[] { "GET" })),
  1958. CreateEndpoint("{contextToken}/Student5", new HttpMethodMetadata(new[] { "GET" })),
  1959. CreateEndpoint("{contextToken}/Student5/$count", new HttpMethodMetadata(new[] { "GET" })),
  1960. CreateEndpoint("{contextToken}/Student5", new HttpMethodMetadata(new[] { "PATCH" })),
  1961. CreateEndpoint("Student5({propName}={propValue})", new HttpMethodMetadata(new[] { "DELETE" })),
  1962. CreateEndpoint("Student5({key})", new HttpMethodMetadata(new[] { "DELETE" })),
  1963. CreateEndpoint("Student5/{key}", new HttpMethodMetadata(new[] { "DELETE" })),
  1964. CreateEndpoint("{contextToken}/Student5({key})", new HttpMethodMetadata(new[] { "DELETE" })),
  1965. CreateEndpoint("{contextToken}/Student5/{key}", new HttpMethodMetadata(new[] { "DELETE" })),
  1966. CreateEndpoint("Student6", new HttpMethodMetadata(new[] { "GET" })),
  1967. CreateEndpoint("{contextToken}/Student6", new HttpMethodMetadata(new[] { "GET" })),
  1968. CreateEndpoint("{contextToken}/Student6/$count", new HttpMethodMetadata(new[] { "GET" })),
  1969. CreateEndpoint("{contextToken}/Student6", new HttpMethodMetadata(new[] { "PATCH" })),
  1970. CreateEndpoint("Student6({propName}={propValue})", new HttpMethodMetadata(new[] { "DELETE" })),
  1971. CreateEndpoint("Student6({key})", new HttpMethodMetadata(new[] { "DELETE" })),
  1972. CreateEndpoint("Student6/{key}", new HttpMethodMetadata(new[] { "DELETE" })),
  1973. CreateEndpoint("{contextToken}/Student6({key})", new HttpMethodMetadata(new[] { "DELETE" })),
  1974. CreateEndpoint("{contextToken}/Student6/{key}", new HttpMethodMetadata(new[] { "DELETE" })),
  1975. CreateEndpoint("Student7", new HttpMethodMetadata(new[] { "GET" })),
  1976. CreateEndpoint("{contextToken}/Student7", new HttpMethodMetadata(new[] { "GET" })),
  1977. CreateEndpoint("{contextToken}/Student7/$count", new HttpMethodMetadata(new[] { "GET" })),
  1978. CreateEndpoint("{contextToken}/Student7", new HttpMethodMetadata(new[] { "PATCH" })),
  1979. CreateEndpoint("Student7({propName}={propValue})", new HttpMethodMetadata(new[] { "DELETE" })),
  1980. CreateEndpoint("Student7({key})", new HttpMethodMetadata(new[] { "DELETE" })),
  1981. CreateEndpoint("Student7/{key}", new HttpMethodMetadata(new[] { "DELETE" })),
  1982. CreateEndpoint("{contextToken}/Student7({key})", new HttpMethodMetadata(new[] { "DELETE" })),
  1983. CreateEndpoint("{contextToken}/Student7/{key}", new HttpMethodMetadata(new[] { "DELETE" })),
  1984. CreateEndpoint("Student8", new HttpMethodMetadata(new[] { "GET" })),
  1985. CreateEndpoint("{contextToken}/Student8", new HttpMethodMetadata(new[] { "GET" })),
  1986. CreateEndpoint("{contextToken}/Student8/$count", new HttpMethodMetadata(new[] { "GET" })),
  1987. CreateEndpoint("{contextToken}/Student8", new HttpMethodMetadata(new[] { "PATCH" })),
  1988. CreateEndpoint("Student8({propName}={propValue})", new HttpMethodMetadata(new[] { "DELETE" })),
  1989. CreateEndpoint("Student8({key})", new HttpMethodMetadata(new[] { "DELETE" })),
  1990. CreateEndpoint("Student8/{key}", new HttpMethodMetadata(new[] { "DELETE" })),
  1991. CreateEndpoint("{contextToken}/Student8({key})", new HttpMethodMetadata(new[] { "DELETE" })),
  1992. CreateEndpoint("{contextToken}/Student8/{key}", new HttpMethodMetadata(new[] { "DELETE" })),
  1993. CreateEndpoint("Student9", new HttpMethodMetadata(new[] { "GET" })),
  1994. CreateEndpoint("{contextToken}/Student9", new HttpMethodMetadata(new[] { "GET" })),
  1995. CreateEndpoint("{contextToken}/Student9/$count", new HttpMethodMetadata(new[] { "GET" })),
  1996. CreateEndpoint("{contextToken}/Student9", new HttpMethodMetadata(new[] { "PATCH" })),
  1997. CreateEndpoint("Student9({propName}={propValue})", new HttpMethodMetadata(new[] { "DELETE" })),
  1998. CreateEndpoint("Student9({key})", new HttpMethodMetadata(new[] { "DELETE" })),
  1999. CreateEndpoint("Student9/{key}", new HttpMethodMetadata(new[] { "DELETE" })),
  2000. CreateEndpoint("{contextToken}/Student9({key})", new HttpMethodMetadata(new[] { "DELETE" })),
  2001. CreateEndpoint("{contextToken}/Student9/{key}", new HttpMethodMetadata(new[] { "DELETE" })),
  2002. CreateEndpoint("Student10", new HttpMethodMetadata(new[] { "GET" })),
  2003. CreateEndpoint("{contextToken}/Student10", new HttpMethodMetadata(new[] { "GET" })),
  2004. CreateEndpoint("{contextToken}/Student10/$count", new HttpMethodMetadata(new[] { "GET" })),
  2005. CreateEndpoint("{contextToken}/Student10", new HttpMethodMetadata(new[] { "PATCH" })),
  2006. CreateEndpoint("Student10({propName}={propValue})", new HttpMethodMetadata(new[] { "DELETE" })),
  2007. CreateEndpoint("Student10({key})", new HttpMethodMetadata(new[] { "DELETE" })),
  2008. CreateEndpoint("Student10/{key}", new HttpMethodMetadata(new[] { "DELETE" })),
  2009. CreateEndpoint("{contextToken}/Student10({key})", new HttpMethodMetadata(new[] { "DELETE" })),
  2010. CreateEndpoint("{contextToken}/Student10/{key}", new HttpMethodMetadata(new[] { "DELETE" })),
  2011. CreateEndpoint("Student11", new HttpMethodMetadata(new[] { "GET" })),
  2012. CreateEndpoint("{contextToken}/Student11", new HttpMethodMetadata(new[] { "GET" })),
  2013. CreateEndpoint("{contextToken}/Student11/$count", new HttpMethodMetadata(new[] { "GET" })),
  2014. CreateEndpoint("{contextToken}/Student11", new HttpMethodMetadata(new[] { "PATCH" })),
  2015. CreateEndpoint("Student11({propName}={propValue})", new HttpMethodMetadata(new[] { "DELETE" })),
  2016. CreateEndpoint("Student11({key})", new HttpMethodMetadata(new[] { "DELETE" })),
  2017. CreateEndpoint("Student11/{key}", new HttpMethodMetadata(new[] { "DELETE" })),
  2018. CreateEndpoint("{contextToken}/Student11({key})", new HttpMethodMetadata(new[] { "DELETE" })),
  2019. CreateEndpoint("{contextToken}/Student11/{key}", new HttpMethodMetadata(new[] { "DELETE" })),
  2020. CreateEndpoint("Student12", new HttpMethodMetadata(new[] { "GET" })),
  2021. CreateEndpoint("{contextToken}/Student12", new HttpMethodMetadata(new[] { "GET" })),
  2022. CreateEndpoint("{contextToken}/Student12/$count", new HttpMethodMetadata(new[] { "GET" })),
  2023. CreateEndpoint("{contextToken}/Student12", new HttpMethodMetadata(new[] { "PATCH" })),
  2024. CreateEndpoint("Student12({propName}={propValue})", new HttpMethodMetadata(new[] { "DELETE" })),
  2025. CreateEndpoint("Student12({key})", new HttpMethodMetadata(new[] { "DELETE" })),
  2026. CreateEndpoint("Student12/{key}", new HttpMethodMetadata(new[] { "DELETE" })),
  2027. CreateEndpoint("{contextToken}/Student12({key})", new HttpMethodMetadata(new[] { "DELETE" })),
  2028. CreateEndpoint("{contextToken}/Student12/{key}", new HttpMethodMetadata(new[] { "DELETE" })),
  2029. CreateEndpoint("Student13", new HttpMethodMetadata(new[] { "GET" })),
  2030. CreateEndpoint("{contextToken}/Student13", new HttpMethodMetadata(new[] { "GET" })),
  2031. CreateEndpoint("{contextToken}/Student13/$count", new HttpMethodMetadata(new[] { "GET" })),
  2032. CreateEndpoint("{contextToken}/Student13", new HttpMethodMetadata(new[] { "PATCH" })),
  2033. CreateEndpoint("Student13({propName}={propValue})", new HttpMethodMetadata(new[] { "DELETE" })),
  2034. CreateEndpoint("Student13({key})", new HttpMethodMetadata(new[] { "DELETE" })),
  2035. CreateEndpoint("Student13/{key}", new HttpMethodMetadata(new[] { "DELETE" })),
  2036. CreateEndpoint("{contextToken}/Student13({key})", new HttpMethodMetadata(new[] { "DELETE" })),
  2037. CreateEndpoint("{contextToken}/Student13/{key}", new HttpMethodMetadata(new[] { "DELETE" })),
  2038. CreateEndpoint("Student14", new HttpMethodMetadata(new[] { "GET" })),
  2039. CreateEndpoint("{contextToken}/Student14", new HttpMethodMetadata(new[] { "GET" })),
  2040. CreateEndpoint("{contextToken}/Student14/$count", new HttpMethodMetadata(new[] { "GET" })),
  2041. CreateEndpoint("{contextToken}/Student14", new HttpMethodMetadata(new[] { "PATCH" })),
  2042. CreateEndpoint("Student14({propName}={propValue})", new HttpMethodMetadata(new[] { "DELETE" })),
  2043. CreateEndpoint("Student14({key})", new HttpMethodMetadata(new[] { "DELETE" })),
  2044. CreateEndpoint("Student14/{key}", new HttpMethodMetadata(new[] { "DELETE" })),
  2045. CreateEndpoint("{contextToken}/Student14({key})", new HttpMethodMetadata(new[] { "DELETE" })),
  2046. CreateEndpoint("{contextToken}/Student14/{key}", new HttpMethodMetadata(new[] { "DELETE" })),
  2047. CreateEndpoint("Student15", new HttpMethodMetadata(new[] { "GET" })),
  2048. CreateEndpoint("{contextToken}/Student15", new HttpMethodMetadata(new[] { "GET" })),
  2049. CreateEndpoint("{contextToken}/Student15/$count", new HttpMethodMetadata(new[] { "GET" })),
  2050. CreateEndpoint("{contextToken}/Student15", new HttpMethodMetadata(new[] { "PATCH" })),
  2051. CreateEndpoint("Student15({propName}={propValue})", new HttpMethodMetadata(new[] { "DELETE" })),
  2052. CreateEndpoint("Student15({key})", new HttpMethodMetadata(new[] { "DELETE" })),
  2053. CreateEndpoint("Student15/{key}", new HttpMethodMetadata(new[] { "DELETE" })),
  2054. CreateEndpoint("{contextToken}/Student15({key})", new HttpMethodMetadata(new[] { "DELETE" })),
  2055. CreateEndpoint("{contextToken}/Student15/{key}", new HttpMethodMetadata(new[] { "DELETE" })),
  2056. CreateEndpoint("Student16", new HttpMethodMetadata(new[] { "GET" })),
  2057. CreateEndpoint("{contextToken}/Student16", new HttpMethodMetadata(new[] { "GET" })),
  2058. CreateEndpoint("{contextToken}/Student16/$count", new HttpMethodMetadata(new[] { "GET" })),
  2059. CreateEndpoint("{contextToken}/Student16", new HttpMethodMetadata(new[] { "PATCH" })),
  2060. CreateEndpoint("Student16({propName}={propValue})", new HttpMethodMetadata(new[] { "DELETE" })),
  2061. CreateEndpoint("Student16({key})", new HttpMethodMetadata(new[] { "DELETE" })),
  2062. CreateEndpoint("Student16/{key}", new HttpMethodMetadata(new[] { "DELETE" })),
  2063. CreateEndpoint("{contextToken}/Student16({key})", new HttpMethodMetadata(new[] { "DELETE" })),
  2064. CreateEndpoint("{contextToken}/Student16/{key}", new HttpMethodMetadata(new[] { "DELETE" })),
  2065. CreateEndpoint("Student17", new HttpMethodMetadata(new[] { "GET" })),
  2066. CreateEndpoint("{contextToken}/Student17", new HttpMethodMetadata(new[] { "GET" })),
  2067. CreateEndpoint("{contextToken}/Student17/$count", new HttpMethodMetadata(new[] { "GET" })),
  2068. CreateEndpoint("{contextToken}/Student17", new HttpMethodMetadata(new[] { "PATCH" })),
  2069. CreateEndpoint("Student17({propName}={propValue})", new HttpMethodMetadata(new[] { "DELETE" })),
  2070. CreateEndpoint("Student17({key})", new HttpMethodMetadata(new[] { "DELETE" })),
  2071. CreateEndpoint("Student17/{key}", new HttpMethodMetadata(new[] { "DELETE" })),
  2072. CreateEndpoint("{contextToken}/Student17({key})", new HttpMethodMetadata(new[] { "DELETE" })),
  2073. CreateEndpoint("{contextToken}/Student17/{key}", new HttpMethodMetadata(new[] { "DELETE" })),
  2074. CreateEndpoint("Student18", new HttpMethodMetadata(new[] { "GET" })),
  2075. CreateEndpoint("{contextToken}/Student18", new HttpMethodMetadata(new[] { "GET" })),
  2076. CreateEndpoint("{contextToken}/Student18/$count", new HttpMethodMetadata(new[] { "GET" })),
  2077. CreateEndpoint("{contextToken}/Student18", new HttpMethodMetadata(new[] { "PATCH" })),
  2078. CreateEndpoint("Student18({propName}={propValue})", new HttpMethodMetadata(new[] { "DELETE" })),
  2079. CreateEndpoint("Student18({key})", new HttpMethodMetadata(new[] { "DELETE" })),
  2080. CreateEndpoint("Student18/{key}", new HttpMethodMetadata(new[] { "DELETE" })),
  2081. CreateEndpoint("{contextToken}/Student18({key})", new HttpMethodMetadata(new[] { "DELETE" })),
  2082. CreateEndpoint("{contextToken}/Student18/{key}", new HttpMethodMetadata(new[] { "DELETE" })),
  2083. CreateEndpoint("Student19", new HttpMethodMetadata(new[] { "GET" })),
  2084. CreateEndpoint("{contextToken}/Student19", new HttpMethodMetadata(new[] { "GET" })),
  2085. CreateEndpoint("{contextToken}/Student19/$count", new HttpMethodMetadata(new[] { "GET" })),
  2086. CreateEndpoint("{contextToken}/Student19", new HttpMethodMetadata(new[] { "PATCH" })),
  2087. CreateEndpoint("Student19({propName}={propValue})", new HttpMethodMetadata(new[] { "DELETE" })),
  2088. CreateEndpoint("Student19({key})", new HttpMethodMetadata(new[] { "DELETE" })),
  2089. CreateEndpoint("Student19/{key}", new HttpMethodMetadata(new[] { "DELETE" })),
  2090. CreateEndpoint("{contextToken}/Student19({key})", new HttpMethodMetadata(new[] { "DELETE" })),
  2091. CreateEndpoint("{contextToken}/Student19/{key}", new HttpMethodMetadata(new[] { "DELETE" })),
  2092. CreateEndpoint("Student20", new HttpMethodMetadata(new[] { "GET" })),
  2093. CreateEndpoint("{contextToken}/Student20", new HttpMethodMetadata(new[] { "GET" })),
  2094. CreateEndpoint("{contextToken}/Student20/$count", new HttpMethodMetadata(new[] { "GET" })),
  2095. CreateEndpoint("{contextToken}/Student20", new HttpMethodMetadata(new[] { "PATCH" })),
  2096. CreateEndpoint("Student20({propName}={propValue})", new HttpMethodMetadata(new[] { "DELETE" })),
  2097. CreateEndpoint("Student20({key})", new HttpMethodMetadata(new[] { "DELETE" })),
  2098. CreateEndpoint("Student20/{key}", new HttpMethodMetadata(new[] { "DELETE" })),
  2099. CreateEndpoint("{contextToken}/Student20({key})", new HttpMethodMetadata(new[] { "DELETE" })),
  2100. CreateEndpoint("{contextToken}/Student20/{key}", new HttpMethodMetadata(new[] { "DELETE" })),
  2101. CreateEndpoint("{contextToken}/$metadata", new HttpMethodMetadata(new[] { "GET" })),
  2102. CreateEndpoint("{contextToken}", new HttpMethodMetadata(new[] { "GET" })),
  2103. };
  2104. foreach (var endpoint in endpoints)
  2105. {
  2106. builder.AddEndpoint(endpoint);
  2107. }
  2108. // Act
  2109. var root = builder.BuildDfaTree();
  2110. // Assert
  2111. Assert.NotNull(root);
  2112. var count = 0;
  2113. root.Visit(node => count++);
  2114. // Without filtering it would have resulted in several order of magnitudes more nodes and much more memory
  2115. Assert.Equal(1453, count);
  2116. }
  2117. // Regression test for https://github.com/dotnet/aspnetcore/issues/16579
  2118. //
  2119. // This case behaves the same for all combinations.
  2120. [Fact]
  2121. public void BuildDfaTree_MultipleEndpoint_ParameterAndCatchAll_OnSameNode_Order1()
  2122. {
  2123. // Arrange
  2124. var builder = CreateDfaMatcherBuilder();
  2125. var endpoint1 = CreateEndpoint("a/{b}", order: 0);
  2126. builder.AddEndpoint(endpoint1);
  2127. var endpoint2 = CreateEndpoint("a/{*b}", order: 1);
  2128. builder.AddEndpoint(endpoint2);
  2129. // Act
  2130. var root = builder.BuildDfaTree();
  2131. // Assert
  2132. Assert.Null(root.Matches);
  2133. Assert.Null(root.Parameters);
  2134. var next = Assert.Single(root.Literals);
  2135. Assert.Equal("a", next.Key);
  2136. var a = next.Value;
  2137. Assert.Same(endpoint2, Assert.Single(a.Matches));
  2138. Assert.Null(a.Literals);
  2139. var b = a.Parameters;
  2140. Assert.Collection(
  2141. b.Matches,
  2142. e => Assert.Same(endpoint1, e),
  2143. e => Assert.Same(endpoint2, e));
  2144. Assert.Null(b.Literals);
  2145. Assert.Null(b.Parameters);
  2146. Assert.NotNull(b.CatchAll);
  2147. var catchAll = b.CatchAll;
  2148. Assert.Same(endpoint2, Assert.Single(catchAll.Matches));
  2149. Assert.Null(catchAll.Literals);
  2150. Assert.Same(catchAll, catchAll.Parameters);
  2151. Assert.Same(catchAll, catchAll.CatchAll);
  2152. }
  2153. // Regression test for https://github.com/dotnet/aspnetcore/issues/16579
  2154. [Fact]
  2155. public void BuildDfaTree_MultipleEndpoint_ParameterAndCatchAll_OnSameNode_Order2()
  2156. {
  2157. // Arrange
  2158. var builder = CreateDfaMatcherBuilder();
  2159. var endpoint1 = CreateEndpoint("a/{*b}", order: 0);
  2160. builder.AddEndpoint(endpoint1);
  2161. var endpoint2 = CreateEndpoint("a/{b}", order: 1);
  2162. builder.AddEndpoint(endpoint2);
  2163. // Act
  2164. var root = builder.BuildDfaTree();
  2165. // Assert
  2166. Assert.Null(root.Matches);
  2167. Assert.Null(root.Parameters);
  2168. var next = Assert.Single(root.Literals);
  2169. Assert.Equal("a", next.Key);
  2170. var a = next.Value;
  2171. Assert.Same(endpoint1, Assert.Single(a.Matches));
  2172. Assert.Null(a.Literals);
  2173. var b = a.Parameters;
  2174. Assert.Collection(
  2175. b.Matches,
  2176. e => Assert.Same(endpoint1, e),
  2177. e => Assert.Same(endpoint2, e));
  2178. Assert.Null(b.Literals);
  2179. Assert.Null(b.Parameters);
  2180. Assert.NotNull(b.CatchAll);
  2181. var catchAll = b.CatchAll;
  2182. Assert.Same(endpoint1, Assert.Single(catchAll.Matches));
  2183. Assert.Null(catchAll.Literals);
  2184. Assert.Same(catchAll, catchAll.Parameters);
  2185. Assert.Same(catchAll, catchAll.CatchAll);
  2186. }
  2187. // Regression test for https://github.com/dotnet/aspnetcore/issues/18677
  2188. [Fact]
  2189. public void BuildDfaTree_MultipleEndpoint_CatchAllWithHigherPrecedenceThanParameter_Order1()
  2190. {
  2191. // Arrange
  2192. var builder = CreateDfaMatcherBuilder();
  2193. var endpoint1 = CreateEndpoint("{a}/{b}", order: 0);
  2194. builder.AddEndpoint(endpoint1);
  2195. var endpoint2 = CreateEndpoint("a/{*b}", order: 1);
  2196. builder.AddEndpoint(endpoint2);
  2197. // Act
  2198. var root = builder.BuildDfaTree();
  2199. // Assert
  2200. Assert.Null(root.Matches);
  2201. var next = Assert.Single(root.Literals);
  2202. Assert.Equal("a", next.Key);
  2203. var a1 = next.Value;
  2204. Assert.Same(endpoint2, Assert.Single(a1.Matches));
  2205. Assert.Null(a1.Literals);
  2206. var b1 = a1.Parameters;
  2207. Assert.Collection(
  2208. b1.Matches,
  2209. e => Assert.Same(endpoint1, e),
  2210. e => Assert.Same(endpoint2, e));
  2211. Assert.Null(b1.Literals);
  2212. Assert.Null(b1.Parameters);
  2213. Assert.NotNull(b1.CatchAll);
  2214. var catchAll1 = b1.CatchAll;
  2215. Assert.Same(endpoint2, Assert.Single(catchAll1.Matches));
  2216. Assert.Null(catchAll1.Literals);
  2217. Assert.Same(catchAll1, catchAll1.Parameters);
  2218. Assert.Same(catchAll1, catchAll1.CatchAll);
  2219. var a2 = root.Parameters;
  2220. Assert.Null(a2.Matches);
  2221. Assert.Null(a2.Literals);
  2222. var b2 = a2.Parameters;
  2223. Assert.Collection(
  2224. b2.Matches,
  2225. e => Assert.Same(endpoint1, e));
  2226. Assert.Null(b2.Literals);
  2227. Assert.Null(b2.Parameters);
  2228. Assert.Null(b2.CatchAll);
  2229. }
  2230. // Regression test for https://github.com/dotnet/aspnetcore/issues/18677
  2231. [Fact]
  2232. public void BuildDfaTree_MultipleEndpoint_CatchAllWithHigherPrecedenceThanParameter_Order2()
  2233. {
  2234. // Arrange
  2235. var builder = CreateDfaMatcherBuilder();
  2236. var endpoint1 = CreateEndpoint("a/{*b}", order: 0);
  2237. builder.AddEndpoint(endpoint1);
  2238. var endpoint2 = CreateEndpoint("{a}/{b}", order: 1);
  2239. builder.AddEndpoint(endpoint2);
  2240. // Act
  2241. var root = builder.BuildDfaTree();
  2242. // Assert
  2243. Assert.Null(root.Matches);
  2244. var next = Assert.Single(root.Literals);
  2245. Assert.Equal("a", next.Key);
  2246. var a1 = next.Value;
  2247. Assert.Same(endpoint1, Assert.Single(a1.Matches));
  2248. Assert.Null(a1.Literals);
  2249. var b1 = a1.Parameters;
  2250. Assert.Collection(
  2251. b1.Matches,
  2252. e => Assert.Same(endpoint1, e),
  2253. e => Assert.Same(endpoint2, e));
  2254. Assert.Null(b1.Literals);
  2255. Assert.Null(b1.Parameters);
  2256. Assert.NotNull(b1.CatchAll);
  2257. var catchAll1 = b1.CatchAll;
  2258. Assert.Same(endpoint1, Assert.Single(catchAll1.Matches));
  2259. Assert.Null(catchAll1.Literals);
  2260. Assert.Same(catchAll1, catchAll1.Parameters);
  2261. Assert.Same(catchAll1, catchAll1.CatchAll);
  2262. var a2 = root.Parameters;
  2263. Assert.Null(a2.Matches);
  2264. Assert.Null(a2.Literals);
  2265. var b2 = a2.Parameters;
  2266. Assert.Collection(
  2267. b2.Matches,
  2268. e => Assert.Same(endpoint2, e));
  2269. Assert.Null(b2.Literals);
  2270. Assert.Null(b2.Parameters);
  2271. Assert.Null(b2.CatchAll);
  2272. }
  2273. private void BuildDfaTree_MultipleEndpoint_CatchAllWithHigherPrecedenceThanParameter_Order2_Legacy30Behavior_Core(DfaMatcherBuilder builder)
  2274. {
  2275. // Arrange
  2276. var endpoint1 = CreateEndpoint("a/{*b}", order: 0);
  2277. builder.AddEndpoint(endpoint1);
  2278. var endpoint2 = CreateEndpoint("{a}/{b}", order: 1);
  2279. builder.AddEndpoint(endpoint2);
  2280. // Act
  2281. var root = builder.BuildDfaTree();
  2282. // Assert
  2283. Assert.Null(root.Matches);
  2284. var next = Assert.Single(root.Literals);
  2285. Assert.Equal("a", next.Key);
  2286. var a1 = next.Value;
  2287. Assert.Same(endpoint1, Assert.Single(a1.Matches));
  2288. Assert.Null(a1.Literals);
  2289. var b1 = a1.Parameters;
  2290. Assert.Same(endpoint2, Assert.Single(b1.Matches));
  2291. Assert.Null(b1.Literals);
  2292. Assert.Null(b1.Parameters);
  2293. Assert.Null(b1.CatchAll);
  2294. var a2 = root.Parameters;
  2295. Assert.Null(a2.Matches);
  2296. Assert.Null(a2.Literals);
  2297. var b2 = a2.Parameters;
  2298. Assert.Collection(
  2299. b2.Matches,
  2300. e => Assert.Same(endpoint2, e));
  2301. Assert.Null(b2.Literals);
  2302. Assert.Null(b2.Parameters);
  2303. Assert.Null(b2.CatchAll);
  2304. }
  2305. [Fact]
  2306. public void BuildDfaTree_WithPolicies()
  2307. {
  2308. // Arrange
  2309. var builder = CreateDfaMatcherBuilder(new TestMetadata1MatcherPolicy(), new TestMetadata2MatcherPolicy());
  2310. var endpoint1 = CreateEndpoint("/a", metadata: new object[] { new TestMetadata1(0), new TestMetadata2(true), });
  2311. builder.AddEndpoint(endpoint1);
  2312. // Act
  2313. var root = builder.BuildDfaTree();
  2314. // Assert
  2315. Assert.Null(root.Matches);
  2316. Assert.Null(root.Parameters);
  2317. var next = Assert.Single(root.Literals);
  2318. Assert.Equal("a", next.Key);
  2319. var a = next.Value;
  2320. Assert.Empty(a.Matches);
  2321. Assert.IsType<TestMetadata1MatcherPolicy>(a.NodeBuilder);
  2322. Assert.Collection(
  2323. a.PolicyEdges.OrderBy(e => e.Key),
  2324. e => Assert.Equal(0, e.Key));
  2325. var test1_0 = a.PolicyEdges[0];
  2326. Assert.Empty(a.Matches);
  2327. Assert.IsType<TestMetadata2MatcherPolicy>(test1_0.NodeBuilder);
  2328. Assert.Collection(
  2329. test1_0.PolicyEdges.OrderBy(e => e.Key),
  2330. e => Assert.Equal(true, e.Key));
  2331. var test2_true = test1_0.PolicyEdges[true];
  2332. Assert.Same(endpoint1, Assert.Single(test2_true.Matches));
  2333. Assert.Null(test2_true.NodeBuilder);
  2334. Assert.Null(test2_true.PolicyEdges);
  2335. }
  2336. [Fact]
  2337. public void BuildDfaTree_WithPolicies_AndBranches()
  2338. {
  2339. // Arrange
  2340. var builder = CreateDfaMatcherBuilder(new TestMetadata1MatcherPolicy(), new TestMetadata2MatcherPolicy());
  2341. var endpoint1 = CreateEndpoint("/a", metadata: new object[] { new TestMetadata1(0), new TestMetadata2(true), });
  2342. builder.AddEndpoint(endpoint1);
  2343. var endpoint2 = CreateEndpoint("/a", metadata: new object[] { new TestMetadata1(1), new TestMetadata2(true), });
  2344. builder.AddEndpoint(endpoint2);
  2345. var endpoint3 = CreateEndpoint("/a", metadata: new object[] { new TestMetadata1(1), new TestMetadata2(false), });
  2346. builder.AddEndpoint(endpoint3);
  2347. // Act
  2348. var root = builder.BuildDfaTree();
  2349. // Assert
  2350. Assert.Null(root.Matches);
  2351. Assert.Null(root.Parameters);
  2352. var next = Assert.Single(root.Literals);
  2353. Assert.Equal("a", next.Key);
  2354. var a = next.Value;
  2355. Assert.Empty(a.Matches);
  2356. Assert.IsType<TestMetadata1MatcherPolicy>(a.NodeBuilder);
  2357. Assert.Collection(
  2358. a.PolicyEdges.OrderBy(e => e.Key),
  2359. e => Assert.Equal(0, e.Key),
  2360. e => Assert.Equal(1, e.Key));
  2361. var test1_0 = a.PolicyEdges[0];
  2362. Assert.Empty(test1_0.Matches);
  2363. Assert.IsType<TestMetadata2MatcherPolicy>(test1_0.NodeBuilder);
  2364. Assert.Collection(
  2365. test1_0.PolicyEdges.OrderBy(e => e.Key),
  2366. e => Assert.Equal(true, e.Key));
  2367. var test2_true = test1_0.PolicyEdges[true];
  2368. Assert.Same(endpoint1, Assert.Single(test2_true.Matches));
  2369. Assert.Null(test2_true.NodeBuilder);
  2370. Assert.Null(test2_true.PolicyEdges);
  2371. var test1_1 = a.PolicyEdges[1];
  2372. Assert.Empty(test1_1.Matches);
  2373. Assert.IsType<TestMetadata2MatcherPolicy>(test1_1.NodeBuilder);
  2374. Assert.Collection(
  2375. test1_1.PolicyEdges.OrderBy(e => e.Key),
  2376. e => Assert.Equal(false, e.Key),
  2377. e => Assert.Equal(true, e.Key));
  2378. test2_true = test1_1.PolicyEdges[true];
  2379. Assert.Same(endpoint2, Assert.Single(test2_true.Matches));
  2380. Assert.Null(test2_true.NodeBuilder);
  2381. Assert.Null(test2_true.PolicyEdges);
  2382. var test2_false = test1_1.PolicyEdges[false];
  2383. Assert.Same(endpoint3, Assert.Single(test2_false.Matches));
  2384. Assert.Null(test2_false.NodeBuilder);
  2385. Assert.Null(test2_false.PolicyEdges);
  2386. }
  2387. [Fact]
  2388. public void BuildDfaTree_WithPolicies_AndBranches_FirstPolicySkipped()
  2389. {
  2390. // Arrange
  2391. var builder = CreateDfaMatcherBuilder(new TestMetadata1MatcherPolicy(), new TestMetadata2MatcherPolicy());
  2392. var endpoint1 = CreateEndpoint("/a", metadata: new object[] { new TestMetadata2(true), });
  2393. builder.AddEndpoint(endpoint1);
  2394. var endpoint2 = CreateEndpoint("/a", metadata: new object[] { new TestMetadata2(true), });
  2395. builder.AddEndpoint(endpoint2);
  2396. var endpoint3 = CreateEndpoint("/a", metadata: new object[] { new TestMetadata2(false), });
  2397. builder.AddEndpoint(endpoint3);
  2398. // Act
  2399. var root = builder.BuildDfaTree();
  2400. // Assert
  2401. Assert.Null(root.Matches);
  2402. Assert.Null(root.Parameters);
  2403. var next = Assert.Single(root.Literals);
  2404. Assert.Equal("a", next.Key);
  2405. var a = next.Value;
  2406. Assert.Empty(a.Matches);
  2407. Assert.IsType<TestMetadata2MatcherPolicy>(a.NodeBuilder);
  2408. Assert.Collection(
  2409. a.PolicyEdges.OrderBy(e => e.Key),
  2410. e => Assert.Equal(false, e.Key),
  2411. e => Assert.Equal(true, e.Key));
  2412. var test2_true = a.PolicyEdges[true];
  2413. Assert.Equal(new[] { endpoint1, endpoint2, }, test2_true.Matches);
  2414. Assert.Null(test2_true.NodeBuilder);
  2415. Assert.Null(test2_true.PolicyEdges);
  2416. var test2_false = a.PolicyEdges[false];
  2417. Assert.Equal(new[] { endpoint3, }, test2_false.Matches);
  2418. Assert.Null(test2_false.NodeBuilder);
  2419. Assert.Null(test2_false.PolicyEdges);
  2420. }
  2421. [Fact]
  2422. public void BuildDfaTree_WithPolicies_AndBranches_SecondSkipped()
  2423. {
  2424. // Arrange
  2425. var builder = CreateDfaMatcherBuilder(new TestMetadata1MatcherPolicy(), new TestMetadata2MatcherPolicy());
  2426. var endpoint1 = CreateEndpoint("/a", metadata: new object[] { new TestMetadata1(0), });
  2427. builder.AddEndpoint(endpoint1);
  2428. var endpoint2 = CreateEndpoint("/a", metadata: new object[] { new TestMetadata1(1), });
  2429. builder.AddEndpoint(endpoint2);
  2430. var endpoint3 = CreateEndpoint("/a", metadata: new object[] { new TestMetadata1(1), });
  2431. builder.AddEndpoint(endpoint3);
  2432. // Act
  2433. var root = builder.BuildDfaTree();
  2434. // Assert
  2435. Assert.Null(root.Matches);
  2436. Assert.Null(root.Parameters);
  2437. var next = Assert.Single(root.Literals);
  2438. Assert.Equal("a", next.Key);
  2439. var a = next.Value;
  2440. Assert.Empty(a.Matches);
  2441. Assert.IsType<TestMetadata1MatcherPolicy>(a.NodeBuilder);
  2442. Assert.Collection(
  2443. a.PolicyEdges.OrderBy(e => e.Key),
  2444. e => Assert.Equal(0, e.Key),
  2445. e => Assert.Equal(1, e.Key));
  2446. var test1_0 = a.PolicyEdges[0];
  2447. Assert.Equal(new[] { endpoint1, }, test1_0.Matches);
  2448. Assert.Null(test1_0.NodeBuilder);
  2449. Assert.Null(test1_0.PolicyEdges);
  2450. var test1_1 = a.PolicyEdges[1];
  2451. Assert.Equal(new[] { endpoint2, endpoint3, }, test1_1.Matches);
  2452. Assert.Null(test1_1.NodeBuilder);
  2453. Assert.Null(test1_1.PolicyEdges);
  2454. }
  2455. [Fact]
  2456. public void BuildDfaTree_WithPolicies_AndBranches_NonRouteEndpoint()
  2457. {
  2458. // Arrange
  2459. var builder = CreateDfaMatcherBuilder(new TestNonRoutePatternMatcherPolicy());
  2460. var endpoint1 = CreateEndpoint("/a", metadata: new object[] { new TestMetadata1(0), });
  2461. builder.AddEndpoint(endpoint1);
  2462. var endpoint2 = CreateEndpoint("/a", metadata: new object[] { new TestMetadata1(1), });
  2463. builder.AddEndpoint(endpoint2);
  2464. var endpoint3 = CreateEndpoint("/a", metadata: new object[] { new TestMetadata1(1), });
  2465. builder.AddEndpoint(endpoint3);
  2466. // Act
  2467. var root = builder.BuildDfaTree();
  2468. // Assert
  2469. Assert.Null(root.Matches);
  2470. Assert.Null(root.Parameters);
  2471. var next = Assert.Single(root.Literals);
  2472. Assert.Equal("a", next.Key);
  2473. var a = next.Value;
  2474. Assert.Empty(a.Matches);
  2475. Assert.IsType<TestNonRoutePatternMatcherPolicy>(a.NodeBuilder);
  2476. Assert.Collection(
  2477. a.PolicyEdges.OrderBy(e => e.Key),
  2478. e => Assert.Equal(0, e.Key),
  2479. e => Assert.Equal(1, e.Key),
  2480. e => Assert.Equal(int.MaxValue, e.Key));
  2481. var test1_0 = a.PolicyEdges[0];
  2482. Assert.Equal(new[] { endpoint1, }, test1_0.Matches);
  2483. Assert.Null(test1_0.NodeBuilder);
  2484. Assert.Null(test1_0.PolicyEdges);
  2485. var test1_1 = a.PolicyEdges[1];
  2486. Assert.Equal(new[] { endpoint2, endpoint3, }, test1_1.Matches);
  2487. Assert.Null(test1_1.NodeBuilder);
  2488. Assert.Null(test1_1.PolicyEdges);
  2489. var nonRouteEndpoint = a.PolicyEdges[int.MaxValue];
  2490. Assert.Equal("MaxValueEndpoint", Assert.Single(nonRouteEndpoint.Matches).DisplayName);
  2491. }
  2492. [Fact]
  2493. public void BuildDfaTree_WithPolicies_AndBranches_BothPoliciesSkipped()
  2494. {
  2495. // Arrange
  2496. var builder = CreateDfaMatcherBuilder(new TestMetadata1MatcherPolicy(), new TestMetadata2MatcherPolicy());
  2497. var endpoint1 = CreateEndpoint("/a", metadata: new object[] { });
  2498. builder.AddEndpoint(endpoint1);
  2499. var endpoint2 = CreateEndpoint("/a", metadata: new object[] { });
  2500. builder.AddEndpoint(endpoint2);
  2501. var endpoint3 = CreateEndpoint("/a", metadata: new object[] { });
  2502. builder.AddEndpoint(endpoint3);
  2503. // Act
  2504. var root = builder.BuildDfaTree();
  2505. // Assert
  2506. Assert.Null(root.Matches);
  2507. Assert.Null(root.Parameters);
  2508. var next = Assert.Single(root.Literals);
  2509. Assert.Equal("a", next.Key);
  2510. var a = next.Value;
  2511. Assert.Equal(new[] { endpoint1, endpoint2, endpoint3, }, a.Matches);
  2512. Assert.Null(a.NodeBuilder);
  2513. Assert.Null(a.PolicyEdges);
  2514. }
  2515. // Verifies that we sort the endpoints before calling into policies.
  2516. //
  2517. // The builder uses a different sort order when building the tree, vs when building the policy nodes. Policy
  2518. // nodes should see an "absolute" order.
  2519. [Fact]
  2520. public void BuildDfaTree_WithPolicies_SortedAccordingToScore()
  2521. {
  2522. // Arrange
  2523. //
  2524. // These cases where chosen where the absolute order incontrolled explicitly by setting .Order, but
  2525. // the precedence of segments is different, so these will be sorted into different orders when building
  2526. // the tree.
  2527. var policies = new MatcherPolicy[]
  2528. {
  2529. new TestMetadata1MatcherPolicy(),
  2530. new TestMetadata2MatcherPolicy(),
  2531. };
  2532. var comparer = new EndpointComparer(policies.OrderBy(p => p.Order).OfType<IEndpointComparerPolicy>().ToArray());
  2533. var builder = CreateDfaMatcherBuilder(policies);
  2534. ((TestMetadata1MatcherPolicy)policies[0]).OnGetEdges = VerifyOrder;
  2535. ((TestMetadata2MatcherPolicy)policies[1]).OnGetEdges = VerifyOrder;
  2536. var endpoint1 = CreateEndpoint("/a/{**b}", order: -1, metadata: new object[] { new TestMetadata1(0), new TestMetadata2(true), });
  2537. builder.AddEndpoint(endpoint1);
  2538. var endpoint2 = CreateEndpoint("/a/{b}/{**c}", order: 0, metadata: new object[] { new TestMetadata1(1), new TestMetadata2(true), });
  2539. builder.AddEndpoint(endpoint2);
  2540. var endpoint3 = CreateEndpoint("/a/b/{c}", order: 1, metadata: new object[] { new TestMetadata1(1), new TestMetadata2(false), });
  2541. builder.AddEndpoint(endpoint3);
  2542. // Act & Assert
  2543. _ = builder.BuildDfaTree();
  2544. void VerifyOrder(IReadOnlyList<Endpoint> endpoints)
  2545. {
  2546. // The list should already be in sorted order, every time build is called.
  2547. Assert.Equal(endpoints, endpoints.OrderBy(e => e, comparer));
  2548. }
  2549. }
  2550. [Fact]
  2551. public void BuildDfaTree_RequiredValues()
  2552. {
  2553. // Arrange
  2554. var builder = CreateDfaMatcherBuilder();
  2555. var endpoint = CreateEndpoint("{controller}/{action}", requiredValues: new { controller = "Home", action = "Index" });
  2556. builder.AddEndpoint(endpoint);
  2557. // Act
  2558. var root = builder.BuildDfaTree();
  2559. // Assert
  2560. Assert.Null(root.Matches);
  2561. Assert.Null(root.Parameters);
  2562. var next = Assert.Single(root.Literals);
  2563. Assert.Equal("Home", next.Key);
  2564. var home = next.Value;
  2565. Assert.Null(home.Matches);
  2566. Assert.Null(home.Parameters);
  2567. next = Assert.Single(home.Literals);
  2568. Assert.Equal("Index", next.Key);
  2569. var index = next.Value;
  2570. Assert.Same(endpoint, Assert.Single(index.Matches));
  2571. Assert.Null(index.Literals);
  2572. }
  2573. [Fact]
  2574. public void BuildDfaTree_RequiredValues_AndMatchingDefaults()
  2575. {
  2576. // Arrange
  2577. var builder = CreateDfaMatcherBuilder();
  2578. var endpoint = CreateEndpoint(
  2579. "{controller}/{action}",
  2580. defaults: new { controller = "Home", action = "Index" },
  2581. requiredValues: new { controller = "Home", action = "Index" });
  2582. builder.AddEndpoint(endpoint);
  2583. // Act
  2584. var root = builder.BuildDfaTree();
  2585. // Assert
  2586. Assert.Same(endpoint, Assert.Single(root.Matches));
  2587. Assert.Null(root.Parameters);
  2588. var next = Assert.Single(root.Literals);
  2589. Assert.Equal("Home", next.Key);
  2590. var home = next.Value;
  2591. Assert.Same(endpoint, Assert.Single(home.Matches));
  2592. Assert.Null(home.Parameters);
  2593. next = Assert.Single(home.Literals);
  2594. Assert.Equal("Index", next.Key);
  2595. var index = next.Value;
  2596. Assert.Same(endpoint, Assert.Single(index.Matches));
  2597. Assert.Null(index.Literals);
  2598. }
  2599. [Fact]
  2600. public void BuildDfaTree_RequiredValues_AndDifferentDefaults()
  2601. {
  2602. // Arrange
  2603. var builder = CreateDfaMatcherBuilder();
  2604. var endpoint = CreateSubsitutedEndpoint(
  2605. "{controller}/{action}",
  2606. defaults: new { controller = "Home", action = "Index" },
  2607. requiredValues: new { controller = "Login", action = "Index" });
  2608. builder.AddEndpoint(endpoint);
  2609. // Act
  2610. var root = builder.BuildDfaTree();
  2611. // Assert
  2612. Assert.Null(root.Matches);
  2613. Assert.Null(root.Parameters);
  2614. var next = Assert.Single(root.Literals);
  2615. Assert.Equal("Login", next.Key);
  2616. var login = next.Value;
  2617. Assert.Same(endpoint, Assert.Single(login.Matches));
  2618. Assert.Null(login.Parameters);
  2619. next = Assert.Single(login.Literals);
  2620. Assert.Equal("Index", next.Key);
  2621. var index = next.Value;
  2622. Assert.Same(endpoint, Assert.Single(index.Matches));
  2623. Assert.Null(index.Literals);
  2624. }
  2625. [Fact]
  2626. public void BuildDfaTree_RequiredValues_Multiple()
  2627. {
  2628. // Arrange
  2629. var builder = CreateDfaMatcherBuilder();
  2630. var endpoint1 = CreateSubsitutedEndpoint(
  2631. "{controller}/{action}/{id?}",
  2632. defaults: new { controller = "Home", action = "Index" },
  2633. requiredValues: new { controller = "Home", action = "Index" });
  2634. builder.AddEndpoint(endpoint1);
  2635. var endpoint2 = CreateSubsitutedEndpoint(
  2636. "{controller}/{action}/{id?}",
  2637. defaults: new { controller = "Home", action = "Index" },
  2638. requiredValues: new { controller = "Login", action = "Index" });
  2639. builder.AddEndpoint(endpoint2);
  2640. var endpoint3 = CreateSubsitutedEndpoint(
  2641. "{controller}/{action}/{id?}",
  2642. defaults: new { controller = "Home", action = "Index" },
  2643. requiredValues: new { controller = "Login", action = "ChangePassword" });
  2644. builder.AddEndpoint(endpoint3);
  2645. // Act
  2646. var root = builder.BuildDfaTree();
  2647. // Assert
  2648. Assert.Same(endpoint1, Assert.Single(root.Matches));
  2649. Assert.Null(root.Parameters);
  2650. Assert.Equal(2, root.Literals.Count);
  2651. var home = root.Literals["Home"];
  2652. Assert.Same(endpoint1, Assert.Single(home.Matches));
  2653. Assert.Null(home.Parameters);
  2654. var next = Assert.Single(home.Literals);
  2655. Assert.Equal("Index", next.Key);
  2656. var homeIndex = next.Value;
  2657. Assert.Same(endpoint1, Assert.Single(homeIndex.Matches));
  2658. Assert.Null(homeIndex.Literals);
  2659. Assert.NotNull(homeIndex.Parameters);
  2660. Assert.Same(endpoint1, Assert.Single(homeIndex.Parameters.Matches));
  2661. var login = root.Literals["Login"];
  2662. Assert.Same(endpoint2, Assert.Single(login.Matches));
  2663. Assert.Null(login.Parameters);
  2664. Assert.Equal(2, login.Literals.Count);
  2665. var loginIndex = login.Literals["Index"];
  2666. Assert.Same(endpoint2, Assert.Single(loginIndex.Matches));
  2667. Assert.Null(loginIndex.Literals);
  2668. Assert.NotNull(loginIndex.Parameters);
  2669. Assert.Same(endpoint2, Assert.Single(loginIndex.Parameters.Matches));
  2670. var loginChangePassword = login.Literals["ChangePassword"];
  2671. Assert.Same(endpoint3, Assert.Single(loginChangePassword.Matches));
  2672. Assert.Null(loginChangePassword.Literals);
  2673. Assert.NotNull(loginChangePassword.Parameters);
  2674. Assert.Same(endpoint3, Assert.Single(loginChangePassword.Parameters.Matches));
  2675. }
  2676. [Fact]
  2677. public void BuildDfaTree_RequiredValues_AndParameterTransformer()
  2678. {
  2679. // Arrange
  2680. var builder = CreateDfaMatcherBuilder();
  2681. var endpoint = CreateEndpoint(
  2682. "{controller:slugify}/{action:slugify}",
  2683. defaults: new { controller = "RecentProducts", action = "ViewAll" },
  2684. requiredValues: new { controller = "RecentProducts", action = "ViewAll" });
  2685. builder.AddEndpoint(endpoint);
  2686. // Act
  2687. var root = builder.BuildDfaTree();
  2688. // Assert
  2689. Assert.Same(endpoint, Assert.Single(root.Matches));
  2690. Assert.Null(root.Parameters);
  2691. var next = Assert.Single(root.Literals);
  2692. Assert.Equal("recent-products", next.Key);
  2693. var home = next.Value;
  2694. Assert.Same(endpoint, Assert.Single(home.Matches));
  2695. Assert.Null(home.Parameters);
  2696. next = Assert.Single(home.Literals);
  2697. Assert.Equal("view-all", next.Key);
  2698. var index = next.Value;
  2699. Assert.Same(endpoint, Assert.Single(index.Matches));
  2700. Assert.Null(index.Literals);
  2701. }
  2702. [Fact]
  2703. public void BuildDfaTree_RequiredValues_AndDefaults_AndParameterTransformer()
  2704. {
  2705. // Arrange
  2706. var builder = CreateDfaMatcherBuilder();
  2707. var endpoint = CreateEndpoint(
  2708. "ConventionalTransformerRoute/{controller:slugify}/{action=Index}/{param:slugify?}",
  2709. requiredValues: new { controller = "ConventionalTransformer", action = "Index", area = (string)null, page = (string)null });
  2710. builder.AddEndpoint(endpoint);
  2711. // Act
  2712. var root = builder.BuildDfaTree();
  2713. // Assert
  2714. Assert.Null(root.Matches);
  2715. Assert.Null(root.Parameters);
  2716. var next = Assert.Single(root.Literals);
  2717. Assert.Equal("ConventionalTransformerRoute", next.Key);
  2718. var conventionalTransformerRoute = next.Value;
  2719. Assert.Null(conventionalTransformerRoute.Matches);
  2720. Assert.Null(conventionalTransformerRoute.Parameters);
  2721. next = Assert.Single(conventionalTransformerRoute.Literals);
  2722. Assert.Equal("conventional-transformer", next.Key);
  2723. var conventionalTransformer = next.Value;
  2724. Assert.Same(endpoint, Assert.Single(conventionalTransformer.Matches));
  2725. next = Assert.Single(conventionalTransformer.Literals);
  2726. Assert.Equal("Index", next.Key);
  2727. var index = next.Value;
  2728. Assert.Same(endpoint, Assert.Single(index.Matches));
  2729. Assert.NotNull(index.Parameters);
  2730. Assert.Same(endpoint, Assert.Single(index.Parameters.Matches));
  2731. }
  2732. [Fact]
  2733. public void CreateCandidate_JustLiterals()
  2734. {
  2735. // Arrange
  2736. var endpoint = CreateEndpoint("/a/b/c");
  2737. var builder = CreateDfaMatcherBuilder();
  2738. // Act
  2739. var candidate = builder.CreateCandidate(endpoint, score: 0);
  2740. // Assert
  2741. Assert.Equal(Candidate.CandidateFlags.None, candidate.Flags);
  2742. Assert.Empty(candidate.Slots);
  2743. Assert.Empty(candidate.Captures);
  2744. Assert.Equal(default, candidate.CatchAll);
  2745. Assert.Empty(candidate.ComplexSegments);
  2746. Assert.Empty(candidate.Constraints);
  2747. }
  2748. [Fact]
  2749. public void CreateCandidate_Parameters()
  2750. {
  2751. // Arrange
  2752. var endpoint = CreateEndpoint("/{a}/{b}/{c}");
  2753. var builder = CreateDfaMatcherBuilder();
  2754. // Act
  2755. var candidate = builder.CreateCandidate(endpoint, score: 0);
  2756. // Assert
  2757. Assert.Equal(Candidate.CandidateFlags.HasCaptures, candidate.Flags);
  2758. Assert.Equal(3, candidate.Slots.Length);
  2759. Assert.Collection(
  2760. candidate.Captures,
  2761. c => Assert.Equal(("a", 0, 0), c),
  2762. c => Assert.Equal(("b", 1, 1), c),
  2763. c => Assert.Equal(("c", 2, 2), c));
  2764. Assert.Equal(default, candidate.CatchAll);
  2765. Assert.Empty(candidate.ComplexSegments);
  2766. Assert.Empty(candidate.Constraints);
  2767. }
  2768. [Fact]
  2769. public void CreateCandidate_Parameters_WithDefaults()
  2770. {
  2771. // Arrange
  2772. var endpoint = CreateEndpoint("/{a=aa}/{b=bb}/{c=cc}");
  2773. var builder = CreateDfaMatcherBuilder();
  2774. // Act
  2775. var candidate = builder.CreateCandidate(endpoint, score: 0);
  2776. // Assert
  2777. Assert.Equal(
  2778. Candidate.CandidateFlags.HasDefaults | Candidate.CandidateFlags.HasCaptures,
  2779. candidate.Flags);
  2780. Assert.Collection(
  2781. candidate.Slots,
  2782. s => Assert.Equal(new KeyValuePair<string, object>("a", "aa"), s),
  2783. s => Assert.Equal(new KeyValuePair<string, object>("b", "bb"), s),
  2784. s => Assert.Equal(new KeyValuePair<string, object>("c", "cc"), s));
  2785. Assert.Collection(
  2786. candidate.Captures,
  2787. c => Assert.Equal(("a", 0, 0), c),
  2788. c => Assert.Equal(("b", 1, 1), c),
  2789. c => Assert.Equal(("c", 2, 2), c));
  2790. Assert.Equal(default, candidate.CatchAll);
  2791. Assert.Empty(candidate.ComplexSegments);
  2792. Assert.Empty(candidate.Constraints);
  2793. }
  2794. [Fact]
  2795. public void CreateCandidate_Parameters_CatchAll()
  2796. {
  2797. // Arrange
  2798. var endpoint = CreateEndpoint("/{a}/{b}/{*c=cc}");
  2799. var builder = CreateDfaMatcherBuilder();
  2800. // Act
  2801. var candidate = builder.CreateCandidate(endpoint, score: 0);
  2802. // Assert
  2803. Assert.Equal(
  2804. Candidate.CandidateFlags.HasDefaults |
  2805. Candidate.CandidateFlags.HasCaptures |
  2806. Candidate.CandidateFlags.HasCatchAll,
  2807. candidate.Flags);
  2808. Assert.Collection(
  2809. candidate.Slots,
  2810. s => Assert.Equal(new KeyValuePair<string, object>("c", "cc"), s),
  2811. s => Assert.Equal(new KeyValuePair<string, object>(null, null), s),
  2812. s => Assert.Equal(new KeyValuePair<string, object>(null, null), s));
  2813. Assert.Collection(
  2814. candidate.Captures,
  2815. c => Assert.Equal(("a", 0, 1), c),
  2816. c => Assert.Equal(("b", 1, 2), c));
  2817. Assert.Equal(("c", 2, 0), candidate.CatchAll);
  2818. Assert.Empty(candidate.ComplexSegments);
  2819. Assert.Empty(candidate.Constraints);
  2820. }
  2821. // Defaults are processed first, which affects the slot ordering.
  2822. [Fact]
  2823. public void CreateCandidate_Parameters_OutOfLineDefaults()
  2824. {
  2825. // Arrange
  2826. var endpoint = CreateEndpoint("/{a}/{b}/{c=cc}", new { a = "aa", d = "dd", });
  2827. var builder = CreateDfaMatcherBuilder();
  2828. // Act
  2829. var candidate = builder.CreateCandidate(endpoint, score: 0);
  2830. // Assert
  2831. Assert.Equal(
  2832. Candidate.CandidateFlags.HasDefaults | Candidate.CandidateFlags.HasCaptures,
  2833. candidate.Flags);
  2834. Assert.Collection(
  2835. candidate.Slots,
  2836. s => Assert.Equal(new KeyValuePair<string, object>("a", "aa"), s),
  2837. s => Assert.Equal(new KeyValuePair<string, object>("d", "dd"), s),
  2838. s => Assert.Equal(new KeyValuePair<string, object>("c", "cc"), s),
  2839. s => Assert.Equal(new KeyValuePair<string, object>(null, null), s));
  2840. Assert.Collection(
  2841. candidate.Captures,
  2842. c => Assert.Equal(("a", 0, 0), c),
  2843. c => Assert.Equal(("b", 1, 3), c),
  2844. c => Assert.Equal(("c", 2, 2), c));
  2845. Assert.Equal(default, candidate.CatchAll);
  2846. Assert.Empty(candidate.ComplexSegments);
  2847. Assert.Empty(candidate.Constraints);
  2848. }
  2849. [Fact]
  2850. public void CreateCandidate_Parameters_ComplexSegments()
  2851. {
  2852. // Arrange
  2853. var endpoint = CreateEndpoint("/{a}-{b=bb}/{c}");
  2854. var builder = CreateDfaMatcherBuilder();
  2855. // Act
  2856. var candidate = builder.CreateCandidate(endpoint, score: 0);
  2857. // Assert
  2858. Assert.Equal(
  2859. Candidate.CandidateFlags.HasDefaults |
  2860. Candidate.CandidateFlags.HasCaptures |
  2861. Candidate.CandidateFlags.HasComplexSegments,
  2862. candidate.Flags);
  2863. Assert.Collection(
  2864. candidate.Slots,
  2865. s => Assert.Equal(new KeyValuePair<string, object>("b", "bb"), s),
  2866. s => Assert.Equal(new KeyValuePair<string, object>(null, null), s));
  2867. Assert.Collection(
  2868. candidate.Captures,
  2869. c => Assert.Equal(("c", 1, 1), c));
  2870. Assert.Equal(default, candidate.CatchAll);
  2871. Assert.Collection(
  2872. candidate.ComplexSegments,
  2873. s => Assert.Equal(0, s.segmentIndex));
  2874. Assert.Empty(candidate.Constraints);
  2875. }
  2876. [Fact]
  2877. public void CreateCandidate_RouteConstraints()
  2878. {
  2879. // Arrange
  2880. var endpoint = CreateEndpoint("/a/b/c", constraints: new { a = new IntRouteConstraint(), });
  2881. var builder = CreateDfaMatcherBuilder();
  2882. // Act
  2883. var candidate = builder.CreateCandidate(endpoint, score: 0);
  2884. // Assert
  2885. Assert.Equal(Candidate.CandidateFlags.HasConstraints, candidate.Flags);
  2886. Assert.Empty(candidate.Slots);
  2887. Assert.Empty(candidate.Captures);
  2888. Assert.Equal(default, candidate.CatchAll);
  2889. Assert.Empty(candidate.ComplexSegments);
  2890. Assert.Single(candidate.Constraints);
  2891. }
  2892. [Fact]
  2893. public void CreateCandidate_CustomParameterPolicy()
  2894. {
  2895. // Arrange
  2896. var endpoint = CreateEndpoint("/a/b/c", constraints: new { a = new CustomParameterPolicy(), });
  2897. var builder = CreateDfaMatcherBuilder();
  2898. // Act
  2899. var candidate = builder.CreateCandidate(endpoint, score: 0);
  2900. // Assert
  2901. Assert.Equal(Candidate.CandidateFlags.None, candidate.Flags);
  2902. Assert.Empty(candidate.Slots);
  2903. Assert.Empty(candidate.Captures);
  2904. Assert.Equal(default, candidate.CatchAll);
  2905. Assert.Empty(candidate.ComplexSegments);
  2906. Assert.Empty(candidate.Constraints);
  2907. }
  2908. private class CustomParameterPolicy : IParameterPolicy
  2909. {
  2910. }
  2911. [Fact]
  2912. public void CreateCandidates_CreatesScoresCorrectly()
  2913. {
  2914. // Arrange
  2915. var endpoints = new[]
  2916. {
  2917. CreateEndpoint("/a/b/c", constraints: new { a = new IntRouteConstraint(), }, metadata: new object[] { new TestMetadata1(), new TestMetadata2(), }),
  2918. CreateEndpoint("/a/b/c", constraints: new { a = new AlphaRouteConstraint(), }, metadata: new object[] { new TestMetadata1(), new TestMetadata2(), }),
  2919. CreateEndpoint("/a/b/c", constraints: new { a = new IntRouteConstraint(), }, metadata: new object[] { new TestMetadata1(), }),
  2920. CreateEndpoint("/a/b/c", constraints: new { a = new IntRouteConstraint(), }, metadata: new object[] { new TestMetadata2(), }),
  2921. CreateEndpoint("/a/b/c", constraints: new { }, metadata: new object[] { }),
  2922. CreateEndpoint("/a/b/c", constraints: new { }, metadata: new object[] { }),
  2923. };
  2924. var builder = CreateDfaMatcherBuilder(new TestMetadata1MatcherPolicy(), new TestMetadata2MatcherPolicy());
  2925. // Act
  2926. var candidates = builder.CreateCandidates(endpoints);
  2927. // Assert
  2928. Assert.Collection(
  2929. candidates,
  2930. c => Assert.Equal(0, c.Score),
  2931. c => Assert.Equal(0, c.Score),
  2932. c => Assert.Equal(1, c.Score),
  2933. c => Assert.Equal(2, c.Score),
  2934. c => Assert.Equal(3, c.Score),
  2935. c => Assert.Equal(3, c.Score));
  2936. }
  2937. private static DfaMatcherBuilder CreateDfaMatcherBuilder(params MatcherPolicy[] policies)
  2938. {
  2939. var policyFactory = CreateParameterPolicyFactory();
  2940. var dataSource = new CompositeEndpointDataSource(Array.Empty<EndpointDataSource>());
  2941. return new DfaMatcherBuilder(
  2942. NullLoggerFactory.Instance,
  2943. policyFactory,
  2944. Mock.Of<EndpointSelector>(),
  2945. policies);
  2946. }
  2947. private static RouteEndpoint CreateSubsitutedEndpoint(
  2948. string template,
  2949. object defaults = null,
  2950. object constraints = null,
  2951. object requiredValues = null,
  2952. params object[] metadata)
  2953. {
  2954. var routePattern = RoutePatternFactory.Parse(template, defaults, constraints);
  2955. var policyFactory = CreateParameterPolicyFactory();
  2956. var defaultRoutePatternTransformer = new DefaultRoutePatternTransformer(policyFactory);
  2957. routePattern = defaultRoutePatternTransformer.SubstituteRequiredValues(routePattern, requiredValues);
  2958. return EndpointFactory.CreateRouteEndpoint(routePattern, metadata: metadata);
  2959. }
  2960. public static RoutePattern CreateRoutePattern(RoutePattern routePattern, object requiredValues)
  2961. {
  2962. if (requiredValues != null)
  2963. {
  2964. var policyFactory = CreateParameterPolicyFactory();
  2965. var defaultRoutePatternTransformer = new DefaultRoutePatternTransformer(policyFactory);
  2966. routePattern = defaultRoutePatternTransformer.SubstituteRequiredValues(routePattern, requiredValues);
  2967. }
  2968. return routePattern;
  2969. }
  2970. private static DefaultParameterPolicyFactory CreateParameterPolicyFactory()
  2971. {
  2972. var serviceCollection = new ServiceCollection();
  2973. var policyFactory = new DefaultParameterPolicyFactory(
  2974. Options.Create(new RouteOptions
  2975. {
  2976. ConstraintMap =
  2977. {
  2978. ["slugify"] = typeof(SlugifyParameterTransformer),
  2979. ["upper-case"] = typeof(UpperCaseParameterTransform)
  2980. }
  2981. }),
  2982. serviceCollection.BuildServiceProvider());
  2983. return policyFactory;
  2984. }
  2985. private static RouteEndpoint CreateEndpoint(
  2986. string template,
  2987. object defaults = null,
  2988. object constraints = null,
  2989. object requiredValues = null,
  2990. int order = 0,
  2991. params object[] metadata)
  2992. {
  2993. return EndpointFactory.CreateRouteEndpoint(template, defaults, constraints, requiredValues, order: order, metadata: metadata);
  2994. }
  2995. private class TestMetadata1
  2996. {
  2997. public TestMetadata1()
  2998. {
  2999. }
  3000. public TestMetadata1(int state)
  3001. {
  3002. State = state;
  3003. }
  3004. public int State { get; set; }
  3005. }
  3006. private class TestMetadata1MatcherPolicy : MatcherPolicy, IEndpointComparerPolicy, INodeBuilderPolicy
  3007. {
  3008. public override int Order => 100;
  3009. public IComparer<Endpoint> Comparer => EndpointMetadataComparer<TestMetadata1>.Default;
  3010. public Action<IReadOnlyList<Endpoint>> OnGetEdges { get; set; }
  3011. public bool AppliesToEndpoints(IReadOnlyList<Endpoint> endpoints)
  3012. {
  3013. return endpoints.Any(e => e.Metadata.GetMetadata<TestMetadata1>() != null);
  3014. }
  3015. public PolicyJumpTable BuildJumpTable(int exitDestination, IReadOnlyList<PolicyJumpTableEdge> edges)
  3016. {
  3017. throw new NotImplementedException();
  3018. }
  3019. public IReadOnlyList<PolicyNodeEdge> GetEdges(IReadOnlyList<Endpoint> endpoints)
  3020. {
  3021. OnGetEdges?.Invoke(endpoints);
  3022. return endpoints
  3023. .GroupBy(e => e.Metadata.GetMetadata<TestMetadata1>().State)
  3024. .Select(g => new PolicyNodeEdge(g.Key, g.ToArray()))
  3025. .ToArray();
  3026. }
  3027. }
  3028. private class TestMetadata2
  3029. {
  3030. public TestMetadata2()
  3031. {
  3032. }
  3033. public TestMetadata2(bool state)
  3034. {
  3035. State = state;
  3036. }
  3037. public bool State { get; set; }
  3038. }
  3039. private class TestMetadata2MatcherPolicy : MatcherPolicy, IEndpointComparerPolicy, INodeBuilderPolicy
  3040. {
  3041. public override int Order => 101;
  3042. public IComparer<Endpoint> Comparer => EndpointMetadataComparer<TestMetadata2>.Default;
  3043. public Action<IReadOnlyList<Endpoint>> OnGetEdges { get; set; }
  3044. public bool AppliesToEndpoints(IReadOnlyList<Endpoint> endpoints)
  3045. {
  3046. return endpoints.Any(e => e.Metadata.GetMetadata<TestMetadata2>() != null);
  3047. }
  3048. public PolicyJumpTable BuildJumpTable(int exitDestination, IReadOnlyList<PolicyJumpTableEdge> edges)
  3049. {
  3050. throw new NotImplementedException();
  3051. }
  3052. public IReadOnlyList<PolicyNodeEdge> GetEdges(IReadOnlyList<Endpoint> endpoints)
  3053. {
  3054. OnGetEdges?.Invoke(endpoints);
  3055. return endpoints
  3056. .GroupBy(e => e.Metadata.GetMetadata<TestMetadata2>().State)
  3057. .Select(g => new PolicyNodeEdge(g.Key, g.ToArray()))
  3058. .ToArray();
  3059. }
  3060. }
  3061. private class TestNonRoutePatternMatcherPolicy : MatcherPolicy, IEndpointComparerPolicy, INodeBuilderPolicy
  3062. {
  3063. public override int Order => 100;
  3064. public IComparer<Endpoint> Comparer => EndpointMetadataComparer<TestMetadata1>.Default;
  3065. public bool AppliesToEndpoints(IReadOnlyList<Endpoint> endpoints)
  3066. {
  3067. return endpoints.Any(e => e.Metadata.GetMetadata<TestMetadata1>() != null);
  3068. }
  3069. public PolicyJumpTable BuildJumpTable(int exitDestination, IReadOnlyList<PolicyJumpTableEdge> edges)
  3070. {
  3071. throw new NotImplementedException();
  3072. }
  3073. public IReadOnlyList<PolicyNodeEdge> GetEdges(IReadOnlyList<Endpoint> endpoints)
  3074. {
  3075. var edges = endpoints
  3076. .GroupBy(e => e.Metadata.GetMetadata<TestMetadata1>().State)
  3077. .Select(g => new PolicyNodeEdge(g.Key, g.ToArray()))
  3078. .ToList();
  3079. var maxValueEndpoint = new Endpoint(TestConstants.EmptyRequestDelegate, EndpointMetadataCollection.Empty, "MaxValueEndpoint");
  3080. edges.Add(new PolicyNodeEdge(int.MaxValue, new[] { maxValueEndpoint }));
  3081. return edges;
  3082. }
  3083. }
  3084. }