Skip to content

Commit f97bc51

Browse files
authored
Merge pull request #2702 from bcgov/feature/other-removal
Remove Other From Document Types
2 parents b18b2f1 + 9f9e3c1 commit f97bc51

File tree

5 files changed

+46
-25
lines changed

5 files changed

+46
-25
lines changed

src/backend/README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,3 +33,7 @@ Run
3333
```
3434
mvn -f src/backend/pom.xml versions:set -DartifactId=* -DgroupId=*
3535
```
36+
37+
## caching
38+
39+
Currently lookups are cached using redis. In the event of a code table change redis should be restarted. Check the api for activity beore doing so.

src/backend/libs/efiling-cso-client/pom.xml

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -3,12 +3,6 @@
33
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
44
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
55
<modelVersion>4.0.0</modelVersion>
6-
<parent>
7-
<groupId>org.springframework.boot</groupId>
8-
<artifactId>spring-boot-starter-parent</artifactId>
9-
<version>2.4.0</version>
10-
<relativePath/> <!-- lookup parent from repository -->
11-
</parent>
126
<groupId>ca.bc.gov.open.jag</groupId>
137
<artifactId>efiling-cso-client</artifactId>
148
<version>1.5.2-SNAPSHOT</version>
@@ -76,14 +70,9 @@
7670
<scope>test</scope>
7771
</dependency>
7872
<dependency>
79-
<groupId>org.springframework.boot</groupId>
80-
<artifactId>spring-boot-starter-web</artifactId>
81-
<version>3.1.0</version>
82-
</dependency>
83-
<dependency>
84-
<groupId>org.springframework.boot</groupId>
85-
<artifactId>spring-boot-starter-webflux</artifactId>
86-
<version>3.1.0</version>
73+
<groupId>org.springframework</groupId>
74+
<artifactId>spring-web</artifactId>
75+
<version>5.3.28</version>
8776
</dependency>
8877
</dependencies>
8978

src/backend/libs/efiling-cso-client/src/main/java/ca/bc/gov/open/jag/efilingcsoclient/CsoDocumentServiceImpl.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@
1212
import java.util.List;
1313
import java.util.stream.Collectors;
1414

15+
import static ca.bc.gov.open.jag.efilingcsoclient.Keys.OTHER_DOCUMENT_TYPE;
16+
1517

