|
|
@ -1,13 +1,12 @@
|
|
|
|
/*
|
|
|
|
/*
|
|
|
|
* Copyright (C) 2018 - 2023 Entgra (Pvt) Ltd, Inc - All Rights Reserved.
|
|
|
|
* Copyright (c) 2023, Entgra Pvt Ltd. (http://www.wso2.org) All Rights Reserved.
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* Unauthorised copying/redistribution of this file, via any medium is strictly prohibited.
|
|
|
|
* Entgra Pvt Ltd. licenses this file to you under the Apache License,
|
|
|
|
*
|
|
|
|
* Version 2.0 (the "License"); you may not use this file except
|
|
|
|
* Licensed under the Entgra Commercial License, Version 1.0 (the "License");
|
|
|
|
* in compliance with the License.
|
|
|
|
* you may not use this file except in compliance with the License.
|
|
|
|
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
* You may obtain a copy of the License at
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* https://entgra.io/licenses/entgra-commercial/1.0
|
|
|
|
* http://www.apache.org/licenses/LICENSE-2.0
|
|
|
|
*
|
|
|
|
*
|
|
|
|
* Unless required by applicable law or agreed to in writing,
|
|
|
|
* Unless required by applicable law or agreed to in writing,
|
|
|
|
* software distributed under the License is distributed on an
|
|
|
|
* software distributed under the License is distributed on an
|
|
|
@ -50,10 +49,10 @@ public class DAOTest extends BaseOperationTemplatePluginTest {
|
|
|
|
|
|
|
|
|
|
|
|
ConnectionManagerUtils.openDBConnection();
|
|
|
|
ConnectionManagerUtils.openDBConnection();
|
|
|
|
OperationTemplate operationTemplateActual = operationTemplateDAO.getOperationTemplate(
|
|
|
|
OperationTemplate operationTemplateActual = operationTemplateDAO.getOperationTemplate(
|
|
|
|
4, TestUtils.deviceType, TestUtils.operationCode);
|
|
|
|
"4", TestUtils.deviceType, TestUtils.operationCode);
|
|
|
|
ConnectionManagerUtils.closeDBConnection();
|
|
|
|
ConnectionManagerUtils.closeDBConnection();
|
|
|
|
Assert.assertNotNull(operationTemplateActual, "Cannot be null");
|
|
|
|
Assert.assertNotNull(operationTemplateActual, "Cannot be null");
|
|
|
|
Assert.assertEquals(operationTemplateActual.getSubTypeId(), 4);
|
|
|
|
Assert.assertEquals(operationTemplateActual.getSubTypeId(), "4");
|
|
|
|
Assert.assertEquals(operationTemplateActual.getCode(), TestUtils.operationCode);
|
|
|
|
Assert.assertEquals(operationTemplateActual.getCode(), TestUtils.operationCode);
|
|
|
|
Assert.assertEquals(operationTemplateActual.getDeviceType(), TestUtils.deviceType);
|
|
|
|
Assert.assertEquals(operationTemplateActual.getDeviceType(), TestUtils.deviceType);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -63,21 +62,21 @@ public class DAOTest extends BaseOperationTemplatePluginTest {
|
|
|
|
throws DBConnectionException, OperationTemplateManagementDAOException {
|
|
|
|
throws DBConnectionException, OperationTemplateManagementDAOException {
|
|
|
|
|
|
|
|
|
|
|
|
OperationTemplate operationTemplate = new OperationTemplate();
|
|
|
|
OperationTemplate operationTemplate = new OperationTemplate();
|
|
|
|
operationTemplate.setSubTypeId(4);
|
|
|
|
operationTemplate.setSubTypeId("4");
|
|
|
|
operationTemplate.setCode(TestUtils.operationCode);
|
|
|
|
operationTemplate.setCode(TestUtils.operationCode);
|
|
|
|
operationTemplate.setDeviceType(TestUtils.deviceType);
|
|
|
|
operationTemplate.setDeviceType(TestUtils.deviceType);
|
|
|
|
operationTemplate.setOperationDefinition(
|
|
|
|
operationTemplate.setOperationDefinition(
|
|
|
|
TestUtils.getOperationDefinition(4, TestUtils.operationCode));
|
|
|
|
TestUtils.getOperationDefinition("4", TestUtils.operationCode));
|
|
|
|
|
|
|
|
|
|
|
|
ConnectionManagerUtils.beginDBTransaction();
|
|
|
|
ConnectionManagerUtils.beginDBTransaction();
|
|
|
|
operationTemplateDAO.addOperationTemplate(operationTemplate);
|
|
|
|
operationTemplateDAO.addOperationTemplate(operationTemplate);
|
|
|
|
ConnectionManagerUtils.commitDBTransaction();
|
|
|
|
ConnectionManagerUtils.commitDBTransaction();
|
|
|
|
|
|
|
|
|
|
|
|
OperationTemplate operationTemplateActual = operationTemplateDAO.getOperationTemplate(
|
|
|
|
OperationTemplate operationTemplateActual = operationTemplateDAO.getOperationTemplate(
|
|
|
|
4, TestUtils.deviceType, TestUtils.operationCode);
|
|
|
|
"4", TestUtils.deviceType, TestUtils.operationCode);
|
|
|
|
ConnectionManagerUtils.closeDBConnection();
|
|
|
|
ConnectionManagerUtils.closeDBConnection();
|
|
|
|
Assert.assertNotNull(operationTemplateActual, "Cannot be null");
|
|
|
|
Assert.assertNotNull(operationTemplateActual, "Cannot be null");
|
|
|
|
Assert.assertEquals(operationTemplateActual.getSubTypeId(), 4);
|
|
|
|
Assert.assertEquals(operationTemplateActual.getSubTypeId(), "4");
|
|
|
|
Assert.assertEquals(operationTemplateActual.getCode(), TestUtils.operationCode);
|
|
|
|
Assert.assertEquals(operationTemplateActual.getCode(), TestUtils.operationCode);
|
|
|
|
Assert.assertEquals(operationTemplateActual.getDeviceType(), TestUtils.deviceType);
|
|
|
|
Assert.assertEquals(operationTemplateActual.getDeviceType(), TestUtils.deviceType);
|
|
|
|
}
|
|
|
|
}
|
|
|
@ -88,14 +87,14 @@ public class DAOTest extends BaseOperationTemplatePluginTest {
|
|
|
|
|
|
|
|
|
|
|
|
ConnectionManagerUtils.beginDBTransaction();
|
|
|
|
ConnectionManagerUtils.beginDBTransaction();
|
|
|
|
OperationTemplate operationTemplate = operationTemplateDAO.getOperationTemplate(
|
|
|
|
OperationTemplate operationTemplate = operationTemplateDAO.getOperationTemplate(
|
|
|
|
4, TestUtils.deviceType, TestUtils.operationCode);
|
|
|
|
"4", TestUtils.deviceType, TestUtils.operationCode);
|
|
|
|
OperationTemplate operationTemplateActual = operationTemplateDAO.updateOperationTemplate(
|
|
|
|
OperationTemplate operationTemplateActual = operationTemplateDAO.updateOperationTemplate(
|
|
|
|
operationTemplate);
|
|
|
|
operationTemplate);
|
|
|
|
ConnectionManagerUtils.commitDBTransaction();
|
|
|
|
ConnectionManagerUtils.commitDBTransaction();
|
|
|
|
ConnectionManagerUtils.closeDBConnection();
|
|
|
|
ConnectionManagerUtils.closeDBConnection();
|
|
|
|
|
|
|
|
|
|
|
|
Assert.assertNotNull(operationTemplateActual, "Cannot be null");
|
|
|
|
Assert.assertNotNull(operationTemplateActual, "Cannot be null");
|
|
|
|
Assert.assertEquals(operationTemplateActual.getSubTypeId(), 4);
|
|
|
|
Assert.assertEquals(operationTemplateActual.getSubTypeId(), "4");
|
|
|
|
Assert.assertEquals(operationTemplateActual.getCode(), TestUtils.operationCode);
|
|
|
|
Assert.assertEquals(operationTemplateActual.getCode(), TestUtils.operationCode);
|
|
|
|
Assert.assertEquals(operationTemplateActual.getDeviceType(), TestUtils.deviceType);
|
|
|
|
Assert.assertEquals(operationTemplateActual.getDeviceType(), TestUtils.deviceType);
|
|
|
|
}
|
|
|
|
}
|
|
|
|