<commit_before>/**
 * Copyright 2017 BlazeMeter Inc.
 * <p>
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * http://www.apache.org/licenses/LICENSE-2.0
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.blaze.api.urlmanager;

import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;


public class UrlManagerImpl implements UrlManager {

    private String serverUrl = "";

    public UrlManagerImpl(String blazeMeterUrl) {
        this.serverUrl = blazeMeterUrl;
    }

    @Override
    public String getServerUrl() {
        return serverUrl;
    }

    @Override
    public void setServerUrl(String serverUrl) {
        this.serverUrl = serverUrl;
    }

    @Override
    public String masterStatus(String appKey, String masterId) {
        try {
            appKey = URLEncoder.encode(appKey, UrlManager.UTF_8);
            masterId = URLEncoder.encode(masterId, UrlManager.UTF_8);
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }

        return serverUrl + V4 + UrlManager.MASTERS + "/" + masterId + "/status?events=false&app_key=" + appKey + CLIENT_IDENTIFICATION;
    }

    @Override
    public String tests(String appKey, int workspaceId) {
        try {
            appKey = URLEncoder.encode(appKey, UrlManager.UTF_8);
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }

        return serverUrl + V4 + TESTS + "?limit=10000&workspaceId=" + workspaceId + "&app_key=" + appKey + CLIENT_IDENTIFICATION;
    }

    @Override
    public String multiTests(String appKey, int workspaceId) {
        try {
            appKey = URLEncoder.encode(appKey, UrlManager.UTF_8);
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }
        return serverUrl + V4 + "/multi-tests?limit=10000&workspaceId=" + workspaceId + "&app_key=" + appKey + CLIENT_IDENTIFICATION;
    }

    @Override
    public String testStart(String appKey, String testId) {
        try {
            appKey = URLEncoder.encode(appKey, UrlManager.UTF_8);
            testId = URLEncoder.encode(testId, UrlManager.UTF_8);
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }

        return serverUrl + V4 + TESTS + "/"
                + testId + "/start?app_key=" + appKey + CLIENT_IDENTIFICATION;
    }

    @Override
    public String collectionStart(String appKey, String collectionId) {
        try {
            appKey = URLEncoder.encode(appKey, UrlManager.UTF_8);
            collectionId = URLEncoder.encode(collectionId, UrlManager.UTF_8);
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }

        return serverUrl + V4 + "/collections/"
                + collectionId + "/start?app_key=" + appKey + CLIENT_IDENTIFICATION;
    }

    @Override
    public String testStop(String appKey, String masterId) {
        try {
            appKey = URLEncoder.encode(appKey, UrlManager.UTF_8);
            masterId = URLEncoder.encode(masterId, UrlManager.UTF_8);
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }
        return serverUrl + V4 + UrlManager.MASTERS + "/"
                + masterId + "/stop?app_key=" + appKey + CLIENT_IDENTIFICATION;
    }

    @Override
    public String testTerminate(String appKey, String masterId) {
        try {
            appKey = URLEncoder.encode(appKey, UrlManager.UTF_8);
            masterId = URLEncoder.encode(masterId, UrlManager.UTF_8);
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }

        return serverUrl + V4 + UrlManager.MASTERS + "/"
                + masterId + "/terminate?app_key=" + appKey + CLIENT_IDENTIFICATION;
    }

    @Override
    public String testReport(String appKey, String masterId) {
        try {
            appKey = URLEncoder.encode(appKey, UrlManager.UTF_8);
            masterId = URLEncoder.encode(masterId, UrlManager.UTF_8);
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }

        return serverUrl + V4 + UrlManager.MASTERS + "/"
                + masterId + "/reports/main/summary?app_key=" + appKey + CLIENT_IDENTIFICATION;
    }

    @Override
    public String getUser(String appKey) {
        try {
            appKey = URLEncoder.encode(appKey, UrlManager.UTF_8);
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }

        return serverUrl + V4 + "/user?app_key=" + appKey + CLIENT_IDENTIFICATION;
    }

    @Override
    public String getCIStatus(String appKey, String masterId) {
        try {
            appKey = URLEncoder.encode(appKey, UrlManager.UTF_8);
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }

        return serverUrl + V4 + MASTERS + "/" + masterId + UrlManager.CI_STATUS + "?app_key=" + appKey + CLIENT_IDENTIFICATION;
    }

    @Override
    public String retrieveJUNITXML(String appKey, String masterId) {
        try {
            appKey = URLEncoder.encode(appKey, UrlManager.UTF_8);
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }

        return serverUrl + V4 + MASTERS + "/" + masterId +
                "/reports/thresholds?format=junit&app_key=" + appKey + CLIENT_IDENTIFICATION;
    }

    @Override
    public String retrieveJTLZIP(String appKey, String sessionId) {
        try {
            appKey = URLEncoder.encode(appKey, UrlManager.UTF_8);
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }

        return serverUrl + V4 + "/sessions/" + sessionId +
                "/reports/logs?app_key=" + appKey + CLIENT_IDENTIFICATION;
    }

    @Override
    public String generatePublicToken(String appKey, String masterId) {
        try {
            appKey = URLEncoder.encode(appKey, UrlManager.UTF_8);
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }
        return serverUrl + V4 + MASTERS + "/" + masterId +
                "/publicToken?app_key=" + appKey + CLIENT_IDENTIFICATION;
    }


    @Override
    public String listOfSessionIds(String appKey, String masterId) {
        try {
            appKey = URLEncoder.encode(appKey, UrlManager.UTF_8);
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }

        return serverUrl + V4 + MASTERS + "/" + masterId +
                "/sessions?app_key=" + appKey + CLIENT_IDENTIFICATION;
    }

    @Override
    public String activeTests(String appKey, int workspaceId) {
        try {
            appKey = URLEncoder.encode(appKey, UrlManager.UTF_8);
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }
        return serverUrl + V4 + UrlManager.MASTERS + "?workspaceId=" + workspaceId + "&active=true&app_key=" + appKey + CLIENT_IDENTIFICATION;
    }

    @Override
    public String masterId(String appKey, String masterId) {
        try {
            appKey = URLEncoder.encode(appKey, UrlManager.UTF_8);
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }

        return serverUrl + V4 + UrlManager.MASTERS + "/" + masterId + "?app_key=" + appKey + CLIENT_IDENTIFICATION;
    }

    @Override
    public String properties(String appKey, String sessionId) {
        try {
            appKey = URLEncoder.encode(appKey, UrlManager.UTF_8);
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }

        return serverUrl + V4 + "/sessions/" + sessionId + "/properties?target=all&app_key=" + appKey + CLIENT_IDENTIFICATION;
    }

    @Override
    public String workspaces(String appKey, int accountId) {
        try {
            appKey = URLEncoder.encode(appKey, UrlManager.UTF_8);
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }
        return serverUrl + V4 + "/workspaces?limit=1000&enabled=true&app_key=" + appKey + "&" + "accountId=" + accountId + CLIENT_IDENTIFICATION;
    }

    @Override
    public String accounts(String appKey) {
        try {
            appKey = URLEncoder.encode(appKey, UrlManager.UTF_8);
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }
        return serverUrl + V4 + "/accounts?app_key=" + appKey + "&" + CLIENT_IDENTIFICATION;
    }
}

<commit_msg>fix edit build step page<commit_after>/**
 * Copyright 2017 BlazeMeter Inc.
 * <p>
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * http://www.apache.org/licenses/LICENSE-2.0
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */

