Modify method names

Thameera 10 months ago
parent 933ab53e81
commit 6e44783996

@ -65,7 +65,7 @@ public class OperationTemplateCacheLoader extends CacheLoader<String, OperationT
} }
try { try {
ConnectionManagerUtils.openDBConnection(); ConnectionManagerUtils.openDBConnection();
return operationTemplateDAO.getOperationTemplateByDeviceTypeAndSubTypeIdAndOperationCode(deviceType, subTypeId, operationCode); return operationTemplateDAO.getOperationTemplate(deviceType, subTypeId, operationCode);
} catch (DBConnectionException e) { } catch (DBConnectionException e) {
String msg = String msg =
"Error occurred while obtaining the database connection to retrieve operation template for " "Error occurred while obtaining the database connection to retrieve operation template for "

@ -30,7 +30,6 @@ import io.entgra.device.mgt.core.operation.template.util.ConnectionManagerUtils;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import java.util.List;
import java.util.Set; import java.util.Set;
/** /**
@ -65,7 +64,7 @@ public class OperationTemplateCodesCacheLoader extends CacheLoader<String, Set<S
} }
try { try {
ConnectionManagerUtils.openDBConnection(); ConnectionManagerUtils.openDBConnection();
return operationTemplateDAO.getOperationTemplateCodesByDeviceTypeAndSubTypeId(deviceType, subTypeId); return operationTemplateDAO.getOperationTemplateCodes(deviceType, subTypeId);
} catch (DBConnectionException e) { } catch (DBConnectionException e) {
String msg = String msg =
"Error occurred while obtaining the database connection to retrieve operation template codes for " "Error occurred while obtaining the database connection to retrieve operation template codes for "

@ -34,11 +34,11 @@ public interface OperationTemplateDAO {
OperationTemplate updateOperationTemplate(OperationTemplate operationTemplate) OperationTemplate updateOperationTemplate(OperationTemplate operationTemplate)
throws OperationTemplateManagementDAOException; throws OperationTemplateManagementDAOException;
OperationTemplate getOperationTemplateByDeviceTypeAndSubTypeIdAndOperationCode(String deviceType, String subTypeId, String operationCode) throws OperationTemplateManagementDAOException; OperationTemplate getOperationTemplate(String deviceType, String subTypeId, String operationCode) throws OperationTemplateManagementDAOException;
List<OperationTemplate> getAllOperationTemplatesByDeviceType(String deviceType) throws OperationTemplateManagementDAOException; List<OperationTemplate> getAllOperationTemplates(String deviceType) throws OperationTemplateManagementDAOException;
int deleteOperationTemplateByDeviceTypeAndSubTypeIdAndOperationCode(String deviceType, String subTypeId, String operationCode) throws OperationTemplateManagementDAOException; boolean deleteOperationTemplate(String deviceType, String subTypeId, String operationCode) throws OperationTemplateManagementDAOException;
Set<String> getOperationTemplateCodesByDeviceTypeAndSubTypeId(String deviceType, String subTypeId) throws OperationTemplateManagementDAOException; Set<String> getOperationTemplateCodes(String deviceType, String subTypeId) throws OperationTemplateManagementDAOException;
} }

@ -106,7 +106,7 @@ public class OperationTemplateDAOImpl implements OperationTemplateDAO {
stmt.setString(5, operationTemplate.getCode()); stmt.setString(5, operationTemplate.getCode());
stmt.executeUpdate(); stmt.executeUpdate();
return getOperationTemplateByDeviceTypeAndSubTypeIdAndOperationCode(operationTemplate.getDeviceType(), operationTemplate.getSubTypeId(), operationTemplate.getCode()); return getOperationTemplate(operationTemplate.getDeviceType(), operationTemplate.getSubTypeId(), operationTemplate.getCode());
} catch (SQLException e) { } catch (SQLException e) {
String msg = "Error occurred while processing update operation template."; String msg = "Error occurred while processing update operation template.";
log.error(msg); log.error(msg);
@ -126,7 +126,7 @@ public class OperationTemplateDAOImpl implements OperationTemplateDAO {
* @throws OperationTemplateManagementDAOException * @throws OperationTemplateManagementDAOException
*/ */
@Override @Override
public OperationTemplate getOperationTemplateByDeviceTypeAndSubTypeIdAndOperationCode(String deviceType, String subTypeId, String operationCode) public OperationTemplate getOperationTemplate(String deviceType, String subTypeId, String operationCode)
throws OperationTemplateManagementDAOException { throws OperationTemplateManagementDAOException {
try { try {
String sql = "SELECT * FROM SUB_OPERATION_TEMPLATE WHERE DEVICE_TYPE = ? AND SUB_TYPE_ID = ? AND OPERATION_CODE = ?"; String sql = "SELECT * FROM SUB_OPERATION_TEMPLATE WHERE DEVICE_TYPE = ? AND SUB_TYPE_ID = ? AND OPERATION_CODE = ?";
@ -161,7 +161,7 @@ public class OperationTemplateDAOImpl implements OperationTemplateDAO {
* @throws OperationTemplateManagementDAOException * @throws OperationTemplateManagementDAOException
*/ */
@Override @Override
public Set<String> getOperationTemplateCodesByDeviceTypeAndSubTypeId(String deviceType, String subTypeId) public Set<String> getOperationTemplateCodes(String deviceType, String subTypeId)
throws OperationTemplateManagementDAOException { throws OperationTemplateManagementDAOException {
try { try {
@ -198,7 +198,7 @@ public class OperationTemplateDAOImpl implements OperationTemplateDAO {
* @throws OperationTemplateManagementDAOException * @throws OperationTemplateManagementDAOException
*/ */
@Override @Override
public List<OperationTemplate> getAllOperationTemplatesByDeviceType(String deviceType) public List<OperationTemplate> getAllOperationTemplates(String deviceType)
throws OperationTemplateManagementDAOException { throws OperationTemplateManagementDAOException {
try { try {
@ -233,7 +233,7 @@ public class OperationTemplateDAOImpl implements OperationTemplateDAO {
* @throws OperationTemplateManagementDAOException * @throws OperationTemplateManagementDAOException
*/ */
@Override @Override
public int deleteOperationTemplateByDeviceTypeAndSubTypeIdAndOperationCode(String deviceType, String subTypeId, String operationCode) public boolean deleteOperationTemplate(String deviceType, String subTypeId, String operationCode)
throws OperationTemplateManagementDAOException { throws OperationTemplateManagementDAOException {
String sql = "DELETE FROM SUB_OPERATION_TEMPLATE WHERE DEVICE_TYPE = ? AND SUB_TYPE_ID = ? AND OPERATION_CODE = ?"; String sql = "DELETE FROM SUB_OPERATION_TEMPLATE WHERE DEVICE_TYPE = ? AND SUB_TYPE_ID = ? AND OPERATION_CODE = ?";
try { try {
@ -242,7 +242,7 @@ public class OperationTemplateDAOImpl implements OperationTemplateDAO {
stmt.setString(1, deviceType); stmt.setString(1, deviceType);
stmt.setString(2, subTypeId); stmt.setString(2, subTypeId);
stmt.setString(3, operationCode); stmt.setString(3, operationCode);
return stmt.executeUpdate(); return stmt.executeUpdate() == 1;
} catch (SQLException e) { } catch (SQLException e) {
String msg = "Error occurred while deleting operation template for sub type id : " + subTypeId String msg = "Error occurred while deleting operation template for sub type id : " + subTypeId
+ " and operation code : " + operationCode; + " and operation code : " + operationCode;

@ -36,7 +36,6 @@ import io.entgra.device.mgt.core.operation.template.util.AssertUtils;
import org.apache.commons.logging.Log; import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory; import org.apache.commons.logging.LogFactory;
import java.util.ArrayList;
import java.util.HashSet; import java.util.HashSet;
import java.util.List; import java.util.List;
import java.util.Set; import java.util.Set;
@ -110,7 +109,7 @@ public class OperationTemplateServiceImpl implements OperationTemplateService {
} }
} }
public void deleteOperationTemplateDetailsForCacheLoader(String deviceType, String subTypeId, String code) { public void deleteOperationTemplateDetailsFromCacheLoader(String deviceType, String subTypeId, String code) {
try { try {
String operationTemplateKey = OperationTemplateManagementUtil.setOperationTemplateCacheKey( String operationTemplateKey = OperationTemplateManagementUtil.setOperationTemplateCacheKey(
deviceType, subTypeId, code); deviceType, subTypeId, code);
@ -124,7 +123,7 @@ public class OperationTemplateServiceImpl implements OperationTemplateService {
} }
} }
public void refreshOperationTemplateDetailsForCacheLoader(OperationTemplate operationTemplate) { public void refreshOperationTemplateDetailsFromCacheLoader(OperationTemplate operationTemplate) {
try { try {
if (operationTemplate != null) { if (operationTemplate != null) {
String operationTemplateKey = OperationTemplateManagementUtil.setOperationTemplateCacheKey(operationTemplate.getDeviceType(), String operationTemplateKey = OperationTemplateManagementUtil.setOperationTemplateCacheKey(operationTemplate.getDeviceType(),
@ -174,7 +173,9 @@ public class OperationTemplateServiceImpl implements OperationTemplateService {
throw new OperationTemplateMgtPluginException(e.getMessage(), e); throw new OperationTemplateMgtPluginException(e.getMessage(), e);
} finally { } finally {
ConnectionManagerUtils.closeDBConnection(); ConnectionManagerUtils.closeDBConnection();
refreshOperationTemplateDetailsForCacheLoader(updatedOperationTemplate); if (updatedOperationTemplate != null) {
refreshOperationTemplateDetailsFromCacheLoader(updatedOperationTemplate);
}
} }
} }
@ -186,7 +187,7 @@ public class OperationTemplateServiceImpl implements OperationTemplateService {
* @throws OperationTemplateMgtPluginException * @throws OperationTemplateMgtPluginException
*/ */
@Override @Override
public OperationTemplate getOperationTemplateByDeviceTypeAndSubTypeIdAndOperationCode(String deviceType, String subTypeId, String operationCode) public OperationTemplate getOperationTemplate(String deviceType, String subTypeId, String operationCode)
throws OperationTemplateMgtPluginException { throws OperationTemplateMgtPluginException {
try { try {
@ -211,12 +212,12 @@ public class OperationTemplateServiceImpl implements OperationTemplateService {
* @throws OperationTemplateMgtPluginException * @throws OperationTemplateMgtPluginException
*/ */
@Override @Override
public List<OperationTemplate> getAllOperationTemplatesByDeviceType(String deviceType) public List<OperationTemplate> getAllOperationTemplates(String deviceType)
throws OperationTemplateMgtPluginException { throws OperationTemplateMgtPluginException {
AssertUtils.hasText(deviceType, "Invalid device type."); AssertUtils.hasText(deviceType, "Invalid device type.");
try { try {
ConnectionManagerUtils.openDBConnection(); ConnectionManagerUtils.openDBConnection();
return operationTemplateDAO.getAllOperationTemplatesByDeviceType(deviceType); return operationTemplateDAO.getAllOperationTemplates(deviceType);
} catch (DBConnectionException | OperationTemplateManagementDAOException e) { } catch (DBConnectionException | OperationTemplateManagementDAOException e) {
log.error(e.getMessage()); log.error(e.getMessage());
throw new OperationTemplateMgtPluginException(e.getMessage(), e); throw new OperationTemplateMgtPluginException(e.getMessage(), e);
@ -233,18 +234,18 @@ public class OperationTemplateServiceImpl implements OperationTemplateService {
* @throws OperationTemplateMgtPluginException * @throws OperationTemplateMgtPluginException
*/ */
@Override @Override
public void deleteOperationTemplateByDeviceTypeAndSubTypeIdAndOperationCode(String deviceType, String subTypeId, String operationCode) public void deleteOperationTemplate(String deviceType, String subTypeId, String operationCode)
throws OperationTemplateMgtPluginException { throws OperationTemplateMgtPluginException {
String msg = "Operation Template does not exist for subtype id : " + subTypeId String msg = "Operation Template does not exist for subtype id : " + subTypeId
+ " and device type : " + deviceType + " and operation code : " + " and device type : " + deviceType + " and operation code : "
+ operationCode; + operationCode;
AssertUtils.isNull(getOperationTemplateByDeviceTypeAndSubTypeIdAndOperationCode(deviceType, subTypeId, operationCode), msg); AssertUtils.isNull(getOperationTemplate(deviceType, subTypeId, operationCode), msg);
int deleted = 0; boolean isDelete = false;
try { try {
ConnectionManagerUtils.beginDBTransaction(); ConnectionManagerUtils.beginDBTransaction();
deleted = operationTemplateDAO.deleteOperationTemplateByDeviceTypeAndSubTypeIdAndOperationCode(deviceType, subTypeId, operationCode); isDelete = operationTemplateDAO.deleteOperationTemplate(deviceType, subTypeId, operationCode);
ConnectionManagerUtils.commitDBTransaction(); ConnectionManagerUtils.commitDBTransaction();
if (log.isDebugEnabled()) { if (log.isDebugEnabled()) {
String debugMsg = "Operation Template deleted successfully,for subtype id " String debugMsg = "Operation Template deleted successfully,for subtype id "
@ -257,8 +258,8 @@ public class OperationTemplateServiceImpl implements OperationTemplateService {
throw new OperationTemplateMgtPluginException(e.getMessage(), e); throw new OperationTemplateMgtPluginException(e.getMessage(), e);
} finally { } finally {
ConnectionManagerUtils.closeDBConnection(); ConnectionManagerUtils.closeDBConnection();
if (deleted == 1) { if (isDelete) {
deleteOperationTemplateDetailsForCacheLoader(deviceType, subTypeId, operationCode); deleteOperationTemplateDetailsFromCacheLoader(deviceType, subTypeId, operationCode);
} }
} }
@ -271,7 +272,7 @@ public class OperationTemplateServiceImpl implements OperationTemplateService {
* @throws OperationTemplateMgtPluginException * @throws OperationTemplateMgtPluginException
*/ */
@Override @Override
public Set<String> getOperationTemplateCodesByDeviceTypeAndSubTypeId(String deviceType, String subTypeId) public Set<String> getOperationTemplateCodes(String deviceType, String subTypeId)
throws OperationTemplateMgtPluginException { throws OperationTemplateMgtPluginException {
try { try {
@ -321,7 +322,7 @@ public class OperationTemplateServiceImpl implements OperationTemplateService {
String msg = "Operation Template already exist for subtype id : " + operationTemplate.getSubTypeId() String msg = "Operation Template already exist for subtype id : " + operationTemplate.getSubTypeId()
+ " and device type : " + operationTemplate.getDeviceType() + " and operation code : " + " and device type : " + operationTemplate.getDeviceType() + " and operation code : "
+ operationTemplate.getCode(); + operationTemplate.getCode();
AssertUtils.notNull(getOperationTemplateByDeviceTypeAndSubTypeIdAndOperationCode(operationTemplate.getDeviceType(), operationTemplate.getSubTypeId(), AssertUtils.notNull(getOperationTemplate(operationTemplate.getDeviceType(), operationTemplate.getSubTypeId(),
operationTemplate.getCode()), msg); operationTemplate.getCode()), msg);
} }
@ -337,7 +338,7 @@ public class OperationTemplateServiceImpl implements OperationTemplateService {
String msg = "Operation Template does not exist for subtype id : " + operationTemplate.getSubTypeId() String msg = "Operation Template does not exist for subtype id : " + operationTemplate.getSubTypeId()
+ " and device type : " + operationTemplate.getDeviceType() + " and operation code : " + " and device type : " + operationTemplate.getDeviceType() + " and operation code : "
+ operationTemplate.getCode(); + operationTemplate.getCode();
AssertUtils.isNull(getOperationTemplateByDeviceTypeAndSubTypeIdAndOperationCode(operationTemplate.getDeviceType(), operationTemplate.getSubTypeId(), AssertUtils.isNull(getOperationTemplate(operationTemplate.getDeviceType(), operationTemplate.getSubTypeId(),
operationTemplate.getCode()), msg); operationTemplate.getCode()), msg);
} }

@ -33,11 +33,11 @@ public interface OperationTemplateService {
OperationTemplate updateOperationTemplate(OperationTemplate operationTemplate) throws OperationTemplateMgtPluginException; OperationTemplate updateOperationTemplate(OperationTemplate operationTemplate) throws OperationTemplateMgtPluginException;
OperationTemplate getOperationTemplateByDeviceTypeAndSubTypeIdAndOperationCode(String deviceType, String subTypeId, String operationCode) throws OperationTemplateMgtPluginException; OperationTemplate getOperationTemplate(String deviceType, String subTypeId, String operationCode) throws OperationTemplateMgtPluginException;
List<OperationTemplate> getAllOperationTemplatesByDeviceType(String deviceType) throws OperationTemplateMgtPluginException; List<OperationTemplate> getAllOperationTemplates(String deviceType) throws OperationTemplateMgtPluginException;
void deleteOperationTemplateByDeviceTypeAndSubTypeIdAndOperationCode(String deviceType, String subTypeId, String operationCode) throws OperationTemplateMgtPluginException; void deleteOperationTemplate(String deviceType, String subTypeId, String operationCode) throws OperationTemplateMgtPluginException;
Set<String> getOperationTemplateCodesByDeviceTypeAndSubTypeId(String deviceType, String subTypeId) throws OperationTemplateMgtPluginException; Set<String> getOperationTemplateCodes(String deviceType, String subTypeId) throws OperationTemplateMgtPluginException;
} }

@ -48,7 +48,7 @@ public class DAOTest extends BaseOperationTemplatePluginTest {
throws DBConnectionException, OperationTemplateManagementDAOException { throws DBConnectionException, OperationTemplateManagementDAOException {
ConnectionManagerUtils.openDBConnection(); ConnectionManagerUtils.openDBConnection();
OperationTemplate operationTemplateActual = operationTemplateDAO.getOperationTemplateByDeviceTypeAndSubTypeIdAndOperationCode( OperationTemplate operationTemplateActual = operationTemplateDAO.getOperationTemplate(
TestUtils.deviceType, "4", TestUtils.operationCode); TestUtils.deviceType, "4", TestUtils.operationCode);
ConnectionManagerUtils.closeDBConnection(); ConnectionManagerUtils.closeDBConnection();
Assert.assertNotNull(operationTemplateActual, "Cannot be null"); Assert.assertNotNull(operationTemplateActual, "Cannot be null");
@ -72,7 +72,7 @@ public class DAOTest extends BaseOperationTemplatePluginTest {
operationTemplateDAO.addOperationTemplate(operationTemplate); operationTemplateDAO.addOperationTemplate(operationTemplate);
ConnectionManagerUtils.commitDBTransaction(); ConnectionManagerUtils.commitDBTransaction();
OperationTemplate operationTemplateActual = operationTemplateDAO.getOperationTemplateByDeviceTypeAndSubTypeIdAndOperationCode( OperationTemplate operationTemplateActual = operationTemplateDAO.getOperationTemplate(
TestUtils.deviceType, "4", TestUtils.operationCode); TestUtils.deviceType, "4", TestUtils.operationCode);
ConnectionManagerUtils.closeDBConnection(); ConnectionManagerUtils.closeDBConnection();
Assert.assertNotNull(operationTemplateActual, "Cannot be null"); Assert.assertNotNull(operationTemplateActual, "Cannot be null");
@ -86,7 +86,7 @@ public class DAOTest extends BaseOperationTemplatePluginTest {
throws DBConnectionException, OperationTemplateManagementDAOException { throws DBConnectionException, OperationTemplateManagementDAOException {
ConnectionManagerUtils.beginDBTransaction(); ConnectionManagerUtils.beginDBTransaction();
OperationTemplate operationTemplate = operationTemplateDAO.getOperationTemplateByDeviceTypeAndSubTypeIdAndOperationCode( OperationTemplate operationTemplate = operationTemplateDAO.getOperationTemplate(
TestUtils.deviceType, "4", TestUtils.operationCode); TestUtils.deviceType, "4", TestUtils.operationCode);
OperationTemplate operationTemplateActual = operationTemplateDAO.updateOperationTemplate( OperationTemplate operationTemplateActual = operationTemplateDAO.updateOperationTemplate(
operationTemplate); operationTemplate);

@ -46,7 +46,7 @@ public class ServiceTest extends BaseOperationTemplatePluginTest {
@Test(dependsOnMethods = "testAddOperationTemplate") @Test(dependsOnMethods = "testAddOperationTemplate")
public void testGetOperationTemplate() throws OperationTemplateMgtPluginException { public void testGetOperationTemplate() throws OperationTemplateMgtPluginException {
OperationTemplate operationTemplateActual = operationTemplateService.getOperationTemplateByDeviceTypeAndSubTypeIdAndOperationCode( OperationTemplate operationTemplateActual = operationTemplateService.getOperationTemplate(
TestUtils.deviceType, TestUtils.subtypeId, TestUtils.operationCode); TestUtils.deviceType, TestUtils.subtypeId, TestUtils.operationCode);
Assert.assertEquals(operationTemplateActual.getSubTypeId(), operationTemplateActual.getSubTypeId()); Assert.assertEquals(operationTemplateActual.getSubTypeId(), operationTemplateActual.getSubTypeId());
Assert.assertEquals(operationTemplateActual.getCode(), TestUtils.operationCode); Assert.assertEquals(operationTemplateActual.getCode(), TestUtils.operationCode);
@ -63,7 +63,7 @@ public class ServiceTest extends BaseOperationTemplatePluginTest {
operationTemplate.setOperationDefinition(TestUtils.getOperationDefinition(TestUtils.subtypeId, TestUtils.operationCode)); operationTemplate.setOperationDefinition(TestUtils.getOperationDefinition(TestUtils.subtypeId, TestUtils.operationCode));
operationTemplateService.addOperationTemplate(operationTemplate); operationTemplateService.addOperationTemplate(operationTemplate);
OperationTemplate operationTemplateActual = operationTemplateService.getOperationTemplateByDeviceTypeAndSubTypeIdAndOperationCode(TestUtils.deviceType, TestUtils.subtypeId, TestUtils.operationCode); OperationTemplate operationTemplateActual = operationTemplateService.getOperationTemplate(TestUtils.deviceType, TestUtils.subtypeId, TestUtils.operationCode);
Assert.assertNotNull(operationTemplateActual, "Cannot be null"); Assert.assertNotNull(operationTemplateActual, "Cannot be null");
Assert.assertEquals(operationTemplateActual.getOperationDefinition(), TestUtils.getOperationDefinition(TestUtils.subtypeId, TestUtils.operationCode)); Assert.assertEquals(operationTemplateActual.getOperationDefinition(), TestUtils.getOperationDefinition(TestUtils.subtypeId, TestUtils.operationCode));
Assert.assertEquals(operationTemplateActual.getSubTypeId(), operationTemplateActual.getSubTypeId()); Assert.assertEquals(operationTemplateActual.getSubTypeId(), operationTemplateActual.getSubTypeId());
@ -74,7 +74,7 @@ public class ServiceTest extends BaseOperationTemplatePluginTest {
@Test(dependsOnMethods = "testAddOperationTemplate") @Test(dependsOnMethods = "testAddOperationTemplate")
public void testUpdateOperationTemplate() throws OperationTemplateMgtPluginException { public void testUpdateOperationTemplate() throws OperationTemplateMgtPluginException {
OperationTemplate operationTemplate = operationTemplateService.getOperationTemplateByDeviceTypeAndSubTypeIdAndOperationCode(TestUtils.deviceType, TestUtils.subtypeId, TestUtils.operationCode); OperationTemplate operationTemplate = operationTemplateService.getOperationTemplate(TestUtils.deviceType, TestUtils.subtypeId, TestUtils.operationCode);
operationTemplate.setOperationDefinition("{}"); operationTemplate.setOperationDefinition("{}");
OperationTemplate operationTemplateActual = operationTemplateService.updateOperationTemplate(operationTemplate); OperationTemplate operationTemplateActual = operationTemplateService.updateOperationTemplate(operationTemplate);
@ -87,20 +87,20 @@ public class ServiceTest extends BaseOperationTemplatePluginTest {
public OperationTemplate getOperationTemplateBySubtypeIdAndDeviceTypeAndOperationCode(String deviceType, String subtypeId, String operationCode) throws OperationTemplateMgtPluginException { public OperationTemplate getOperationTemplateBySubtypeIdAndDeviceTypeAndOperationCode(String deviceType, String subtypeId, String operationCode) throws OperationTemplateMgtPluginException {
return operationTemplateService.getOperationTemplateByDeviceTypeAndSubTypeIdAndOperationCode(deviceType, subtypeId, operationCode); return operationTemplateService.getOperationTemplate(deviceType, subtypeId, operationCode);
} }
@Test(dependsOnMethods = "testAddOperationTemplate") @Test(dependsOnMethods = "testAddOperationTemplate")
public void testGetOperationTemplateCodesByDeviceTypeAndSubTypeId() throws OperationTemplateMgtPluginException { public void testGetOperationTemplateCodesByDeviceTypeAndSubTypeId() throws OperationTemplateMgtPluginException {
Set<String> operationCodes = operationTemplateService.getOperationTemplateCodesByDeviceTypeAndSubTypeId(TestUtils.deviceType, TestUtils.subtypeId); Set<String> operationCodes = operationTemplateService.getOperationTemplateCodes(TestUtils.deviceType, TestUtils.subtypeId);
Assert.assertNotNull(operationCodes, "Cannot be null"); Assert.assertNotNull(operationCodes, "Cannot be null");
} }
@Test(dependsOnMethods = "testAddOperationTemplate") @Test(dependsOnMethods = "testAddOperationTemplate")
public void testGetAllOperationTemplatesByDeviceType() throws OperationTemplateMgtPluginException { public void testGetAllOperationTemplatesByDeviceType() throws OperationTemplateMgtPluginException {
List<OperationTemplate> operationTemplates = operationTemplateService.getAllOperationTemplatesByDeviceType(TestUtils.deviceType); List<OperationTemplate> operationTemplates = operationTemplateService.getAllOperationTemplates(TestUtils.deviceType);
Assert.assertNotNull(operationTemplates, "Cannot be null"); Assert.assertNotNull(operationTemplates, "Cannot be null");
Assert.assertFalse(operationTemplates.isEmpty(), "operationTemplates is empty"); Assert.assertFalse(operationTemplates.isEmpty(), "operationTemplates is empty");
} }
@ -108,7 +108,7 @@ public class ServiceTest extends BaseOperationTemplatePluginTest {
@Test(dependsOnMethods = {"testAddOperationTemplate", "testGetOperationTemplate", "testUpdateOperationTemplate", @Test(dependsOnMethods = {"testAddOperationTemplate", "testGetOperationTemplate", "testUpdateOperationTemplate",
"testGetOperationTemplateCodesByDeviceTypeAndSubTypeId", "testGetAllOperationTemplatesByDeviceType"}) "testGetOperationTemplateCodesByDeviceTypeAndSubTypeId", "testGetAllOperationTemplatesByDeviceType"})
public void testDeleteOperationTemplate() throws OperationTemplateMgtPluginException { public void testDeleteOperationTemplate() throws OperationTemplateMgtPluginException {
operationTemplateService.deleteOperationTemplateByDeviceTypeAndSubTypeIdAndOperationCode(TestUtils.deviceType, TestUtils.subtypeId, TestUtils.operationCode); operationTemplateService.deleteOperationTemplate(TestUtils.deviceType, TestUtils.subtypeId, TestUtils.operationCode);
Assert.assertNull(getOperationTemplateBySubtypeIdAndDeviceTypeAndOperationCode(TestUtils.deviceType, TestUtils.subtypeId, TestUtils.operationCode)); Assert.assertNull(getOperationTemplateBySubtypeIdAndDeviceTypeAndOperationCode(TestUtils.deviceType, TestUtils.subtypeId, TestUtils.operationCode));
} }
} }

Loading…
Cancel
Save