コード例 #1
0
  @Test
  public void testWindowsEventLogInputCrud() {
    Service service = connect();
    InputCollection inputCollection = service.getInputs();
    ServiceInfo info = service.getInfo();

    if (info.getOsName().equals("Windows")) {
      String name = "sdk-input-wel";
      Args args = new Args();

      if (inputCollection.containsKey(name)) {
        inputCollection.remove(name);
        inputCollection.refresh();
      }
      assertFalse(assertRoot + "#52", inputCollection.containsKey(name));

      // CRUD Windows Event Log Input
      args.put("lookup_host", "127.0.0.1");
      inputCollection.create(name, InputKind.WindowsEventLog, args);
      assertTrue(assertRoot + "#53", inputCollection.containsKey(name));
      WindowsEventLogInput windowsEventLogInput = (WindowsEventLogInput) inputCollection.get(name);

      windowsEventLogInput.setIndex("main");
      windowsEventLogInput.setLookupHost("127.0.0.1");
      windowsEventLogInput.setHosts("one.two.three,four.five.six");
      windowsEventLogInput.update();

      assertEquals(assertRoot + "#54", "127.0.0.1", windowsEventLogInput.getLookupHost());
      assertEquals(
          assertRoot + "#55", "one.two.three,four.five.six", windowsEventLogInput.getHosts());
      assertEquals(assertRoot + "#55", "main", windowsEventLogInput.getIndex());

      windowsEventLogInput.remove();
      inputCollection.refresh();
      assertFalse(assertRoot + "#56", inputCollection.containsKey(name));
    }
  }
コード例 #2
0
  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;
    }
  }