package com.blaze.api.urlmanager;

import java.io.UnsupportedEncodingException;
import java.net.URLEncoder;


public class UrlManagerImpl implements UrlManager {

    private String serverUrl = "";

    /**
     * Use this constructor from 'editBlazeRunnerParams.jsp`
     */
    public UrlManagerImpl() {
    }

    public UrlManagerImpl(String blazeMeterUrl) {
        this.serverUrl = blazeMeterUrl;
    }

    @Override
    public String getServerUrl() {
        return serverUrl;
    }

    @Override
    public void setServerUrl(String serverUrl) {
        this.serverUrl = serverUrl;
    }

    @Override
    public String masterStatus(String appKey, String masterId) {
        try {
            appKey = URLEncoder.encode(appKey, UrlManager.UTF_8);
            masterId = URLEncoder.encode(masterId, UrlManager.UTF_8);
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }

        return serverUrl + V4 + UrlManager.MASTERS + "/" + masterId + "/status?events=false&app_key=" + appKey + CLIENT_IDENTIFICATION;
    }

    @Override
    public String tests(String appKey, int workspaceId) {
        try {
            appKey = URLEncoder.encode(appKey, UrlManager.UTF_8);
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }

        return serverUrl + V4 + TESTS + "?limit=10000&workspaceId=" + workspaceId + "&app_key=" + appKey + CLIENT_IDENTIFICATION;
    }

    @Override
    public String multiTests(String appKey, int workspaceId) {
        try {
            appKey = URLEncoder.encode(appKey, UrlManager.UTF_8);
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }
        return serverUrl + V4 + "/multi-tests?limit=10000&workspaceId=" + workspaceId + "&app_key=" + appKey + CLIENT_IDENTIFICATION;
    }

    @Override
    public String testStart(String appKey, String testId) {
        try {
            appKey = URLEncoder.encode(appKey, UrlManager.UTF_8);
            testId = URLEncoder.encode(testId, UrlManager.UTF_8);
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }

        return serverUrl + V4 + TESTS + "/"
                + testId + "/start?app_key=" + appKey + CLIENT_IDENTIFICATION;
    }

    @Override
    public String collectionStart(String appKey, String collectionId) {
        try {
            appKey = URLEncoder.encode(appKey, UrlManager.UTF_8);
            collectionId = URLEncoder.encode(collectionId, UrlManager.UTF_8);
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }

        return serverUrl + V4 + "/collections/"
                + collectionId + "/start?app_key=" + appKey + CLIENT_IDENTIFICATION;
    }

