Skip to content

Commit

Permalink
Update Database tests
Browse files Browse the repository at this point in the history
  • Loading branch information
Abyss777 committed Jun 8, 2018
1 parent 37868cf commit 7f473f9
Showing 1 changed file with 11 additions and 11 deletions.
22 changes: 11 additions & 11 deletions test/org/traccar/database/DataManagerTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -18,11 +18,11 @@ public class DataManagerTest {

@Test
public void constructObjectQuery() {
assertEquals("SELECT * FROM users",
assertEquals("SELECT * FROM tc_users",
DataManager.constructObjectQuery(DataManager.ACTION_SELECT_ALL, User.class, false));
assertEquals("DELETE FROM groups WHERE id = :id",
assertEquals("DELETE FROM tc_groups WHERE id = :id",
DataManager.constructObjectQuery(DataManager.ACTION_DELETE, Group.class, false));
assertEquals("SELECT * FROM positions WHERE id = :id",
assertEquals("SELECT * FROM tc_positions WHERE id = :id",
DataManager.constructObjectQuery(DataManager.ACTION_SELECT, Position.class, false));

String insertDevice = DataManager.constructObjectQuery(DataManager.ACTION_INSERT, Device.class, false);
Expand Down Expand Up @@ -52,28 +52,28 @@ public void constructObjectQuery() {

@Test
public void constructPermissionsQuery() {
assertEquals("SELECT userId, deviceId FROM user_device",
assertEquals("SELECT userId, deviceId FROM tc_user_device",
DataManager.constructPermissionQuery(DataManager.ACTION_SELECT_ALL, User.class, Device.class));

assertEquals("SELECT userId, managedUserId FROM user_user",
assertEquals("SELECT userId, managedUserId FROM tc_user_user",
DataManager.constructPermissionQuery(DataManager.ACTION_SELECT_ALL, User.class, ManagedUser.class));

assertEquals("SELECT deviceId, driverId FROM device_driver",
assertEquals("SELECT deviceId, driverId FROM tc_device_driver",
DataManager.constructPermissionQuery(DataManager.ACTION_SELECT_ALL, Device.class, Driver.class));

assertEquals("SELECT groupId, geofenceId FROM group_geofence",
assertEquals("SELECT groupId, geofenceId FROM tc_group_geofence",
DataManager.constructPermissionQuery(DataManager.ACTION_SELECT_ALL, Group.class, Geofence.class));

assertEquals("INSERT INTO user_device (userId, deviceId) VALUES (:userId, :deviceId)",
assertEquals("INSERT INTO tc_user_device (userId, deviceId) VALUES (:userId, :deviceId)",
DataManager.constructPermissionQuery(DataManager.ACTION_INSERT, User.class, Device.class));

assertEquals("DELETE FROM user_user WHERE userId = :userId AND managedUserId = :managedUserId",
assertEquals("DELETE FROM tc_user_user WHERE userId = :userId AND managedUserId = :managedUserId",
DataManager.constructPermissionQuery(DataManager.ACTION_DELETE, User.class, ManagedUser.class));

assertEquals("INSERT INTO device_geofence (deviceId, geofenceId) VALUES (:deviceId, :geofenceId)",
assertEquals("INSERT INTO tc_device_geofence (deviceId, geofenceId) VALUES (:deviceId, :geofenceId)",
DataManager.constructPermissionQuery(DataManager.ACTION_INSERT, Device.class, Geofence.class));

assertEquals("DELETE FROM group_attribute WHERE groupId = :groupId AND attributeId = :attributeId",
assertEquals("DELETE FROM tc_group_attribute WHERE groupId = :groupId AND attributeId = :attributeId",
DataManager.constructPermissionQuery(DataManager.ACTION_DELETE, Group.class, Attribute.class));

}
Expand Down

0 comments on commit 7f473f9

Please sign in to comment.