From 10b8e0de53989e5661ff29cd92c7f69423220fdc Mon Sep 17 00:00:00 2001 From: Pahansith Gunathilake Date: Fri, 26 Nov 2021 23:03:57 +0530 Subject: [PATCH] Fix test failures --- .../core/operation/mgt/dao/impl/CommandOperationDAOImpl.java | 1 - .../src/test/resources/sql/h2.sql | 4 ++-- .../src/test/resources/sql-files/h2.sql | 4 ++-- .../src/test/resources/sql/CreateH2TestDB.sql | 4 ++-- .../src/main/resources/dbscripts/cdm/application-mgt/h2.sql | 2 +- .../main/resources/dbscripts/cdm/application-mgt/mssql.sql | 2 +- .../resources/dbscripts/cdm/application-mgt/postgresql.sql | 2 +- .../src/main/resources/dbscripts/cdm/archival/mysql.sql | 4 ++-- .../src/main/resources/dbscripts/cdm/h2.sql | 4 ++-- .../src/main/resources/dbscripts/cdm/mssql.sql | 4 ++-- .../src/main/resources/dbscripts/cdm/oracle.sql | 4 ++-- .../src/main/resources/dbscripts/cdm/postgresql.sql | 2 +- 12 files changed, 18 insertions(+), 19 deletions(-) diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/impl/CommandOperationDAOImpl.java b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/impl/CommandOperationDAOImpl.java index badb2238963..c96e20c4f17 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/impl/CommandOperationDAOImpl.java +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/main/java/org/wso2/carbon/device/mgt/core/operation/mgt/dao/impl/CommandOperationDAOImpl.java @@ -50,7 +50,6 @@ public class CommandOperationDAOImpl extends GenericOperationDAOImpl { stmt = connection.prepareStatement(sql, new String[]{"id"}); stmt.setString(1, operation.getType().toString()); stmt.setLong(2, DeviceManagementDAOUtil.getCurrentUTCTime()); - log.info("------Time----- " + DeviceManagementDAOUtil.getCurrentUTCTime()); stmt.setLong(3, 0); stmt.setString(4, operation.getCode()); stmt.setString(5, operation.getInitiatedBy()); diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/resources/sql/h2.sql b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/resources/sql/h2.sql index 2c846cb1af6..cc69537e903 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/resources/sql/h2.sql +++ b/components/device-mgt/org.wso2.carbon.device.mgt.core/src/test/resources/sql/h2.sql @@ -75,8 +75,8 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_GROUP_MAP ( CREATE TABLE IF NOT EXISTS DM_OPERATION ( ID INTEGER AUTO_INCREMENT NOT NULL, TYPE VARCHAR(50) NOT NULL, - CREATED_TIMESTAMP TIMESTAMP NOT NULL, - RECEIVED_TIMESTAMP TIMESTAMP NULL, + CREATED_TIMESTAMP BIGINT NOT NULL, + RECEIVED_TIMESTAMP BIGINT NULL, OPERATION_CODE VARCHAR(1000) NOT NULL, INITIATED_BY VARCHAR(100) NULL, OPERATION_DETAILS BLOB DEFAULT NULL, diff --git a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/resources/sql-files/h2.sql b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/resources/sql-files/h2.sql index 7d7c1ece9cf..ef684a66851 100644 --- a/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/resources/sql-files/h2.sql +++ b/components/device-mgt/org.wso2.carbon.device.mgt.extensions/src/test/resources/sql-files/h2.sql @@ -65,8 +65,8 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_GROUP_MAP ( CREATE TABLE IF NOT EXISTS DM_OPERATION ( ID INTEGER AUTO_INCREMENT NOT NULL, TYPE VARCHAR(50) NOT NULL, - CREATED_TIMESTAMP TIMESTAMP NOT NULL, - RECEIVED_TIMESTAMP TIMESTAMP NULL, + CREATED_TIMESTAMP BIGINT NOT NULL, + RECEIVED_TIMESTAMP BIGINT NULL, OPERATION_CODE VARCHAR(1000) NOT NULL, PRIMARY KEY (ID) ); diff --git a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/test/resources/sql/CreateH2TestDB.sql b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/test/resources/sql/CreateH2TestDB.sql index 7238d37790e..4c59adb953d 100644 --- a/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/test/resources/sql/CreateH2TestDB.sql +++ b/components/policy-mgt/org.wso2.carbon.policy.mgt.core/src/test/resources/sql/CreateH2TestDB.sql @@ -83,8 +83,8 @@ DROP TABLE IF EXISTS DM_OPERATION; CREATE TABLE IF NOT EXISTS DM_OPERATION ( ID INTEGER AUTO_INCREMENT NOT NULL, TYPE VARCHAR(50) NOT NULL, - CREATED_TIMESTAMP TIMESTAMP NOT NULL, - RECEIVED_TIMESTAMP TIMESTAMP NULL, + CREATED_TIMESTAMP BIGINT NOT NULL, + RECEIVED_TIMESTAMP BIGINT NULL, OPERATION_CODE VARCHAR(1000) NOT NULL, INITIATED_BY VARCHAR(100) NULL, OPERATION_DETAILS BLOB DEFAULT NULL, diff --git a/features/application-mgt/org.wso2.carbon.device.application.mgt.server.feature/src/main/resources/dbscripts/cdm/application-mgt/h2.sql b/features/application-mgt/org.wso2.carbon.device.application.mgt.server.feature/src/main/resources/dbscripts/cdm/application-mgt/h2.sql index dcbebd74b45..150480f68df 100644 --- a/features/application-mgt/org.wso2.carbon.device.application.mgt.server.feature/src/main/resources/dbscripts/cdm/application-mgt/h2.sql +++ b/features/application-mgt/org.wso2.carbon.device.application.mgt.server.feature/src/main/resources/dbscripts/cdm/application-mgt/h2.sql @@ -79,7 +79,7 @@ CREATE TABLE IF NOT EXISTS AP_APP_LIFECYCLE_STATE( PREVIOUS_STATE VARCHAR(45) NOT NULL, TENANT_ID INTEGER NOT NULL, UPDATED_BY VARCHAR(100) NOT NULL, - UPDATED_AT TIMESTAMP NOT NULL, + UPDATED_AT BIGINT NOT NULL, AP_APP_RELEASE_ID INTEGER NOT NULL, REASON TEXT DEFAULT NULL, PRIMARY KEY (ID), diff --git a/features/application-mgt/org.wso2.carbon.device.application.mgt.server.feature/src/main/resources/dbscripts/cdm/application-mgt/mssql.sql b/features/application-mgt/org.wso2.carbon.device.application.mgt.server.feature/src/main/resources/dbscripts/cdm/application-mgt/mssql.sql index 25fc47e38e8..5d29525a8c5 100644 --- a/features/application-mgt/org.wso2.carbon.device.application.mgt.server.feature/src/main/resources/dbscripts/cdm/application-mgt/mssql.sql +++ b/features/application-mgt/org.wso2.carbon.device.application.mgt.server.feature/src/main/resources/dbscripts/cdm/application-mgt/mssql.sql @@ -80,7 +80,7 @@ CREATE TABLE AP_APP_LIFECYCLE_STATE( PREVIOUS_STATE VARCHAR(45) NOT NULL, TENANT_ID INTEGER NOT NULL, UPDATED_BY VARCHAR(100) NOT NULL, - UPDATED_AT DATETIME2(0) NOT NULL, + UPDATED_AT BIGINT NOT NULL, AP_APP_RELEASE_ID INTEGER NOT NULL, REASON VARCHAR(max) DEFAULT NULL, PRIMARY KEY (ID), diff --git a/features/application-mgt/org.wso2.carbon.device.application.mgt.server.feature/src/main/resources/dbscripts/cdm/application-mgt/postgresql.sql b/features/application-mgt/org.wso2.carbon.device.application.mgt.server.feature/src/main/resources/dbscripts/cdm/application-mgt/postgresql.sql index d871549d896..c799b032453 100644 --- a/features/application-mgt/org.wso2.carbon.device.application.mgt.server.feature/src/main/resources/dbscripts/cdm/application-mgt/postgresql.sql +++ b/features/application-mgt/org.wso2.carbon.device.application.mgt.server.feature/src/main/resources/dbscripts/cdm/application-mgt/postgresql.sql @@ -87,7 +87,7 @@ CREATE TABLE IF NOT EXISTS AP_APP_LIFECYCLE_STATE( PREVIOUS_STATE VARCHAR(45) NOT NULL, TENANT_ID INTEGER NOT NULL, UPDATED_BY VARCHAR(100) NOT NULL, - UPDATED_AT TIMESTAMP(0) NOT NULL, + UPDATED_AT BIGINT NOT NULL, AP_APP_RELEASE_ID INTEGER NOT NULL, REASON TEXT DEFAULT NULL, PRIMARY KEY (ID), diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/archival/mysql.sql b/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/archival/mysql.sql index 659e22d110b..7854ee11815 100644 --- a/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/archival/mysql.sql +++ b/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/archival/mysql.sql @@ -2,8 +2,8 @@ CREATE TABLE IF NOT EXISTS DM_OPERATION_ARCH ( ID INTEGER NOT NULL, TYPE VARCHAR(20) NOT NULL, - CREATED_TIMESTAMP TIMESTAMP NOT NULL, - RECEIVED_TIMESTAMP TIMESTAMP NULL, + CREATED_TIMESTAMP BIGINT NOT NULL, + RECEIVED_TIMESTAMP BIGINT NULL, OPERATION_CODE VARCHAR(50) NOT NULL, INITIATED_BY VARCHAR(100) NULL, OPERATION_DETAILS BLOB DEFAULT NULL, diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/h2.sql b/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/h2.sql index f6894eb4ac1..ed9ce41c7dc 100644 --- a/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/h2.sql +++ b/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/h2.sql @@ -84,8 +84,8 @@ CREATE TABLE IF NOT EXISTS DM_DEVICE_GROUP_MAP ( CREATE TABLE IF NOT EXISTS DM_OPERATION ( ID INTEGER AUTO_INCREMENT NOT NULL, TYPE VARCHAR(50) NOT NULL, - CREATED_TIMESTAMP TIMESTAMP NOT NULL, - RECEIVED_TIMESTAMP TIMESTAMP NULL, + CREATED_TIMESTAMP BIGINT NOT NULL, + RECEIVED_TIMESTAMP BIGINT NULL, OPERATION_CODE VARCHAR(1000) NOT NULL, INITIATED_BY VARCHAR(100) NULL, OPERATION_DETAILS BLOB DEFAULT NULL, diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/mssql.sql b/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/mssql.sql index c27f8914452..f0cbcf24583 100644 --- a/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/mssql.sql +++ b/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/mssql.sql @@ -111,8 +111,8 @@ IF NOT EXISTS (SELECT * FROM SYS.OBJECTS WHERE OBJECT_ID = OBJECT_ID(N'[DBO].[D CREATE TABLE DM_OPERATION ( ID INTEGER IDENTITY(1,1) NOT NULL, TYPE VARCHAR(20) NOT NULL, - CREATED_TIMESTAMP DATETIME2 NOT NULL, - RECEIVED_TIMESTAMP DATETIME2 NULL, + CREATED_TIMESTAMP BIGINT NOT NULL, + RECEIVED_TIMESTAMP BIGINT NULL, OPERATION_CODE VARCHAR(50) NOT NULL, INITIATED_BY VARCHAR(100) NULL, OPERATION_DETAILS VARBINARY(MAX) DEFAULT NULL, diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/oracle.sql b/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/oracle.sql index e2e4693bd23..00adba35005 100644 --- a/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/oracle.sql +++ b/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/oracle.sql @@ -173,8 +173,8 @@ WHEN (NEW.ID IS NULL) CREATE TABLE DM_OPERATION ( ID NUMBER(10) NOT NULL, TYPE VARCHAR2(50) NOT NULL, - CREATED_TIMESTAMP TIMESTAMP(0) NOT NULL, - RECEIVED_TIMESTAMP TIMESTAMP(0) NULL, + CREATED_TIMESTAMP BIGINT NOT NULL, + RECEIVED_TIMESTAMP BIGINT NULL, OPERATION_CODE VARCHAR2(1000) NOT NULL, INITIATED_BY VARCHAR2(100) NULL, ENABLED NUMBER(10) DEFAULT 0 NOT NULL, diff --git a/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/postgresql.sql b/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/postgresql.sql index bd8eb8771ac..d2537af3a88 100644 --- a/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/postgresql.sql +++ b/features/device-mgt/org.wso2.carbon.device.mgt.basics.feature/src/main/resources/dbscripts/cdm/postgresql.sql @@ -93,7 +93,7 @@ CREATE SEQUENCE DM_OPERATION_seq; CREATE TABLE IF NOT EXISTS DM_OPERATION ( ID INTEGER DEFAULT NEXTVAL ('DM_OPERATION_seq') NOT NULL, TYPE VARCHAR(20) NOT NULL, - CREATED_TIMESTAMP TIMESTAMP(0) NOT NULL, + CREATED_TIMESTAMP NOT NULL, RECEIVED_TIMESTAMP TIMESTAMP(0) NULL, OPERATION_CODE VARCHAR(50) NOT NULL, INITIATED_BY VARCHAR(100) NULL,