code: def testDumpUiMetadataWithPreExistingFile(self):
      dummy_node = pipeline_pb2.PipelineNode()
      dummy_node.node_info.type.name = (
          "class_path_for_dummy_node.DummyComponent"
      )
      exec_info = data_types.ExecutionInfo(
          input_dict={},
          output_dict={},
          exec_properties={},
          execution_id="id",
      )
  
      ui_metadata_path = os.path.join(
          os.environ.get(
              "TEST_UNDECLARED_OUTPUTS_DIR", self.get_temp_dir()
          ),
          self._testMethodName,
          "json",
      )
      fileio.makedirs(os.path.dirname(ui_metadata_path))
  
      # Check with valid file
      example_ui_metadata_item = {
          "type": "table",
          "storage": "gcs",
          "format": "csv",
          "header": ["example-header1", "example-header2"],
          "source": "gs://example-data-source/example.csv",
      }
      with fileio.open(ui_metadata_path, "w") as f:
          f.write(json.dumps({"outputs": [example_ui_metadata_item]}))
  
      container_entrypoint._dump_ui_metadata(
          dummy_node, exec_info, ui_metadata_path
      )
  
      with open(ui_metadata_path) as f:
          ui_metadata = json.load(f)
          self.assertLen(ui_metadata["outputs"], 2)
          self.assertTrue(
              any(
                  "markdown" == item["type"]
                  for item in ui_metadata["outputs"]
              )
          )
          self.assertTrue(
              any(
                  "table" == item["type"]
                  for item in ui_metadata["outputs"]
              )
          )
  
      # Check with invalid file
      invalid_contents = [
          json.dumps({"wrong_key": [{"foo": 1}]}),
          json.dumps({"outputs": [1]}),  # not a dictionary item
          "not a json",
      ]
      for content in invalid_contents:
          with fileio.open(ui_metadata_path, "w") as f:
              f.write(content)
  
          container_entrypoint._dump_ui_metadata(
              dummy_node, exec_info, ui_metadata_path
          )
  
          with open(ui_metadata_path) as f:
              ui_metadata = json.load(f)
              self.assertLen(ui_metadata["outputs"], 1)
              self.assertEqual(
                  "markdown", ui_metadata["outputs"][0]["type"]
              )
  
imports: import json
  import os
  from unittest import mock
  import tensorflow
  from tfx.dsl.io import fileio
  from tfx.orchestration import metadata
  from tfx.orchestration.kubeflow import container_entrypoint
  from tfx.orchestration.kubeflow import kubeflow_dag_runner
  from tfx.orchestration.kubeflow.proto import kubeflow_pb2
  from tfx.orchestration.portable import beam_executor_operator
  from tfx.orchestration.portable import data_types
  from tfx.orchestration.portable import execution_publish_utils
  from tfx.orchestration.portable import launcher
  from tfx.orchestration.portable import outputs_utils
  from tfx.orchestration.portable import python_driver_operator
  from tfx.orchestration.portable.mlmd import execution_lib
  from tfx.proto.orchestration import driver_output_pb2
  from tfx.proto.orchestration import execution_result_pb2
  from tfx.proto.orchestration import pipeline_pb2
  from tfx.types import standard_artifacts
  from tfx.utils import io_utils
  from tfx.utils import test_case_utils
  from google.protobuf import json_format
  from ml_metadata.proto import metadata_store_pb2
label_desc: Use image node_id 5 for calling the MLMDConfigTest obj's underlying member method code with example usage: obj.testDumpUiMetadataWithPreExistingFile() without return types