1618
public class CsoDocumentServiceImpl implements EfilingDocumentService {
1719

@@ -55,10 +57,13 @@ public List<DocumentTypeDetails> getDocumentTypes(String courtLevel, String cour
5557

5658
private List<DocumentType> getSoapDocumentTypes(String courtLevel, String courtClass) {
5759

58-
List<DocumentType> documentTypes = new ArrayList<>();
60+
List<DocumentType> documentTypes;
5961

6062
try {
61-
documentTypes.addAll(filingStatusFacadeBean.getDocumentTypes(courtLevel, courtClass));
63+
documentTypes = new ArrayList<>(filingStatusFacadeBean.getDocumentTypes(courtLevel, courtClass));
64+
//Remove other document types. NOTE these are cached and redis requires a restart
65+
//TODO: consider feature flagging this
66+
documentTypes.removeIf(documentType -> documentType.getDocumentTypeCd().equals(OTHER_DOCUMENT_TYPE));
6267
} catch (NestedEjbException_Exception e) {
6368
throw new EfilingDocumentServiceException("Exception while retrieving document details", e.getCause());
6469
}

src/backend/libs/efiling-cso-client/src/main/java/ca/bc/gov/open/jag/efilingcsoclient/Keys.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,4 +63,6 @@ private Keys() {}
6363
public static final String AUTO_PROCESSING_STATE = "AUTO";
6464
public static final String MANUAL_PROCESSING_STATE = "MANUAL";
6565

66+
public static final String OTHER_DOCUMENT_TYPE = "OTH";
67+
6668
}

src/backend/libs/efiling-cso-client/src/test/java/ca/bc/gov/open/jag/efilingcsoclient/csoDocumentServiceImpl/GetDocumentTypesTest.java

Lines changed: 30 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@
2222
@DisplayName("Get Document Type Test Suite")
2323
public class GetDocumentTypesTest {
2424
private static final String DOCUMENT_TYPE_CD = "ACODE";
25+
private static final String DOCUMENT_TYPE_OTHER_CD = "OTH";
2526
private static final String DESCRIPTION = "DESCRIPTION";
2627
private static final String NODOC = "NODOC";
2728
public static final String COURT_LEVEL = "level1";
@@ -36,15 +37,8 @@ public class GetDocumentTypesTest {
3637
public void setUp() throws NestedEjbException_Exception {
3738

3839
MockitoAnnotations.openMocks(this);
39-
DocumentType documentType = new DocumentType();
40-
documentType.setDocumentTypeCd(DOCUMENT_TYPE_CD);
41-
documentType.setDocumentTypeDesc(DESCRIPTION);
42-
documentType.setDefaultStatutoryFee(BigDecimal.TEN);
43-
documentType.setOrderDocumentYn(true);
44-
documentType.setRushRequiredYn(true);
45-
documentType.setAutoProcessYn(false);
46-
47-
Mockito.when(filingStatusFacadeBean.getDocumentTypes(Mockito.eq(COURT_LEVEL),any())).thenReturn(Arrays.asList(documentType));
40+
41+
Mockito.when(filingStatusFacadeBean.getDocumentTypes(Mockito.eq(COURT_LEVEL),any())).thenReturn(createDocumentTypeList());
4842
Mockito.when(filingStatusFacadeBean.getDocumentTypes(Mockito.eq(NODOC),any())).thenReturn(new ArrayList<>());
4943

5044
Mockito.when(filingStatusFacadeBean.getDocumentTypes(Mockito.eq(EXCEPTION),any())).thenThrow(NestedEjbException_Exception.class);
@@ -56,15 +50,19 @@ public void setUp() throws NestedEjbException_Exception {
5650
@Test
5751
public void testWithFoundResult() {
5852
List<DocumentTypeDetails> result = sut.getDocumentTypes(COURT_LEVEL, COURT_CLASS);
53+
54+
Assertions.assertEquals(1, result.size());
5955
Assertions.assertEquals(DESCRIPTION, result.get(0).getDescription());
6056
Assertions.assertEquals(DOCUMENT_TYPE_CD, result.get(0).getType());
57+
6158
}
6259

6360
@DisplayName("Failure: when SOAP service throws NestedEjbException_Exception, service should throw EfilingDocumentServiceException")
6461
@Test
6562
public void testThrowException() throws NestedEjbException_Exception {
6663

6764
Assertions.assertThrows(EfilingDocumentServiceException.class, () -> sut.getDocumentTypes(EXCEPTION, COURT_CLASS));
65+
6866
}
6967

7068
@DisplayName("Exception: courtLevel is required")
@@ -87,4 +85,27 @@ public void whenCourtClassIsBlankShouldThrowIllegalArgumentException() {
8785

8886
}
8987

88+
private List<DocumentType> createDocumentTypeList() {
89+
90+
DocumentType documentType1 = new DocumentType();
91+
documentType1.setDocumentTypeCd(DOCUMENT_TYPE_CD);
92+
documentType1.setDocumentTypeDesc(DESCRIPTION);
93+
documentType1.setDefaultStatutoryFee(BigDecimal.TEN);
94+
documentType1.setOrderDocumentYn(true);
95+
documentType1.setRushRequiredYn(true);
96+
documentType1.setAutoProcessYn(false);
97+
98+
DocumentType documentType2 = new DocumentType();
99+
documentType2.setDocumentTypeCd(DOCUMENT_TYPE_OTHER_CD);
100+
documentType2.setDocumentTypeDesc(DESCRIPTION);
101+
documentType2.setDefaultStatutoryFee(BigDecimal.TEN);
102+
documentType2.setOrderDocumentYn(true);
103+
documentType2.setRushRequiredYn(true);
104+
documentType2.setAutoProcessYn(false);
105+
106+
return Arrays.asList(documentType1, documentType2);
107+
108+
}
109+
110+
90111
}

0 commit comments

Comments
 (0)