use of org.apache.kafka.connect.errors.NotFoundException in project apache-kafka-on-k8s by banzaicloud.
the class StandaloneHerder method deleteConnectorConfig.
@Override
public synchronized void deleteConnectorConfig(String connName, Callback<Created<ConnectorInfo>> callback) {
try {
if (!configState.contains(connName)) {
// Deletion, must already exist
callback.onCompletion(new NotFoundException("Connector " + connName + " not found", null), null);
return;
}
removeConnectorTasks(connName);
worker.stopConnector(connName);
configBackingStore.removeConnectorConfig(connName);
onDeletion(connName);
callback.onCompletion(null, new Created<ConnectorInfo>(false, null));
} catch (ConnectException e) {
callback.onCompletion(e, null);
}
}
use of org.apache.kafka.connect.errors.NotFoundException in project apache-kafka-on-k8s by banzaicloud.
the class StandaloneHerder method taskConfigs.
@Override
public synchronized void taskConfigs(String connName, Callback<List<TaskInfo>> callback) {
if (!configState.contains(connName)) {
callback.onCompletion(new NotFoundException("Connector " + connName + " not found", null), null);
return;
}
List<TaskInfo> result = new ArrayList<>();
for (ConnectorTaskId taskId : configState.tasks(connName)) result.add(new TaskInfo(taskId, configState.taskConfig(taskId)));
callback.onCompletion(null, result);
}
use of org.apache.kafka.connect.errors.NotFoundException in project apache-kafka-on-k8s by banzaicloud.
the class ConnectorsResourceTest method testGetConnectorTaskConfigsConnectorNotFound.
@Test(expected = NotFoundException.class)
public void testGetConnectorTaskConfigsConnectorNotFound() throws Throwable {
final Capture<Callback<List<TaskInfo>>> cb = Capture.newInstance();
herder.taskConfigs(EasyMock.eq(CONNECTOR_NAME), EasyMock.capture(cb));
expectAndCallbackException(cb, new NotFoundException("connector not found"));
PowerMock.replayAll();
connectorsResource.getTaskConfigs(CONNECTOR_NAME, FORWARD);
PowerMock.verifyAll();
}
use of org.apache.kafka.connect.errors.NotFoundException in project apache-kafka-on-k8s by banzaicloud.
the class ConnectorsResourceTest method testGetConnectorConfigConnectorNotFound.
@Test(expected = NotFoundException.class)
public void testGetConnectorConfigConnectorNotFound() throws Throwable {
final Capture<Callback<Map<String, String>>> cb = Capture.newInstance();
herder.connectorConfig(EasyMock.eq(CONNECTOR_NAME), EasyMock.capture(cb));
expectAndCallbackException(cb, new NotFoundException("not found"));
PowerMock.replayAll();
connectorsResource.getConnectorConfig(CONNECTOR_NAME, FORWARD);
PowerMock.verifyAll();
}
use of org.apache.kafka.connect.errors.NotFoundException in project apache-kafka-on-k8s by banzaicloud.
the class ConnectorsResourceTest method testRestartConnectorNotFound.
@Test(expected = NotFoundException.class)
public void testRestartConnectorNotFound() throws Throwable {
final Capture<Callback<Void>> cb = Capture.newInstance();
herder.restartConnector(EasyMock.eq(CONNECTOR_NAME), EasyMock.capture(cb));
expectAndCallbackException(cb, new NotFoundException("not found"));
PowerMock.replayAll();
connectorsResource.restartConnector(CONNECTOR_NAME, FORWARD);
PowerMock.verifyAll();
}
Aggregations