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

Commit c9c7721

Browse files
Corneil du Plessiscppwfs
Corneil du Plessis
authored andcommitted
Added verification of tasks/thinexecutions in DataflowOAuthIT.
1 parent d970ac1 commit c9c7721

File tree

1 file changed

+18
-2
lines changed
  • spring-cloud-dataflow-server/src/test/java/org/springframework/cloud/dataflow/integration/test/oauth

1 file changed

+18
-2
lines changed

spring-cloud-dataflow-server/src/test/java/org/springframework/cloud/dataflow/integration/test/oauth/DataflowOAuthIT.java

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818

1919
import java.util.concurrent.TimeUnit;
2020

21+
import com.jayway.jsonpath.JsonPath;
2122
import org.junit.jupiter.api.Test;
2223
import org.slf4j.Logger;
2324
import org.slf4j.LoggerFactory;
@@ -26,6 +27,7 @@
2627
import org.springframework.cloud.dataflow.integration.test.db.AbstractDataflowTests;
2728
import org.springframework.cloud.dataflow.integration.test.tags.Oauth;
2829
import org.springframework.cloud.dataflow.integration.test.tags.TagNames;
30+
import org.springframework.cloud.dataflow.rest.client.support.VersionUtils;
2931
import org.springframework.test.context.ActiveProfiles;
3032

3133
import static org.awaitility.Awaitility.with;
@@ -54,12 +56,26 @@ public void testSecuredSetup() throws Exception {
5456
.ignoreExceptions()
5557
.atMost(120, TimeUnit.SECONDS)
5658
.until(() -> {
57-
log.debug("Checking auth using curl");
59+
log.info("Checking auth using curl");
5860
ExecResult cmdResult = execInToolsContainer("curl", "-u", "janne:janne", "http://dataflow:9393/about");
5961
String response = cmdResult.getStdout();
6062
log.debug("Response is {}", response);
61-
boolean ok = response.contains("\"authenticated\":true") && response.contains("\"username\":\"janne\"");
63+
Boolean authenticated = JsonPath.parse(response).read("$.securityInfo.authenticated", Boolean.class);
64+
String username = JsonPath.parse(response).read("$.securityInfo.username", String.class);
65+
boolean ok = Boolean.TRUE.equals(authenticated) && "janne".equals(username);
6266
log.info("Check for oauth {}", ok);
67+
if (ok) {
68+
String version = JsonPath.parse(response).read("$.versionInfo.core.version");
69+
log.info("Version=[{}]", version);
70+
String api = "tasks/executions";
71+
if (VersionUtils.isDataFlowServerVersionGreaterThanOrEqualToRequiredVersion(
72+
VersionUtils.getThreePartVersion(version), "2.11.3")) {
73+
api = "tasks/thinexecutions";
74+
}
75+
cmdResult = execInToolsContainer("curl", "-u", "janne:janne", "http://dataflow:9393/" + api);
76+
response = cmdResult.getStdout();
77+
ok = !JsonPath.parse(response).read("$._links.self.href", String.class).isEmpty();
78+
}
6379
return ok;
6480
});
6581
}

0 commit comments

Comments
 (0)