Skip to content

Commit

Permalink
Merge pull request #3 from sanctuuary/ape_mvn
Browse files Browse the repository at this point in the history
Fix APE dependencies - use the version now available in mvn repo
  • Loading branch information
vedran-kasalica committed Aug 1, 2023
2 parents 2810e4d + 906e88f commit 5be389b
Show file tree
Hide file tree
Showing 2 changed files with 64 additions and 2 deletions.
22 changes: 21 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,26 @@
<version>0.2.2</version>
<name>restape</name>
<description>RESTful API for the APE library</description>
<licenses>
<license>
<name>Apache License, Version 2.0</name>
<url>http://www.apache.org/licenses/LICENSE-2.0.txt</url>
<distribution>repo</distribution>
</license>
</licenses>
<developers>
<developer>
<name>Vedran Kasalica</name>
<email>v.kasalica@esciencecenter.nl</email>
<organization>Netherlands eScience Center</organization>
<organizationUrl>https://www.esciencecenter.nl/</organizationUrl>
</developer>
</developers>
<scm>
<connection>scm:git:git://github.com/sanctuuary/RESTAPE.git</connection>
<developerConnection>scm:git:ssh://github.com:sanctuuary/RESTAPE.git</developerConnection>
<url>https://github.com/sanctuuary/RESTAPE/tree/master</url>
</scm>
<properties>
<java.version>17</java.version>
</properties>
Expand Down Expand Up @@ -56,7 +76,7 @@
<dependency>
<groupId>io.github.sanctuuary</groupId>
<artifactId>APE</artifactId>
<version>2.1.3</version>
<version>2.1.5</version>
</dependency>

<dependency>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,34 @@ public class RestApeControllerTest {
@Autowired
private MockMvc mvc;

/**
* Test the getGreetings method.
*
* @throws Exception if the test fails
*/
@Test
public void getGreetings() throws Exception {
mvc.perform(MockMvcRequestBuilders.get("/").accept(MediaType.APPLICATION_JSON))
.andExpect(status().isOk())
.andExpect(content().string(equalTo("Welcome to the RestApe API!")));
}

/**
* Test the getData method without a config_path parameter.
*
* @throws Exception if the call does not detect the missing parameter.
*/
@Test
public void getDataFail() throws Exception {
mvc.perform(MockMvcRequestBuilders.get("/get_data").accept(MediaType.APPLICATION_JSON))
.andExpect(status().isBadRequest());
}

/**
* Test the getData method with a config_path parameter.
*
* @throws Exception if the test fails.
*/
@Test
public void getDataTest() throws Exception {
String path = "https://raw.githubusercontent.com/Workflomics/domain-annotations/main/MassSpectometry/config.json";
Expand All @@ -44,12 +59,22 @@ public void getDataTest() throws Exception {
.andExpect(content().contentType(MediaType.APPLICATION_JSON));
}

/**
* Test the getTools method without a config_path parameter.
*
* @throws Exception if the call does not detect the missing parameter.
*/
@Test
public void getToolsFail() throws Exception {
mvc.perform(MockMvcRequestBuilders.get("/get_tools").accept(MediaType.APPLICATION_JSON))
.andExpect(status().isBadRequest());
}

/**
* Test the getTools method with a config_path parameter.
*
* @throws Exception if the test fails.
*/
@Test
public void getToolsTest() throws Exception {
String path = "https://raw.githubusercontent.com/Workflomics/domain-annotations/main/MassSpectometry/config.json";
Expand All @@ -59,9 +84,26 @@ public void getToolsTest() throws Exception {
.andExpect(content().contentType(MediaType.APPLICATION_JSON));
}

/**
* Test the runSynthesis method with GET instead of POST.
*
* @throws Exception if the call does not detect the that the call should be
* POST.
*/
@Test
public void runSynthesisFail() throws Exception {
public void runSynthesisGetFail() throws Exception {
mvc.perform(MockMvcRequestBuilders.get("/run_synthesis").accept(MediaType.APPLICATION_JSON))
.andExpect(status().isMethodNotAllowed());
}

/**
* Test the runSynthesis method with POST, but without a confuguartion file.
*
* @throws Exception if the call does not detect the missing file.
*/
@Test
public void runSynthesisPostFail() throws Exception {
mvc.perform(MockMvcRequestBuilders.post("/run_synthesis").accept(MediaType.APPLICATION_JSON))
.andExpect(status().isBadRequest());
}

Expand Down

0 comments on commit 5be389b

Please sign in to comment.