-
Notifications
You must be signed in to change notification settings - Fork 10
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
add DeviceInfo and Location for the android Device. update DB structure.
- Loading branch information
Showing
35 changed files
with
592 additions
and
155 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -30,30 +30,39 @@ CommandLineRunner initDatabase(AuthDatabaseSpringManager authDatabaseSpringManag | |
authDatabaseSpringManager.addUser(adminUser); | ||
} | ||
|
||
// add login entry | ||
User adminUser2 = new User("[email protected]", "00000000", true); | ||
if (!authDatabaseSpringManager.isUserPresent(adminUser2.getEmail())) { | ||
authDatabaseSpringManager.addUser(adminUser2); | ||
} | ||
|
||
|
||
// test | ||
User user = new User(RandomStringGenerator.generateAlphanumericString(4) + "@example.com", "00000000", false); | ||
User user1 = new User("[email protected]", "00000000", false); | ||
authDatabaseSpringManager.addUser(user); | ||
authDatabaseSpringManager.removeUser(user.getEmail()); | ||
authDatabaseSpringManager.addUser(user1); | ||
if(!authDatabaseSpringManager.isUserPresent(user1.getEmail())) { | ||
authDatabaseSpringManager.addUser(user1); | ||
} | ||
// user1 will be deleted later in RMC test phase | ||
|
||
|
||
Device device = new Device(RandomStringGenerator.generateAlphanumericString(4), "43.34.43.34", "40", "20-10-18", "ckeroivervioeon", "[email protected]", "", "","iid","loc"); | ||
Device device1 = new Device(RandomStringGenerator.generateAlphanumericString(4), "43.34.43.34", "40", "20-10-18", "ckeroivervioeon", "[email protected]", "", "","iid","loc"); | ||
User u1 = authDatabaseSpringManager.findUserByEmail("[email protected]"); | ||
User u2 = authDatabaseSpringManager.findUserByEmail("[email protected]"); | ||
Device device = new Device(RandomStringGenerator.generateAlphanumericString(4), "43.34.43.34", "40", "20-10-18", "ckeroivervioeon", u1, "", "", "iid", null, null); | ||
Device device1 = new Device(RandomStringGenerator.generateAlphanumericString(4), "43.34.43.34", "40", "20-10-18", "ckeroivervioeon", u2, "", "", "iid", null, null); | ||
deviceDatabaseSpringManager.addDevice(device); | ||
deviceDatabaseSpringManager.addDevice(device1); | ||
deviceDatabaseSpringManager.removeDevice(device.getName()); | ||
deviceDatabaseSpringManager.removeDevice(device1.getName()); | ||
|
||
Rmc rmc = new Rmc(adminUser.getEmail(), "test_rmc_ID"); | ||
Rmc rmc2 = new Rmc("[email protected]", "test_rmc_ID" + RandomStringGenerator.generateAlphanumericString(4)); | ||
Rmc rmc = new Rmc(u1, "test_rmc_ID"); | ||
Rmc rmc2 = new Rmc(u2, "test_rmc_ID" + RandomStringGenerator.generateAlphanumericString(4)); | ||
|
||
rmcDatabaseSpringManager.addRMC(rmc); | ||
rmcDatabaseSpringManager.addRMC(rmc2); | ||
|
||
authDatabaseSpringManager.removeUser(rmc.getAssociatedUser()); | ||
authDatabaseSpringManager.removeUser(rmc.getAssociatedUser().getEmail()); | ||
assert rmcDatabaseSpringManager.checkRmc(rmc.getRmcId()); | ||
authDatabaseSpringManager.removeUser(user1.getEmail()); | ||
assert rmcDatabaseSpringManager.checkRmc(rmc2.getRmcId()); | ||
|
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
14 changes: 14 additions & 0 deletions
14
src/main/java/it/richkmeli/rms/data/entity/device/DeviceInfoRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package it.richkmeli.rms.data.entity.device; | ||
|
||
import it.richkmeli.rms.data.entity.device.model.Device; | ||
import it.richkmeli.rms.data.entity.device.model.DeviceInfo; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import org.springframework.stereotype.Repository; | ||
|
||
import java.util.List; | ||
|
||
|
||
@Repository | ||
public interface DeviceInfoRepository extends JpaRepository<DeviceInfo, String> { | ||
|
||
} |
7 changes: 7 additions & 0 deletions
7
src/main/java/it/richkmeli/rms/data/entity/device/DeviceRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,14 +1,21 @@ | ||
package it.richkmeli.rms.data.entity.device; | ||
|
||
import it.richkmeli.rms.data.entity.device.model.Device; | ||
import it.richkmeli.rms.data.entity.device.model.Location; | ||
import it.richkmeli.rms.data.entity.user.model.User; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import org.springframework.stereotype.Repository; | ||
|
||
import java.util.List; | ||
import java.util.Locale; | ||
|
||
|
||
@Repository | ||
public interface DeviceRepository extends JpaRepository<Device, String> { | ||
|
||
List<Device> findDevicesByAssociatedUser_Email(String email); | ||
|
||
boolean existsDeviceByName(String name); | ||
void deleteDeviceByName(String name); | ||
Device findDeviceByName(String name); | ||
} |
14 changes: 14 additions & 0 deletions
14
src/main/java/it/richkmeli/rms/data/entity/device/LocationRepository.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
package it.richkmeli.rms.data.entity.device; | ||
|
||
import it.richkmeli.rms.data.entity.device.model.Device; | ||
import it.richkmeli.rms.data.entity.device.model.Location; | ||
import org.springframework.data.jpa.repository.JpaRepository; | ||
import org.springframework.stereotype.Repository; | ||
|
||
import java.util.List; | ||
|
||
|
||
@Repository | ||
public interface LocationRepository extends JpaRepository<Location, String> { | ||
|
||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.