CPD Results

The following document contains the results of PMD's CPD 5.5.1.

Duplications

File Line
br/eti/kinoshita/testlinkjavaapi/TestCaseService.java 486
br/eti/kinoshita/testlinkjavaapi/TestSuiteService.java 308
            Object response = this.executeXmlRpcCall(TestLinkMethods.GET_TEST_CASE_ATTACHMENTS.toString(),
                    executionData);
            if (response instanceof Map<?, ?>) {
                Map<String, Object> responseMap = Util.castToMap(response);
                Set<Entry<String, Object>> entrySet = responseMap.entrySet();

                attachments = new Attachment[entrySet.size()];

                int index = 0;
                for (Entry<String, Object> entry : entrySet) {
                    String key = entry.getKey();
                    Map<String, Object> attachmentMap = (Map<String, Object>) entry.getValue();
                    attachmentMap.put(TestLinkResponseParams.ID.toString(), key);
                    attachments[index] = Util.getAttachment(attachmentMap);
                    index += 1;
                }
            } else {
                attachments = new Attachment[0];
            }

        } catch (XmlRpcException xmlrpcex) {
            throw new TestLinkAPIException("Error retrieving test case's attachments: " + xmlrpcex.getMessage(),
File Line
br/eti/kinoshita/testlinkjavaapi/TestCaseService.java 637
br/eti/kinoshita/testlinkjavaapi/TestCaseService.java 680
    protected CustomField getTestCaseCustomFieldDesignValue(Integer testCaseId, Integer testCaseExternalId,
            Integer versionNumber, Integer testProjectId, String customFieldName, ResponseDetails details)
            throws TestLinkAPIException {
        CustomField customField = null;

        try {
            Map<String, Object> executionData = new HashMap<>();
            executionData.put(TestLinkParams.TEST_CASE_ID.toString(), testCaseId);
            executionData.put(TestLinkParams.TEST_CASE_EXTERNAL_ID.toString(), testCaseExternalId);
            executionData.put(TestLinkParams.VERSION.toString(), versionNumber);
            executionData.put(TestLinkParams.TEST_PROJECT_ID.toString(), testProjectId);
            executionData.put(TestLinkParams.CUSTOM_FIELD_NAME.toString(), customFieldName);
            executionData.put(TestLinkParams.DETAILS.toString(), Util.getStringValueOrNull(details));

            Object response = this.executeXmlRpcCall(TestLinkMethods.GET_TEST_CASE_CUSTOM_FIELD_DESIGN_VALUE.toString(),
File Line
br/eti/kinoshita/testlinkjavaapi/util/Util.java 659
br/eti/kinoshita/testlinkjavaapi/util/Util.java 675
br/eti/kinoshita/testlinkjavaapi/util/Util.java 691
br/eti/kinoshita/testlinkjavaapi/util/Util.java 707
br/eti/kinoshita/testlinkjavaapi/util/Util.java 723
br/eti/kinoshita/testlinkjavaapi/util/Util.java 739
        executionData.put(TestLinkParams.FK_ID.toString(), attachment.getFkId());
        executionData.put(TestLinkParams.FK_TABLE.toString(), attachment.getFkTable());
        executionData.put(TestLinkParams.TITLE.toString(), attachment.getTitle());
        executionData.put(TestLinkParams.DESCRIPTION.toString(), attachment.getDescription());
        executionData.put(TestLinkParams.FILE_NAME.toString(), attachment.getFileName());
        executionData.put(TestLinkParams.FILE_TYPE.toString(), attachment.getFileType());
        executionData.put(TestLinkParams.CONTENT.toString(), attachment.getContent());
        return executionData;
    }

    /**
     * @param attachment an attachment
     * @return Map of Test Case Attachment.
     */
    public static Map<String, Object> getTestCaseAttachmentMap(Attachment attachment) {
File Line
br/eti/kinoshita/testlinkjavaapi/TestLinkAPI.java 132
br/eti/kinoshita/testlinkjavaapi/TestLinkAPI.java 171
        this.xmlRpcClient = new XmlRpcClient();

        // application configuration
        final CompositeConfiguration appConfig = this.createApplicationConfiguration();
        // XML-RPC client specific configuration, using the application
        // configuration
        final XmlRpcClientConfigImpl config = this.createXmlRpcClientConfiguration(url, appConfig);
        this.xmlRpcClient.setConfig(config);

        this.testProjectService = new TestProjectService(xmlRpcClient, devKey);
        this.testPlanService = new TestPlanService(xmlRpcClient, devKey);
        this.miscService = new MiscService(xmlRpcClient, devKey);
        this.testCaseService = new TestCaseService(xmlRpcClient, devKey);
        this.testSuiteService = new TestSuiteService(xmlRpcClient, devKey);
        this.buildService = new BuildService(xmlRpcClient, devKey);
        this.requirementService = new RequirementService(xmlRpcClient, devKey);
        this.reqSpecService = new ReqSpecService(xmlRpcClient, devKey);

        this.miscService.checkDevKey(devKey);
    }
File Line
br/eti/kinoshita/testlinkjavaapi/util/Util.java 659
br/eti/kinoshita/testlinkjavaapi/util/Util.java 675
br/eti/kinoshita/testlinkjavaapi/util/Util.java 691
br/eti/kinoshita/testlinkjavaapi/util/Util.java 707
br/eti/kinoshita/testlinkjavaapi/util/Util.java 723
br/eti/kinoshita/testlinkjavaapi/util/Util.java 739
br/eti/kinoshita/testlinkjavaapi/util/Util.java 755
        executionData.put(TestLinkParams.FK_ID.toString(), attachment.getFkId());
        executionData.put(TestLinkParams.FK_TABLE.toString(), attachment.getFkTable());
        executionData.put(TestLinkParams.TITLE.toString(), attachment.getTitle());
        executionData.put(TestLinkParams.DESCRIPTION.toString(), attachment.getDescription());
        executionData.put(TestLinkParams.FILE_NAME.toString(), attachment.getFileName());
        executionData.put(TestLinkParams.FILE_TYPE.toString(), attachment.getFileType());
        executionData.put(TestLinkParams.CONTENT.toString(), attachment.getContent());
        return executionData;
    }

    /**
     * @param attachment an attachment
     * @return Map of Test Case Attachment.
     */
    public static Map<String, Object> getTestCaseAttachmentMap(Attachment attachment) {
File Line
br/eti/kinoshita/testlinkjavaapi/MiscService.java 276
br/eti/kinoshita/testlinkjavaapi/TestCaseService.java 923
        Execution execution = null;

        try {
            Map<String, Object> executionData = new HashMap<>();
            executionData.put(TestLinkParams.TEST_PLAN_ID.toString(), testPlanId);
            executionData.put(TestLinkParams.TEST_CASE_ID.toString(), testCaseId);
            executionData.put(TestLinkParams.TEST_CASE_EXTERNAL_ID.toString(), testCaseExternalId);
            executionData.put(TestLinkParams.PLATFORM_ID.toString(), platformId);
            executionData.put(TestLinkParams.PLATFORM_NAME.toString(), platformName);
            executionData.put(TestLinkParams.BUILD_ID.toString(), buildId);
            executionData.put(TestLinkParams.BUILD_NAME.toString(), buildName);
File Line
br/eti/kinoshita/testlinkjavaapi/TestPlanService.java 201
br/eti/kinoshita/testlinkjavaapi/TestPlanService.java 216
    protected Map<String, Object> removePlatformFromTestPlan(Integer testProjectId, Integer testPlanId,
            String platformName) {
        try {
            Map<String, Object> executionData = new HashMap<>();
            executionData.put(TestLinkParams.TEST_PROJECT_ID.toString(), testProjectId);
            executionData.put(TestLinkParams.TEST_PLAN_ID.toString(), testPlanId);
            executionData.put(TestLinkParams.PLATFORM_NAME.toString(), platformName);
            Object response = this.executeXmlRpcCall(TestLinkMethods.ADD_PLATFORM_TO_TEST_PLAN.toString(),
                    executionData);
            return Util.castToMap(response);
        } catch (XmlRpcException xmlrpcex) {
            throw new TestLinkAPIException("Error retrieving platforms: " + xmlrpcex.getMessage(), xmlrpcex);
        }
    }