Skip to content

Commit 0d3792e

Browse files
authored
Replace SECURE_SESSION_NO_TEE_PROVIDER with SECURE_SESSION_NO_TEE_FRAMEWORK (#265)
1 parent 4f7d099 commit 0d3792e

File tree

4 files changed

+15
-18
lines changed

4 files changed

+15
-18
lines changed

CHANGELOG.md

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,8 @@ All notable changes to this project will be documented in this file.
1111
### Quality
1212

1313
- Configure Gradle JVM Test Suite Plugin. (#259)
14+
- Replace `SECURE_SESSION_NO_TEE_PROVIDER` with `SECURE_SESSION_NO_TEE_FRAMEWORK`
15+
in `TeeSessionGenerationError`. (#265)
1416

1517
### Dependency Upgrades
1618

iexec-sms-library/src/main/java/com/iexec/sms/api/TeeSessionGenerationError.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2022 IEXEC BLOCKCHAIN TECH
2+
* Copyright 2022-2024 IEXEC BLOCKCHAIN TECH
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -49,16 +49,16 @@ public enum TeeSessionGenerationError {
4949
// region Secure session generation
5050
SECURE_SESSION_STORAGE_CALL_FAILED,
5151
SECURE_SESSION_GENERATION_FAILED,
52+
SECURE_SESSION_NO_TEE_FRAMEWORK,
53+
@Deprecated(forRemoval = true)
5254
SECURE_SESSION_NO_TEE_PROVIDER,
53-
SECURE_SESSION_UNKNOWN_TEE_PROVIDER,
5455
// endregion
5556

5657
// region Miscellaneous
5758
GET_TASK_DESCRIPTION_FAILED,
5859
NO_SESSION_REQUEST,
5960
NO_TASK_DESCRIPTION,
60-
GET_SESSION_FAILED,
61-
61+
// worker side
6262
UNKNOWN_ISSUE
6363
// endregion
6464
}

src/main/java/com/iexec/sms/tee/session/TeeSessionService.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2020-2023 IEXEC BLOCKCHAIN TECH
2+
* Copyright 2020-2024 IEXEC BLOCKCHAIN TECH
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -27,7 +27,7 @@
2727
import org.springframework.stereotype.Service;
2828

2929
import static com.iexec.sms.api.TeeSessionGenerationError.GET_TASK_DESCRIPTION_FAILED;
30-
import static com.iexec.sms.api.TeeSessionGenerationError.SECURE_SESSION_NO_TEE_PROVIDER;
30+
import static com.iexec.sms.api.TeeSessionGenerationError.SECURE_SESSION_NO_TEE_FRAMEWORK;
3131

3232
@Service
3333
public class TeeSessionService {
@@ -64,7 +64,7 @@ public TeeSessionGenerationResponse generateTeeSession(
6464
final TeeFramework teeFramework = taskDescription.getTeeFramework();
6565
if (teeFramework == null) {
6666
throw new TeeSessionGenerationException(
67-
SECURE_SESSION_NO_TEE_PROVIDER,
67+
SECURE_SESSION_NO_TEE_FRAMEWORK,
6868
String.format("TEE framework can't be null [taskId:%s]", taskId));
6969
}
7070

src/test/java/com/iexec/sms/tee/session/TeeSessionServiceTests.java

Lines changed: 6 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2022-2023 IEXEC BLOCKCHAIN TECH
2+
* Copyright 2022-2024 IEXEC BLOCKCHAIN TECH
33
*
44
* Licensed under the Apache License, Version 2.0 (the "License");
55
* you may not use this file except in compliance with the License.
@@ -24,15 +24,16 @@
2424
import com.iexec.sms.tee.session.generic.TeeSessionGenerationException;
2525
import com.iexec.sms.tee.session.gramine.GramineSessionHandlerService;
2626
import com.iexec.sms.tee.session.scone.SconeSessionHandlerService;
27-
import org.junit.jupiter.api.BeforeEach;
2827
import org.junit.jupiter.api.Test;
28+
import org.junit.jupiter.api.extension.ExtendWith;
2929
import org.mockito.Mock;
30-
import org.mockito.MockitoAnnotations;
30+
import org.mockito.junit.jupiter.MockitoExtension;
3131

3232
import static org.junit.jupiter.api.Assertions.*;
3333
import static org.mockito.ArgumentMatchers.any;
3434
import static org.mockito.Mockito.*;
3535

36+
@ExtendWith(MockitoExtension.class)
3637
class TeeSessionServiceTests {
3738
private final static String TASK_ID = "0x0";
3839
private final static String WORKER_ADDRESS = "0x1";
@@ -45,11 +46,6 @@ class TeeSessionServiceTests {
4546
@Mock
4647
private IexecHubService iexecHubService;
4748

48-
@BeforeEach
49-
void setUp() {
50-
MockitoAnnotations.openMocks(this);
51-
}
52-
5349
@Test
5450
void shouldGenerateSconeSession()
5551
throws TeeSessionGenerationException {
@@ -119,10 +115,9 @@ void shouldNotGenerateTeeSessionSinceNoTeeFramework() {
119115
final TeeSessionGenerationException teeSessionGenerationException = assertThrows(
120116
TeeSessionGenerationException.class,
121117
() -> teeSessionService.generateTeeSession(TASK_ID, WORKER_ADDRESS, TEE_CHALLENGE));
122-
assertEquals(TeeSessionGenerationError.SECURE_SESSION_NO_TEE_PROVIDER,
118+
assertEquals(TeeSessionGenerationError.SECURE_SESSION_NO_TEE_FRAMEWORK,
123119
teeSessionGenerationException.getError());
124-
assertEquals(String.format("TEE framework can't be null [taskId:%s]",
125-
TASK_ID),
120+
assertEquals(String.format("TEE framework can't be null [taskId:%s]", TASK_ID),
126121
teeSessionGenerationException.getMessage());
127122
}
128123

0 commit comments

Comments
 (0)