Skip to content

Commit

Permalink
Restore broken api docs
Browse files Browse the repository at this point in the history
  • Loading branch information
jamesamcl committed Aug 13, 2020
1 parent 0ba7fd1 commit 5ca43cb
Showing 1 changed file with 13 additions and 23 deletions.
36 changes: 13 additions & 23 deletions oxo-web/src/test/java/ApiDocumentation.java
Original file line number Diff line number Diff line change
Expand Up @@ -11,8 +11,6 @@
import org.neo4j.ogm.response.model.QueryResultModel;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.boot.test.SpringApplicationConfiguration;
import org.springframework.boot.test.autoconfigure.restdocs.AutoConfigureRestDocs;
import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
import org.springframework.boot.test.context.SpringBootTest;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.data.domain.Page;
Expand All @@ -32,14 +30,8 @@
import org.springframework.test.web.servlet.setup.MockMvcBuilders;
import org.springframework.web.context.WebApplicationContext;
import uk.ac.ebi.spot.OxoWebApp;
import uk.ac.ebi.spot.controller.api.MappingController;
import uk.ac.ebi.spot.model.Datasource;
import uk.ac.ebi.spot.model.Mapping;
import uk.ac.ebi.spot.model.SourceType;
import uk.ac.ebi.spot.model.Term;
import uk.ac.ebi.spot.service.DatasourceService;
import uk.ac.ebi.spot.service.MappingService;
import uk.ac.ebi.spot.service.TermService;
import uk.ac.ebi.spot.model.*;
import uk.ac.ebi.spot.service.*;

import javax.servlet.RequestDispatcher;

Expand Down Expand Up @@ -70,7 +62,6 @@
@RunWith(SpringJUnit4ClassRunner.class)
@SpringBootTest(classes = OxoWebApp.class)
@WebAppConfiguration
/*@Ignore*/
public class ApiDocumentation {

@Rule
Expand Down Expand Up @@ -103,7 +94,8 @@ public class ApiDocumentation {
@Before
public void setUp() {

System.out.print("Start the Tests");
Mockito.when(neo4jTemplate.query(Mockito.anyString(), Mockito.anyMap(), Mockito.anyBoolean())).thenReturn(new QueryResultModel(null, null));

this.document = document("{method-name}"
,
preprocessRequest(prettyPrint()),
Expand All @@ -112,16 +104,16 @@ public void setUp() {

this.mockMvc = MockMvcBuilders.webAppContextSetup(this.context)
.apply(documentationConfiguration(this.restDocumentation).uris()
.withScheme("https")
.withHost("www.ebi.ac.uk/spot/oxo")
.withPort(80)
.withScheme("https")
.withHost("www.ebi.ac.uk")
.withPort(443)
)
.alwaysDo(this.document)
.build();
}


/*

@Test
public void pageExample () throws Exception {

Expand Down Expand Up @@ -153,7 +145,8 @@ public void pageExample () throws Exception {

this.mockMvc.perform(requestBuilder)
.andExpect(status().isOk());
}*/

}


@Test
Expand All @@ -179,8 +172,6 @@ public void errorExample() throws Exception {
;
}


/*
@Test
public void apiExample () throws Exception {

Expand All @@ -197,7 +188,7 @@ public void apiExample () throws Exception {
);
this.mockMvc.perform(get("/spot/oxo/api").contextPath("/spot/oxo").accept(MediaType.APPLICATION_JSON))
.andExpect(status().isOk());
}*/
}


@Test
Expand Down Expand Up @@ -234,7 +225,6 @@ public void mappingsListExample () throws Exception {
}


/*
@Test
public void mappingExample () throws Exception {

Expand Down Expand Up @@ -374,5 +364,5 @@ public void searchByIdsToJson () throws Exception {
ObjectMapper mapper = new ObjectMapper();
this.mockMvc.perform(post("/spot/oxo/api/search").contextPath("/spot/oxo").contentType(MediaType.APPLICATION_JSON).accept(MediaType.APPLICATION_JSON).content(mapper.writeValueAsString(searchRequest)))
.andExpect(status().isOk());
}*/
}
}
}

0 comments on commit 5ca43cb

Please sign in to comment.