Skip to content

Commit 304513f

Browse files
committed
More test polishing
Signed-off-by: Ben Hale <[email protected]>
1 parent b2dabdd commit 304513f

File tree

3 files changed

+34
-2
lines changed

3 files changed

+34
-2
lines changed

cloudfoundry-client/src/main/java/org/cloudfoundry/client/v3/processes/_PortMapping.java

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

1919
import com.fasterxml.jackson.annotation.JsonProperty;
2020
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
21+
import org.cloudfoundry.Nullable;
2122
import org.immutables.value.Value;
2223

2324
/**
@@ -37,6 +38,7 @@ abstract class _PortMapping {
3738
* The external TLS proxy port
3839
*/
3940
@JsonProperty("external_tls_proxy_port")
41+
@Nullable
4042
abstract Integer getExternalTlsProxyPort();
4143

4244
/**
@@ -49,6 +51,7 @@ abstract class _PortMapping {
4951
* The internal TLS proxy port
5052
*/
5153
@JsonProperty("internal_tls_proxy_port")
54+
@Nullable
5255
abstract Integer getInternalTlsProxyPort();
5356

5457
}

integration-test/src/test/java/org/cloudfoundry/CloudFoundryVersion.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -38,6 +38,14 @@ public enum CloudFoundryVersion {
3838

3939
PCF_2_4(Version.forIntegers(2, 125, 0)),
4040

41+
PCF_2_5(Version.forIntegers(2, 131, 0)),
42+
43+
PCF_2_6(Version.forIntegers(2, 135, 0)),
44+
45+
PCF_2_7(Version.forIntegers(2, 139, 0)),
46+
47+
PCF_2_8(Version.forIntegers(2, 142, 0)),
48+
4149
UNSPECIFIED(Version.forIntegers(0));
4250

4351
private final Version version;

integration-test/src/test/java/org/cloudfoundry/uaa/ClientsTest.java

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

1919
import io.netty.util.AsciiString;
2020
import org.cloudfoundry.AbstractIntegrationTest;
21+
import org.cloudfoundry.CloudFoundryVersion;
22+
import org.cloudfoundry.IfCloudFoundryVersion;
2123
import org.cloudfoundry.uaa.clients.BatchChangeSecretRequest;
2224
import org.cloudfoundry.uaa.clients.BatchChangeSecretResponse;
2325
import org.cloudfoundry.uaa.clients.BatchCreateClientsRequest;
@@ -201,8 +203,28 @@ public void batchUpdate() {
201203
.verify(Duration.ofMinutes(5));
202204
}
203205

206+
@IfCloudFoundryVersion(lessThan = CloudFoundryVersion.PCF_2_8)
204207
@Test
205-
public void changeSecret() {
208+
public void changeSecret27() {
209+
String clientId = this.nameFactory.getClientId();
210+
String newClientSecret = this.nameFactory.getClientSecret();
211+
String oldClientSecret = this.nameFactory.getClientSecret();
212+
213+
requestCreateClient(this.uaaClient, clientId, oldClientSecret)
214+
.then(this.uaaClient.clients()
215+
.changeSecret(ChangeSecretRequest.builder()
216+
.clientId(clientId)
217+
.oldSecret(oldClientSecret)
218+
.secret(newClientSecret)
219+
.build()))
220+
.as(StepVerifier::create)
221+
.consumeErrorWith(t -> assertThat(t).isInstanceOf(UaaException.class).hasMessage("invalid_client: Only a client can change client secret"))
222+
.verify(Duration.ofMinutes(5));
223+
}
224+
225+
@IfCloudFoundryVersion(greaterThanOrEqualTo = CloudFoundryVersion.PCF_2_8)
226+
@Test
227+
public void changeSecret28() {
206228
String clientId = this.nameFactory.getClientId();
207229
String newClientSecret = this.nameFactory.getClientSecret();
208230
String oldClientSecret = this.nameFactory.getClientSecret();
@@ -221,7 +243,6 @@ public void changeSecret() {
221243
})
222244
.expectComplete()
223245
.verify(Duration.ofMinutes(5));
224-
225246
}
226247

227248
@Test

0 commit comments

Comments
 (0)