Search in sources :

Example 11 with AdditionalData

use of com.cosylab.logging.engine.log.ILogEntry.AdditionalData in project ACS by ACS-Community.

the class ConvertersTest method testXML.

/**
	 * Test the XML conversion
	 * 
	 * @throws Exception
	 */
public void testXML() throws Exception {
    XMLConverter converter = new XMLConverter();
    assertNotNull(converter);
    String ret = converter.convert(logToConvert);
    assertNotNull(ret);
    ParserTypes type = ParserTypes.VTD;
    ACSLogParser parser = ACSLogParserFactory.getParser(type);
    ILogEntry log = parser.parse(ret);
    assertNotNull(log);
    for (LogField f : LogField.values()) {
        Object original = logToConvert.getField(f);
        Object converted = log.getField(f);
        assertEquals(original, converted);
    }
    Vector<AdditionalData> originalData = logToConvert.getAdditionalData();
    assertNotNull(originalData);
    Vector<AdditionalData> convertedData = log.getAdditionalData();
    assertNotNull(convertedData);
    assertEquals(originalData.size(), convertedData.size());
    for (AdditionalData ad : originalData) {
        boolean found = false;
        String name = ad.name;
        String val = ad.value;
        for (AdditionalData adConverted : convertedData) {
            if (name.equals(adConverted.name)) {
                found = true;
                assertEquals(val, adConverted.value);
                break;
            }
        }
        assertTrue("Additional data not found", found);
    }
}
Also used : AdditionalData(com.cosylab.logging.engine.log.ILogEntry.AdditionalData) ILogEntry(com.cosylab.logging.engine.log.ILogEntry) XMLConverter(alma.acs.logging.tools.XMLConverter) ParserTypes(alma.acs.logging.engine.parser.ACSLogParserFactory.ParserTypes) ACSLogParser(alma.acs.logging.engine.parser.ACSLogParser) LogField(com.cosylab.logging.engine.log.LogField)

Aggregations

AdditionalData (com.cosylab.logging.engine.log.ILogEntry.AdditionalData)11 ILogEntry (com.cosylab.logging.engine.log.ILogEntry)9 LogEntry (com.cosylab.logging.engine.log.LogEntry)5 LogTypeHelper (com.cosylab.logging.engine.log.LogTypeHelper)4 ParserTypes (alma.acs.logging.engine.parser.ACSLogParserFactory.ParserTypes)3 ACSLogParser (alma.acs.logging.engine.parser.ACSLogParser)2 LogField (com.cosylab.logging.engine.log.LogField)2 LogBinaryRecord (alma.ACSLoggingLog.LogBinaryRecord)1 NameValue (alma.ACSLoggingLog.NameValue)1 IOHelper (alma.acs.logging.engine.io.IOHelper)1 XMLConverter (alma.acs.logging.tools.XMLConverter)1 LogParseException (com.cosylab.logging.engine.ACS.LogParseException)1 LogEngineException (com.cosylab.logging.engine.LogEngineException)1 ByteArrayOutputStream (java.io.ByteArrayOutputStream)1 ParseException (java.text.ParseException)1 Date (java.util.Date)1 Vector (java.util.Vector)1