Skip to content

Commit

Permalink
Removed the code that used the 'Clients' table as it's not being used…
Browse files Browse the repository at this point in the history
… after the keycloak implementation. (#129)
  • Loading branch information
ssathiah authored Feb 12, 2024
1 parent b7c464d commit 81ae32a
Show file tree
Hide file tree
Showing 13 changed files with 12 additions and 331 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -30,8 +30,6 @@
"gov.cdc.dataingestion.report.repository",
"gov.cdc.dataingestion.conversion.repository",
"gov.cdc.dataingestion.deadletter.repository",
"gov.cdc.dataingestion.registration.repository",
"gov.cdc.dataingestion.security.repository",
"gov.cdc.dataingestion.reportstatus.repository"
}
)
Expand Down Expand Up @@ -83,7 +81,6 @@ public LocalContainerEntityManagerFactoryBean ingestEntityManagerFactory(
"gov.cdc.dataingestion.report.repository",
"gov.cdc.dataingestion.conversion.repository.model",
"gov.cdc.dataingestion.deadletter.repository.model",
"gov.cdc.dataingestion.registration.model",
"gov.cdc.dataingestion.security.model",
"gov.cdc.dataingestion.reportstatus.model")
.persistenceUnit("ingest")
Expand Down

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

This file was deleted.

17 changes: 0 additions & 17 deletions data-ingestion-service/src/main/resources/db/di-service-001.sql
Original file line number Diff line number Diff line change
Expand Up @@ -78,20 +78,3 @@ IF NOT EXISTS(
);
END


IF NOT EXISTS(
SELECT ' X'
FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_NAME = 'clients') BEGIN
CREATE TABLE clients
(
id UNIQUEIDENTIFIER PRIMARY KEY DEFAULT NEWID(),
client_id VARCHAR(255) NOT NULL UNIQUE,
client_secret VARCHAR(255) NOT NULL,
client_roles VARCHAR(255) NULL,
created_by VARCHAR(255) NOT NULL,
updated_by VARCHAR(255) NOT NULL,
created_on DATETIME NOT NULL DEFAULT getdate(),
updated_on DATETIME NULL
);
END
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.security.test.web.servlet.request.SecurityMockMvcRequestPostProcessors;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
import org.springframework.test.web.servlet.result.MockMvcResultMatchers;
Expand All @@ -18,8 +19,7 @@
import static org.mockito.Mockito.when;

@WebMvcTest(ElrDeadLetterController.class)
//@EnableConfigurationProperties(RsaKeyProperties.class)

@ActiveProfiles("test")
class ElrDeadLetterControllerTest {
@Autowired
private MockMvc mockMvc;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,15 +14,15 @@
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.http.MediaType;
import org.springframework.security.test.web.servlet.request.SecurityMockMvcRequestPostProcessors;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
import org.springframework.test.web.servlet.result.MockMvcResultMatchers;

import static org.mockito.Mockito.when;


//@EnableConfigurationProperties(RsaKeyProperties.class)
@WebMvcTest(ElrReportsController.class)
@ActiveProfiles("test")
class ElrReportsControllerTest {

@Autowired
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -12,14 +12,15 @@
import org.springframework.boot.test.autoconfigure.web.servlet.WebMvcTest;
import org.springframework.boot.test.mock.mockito.MockBean;
import org.springframework.security.test.web.servlet.request.SecurityMockMvcRequestPostProcessors;
import org.springframework.test.context.ActiveProfiles;
import org.springframework.test.web.servlet.MockMvc;
import org.springframework.test.web.servlet.request.MockMvcRequestBuilders;
import org.springframework.test.web.servlet.result.MockMvcResultMatchers;

import static org.mockito.Mockito.verify;

@WebMvcTest(ElrReportsController.class)
//@EnableConfigurationProperties(RsaKeyProperties.class)
@ActiveProfiles("test")
class ElrReportsControllerTest {

@Autowired
Expand All @@ -42,7 +43,6 @@ void testSaveHL7Message() throws Exception {
String messageType = "HL7";
mockMvc.perform(MockMvcRequestBuilders.post("/api/reports")
.header("msgType", messageType)
.header("validationActive", "false")
.contentType("text/plain")
.content(hl7Payload)
.with(SecurityMockMvcRequestPostProcessors.jwt()))
Expand All @@ -51,6 +51,7 @@ void testSaveHL7Message() throws Exception {
RawERLDto rawERLDto = new RawERLDto();
rawERLDto.setType(messageType);
rawERLDto.setPayload(hl7Payload);
rawERLDto.setValidationActive(true);

verify(rawELRService).submission(rawERLDto);

Expand All @@ -62,7 +63,6 @@ void testSaveHL7MessageValidationActivated() throws Exception {
String messageType = "HL7";
mockMvc.perform(MockMvcRequestBuilders.post("/api/reports")
.header("msgType", messageType)
.header("validationActive", "true")
.contentType("text/plain")
.content(hl7Payload)
.with(SecurityMockMvcRequestPostProcessors.jwt()))
Expand All @@ -79,10 +79,9 @@ void testSaveHL7MessageValidationActivated() throws Exception {
@Test
void testSaveHL7MessageHeaderIsEmpty() throws Exception {
String hl7Payload = "testmessage";
String messageType = "HL7";
String messageType = "";
mockMvc.perform(MockMvcRequestBuilders.post("/api/reports")
.header("msgType", messageType)
.header("validationActive", "")
.contentType("text/plain")
.content(hl7Payload)
.with(SecurityMockMvcRequestPostProcessors.jwt()))
Expand All @@ -94,7 +93,6 @@ void testSaveHL7MessageHeaderIsEmptyType() throws Exception {
String hl7Payload = "testmessage";
mockMvc.perform(MockMvcRequestBuilders.post("/api/reports")
.header("msgType", "")
.header("validationActive", "true")
.contentType("text/plain")
.content(hl7Payload)
.with(SecurityMockMvcRequestPostProcessors.jwt()))
Expand All @@ -106,19 +104,6 @@ void testSaveHL7MessageHeaderTypeInvalid() throws Exception {
String hl7Payload = "testmessage";
mockMvc.perform(MockMvcRequestBuilders.post("/api/reports")
.header("msgType", "AAA")
.header("validationActive", "true")
.contentType("text/plain")
.content(hl7Payload)
.with(SecurityMockMvcRequestPostProcessors.jwt()))
.andExpect(MockMvcResultMatchers.status().isInternalServerError());
}

@Test
void testSaveHL7MessageHeaderValidationInvalid() throws Exception {
String hl7Payload = "testmessage";
mockMvc.perform(MockMvcRequestBuilders.post("/api/reports")
.header("msgType", "HL7")
.header("validationActive", "AAA")
.contentType("text/plain")
.content(hl7Payload)
.with(SecurityMockMvcRequestPostProcessors.jwt()))
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import org.mockito.Mock;
import org.mockito.MockitoAnnotations;
import org.springframework.http.ResponseEntity;
import org.springframework.test.context.ActiveProfiles;
import org.testcontainers.shaded.com.fasterxml.jackson.databind.ObjectMapper;

import java.io.IOException;
Expand All @@ -16,6 +17,7 @@
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.mockito.Mockito.*;

@ActiveProfiles("test")
class ReportStatusControllerTest {
@Mock
private ReportStatusService reportStatusServiceMock;
Expand Down
Loading

0 comments on commit 81ae32a

Please sign in to comment.