    @Override
    public String testStop(String appKey, String masterId) {
        try {
            appKey = URLEncoder.encode(appKey, UrlManager.UTF_8);
            masterId = URLEncoder.encode(masterId, UrlManager.UTF_8);
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }
        return serverUrl + V4 + UrlManager.MASTERS + "/"
                + masterId + "/stop?app_key=" + appKey + CLIENT_IDENTIFICATION;
    }

    @Override
    public String testTerminate(String appKey, String masterId) {
        try {
            appKey = URLEncoder.encode(appKey, UrlManager.UTF_8);
            masterId = URLEncoder.encode(masterId, UrlManager.UTF_8);
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }

        return serverUrl + V4 + UrlManager.MASTERS + "/"
                + masterId + "/terminate?app_key=" + appKey + CLIENT_IDENTIFICATION;
    }

    @Override
    public String testReport(String appKey, String masterId) {
        try {
            appKey = URLEncoder.encode(appKey, UrlManager.UTF_8);
            masterId = URLEncoder.encode(masterId, UrlManager.UTF_8);
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }

        return serverUrl + V4 + UrlManager.MASTERS + "/"
                + masterId + "/reports/main/summary?app_key=" + appKey + CLIENT_IDENTIFICATION;
    }

    @Override
    public String getUser(String appKey) {
        try {
            appKey = URLEncoder.encode(appKey, UrlManager.UTF_8);
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }

        return serverUrl + V4 + "/user?app_key=" + appKey + CLIENT_IDENTIFICATION;
    }

    @Override
    public String getCIStatus(String appKey, String masterId) {
        try {
            appKey = URLEncoder.encode(appKey, UrlManager.UTF_8);
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }

        return serverUrl + V4 + MASTERS + "/" + masterId + UrlManager.CI_STATUS + "?app_key=" + appKey + CLIENT_IDENTIFICATION;
    }

    @Override
    public String retrieveJUNITXML(String appKey, String masterId) {
        try {
            appKey = URLEncoder.encode(appKey, UrlManager.UTF_8);
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }

        return serverUrl + V4 + MASTERS + "/" + masterId +
                "/reports/thresholds?format=junit&app_key=" + appKey + CLIENT_IDENTIFICATION;
    }

    @Override
    public String retrieveJTLZIP(String appKey, String sessionId) {
        try {
            appKey = URLEncoder.encode(appKey, UrlManager.UTF_8);
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }

        return serverUrl + V4 + "/sessions/" + sessionId +
                "/reports/logs?app_key=" + appKey + CLIENT_IDENTIFICATION;
    }

    @Override
    public String generatePublicToken(String appKey, String masterId) {
        try {
            appKey = URLEncoder.encode(appKey, UrlManager.UTF_8);
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }
        return serverUrl + V4 + MASTERS + "/" + masterId +
                "/publicToken?app_key=" + appKey + CLIENT_IDENTIFICATION;
    }


    @Override
    public String listOfSessionIds(String appKey, String masterId) {
        try {
            appKey = URLEncoder.encode(appKey, UrlManager.UTF_8);
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }

        return serverUrl + V4 + MASTERS + "/" + masterId +
                "/sessions?app_key=" + appKey + CLIENT_IDENTIFICATION;
    }

    @Override
    public String activeTests(String appKey, int workspaceId) {
        try {
            appKey = URLEncoder.encode(appKey, UrlManager.UTF_8);
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }
        return serverUrl + V4 + UrlManager.MASTERS + "?workspaceId=" + workspaceId + "&active=true&app_key=" + appKey + CLIENT_IDENTIFICATION;
    }

    @Override
    public String masterId(String appKey, String masterId) {
        try {
            appKey = URLEncoder.encode(appKey, UrlManager.UTF_8);
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }

        return serverUrl + V4 + UrlManager.MASTERS + "/" + masterId + "?app_key=" + appKey + CLIENT_IDENTIFICATION;
    }

    @Override
    public String properties(String appKey, String sessionId) {
        try {
            appKey = URLEncoder.encode(appKey, UrlManager.UTF_8);
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }

        return serverUrl + V4 + "/sessions/" + sessionId + "/properties?target=all&app_key=" + appKey + CLIENT_IDENTIFICATION;
    }

    @Override
    public String workspaces(String appKey, int accountId) {
        try {
            appKey = URLEncoder.encode(appKey, UrlManager.UTF_8);
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }
        return serverUrl + V4 + "/workspaces?limit=1000&enabled=true&app_key=" + appKey + "&" + "accountId=" + accountId + CLIENT_IDENTIFICATION;
    }

    @Override
    public String accounts(String appKey) {
        try {
            appKey = URLEncoder.encode(appKey, UrlManager.UTF_8);
        } catch (UnsupportedEncodingException e) {
            e.printStackTrace();
        }
        return serverUrl + V4 + "/accounts?app_key=" + appKey + "&" + CLIENT_IDENTIFICATION;
    }
}


{'fraction_non_alphanumeric': 0.09944843723884339, 'fraction_numerical': 0.0073541701487548055, 'mean_word_length': 2.3925533925533924, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 0, 'lorem ipsum': 0, 'www.': 2, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3109059', 'n_tokens_mistral': 5394, 'n_tokens_neox': 5205, 'n_words': 1143}