Skip to content

Commit e941abb

Browse files
* Fix after review by @abelsromero
1 parent 464555a commit e941abb

9 files changed

Lines changed: 68 additions & 25 deletions

File tree

README.adoc

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
== Java CFEnv image:https://build.spring.io/plugins/servlet/wittified/build-status/CFENV-BMASTER[Build Status, link=https://build.spring.io/browse/CFENV-BMASTER]
1+
= Java CFEnv image:https://build.spring.io/plugins/servlet/wittified/build-status/CFENV-BMASTER[Build Status, link=https://build.spring.io/browse/CFENV-BMASTER]
22

33
Java CFEnv is a library for easily accessing the environment variables set when deploying an application to Cloud Foundry.
44
It is modeled after the design of the node library https://github.com/cloudfoundry-community/node-cfenv/[node-cfenv] and other `-cfenv` libraries in the Cloud Foundry ecosystem.
@@ -9,6 +9,20 @@ CFEnv's Boot support sets https://docs.spring.io/spring-boot/docs/current/refere
99

1010
The https://spring.io/blog/2019/02/15/introducing-java-cfenv-a-new-library-for-accessing-cloud-foundry-services[1.0 M1 blog] provides some additional background information.
1111

12+
== Compatibility
13+
=== https://github.com/pivotal-cf/java-cfenv/tree/main[3.x]
14+
15+
* https://projects.spring.io/spring-framework/[Spring Framework] 6.x
16+
17+
* https://projects.spring.io/spring-boot/[Spring Boot] 3.x
18+
19+
20+
=== https://github.com/pivotal-cf/java-cfenv/tree/2.5.x[2.x]
21+
22+
* https://projects.spring.io/spring-framework/[Spring Framework] 5.3+
23+
24+
* https://projects.spring.io/spring-boot/[Spring Boot] 2.5+
25+
1226
== Dependency Info
1327

1428
You can access the stable release from maven central using the coordinates

build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
buildscript {
22
ext {
3-
jmockitVersion = "1.49.2"
3+
jmockitVersion = "1.49"
44
springBootVersion = "3.1.0"
55
}
66
}

buildSrc/src/main/groovy/io.pivotal.cfenv.java-conventions.gradle

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,14 @@ ext {
1616
] as String[]
1717
}
1818

