Skip to content

Commit 74bf8ff

Browse files
committed
Update VersionService and VersionServiceTests
1 parent 323bc72 commit 74bf8ff

File tree

4 files changed

+24
-22
lines changed

4 files changed

+24
-22
lines changed

src/main/java/com/iexec/worker/utils/version/VersionService.java renamed to src/main/java/com/iexec/worker/version/VersionService.java

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2020 IEXEC BLOCKCHAIN TECH
2+
* Copyright 2020-2023 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.
@@ -14,9 +14,8 @@
1414
* limitations under the License.
1515
*/
1616

17-
package com.iexec.worker.utils.version;
17+
package com.iexec.worker.version;
1818

19-
import com.iexec.common.utils.VersionUtils;
2019
import org.springframework.boot.info.BuildProperties;
2120
import org.springframework.stereotype.Service;
2221

@@ -33,8 +32,4 @@ public String getVersion() {
3332
return buildProperties.getVersion();
3433
}
3534

36-
public boolean isSnapshot() {
37-
return VersionUtils.isSnapshot(buildProperties.getVersion());
38-
}
39-
4035
}

src/main/java/com/iexec/worker/worker/WorkerService.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@
2626
import com.iexec.worker.feign.CustomCoreFeignClient;
2727
import com.iexec.worker.tee.scone.TeeSconeService;
2828
import com.iexec.worker.utils.LoggingUtils;
29-
import com.iexec.worker.utils.version.VersionService;
29+
import com.iexec.worker.version.VersionService;
3030
import lombok.extern.slf4j.Slf4j;
3131
import org.springframework.cloud.context.restart.RestartEndpoint;
3232
import org.springframework.context.annotation.Bean;

src/test/java/com/iexec/worker/utils/version/VersionServiceTests.java renamed to src/test/java/com/iexec/worker/version/VersionServiceTests.java

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,23 @@
1-
package com.iexec.worker.utils.version;
1+
/*
2+
* Copyright 2020-2023 IEXEC BLOCKCHAIN TECH
3+
*
4+
* Licensed under the Apache License, Version 2.0 (the "License");
5+
* you may not use this file except in compliance with the License.
6+
* You may obtain a copy of the License at
7+
*
8+
* http://www.apache.org/licenses/LICENSE-2.0
9+
*
10+
* Unless required by applicable law or agreed to in writing, software
11+
* distributed under the License is distributed on an "AS IS" BASIS,
12+
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13+
* See the License for the specific language governing permissions and
14+
* limitations under the License.
15+
*/
16+
17+
package com.iexec.worker.version;
218

319
import org.junit.jupiter.api.Assertions;
420
import org.junit.jupiter.api.BeforeEach;
5-
import org.junit.jupiter.api.Test;
621
import org.junit.jupiter.params.ParameterizedTest;
722
import org.junit.jupiter.params.provider.ValueSource;
823
import org.mockito.InjectMocks;
@@ -25,18 +40,10 @@ public void preflight() {
2540
}
2641

2742
@ParameterizedTest
28-
@ValueSource(strings={"x.y.z", "x.y.z-rc"})
29-
void testNonSnapshotVersion(String version) {
43+
@ValueSource(strings={"x.y.z", "x.y.z-rc", "x.y.z-NEXT-SNAPSHOT"})
44+
void testVersions(String version) {
3045
Mockito.when(buildProperties.getVersion()).thenReturn(version);
3146
Assertions.assertEquals(version, versionService.getVersion());
32-
Assertions.assertFalse(versionService.isSnapshot());
33-
}
34-
35-
@Test
36-
void testSnapshotVersion() {
37-
Mockito.when(buildProperties.getVersion()).thenReturn("x.y.z-NEXT-SNAPSHOT");
38-
Assertions.assertEquals("x.y.z-NEXT-SNAPSHOT", versionService.getVersion());
39-
Assertions.assertTrue(versionService.isSnapshot());
4047
}
4148

4249
}

src/test/java/com/iexec/worker/worker/WorkerServiceTests.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
/*
2-
* Copyright 2020 IEXEC BLOCKCHAIN TECH
2+
* Copyright 2020-2023 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,7 +24,7 @@
2424
import com.iexec.worker.docker.DockerService;
2525
import com.iexec.worker.feign.CustomCoreFeignClient;
2626
import com.iexec.worker.tee.scone.TeeSconeService;
27-
import com.iexec.worker.utils.version.VersionService;
27+
import com.iexec.worker.version.VersionService;
2828
import org.junit.jupiter.api.BeforeEach;
2929
import org.junit.jupiter.api.Test;
3030
import org.mockito.ArgumentCaptor;

0 commit comments

Comments
 (0)