public void UdpInputCRUD() { Service service = Connect(); InputCollection inputCollection = service.GetInputs(); string port = "9997"; // test port // CRUD UDP input if (inputCollection.ContainsKey(port)) { inputCollection.Remove(port); inputCollection.Refresh(); } Assert.IsFalse(inputCollection.ContainsKey(port), assertRoot + "#34"); inputCollection.Create(port, InputKind.Udp); Assert.IsTrue(inputCollection.ContainsKey(port), assertRoot + "#35"); UdpInput udpInput = (UdpInput)inputCollection.Get(port); udpInput.ConnectionHost = "ip"; udpInput.Host = "myhost"; udpInput.Index = "main"; udpInput.NoAppendingTimeStamp = true; udpInput.NoPriorityStripping = true; udpInput.Queue = "indexQueue"; udpInput.Source = "mysource"; udpInput.SourceType = "mysourcetype"; udpInput.Update(); Assert.AreEqual("ip", udpInput.ConnectionHost, assertRoot + "#36"); Assert.AreEqual("myhost", udpInput.Host, assertRoot + "#37"); Assert.AreEqual("main", udpInput.Index, assertRoot + "#38"); Assert.IsTrue(udpInput.NoAppendingTimeStamp, assertRoot + "#39"); Assert.IsTrue(udpInput.NoPriorityStripping, assertRoot + "#40"); Assert.AreEqual("indexQueue", udpInput.Queue, assertRoot + "#41"); Assert.AreEqual("mysource", udpInput.Source, assertRoot + "#42"); Assert.AreEqual("mysourcetype", udpInput.SourceType, assertRoot + "#43"); udpInput.Remove(); inputCollection.Refresh(); Assert.IsFalse(inputCollection.ContainsKey(port), assertRoot + "#44"); }
/// <summary> /// Touch all the properties of all any input /// </summary> /// <param name="input">The Input</param> private void TouchSpecificInput(Input input) { InputKind inputKind = input.GetKind(); TcpConnections tcpConnections = null; UdpConnections udpConnections = null; string[] dummyStrings; string dummyString; bool dummyBoolean; DateTime dummyDate; int dummyInt; if (inputKind.Equals(InputKind.Monitor)) { MonitorInput monitorInput = (MonitorInput)input; dummyString = monitorInput.Blacklist; dummyString = monitorInput.CrcSalt; dummyInt = monitorInput.FileCount; dummyBoolean = monitorInput.FollowTail; dummyString = monitorInput.Host; dummyString = monitorInput.HostRegex; dummyString = monitorInput.IgnoreOlderThan; dummyString = monitorInput.Index; dummyString = monitorInput.Queue; dummyBoolean = monitorInput.IsRecursive; dummyString = monitorInput.Source; dummyString = monitorInput.SourceType; dummyInt = monitorInput.TimeBeforeClose; dummyString = monitorInput.Whitelist; } else if (inputKind.Equals(InputKind.Script)) { ScriptInput scriptInput = (ScriptInput)input; dummyDate = scriptInput.EndTime; dummyString = scriptInput.Group; dummyString = scriptInput.Host; dummyString = scriptInput.Index; dummyString = scriptInput.Interval; dummyDate = scriptInput.StartTime; } else if (inputKind.Equals(InputKind.Tcp)) { TcpInput tcpInput = (TcpInput)input; dummyString = tcpInput.ConnectionHost; dummyString = tcpInput.Group; dummyString = tcpInput.Host; dummyString = tcpInput.Index; dummyString = tcpInput.Queue; dummyString = tcpInput.RestrictToHost; dummyString = tcpInput.Source; dummyString = tcpInput.SourceType; dummyBoolean = tcpInput.SSL; tcpConnections = tcpInput.Connections(); dummyString = tcpConnections.Connection; dummyString = tcpConnections.Servername; } else if (inputKind.Equals(InputKind.TcpSplunk)) { TcpSplunkInput tcpSplunkInput = (TcpSplunkInput)input; dummyString = tcpSplunkInput.ConnectionHost; dummyString = tcpSplunkInput.Group; dummyString = tcpSplunkInput.Host; dummyString = tcpSplunkInput.Index; dummyString = tcpSplunkInput.Queue; dummyString = tcpSplunkInput.Source; dummyString = tcpSplunkInput.SourceType; dummyBoolean = tcpSplunkInput.SSL; tcpConnections = tcpSplunkInput.Connections(); dummyString = tcpConnections.Connection; dummyString = tcpConnections.Servername; } else if (inputKind.Equals(InputKind.Udp)) { UdpInput udpInput = (UdpInput)input; dummyString = udpInput.ConnectionHost; dummyString = udpInput.Group; dummyString = udpInput.Host; dummyString = udpInput.Index; dummyString = udpInput.Queue; dummyString = udpInput.Source; dummyString = udpInput.SourceType; dummyBoolean = udpInput.NoAppendingTimeStamp; dummyBoolean = udpInput.NoPriorityStripping; udpConnections = udpInput.Connections(); dummyString = udpConnections.Group; } else if (inputKind.Equals(InputKind.WindowsActiveDirectory)) { WindowsActiveDirectoryInput windowsActiveDirectoryInput = (WindowsActiveDirectoryInput)input; dummyString = windowsActiveDirectoryInput.Index; dummyBoolean = windowsActiveDirectoryInput.MonitorSubtree; dummyString = windowsActiveDirectoryInput.StartingNode; dummyString = windowsActiveDirectoryInput.TargetDc; } else if (inputKind.Equals(InputKind.WindowsEventLog)) { WindowsEventLogInput windowsEventLogInput = (WindowsEventLogInput)input; dummyString = windowsEventLogInput.Hosts; dummyString = windowsEventLogInput.Index; dummyString = windowsEventLogInput.LocalName; dummyStrings = windowsEventLogInput.Logs; dummyString = windowsEventLogInput.LookupHost; } else if (inputKind.Equals(InputKind.WindowsPerfmon)) { WindowsPerfmonInput windowsPerfmonInput = (WindowsPerfmonInput)input; dummyStrings = windowsPerfmonInput.Counters; dummyString = windowsPerfmonInput.Index; dummyStrings = windowsPerfmonInput.Instances; dummyInt = windowsPerfmonInput.Interval; dummyString = windowsPerfmonInput.Object; } else if (inputKind.Equals(InputKind.WindowsRegistry)) { WindowsRegistryInput windowsRegistryInput = (WindowsRegistryInput)input; dummyBoolean = windowsRegistryInput.Baseline; dummyString = windowsRegistryInput.Hive; dummyString = windowsRegistryInput.Index; dummyBoolean = windowsRegistryInput.MonitorSubnodes; dummyString = windowsRegistryInput.Proc; dummyStrings = windowsRegistryInput.Type; } else if (inputKind.Equals(InputKind.WindowsWmi)) { WindowsWmiInput windowsWmiInput = (WindowsWmiInput)input; dummyString = windowsWmiInput.Classes; dummyStrings = windowsWmiInput.Fields; dummyString = windowsWmiInput.Index; dummyStrings = windowsWmiInput.Instances; dummyInt = windowsWmiInput.Interval; dummyString = windowsWmiInput.LocalName; dummyString = windowsWmiInput.LookupHost; dummyString = windowsWmiInput.Servers; dummyString = windowsWmiInput.Wql; } else { Assert.Fail(); } }