19+
// we can not use latest Jacoco because of an issue with Java 17 and JMockit
20+
//https://github.com/jmockit/jmockit1/issues/615
21+
// Eventually, we need to remove Jmockit dependency since it's barely maintained anymore
22+
//https://github.com/jmockit/jmockit1
23+
jacoco {
24+
toolVersion = "0.8.6"
25+
}
26+
1927
java {
2028
withJavadocJar()
2129
withSourcesJar()

java-cfenv-boot-pivotal-sso/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ dependencies {
99

1010
testImplementation project(':java-cfenv-test-support')
1111
testImplementation "junit:junit"
12-
testImplementation "com.github.hazendaz.jmockit:jmockit:${jmockitVersion}"
12+
testImplementation "org.jmockit:jmockit:${jmockitVersion}"
1313

1414
testRuntimeOnly('org.junit.vintage:junit-vintage-engine') {
1515
exclude group: 'org.hamcrest', module: 'hamcrest-core'

java-cfenv-boot/build.gradle

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ dependencies {
1212

1313
testImplementation testFixtures(project(':java-cfenv'))
1414
testImplementation project(':java-cfenv-test-support')
15-
testImplementation "com.github.hazendaz.jmockit:jmockit:${jmockitVersion}"
15+
testImplementation "org.jmockit:jmockit:${jmockitVersion}"
1616

1717
testRuntimeOnly('org.junit.vintage:junit-vintage-engine') {
1818
exclude group: 'org.hamcrest', module: 'hamcrest-core'

java-cfenv-boot/src/test/java/io/pivotal/cfenv/spring/boot/CassandraCfEnvProcessorTests.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@
3030
*/
3131
public class CassandraCfEnvProcessorTests extends AbstractCfEnvTests {
3232

33-
public static final String SPRING_CASSANDRA = "spring.cassandra";
33+
private static final String SPRING_CASSANDRA = "spring.cassandra";
3434

3535
@Test
3636
public void simpleService() {

java-cfenv-boot/src/test/java/io/pivotal/cfenv/spring/boot/RedisCfEnvProcessorTests.java

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@
3333
*/
3434
public class RedisCfEnvProcessorTests extends AbstractCfEnvTests {
3535
private final static int TLS_PORT = 11111;
36-
public static final String SPRING_DATA_REDIS = "spring.data.redis";
36+
private static final String SPRING_DATA_REDIS = "spring.data.redis";
3737

3838
public static void commonAssertions(Environment environment, String SPRING_DATA_REDIS) {
3939
assertThat(environment.getProperty(SPRING_DATA_REDIS + ".host")).isEqualTo(hostname);
@@ -64,10 +64,10 @@ public void testRedisBootPropertiesWithTLSEnabledInCredentials() {
6464

6565
Environment environment = getEnvironment();
6666

67-
assertThat(environment.getProperty(SPRING_DATA_REDIS+".host")).isEqualTo(hostname);
68-
assertThat(environment.getProperty(SPRING_DATA_REDIS+".port")).isEqualTo(String.valueOf(TLS_PORT));
69-
assertThat(environment.getProperty(SPRING_DATA_REDIS+".password")).isEqualTo(password);
70-
assertThat(environment.getProperty(SPRING_DATA_REDIS+".ssl")).isEqualTo("true");
67+
assertThat(environment.getProperty(SPRING_DATA_REDIS + ".host")).isEqualTo(hostname);
68+
assertThat(environment.getProperty(SPRING_DATA_REDIS + ".port")).isEqualTo(String.valueOf(TLS_PORT));
69+
assertThat(environment.getProperty(SPRING_DATA_REDIS + ".password")).isEqualTo(password);
70+
assertThat(environment.getProperty(SPRING_DATA_REDIS + ".ssl")).isEqualTo("true");
7171
}
7272

7373
@Test
@@ -87,10 +87,10 @@ public void testNoCredentials() {
8787

8888
Environment environment = getEnvironment();
8989

90-
assertThat(environment.getProperty(SPRING_DATA_REDIS+".host")).isNull();
91-
assertThat(environment.getProperty(SPRING_DATA_REDIS+".port")).isNull();
92-
assertThat(environment.getProperty(SPRING_DATA_REDIS+".password")).isNull();
93-
assertThat(environment.getProperty(SPRING_DATA_REDIS+".ssl")).isNull();
90+
assertThat(environment.getProperty(SPRING_DATA_REDIS + ".host")).isNull();
91+
assertThat(environment.getProperty(SPRING_DATA_REDIS + ".port")).isNull();
92+
assertThat(environment.getProperty(SPRING_DATA_REDIS + ".password")).isNull();
93+
assertThat(environment.getProperty(SPRING_DATA_REDIS + ".ssl")).isNull();
9494
}
9595

9696
@Test

java-cfenv-tests-boot/build.gradle

Lines changed: 30 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,12 @@
1+
import groovy.json.JsonOutput
2+
13
plugins {
24
id 'io.pivotal.cfenv.java-conventions'
35
}
46

5-
description = 'Java CF Env Spring Boot 3 specific tests'
6-
7-
java {
8-
toolchain {
9-
languageVersion.set(JavaLanguageVersion.of(17))
10-
}
11-
}
7+
publishMavenJavaPublicationToMavenRepository.enabled = false
128

9+
description = 'Java CF Env Spring Boot 3 specific tests'
1310

1411
dependencies {
1512
testImplementation project(':java-cfenv-boot')
@@ -26,6 +23,30 @@ dependencies {
2623
}
2724

2825
tasks.withType(Test) {
29-
environment 'VCAP_SERVICES', '{"p-redis":[{"label":"p-redis","provider":null,"plan":"shared-vm","name":"my-redis-service","tags":["pivotal","redis"],"instance_guid":"cde54916-a366-4028-a2ec-1d5dc9657c68","instance_name":"my-redis-service","binding_guid":"8f81d232-25f3-4002-a012-1f734b464bc6","binding_name":null,"credentials":{"host":"localhost","password":"","port":46084},"syslog_drain_url":null,"volume_mounts":[]}]}'
26+
def vcapServicesAsJson = JsonOutput.toJson(
27+
["p-redis": [
28+
[
29+
"label" : "p-redis",
30+
"provider" : null,
31+
"plan" : "shared-vm",
32+
"name" : "my-redis-service",
33+
"tags" : [
34+
"pivotal",
35+
"redis"
36+
],
37+
"instance_guid" : "cde54916-a366-4028-a2ec-1d5dc9657c68",
38+
"instance_name" : "my-redis-service",
39+
"binding_guid" : "8f81d232-25f3-4002-a012-1f734b464bc6",
40+
"binding_name" : null,
41+
"credentials" : [
42+
"host" : "localhost",
43+
"password": "",
44+
"port" : 46084
45+
],
46+
"syslog_drain_url": null,
47+
"volume_mounts" : []
48+
]
49+
]]
50+
)
51+
environment 'VCAP_SERVICES', vcapServicesAsJson
3052
}
31-

java-cfenv/build.gradle

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,15 +12,15 @@ dependencies {
1212

1313
testImplementation "org.springframework.boot:spring-boot-starter-test"
1414
testImplementation "junit:junit"
15-
testImplementation "com.github.hazendaz.jmockit:jmockit:${jmockitVersion}"
15+
testImplementation "org.jmockit:jmockit:${jmockitVersion}"
1616

1717
testRuntimeOnly('org.junit.vintage:junit-vintage-engine') {
1818
exclude group: 'org.hamcrest', module: 'hamcrest-core'
1919
}
2020

2121
testFixturesApi platform("org.springframework.boot:spring-boot-dependencies:${springBootVersion}")
2222
testFixturesImplementation "org.springframework.boot:spring-boot-starter-test"
23-
testFixturesImplementation "com.github.hazendaz.jmockit:jmockit:${jmockitVersion}"
23+
testFixturesImplementation "org.jmockit:jmockit:${jmockitVersion}"
2424
}
2525

2626
testFixturesJar {

0 commit comments

Comments
 (0)