예제 #1
0
파일: test_2.py 프로젝트: nima-ab/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_package': 'org.w3c.util',
        '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.java",
        'target_class': 'DateParser',
        'target_method': 'test',
        'target_method_args': [
            'Date',
        ],
        'lines': [2],
        'new_method_name': 'printDivider',
    }
    extract_method(_conf)
예제 #2
0
파일: test_3.py 프로젝트: MinaTahaei/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_test_3.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_test_3.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_3.java",
        'lines': [191, 192, 193, 194, 195, 196, 197, 198, 199],
        'new_method_name': 'fillBufferWithDate',
    }
    extract_method(_conf)
예제 #3
0
파일: test_4.py 프로젝트: MinaTahaei/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/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_5.py 프로젝트: MinaTahaei/CodART
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(6)
    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_5.java'
    _conf['new_method_name'] = 'switchCase'
    print('conf:', _conf)
    extract_method(_conf)
예제 #5
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_test_5.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_test_5.java"
                ))
        except OSError as exc:  # Guard against race condition
            if exc.errno != errno.EEXIST:
                raise
    _conf = {
        'target_package': 'biz.ganttproject.core.calendar',
        '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_test_5.java",
        'target_class': 'WeekendCalendarImpl',
        'target_method': 'setPublicHolidays',
        'lines': [3, 4, 5, 6, 7, 8, 9, 10, 11],
        'new_method_name': 'iterateOnCalender',
    }
    extract_method(_conf)
예제 #6
0
파일: test.py 프로젝트: MinaTahaei/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')))
예제 #7
0
파일: test_1.py 프로젝트: MinaTahaei/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)
예제 #8
0
def main():
    _conf = {
        'target_package': None,
        'target_file':
        "/mnt/d/Sajad/Uni/Spring00/Compiler/CodART/tests/extract_method/in/ExtractMethodTest.java",
        'output_file':
        "/mnt/d/Sajad/Uni/Spring00/Compiler/CodART/tests/extract_method/out/ExtractMethodTest.java",
        'target_class': 'ExtractMethodTest',
        'target_method': 'printOwing',
        'lines': [4, 5],
        'new_method_name': 'printDetails',
    }
    extract_method(_conf)
예제 #9
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/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)