Search in sources :

Example 6 with CSVConverter

use of alma.acs.logging.tools.CSVConverter in project ACS by ACS-Community.

the class ConvertersTest method testCSVConverterAllFields.

/**
	 * Test the CSV converter whose converted string
	 * contains all the log fields
	 * 
	 * @throws Exception
	 */
public void testCSVConverterAllFields() throws Exception {
    CSVConverter converter = new CSVConverter();
    assertNotNull(converter);
    String ret = converter.convert(logToConvert);
    assertNotNull(ret);
    assertFalse("The convertion returned an empty string", ret.isEmpty());
    // Build the string that the converted should have returned
    StringBuilder testSB = new StringBuilder();
    for (String str : logFields) {
        if (str.equals(type) || str.equals(message)) {
            testSB.append('"');
            testSB.append(str);
            testSB.append('"');
        } else {
            testSB.append(str);
        }
        testSB.append(',');
    }
    testSB.append("\"[");
    testSB.append(DataName1.replaceAll("\"", ""));
    testSB.append(" ==> ");
    testSB.append(DataValue1);
    testSB.append("] [");
    testSB.append(DataName2.replaceAll("\"", ""));
    testSB.append(" ==> ");
    testSB.append(DataValue2);
    testSB.append("]\"\n");
    assertEquals(testSB.toString(), ret);
}
Also used : CSVConverter(alma.acs.logging.tools.CSVConverter)

Aggregations

CSVConverter (alma.acs.logging.tools.CSVConverter)6 TextConverter (alma.acs.logging.tools.TextConverter)2 TwikiTableConverter (alma.acs.logging.tools.TwikiTableConverter)2 XMLConverter (alma.acs.logging.tools.XMLConverter)2 ILogEntry (com.cosylab.logging.engine.log.ILogEntry)1 UserInfoDlg (com.cosylab.logging.settings.UserInfoDlg)1