Skip to content

Commit 6b3201f

Browse files
Merge pull request #2 from CASParser/release-please--branches--main--changes--next
release: 0.0.3
2 parents e9f2d24 + ecac9b0 commit 6b3201f

File tree

19 files changed

+147
-67
lines changed

19 files changed

+147
-67
lines changed

.release-please-manifest.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,3 @@
11
{
2-
".": "0.0.2"
2+
".": "0.0.3"
33
}

.stats.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
11
configured_endpoints: 5
22
openapi_spec_url: https://storage.googleapis.com/stainless-sdk-openapi-specs/cas-parser%2Fcas-parser-b7fdba3d3f97c7debc22c7ca30b828bce81bcd64648df8c94029b27a3321ebb9.yml
33
openapi_spec_hash: 03f1315f1d32ada42445ca920f047dff
4-
config_hash: 0e1291f316b20497ad29b59a231a8680
4+
config_hash: cb5d75abef6264b5d86448caf7295afa

CHANGELOG.md

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
# Changelog
22

3+
## 0.0.3 (2025-08-22)
4+
5+
Full Changelog: [v0.0.2...v0.0.3](https://github.com/CASParser/cas-parser-java/compare/v0.0.2...v0.0.3)
6+
7+
### Chores
8+
9+
* **ci:** reduce log noise ([b66b3f9](https://github.com/CASParser/cas-parser-java/commit/b66b3f9da67d09730f90fc863a3aa05bd54d1b14))
10+
* **client:** refactor closing / shutdown ([a96f2f2](https://github.com/CASParser/cas-parser-java/commit/a96f2f22d6b5e36631fd79ad19e71b45c33a1402))
11+
* **internal:** fix multipart tests ([c564310](https://github.com/CASParser/cas-parser-java/commit/c56431084f5366b0b5887619ca0e1e4c44fe6e6c))
12+
* **internal:** support running formatters directly ([aec2ce4](https://github.com/CASParser/cas-parser-java/commit/aec2ce4f099cfebef00d9357a1c1cc8280caa83b))
13+
314
## 0.0.2 (2025-08-18)
415

516
Full Changelog: [v0.0.1...v0.0.2](https://github.com/CASParser/cas-parser-java/compare/v0.0.1...v0.0.2)

README.md

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,8 @@
22

33
<!-- x-release-please-start-version -->
44

5-
[![Maven Central](https://img.shields.io/maven-central/v/com.cas_parser.api/cas-parser-java)](https://central.sonatype.com/artifact/com.cas_parser.api/cas-parser-java/0.0.2)
6-
[![javadoc](https://javadoc.io/badge2/com.cas_parser.api/cas-parser-java/0.0.2/javadoc.svg)](https://javadoc.io/doc/com.cas_parser.api/cas-parser-java/0.0.2)
5+
[![Maven Central](https://img.shields.io/maven-central/v/com.cas_parser.api/cas-parser-java)](https://central.sonatype.com/artifact/com.cas_parser.api/cas-parser-java/0.0.3)
6+
[![javadoc](https://javadoc.io/badge2/com.cas_parser.api/cas-parser-java/0.0.3/javadoc.svg)](https://javadoc.io/doc/com.cas_parser.api/cas-parser-java/0.0.3)
77

88
<!-- x-release-please-end -->
99

@@ -13,7 +13,7 @@ It is generated with [Stainless](https://www.stainless.com/).
1313

1414
<!-- x-release-please-start-version -->
1515

16-
The REST API documentation can be found on [docs.casparser.in](https://docs.casparser.in/reference). Javadocs are available on [javadoc.io](https://javadoc.io/doc/com.cas_parser.api/cas-parser-java/0.0.2).
16+
The REST API documentation can be found on [docs.casparser.in](https://docs.casparser.in/reference). Javadocs are available on [javadoc.io](https://javadoc.io/doc/com.cas_parser.api/cas-parser-java/0.0.3).
1717

1818
<!-- x-release-please-end -->
1919

@@ -24,7 +24,7 @@ The REST API documentation can be found on [docs.casparser.in](https://docs.casp
2424
### Gradle
2525

2626
```kotlin
27-
implementation("com.cas_parser.api:cas-parser-java:0.0.2")
27+
implementation("com.cas_parser.api:cas-parser-java:0.0.3")
2828
```
2929

3030
### Maven
@@ -33,7 +33,7 @@ implementation("com.cas_parser.api:cas-parser-java:0.0.2")
3333
<dependency>
3434
<groupId>com.cas_parser.api</groupId>
3535
<artifactId>cas-parser-java</artifactId>
36-
<version>0.0.2</version>
36+
<version>0.0.3</version>
3737
</dependency>
3838
```
3939

build.gradle.kts

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

1010
allprojects {
1111
group = "com.cas_parser.api"
12-
version = "0.0.2" // x-release-please-version
12+
version = "0.0.3" // x-release-please-version
1313
}
1414

1515
subprojects {

cas-parser-java-core/src/main/kotlin/com/cas_parser/api/client/CasParserClientAsyncImpl.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class CasParserClientAsyncImpl(private val clientOptions: ClientOptions) : CasPa
4646

4747
override fun casGenerator(): CasGeneratorServiceAsync = casGenerator
4848

49-
override fun close() = clientOptions.httpClient.close()
49+
override fun close() = clientOptions.close()
5050

5151
class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) :
5252
CasParserClientAsync.WithRawResponse {

cas-parser-java-core/src/main/kotlin/com/cas_parser/api/client/CasParserClientImpl.kt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ class CasParserClientImpl(private val clientOptions: ClientOptions) : CasParserC
4646

4747
override fun casGenerator(): CasGeneratorService = casGenerator
4848

49-
override fun close() = clientOptions.httpClient.close()
49+
override fun close() = clientOptions.close()
5050

5151
class WithRawResponseImpl internal constructor(private val clientOptions: ClientOptions) :
5252
CasParserClient.WithRawResponse {

cas-parser-java-core/src/main/kotlin/com/cas_parser/api/core/ClientOptions.kt

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,6 +21,8 @@ private constructor(
2121
* The HTTP client to use in the SDK.
2222
*
2323
* Use the one published in `cas-parser-java-client-okhttp` or implement your own.
24+
*
25+
* This class takes ownership of the client and closes it when closed.
2426
*/
2527
@get:JvmName("httpClient") val httpClient: HttpClient,
2628
/**
@@ -157,6 +159,8 @@ private constructor(
157159
* The HTTP client to use in the SDK.
158160
*
159161
* Use the one published in `cas-parser-java-client-okhttp` or implement your own.
162+
*
163+
* This class takes ownership of the client and closes it when closed.
160164
*/
161165
fun httpClient(httpClient: HttpClient) = apply {
162166
this.httpClient = PhantomReachableClosingHttpClient(httpClient)
@@ -404,4 +408,18 @@ private constructor(
404408
)
405409
}
406410
}
411+
412+
/**
413+
* Closes these client options, relinquishing any underlying resources.
414+
*
415+
* This is purposefully not inherited from [AutoCloseable] because the client options are
416+
* long-lived and usually should not be synchronously closed via try-with-resources.
417+
*
418+
* It's also usually not necessary to call this method at all. the default client automatically
419+
* releases threads and connections if they remain idle, but if you are writing an application
420+
* that needs to aggressively release unused resources, then you may call this method.
421+
*/
422+
fun close() {
423+
httpClient.close()
424+
}
407425
}
Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
package com.cas_parser.api.core
2+
3+
import java.util.concurrent.Callable
4+
import java.util.concurrent.ExecutorService
5+
import java.util.concurrent.Future
6+
import java.util.concurrent.TimeUnit
7+
8+
/**
9+
* A delegating wrapper around an [ExecutorService] that shuts it down once it's only phantom
10+
* reachable.
11+
*
12+
* This class ensures the [ExecutorService] is shut down even if the user forgets to do it.
13+
*/
14+
internal class PhantomReachableExecutorService(private val executorService: ExecutorService) :
15+
ExecutorService {
16+
init {
17+
closeWhenPhantomReachable(this) { executorService.shutdown() }
18+
}
19+
20+
override fun execute(command: Runnable) = executorService.execute(command)
21+
22+
override fun shutdown() = executorService.shutdown()
23+
24+
override fun shutdownNow(): MutableList<Runnable> = executorService.shutdownNow()
25+
26+
override fun isShutdown(): Boolean = executorService.isShutdown
27+
28+
override fun isTerminated(): Boolean = executorService.isTerminated
29+
30+
override fun awaitTermination(timeout: Long, unit: TimeUnit): Boolean =
31+
executorService.awaitTermination(timeout, unit)
32+
33+
override fun <T : Any?> submit(task: Callable<T>): Future<T> = executorService.submit(task)
34+
35+
override fun <T : Any?> submit(task: Runnable, result: T): Future<T> =
36+
executorService.submit(task, result)
37+
38+
override fun submit(task: Runnable): Future<*> = executorService.submit(task)
39+
40+
override fun <T : Any?> invokeAll(
41+
tasks: MutableCollection<out Callable<T>>
42+
): MutableList<Future<T>> = executorService.invokeAll(tasks)
43+
44+
override fun <T : Any?> invokeAll(
45+
tasks: MutableCollection<out Callable<T>>,
46+
timeout: Long,
47+
unit: TimeUnit,
48+
): MutableList<Future<T>> = executorService.invokeAll(tasks, timeout, unit)
49+
50+
override fun <T : Any?> invokeAny(tasks: MutableCollection<out Callable<T>>): T =
51+
executorService.invokeAny(tasks)
52+
53+
override fun <T : Any?> invokeAny(
54+
tasks: MutableCollection<out Callable<T>>,
55+
timeout: Long,
56+
unit: TimeUnit,
57+
): T = executorService.invokeAny(tasks, timeout, unit)
58+
}

cas-parser-java-core/src/test/kotlin/com/cas_parser/api/models/casparser/CasParserCamsKfintechParamsTest.kt

Lines changed: 1 addition & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -55,18 +55,6 @@ internal class CasParserCamsKfintechParamsTest {
5555

5656
val body = params._body()
5757

58-
assertThat(body.filterValues { !it.value.isNull() })
59-
.usingRecursiveComparison()
60-
// TODO(AssertJ): Replace this and the `mapValues` below with:
61-
// https://github.com/assertj/assertj/issues/3165
62-
.withEqualsForType(
63-
{ a, b -> a.readBytes() contentEquals b.readBytes() },
64-
InputStream::class.java,
65-
)
66-
.isEqualTo(
67-
mapOf().mapValues { (_, field) ->
68-
field.map { (it as? ByteArray)?.inputStream() ?: it }
69-
}
70-
)
58+
assertThat(body.filterValues { !it.value.isNull() }).isEmpty()
7159
}
7260
}

0 commit comments

Comments
 (0)