use of alma.acs.manager.logparser.ManagerStdoutParser.ComponentRequestKey in project ACS by ACS-Community.
the class ManagerStdoutParserTest method testParseLine.
@Test
public void testParseLine() throws Exception {
ManagerStdoutParser parser = new ManagerStdoutParser(logger);
Map<ComponentRequestKey, List<ComponentRequest>> pendingRequests = new HashMap<ComponentRequestKey, List<ComponentRequest>>();
List<ComponentRequest> finishedRequests = new ArrayList<ComponentRequest>();
parser.parseLine("2011-09-30T21:34:20.084 INFO [Manager] 'Python Client' requested component 'curl:///CONTROL/DV15/Mount'.", pendingRequests, finishedRequests);
parser.parseLine("2011-09-30T21:38:20.008 FINE [Manager] 'CCLSimpleClient' requested non-sticky component 'curl:///CONTROL/DA43/WVR'.", pendingRequests, finishedRequests);
assertEquals(2, pendingRequests.keySet().size());
assertEquals(0, finishedRequests.size());
parser.parseLine("2011-09-30T21:34:20.085 INFO [Manager] Component 'curl:///CONTROL/DV15/Mount' provided to 'Python Client'.", pendingRequests, finishedRequests);
assertEquals(1, pendingRequests.keySet().size());
assertEquals(1, finishedRequests.size());
ComponentRequest request = finishedRequests.get(0);
assertEquals("Python Client", request.key.clientName);
assertEquals("curl:///CONTROL/DV15/Mount", request.key.curl);
assertEquals("2011-09-30T21:34:20.084", toISO(request.timeRequested));
assertEquals("2011-09-30T21:34:20.085", toISO(request.timeProvided));
logger.info("Got ComponentRequest as expected: " + request);
pendingRequests.clear();
finishedRequests.clear();
// Unmatched 'provided to', should also log a WARNING which we currently don't check here
parser.parseLine("2011-09-30T21:34:20.085 INFO [Manager] Component 'curl:///CONTROL/DV15/Mount' provided to 'Python Client'.", pendingRequests, finishedRequests);
assertEquals(0, pendingRequests.keySet().size());
assertEquals(0, finishedRequests.size());
}
Aggregations