use of com.azure.cosmos.implementation.BadRequestException in project kafka-connect-cosmosdb by microsoft.
the class CosmosDBSinkTaskTestNotFails method testPutMapThatFailsDoesNotStopTask.
@Test
public void testPutMapThatFailsDoesNotStopTask() throws JsonProcessingException, IllegalAccessException {
Schema stringSchema = new ConnectSchema(Schema.Type.STRING);
Schema mapSchema = new ConnectSchema(Schema.Type.MAP);
when(mockContainer.upsertItem(any())).thenThrow(new BadRequestException("Something"));
SinkRecord record = new SinkRecord(topicName, 1, stringSchema, "nokey", mapSchema, "{", 0L);
testTask.put(List.of(record));
}
use of com.azure.cosmos.implementation.BadRequestException in project DataSpaceConnector by eclipse-dataspaceconnector.
the class LeaseContextTest method breakLease_throwsException.
@Test
void breakLease_throwsException() {
when(cosmosDbApiMock.invokeStoredProcedure(eq("lease"), eq(TEST_PARTITION_KEY), any())).thenThrow(new BadRequestException("foo"));
assertThatThrownBy(() -> context.breakLease("test-doc-id")).isInstanceOf(BadRequestException.class);
verify(cosmosDbApiMock, times(1)).invokeStoredProcedure("lease", TEST_PARTITION_KEY, "test-doc-id", "me", false);
}
use of com.azure.cosmos.implementation.BadRequestException in project DataSpaceConnector by eclipse-dataspaceconnector.
the class LeaseContextTest method acquireLease_throwsException.
@Test
void acquireLease_throwsException() {
when(cosmosDbApiMock.invokeStoredProcedure(eq("lease"), eq(TEST_PARTITION_KEY), any())).thenThrow(new BadRequestException("foo"));
assertThatThrownBy(() -> context.acquireLease("test-doc-id")).isInstanceOf(BadRequestException.class);
verify(cosmosDbApiMock, times(1)).invokeStoredProcedure("lease", TEST_PARTITION_KEY, "test-doc-id", "me", true);
}
use of com.azure.cosmos.implementation.BadRequestException in project DataSpaceConnector by eclipse-dataspaceconnector.
the class CosmosLeaseContextTest method acquireLease_throwsException.
@Test
void acquireLease_throwsException() {
when(cosmosDbApiMock.invokeStoredProcedure(eq("lease"), eq(TEST_PARTITION_KEY), any())).thenThrow(new BadRequestException("foo"));
assertThatThrownBy(() -> context.acquireLease("test-doc-id")).isInstanceOf(BadRequestException.class);
verify(cosmosDbApiMock, times(1)).invokeStoredProcedure("lease", TEST_PARTITION_KEY, "test-doc-id", "me", true);
}
use of com.azure.cosmos.implementation.BadRequestException in project DataSpaceConnector by eclipse-dataspaceconnector.
the class CosmosLeaseContextTest method breakLease_throwsException.
@Test
void breakLease_throwsException() {
when(cosmosDbApiMock.invokeStoredProcedure(eq("lease"), eq(TEST_PARTITION_KEY), any())).thenThrow(new BadRequestException("foo"));
assertThatThrownBy(() -> context.breakLease("test-doc-id")).isInstanceOf(BadRequestException.class);
verify(cosmosDbApiMock, times(1)).invokeStoredProcedure("lease", TEST_PARTITION_KEY, "test-doc-id", "me", false);
}
Aggregations