test_class.declarator: CONNECTOR_NAME = "test"
test_class.modifier: private static final
test_class.original_string: private static final String CONNECTOR_NAME = "test";
test_class.type: String
test_class.var_name: CONNECTOR_NAME
test_class.declarator: TOPICS_LIST = Arrays.asList("topic1", "topic2")
test_class.modifier: private static final
test_class.original_string: private static final List<String> TOPICS_LIST = Arrays.asList("topic1", "topic2");
test_class.type: List<String>
test_class.var_name: TOPICS_LIST
test_class.declarator: TOPICS_LIST_STR = "topic1,topic2"
test_class.modifier: private static final
test_class.original_string: private static final String TOPICS_LIST_STR = "topic1,topic2";
test_class.type: String
test_class.var_name: TOPICS_LIST_STR
test_class.declarator: DEFAULT_MAX_TASKS = 1
test_class.modifier: private static final
test_class.original_string: private static final int DEFAULT_MAX_TASKS = 1;
test_class.type: int
test_class.var_name: DEFAULT_MAX_TASKS
test_class.declarator: WORKER_ID = "localhost:8083"
test_class.modifier: private static final
test_class.original_string: private static final String WORKER_ID = "localhost:8083";
test_class.type: String
test_class.var_name: WORKER_ID
test_class.declarator: herder
test_class.modifier: private
test_class.original_string: private StandaloneHerder herder;
test_class.type: StandaloneHerder
test_class.var_name: herder
test_class.declarator: connector
test_class.modifier: private
test_class.original_string: private Connector connector;
test_class.type: Connector
test_class.var_name: connector
test_class.declarator: worker
test_class.modifier: @Mock protected
test_class.original_string: @Mock protected Worker worker;
test_class.type: Worker
test_class.var_name: worker
test_class.declarator: createCallback
test_class.modifier: @Mock protected
test_class.original_string: @Mock protected Callback<Herder.Created<ConnectorInfo>> createCallback;
test_class.type: Callback<Herder.Created<ConnectorInfo>>
test_class.var_name: createCallback
test_class.declarator: statusBackingStore
test_class.modifier: @Mock protected
test_class.original_string: @Mock protected StatusBackingStore statusBackingStore;
test_class.type: StatusBackingStore
test_class.var_name: statusBackingStore
test_class.file: connect/runtime/src/test/java/org/apache/kafka/connect/runtime/standalone/StandaloneHerderTest.java
test_class.identifier: StandaloneHerderTest
test_case.body: @Test
      public void testPutConnectorConfig() throws Exception {
          Map<String, String> connConfig = connectorConfig(CONNECTOR_NAME, BogusSourceConnector.class, false);
          Map<String, String> newConnConfig = new HashMap<>(connConfig);
          newConnConfig.put("foo", "bar");
  
          Callback<Map<String, String>> connectorConfigCb = PowerMock.createMock(Callback.class);
          Callback<Herder.Created<ConnectorInfo>> putConnectorConfigCb = PowerMock.createMock(Callback.class);
  
          // Create
          connector = PowerMock.createMock(BogusSourceConnector.class);
          expectAdd(CONNECTOR_NAME, BogusSourceConnector.class, BogusSourceTask.class, false);
          // Should get first config
          connectorConfigCb.onCompletion(null, connConfig);
          EasyMock.expectLastCall();
          // Update config, which requires stopping and restarting
          worker.stopConnector(CONNECTOR_NAME);
          EasyMock.expectLastCall();
          Capture<ConnectorConfig> capturedConfig = EasyMock.newCapture();
          worker.startConnector(EasyMock.capture(capturedConfig), EasyMock.<ConnectorContext>anyObject(),
                  EasyMock.eq(herder), EasyMock.eq(TargetState.STARTED));
          EasyMock.expectLastCall();
          EasyMock.expect(worker.isRunning(CONNECTOR_NAME)).andReturn(true);
          // Generate same task config, which should result in no additional action to restart tasks
          EasyMock.expect(worker.connectorTaskConfigs(CONNECTOR_NAME, DEFAULT_MAX_TASKS, null))
                  .andReturn(Collections.singletonList(taskConfig(BogusSourceTask.class, false)));
          worker.isSinkConnector(CONNECTOR_NAME);
          EasyMock.expectLastCall().andReturn(false);
          ConnectorInfo newConnInfo = new ConnectorInfo(CONNECTOR_NAME, newConnConfig, Arrays.asList(new ConnectorTaskId(CONNECTOR_NAME, 0)));
          putConnectorConfigCb.onCompletion(null, new Herder.Created<>(false, newConnInfo));
          EasyMock.expectLastCall();
          // Should get new config
          connectorConfigCb.onCompletion(null, newConnConfig);
          EasyMock.expectLastCall();
  
          PowerMock.replayAll();
  
          herder.putConnectorConfig(CONNECTOR_NAME, connConfig, false, createCallback);
          herder.connectorConfig(CONNECTOR_NAME, connectorConfigCb);
          herder.putConnectorConfig(CONNECTOR_NAME, newConnConfig, true, putConnectorConfigCb);
          assertEquals("bar", capturedConfig.getValue().originals().get("foo"));
          herder.connectorConfig(CONNECTOR_NAME, connectorConfigCb);
  
          PowerMock.verifyAll();
  
      }
test_case.class_method_signature: StandaloneHerderTest.testPutConnectorConfig()
test_case.full_signature: @Test public void testPutConnectorConfig()
test_case.identifier: testPutConnectorConfig
test_case.invocations: connectorConfig put createMock createMock createMock expectAdd onCompletion expectLastCall stopConnector expectLastCall newCapture startConnector capture anyObject eq eq expectLastCall andReturn expect isRunning andReturn expect connectorTaskConfigs singletonList taskConfig isSinkConnector andReturn expectLastCall asList onCompletion expectLastCall onCompletion expectLastCall replayAll putConnectorConfig connectorConfig putConnectorConfig assertEquals get originals getValue connectorConfig verifyAll
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void testPutConnectorConfig()
focal_class.declarator: log = LoggerFactory.getLogger(StandaloneHerder.class)
focal_class.modifier: private static final
focal_class.original_string: private static final Logger log = LoggerFactory.getLogger(StandaloneHerder.class);
focal_class.type: Logger
focal_class.var_name: log
focal_class.declarator: configState
focal_class.modifier: private
focal_class.original_string: private ClusterConfigState configState;
focal_class.type: ClusterConfigState
focal_class.var_name: configState
focal_class.file: connect/runtime/src/main/java/org/apache/kafka/connect/runtime/standalone/StandaloneHerder.java
focal_class.identifier: StandaloneHerder
focal_class.class_method_signature: StandaloneHerder.StandaloneHerder(Worker worker)
focal_class.full_signature: public  StandaloneHerder(Worker worker)
focal_class.identifier: StandaloneHerder
focal_class.modifiers: public
focal_class.parameters: (Worker worker)
focal_class.signature:  StandaloneHerder(Worker worker)
focal_class.class_method_signature: StandaloneHerder.StandaloneHerder(Worker worker,
                       String workerId,
                       StatusBackingStore statusBackingStore,
                       MemoryConfigBackingStore configBackingStore)
focal_class.full_signature:   StandaloneHerder(Worker worker,
                       String workerId,
                       StatusBackingStore statusBackingStore,
                       MemoryConfigBackingStore configBackingStore)
focal_class.identifier: StandaloneHerder
focal_class.parameters: (Worker worker,
                       String workerId,
                       StatusBackingStore statusBackingStore,
                       MemoryConfigBackingStore configBackingStore)
focal_class.signature:  StandaloneHerder(Worker worker,
                       String workerId,
                       StatusBackingStore statusBackingStore,
                       MemoryConfigBackingStore configBackingStore)
focal_class.class_method_signature: StandaloneHerder.start()
focal_class.full_signature: public synchronized void start()
focal_class.identifier: start
focal_class.modifiers: public synchronized
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void start()
focal_class.class_method_signature: StandaloneHerder.stop()
focal_class.full_signature: public synchronized void stop()
focal_class.identifier: stop
focal_class.modifiers: public synchronized
focal_class.parameters: ()
focal_class.return: void
focal_class.signature: void stop()
focal_class.class_method_signature: StandaloneHerder.generation()
focal_class.full_signature: @Override public int generation()
focal_class.identifier: generation
focal_class.modifiers: @Override public
focal_class.parameters: ()
focal_class.return: int
focal_class.signature: int generation()
focal_class.class_method_signature: StandaloneHerder.connectors(Callback<Collection<String>> callback)
focal_class.full_signature: @Override public synchronized void connectors(Callback<Collection<String>> callback)
focal_class.identifier: connectors
focal_class.modifiers: @Override public synchronized
focal_class.parameters: (Callback<Collection<String>> callback)
focal_class.return: void
focal_class.signature: void connectors(Callback<Collection<String>> callback)
focal_class.class_method_signature: StandaloneHerder.connectorInfo(String connName, Callback<ConnectorInfo> callback)
focal_class.full_signature: @Override public synchronized void connectorInfo(String connName, Callback<ConnectorInfo> callback)
focal_class.identifier: connectorInfo
focal_class.modifiers: @Override public synchronized
focal_class.parameters: (String connName, Callback<ConnectorInfo> callback)
focal_class.return: void
focal_class.signature: void connectorInfo(String connName, Callback<ConnectorInfo> callback)
focal_class.class_method_signature: StandaloneHerder.createConnectorInfo(String connector)
focal_class.full_signature: private ConnectorInfo createConnectorInfo(String connector)
focal_class.identifier: createConnectorInfo
focal_class.modifiers: private
focal_class.parameters: (String connector)
focal_class.return: ConnectorInfo
focal_class.signature: ConnectorInfo createConnectorInfo(String connector)
focal_class.class_method_signature: StandaloneHerder.connectorConfig(String connName, final Callback<Map<String, String>> callback)
focal_class.full_signature: @Override public void connectorConfig(String connName, final Callback<Map<String, String>> callback)
focal_class.identifier: connectorConfig
focal_class.modifiers: @Override public
focal_class.parameters: (String connName, final Callback<Map<String, String>> callback)
focal_class.return: void
focal_class.signature: void connectorConfig(String connName, final Callback<Map<String, String>> callback)
focal_class.class_method_signature: StandaloneHerder.putConnectorConfig(String connName,
                                                  final Map<String, String> config,
                                                  boolean allowReplace,
                                                  final Callback<Created<ConnectorInfo>> callback)
focal_class.full_signature: @Override public synchronized void putConnectorConfig(String connName,
                                                  final Map<String, String> config,
                                                  boolean allowReplace,
                                                  final Callback<Created<ConnectorInfo>> callback)
focal_class.identifier: putConnectorConfig
focal_class.modifiers: @Override public synchronized
focal_class.parameters: (String connName,
                                                  final Map<String, String> config,
                                                  boolean allowReplace,
                                                  final Callback<Created<ConnectorInfo>> callback)
focal_class.return: void
focal_class.signature: void putConnectorConfig(String connName,
                                                  final Map<String, String> config,
                                                  boolean allowReplace,
                                                  final Callback<Created<ConnectorInfo>> callback)
focal_class.class_method_signature: StandaloneHerder.requestTaskReconfiguration(String connName)
focal_class.full_signature: @Override public synchronized void requestTaskReconfiguration(String connName)
focal_class.identifier: requestTaskReconfiguration
focal_class.modifiers: @Override public synchronized
focal_class.parameters: (String connName)
focal_class.return: void
focal_class.signature: void requestTaskReconfiguration(String connName)
focal_class.class_method_signature: StandaloneHerder.taskConfigs(String connName, Callback<List<TaskInfo>> callback)
focal_class.full_signature: @Override public synchronized void taskConfigs(String connName, Callback<List<TaskInfo>> callback)
focal_class.identifier: taskConfigs
focal_class.modifiers: @Override public synchronized
focal_class.parameters: (String connName, Callback<List<TaskInfo>> callback)
focal_class.return: void
focal_class.signature: void taskConfigs(String connName, Callback<List<TaskInfo>> callback)
focal_class.class_method_signature: StandaloneHerder.putTaskConfigs(String connName, List<Map<String, String>> configs, Callback<Void> callback)
focal_class.full_signature: @Override public void putTaskConfigs(String connName, List<Map<String, String>> configs, Callback<Void> callback)
focal_class.identifier: putTaskConfigs
focal_class.modifiers: @Override public
focal_class.parameters: (String connName, List<Map<String, String>> configs, Callback<Void> callback)
focal_class.return: void
focal_class.signature: void putTaskConfigs(String connName, List<Map<String, String>> configs, Callback<Void> callback)
focal_class.class_method_signature: StandaloneHerder.restartTask(ConnectorTaskId taskId, Callback<Void> cb)
focal_class.full_signature: @Override public synchronized void restartTask(ConnectorTaskId taskId, Callback<Void> cb)
focal_class.identifier: restartTask
focal_class.modifiers: @Override public synchronized
focal_class.parameters: (ConnectorTaskId taskId, Callback<Void> cb)
focal_class.return: void
focal_class.signature: void restartTask(ConnectorTaskId taskId, Callback<Void> cb)
focal_class.class_method_signature: StandaloneHerder.restartConnector(String connName, Callback<Void> cb)
focal_class.full_signature: @Override public synchronized void restartConnector(String connName, Callback<Void> cb)
focal_class.identifier: restartConnector
focal_class.modifiers: @Override public synchronized
focal_class.parameters: (String connName, Callback<Void> cb)
focal_class.return: void
focal_class.signature: void restartConnector(String connName, Callback<Void> cb)
focal_class.class_method_signature: StandaloneHerder.startConnector(Map<String, String> connectorProps)
focal_class.full_signature: private String startConnector(Map<String, String> connectorProps)
focal_class.identifier: startConnector
focal_class.modifiers: private
focal_class.parameters: (Map<String, String> connectorProps)
focal_class.return: String
focal_class.signature: String startConnector(Map<String, String> connectorProps)
focal_class.class_method_signature: StandaloneHerder.recomputeTaskConfigs(String connName)
focal_class.full_signature: private List<Map<String, String>> recomputeTaskConfigs(String connName)
focal_class.identifier: recomputeTaskConfigs
focal_class.modifiers: private
focal_class.parameters: (String connName)
focal_class.return: List<Map<String, String>>
focal_class.signature: List<Map<String, String>> recomputeTaskConfigs(String connName)
focal_class.class_method_signature: StandaloneHerder.createConnectorTasks(String connName, TargetState initialState)
focal_class.full_signature: private void createConnectorTasks(String connName, TargetState initialState)
focal_class.identifier: createConnectorTasks
focal_class.modifiers: private
focal_class.parameters: (String connName, TargetState initialState)
focal_class.return: void
focal_class.signature: void createConnectorTasks(String connName, TargetState initialState)
focal_class.class_method_signature: StandaloneHerder.removeConnectorTasks(String connName)
focal_class.full_signature: private void removeConnectorTasks(String connName)
focal_class.identifier: removeConnectorTasks
focal_class.modifiers: private
focal_class.parameters: (String connName)
focal_class.return: void
focal_class.signature: void removeConnectorTasks(String connName)
focal_class.class_method_signature: StandaloneHerder.updateConnectorTasks(String connName)
focal_class.full_signature: private void updateConnectorTasks(String connName)
focal_class.identifier: updateConnectorTasks
focal_class.modifiers: private
focal_class.parameters: (String connName)
focal_class.return: void
focal_class.signature: void updateConnectorTasks(String connName)
focal_class.superclass: extends AbstractHerder
focal_method.body: @Override
      public synchronized void putConnectorConfig(String connName,
                                                  final Map<String, String> config,
                                                  boolean allowReplace,
                                                  final Callback<Created<ConnectorInfo>> callback) {
          try {
              boolean created = false;
              if (configState.contains(connName)) {
                  if (!allowReplace) {
                      callback.onCompletion(new AlreadyExistsException("Connector " + connName + " already exists"), null);
                      return;
                  }
                  if (config == null) // Deletion, kill tasks as well
                      removeConnectorTasks(connName);
                  worker.stopConnector(connName);
                  if (config == null) {
                      configBackingStore.removeConnectorConfig(connName);
                      onDeletion(connName);
                  }
              } else {
                  if (config == null) {
                      // Deletion, must already exist
                      callback.onCompletion(new NotFoundException("Connector " + connName + " not found", null), null);
                      return;
                  }
                  created = true;
              }
              if (config != null) {
                  startConnector(config);
                  updateConnectorTasks(connName);
              }
              if (config != null)
                  callback.onCompletion(null, new Created<>(created, createConnectorInfo(connName)));
              else
                  callback.onCompletion(null, new Created<ConnectorInfo>(false, null));
          } catch (ConnectException e) {
              callback.onCompletion(e, null);
          }
  
      }
focal_method.class_method_signature: StandaloneHerder.putConnectorConfig(String connName,
                                                  final Map<String, String> config,
                                                  boolean allowReplace,
                                                  final Callback<Created<ConnectorInfo>> callback)
focal_method.full_signature: @Override public synchronized void putConnectorConfig(String connName,
                                                  final Map<String, String> config,
                                                  boolean allowReplace,
                                                  final Callback<Created<ConnectorInfo>> callback)
focal_method.identifier: putConnectorConfig
focal_method.invocations: contains onCompletion removeConnectorTasks stopConnector removeConnectorConfig onDeletion onCompletion startConnector updateConnectorTasks onCompletion createConnectorInfo onCompletion onCompletion
focal_method.modifiers: @Override public synchronized
focal_method.parameters: (String connName,
                                                  final Map<String, String> config,
                                                  boolean allowReplace,
                                                  final Callback<Created<ConnectorInfo>> callback)
focal_method.return: void
focal_method.signature: void putConnectorConfig(String connName,
                                                  final Map<String, String> config,
                                                  boolean allowReplace,
                                                  final Callback<Created<ConnectorInfo>> callback)