<commit_before>//
// 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.
//

import UIKit
import HTTPRPC

class ViewController: UIViewController, UITableViewDataSource, NSURLSessionDataDelegate {
    var cells: [UITableViewCell]!

    var addCell: UITableViewCell!
    var addValuesCell: UITableViewCell!
    var invertValueCell: UITableViewCell!
    var getCharactersCell: UITableViewCell!
    var getSelectionCell: UITableViewCell!
    var getMapCell: UITableViewCell!
    var getStatisticsCell: UITableViewCell!
    var getTestDataCell: UITableViewCell!
    var getVoidCell: UITableViewCell!
    var getNullCell: UITableViewCell!
    var getLocaleCodeCell: UITableViewCell!
    var getUserNameCell: UITableViewCell!
    var isUserInRoleCell: UITableViewCell!
    var getAttachmentInfoCell: UITableViewCell!

    override func loadView() {
        let tableView = UITableView()

        tableView.contentInset = UIEdgeInsets(top: 20, left: 0, bottom: 0, right: 0)
        tableView.dataSource = self

        cells = [];

        addCell = UITableViewCell(style: UITableViewCellStyle.Value1, reuseIdentifier: nil)
        addCell.textLabel!.text = "add()"
        cells.append(addCell)

        addValuesCell = UITableViewCell(style: UITableViewCellStyle.Value1, reuseIdentifier: nil)
        addValuesCell.textLabel!.text = "addArray()"
        cells.append(addValuesCell)

        invertValueCell = UITableViewCell(style: UITableViewCellStyle.Value1, reuseIdentifier: nil)
        invertValueCell.textLabel!.text = "invertValue()"
        cells.append(invertValueCell)

        getCharactersCell = UITableViewCell(style: UITableViewCellStyle.Value1, reuseIdentifier: nil)
        getCharactersCell.textLabel!.text = "getCharacters()"
        cells.append(getCharactersCell)

        getSelectionCell = UITableViewCell(style: UITableViewCellStyle.Value1, reuseIdentifier: nil)
        getSelectionCell.textLabel!.text = "getSelection()"
        cells.append(getSelectionCell)

        getMapCell = UITableViewCell(style: UITableViewCellStyle.Value1, reuseIdentifier: nil)
        getMapCell.textLabel!.text = "getMap()"
        cells.append(getMapCell)

        getStatisticsCell = UITableViewCell(style: UITableViewCellStyle.Value1, reuseIdentifier: nil)
        getStatisticsCell.textLabel!.text = "getStatistics()"
        cells.append(getStatisticsCell)

        getTestDataCell = UITableViewCell(style: UITableViewCellStyle.Value1, reuseIdentifier: nil)
        getTestDataCell.textLabel!.text = "getTestData()"
        cells.append(getTestDataCell)

        getVoidCell = UITableViewCell(style: UITableViewCellStyle.Value1, reuseIdentifier: nil)
        getVoidCell.textLabel!.text = "getVoid()"
        cells.append(getVoidCell)

        getNullCell = UITableViewCell(style: UITableViewCellStyle.Value1, reuseIdentifier: nil)
        getNullCell.textLabel!.text = "getNull()"
        cells.append(getNullCell)

        getLocaleCodeCell = UITableViewCell(style: UITableViewCellStyle.Value1, reuseIdentifier: nil)
        getLocaleCodeCell.textLabel!.text = "getLocaleCode()"
        cells.append(getLocaleCodeCell)

        getUserNameCell = UITableViewCell(style: UITableViewCellStyle.Value1, reuseIdentifier: nil)
        getUserNameCell.textLabel!.text = "getUserName()"
        cells.append(getUserNameCell)

        isUserInRoleCell = UITableViewCell(style: UITableViewCellStyle.Value1, reuseIdentifier: nil)
        isUserInRoleCell.textLabel!.text = "isUserInRole()"
        cells.append(isUserInRoleCell)

        getAttachmentInfoCell = UITableViewCell(style: UITableViewCellStyle.Value1, reuseIdentifier: nil)
        getAttachmentInfoCell.textLabel!.text = "getAttachmentInfoCell()"
        cells.append(getAttachmentInfoCell)

        view = tableView
    }

