diff --git a/cccm-automation-test-ui/Dockerfile b/cccm-automation-test-ui/Dockerfile
index c2a7c3ef..c55ba3a7 100644
--- a/cccm-automation-test-ui/Dockerfile
+++ b/cccm-automation-test-ui/Dockerfile
@@ -25,10 +25,10 @@ RUN wget -qO- https://packages.microsoft.com/keys/microsoft.asc | gpg --dearmor
apt-get update && \
apt-get install -y microsoft-edge-stable
-ARG PASSWORD_APP=$PASSWORD_APP
-ARG USERNAME_APP=$USERNAME_APP
-ENV USERNAME_APP=${USERNAME_APP}
-ENV PASSWORD_APP=${PASSWORD_APP}
+#ARG PASSWORD_APP=$PASSWORD_APP
+#ARG USERNAME_APP=$USERNAME_APP
+#ENV USERNAME_APP=${USERNAME_APP}
+#ENV PASSWORD_APP=${PASSWORD_APP}
# copy local jar
#COPY ./target/cccm-automation-test-jag-0.0.1-SNAPSHOT-test-jar-with-dependencies.jar .
diff --git a/cccm-automation-test-ui/cccm-automation-test-ui.iml b/cccm-automation-test-ui/cccm-automation-test-ui.iml
new file mode 100644
index 00000000..bd748078
--- /dev/null
+++ b/cccm-automation-test-ui/cccm-automation-test-ui.iml
@@ -0,0 +1,6 @@
+
+
+
+
+
+
\ No newline at end of file
diff --git a/cccm-automation-test-ui/pom.xml b/cccm-automation-test-ui/pom.xml
index cecd1c51..255f6376 100644
--- a/cccm-automation-test-ui/pom.xml
+++ b/cccm-automation-test-ui/pom.xml
@@ -8,10 +8,11 @@
CCCM-testing
+
UTF-8
5.6.3
- 4.11.0
+ 4.13.0
6.4.0.jre8
4.13.1
2.0.26
@@ -22,6 +23,7 @@
+
io.github.bonigarcia
@@ -101,6 +103,11 @@
jackson-databind
2.13.0
+
+ org.apache.commons
+ commons-lang3
+ 3.14.0
+
diff --git a/cccm-automation-test-ui/src/main/java/ca/bc/gov/open/jag/CommonMethods.java b/cccm-automation-test-ui/src/main/java/ca/bc/gov/open/jag/CommonMethods.java
index a4c25c0b..221269fd 100644
--- a/cccm-automation-test-ui/src/main/java/ca/bc/gov/open/jag/CommonMethods.java
+++ b/cccm-automation-test-ui/src/main/java/ca/bc/gov/open/jag/CommonMethods.java
@@ -10,9 +10,9 @@
import java.time.Duration;
-
public class CommonMethods {
+
private static int defaultSleepBeforeAction = 1;
private static String appUSERNAME = System.getenv("USERNAME_APP");
private static String appPASSWORD = System.getenv("PASSWORD_APP");
diff --git a/cccm-automation-test-ui/src/main/java/ca/bc/gov/open/jag/CommonUtils.java b/cccm-automation-test-ui/src/main/java/ca/bc/gov/open/jag/CommonUtils.java
index 7cd3ed14..34ffdb0e 100644
--- a/cccm-automation-test-ui/src/main/java/ca/bc/gov/open/jag/CommonUtils.java
+++ b/cccm-automation-test-ui/src/main/java/ca/bc/gov/open/jag/CommonUtils.java
@@ -28,46 +28,4 @@ public static void openLogin() throws Exception {
}
}
- // Construct jdbcUrl for Environment
- public static String getJdbcUrl() {
- String jdbcUrl = "";
- if (Config.ENVIROMENT.equals(Constants.DEV)) {
- jdbcUrl = "jdbc:oracle:thin:@devdb.bcgov:1521:devj";
- } else if (Config.ENVIROMENT.equals(Constants.TST)) {
- jdbcUrl = "jdbc:oracle:thin:@testdb.bcgov:1521:tstj";
- }
-
- String dbName = "";
-
- if (Config.ENVIROMENT.equals(Constants.DEV)) {
- dbName = "DatabaseName=";
- } else if (Config.ENVIROMENT.equals(Constants.TST)) {
- dbName = "DatabaseName=";
- }
-
- return jdbcUrl;
- }
-
- // Construct userName for Environment
- public static String getJdbcUserName() {
- String userName = "";
- if (Config.ENVIROMENT.equals(Constants.DEV)) {
- userName = "jdbcUserName.DEV";
- } else if (Config.ENVIROMENT.equals(Constants.TST)) {
- userName = "jdbcUserName.TST";
- }
- return userName;
- }
-
- // Construct password for Environment
- public static String getJdbcPassword() {
- String password = "";
- if (Config.ENVIROMENT.equals(Constants.DEV)) {
- password = "jdbcPassword.DEV";
- } else if (Config.ENVIROMENT.equals(Constants.TST)) {
- password = "jdbcPassword.TST";
- }
- return password;
- }
-
}
diff --git a/cccm-automation-test-ui/src/main/java/ca/bc/gov/open/jag/DbConnection.java b/cccm-automation-test-ui/src/main/java/ca/bc/gov/open/jag/DbConnection.java
deleted file mode 100644
index 59d782b5..00000000
--- a/cccm-automation-test-ui/src/main/java/ca/bc/gov/open/jag/DbConnection.java
+++ /dev/null
@@ -1,63 +0,0 @@
-package ca.bc.gov.open.jag;
-
-import java.io.File;
-import java.io.IOException;
-import java.sql.Connection;
-import java.sql.DriverManager;
-import java.sql.SQLException;
-import java.util.Properties;
-import java.util.logging.Logger;
-
-
-public class DbConnection {
-
- private static final Logger logger = Logger.getLogger("DbConnection");
- private static File fileUrl = new File(
- DbConnection.class.getProtectionDomain().getCodeSource().getLocation().getPath()).getParentFile();
-
- public static Connection getConnection() {
- String[] jdbc = null;
-
- try {
- jdbc = getJdbcInfo();
- Class.forName(jdbc[0]);
- } catch (ClassNotFoundException | IOException e) {
- logger.info("NO Oracle JDBC Driver found!");
- e.printStackTrace();
- }
-
- Connection connection = null;
-
- try {
- connection = DriverManager.getConnection(jdbc[1], jdbc[2], jdbc[3]);
- } catch (SQLException e) {
- logger.info("Connection Failed! Check output console");
- e.printStackTrace();
- }
- return connection;
- }
-
- public static String[] getJdbcInfo() throws IOException {
- String jdbcDriver, jdbcUrl, username, password = null;
- Properties jdbcProperties = new Properties();
- java.io.InputStream file;
-
-
- try {
- ClassLoader classloader = Thread.currentThread().getContextClassLoader();
- file = classloader.getResourceAsStream("jdbc.properties");
- jdbcProperties.load(file);
- } catch (Exception e) {
- e.printStackTrace();
- }
-
- jdbcDriver = jdbcProperties.getProperty("jdbc.driver");
- jdbcUrl = CommonUtils.getJdbcUrl();
- username = jdbcProperties.getProperty(CommonUtils.getJdbcUserName());
- password = jdbcProperties.getProperty(CommonUtils.getJdbcPassword());
- String[] jdbc = {jdbcDriver, jdbcUrl, username, password};
- return jdbc;
- }
-
-
-}
diff --git a/cccm-automation-test-ui/src/test/java/ca/bc/gov/open/jag/resources/application.properties b/cccm-automation-test-ui/src/test/java/ca/bc/gov/open/jag/resources/application.properties
index 71155244..412466f1 100644
--- a/cccm-automation-test-ui/src/test/java/ca/bc/gov/open/jag/resources/application.properties
+++ b/cccm-automation-test-ui/src/test/java/ca/bc/gov/open/jag/resources/application.properties
@@ -1,2 +1,4 @@
USERNAME_APP=${USERNAME_APP}
-PASSWORD_APP=${PASSWORD_APP}
\ No newline at end of file
+PASSWORD_APP=${PASSWORD_APP}
+BASE_URL=${BASE_URL}
+DB_CONNECTION=${DB_CONNECTION}
\ No newline at end of file
diff --git a/cccm-backend/cccm-api/src/main/java/ca/bc/gov/open/jag/api/mapper/CodeTableMapper.java b/cccm-backend/cccm-api/src/main/java/ca/bc/gov/open/jag/api/mapper/CodeTableMapper.java
index 6d5a12d3..a533e046 100644
--- a/cccm-backend/cccm-api/src/main/java/ca/bc/gov/open/jag/api/mapper/CodeTableMapper.java
+++ b/cccm-backend/cccm-api/src/main/java/ca/bc/gov/open/jag/api/mapper/CodeTableMapper.java
@@ -18,5 +18,4 @@ public interface CodeTableMapper {
@Mapping(target = "value", source = "value")
Code toCode(CodeTable codeTable);
-
}
diff --git a/cccm-backend/cccm-api/src/main/java/ca/bc/gov/open/jag/api/mapper/LocationMapper.java b/cccm-backend/cccm-api/src/main/java/ca/bc/gov/open/jag/api/mapper/LocationMapper.java
index 4c1157ae..3f26f8e3 100644
--- a/cccm-backend/cccm-api/src/main/java/ca/bc/gov/open/jag/api/mapper/LocationMapper.java
+++ b/cccm-backend/cccm-api/src/main/java/ca/bc/gov/open/jag/api/mapper/LocationMapper.java
@@ -1,8 +1,11 @@
package ca.bc.gov.open.jag.api.mapper;
+import ca.bc.gov.open.jag.api.model.data.CodeTable;
import ca.bc.gov.open.jag.api.model.data.Location;
import ca.bc.gov.open.jag.cccm.api.openapi.model.Code;
import ca.bc.gov.open.jag.cccm.api.openapi.model.CodeList;
+import ca.bc.gov.open.jag.cccm.api.openapi.model.LocationCode;
+import ca.bc.gov.open.jag.cccm.api.openapi.model.LocationCodeList;
import org.mapstruct.Mapper;
import org.mapstruct.Mapping;
@@ -18,4 +21,12 @@ public interface LocationMapper {
@Mapping(target = "value", source = "dsc")
Code toCode(Location location);
+ @Mapping(target = "items", source = "locations")
+ LocationCodeList toLocationCodeResult(String dummyValue, List locations);
+
+ @Mapping(target = "key", source = "id")
+ @Mapping(target = "value", source = "dsc")
+ @Mapping(target = "locationTypeCode", source = "lotyCd")
+ LocationCode toLocationCode(Location location);
+
}
diff --git a/cccm-backend/cccm-api/src/main/java/ca/bc/gov/open/jag/api/service/UserDataService.java b/cccm-backend/cccm-api/src/main/java/ca/bc/gov/open/jag/api/service/UserDataService.java
index 765a62a9..17cf5661 100644
--- a/cccm-backend/cccm-api/src/main/java/ca/bc/gov/open/jag/api/service/UserDataService.java
+++ b/cccm-backend/cccm-api/src/main/java/ca/bc/gov/open/jag/api/service/UserDataService.java
@@ -8,9 +8,9 @@
public interface UserDataService {
- Code getDefaultLocation(String user);
+ LocationCode getDefaultLocation(String user);
- CodeList getLocations(String user);
+ LocationCodeList getLocations(String user);
String getOracleId(String user);
diff --git a/cccm-backend/cccm-api/src/main/java/ca/bc/gov/open/jag/api/service/UserDataServiceImpl.java b/cccm-backend/cccm-api/src/main/java/ca/bc/gov/open/jag/api/service/UserDataServiceImpl.java
index e860298b..e66ca2e1 100644
--- a/cccm-backend/cccm-api/src/main/java/ca/bc/gov/open/jag/api/service/UserDataServiceImpl.java
+++ b/cccm-backend/cccm-api/src/main/java/ca/bc/gov/open/jag/api/service/UserDataServiceImpl.java
@@ -38,7 +38,7 @@ public UserDataServiceImpl(@RestClient ObridgeClientService obridgeClientService
}
@Override
- public Code getDefaultLocation(String user) {
+ public LocationCode getDefaultLocation(String user) {
logger.debug("Default Location {}", user);
@@ -51,7 +51,7 @@ public Code getDefaultLocation(String user) {
}
@Override
- public CodeList getLocations(String user) {
+ public LocationCodeList getLocations(String user) {
logger.debug("Default Locations {}", user);
@@ -61,7 +61,7 @@ public CodeList getLocations(String user) {
logger.info("Getting Locations Code For Default Locations");
List locations = obridgeClientService.getLocations(oracleId);
- return locationMapper.toCodeResult("", locations);
+ return locationMapper.toLocationCodeResult("", locations);
}
@Override
@@ -145,13 +145,14 @@ public List getPOList(String user, BigDecimal location) {
}
- private Code getCode(String oracleId) {
+ private LocationCode getCode(String oracleId) {
Location location = obridgeClientService.getLocation(oracleId);
- Code code = new Code();
+ LocationCode code = new LocationCode();
code.setKey(location.getId().toPlainString());
code.setValue(location.getDsc());
+ code.setLocationTypeCode(location.getlotyCd());
return code;
diff --git a/cccm-backend/cccm-api/src/main/java/ca/bc/gov/open/jag/api/user/UserApiImpl.java b/cccm-backend/cccm-api/src/main/java/ca/bc/gov/open/jag/api/user/UserApiImpl.java
index 27fda67e..7451c1ae 100644
--- a/cccm-backend/cccm-api/src/main/java/ca/bc/gov/open/jag/api/user/UserApiImpl.java
+++ b/cccm-backend/cccm-api/src/main/java/ca/bc/gov/open/jag/api/user/UserApiImpl.java
@@ -2,10 +2,7 @@
import ca.bc.gov.open.jag.api.service.UserDataServiceImpl;
import ca.bc.gov.open.jag.cccm.api.openapi.UserApi;
-import ca.bc.gov.open.jag.cccm.api.openapi.model.Code;
-import ca.bc.gov.open.jag.cccm.api.openapi.model.CodeList;
-import ca.bc.gov.open.jag.cccm.api.openapi.model.LogonResult;
-import ca.bc.gov.open.jag.cccm.api.openapi.model.PO;
+import ca.bc.gov.open.jag.cccm.api.openapi.model.*;
import org.eclipse.microprofile.jwt.Claim;
import org.eclipse.microprofile.jwt.Claims;
import org.slf4j.Logger;
@@ -41,7 +38,7 @@ public LogonResult getLogon(@NotNull String locationType) {
@Override
@RolesAllowed("data-view")
- public Code getUserDefaultLocation() {
+ public LocationCode getUserDefaultLocation() {
logger.info("Default Location Request");
@@ -61,7 +58,7 @@ public String getUserId() {
@Override
@RolesAllowed("data-view")
- public CodeList getUserLocations() {
+ public LocationCodeList getUserLocations() {
logger.info("User Locations Request");
diff --git a/cccm-backend/cccm-api/src/main/resources/cccm-api.yaml b/cccm-backend/cccm-api/src/main/resources/cccm-api.yaml
index 69b83b96..a8473157 100644
--- a/cccm-backend/cccm-api/src/main/resources/cccm-api.yaml
+++ b/cccm-backend/cccm-api/src/main/resources/cccm-api.yaml
@@ -1980,7 +1980,7 @@ paths:
content:
application/json:
schema:
- $ref: '#/components/schemas/Code'
+ $ref: '#/components/schemas/LocationCode'
description: get users default location
summary: get users default location
tags:
@@ -1996,7 +1996,7 @@ paths:
content:
application/json:
schema:
- $ref: '#/components/schemas/CodeList'
+ $ref: '#/components/schemas/LocationCodeList'
description: get users locations
summary: get users locations
tags:
@@ -2651,6 +2651,20 @@ components:
type: number
dueSeven:
type: number
+ LocationCode:
+ allOf:
+ - $ref: '#/components/schemas/Code'
+ - type: object
+ properties:
+ locationTypeCode:
+ type: string
+ LocationCodeList:
+ properties:
+ items:
+ description: Code Type Results
+ items:
+ $ref: '#/components/schemas/LocationCode'
+ type: array
Code:
type: object
properties:
@@ -3069,7 +3083,7 @@ components:
type: object
properties:
defaultLocation:
- $ref: '#/components/schemas/Code'
+ $ref: '#/components/schemas/LocationCode'
locations:
$ref: '#/components/schemas/CodeList'
User:
diff --git a/cccm-backend/cccm-api/src/test/java/ca/bc/gov/open/jag/api/service/dataservice/user/GetDefaultLocationTest.java b/cccm-backend/cccm-api/src/test/java/ca/bc/gov/open/jag/api/service/dataservice/user/GetDefaultLocationTest.java
index 80fb6de1..e3ed7344 100644
--- a/cccm-backend/cccm-api/src/test/java/ca/bc/gov/open/jag/api/service/dataservice/user/GetDefaultLocationTest.java
+++ b/cccm-backend/cccm-api/src/test/java/ca/bc/gov/open/jag/api/service/dataservice/user/GetDefaultLocationTest.java
@@ -4,6 +4,7 @@
import ca.bc.gov.open.jag.api.service.ObridgeClientService;
import ca.bc.gov.open.jag.api.service.UserDataService;
import ca.bc.gov.open.jag.cccm.api.openapi.model.Code;
+import ca.bc.gov.open.jag.cccm.api.openapi.model.LocationCode;
import io.quarkus.test.junit.QuarkusTest;
import io.quarkus.test.InjectMock;
import org.eclipse.microprofile.rest.client.inject.RestClient;
@@ -37,13 +38,15 @@ public void testGetFormTypes() {
locationMock.setId(TEST_ID);
locationMock.setAlternateCd(TEST_CD);
locationMock.setDsc(TEST_VALUE);
+ locationMock.setlotyCd(TEST_VALUE);
Mockito.when(obridgeClientService.getOracleId(Mockito.any())).thenReturn(TEST_ID.toPlainString());
Mockito.when(obridgeClientService.getLocation(Mockito.any())).thenReturn(locationMock);
- Code result = sut.getDefaultLocation("test@idir");
+ LocationCode result = sut.getDefaultLocation("test@idir");
Assertions.assertEquals(TEST_ID.toPlainString(), result.getKey());
Assertions.assertEquals(TEST_VALUE, result.getValue());
+ Assertions.assertEquals(TEST_VALUE, result.getLocationTypeCode());
}
diff --git a/cccm-backend/cccm-api/src/test/java/ca/bc/gov/open/jag/api/service/dataservice/user/GetLocationsTest.java b/cccm-backend/cccm-api/src/test/java/ca/bc/gov/open/jag/api/service/dataservice/user/GetLocationsTest.java
index 217cc92d..31efcd28 100644
--- a/cccm-backend/cccm-api/src/test/java/ca/bc/gov/open/jag/api/service/dataservice/user/GetLocationsTest.java
+++ b/cccm-backend/cccm-api/src/test/java/ca/bc/gov/open/jag/api/service/dataservice/user/GetLocationsTest.java
@@ -4,6 +4,7 @@
import ca.bc.gov.open.jag.api.service.ObridgeClientService;
import ca.bc.gov.open.jag.api.service.UserDataService;
import ca.bc.gov.open.jag.cccm.api.openapi.model.CodeList;
+import ca.bc.gov.open.jag.cccm.api.openapi.model.LocationCodeList;
import io.quarkus.test.junit.QuarkusTest;
import io.quarkus.test.InjectMock;
import org.eclipse.microprofile.rest.client.inject.RestClient;
@@ -47,7 +48,7 @@ public void testGetLocations() {
Mockito.when(obridgeClientService.getOracleId(Mockito.any())).thenReturn(TEST_ID.toPlainString());
Mockito.when(obridgeClientService.getLocations(Mockito.any())).thenReturn(locationListMock);
- CodeList result = sut.getLocations("test@idir");
+ LocationCodeList result = sut.getLocations("test@idir");
Assertions.assertEquals(1, result.getItems().size());
Assertions.assertEquals(TEST_ID.toPlainString(), result.getItems().get(0).getKey());
diff --git a/cccm-backend/cccm-api/src/test/java/ca/bc/gov/open/jag/api/user/GetUserDefaultLocationTest.java b/cccm-backend/cccm-api/src/test/java/ca/bc/gov/open/jag/api/user/GetUserDefaultLocationTest.java
index 196973ac..1cbbdabd 100644
--- a/cccm-backend/cccm-api/src/test/java/ca/bc/gov/open/jag/api/user/GetUserDefaultLocationTest.java
+++ b/cccm-backend/cccm-api/src/test/java/ca/bc/gov/open/jag/api/user/GetUserDefaultLocationTest.java
@@ -1,7 +1,9 @@
package ca.bc.gov.open.jag.api.user;
+import ca.bc.gov.open.jag.api.model.data.Location;
import ca.bc.gov.open.jag.api.service.UserDataService;
import ca.bc.gov.open.jag.cccm.api.openapi.model.Code;
+import ca.bc.gov.open.jag.cccm.api.openapi.model.LocationCode;
import io.quarkus.security.ForbiddenException;
import io.quarkus.security.UnauthorizedException;
import io.quarkus.test.junit.QuarkusTest;
@@ -14,6 +16,8 @@
import jakarta.inject.Inject;
+import java.math.BigDecimal;
+
import static org.mockito.ArgumentMatchers.any;
@QuarkusTest
@@ -33,16 +37,18 @@ public class GetUserDefaultLocationTest {
@DisplayName("200: should return form types")
public void testGetUserDefaultLocationEndpoint() {
- Code location = new Code();
+ LocationCode location = new LocationCode();
location.setKey(TEST_CD);
location.setValue(TEST_VALUE);
+ location.setLocationTypeCode(TEST_CD);
Mockito.when(userDataService.getDefaultLocation(any())).thenReturn(location);
- Code result = sut.getUserDefaultLocation();
+ LocationCode result = sut.getUserDefaultLocation();
Assertions.assertEquals(TEST_CD, result.getKey());
Assertions.assertEquals(TEST_VALUE, result.getValue());
+ Assertions.assertEquals(TEST_CD, result.getLocationTypeCode());
}
diff --git a/cccm-backend/cccm-api/src/test/java/ca/bc/gov/open/jag/api/user/GetUserLocationsTest.java b/cccm-backend/cccm-api/src/test/java/ca/bc/gov/open/jag/api/user/GetUserLocationsTest.java
index 17b46490..9a2e8c37 100644
--- a/cccm-backend/cccm-api/src/test/java/ca/bc/gov/open/jag/api/user/GetUserLocationsTest.java
+++ b/cccm-backend/cccm-api/src/test/java/ca/bc/gov/open/jag/api/user/GetUserLocationsTest.java
@@ -1,8 +1,11 @@
package ca.bc.gov.open.jag.api.user;
+import ca.bc.gov.open.jag.api.model.data.Location;
import ca.bc.gov.open.jag.api.service.UserDataService;
import ca.bc.gov.open.jag.cccm.api.openapi.model.Code;
import ca.bc.gov.open.jag.cccm.api.openapi.model.CodeList;
+import ca.bc.gov.open.jag.cccm.api.openapi.model.LocationCode;
+import ca.bc.gov.open.jag.cccm.api.openapi.model.LocationCodeList;
import io.quarkus.security.ForbiddenException;
import io.quarkus.security.UnauthorizedException;
import io.quarkus.test.junit.QuarkusTest;
@@ -14,7 +17,10 @@
import org.mockito.Mockito;
import jakarta.inject.Inject;
+
+import java.math.BigDecimal;
import java.util.Collections;
+import java.util.List;
import static org.mockito.ArgumentMatchers.any;
@@ -35,20 +41,22 @@ public class GetUserLocationsTest {
@DisplayName("200: should return locations")
public void testGetUserLocationsEndpoint() {
- Code location = new Code();
+ LocationCode location = new LocationCode();
location.setKey(TEST_CD);
location.setValue(TEST_VALUE);
+ location.setLocationTypeCode(TEST_VALUE);
- CodeList codeListMock = new CodeList();
- codeListMock.setItems(Collections.singletonList(location));
+ LocationCodeList codeListMock = new LocationCodeList();
+ codeListMock.addItemsItem(location);
Mockito.when(userDataService.getLocations(any())).thenReturn(codeListMock);
- CodeList result = sut.getUserLocations();
+ LocationCodeList result = sut.getUserLocations();
Assertions.assertEquals(1, result.getItems().size());
Assertions.assertEquals(TEST_CD, result.getItems().get(0).getKey());
Assertions.assertEquals(TEST_VALUE, result.getItems().get(0).getValue());
+ Assertions.assertEquals(TEST_VALUE, result.getItems().get(0).getLocationTypeCode());
}