Commit 1ef58837 authored by benjaminParisel's avatar benjaminParisel Committed by melhuet

fix(api): Update regex to export missing external api (#2633)

* ../API/bpm/task/{‌{aaa}‌}/context generated GET|bpm/task

Covers [UID-11](https://bonitasoft.atlassian.net/browse/UID-11)
parent cfb0c43f
......@@ -72,7 +72,7 @@ import org.springframework.web.bind.annotation.RestController;
public class PageResource extends AssetResource<Page> {
protected static final Logger logger = LoggerFactory.getLogger(PageResource.class);
public static final String BONITA_RESOURCE_REGEX = ".+/API/(?!extension)([^ /]*)/([^ /?]*)[/?]?[^/]*";// matches ..... /API/{}/{}?...
public static final String BONITA_RESOURCE_REGEX = ".+/API/(?!extension)([^ /]*)/([^ /?]*)[\\S+]*";// matches ..... /API/{}/{}?...
public static final String EXTENSION_RESOURCE_REGEX = ".+/API/(?=extension)([^ /]*)/([^ (?|{)]*).*";
private PageRepository pageRepository;
......
......@@ -759,12 +759,14 @@ public class PageResourceTest {
data.put("aa", anApiData("../API/extension/group/list"));
data.put("session", anApiData("../API/extension/user/group/unusedid"));
data.put("ab", anApiData("http://localhost:8080/bonita/portal/API/extension/vehicule/voiture/roue?p=0&c=10&f=case_id={{caseId}}"));
data.put("user", anApiData("../API/identity/user/{{aaa}}/context"));
data.put("task", anApiData("../API/bpm/task/1/context"));
page.setData(data);
when(authRulesCollector.visit(page)).thenReturn(authRules);
String properties = new String(pageResource.getResources(page.getId()).toString());
assertThat(properties).contains("[GET|extension/group/list, GET|extension/vehicule/voiture/roue, GET|extension/user/4, GET|extension/user/group/unusedid, GET|extension/CA31/SQLToObject, POST|bpm/process]");
assertThat(properties).contains("[GET|bpm/task, GET|identity/user, GET|extension/group/list, GET|extension/vehicule/voiture/roue, GET|extension/user/4, GET|extension/user/group/unusedid, GET|extension/CA31/SQLToObject, POST|bpm/process]");
}
@Test
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment