@Test
  public void testTcpInputCrud() {
    Service service = connect();
    InputCollection inputCollection = service.getInputs();
    String port = "9999"; // test port

    // CRUD TCP (raw) input
    if (inputCollection.containsKey(port)) {
      inputCollection.remove(port);
      inputCollection.refresh();
    }
    assertFalse(assertRoot + "#19", inputCollection.containsKey(port));

    inputCollection.create(port, InputKind.Tcp);
    assertTrue(assertRoot + "#20", inputCollection.containsKey(port));
    TcpInput tcpInput = (TcpInput) inputCollection.get(port);

    tcpInput.setConnectionHost("one.two.three");
    tcpInput.setHost("myhost");
    tcpInput.setIndex("main");
    tcpInput.setQueue("indexQueue");
    if (service.versionCompare("4.3") >= 0) {
      // Behavioral difference between 4.3 and earlier versions
      tcpInput.setRawTcpDoneTimeout(120);
      tcpInput.setRestrictToHost("four.five.com");
    }
    tcpInput.setSource("tcp");
    tcpInput.setSourceType("sdk-tests");
    tcpInput.setSSL(false);
    tcpInput.update();

    assertEquals(assertRoot + "#21", "one.two.three", tcpInput.getConnectionHost());
    assertEquals(assertRoot + "#22", "myhost", tcpInput.getHost());
    assertEquals(assertRoot + "#23", "main", tcpInput.getIndex());
    assertEquals(assertRoot + "#24", "indexQueue", tcpInput.getQueue());
    assertEquals(assertRoot + "#25", "tcp", tcpInput.getSource());
    assertEquals(assertRoot + "#26", "sdk-tests", tcpInput.getSourceType());
    assertFalse(assertRoot + "#27", tcpInput.getSSL());

    tcpInput.remove();
    inputCollection.refresh();
    assertFalse(assertRoot + "#28", inputCollection.containsKey(port));
  }
  private void touchSpecificInput(Input input) {
    InputKind inputKind = input.getKind();
    TcpConnections tcpConnections = null;
    UdpConnections udpConnections = null;

    switch (inputKind) {
      case Monitor:
        MonitorInput monitorInput = (MonitorInput) input;
        monitorInput.getBlacklist();
        monitorInput.getCrcSalt();
        monitorInput.getFileCount();
        monitorInput.getFollowTail();
        monitorInput.getHost();
        monitorInput.getHostRegex();
        monitorInput.getIgnoreOlderThan();
        monitorInput.getIndex();
        monitorInput.getQueue();
        monitorInput.getRcvBuf();
        monitorInput.getRecursive();
        monitorInput.getSource();
        monitorInput.getSourceType();
        monitorInput.getTimeBeforeClose();
        monitorInput.getWhitelist();
        break;
      case Script:
        ScriptInput scriptInput = (ScriptInput) input;
        scriptInput.getEndTime();
        scriptInput.getGroup();
        scriptInput.getHost();
        scriptInput.getIndex();
        scriptInput.getInterval();
        scriptInput.getRcvBuf();
        scriptInput.getStartTime();
        break;
      case Tcp:
        TcpInput tcpInput = (TcpInput) input;
        tcpInput.getConnectionHost();
        tcpInput.getGroup();
        tcpInput.getHost();
        tcpInput.getIndex();
        tcpInput.getQueue();
        tcpInput.getRcvBuf();
        tcpInput.getRestrictToHost();
        tcpInput.getSource();
        tcpInput.getSourceType();
        tcpInput.getSSL();
        tcpConnections = tcpInput.connections();
        tcpConnections.getConnection();
        tcpConnections.getServername();
        break;
      case TcpSplunk:
        TcpSplunkInput tcpSplunkInput = (TcpSplunkInput) input;
        tcpSplunkInput.getConnectionHost();
        tcpSplunkInput.getGroup();
        tcpSplunkInput.getHost();
        tcpSplunkInput.getIndex();
        tcpSplunkInput.getQueue();
        tcpSplunkInput.getRcvBuf();
        tcpSplunkInput.getSource();
        tcpSplunkInput.getSourceType();
        tcpSplunkInput.getSSL();
        tcpConnections = tcpSplunkInput.connections();
        tcpConnections.getConnection();
        tcpConnections.getServername();
        break;
      case Udp:
        UdpInput udpInput = (UdpInput) input;
        udpInput.getConnectionHost();
        udpInput.getGroup();
        udpInput.getHost();
        udpInput.getIndex();
        udpInput.getQueue();
        udpInput.getRcvBuf();
        udpInput.getSource();
        udpInput.getSourceType();
        udpInput.getNoAppendingTimeStamp();
        udpInput.getNoPriorityStripping();
        udpConnections = udpInput.connections();
        udpConnections.getGroup();
        break;
      case WindowsActiveDirectory:
        WindowsActiveDirectoryInput windowsActiveDirectoryInput =
            (WindowsActiveDirectoryInput) input;
        windowsActiveDirectoryInput.getIndex();
        windowsActiveDirectoryInput.getMonitorSubtree();
        windowsActiveDirectoryInput.getStartingNode();
        windowsActiveDirectoryInput.getTargetDc();
        break;
      case WindowsEventLog:
        WindowsEventLogInput windowsEventLogInput = (WindowsEventLogInput) input;
        windowsEventLogInput.getHosts();
        windowsEventLogInput.getIndex();
        windowsEventLogInput.getLocalName();
        windowsEventLogInput.getLogs();
        windowsEventLogInput.getLookupHost();
        break;
      case WindowsPerfmon:
        WindowsPerfmonInput windowsPerfmonInput = (WindowsPerfmonInput) input;
        windowsPerfmonInput.getCounters();
        windowsPerfmonInput.getIndex();
        windowsPerfmonInput.getInstances();
        windowsPerfmonInput.getInterval();
        windowsPerfmonInput.getObject();
        break;
      case WindowsRegistry:
        WindowsRegistryInput windowsRegistryInput = (WindowsRegistryInput) input;
        windowsRegistryInput.getBaseline();
        windowsRegistryInput.getHive();
        windowsRegistryInput.getIndex();
        windowsRegistryInput.getMonitorSubnodes();
        windowsRegistryInput.getProc();
        windowsRegistryInput.getType();
        break;
      case WindowsWmi:
        WindowsWmiInput windowsWmiInput = (WindowsWmiInput) input;
        windowsWmiInput.getClasses();
        windowsWmiInput.getFields();
        windowsWmiInput.getIndex();
        windowsWmiInput.getInstances();
        windowsWmiInput.getInterval();
        windowsWmiInput.getLocalName();
        windowsWmiInput.getLookupHost();
        windowsWmiInput.getServers();
        windowsWmiInput.getWql();
        break;
    }
  }