Add missing test cases for DevicePersistTests and GroupPersistTests #408

Merged
tcdlpds merged 1 commits from pramilaniroshan/device-mgt-core:add-missing-test-cases into master 4 months ago
Collaborator
https://roadmap.entgra.net/issues/11282
pramilaniroshan added 1 commit 4 months ago
pramilaniroshan added 1 commit 4 months ago
tcdlpds requested changes 4 months ago
Device device = TestDataHolder.initialTestDevice;
try {
DeviceManagementDAOFactory.beginTransaction();
Device results = deviceDAO.getDevice(device.getDeviceIdentifier(),TestDataHolder.SUPER_TENANT_ID);
Owner

Format the source

Format the source
pramilaniroshan marked this conversation as resolved
try {
DeviceManagementDAOFactory.beginTransaction();
DeviceIdentifier deviceIdentifier = new DeviceIdentifier(device.getDeviceIdentifier(), device.getType());
Device results = deviceDAO.getDevice(deviceIdentifier,TestDataHolder.SUPER_TENANT_ID);
Owner

Format the source

Format the source
pramilaniroshan marked this conversation as resolved
DeviceIdentifier deviceIdentifier = new DeviceIdentifier(device.getDeviceIdentifier(), device.getType());
try {
DeviceManagementDAOFactory.beginTransaction();
Device results = deviceDAO.getDevice(deviceIdentifier,TestDataHolder.OWNER, TestDataHolder.SUPER_TENANT_ID);
Owner

Format the source

Format the source
pramilaniroshan marked this conversation as resolved
pr.setDeviceType(device.getType());
try {
DeviceManagementDAOFactory.beginTransaction();
List<Device> results = deviceDAO.getAppNotInstalledDevices(pr, TestDataHolder.SUPER_TENANT_ID,"com.google.calc" ,"1.0.0");
Owner

Format the source

Format the source
pramilaniroshan marked this conversation as resolved
pr.setDeviceType(device.getType());
try {
DeviceManagementDAOFactory.beginTransaction();
int results = deviceDAO.getCountOfAppNotInstalledDevices(pr, TestDataHolder.SUPER_TENANT_ID,"com.google.calc" ,"1.0.0");
Owner

Format the source

Format the source
pramilaniroshan marked this conversation as resolved
PaginationRequest pr = new PaginationRequest(0, 10);
try {
DeviceManagementDAOFactory.beginTransaction();
List<Device> results = deviceDAO.getDevicesByEncryptionStatus(pr, TestDataHolder.SUPER_TENANT_ID,false);
Owner

Format the source

Format the source
pramilaniroshan marked this conversation as resolved
public void getCountOfDevicesByEncryptionStatus() throws DeviceManagementDAOException, TransactionManagementException {
try {
DeviceManagementDAOFactory.beginTransaction();
int results = deviceDAO.getCountOfDevicesByEncryptionStatus(TestDataHolder.SUPER_TENANT_ID,true);
Owner

Format the source

Format the source
pramilaniroshan marked this conversation as resolved
GroupManagementDAOFactory.beginTransaction();
groupDAO.getAllDevicesOfGroup(deviceGroup.getName(), deviceStatus, TestDataHolder.SUPER_TENANT_ID);
GroupManagementDAOFactory.commitTransaction();
GroupManagementDAOFactory.closeConnection();
Owner

move the close connection into finally block

move the close connection into finally block
pramilaniroshan marked this conversation as resolved
GroupManagementDAOFactory.beginTransaction();
groupDAO.getAllDevicesOfGroup(deviceGroup.getName(), TestDataHolder.SUPER_TENANT_ID);
GroupManagementDAOFactory.commitTransaction();
GroupManagementDAOFactory.closeConnection();
Owner

Move the close connection into finally block. Check in catch blocks as well.

Move the close connection into finally block. Check in catch blocks as well.
pramilaniroshan marked this conversation as resolved
GroupManagementDAOFactory.beginTransaction();
groupDAO.getGroupUnassignedDevices(pr, groupNames);
GroupManagementDAOFactory.commitTransaction();
GroupManagementDAOFactory.closeConnection();
Owner

Move the close connection into finally block.

Move the close connection into finally block.
pramilaniroshan marked this conversation as resolved
GroupManagementDAOFactory.beginTransaction();
groupDAO.getOwnGroups(TestDataHolder.OWNER, TestDataHolder.SUPER_TENANT_ID);
GroupManagementDAOFactory.commitTransaction();
GroupManagementDAOFactory.closeConnection();
Owner

Move the close connection into finally block.

Move the close connection into finally block.
pramilaniroshan marked this conversation as resolved
GroupManagementDAOFactory.beginTransaction();
groupDAO.getOwnGroupIds(TestDataHolder.OWNER, TestDataHolder.SUPER_TENANT_ID);
GroupManagementDAOFactory.commitTransaction();
GroupManagementDAOFactory.closeConnection();
Owner

Move the close connection into finally block

Move the close connection into finally block
pramilaniroshan marked this conversation as resolved
GroupManagementDAOFactory.beginTransaction();
groupDAO.getDeviceCount(deviceGroup.getGroupId(), TestDataHolder.SUPER_TENANT_ID);
GroupManagementDAOFactory.commitTransaction();
GroupManagementDAOFactory.closeConnection();
Owner

Move the close connection into finally block and check all the methods in this file and do the modifications.

Move the close connection into finally block and check all the methods in this file and do the modifications.
pramilaniroshan marked this conversation as resolved
} catch (GroupManagementDAOException e) {
GroupManagementDAOFactory.rollbackTransaction();
GroupManagementDAOFactory.closeConnection();
String msg = "Error occurred while getting group count for '" +TestDataHolder.SUPER_TENANT_ID+ "'.";
Owner

Format the source

Format the source
pramilaniroshan marked this conversation as resolved
} catch (GroupManagementDAOException e) {
GroupManagementDAOFactory.rollbackTransaction();
GroupManagementDAOFactory.closeConnection();
String msg = "Error occurred while getting group count for '" +TestDataHolder.SUPER_TENANT_ID+ "'.";
Owner

Format the source

Format the source
pramilaniroshan marked this conversation as resolved
} catch (GroupManagementDAOException e) {
GroupManagementDAOFactory.rollbackTransaction();
GroupManagementDAOFactory.closeConnection();
String msg = "Error occurred while getting groups for '" +TestDataHolder.SUPER_TENANT_ID+ "'.";
Owner

Format the source

Format the source
pramilaniroshan marked this conversation as resolved
pramilaniroshan force-pushed add-missing-test-cases from 178b249c04 to d443fef6e0 4 months ago
tcdlpds merged commit e84a479c23 into master 4 months ago

Reviewers

tcdlpds requested changes 4 months ago
The pull request has been merged as e84a479c23.
Sign in to join this conversation.
No reviewers
No Milestone
No project
No Assignees
2 Participants
Notifications
Due Date

No due date set.

Dependencies

No dependencies set.

Reference: community/device-mgt-core#408
Loading…
There is no content yet.