File tree Expand file tree Collapse file tree 2 files changed +37
-3
lines changed
main/java/org/radarbase/output
test/java/org/radarbase/output/source Expand file tree Collapse file tree 2 files changed +37
-3
lines changed Original file line number Diff line number Diff line change @@ -18,8 +18,7 @@ package org.radarbase.output
18
18
19
19
import com.beust.jcommander.JCommander
20
20
import com.beust.jcommander.ParameterException
21
- import kotlinx.coroutines.launch
22
- import kotlinx.coroutines.runBlocking
21
+ import kotlinx.coroutines.*
23
22
import kotlinx.coroutines.sync.Mutex
24
23
import kotlinx.coroutines.sync.Semaphore
25
24
import org.radarbase.output.accounting.*
@@ -200,9 +199,17 @@ class Application(
200
199
} catch (e: IllegalStateException ) {
201
200
logger.error(" Invalid configuration: {}" , e.message)
202
201
exitProcess(1 )
202
+ } catch (ex: Throwable ) {
203
+ logger.error(" Failed to initialize application: {}" , ex.message)
204
+ exitProcess(1 )
203
205
}
204
206
205
- application.start()
207
+ try {
208
+ application.start()
209
+ } catch (ex: Throwable ) {
210
+ logger.error(" Application failed: {}" , ex.message)
211
+ exitProcess(1 )
212
+ }
206
213
}
207
214
}
208
215
}
Original file line number Diff line number Diff line change
1
+ package org.radarbase.output.source
2
+
3
+ import kotlinx.coroutines.launch
4
+ import kotlinx.coroutines.runBlocking
5
+ import org.junit.jupiter.api.Test
6
+ import org.junit.jupiter.api.assertThrows
7
+ import org.radarbase.output.source.S3SourceStorage.Companion.faultTolerant
8
+ import java.io.IOException
9
+
10
+ class S3SourceStorageTest {
11
+ @Test
12
+ fun testSuspend () {
13
+ assertThrows<IOException > {
14
+ runBlocking {
15
+ launch { throw IOException (" ex" ) }
16
+ }
17
+ }
18
+ }
19
+ @Test
20
+ fun testFaultTolerant () {
21
+ assertThrows<IOException > {
22
+ runBlocking {
23
+ faultTolerant { throw IOException (" test" ) }
24
+ }
25
+ }
26
+ }
27
+ }
You can’t perform that action at this time.
0 commit comments