Exemple #1
0
  def testParse(self):
    """Tests the Parse function."""
    parser = skydrivelog.SkyDriveOldLogParser()
    storage_writer = self._ParseFile(['skydrive_old.log'], parser)

    self.assertEqual(storage_writer.number_of_events, 18)
    self.assertEqual(storage_writer.number_of_extraction_warnings, 1)
    self.assertEqual(storage_writer.number_of_recovery_warnings, 0)

    events = list(storage_writer.GetSortedEvents())

    expected_event_values = {
        'date_time': '2013-08-01 21:22:28.999',
        'data_type': 'skydrive:log:old:line',
        'log_level': 'DETAIL',
        'source_code': 'global.cpp:626!logVersionInfo',
        'text': '17.0.2011.0627 (Ship)'}

    self.CheckEventValues(storage_writer, events[0], expected_event_values)

    expected_event_values = {
        'date_time': '2013-08-01 21:22:29.702',
        'data_type': 'skydrive:log:old:line'}

    self.CheckEventValues(storage_writer, events[1], expected_event_values)

    expected_event_values = {
        'date_time': '2013-08-01 21:22:29.702',
        'data_type': 'skydrive:log:old:line'}

    self.CheckEventValues(storage_writer, events[2], expected_event_values)

    expected_event_values = {
        'date_time': '2013-08-01 21:22:29.702',
        'data_type': 'skydrive:log:old:line',
        'text': (
            'SyncToken = LM%3d12345678905670%3bID%3d1234567890E059C0!'
            '103%3bLR%3d12345678905623%3aEP%3d2')}

    self.CheckEventValues(storage_writer, events[3], expected_event_values)

    expected_event_values = {
        'date_time': '2013-08-01 21:22:58.344',
        'data_type': 'skydrive:log:old:line'}

    self.CheckEventValues(storage_writer, events[4], expected_event_values)

    expected_event_values = {
        'date_time': '2013-08-01 21:22:58.344',
        'data_type': 'skydrive:log:old:line'}

    self.CheckEventValues(storage_writer, events[5], expected_event_values)

    expected_event_values = {
        'date_time': '2013-08-01 21:28:46.742',
        'data_type': 'skydrive:log:old:line',
        'text': 'SyncToken = Not a sync token (\xe0\xe8\xec\xf2\xf9)!'}

    self.CheckEventValues(storage_writer, events[17], expected_event_values)
Exemple #2
0
    def testParse(self):
        """Tests the Parse function."""
        parser = skydrivelog.SkyDriveOldLogParser()
        storage_writer = self._ParseFile(['skydrive_old.log'], parser)

        self.assertEqual(storage_writer.number_of_warnings, 1)
        self.assertEqual(storage_writer.number_of_events, 18)

        events = list(storage_writer.GetEvents())

        event = events[0]

        self.CheckTimestamp(event.timestamp, '2013-08-01 21:22:28.999000')

        expected_message = (
            '[global.cpp:626!logVersionInfo] (DETAIL) 17.0.2011.0627 (Ship)')
        expected_short_message = ('17.0.2011.0627 (Ship)')
        self._TestGetMessageStrings(event, expected_message,
                                    expected_short_message)

        event = events[1]

        self.CheckTimestamp(event.timestamp, '2013-08-01 21:22:29.702000')

        event = events[2]

        self.CheckTimestamp(event.timestamp, '2013-08-01 21:22:29.702000')

        event = events[3]

        self.CheckTimestamp(event.timestamp, '2013-08-01 21:22:29.702000')

        expected_message = (
            'SyncToken = LM%3d12345678905670%3bID%3d1234567890E059C0!'
            '103%3bLR%3d12345678905623%3aEP%3d2')
        expected_short_message = (
            'SyncToken = LM%3d12345678905670%3bID%3d1234567890E059C0!'
            '103%3bLR%3d1234567890...')
        self._TestGetMessageStrings(event, expected_message,
                                    expected_short_message)

        event = events[4]

        self.CheckTimestamp(event.timestamp, '2013-08-01 21:22:58.344000')

        event = events[5]

        self.CheckTimestamp(event.timestamp, '2013-08-01 21:22:58.344000')

        event = events[17]

        self.CheckTimestamp(event.timestamp, '2013-08-01 21:28:46.742000')

        expected_message = (
            'SyncToken = Not a sync token (\xe0\xe8\xec\xf2\xf9)!')
        self._TestGetMessageStrings(event, expected_message, expected_message)
Exemple #3
0
  def testParse(self):
    """Tests the Parse function."""
    parser_object = skydrivelog.SkyDriveOldLogParser()

    test_file = self._GetTestFilePath([u'skydrive_old.log'])
    event_queue_consumer = self._ParseFile(parser_object, test_file)
    event_objects = self._GetEventObjectsFromQueue(event_queue_consumer)

    self.assertEqual(len(event_objects), 18)

    expected_timestamp = timelib.Timestamp.CopyFromString(
        u'2013-08-01 21:22:28.999')
    self.assertEqual(event_objects[0].timestamp, expected_timestamp)

    expected_timestamp = timelib.Timestamp.CopyFromString(
        u'2013-08-01 21:22:29.702')
    self.assertEqual(event_objects[1].timestamp, expected_timestamp)
    self.assertEqual(event_objects[2].timestamp, expected_timestamp)
    self.assertEqual(event_objects[3].timestamp, expected_timestamp)

    expected_timestamp = timelib.Timestamp.CopyFromString(
        u'2013-08-01 21:22:58.344')
    self.assertEqual(event_objects[4].timestamp, expected_timestamp)
    self.assertEqual(event_objects[5].timestamp, expected_timestamp)

    expected_msg = (
        u'[global.cpp:626!logVersionInfo] (DETAIL) 17.0.2011.0627 (Ship)')
    expected_msg_short = (
        u'17.0.2011.0627 (Ship)')
    self._TestGetMessageStrings(
        event_objects[0], expected_msg, expected_msg_short)

    expected_msg = (
        u'SyncToken = LM%3d12345678905670%3bID%3d1234567890E059C0!'
        u'103%3bLR%3d12345678905623%3aEP%3d2')
    expected_msg_short = (
        u'SyncToken = LM%3d12345678905670%3bID%3d1234567890E059C0!'
        u'103%3bLR%3d1234567890...')
    self._TestGetMessageStrings(
        event_objects[3], expected_msg, expected_msg_short)

    expected_string = (
        u'SyncToken = Not a sync token (\xe0\xe8\xec\xf2\xf9)!')
    self._TestGetMessageStrings(
        event_objects[17], expected_string, expected_string)
Exemple #4
0
 def setUp(self):
   """Makes preparations before running an individual test."""
   self._parser = skydrivelog.SkyDriveOldLogParser()