Skip to content
This repository was archived by the owner on May 14, 2025. It is now read-only.

Commit 6c839d3

Browse files
committed
Fix About controller version info to check correct snapshot
Resolves #4445
1 parent b12732d commit 6c839d3

File tree

2 files changed

+38
-1
lines changed

2 files changed

+38
-1
lines changed

spring-cloud-dataflow-server-core/src/main/java/org/springframework/cloud/dataflow/server/controller/AboutController.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -304,7 +304,7 @@ private String repoSelector(String version) {
304304
final String MAVEN_ROOT = "https://repo1.maven.org/maven2";
305305

306306
String result = MAVEN_ROOT;
307-
if (version.endsWith("BUILD-SNAPSHOT")) {
307+
if (version.endsWith("-SNAPSHOT")) {
308308
result = REPO_SNAPSHOT_ROOT;
309309
}
310310
else if (version.contains(".M")) {

spring-cloud-dataflow-server-core/src/test/java/org/springframework/cloud/dataflow/server/controller/AboutControllerTests.java

Lines changed: 37 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -144,6 +144,43 @@ public void testChecksumDisabled() throws Exception {
144144
}
145145
}
146146

147+
@RunWith(SpringRunner.class)
148+
@SpringBootTest(classes = TestDependencies.class)
149+
@DirtiesContext(classMode = DirtiesContext.ClassMode.BEFORE_EACH_TEST_METHOD)
150+
@TestPropertySource(properties = {
151+
"spring.cloud.dataflow.version-info.dependencies.spring-cloud-dataflow-shell.version=2.7.2-SNAPSHOT",
152+
"spring.cloud.dataflow.version-info.dependency-fetch.enabled=false",
153+
"spring.cloud.dataflow.version-info.dependencies.spring-cloud-dataflow-shell.checksum-sha1=ABCDEFG"
154+
})
155+
@AutoConfigureTestDatabase(replace = Replace.ANY)
156+
public static class SnapshotUrlTests {
157+
158+
private MockMvc mockMvc;
159+
160+
@Rule
161+
public LogTestNameRule logTestName = new LogTestNameRule();
162+
163+
@Autowired
164+
private WebApplicationContext wac;
165+
166+
@Before
167+
public void setupMocks() {
168+
this.mockMvc = MockMvcBuilders.webAppContextSetup(wac)
169+
.defaultRequest(get("/").accept(MediaType.APPLICATION_JSON)).build();
170+
}
171+
172+
@Test
173+
public void testSnapshotVersionInfo() throws Exception {
174+
ResultActions result = mockMvc.perform(get("/about").accept(MediaType.APPLICATION_JSON)).andDo(print()).andExpect(status().isOk());
175+
result.andExpect(jsonPath("$.featureInfo.analyticsEnabled", is(true)))
176+
.andExpect(jsonPath("$.versionInfo.shell.name", is("Spring Cloud Data Flow Shell")))
177+
.andExpect(jsonPath("$.versionInfo.shell.url", is("https://repo.spring.io/libs-snapshot/org/springframework/cloud/spring-cloud-dataflow-shell/2.7.2-SNAPSHOT/spring-cloud-dataflow-shell-2.7.2-SNAPSHOT.jar")))
178+
.andExpect(jsonPath("$.versionInfo.shell.version", is("2.7.2-SNAPSHOT")))
179+
.andExpect(jsonPath("$.versionInfo.shell.checksumSha1").doesNotExist())
180+
.andExpect(jsonPath("$.versionInfo.shell.checksumSha256").doesNotExist());
181+
}
182+
}
183+
147184
@RunWith(SpringRunner.class)
148185
@SpringBootTest(classes = TestDependencies.class)
149186
@DirtiesContext(classMode = DirtiesContext.ClassMode.BEFORE_EACH_TEST_METHOD)

0 commit comments

Comments
 (0)