    override func viewDidLoad() {
        // Set invalid user credentials
        let credential = NSURLCredential(user: "tomcatx", password: "<PASSWORD>", persistence: NSURLCredentialPersistence.ForSession);
        let protectionSpace = NSURLProtectionSpace(host: "localhost", port: 8443, protocol: "https", realm: "tomcat",
            authenticationMethod: NSURLAuthenticationMethodHTTPBasic)

        NSURLCredentialStorage.sharedCredentialStorage().setDefaultCredential(credential, forProtectionSpace: protectionSpace)

        // Configure session
        let configuration = NSURLSessionConfiguration.defaultSessionConfiguration()
        configuration.requestCachePolicy = NSURLRequestCachePolicy.ReloadIgnoringLocalAndRemoteCacheData

        let delegateQueue = NSOperationQueue()
        delegateQueue.maxConcurrentOperationCount = 10

        let session = NSURLSession(configuration: configuration, delegate: self, delegateQueue: delegateQueue)

        // Initialize service and invoke methods
        let baseURL = NSURL(string: "https://localhost:8443/httprpc-server-test/test/")<commit_msg>Fix typo.<commit_after>//
// 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.
//

import UIKit
import HTTPRPC

class ViewController: UIViewController, UITableViewDataSource, NSURLSessionDataDelegate {
    var cells: [UITableViewCell]!

    var addCell: UITableViewCell!
    var addValuesCell: UITableViewCell!
    var invertValueCell: UITableViewCell!
    var getCharactersCell: UITableViewCell!
    var getSelectionCell: UITableViewCell!
    var getMapCell: UITableViewCell!
    var getStatisticsCell: UITableViewCell!
    var getTestDataCell: UITableViewCell!
    var getVoidCell: UITableViewCell!
    var getNullCell: UITableViewCell!
    var getLocaleCodeCell: UITableViewCell!
    var getUserNameCell: UITableViewCell!
    var isUserInRoleCell: UITableViewCell!
    var getAttachmentInfoCell: UITableViewCell!

    override func loadView() {
        let tableView = UITableView()

        tableView.contentInset = UIEdgeInsets(top: 20, left: 0, bottom: 0, right: 0)
        tableView.dataSource = self

        cells = [];

        addCell = UITableViewCell(style: UITableViewCellStyle.Value1, reuseIdentifier: nil)
        addCell.textLabel!.text = "add()"
        cells.append(addCell)

        addValuesCell = UITableViewCell(style: UITableViewCellStyle.Value1, reuseIdentifier: nil)
        addValuesCell.textLabel!.text = "addArray()"
        cells.append(addValuesCell)

        invertValueCell = UITableViewCell(style: UITableViewCellStyle.Value1, reuseIdentifier: nil)
        invertValueCell.textLabel!.text = "invertValue()"
        cells.append(invertValueCell)

        getCharactersCell = UITableViewCell(style: UITableViewCellStyle.Value1, reuseIdentifier: nil)
        getCharactersCell.textLabel!.text = "getCharacters()"
        cells.append(getCharactersCell)

        getSelectionCell = UITableViewCell(style: UITableViewCellStyle.Value1, reuseIdentifier: nil)
        getSelectionCell.textLabel!.text = "getSelection()"
        cells.append(getSelectionCell)

        getMapCell = UITableViewCell(style: UITableViewCellStyle.Value1, reuseIdentifier: nil)
        getMapCell.textLabel!.text = "getMap()"
        cells.append(getMapCell)

        getStatisticsCell = UITableViewCell(style: UITableViewCellStyle.Value1, reuseIdentifier: nil)
        getStatisticsCell.textLabel!.text = "getStatistics()"
        cells.append(getStatisticsCell)

        getTestDataCell = UITableViewCell(style: UITableViewCellStyle.Value1, reuseIdentifier: nil)
        getTestDataCell.textLabel!.text = "getTestData()"
        cells.append(getTestDataCell)

        getVoidCell = UITableViewCell(style: UITableViewCellStyle.Value1, reuseIdentifier: nil)
        getVoidCell.textLabel!.text = "getVoid()"
        cells.append(getVoidCell)

        getNullCell = UITableViewCell(style: UITableViewCellStyle.Value1, reuseIdentifier: nil)
        getNullCell.textLabel!.text = "getNull()"
        cells.append(getNullCell)

        getLocaleCodeCell = UITableViewCell(style: UITableViewCellStyle.Value1, reuseIdentifier: nil)
        getLocaleCodeCell.textLabel!.text = "getLocaleCode()"
        cells.append(getLocaleCodeCell)

        getUserNameCell = UITableViewCell(style: UITableViewCellStyle.Value1, reuseIdentifier: nil)
        getUserNameCell.textLabel!.text = "getUserName()"
        cells.append(getUserNameCell)

        isUserInRoleCell = UITableViewCell(style: UITableViewCellStyle.Value1, reuseIdentifier: nil)
        isUserInRoleCell.textLabel!.text = "isUserInRole()"
        cells.append(isUserInRoleCell)

        getAttachmentInfoCell = UITableViewCell(style: UITableViewCellStyle.Value1, reuseIdentifier: nil)
        getAttachmentInfoCell.textLabel!.text = "getAttachmentInfo()"
        cells.append(getAttachmentInfoCell)

        view = tableView
    }

    override func viewDidLoad() {
        // Set invalid user credentials
        let credential = NSURLCredential(user: "tomcatx", password: "<PASSWORD>", persistence: NSURLCredentialPersistence.ForSession);
        let protectionSpace = NSURLProtectionSpace(host: "localhost", port: 8443, protocol: "https", realm: "tomcat",
            authenticationMethod: NSURLAuthenticationMethodHTTPBasic)

        NSURLCredentialStorage.sharedCredentialStorage().setDefaultCredential(credential, forProtectionSpace: protectionSpace)

        // Configure session
        let configuration = NSURLSessionConfiguration.defaultSessionConfiguration()
        configuration.requestCachePolicy = NSURLRequestCachePolicy.ReloadIgnoringLocalAndRemoteCacheData

        let delegateQueue = NSOperationQueue()
        delegateQueue.maxConcurrentOperationCount = 10

        let session = NSURLSession(configuration: configuration, delegate: self, delegateQueue: delegateQueue)

        // Initialize service and invoke methods
        let baseURL = NSURL(string: "https://localhost:8443/httprpc-server-test/test/")
{'fraction_non_alphanumeric': 0.08404531946508173, 'fraction_numerical': 0.00612927191679049, 'mean_word_length': 3.951264367816092, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 5, 'https://': 2, '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': '4817806', 'n_tokens_mistral': 3132, 'n_tokens_neox': 2823, 'n_words': 648}