Skip to content

Commit

Permalink
Some general changes to existing controllers, mainly changing 'api' t…
Browse files Browse the repository at this point in the history
…o 'dev'
  • Loading branch information
RustyHMCTS committed Jul 11, 2024
1 parent 8308f0a commit 1fc6691
Show file tree
Hide file tree
Showing 46 changed files with 86 additions and 168 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ void testGetConfigurationItemById() throws Exception {

when(configurationItemService.getConfigurationItem(1L)).thenReturn(configurationItemEntity);

mockMvc.perform(get("/api/configuration-item/1"))
mockMvc.perform(get("/dev/configuration-item/1"))
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON))
.andExpect(jsonPath("$.configurationItemId").value(1))
Expand All @@ -56,7 +56,7 @@ void testGetConfigurationItemById() throws Exception {
void testGetConfigurationItemById_WhenConfigurationItemDoesNotExist() throws Exception {
when(configurationItemService.getConfigurationItem(2L)).thenReturn(null);

mockMvc.perform(get("/api/configuration-item/2"))
mockMvc.perform(get("/dev/configuration-item/2"))
.andExpect(status().isNoContent());
}

Expand All @@ -67,7 +67,7 @@ void testPostConfigurationItemsSearch() throws Exception {
when(configurationItemService.searchConfigurationItems(any(ConfigurationItemSearchDto.class)))
.thenReturn(singletonList(configurationItemEntity));

mockMvc.perform(post("/api/configuration-item/search")
mockMvc.perform(post("/dev/configuration-item/search")
.contentType(MediaType.APPLICATION_JSON)
.content("{\"criteria\":\"value\"}"))
.andExpect(status().isOk())
Expand All @@ -80,7 +80,7 @@ void testPostConfigurationItemsSearch() throws Exception {

@Test
void testPostConfigurationItemsSearch_WhenConfigurationItemDoesNotExist() throws Exception {
mockMvc.perform(post("/api/configuration-item/search")
mockMvc.perform(post("/dev/configuration-item/search")
.contentType(MediaType.APPLICATION_JSON)
.content("{\"criteria\":\"2\"}"))
.andExpect(status().isNoContent());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ void testGetImpositionById() throws Exception {

when(impositionService.getImposition(1L)).thenReturn(impositionEntity);

mockMvc.perform(get("/api/imposition/1"))
mockMvc.perform(get("/dev/imposition/1"))
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON))
.andExpect(jsonPath("$.impositionId").value(1))
Expand All @@ -64,7 +64,7 @@ void testGetImpositionById() throws Exception {
void testGetImpositionById_WhenImpositionDoesNotExist() throws Exception {
when(impositionService.getImposition(2L)).thenReturn(null);

mockMvc.perform(get("/api/imposition/2"))
mockMvc.perform(get("/dev/imposition/2"))
.andExpect(status().isNoContent());
}

Expand All @@ -75,7 +75,7 @@ void testPostImpositionsSearch() throws Exception {
when(impositionService.searchImpositions(any(ImpositionSearchDto.class)))
.thenReturn(singletonList(impositionEntity));

mockMvc.perform(post("/api/imposition/search")
mockMvc.perform(post("/dev/imposition/search")
.contentType(MediaType.APPLICATION_JSON)
.content("{\"criteria\":\"value\"}"))
.andExpect(status().isOk())
Expand All @@ -91,7 +91,7 @@ void testPostImpositionsSearch() throws Exception {

@Test
void testPostImpositionsSearch_WhenImpositionDoesNotExist() throws Exception {
mockMvc.perform(post("/api/imposition/search")
mockMvc.perform(post("/dev/imposition/search")
.contentType(MediaType.APPLICATION_JSON)
.content("{\"criteria\":\"2\"}"))
.andExpect(status().isNoContent());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ void testGetLogActionById() throws Exception {

when(logActionService.getLogAction((short)1)).thenReturn(logActionEntity);

mockMvc.perform(get("/api/log-action/1"))
mockMvc.perform(get("/dev/log-action/1"))
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON))
.andExpect(jsonPath("$.logActionId").value(1))
Expand All @@ -52,7 +52,7 @@ void testGetLogActionById() throws Exception {
void testGetLogActionById_WhenLogActionDoesNotExist() throws Exception {
when(logActionService.getLogAction((short)2)).thenReturn(null);

mockMvc.perform(get("/api/log-action/2"))
mockMvc.perform(get("/dev/log-action/2"))
.andExpect(status().isNoContent());
}

Expand All @@ -63,7 +63,7 @@ void testPostLogActionsSearch() throws Exception {
when(logActionService.searchLogActions(any(LogActionSearchDto.class)))
.thenReturn(singletonList(logActionEntity));

mockMvc.perform(post("/api/log-action/search")
mockMvc.perform(post("/dev/log-action/search")
.contentType(MediaType.APPLICATION_JSON)
.content("{\"criteria\":\"value\"}"))
.andExpect(status().isOk())
Expand All @@ -74,7 +74,7 @@ void testPostLogActionsSearch() throws Exception {

@Test
void testPostLogActionsSearch_WhenLogActionDoesNotExist() throws Exception {
mockMvc.perform(post("/api/log-action/search")
mockMvc.perform(post("/dev/log-action/search")
.contentType(MediaType.APPLICATION_JSON)
.content("{\"criteria\":\"2\"}"))
.andExpect(status().isNoContent());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ void testGetLogAuditDetailById() throws Exception {

when(logAuditDetailService.getLogAuditDetail(1L)).thenReturn(logAuditDetailEntity);

mockMvc.perform(get("/api/log-audit-detail/1"))
mockMvc.perform(get("/dev/log-audit-detail/1"))
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON))
.andExpect(jsonPath("$.logAuditDetailId").value(1))
Expand All @@ -60,7 +60,7 @@ void testGetLogAuditDetailById() throws Exception {
void testGetLogAuditDetailById_WhenLogAuditDetailDoesNotExist() throws Exception {
when(logAuditDetailService.getLogAuditDetail(2L)).thenReturn(null);

mockMvc.perform(get("/api/log-audit-detail/2"))
mockMvc.perform(get("/dev/log-audit-detail/2"))
.andExpect(status().isNoContent());
}

Expand All @@ -71,7 +71,7 @@ void testPostLogAuditDetailsSearch() throws Exception {
when(logAuditDetailService.searchLogAuditDetails(any(LogAuditDetailSearchDto.class)))
.thenReturn(singletonList(logAuditDetailEntity));

mockMvc.perform(post("/api/log-audit-detail/search")
mockMvc.perform(post("/dev/log-audit-detail/search")
.contentType(MediaType.APPLICATION_JSON)
.content("{\"criteria\":\"value\"}"))
.andExpect(status().isOk())
Expand All @@ -86,7 +86,7 @@ void testPostLogAuditDetailsSearch() throws Exception {

@Test
void testPostLogAuditDetailsSearch_WhenLogAuditDetailDoesNotExist() throws Exception {
mockMvc.perform(post("/api/log-audit-detail/search")
mockMvc.perform(post("/dev/log-audit-detail/search")
.contentType(MediaType.APPLICATION_JSON)
.content("{\"criteria\":\"2\"}"))
.andExpect(status().isNoContent());
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ void testGetResultById() throws Exception {

when(resultService.getResult(1L)).thenReturn(resultEntity);

mockMvc.perform(get("/api/result/1"))
mockMvc.perform(get("/dev/result/1"))
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON))
.andExpect(jsonPath("$.resultId").value(1))
Expand Down Expand Up @@ -73,7 +73,7 @@ void testGetResultById() throws Exception {
void testGetResultById_WhenResultDoesNotExist() throws Exception {
when(resultService.getResult(2L)).thenReturn(null);

mockMvc.perform(get("/api/result/2"))
mockMvc.perform(get("/dev/result/2"))
.andExpect(status().isNoContent());
}

Expand All @@ -83,7 +83,7 @@ void testPostResultsSearch() throws Exception {

when(resultService.searchResults(any(ResultSearchDto.class))).thenReturn(singletonList(resultEntity));

mockMvc.perform(post("/api/result/search")
mockMvc.perform(post("/dev/result/search")
.contentType(MediaType.APPLICATION_JSON)
.content("{\"criteria\":\"value\"}"))
.andExpect(status().isOk())
Expand Down Expand Up @@ -115,7 +115,7 @@ void testPostResultsSearch() throws Exception {

@Test
void testPostResultsSearch_WhenResultDoesNotExist() throws Exception {
mockMvc.perform(post("/api/result/search")
mockMvc.perform(post("/dev/result/search")
.contentType(MediaType.APPLICATION_JSON)
.content("{\"criteria\":\"2\"}"))
.andExpect(status().isNoContent());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import org.springframework.test.context.ContextConfiguration;
import org.springframework.test.web.servlet.MockMvc;
import uk.gov.hmcts.opal.dto.search.TillSearchDto;
import uk.gov.hmcts.opal.entity.BusinessUnitEntity;
import uk.gov.hmcts.opal.entity.TillEntity;
import uk.gov.hmcts.opal.service.opal.TillService;

Expand Down Expand Up @@ -40,12 +41,12 @@ void testGetTillById() throws Exception {

when(tillService.getTill(1L)).thenReturn(tillEntity);

mockMvc.perform(get("/api/till/1"))
mockMvc.perform(get("/dev/till/1"))
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON))
.andExpect(jsonPath("$.tillId").value(1))
.andExpect(jsonPath("$.tillNumber").value(2))
.andExpect(jsonPath("$.businessUnitId").value(3))
.andExpect(jsonPath("$.businessUnit.businessUnitId").value(3))
.andExpect(jsonPath("$.ownedBy").value("Owner Keith"));
}

Expand All @@ -54,7 +55,7 @@ void testGetTillById() throws Exception {
void testGetTillById_WhenTillDoesNotExist() throws Exception {
when(tillService.getTill(2L)).thenReturn(null);

mockMvc.perform(get("/api/till/2"))
mockMvc.perform(get("/dev/till/2"))
.andExpect(status().isNoContent());
}

Expand All @@ -64,20 +65,20 @@ void testPostTillsSearch() throws Exception {

when(tillService.searchTills(any(TillSearchDto.class))).thenReturn(singletonList(tillEntity));

mockMvc.perform(post("/api/till/search")
mockMvc.perform(post("/dev/till/search")
.contentType(MediaType.APPLICATION_JSON)
.content("{\"criteria\":\"value\"}"))
.andExpect(status().isOk())
.andExpect(content().contentType(MediaType.APPLICATION_JSON))
.andExpect(jsonPath("$[0].tillId").value(1))
.andExpect(jsonPath("$[0].tillNumber").value(2))
.andExpect(jsonPath("$[0].businessUnitId").value(3))
.andExpect(jsonPath("$[0].businessUnit.businessUnitId").value(3))
.andExpect(jsonPath("$[0].ownedBy").value("Owner Keith"));
}

@Test
void testPostTillsSearch_WhenTillDoesNotExist() throws Exception {
mockMvc.perform(post("/api/till/search")
mockMvc.perform(post("/dev/till/search")
.contentType(MediaType.APPLICATION_JSON)
.content("{\"criteria\":\"2\"}"))
.andExpect(status().isNoContent());
Expand All @@ -87,7 +88,7 @@ private TillEntity createTillEntity() {
return TillEntity.builder()
.tillId(1L)
.tillNumber((short)2)
.businessUnitId((short)3)
.businessUnit(BusinessUnitEntity.builder().businessUnitId((short)3).build())
.ownedBy("Owner Keith")
.build();
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,8 @@
import uk.gov.hmcts.opal.authentication.exception.AuthenticationException;

import java.net.MalformedURLException;
import java.net.URI;
import java.net.URISyntaxException;
import java.net.URL;

public interface AuthProviderConfigurationProperties {
Expand All @@ -22,11 +24,11 @@ public interface AuthProviderConfigurationProperties {

default JWKSource<SecurityContext> getJwkSource() {
try {
URL jwksUrl = new URL(getJwkSetUri());
URL jwksUrl = new URI(getJwkSetUri()).toURL();

return JWKSourceBuilder.create(jwksUrl).build();
} catch (MalformedURLException malformedUrlException) {
throw new AuthenticationException("Sorry authentication jwks URL is incorrect");
} catch (MalformedURLException | URISyntaxException malformedUrlException) {
throw new AuthenticationException("Sorry authentication jwks URL (" + getJwkSetUri() + ") is incorrect");
}
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@


@RestController
@RequestMapping("/api/account-transfer")
@RequestMapping("/dev/account-transfer")
@Slf4j(topic = "AccountTransferController")
@Tag(name = "AccountTransfer Controller")
public class AccountTransferController {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@


@RestController
@RequestMapping("/api/alias")
@RequestMapping("/dev/alias")
@Slf4j(topic = "AliasController")
@Tag(name = "Alias Controller")
public class AliasController {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@


@RestController
@RequestMapping("/api/amendment")
@RequestMapping("/dev/amendment")
@Slf4j(topic = "AmendmentController")
@Tag(name = "Amendment Controller")
public class AmendmentController {
Expand Down
Loading

0 comments on commit 1fc6691

Please sign in to comment.