Ejemplo n.º 1
0
    def testParse(self):
        """Tests the Parse function."""
        parser = winrestore.RestorePointLogParser()
        storage_writer = self._ParseFile(['rp.log'], parser)

        number_of_events = storage_writer.GetNumberOfAttributeContainers(
            'event')
        self.assertEqual(number_of_events, 1)

        number_of_warnings = storage_writer.GetNumberOfAttributeContainers(
            'extraction_warning')
        self.assertEqual(number_of_warnings, 0)

        number_of_warnings = storage_writer.GetNumberOfAttributeContainers(
            'recovery_warning')
        self.assertEqual(number_of_warnings, 0)

        events = list(storage_writer.GetEvents())

        expected_event_values = {
            'date_time': '2015-03-23 18:38:14.2469544',
            'data_type': 'windows:restore_point:info',
            'description': 'Software Distribution Service 3.0',
            'restore_point_event_type': 102,
            'restore_point_type': 0,
            'timestamp_desc': definitions.TIME_DESCRIPTION_CREATION
        }

        self.CheckEventValues(storage_writer, events[0], expected_event_values)
Ejemplo n.º 2
0
  def testParse(self):
    """Tests the Parse function."""
    parser = winrestore.RestorePointLogParser()
    storage_writer = self._ParseFile(['rp.log'], parser)

    self.assertEqual(storage_writer.number_of_events, 1)

    events = list(storage_writer.GetEvents())

    event = events[0]

    expected_timestamp = timelib.Timestamp.CopyFromString(
        '2015-03-23 18:38:14.246954')
    self.assertEqual(
        event.timestamp_desc, definitions.TIME_DESCRIPTION_CREATION)
    self.assertEqual(event.timestamp, expected_timestamp)

    self.assertEqual(event.restore_point_event_type, 102)
    self.assertEqual(event.restore_point_type, 0)
    expected_description = 'Software Distribution Service 3.0'
    self.assertEqual(event.description, expected_description)

    expected_message = (
        '{0:s} '
        'Event type: BEGIN_NESTED_SYSTEM_CHANGE '
        'Restore point type: UNKNOWN').format(expected_description)
    expected_short_message = expected_description

    self._TestGetMessageStrings(event, expected_message, expected_short_message)
Ejemplo n.º 3
0
    def testParse(self):
        """Tests the Parse function."""
        parser_object = winrestore.RestorePointLogParser()

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

        self.assertEqual(len(event_objects), 1)

        event_object = event_objects[0]

        expected_timestamp = timelib.Timestamp.CopyFromString(
            u'2015-03-23 18:38:14.246954')
        self.assertEqual(event_object.timestamp_desc,
                         eventdata.EventTimestamp.CREATION_TIME)
        self.assertEqual(event_object.timestamp, expected_timestamp)

        self.assertEqual(event_object.restore_point_event_type, 102)
        self.assertEqual(event_object.restore_point_type, 0)
        expected_description = u'Software Distribution Service 3.0'
        self.assertEqual(event_object.description, expected_description)

        expected_message = (
            u'{0:s} '
            u'Event type: BEGIN_NESTED_SYSTEM_CHANGE '
            u'Restore point type: UNKNOWN').format(expected_description)
        expected_message_short = expected_description

        self._TestGetMessageStrings(event_object, expected_message,
                                    expected_message_short)
Ejemplo n.º 4
0
  def testParse(self):
    """Tests the Parse function."""
    parser = winrestore.RestorePointLogParser()
    storage_writer = self._ParseFile(['rp.log'], parser)

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

    events = list(storage_writer.GetEvents())

    event = events[0]

    self.CheckTimestamp(event.timestamp, '2015-03-23 18:38:14.246954')
    self.assertEqual(
        event.timestamp_desc, definitions.TIME_DESCRIPTION_CREATION)

    event_data = self._GetEventDataOfEvent(storage_writer, event)
    self.assertEqual(event_data.restore_point_event_type, 102)
    self.assertEqual(event_data.restore_point_type, 0)
    expected_description = 'Software Distribution Service 3.0'
    self.assertEqual(event_data.description, expected_description)

    expected_message = (
        '{0:s} '
        'Event type: BEGIN_NESTED_SYSTEM_CHANGE '
        'Restore point type: APPLICATION_INSTALL').format(expected_description)
    expected_short_message = expected_description

    self._TestGetMessageStrings(
        event_data, expected_message, expected_short_message)
Ejemplo n.º 5
0
    def testParse(self):
        """Tests the Parse function."""
        parser = winrestore.RestorePointLogParser()
        storage_writer = self._ParseFile(['rp.log'], parser)

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

        events = list(storage_writer.GetEvents())

        expected_event_values = {
            'description': 'Software Distribution Service 3.0',
            'restore_point_event_type': 102,
            'restore_point_type': 0,
            'timestamp': '2015-03-23 18:38:14.246954',
            'timestamp_desc': definitions.TIME_DESCRIPTION_CREATION
        }

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

        expected_message = ('Software Distribution Service 3.0 '
                            'Event type: BEGIN_NESTED_SYSTEM_CHANGE '
                            'Restore point type: APPLICATION_INSTALL')
        expected_short_message = ('Software Distribution Service 3.0')

        event_data = self._GetEventDataOfEvent(storage_writer, events[0])
        self._TestGetMessageStrings(event_data, expected_message,
                                    expected_short_message)
Ejemplo n.º 6
0
 def setUp(self):
   """Sets up the needed objects used throughout the test."""
   self._parser = winrestore.RestorePointLogParser()
Ejemplo n.º 7
0
 def setUp(self):
     """Makes preparations before running an individual test."""
     self._parser = winrestore.RestorePointLogParser()