def test_static_methods(self):
        test_log_name = "testLog"
        self.assertFalse(PropertyManager.isAnInvalidValuesFilterLog(test_log_name))
        self.assertEqual(PropertyManager.getInvalidValuesFilterLogName(test_log_name),
          test_log_name + "_invalid_values")

        self.assertTrue(PropertyManager.isAnInvalidValuesFilterLog(
            PropertyManager.getInvalidValuesFilterLogName(test_log_name)))

        # not a valid invalid values log
        self.assertEqual(
            PropertyManager.getLogNameFromInvalidValuesFilter(test_log_name), "")
        # A valid invalid values log
        self.assertEqual(
            PropertyManager.getLogNameFromInvalidValuesFilter(
                PropertyManager.getInvalidValuesFilterLogName(test_log_name)),
            test_log_name)
Beispiel #2
0
    def get_logs_with_invalid_data(self):
        """Returns a map of log names with invalid data, and the invalid filter logs
        The value of each log is the number of invalid entries,
         with -1 meaning all of the entries are invalid"""
        invalid_data_logs = {}
        log_list = self.get_log_names()
        for log_name in log_list:
            if PropertyManager.isAnInvalidValuesFilterLog(log_name):
                log = self.get_log(log_name)
                #determine if the entire log is invalid
                invalid_value_count = 0
                for log_value in log.value:
                    if not log_value:
                        invalid_value_count += 1
                if invalid_value_count == log.size():
                    invalid_value_count = -1

                filtered_log = PropertyManager.getLogNameFromInvalidValuesFilter(
                    log_name)
                if filtered_log:
                    invalid_data_logs[filtered_log] = invalid_value_count
        return invalid_data_logs