Commit a0bb681f authored by Ricki Hirner's avatar Ricki Hirner

Don't show InterruptedIOException; tests

parent 2e3987e6
Pipeline #22633305 failed with stages
in 14 minutes and 47 seconds
......@@ -54,13 +54,14 @@ class CollectionInfoTest {
"</response>" +
"</multistatus>"))
var dav = DavResource(httpClient.okHttpClient, server.url("/"))
dav.propfind(0, ResourceType.NAME)
var info = CollectionInfo(dav)
assertEquals(CollectionInfo.Type.ADDRESS_BOOK, info.type)
assertFalse(info.readOnly)
assertEquals("My Contacts", info.displayName)
assertEquals("My Contacts Description", info.description)
DavResource(httpClient.okHttpClient, server.url("/"))
.propfind(0, ResourceType.NAME).use {
val info = CollectionInfo(it)
assertEquals(CollectionInfo.Type.ADDRESS_BOOK, info.type)
assertFalse(info.readOnly)
assertEquals("My Contacts", info.displayName)
assertEquals("My Contacts Description", info.description)
}
// read-only calendar, no display name
server.enqueue(MockResponse()
......@@ -78,17 +79,18 @@ class CollectionInfoTest {
"</response>" +
"</multistatus>"))
dav = DavResource(httpClient.okHttpClient, server.url("/"))
dav.propfind(0, ResourceType.NAME)
info = CollectionInfo(dav)
assertEquals(CollectionInfo.Type.CALENDAR, info.type)
assertTrue(info.readOnly)
assertNull(info.displayName)
assertEquals("My Calendar", info.description)
assertEquals(0xFFFF0000.toInt(), info.color)
assertEquals("tzdata", info.timeZone)
assertTrue(info.supportsVEVENT)
assertTrue(info.supportsVTODO)
DavResource(httpClient.okHttpClient, server.url("/"))
.propfind(0, ResourceType.NAME).use {
val info = CollectionInfo(it)
assertEquals(CollectionInfo.Type.CALENDAR, info.type)
assertTrue(info.readOnly)
assertNull(info.displayName)
assertEquals("My Calendar", info.description)
assertEquals(0xFFFF0000.toInt(), info.color)
assertEquals("tzdata", info.timeZone)
assertTrue(info.supportsVEVENT)
assertTrue(info.supportsVTODO)
}
}
@Test
......
......@@ -68,31 +68,26 @@ class DavResourceFinderTest {
@Test
@SmallTest
fun testRememberIfAddressBookOrHomeset() {
// before dav.propfind(), no info is available
var dav = DavResource(client.okHttpClient, server.url(PATH_CARDDAV + SUBPATH_PRINCIPAL))
ServiceInfo().let { info ->
finder.rememberIfAddressBookOrHomeset(dav, info)
assertEquals(0, info.collections.size)
assertEquals(0, info.homeSets.size)
}
// recognize home set
dav.propfind(0, AddressbookHomeSet.NAME)
ServiceInfo().let { info ->
finder.rememberIfAddressBookOrHomeset(dav, info)
assertEquals(0, info.collections.size)
assertEquals(1, info.homeSets.size)
assertEquals(server.url("$PATH_CARDDAV$SUBPATH_ADDRESSBOOK_HOMESET/").uri(), info.homeSets.first())
DavResource(client.okHttpClient, server.url(PATH_CARDDAV + SUBPATH_PRINCIPAL))
.propfind(0, AddressbookHomeSet.NAME).use {
ServiceInfo().let { info ->
finder.rememberIfAddressBookOrHomeset(it, info)
assertEquals(0, info.collections.size)
assertEquals(1, info.homeSets.size)
assertEquals(server.url("$PATH_CARDDAV$SUBPATH_ADDRESSBOOK_HOMESET/").uri(), info.homeSets.first())
}
}
// recognize address book
dav = DavResource(client.okHttpClient, server.url(PATH_CARDDAV + SUBPATH_ADDRESSBOOK))
dav.propfind(0, ResourceType.NAME)
ServiceInfo().let { info ->
finder.rememberIfAddressBookOrHomeset(dav, info)
assertEquals(1, info.collections.size)
assertEquals(server.url("$PATH_CARDDAV$SUBPATH_ADDRESSBOOK/").uri(), info.collections.keys.first())
assertEquals(0, info.homeSets.size)
DavResource(client.okHttpClient, server.url(PATH_CARDDAV + SUBPATH_ADDRESSBOOK))
.propfind(0, ResourceType.NAME).use {
ServiceInfo().let { info ->
finder.rememberIfAddressBookOrHomeset(it, info)
assertEquals(1, info.collections.size)
assertEquals(server.url("$PATH_CARDDAV$SUBPATH_ADDRESSBOOK/").uri(), info.collections.keys.first())
assertEquals(0, info.homeSets.size)
}
}
}
......
......@@ -207,6 +207,7 @@ abstract class SyncManager<out ResourceType: LocalResource<*>, out CollectionTyp
}
// sync was cancelled: re-throw to SyncAdapterService
catch (e: InterruptedException) { throw e }
catch (e: InterruptedIOException) { throw e }
// specific I/O errors
catch (e: SSLHandshakeException) {
......@@ -436,7 +437,7 @@ abstract class SyncManager<out ResourceType: LocalResource<*>, out CollectionTyp
val channel: String
val priority: Int
if (e is IOException || e is InterruptedIOException) {
if (e is IOException) {
channel = NotificationUtils.CHANNEL_SYNC_IO_ERRORS
priority = NotificationCompat.PRIORITY_MIN
} else {
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment