Skip to content

Commit 274b5f7

Browse files
author
Evgenii Grigorev
committed
Add sending of sciptPath parameter so it could be processed by s-pipes
1 parent f13af1d commit 274b5f7

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

src/main/java/og_spipes/rest/FunctionController.java

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@ public String executeFunction(@RequestBody ExecuteFunctionDTO dto) throws SPipes
7676

7777
String function = dto.getFunction();
7878
String[] split = dto.getParams().split("&");
79+
String scriptPath = dto.getScriptPath();
7980

8081
Map<String, String> params = new HashMap<>();
8182
if(!dto.getParams().equals("")){
@@ -84,7 +85,7 @@ public String executeFunction(@RequestBody ExecuteFunctionDTO dto) throws SPipes
8485
.collect(Collectors.toMap(e -> e[0], e -> e[1]));
8586
}
8687

87-
return executorService.serviceExecution(function, params);
88+
return executorService.serviceExecution(function, params, scriptPath);
8889
}
8990

9091
@PostMapping(path = "/module/execute")

src/main/java/og_spipes/service/SPipesExecutionService.java

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -53,11 +53,13 @@ public SPipesExecutionService(
5353

5454
public String serviceExecution (
5555
String functionId,
56-
Map<String, String> params
56+
Map<String, String> params,
57+
String scriptPath
5758
) throws SPipesEngineException {
5859
String serviceUrl = engineUrl + "/service";
5960
params.put("_pId", functionId);
6061
params.put("_pConfigURL", pConfigURL);
62+
params.put("_pScriptPath", scriptPath);
6163

6264
UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(serviceUrl);
6365
for (Map.Entry<String, String> pair : params.entrySet()) {
@@ -97,6 +99,7 @@ public String moduleExecution(String moduleScript, String moduleInput, String mo
9799
params.put("_pId", moduleId);
98100
createDebugConfig(configLocation, moduleScript);
99101
params.put("_pConfigURL", configLocation);
102+
params.put("_pScriptPath", moduleScript);
100103

101104
UriComponentsBuilder builder = UriComponentsBuilder.fromHttpUrl(serviceUrl);
102105
for (Map.Entry<String, String> pair : params.entrySet()) {

src/test/java/og_spipes/service/SPipesExecutionServiceTest.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public void serviceExecution() throws SPipesEngineException {
4848
"execute-greeding",
4949
new HashMap<String, String>() {{
5050
put("firstName","karel");
51-
}}
51+
}}, "serviceExecutionTest.ttl"
5252
);
5353

5454
Assertions.assertEquals("body", entity);

0 commit comments

Comments
 (0)