Search in sources :

Example 46 with NotFoundException

use of org.apache.kafka.connect.errors.NotFoundException in project kafka by apache.

the class ConnectorsResourceTest method testGetConnectorConfigConnectorNotFound.

@Test
public void testGetConnectorConfigConnectorNotFound() {
    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();
    assertThrows(NotFoundException.class, () -> connectorsResource.getConnectorConfig(CONNECTOR_NAME, NULL_HEADERS, FORWARD));
    PowerMock.verifyAll();
}
Also used : Callback(org.apache.kafka.connect.util.Callback) NotFoundException(org.apache.kafka.connect.errors.NotFoundException) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) Test(org.junit.Test)

Example 47 with NotFoundException

use of org.apache.kafka.connect.errors.NotFoundException in project kafka by apache.

the class ConnectorsResourceTest method testGetConnectorTaskConfigsConnectorNotFound.

@Test
public void testGetConnectorTaskConfigsConnectorNotFound() {
    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();
    assertThrows(NotFoundException.class, () -> connectorsResource.getTaskConfigs(CONNECTOR_NAME, NULL_HEADERS, FORWARD));
    PowerMock.verifyAll();
}
Also used : TaskInfo(org.apache.kafka.connect.runtime.rest.entities.TaskInfo) Callback(org.apache.kafka.connect.util.Callback) NotFoundException(org.apache.kafka.connect.errors.NotFoundException) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) Test(org.junit.Test)

Example 48 with NotFoundException

use of org.apache.kafka.connect.errors.NotFoundException in project kafka by apache.

the class ConnectorsResourceTest method testRestartConnectorNotFound.

@Test
public void testRestartConnectorNotFound() {
    final Capture<Callback<Void>> cb = Capture.newInstance();
    herder.restartConnector(EasyMock.eq(CONNECTOR_NAME), EasyMock.capture(cb));
    expectAndCallbackException(cb, new NotFoundException("not found"));
    PowerMock.replayAll();
    assertThrows(NotFoundException.class, () -> connectorsResource.restartConnector(CONNECTOR_NAME, NULL_HEADERS, false, false, FORWARD));
    PowerMock.verifyAll();
}
Also used : Callback(org.apache.kafka.connect.util.Callback) NotFoundException(org.apache.kafka.connect.errors.NotFoundException) PrepareForTest(org.powermock.core.classloader.annotations.PrepareForTest) Test(org.junit.Test)

Aggregations

NotFoundException (org.apache.kafka.connect.errors.NotFoundException)48 Test (org.junit.Test)22 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)22 Callback (org.apache.kafka.connect.util.Callback)14 ConnectorTaskId (org.apache.kafka.connect.util.ConnectorTaskId)11 ConnectException (org.apache.kafka.connect.errors.ConnectException)9 ExecutionException (java.util.concurrent.ExecutionException)8 FutureCallback (org.apache.kafka.connect.util.FutureCallback)8 ArrayList (java.util.ArrayList)7 ConnectorInfo (org.apache.kafka.connect.runtime.rest.entities.ConnectorInfo)7 ConnectorStateInfo (org.apache.kafka.connect.runtime.rest.entities.ConnectorStateInfo)6 TaskInfo (org.apache.kafka.connect.runtime.rest.entities.TaskInfo)6 NoSuchElementException (java.util.NoSuchElementException)5 TimeoutException (java.util.concurrent.TimeoutException)5 WakeupException (org.apache.kafka.common.errors.WakeupException)5 AlreadyExistsException (org.apache.kafka.connect.errors.AlreadyExistsException)5 RestartRequest (org.apache.kafka.connect.runtime.RestartRequest)5 Herder (org.apache.kafka.connect.runtime.Herder)4 BadRequestException (org.apache.kafka.connect.runtime.rest.errors.BadRequestException)4 Connector (org.apache.kafka.connect.connector.Connector)3