Skip to content

Commit 4b48ddb

Browse files
committed
Renamed env variable used to provide python installation from pythonLocation to pythonExecutable to avoid conflicts if pythonLocation points already to a path
1 parent 4c61667 commit 4b48ddb

File tree

4 files changed

+14
-18
lines changed

4 files changed

+14
-18
lines changed

README.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -27,13 +27,13 @@ Dependencies that are needed to build and are not being downloaded via gradle:
2727

2828
### Python Location
2929

30-
Currently, mapping-service requires Python to be installed in order to build and to run. At runtime, the Python location is configured in
31-
`application.properties`(see below). For building the mapping-service Python location is set to `/usr/bin/python3` by default. In case you want to build
30+
Currently, mapping-service requires Python to be installed in order to build and to run. At runtime, the Python executable is configured in
31+
`application.properties`(see below). For building the mapping-service Python executable is set to `/usr/bin/python3` by default. In case you want to build
3232
the mapping-service on a machine on which the Python installation is located elsewhere, e.g., under Windows, you can provide the Python location
3333
used at compile time externally, i.e.:
3434

3535
```
36-
.\gradlew -Pclean-release "-DpythonLocation=file:///C:/Python310/python.exe" build
36+
.\gradlew -Pclean-release "-DpythonExecutable=file:///C:/Python310/python.exe" build
3737
```
3838

3939
## How to start
@@ -42,7 +42,7 @@ Before you can start the mapping-service, you first have to create an `applicat
4242
and modify it according to your needs. Espacially the following properties (at the end of the file) are important:
4343
- `spring.datasource.url=jdbc:h2:file:/tmp/mapping-service/database`
4444
The path points to the location of the database in which your configured mappings are stored.
45-
- `mapping-service.pythonLocation=${pythonLocation:'file:///usr/bin/python3'}` \
45+
- `mapping-service.pythonLocation=${pythonExecutable:'file:///usr/bin/python3'}` \
4646
If no pythonLocation is provided externally (see above) the default `/usr/bin/python3` is used.
4747
- `mapping-service.pluginLocation=file:///tmp/mapping-service/plugins` \
4848
The local folder where available plugins are located.

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,7 +36,7 @@ repositories {
3636
ext {
3737
set('snippetsDir', file('build/generated-snippets'))
3838
applicationProperties = System.getProperty('applicationProperties', './src/test/resources/test-config/application-test.properties')
39-
pythonLocation = System.getProperty('pythonLocation', 'file:///c:/python310/python.exe')
39+
pythonLocation = System.getProperty('pythonExecutable', 'file:///c:/python310/python.exe')
4040
}
4141

4242
dependencies {

src/test/java/edu/kit/datamanager/mappingservice/rest/impl/MappingExecutionControllerTest.java

Lines changed: 8 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -50,16 +50,15 @@
5050
import static org.springframework.test.web.servlet.result.MockMvcResultHandlers.print;
5151
import static org.springframework.test.web.servlet.result.MockMvcResultMatchers.*;
5252

53-
5453
@ExtendWith({RestDocumentationExtension.class, SpringExtension.class})
5554
@EnableRuleMigrationSupport
5655
@SpringBootTest(webEnvironment = SpringBootTest.WebEnvironment.DEFINED_PORT, classes = MappingServiceApplication.class)
5756
@AutoConfigureMockMvc
5857
@TestExecutionListeners(listeners = {ServletTestExecutionListener.class,
59-
DependencyInjectionTestExecutionListener.class,
60-
DirtiesContextTestExecutionListener.class,
61-
TransactionalTestExecutionListener.class,
62-
WithSecurityContextTestExecutionListener.class})
58+
DependencyInjectionTestExecutionListener.class,
59+
DirtiesContextTestExecutionListener.class,
60+
TransactionalTestExecutionListener.class,
61+
WithSecurityContextTestExecutionListener.class})
6362
@ActiveProfiles("test")
6463
@TestPropertySource(properties = {"server.port=41500"})
6564
public class MappingExecutionControllerTest {
@@ -96,8 +95,8 @@ private void createMapping() throws Exception {
9695
MockMultipartFile mappingFile = new MockMultipartFile("document", "my_dc4gemma.mapping", "application/json", mappingContent.getBytes());
9796

9897
this.mockMvc.perform(MockMvcRequestBuilders.multipart("/api/v1/mappingAdministration/").
99-
file(recordFile).
100-
file(mappingFile)).
98+
file(recordFile).
99+
file(mappingFile)).
101100
andDo(print()).
102101
andExpect(status().isCreated()).
103102
andExpect(redirectedUrlPattern("http://*:*/api/v1/mappingAdministration/*")).
@@ -140,8 +139,7 @@ void mapValidDocument() throws Exception {
140139
this.mockMvc.perform(MockMvcRequestBuilders.multipart(MAPPING_URL).file(mappingFile)).
141140
andDo(print()).
142141
andExpect(status().isOk()).
143-
andExpect(content().string("Hello World!")).
144-
andReturn();
142+
andExpect(header().string("content-disposition", "attachment;result.txt")).andReturn();
145143
}
146144

147145
@Test
@@ -164,7 +162,6 @@ void mapWithoutDocument() throws Exception {
164162
// andExpect(content().string("There is no result for the input. The input must be invalid.")).
165163
// andReturn();
166164
// }
167-
168165
@Test
169166
void mapWithMissingParameters() throws Exception {
170167
String mappingContent = FileUtils.readFileToString(new File("src/test/resources/examples/gemma/simple.json"), StandardCharsets.UTF_8);
@@ -199,7 +196,6 @@ void mapWithInvalidID() throws Exception {
199196
// andExpect(content().string("No mapping record found for mapping my_dc/gkahjg.")).
200197
// andReturn();
201198
// }
202-
203199
// @Test
204200
// void mapWithTypeMissing() throws Exception {
205201
// String mappingContent = FileUtils.readFileToString(new File("src/test/resources/examples/gemma/simple.json"), StandardCharsets.UTF_8);
@@ -210,4 +206,4 @@ void mapWithInvalidID() throws Exception {
210206
// andExpect(status().isNotFound()).
211207
// andReturn();
212208
// }
213-
}
209+
}

src/test/resources/test-config/application-test.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ spring.jpa.hibernate.ddl-auto=update
4848
# Mapping-Service specific settings
4949
##################################################
5050
# Absolute path to the local python interpreter
51-
mapping-service.pythonLocation=${pythonLocation:'file:///usr/bin/python3'}
51+
mapping-service.pythonLocation=${pythonExecutable:'file:///usr/bin/python3'}
5252
# Absolute path to the folder where all plugins are located
5353
mapping-service.pluginLocation=file:///${user.dir}/plugins
5454
# Absolute path to the local gemma mappings folder

0 commit comments

Comments
 (0)