<commit_before>/*
 * tests/embodiment/Control/OperationalAvatarController/OACMock.cc
 *
 * @author <NAME> <<EMAIL>>
 * @date   2011-06-14
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License v3 as
 * published by the Free Software Foundation and including the exceptions
 * at http://opencog.org/wiki/Licenses
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program; if not, write to:
 * Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */

#include "OACMock.h"
#include <opencog/embodiment/Control/MessagingSystem/MessageFactory.h>


void OACMock::setConfig()
{
    // Set arguments used by OAC::init
    // You can easily get these arguments by set MANUAL_OAC_LAUNCH true in 
    // config file, run the embodiment system and copy the command of 
    // running OAC in console. 
    agentBrainId = "123456"; 
    ownerId = "290"; 
    agentType = "pet";  
    agentTrait = "Maxie"; 
    networkElementPort = "16326"; 
    cogServerShellPort = "17002"; 
    zmqPublishPort = "18002"; 

    // Set logger level
    logger().setLevel(Logger::FINE);
    logger().setPrintToStdoutFlag(true);

    // Load config file and reset some configurations  
    config(opencog::control::EmbodimentConfig::embodimentCreateInstance, true);
    
    if ( fileExists(config().get("CONFIG_FILE").c_str()) ) {
        config().load(config().get("CONFIG_FILE").c_str());
    }
   
    config().set("EXTERNAL_TICK_MODE", "true");
    config().set("SERVER_PORT", cogServerShellPort);
    config().set("ZMQ_PUBLISH_PORT", zmqPublishPort);

    config().set("MODULES", "libquery.so, libbuiltinreqs.so, \
                             libscheme-shell.so, libpersist.so");

    config().set("RUN_OAC_DEBUGGER", "false"); 
    config().set("MANUAL_OAC_LAUNCH", "false"); 
    config().set("ENABLE_UNITY_CONNECTOR", "false"); 
    //config().set("USE_3D_MAP", "false");

    // Put the log file in the current directory -- also print log
    // location to the screen. 
    config().set("LOG_DIR", "."); 
    config().set("PRINT_LOG_TO_STDOUT", "true");

    // Disable opencog::spatial::MapExplorerServer, which raises
    // 'bad file descriptor' error during unit test
    config().set("VISUAL_DEBUGGER_ACTIVE", "false"); 
};

OAC & OACMock::createOAC()
{
    // Create an instance of OAC
    server(OAC::createInstance);
    this->oac = & static_cast<OAC&>(server());

    // Open database *before* loading modules, since the modules
    // might create atoms, and we can't have that happen until 
    // storage is open, as otherwise, there will be handle conflicts.
    oac->openDatabase();<commit_msg>Add explicit locations to the modules to be loaded.<commit_after>/*
 * tests/embodiment/Control/OperationalAvatarController/OACMock.cc
 *
 * @author <NAME> <<EMAIL>>
 * @date   2011-06-14
 *
 * This program is free software; you can redistribute it and/or modify
 * it under the terms of the GNU Affero General Public License v3 as
 * published by the Free Software Foundation and including the exceptions
 * at http://opencog.org/wiki/Licenses
 *
 * This program is distributed in the hope that it will be useful,
 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
 * GNU General Public License for more details.
 *
 * You should have received a copy of the GNU Affero General Public License
 * along with this program; if not, write to:
 * Free Software Foundation, Inc.,
 * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
 */

#include "OACMock.h"
#include <opencog/embodiment/Control/MessagingSystem/MessageFactory.h>


void OACMock::setConfig()
{
    // Set arguments used by OAC::init
    // You can easily get these arguments by set MANUAL_OAC_LAUNCH true in 
    // config file, run the embodiment system and copy the command of 
    // running OAC in console. 
    agentBrainId = "123456"; 
    ownerId = "290"; 
    agentType = "pet";  
    agentTrait = "Maxie"; 
    networkElementPort = "16326"; 
    cogServerShellPort = "17002"; 
    zmqPublishPort = "18002"; 

    // Set logger level
    logger().setLevel(Logger::FINE);
    logger().setPrintToStdoutFlag(true);

    // Load config file and reset some configurations  
    config(opencog::control::EmbodimentConfig::embodimentCreateInstance, true);
    
    if ( fileExists(config().get("CONFIG_FILE").c_str()) ) {
        config().load(config().get("CONFIG_FILE").c_str());
    }
   
    config().set("EXTERNAL_TICK_MODE", "true");
    config().set("SERVER_PORT", cogServerShellPort);
    config().set("ZMQ_PUBLISH_PORT", zmqPublishPort);

    // XXX FIXME: at this time, we need to specify explicit paths to
    // to the modules that need to be loaded. I don't know why.
    config().set("MODULES", "opencog/query/libquery.so, "
                            "opencog/server/libbuiltinreqs.so, "
                            "opencog/shell/libscheme-shell.so, "
                            "opencog/persist/sql/libpersist.so");

    config().set("RUN_OAC_DEBUGGER", "false"); 
    config().set("MANUAL_OAC_LAUNCH", "false"); 
    config().set("ENABLE_UNITY_CONNECTOR", "false"); 
    //config().set("USE_3D_MAP", "false");

    // Put the log file in the current directory -- also print log
    // location to the screen. 
    config().set("LOG_DIR", "."); 
    config().set("PRINT_LOG_TO_STDOUT", "true");

    // Disable opencog::spatial::MapExplorerServer, which raises
    // 'bad file descriptor' error during unit test
    config().set("VISUAL_DEBUGGER_ACTIVE", "false"); 
};

OAC & OACMock::createOAC()
{
    // Create an instance of OAC
    server(OAC::createInstance);
    this->oac = & static_cast<OAC&>(server());

    // Open database *before* loading modules, since the modules
    // might create atoms, and we can't have that happen until 
    // storage is open, as otherwise, there will be handle conflicts.
    oac->openDatabase();
{'fraction_non_alphanumeric': 0.12219056663501109, 'fraction_numerical': 0.014245014245014245, 'mean_word_length': 3.325119780971937, 'pattern_counts': {'":': 0, '<': 13, '<?xml version=': 0, '>': 17, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, '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': '3108589', 'n_tokens_mistral': 1977, 'n_tokens_neox': 1866, 'n_words': 575}