Skip to content

Commit

Permalink
Merge pull request #555 from xinlian12/fixNullPointerException
Browse files Browse the repository at this point in the history
fixNullPointerException
xinlian12 authored Feb 29, 2024
2 parents d893680 + dee691d commit fbb83ea
Showing 4 changed files with 22 additions and 3 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,9 @@
## Release History

### 1.14.1 (2024-02-29)
#### Key Bug Fixes
* Fixed `NullPointerException` in `CosmosDBSourceConnector`. [PR 555](https://github.com/microsoft/kafka-connect-cosmosdb/pull/555)

### 1.14.0 (2024-02-28)
#### New Features
* Updated `azure-cosmos` version to 4.56.0.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@

<groupId>com.azure.cosmos.kafka</groupId>
<artifactId>kafka-connect-cosmos</artifactId>
<version>1.14.0</version>
<version>1.14.1</version>

<name> kafka-connect-cosmos</name>
<url>https://github.com/microsoft/kafka-connect-cosmosdb</url>
Original file line number Diff line number Diff line change
@@ -63,8 +63,9 @@ public String version() {

@Override
public void start(Map<String, String> map) {
logger.info("Worker {} Starting CosmosDBSourceTask.", this.config.getWorkerName());
config = new CosmosDBSourceConfig(map);
logger.info("Starting CosmosDBSourceTask.");
config = new CosmosDBSourceConfig(map);

this.queue = new LinkedTransferQueue<>();

logger.info("Worker {} Creating the client.", this.config.getWorkerName());
Original file line number Diff line number Diff line change
@@ -9,6 +9,7 @@
import static org.mockito.Mockito.when;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
@@ -31,6 +32,8 @@
import org.mockito.Mockito;

public class CosmosDBSourceTaskTest {
private final static String COSMOS_EMULATOR_KEY = "C2y6yDjf5/R+ob0N8A7Cgv30VRDJIWEHLM+4QDU5DE2nQ9nDuVTqobD4b8mGGyPMbIZnqyMsEcaGQy67XIw/Jw==";
private final static String COSMOS_EMULATOR_HOST = "https://localhost:8081/";
private CosmosDBSourceTask testTask;
private final String topicName = "testtopic";
private final String containerName = "container666";
@@ -96,6 +99,17 @@ public void setup() throws IllegalAccessException {

}

@Test(expected = IllegalArgumentException.class)
public void start() {
CosmosDBSourceTask testTask = new CosmosDBSourceTask();
HashMap<String, String> configs = new HashMap<>();
configs.put(CosmosDBSourceConfig.COSMOS_CONN_ENDPOINT_CONF, COSMOS_EMULATOR_HOST);
configs.put(CosmosDBSourceConfig.COSMOS_CONN_KEY_CONF, COSMOS_EMULATOR_KEY);
configs.put(CosmosDBSourceConfig.COSMOS_DATABASE_NAME_CONF, "mydb");
configs.put(CosmosDBSourceConfig.COSMOS_CONTAINER_TOPIC_MAP_CONF, "mytopic5#mycontainer6");
testTask.start(sourceSettings);
}

@Test
public void testHandleChanges() throws JsonProcessingException, IllegalAccessException, InterruptedException {
String jsonString = "{\"k1\":\"v1\",\"k2\":\"v2\", \"_lsn\":\"2\"}";

0 comments on commit fbb83ea

Please sign in to comment.