コード例 #1
0
def main():
    base_dir = '/mnt/d/Sajad/Uni/Spring00/Compiler/CodART/'
    project_root = 'benchmark_projects/JSON/src/main/java/'
    csv_addr = '/mnt/d/Sajad/Uni/Spring00/Compiler/CodART/tests/extract_method/benchmark_projects_test/JSON/Long-Method.csv'
    cr = CandidateReader(csv_addr)
    _conf = cr.get_conf(3)
    if not os.path.exists(
            os.path.dirname(base_dir + 'tests/extract_method/out/' +
                            project_root +
                            str(_conf['target_file']).replace(".", "/") +
                            '.java')):
        try:
            os.makedirs(
                os.path.dirname(base_dir + 'tests/extract_method/out/' +
                                project_root +
                                str(_conf['target_file']).replace(".", "/") +
                                '.java'))
        except OSError as exc:  # Guard against race condition
            if exc.errno != errno.EEXIST:
                raise
    target_file = _conf['target_file']
    _conf['target_file'] = base_dir + project_root + str(target_file).replace(
        ".", "/") + '.java'
    _conf[
        'output_file'] = base_dir + 'tests/extract_method/out/' + project_root + str(
            target_file).replace(".", "/") + '_test_3.java'
    _conf['new_method_name'] = 'emitContentInBody'
    print('conf:', _conf)
    extract_method(_conf)
コード例 #2
0
ファイル: test_2.py プロジェクト: m-zakeri/CodART
def main():
    base_dir = '/mnt/d/Sajad/Uni/Spring00/Compiler/CodART/'
    if not os.path.exists(
            os.path.dirname(
                base_dir +
                "tests/extract_method/out/benchmark_projects/ganttproject/biz.ganttproject.core/src/main/java/org/w3c/util/DateParser.java"
            )):
        try:
            os.makedirs(
                os.path.dirname(
                    base_dir +
                    "tests/extract_method/out/benchmark_projects/ganttproject/biz.ganttproject.core/src/main/java/org/w3c/util/DateParser.java"
                ))
        except OSError as exc:  # Guard against race condition
            if exc.errno != errno.EEXIST:
                raise
    _conf = {
        'target_file': base_dir +
        "benchmark_projects/ganttproject/biz.ganttproject.core/src/main/java/org/w3c/util/DateParser.java",
        'output_file': base_dir +
        "tests/extract_method/out/benchmark_projects/ganttproject/biz.ganttproject.core/src/main/java/org/w3c/util/DateParser_test_2.java",
        'lines': [255, 256, 257, 258],
        'new_method_name': 'printDivider',
    }
    extract_method(_conf)
コード例 #3
0
def main():
    base_dir = '/mnt/d/Sajad/Uni/Spring00/Compiler/CodART/'
    if not os.path.exists(
            os.path.dirname(
                base_dir +
                "tests/extract_method/out/benchmark_projects/ganttproject/biz.ganttproject.core/src/main/java/biz/ganttproject/core/calendar/WeekendCalendarImpl.java"
            )):
        try:
            os.makedirs(
                os.path.dirname(
                    base_dir +
                    "tests/extract_method/out/benchmark_projects/ganttproject/biz.ganttproject.core/src/main/java/biz/ganttproject/core/calendar/WeekendCalendarImpl.java"
                ))
        except OSError as exc:  # Guard against race condition
            if exc.errno != errno.EEXIST:
                raise
    _conf = {
        'target_file': base_dir +
        "benchmark_projects/ganttproject/biz.ganttproject.core/src/main/java/biz/ganttproject/core/calendar/WeekendCalendarImpl.java",
        'output_file': base_dir +
        "tests/extract_method/out/benchmark_projects/ganttproject/biz.ganttproject.core/src/main/java/biz/ganttproject/core/calendar/WeekendCalendarImpl.java",
        'lines': [87, 88],
        'new_method_name': 'clearMap',
    }
    extract_method(_conf)
コード例 #4
0
ファイル: test_7.py プロジェクト: m-zakeri/CodART
def main():
    base_dir = '/mnt/d/Sajad/Uni/Spring00/Compiler/CodART/'
    if not os.path.exists(
            os.path.dirname(
                base_dir +
                "tests/extract_method/out/benchmark_projects/ganttproject/biz.ganttproject.core/src/main/java/biz/ganttproject/core/chart/render/Style.java"
            )):
        try:
            os.makedirs(
                os.path.dirname(
                    base_dir +
                    "tests/extract_method/out/benchmark_projects/ganttproject/biz.ganttproject.core/src/main/java/biz/ganttproject/core/chart/render/Style.java"
                ))
        except OSError as exc:  # Guard against race condition
            if exc.errno != errno.EEXIST:
                raise
    _conf = {
        'target_package': 'biz.ganttproject.core.chart.render',
        'target_file': base_dir +
        "benchmark_projects/ganttproject/biz.ganttproject.core/src/main/java/biz/ganttproject/core/chart/render/Style.java",
        'output_file': base_dir +
        "tests/extract_method/out/benchmark_projects/ganttproject/biz.ganttproject.core/src/main/java/biz/ganttproject/core/chart/render/Style.java",
        'lines': [108, 109, 110, 111, 112, 113, 114, 115, 116, 117, 118, 119],
        'new_method_name': 'checkResult',
    }
    extract_method(_conf)
コード例 #5
0
ファイル: test_1.py プロジェクト: m-zakeri/CodART
def main():
    base_dir = '/mnt/d/Sajad/Uni/Spring00/Compiler/CodART/'
    _conf = {
        'target_file':
        base_dir + "tests/extract_method/in/ExtractMethodTest.java",
        'output_file':
        base_dir + "tests/extract_method/out/ExtractMethodTest.java",
        'lines': [7, 8],
        'new_method_name': 'printAllDetails',
    }
    extract_method(_conf)
コード例 #6
0
ファイル: test.py プロジェクト: m-zakeri/CodART
 def assert__(self, test_index, new_method_name):
     _conf = self.cr.get_conf(test_index)
     target_file = _conf['target_file']
     _conf[
         'target_file'] = self.base_dir + self.benchmark_project_root + str(
             target_file).replace(".", "/") + '.java'
     _conf['output_file'] = self.base_dir + 'tests/extract_method/benchmark_projects_test/xerces2-j/testdata/test_' + \
                            str(test_index) + '_CodART.java'
     _conf['new_method_name'] = new_method_name
     extract_method(_conf)
     self.assertTrue(
         is_equal(_conf['output_file'],
                  _conf['output_file'].replace('_CodART', '_JDeodorant')))