Skip to content
Snippets Groups Projects
Commit 5808ddca authored by Lukáš Majdan's avatar Lukáš Majdan Committed by Karolína Dočkalová Burská
Browse files

Change training run allocation id type from Long to Integer

parent 1fdafaed
No related branches found
No related tags found
1 merge request!127Develop
......@@ -131,7 +131,7 @@ public class TrainingRun implements Serializable {
@Column(name = "sandbox_instance_ref_id", length = 36)
private String sandboxInstanceRefId;
@Column(name = "sandbox_instance_allocation_id")
private Long sandboxInstanceAllocationId;
private Integer sandboxInstanceAllocationId;
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "user_id", nullable = false)
private User participantRef;
......@@ -287,7 +287,7 @@ public class TrainingRun implements Serializable {
*
* @return the sandbox instance allocation id
*/
public Long getSandboxInstanceAllocationId() {
public Integer getSandboxInstanceAllocationId() {
return sandboxInstanceAllocationId;
}
......@@ -295,7 +295,7 @@ public class TrainingRun implements Serializable {
* Sets sandbox instance allocation id associated with Training run
* @param sandboxInstanceAllocationId the sandbox instance allocation id
*/
public void setSandboxInstanceAllocationId(Long sandboxInstanceAllocationId) {
public void setSandboxInstanceAllocationId(Integer sandboxInstanceAllocationId) {
this.sandboxInstanceAllocationId = sandboxInstanceAllocationId;
}
......
......@@ -32,7 +32,7 @@ public class TrainingRunDTO {
@ApiModelProperty(value = "Reference to the received sandbox.")
private String sandboxInstanceRefId;
@ApiModelProperty(value = "Allocation id to the received sandbox.")
private Long sandboxInstanceAllocationId;
private Integer sandboxInstanceAllocationId;
@ApiModelProperty(value = "Reference to participant of training run.")
private UserRefDTO participantRef;
@ApiModelProperty(value = "Boolean to check whether event logging works.", example = "true")
......@@ -135,7 +135,7 @@ public class TrainingRunDTO {
*
* @return the sandbox instance allocation id
*/
public Long getSandboxInstanceAllocationId() {
public Integer getSandboxInstanceAllocationId() {
return sandboxInstanceAllocationId;
}
......@@ -144,7 +144,7 @@ public class TrainingRunDTO {
*
* @param sandboxInstanceAllocationId the sandbox instance allocation id
*/
public void setSandboxInstanceAllocationId(Long sandboxInstanceAllocationId) {
public void setSandboxInstanceAllocationId(Integer sandboxInstanceAllocationId) {
this.sandboxInstanceAllocationId = sandboxInstanceAllocationId;
}
......
......@@ -605,8 +605,9 @@ public class TrainingRunService {
*/
public TrainingRun assignSandbox(TrainingRun trainingRun, long poolId) {
String sandboxInstanceRef = this.sandboxServiceApi.getAndLockSandboxForTrainingRun(poolId);
Long sandboxInstanceAllocationId = this.sandboxServiceApi.getAndLockSandbox(poolId).getAllocationUnitId().longValue();
Integer sandboxInstanceAllocationId = this.sandboxServiceApi.getAndLockSandbox(poolId).getAllocationUnitId();
trainingRun.setSandboxInstanceRefId(sandboxInstanceRef);
trainingRun.setSandboxInstanceAllocationId(sandboxInstanceAllocationId);
return trainingRunRepository.save(trainingRun);
}
......
......@@ -177,16 +177,16 @@ public class TestDataFactory {
LocalDateTime.now(Clock.systemUTC()).minusHours(10), "Archived instance", "archived-6666");
private TrainingRun runningRun = generateTrainingRun(LocalDateTime.now(Clock.systemUTC()).minusHours(2), LocalDateTime.now(Clock.systemUTC()).plusHours(2),
TRState.RUNNING, 2, true, "1L", 1L, true,
TRState.RUNNING, 2, true, "1L", 1, true,
"20L");
private TrainingRun finishedRun = generateTrainingRun(LocalDateTime.now(Clock.systemUTC()).minusHours(10), LocalDateTime.now(Clock.systemUTC()).minusHours(5),
TRState.FINISHED, 4, false, "3L", 3l, true, "30L");
TRState.FINISHED, 4, false, "3L", 3, true, "30L");
private TrainingRun archivedRun = generateTrainingRun(LocalDateTime.now(Clock.systemUTC()).minusHours(20), LocalDateTime.now(Clock.systemUTC()).minusHours(10),
TRState.ARCHIVED, 0, false, "5L", 5l, false, "60L");
TRState.ARCHIVED, 0, false, "5L", 5, false, "60L");
private TrainingRunByIdDTO trainingRunByIdDTO = generateTrainingRunByIdDTO(LocalDateTime.now(Clock.systemUTC()).minusHours(2), LocalDateTime.now(Clock.systemUTC()).plusHours(2),
TRState.RUNNING, "5L");
private TrainingRunDTO trainingRunDTO = generateTrainingRunDTO(LocalDateTime.now(Clock.systemUTC()).minusHours(9), LocalDateTime.now(Clock.systemUTC()).minusHours(5),
TRState.FINISHED, "7L", 7L);
TRState.FINISHED, "7L", 7);
// private AccessedTrainingRunDTO accessedTrainingRunDTO = generateAccessedTrainingRunDTO("Accessed run", LocalDateTime.now(Clock.systemUTC()).minusHours(8), LocalDateTime.now(Clock.systemUTC()).minusHours(4), 5,
// 6, Actions.RESUME);
......@@ -694,7 +694,7 @@ public class TestDataFactory {
}
private TrainingRun generateTrainingRun(LocalDateTime startTime, LocalDateTime endTime, TRState state,
int incorrectAnswerCount, boolean solutionTaken, String SBIRefId, Long SBIAllocId, boolean phaseAnswered, String previousSBIRefId){
int incorrectAnswerCount, boolean solutionTaken, String SBIRefId, Integer SBIAllocId, boolean phaseAnswered, String previousSBIRefId){
TrainingRun newTrainingRun = new TrainingRun();
newTrainingRun.setStartTime(startTime);
newTrainingRun.setEndTime(endTime);
......@@ -805,7 +805,7 @@ public class TestDataFactory {
return trainingRunByIdDTO;
}
private TrainingRunDTO generateTrainingRunDTO(LocalDateTime start, LocalDateTime end, TRState state, String SBIRefId, Long SBIAllocId){
private TrainingRunDTO generateTrainingRunDTO(LocalDateTime start, LocalDateTime end, TRState state, String SBIRefId, Integer SBIAllocId){
TrainingRunDTO trainingRunDTO = new TrainingRunDTO();
trainingRunDTO.setStartTime(start);
trainingRunDTO.setEndTime(end);
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment