Skip to content

Commit

Permalink
Merge pull request #2083 from ballerina-platform/cache-fix-8.x
Browse files Browse the repository at this point in the history
[2201.8.x] Fix `NumberFormatException` when specifying cache configurations as decimal values
  • Loading branch information
TharmiganK authored Jul 24, 2024
2 parents 48db1d2 + 05c24e6 commit cd93cdd
Show file tree
Hide file tree
Showing 29 changed files with 91 additions and 78 deletions.
6 changes: 3 additions & 3 deletions ballerina-tests/http-advanced-tests/Ballerina.toml
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
[package]
org = "ballerina"
name = "http_advanced_tests"
version = "2.10.14"
version = "2.10.15"

[[dependency]]
org = "ballerina"
name = "http_test_common"
repository = "local"
version = "2.10.14"
version = "2.10.15"

[platform.java17]
graalvmCompatible = true

[[platform.java17.dependency]]
scope = "testOnly"
path = "../../test-utils/build/libs/http-test-utils-2.10.14.jar"
path = "../../test-utils/build/libs/http-test-utils-2.10.15-SNAPSHOT.jar"
6 changes: 3 additions & 3 deletions ballerina-tests/http-advanced-tests/Dependencies.toml
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ modules = [
[[package]]
org = "ballerina"
name = "http"
version = "2.10.14"
version = "2.10.15"
scope = "testOnly"
dependencies = [
{org = "ballerina", name = "auth"},
Expand Down Expand Up @@ -105,7 +105,7 @@ modules = [
[[package]]
org = "ballerina"
name = "http_advanced_tests"
version = "2.10.14"
version = "2.10.15"
dependencies = [
{org = "ballerina", name = "crypto"},
{org = "ballerina", name = "file"},
Expand All @@ -125,7 +125,7 @@ modules = [
[[package]]
org = "ballerina"
name = "http_test_common"
version = "2.10.14"
version = "2.10.15"
scope = "testOnly"
dependencies = [
{org = "ballerina", name = "lang.string"},
Expand Down
12 changes: 6 additions & 6 deletions ballerina-tests/http-advanced-tests/tests/http2_caching_test.bal
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ service /cachingBackend on http2CachingListener2 { //new http:Listener(9240) {
isolated resource function 'default .(http:Caller caller, http:Request req) returns error? {
http:Response res = new;
http:ResponseCacheControl resCC = new;
resCC.maxAge = 60;
resCC.maxAge = 60.54;
resCC.isPrivate = false;

res.cacheControl = resCC;
Expand Down Expand Up @@ -158,28 +158,28 @@ function testHttp2BasicCachingBehaviour() returns error? {
@test:Config {}
function testHttp2RequestCacheControlBuildCacheControlDirectives() {
http:RequestCacheControl reqCC = new;
reqCC.maxAge = 60;
reqCC.maxAge = 60.34;
reqCC.noCache = true;
reqCC.noStore = true;
reqCC.noTransform = true;
reqCC.onlyIfCached = true;
reqCC.maxStale = 120;
reqCC.minFresh = 6;
reqCC.maxStale = 120.04;
reqCC.minFresh = 6.0;
test:assertEquals(reqCC.buildCacheControlDirectives(),
"no-cache, no-store, no-transform, only-if-cached, max-age=60, max-stale=120, min-fresh=6");
}

@test:Config {}
function testHttp2ResponseCacheControlBuildCacheControlDirectives() {
http:ResponseCacheControl resCC = new;
resCC.maxAge = 60;
resCC.maxAge = 60.54;
resCC.isPrivate = false;
resCC.mustRevalidate = true;
resCC.noCache = true;
resCC.noStore = true;
resCC.noTransform = true;
resCC.proxyRevalidate = true;
resCC.sMaxAge = 60;
resCC.sMaxAge = 60.32;
test:assertEquals(resCC.buildCacheControlDirectives(),
"must-revalidate, no-cache, no-store, no-transform, public, proxy-revalidate, max-age=60, s-maxage=60");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ service / on new http:Listener(cacheAnnotationTestPort2, httpVersion = http:HTTP
}
}

resource function default maxAgeBE(http:Request req) returns @http:Cache {maxAge: 5, mustRevalidate: false} xml {
resource function default maxAgeBE(http:Request req) returns @http:Cache {maxAge: 5.32, mustRevalidate: false} xml {
int count = 0;
lock {
maxAgeHitCountNew += 1;
Expand Down
6 changes: 3 additions & 3 deletions ballerina-tests/http-client-tests/Ballerina.toml
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
[package]
org = "ballerina"
name = "http_client_tests"
version = "2.10.14"
version = "2.10.15"

[[dependency]]
org = "ballerina"
name = "http_test_common"
repository = "local"
version = "2.10.14"
version = "2.10.15"

[platform.java17]
graalvmCompatible = true

[[platform.java17.dependency]]
scope = "testOnly"
path = "../../test-utils/build/libs/http-test-utils-2.10.14.jar"
path = "../../test-utils/build/libs/http-test-utils-2.10.15-SNAPSHOT.jar"
6 changes: 3 additions & 3 deletions ballerina-tests/http-client-tests/Dependencies.toml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ dependencies = [
[[package]]
org = "ballerina"
name = "http"
version = "2.10.14"
version = "2.10.15"
scope = "testOnly"
dependencies = [
{org = "ballerina", name = "auth"},
Expand Down Expand Up @@ -102,7 +102,7 @@ modules = [
[[package]]
org = "ballerina"
name = "http_client_tests"
version = "2.10.14"
version = "2.10.15"
dependencies = [
{org = "ballerina", name = "constraint"},
{org = "ballerina", name = "http"},
Expand All @@ -121,7 +121,7 @@ modules = [
[[package]]
org = "ballerina"
name = "http_test_common"
version = "2.10.14"
version = "2.10.15"
scope = "testOnly"
dependencies = [
{org = "ballerina", name = "lang.string"},
Expand Down
6 changes: 3 additions & 3 deletions ballerina-tests/http-dispatching-tests/Ballerina.toml
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
[package]
org = "ballerina"
name = "http_dispatching_tests"
version = "2.10.14"
version = "2.10.15"

[[dependency]]
org = "ballerina"
name = "http_test_common"
repository = "local"
version = "2.10.14"
version = "2.10.15"

[platform.java17]
graalvmCompatible = true

[[platform.java17.dependency]]
scope = "testOnly"
path = "../../test-utils/build/libs/http-test-utils-2.10.14.jar"
path = "../../test-utils/build/libs/http-test-utils-2.10.15-SNAPSHOT.jar"
6 changes: 3 additions & 3 deletions ballerina-tests/http-dispatching-tests/Dependencies.toml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ dependencies = [
[[package]]
org = "ballerina"
name = "http"
version = "2.10.14"
version = "2.10.15"
scope = "testOnly"
dependencies = [
{org = "ballerina", name = "auth"},
Expand Down Expand Up @@ -102,7 +102,7 @@ modules = [
[[package]]
org = "ballerina"
name = "http_dispatching_tests"
version = "2.10.14"
version = "2.10.15"
dependencies = [
{org = "ballerina", name = "constraint"},
{org = "ballerina", name = "http"},
Expand All @@ -124,7 +124,7 @@ modules = [
[[package]]
org = "ballerina"
name = "http_test_common"
version = "2.10.14"
version = "2.10.15"
scope = "testOnly"
dependencies = [
{org = "ballerina", name = "lang.string"},
Expand Down
6 changes: 3 additions & 3 deletions ballerina-tests/http-interceptor-tests/Ballerina.toml
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
[package]
org = "ballerina"
name = "http_interceptor_tests"
version = "2.10.14"
version = "2.10.15"

[[dependency]]
org = "ballerina"
name = "http_test_common"
repository = "local"
version = "2.10.14"
version = "2.10.15"

[platform.java17]
graalvmCompatible = true

[[platform.java17.dependency]]
scope = "testOnly"
path = "../../test-utils/build/libs/http-test-utils-2.10.14.jar"
path = "../../test-utils/build/libs/http-test-utils-2.10.15-SNAPSHOT.jar"
6 changes: 3 additions & 3 deletions ballerina-tests/http-interceptor-tests/Dependencies.toml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ dependencies = [
[[package]]
org = "ballerina"
name = "http"
version = "2.10.14"
version = "2.10.15"
scope = "testOnly"
dependencies = [
{org = "ballerina", name = "auth"},
Expand Down Expand Up @@ -99,7 +99,7 @@ modules = [
[[package]]
org = "ballerina"
name = "http_interceptor_tests"
version = "2.10.14"
version = "2.10.15"
dependencies = [
{org = "ballerina", name = "http"},
{org = "ballerina", name = "http_test_common"},
Expand All @@ -115,7 +115,7 @@ modules = [
[[package]]
org = "ballerina"
name = "http_test_common"
version = "2.10.14"
version = "2.10.15"
scope = "testOnly"
dependencies = [
{org = "ballerina", name = "lang.string"},
Expand Down
6 changes: 3 additions & 3 deletions ballerina-tests/http-misc-tests/Ballerina.toml
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
[package]
org = "ballerina"
name = "http_misc_tests"
version = "2.10.14"
version = "2.10.15"

[[dependency]]
org = "ballerina"
name = "http_test_common"
repository = "local"
version = "2.10.14"
version = "2.10.15"

[platform.java17]
graalvmCompatible = true

[[platform.java17.dependency]]
scope = "testOnly"
path = "../../test-utils/build/libs/http-test-utils-2.10.14.jar"
path = "../../test-utils/build/libs/http-test-utils-2.10.15-SNAPSHOT.jar"
6 changes: 3 additions & 3 deletions ballerina-tests/http-misc-tests/Dependencies.toml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ dependencies = [
[[package]]
org = "ballerina"
name = "http"
version = "2.10.14"
version = "2.10.15"
scope = "testOnly"
dependencies = [
{org = "ballerina", name = "auth"},
Expand Down Expand Up @@ -99,7 +99,7 @@ modules = [
[[package]]
org = "ballerina"
name = "http_misc_tests"
version = "2.10.14"
version = "2.10.15"
dependencies = [
{org = "ballerina", name = "http"},
{org = "ballerina", name = "http_test_common"},
Expand All @@ -118,7 +118,7 @@ modules = [
[[package]]
org = "ballerina"
name = "http_test_common"
version = "2.10.14"
version = "2.10.15"
scope = "testOnly"
dependencies = [
{org = "ballerina", name = "lang.string"},
Expand Down
6 changes: 3 additions & 3 deletions ballerina-tests/http-resiliency-tests/Ballerina.toml
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
[package]
org = "ballerina"
name = "http_resiliency_tests"
version = "2.10.14"
version = "2.10.15"

[[dependency]]
org = "ballerina"
name = "http_test_common"
repository = "local"
version = "2.10.14"
version = "2.10.15"

[platform.java17]
graalvmCompatible = true

[[platform.java17.dependency]]
scope = "testOnly"
path = "../../test-utils/build/libs/http-test-utils-2.10.14.jar"
path = "../../test-utils/build/libs/http-test-utils-2.10.15-SNAPSHOT.jar"
6 changes: 3 additions & 3 deletions ballerina-tests/http-resiliency-tests/Dependencies.toml
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ dependencies = [
[[package]]
org = "ballerina"
name = "http"
version = "2.10.14"
version = "2.10.15"
scope = "testOnly"
dependencies = [
{org = "ballerina", name = "auth"},
Expand Down Expand Up @@ -99,7 +99,7 @@ modules = [
[[package]]
org = "ballerina"
name = "http_resiliency_tests"
version = "2.10.14"
version = "2.10.15"
dependencies = [
{org = "ballerina", name = "http"},
{org = "ballerina", name = "http_test_common"},
Expand All @@ -116,7 +116,7 @@ modules = [
[[package]]
org = "ballerina"
name = "http_test_common"
version = "2.10.14"
version = "2.10.15"
scope = "testOnly"
dependencies = [
{org = "ballerina", name = "lang.string"},
Expand Down
6 changes: 3 additions & 3 deletions ballerina-tests/http-security-tests/Ballerina.toml
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
[package]
org = "ballerina"
name = "http_security_tests"
version = "2.10.14"
version = "2.10.15"

[[dependency]]
org = "ballerina"
name = "http_test_common"
repository = "local"
version = "2.10.14"
version = "2.10.15"

[platform.java17]
graalvmCompatible = true

[[platform.java17.dependency]]
scope = "testOnly"
path = "../../test-utils/build/libs/http-test-utils-2.10.14.jar"
path = "../../test-utils/build/libs/http-test-utils-2.10.15-SNAPSHOT.jar"
6 changes: 3 additions & 3 deletions ballerina-tests/http-security-tests/Dependencies.toml
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ dependencies = [
[[package]]
org = "ballerina"
name = "http"
version = "2.10.14"
version = "2.10.15"
scope = "testOnly"
dependencies = [
{org = "ballerina", name = "auth"},
Expand Down Expand Up @@ -102,7 +102,7 @@ modules = [
[[package]]
org = "ballerina"
name = "http_security_tests"
version = "2.10.14"
version = "2.10.15"
dependencies = [
{org = "ballerina", name = "auth"},
{org = "ballerina", name = "http"},
Expand All @@ -120,7 +120,7 @@ modules = [
[[package]]
org = "ballerina"
name = "http_test_common"
version = "2.10.14"
version = "2.10.15"
scope = "testOnly"
dependencies = [
{org = "ballerina", name = "lang.string"},
Expand Down
Loading

0 comments on commit cd93cdd

Please sign in to comment.