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 badb223896..c96e20c4f1 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 2c846cb1af..cc69537e90 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 7d7c1ece9c..ef684a6685 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 7238d37790..4c59adb953 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 dcbebd74b4..150480f68d 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 25fc47e38e..5d29525a8c 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 d871549d89..c799b03245 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 659e22d110..7854ee1181 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 f6894eb4ac..ed9ce41c7d 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 c27f891445..f0cbcf2458 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 e2e4693bd2..00adba3500 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 bd8eb8771a..d2537af3a8 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,