# Path: artman/config/converter.py
# def convert_to_legacy_config_dict(artifact_config, root_dir, output_dir):
# def _calculate_rel_gapic_output_dir(language, api_name, api_version):
# def _calculate_proto_paths(proto_paths):
# 
# Path: artman/config/loader.py
# CONFIG_NOT_FOUND_ERROR_MESSAGE_FORMAT = (
#     'Artman YAML cannot be found at `%s`. Please check the file location.')
# INVALID_CONFIG_ERROR_MESSAGE_FORMAT = 'Artman YAML %s is invalid.'
# INVALID_USER_CONFIG_ERROR_MESSAGE_FORMAT = 'Artman user YAML %s is invalid.'
# ARTIFACT_MAPPING = {
#     'java_proto': {'language': 'JAVA', 'type': 'PROTOBUF'},
#     'java_grpc': {'language': 'JAVA', 'type': 'GRPC'},
#     'ruby_grpc': {'language': 'RUBY', 'type': 'GRPC'},
#     'python_grpc': {'language': 'PYTHON', 'type': 'GRPC'},
#     'java_gapic': {'language': 'JAVA', 'type': 'GAPIC'},
#     'java_discogapic': {'language': 'JAVA', 'type': 'DISCOGAPIC'},
#     'java_gapic_only': {'language': 'JAVA', 'type': 'GAPIC_ONLY'},
#     'python_gapic': {'language': 'PYTHON', 'type': 'GAPIC'},
#     'nodejs_gapic': {'language': 'NODEJS', 'type': 'GAPIC'},
#     'php_gapic': {'language': 'PHP', 'type': 'GAPIC'},
#     'go_gapic': {'language': 'GO', 'type': 'GAPIC'},
#     'ruby_gapic': {'language': 'RUBY', 'type': 'GAPIC'},
#     'csharp_gapic': {'language': 'CSHARP', 'type': 'GAPIC'},
#     'gapic_config': {'type': 'GAPIC_CONFIG'},
#     'discogapic_config': {'type': 'DISCOGAPIC_CONFIG'},
#     'php_grpc': {'language': 'JAVA', 'type': 'GRPC'},
# }
# def load_artifact_config(artman_config_path, artifact_name, aspect=None):
# def read_user_config(artman_user_config_path):
# def _read_artman_config(artman_yaml_path):
# def _parse(artman_yaml_path):
# def _validate_artman_config(config_pb):
# def _validate_artifact_config(artifact_config):
# def _normalize_artifact_config(artifact_config, artman_config_path):
# def _normalize_path(path, artman_config_path, field):


import io
import os
import unittest
import yaml
from artman.config import converter
from artman.config import loader




class ConverterTest(unittest.TestCase):
    TESTDATA = os.path.join(
        os.path.realpath(os.path.dirname(__file__)), 'testdata')

    def test_pubsub_java(self):
        self._test('artman_pubsub.yaml', 'java_gapic',
                   'expected_pubsub_java_legacy_config.yaml')

    def test_pubsub_java_proto(self):
        self._test('artman_pubsub.yaml', 'java_proto',
                   'expected_pubsub_java_proto_legacy_config.yaml')

    def test_pubsub_python(self):
        self._test('artman_pubsub.yaml', 'python_gapic',
                   'expected_pubsub_python_legacy_config.yaml')

    def test_library_java(self):
        self._test('artman_library.yaml', 'java_gapic',
                   'expected_library_java_config.yaml')

    def test_library_php(self):
        self._test('artman_library.yaml', 'php_gapic',
                   'expected_library_php_config.yaml')

    def _test(self, artman_yaml, artifact_name, expected_legacy_config):
        artifact_config = loader.load_artifact_config(os.path.join(

# Path: artman/config/converter.py
# def convert_to_legacy_config_dict(artifact_config, root_dir, output_dir):
# def _calculate_rel_gapic_output_dir(language, api_name, api_version):
# def _calculate_proto_paths(proto_paths):
# 
# Path: artman/config/loader.py
# CONFIG_NOT_FOUND_ERROR_MESSAGE_FORMAT = (
#     'Artman YAML cannot be found at `%s`. Please check the file location.')
# INVALID_CONFIG_ERROR_MESSAGE_FORMAT = 'Artman YAML %s is invalid.'
# INVALID_USER_CONFIG_ERROR_MESSAGE_FORMAT = 'Artman user YAML %s is invalid.'
# ARTIFACT_MAPPING = {
#     'java_proto': {'language': 'JAVA', 'type': 'PROTOBUF'},
#     'java_grpc': {'language': 'JAVA', 'type': 'GRPC'},
#     'ruby_grpc': {'language': 'RUBY', 'type': 'GRPC'},
#     'python_grpc': {'language': 'PYTHON', 'type': 'GRPC'},
#     'java_gapic': {'language': 'JAVA', 'type': 'GAPIC'},
#     'java_discogapic': {'language': 'JAVA', 'type': 'DISCOGAPIC'},
#     'java_gapic_only': {'language': 'JAVA', 'type': 'GAPIC_ONLY'},
#     'python_gapic': {'language': 'PYTHON', 'type': 'GAPIC'},
#     'nodejs_gapic': {'language': 'NODEJS', 'type': 'GAPIC'},
#     'php_gapic': {'language': 'PHP', 'type': 'GAPIC'},
#     'go_gapic': {'language': 'GO', 'type': 'GAPIC'},
#     'ruby_gapic': {'language': 'RUBY', 'type': 'GAPIC'},
#     'csharp_gapic': {'language': 'CSHARP', 'type': 'GAPIC'},
#     'gapic_config': {'type': 'GAPIC_CONFIG'},
#     'discogapic_config': {'type': 'DISCOGAPIC_CONFIG'},
#     'php_grpc': {'language': 'JAVA', 'type': 'GRPC'},
# }
# def load_artifact_config(artman_config_path, artifact_name, aspect=None):
# def read_user_config(artman_user_config_path):
# def _read_artman_config(artman_yaml_path):
# def _parse(artman_yaml_path):
# def _validate_artman_config(config_pb):
# def _validate_artifact_config(artifact_config):
# def _normalize_artifact_config(artifact_config, artman_config_path):
# def _normalize_path(path, artman_config_path, field):


# Path: test/config/test_converter.py
import io
import os
import unittest
import yaml
from artman.config import converter
from artman.config import loader





class ConverterTest(unittest.TestCase):
    TESTDATA = os.path.join(
        os.path.realpath(os.path.dirname(__file__)), 'testdata')

    def test_pubsub_java(self):
        self._test('artman_pubsub.yaml', 'java_gapic',
                   'expected_pubsub_java_legacy_config.yaml')

    def test_pubsub_java_proto(self):
        self._test('artman_pubsub.yaml', 'java_proto',
                   'expected_pubsub_java_proto_legacy_config.yaml')

    def test_pubsub_python(self):
        self._test('artman_pubsub.yaml', 'python_gapic',
                   'expected_pubsub_python_legacy_config.yaml')

    def test_library_java(self):
        self._test('artman_library.yaml', 'java_gapic',
                   'expected_library_java_config.yaml')

    def test_library_php(self):
        self._test('artman_library.yaml', 'php_gapic',
                   'expected_library_php_config.yaml')

    def _test(self, artman_yaml, artifact_name, expected_legacy_config):
        artifact_config = loader.load_artifact_config(os.path.join(

            self.TESTDATA, artman_yaml), artifact_name)