use of alma.acs.logging.engine.parser.ACSLogParser in project ACS by ACS-Community.
the class AntennaReductionTest method createLog.
private ILogEntry createLog(String logMsg) throws Exception {
ACSLogParser parser = ACSLogParserFactory.getParser();
long now = Calendar.getInstance().getTimeInMillis();
SimpleDateFormat df = new IsoDateFormat();
Date dt = new Date(now);
StringBuffer dateSB = new StringBuffer();
FieldPosition pos = new FieldPosition(0);
df.format(dt, dateSB, pos);
StringBuilder logStr = new StringBuilder("<Info TimeStamp=\"");
logStr.append(dateSB.toString());
logStr.append("\" Routine=\"CacheTest::testGet\" Host=\"this\" Process=\"test\" Thread=\"main\" Context=\"\"><![CDATA[");
logStr.append(logMsg);
logStr.append("]]></Info>");
ILogEntry newLog = parser.parse(logStr.toString());
return newLog;
}
use of alma.acs.logging.engine.parser.ACSLogParser in project ACS by ACS-Community.
the class LogProcessorTest method createLog.
private ILogEntry createLog(String logMsg) throws Exception {
ACSLogParser parser = ACSLogParserFactory.getParser();
long now = Calendar.getInstance().getTimeInMillis();
SimpleDateFormat df = new IsoDateFormat();
Date dt = new Date(now);
StringBuffer dateSB = new StringBuffer();
FieldPosition pos = new FieldPosition(0);
df.format(dt, dateSB, pos);
StringBuilder logStr = new StringBuilder("<Info TimeStamp=\"");
logStr.append(dateSB.toString());
logStr.append("\" Routine=\"CacheTest::testGet\" Host=\"this\" Process=\"test\" Thread=\"main\" Context=\"\"><![CDATA[");
logStr.append(logMsg);
logStr.append("]]></Info>");
ILogEntry newLog = parser.parse(logStr.toString());
return newLog;
}
use of alma.acs.logging.engine.parser.ACSLogParser 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);
}
}
Aggregations