com.splunk.modularinput
Class EventTest

java.lang.Object
  extended by com.splunk.modularinput.ModularInputTestCase
      extended by com.splunk.modularinput.EventTest

public class EventTest
extends ModularInputTestCase

Checks if Event and EventWriter behavior correctly.


Constructor Summary
EventTest()
           
 
Method Summary
 void testErrorInEventWriter()
          An event which cannot write itself onto an output stream (such as because it doesn't have a data field set) should write an error to stderr.
 void testEventWithoutEnoughFieldsFails()
          An event without a data field should throw an error when asked to write itself onto a stream.
 void testLoggingErrorsWithEventWriter()
          Check that the log method on EventWriter produces the expected error message on the stderr stream.
 void testWriteXmlDocumentIsSane()
          Check that EventWriter.writeXmlDocument writes sensible XML to the output stream.
 void testWritingEventsOnEventWriter()
          Write a pair of events with an EventWriter, and ensure that they are being encoded immediately and correctly onto the output stream.
 void testXmlOfEventWithMinimalConfiguration()
          Generate XML from an event object with a small number of fields, and see if it matches what we expect.
 void testXmlOfEventWithMoreConfiguration()
          Generate XML from an event with all its fields set, and see if it matches what we expect.
 
Methods inherited from class com.splunk.modularinput.ModularInputTestCase
assertXmlEqual, assertXmlEqual, nodeToXml, removeBlankTextNodes, resourceToXmlDocument, stringToXmlDocument, testCoercionMethods, testNormalizeBoolean
 
Methods inherited from class java.lang.Object
equals, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Constructor Detail

EventTest

public EventTest()
Method Detail

testEventWithoutEnoughFieldsFails

public void testEventWithoutEnoughFieldsFails()
                                       throws javax.xml.stream.XMLStreamException
An event without a data field should throw an error when asked to write itself onto a stream. Be sure that it does.

Throws:
javax.xml.stream.XMLStreamException

testXmlOfEventWithMinimalConfiguration

public void testXmlOfEventWithMinimalConfiguration()
                                            throws javax.xml.stream.XMLStreamException,
                                                   MalformedDataException,
                                                   javax.xml.transform.TransformerException,
                                                   javax.xml.parsers.ParserConfigurationException
Generate XML from an event object with a small number of fields, and see if it matches what we expect.

Throws:
javax.xml.stream.XMLStreamException
MalformedDataException
javax.xml.transform.TransformerException
javax.xml.parsers.ParserConfigurationException

testXmlOfEventWithMoreConfiguration

public void testXmlOfEventWithMoreConfiguration()
                                         throws MalformedDataException,
                                                javax.xml.stream.XMLStreamException,
                                                javax.xml.transform.TransformerException,
                                                javax.xml.parsers.ParserConfigurationException
Generate XML from an event with all its fields set, and see if it matches what we expect.

Throws:
MalformedDataException
javax.xml.stream.XMLStreamException
javax.xml.transform.TransformerException
javax.xml.parsers.ParserConfigurationException

testWritingEventsOnEventWriter

public void testWritingEventsOnEventWriter()
                                    throws javax.xml.stream.XMLStreamException,
                                           javax.xml.transform.TransformerException,
                                           javax.xml.parsers.ParserConfigurationException,
                                           MalformedDataException
Write a pair of events with an EventWriter, and ensure that they are being encoded immediately and correctly onto the output stream.

Throws:
javax.xml.stream.XMLStreamException
javax.xml.transform.TransformerException
javax.xml.parsers.ParserConfigurationException
MalformedDataException

testErrorInEventWriter

public void testErrorInEventWriter()
                            throws javax.xml.stream.XMLStreamException
An event which cannot write itself onto an output stream (such as because it doesn't have a data field set) should write an error to stderr. Check that it does so.

Throws:
javax.xml.stream.XMLStreamException

testLoggingErrorsWithEventWriter

public void testLoggingErrorsWithEventWriter()
                                      throws javax.xml.stream.XMLStreamException,
                                             java.io.IOException
Check that the log method on EventWriter produces the expected error message on the stderr stream.

Throws:
javax.xml.stream.XMLStreamException
java.io.IOException

testWriteXmlDocumentIsSane

public void testWriteXmlDocumentIsSane()
                                throws javax.xml.stream.XMLStreamException,
                                       java.io.IOException,
                                       javax.xml.transform.TransformerException,
                                       javax.xml.parsers.ParserConfigurationException
Check that EventWriter.writeXmlDocument writes sensible XML to the output stream.

Throws:
javax.xml.stream.XMLStreamException
java.io.IOException
javax.xml.transform.TransformerException
javax.xml.parsers.ParserConfigurationException