<commit_before>/*************************************************************************
This file is part of libresourceqt

Copyright (C) 2010 Nokia Corporation.

This library is free software; you can redistribute
it and/or modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation
version 2.1 of the License.

This library 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
Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
USA.
*************************************************************************/
#include "test-init.h"
#include <time.h>


using namespace ResourcePolicy;

static struct timespec startTime;

long int stop_timer(void);
int      start_timer(void);


void TestInitAndConnect::init()
{
     theCase.init();
}


void Case::init()
{
    resSetWithInit           = new ResourcePolicy::ResourceSet("player");
    resSetWithoutInit        = new ResourcePolicy::ResourceSet("player");
    videoResourceWithInit    = new ResourcePolicy::VideoResource;
    videoResourceWithoutInit = new ResourcePolicy::VideoResource;
    //Add the resources.
    resSetWithInit->addResourceObject(videoResourceWithInit);
    resSetWithoutInit->addResourceObject(videoResourceWithoutInit);
}


void TestInitAndConnect::testTheCase()
{
    theCase.initAndConnect();
}


void Case::initAndConnect()
{
    resSetWithInit->initAndConnect();
    QObject::connect(resSetWithInit, SIGNAL(connectedToManager()), &loop, SLOT(quit()));
    loop.exec();
    connectedWithInitHandler();
}


void Case::connectedWithInitHandler()
{
    QVERIFY(resSetWithInit->isConnectedToManager() == true);
    QObject::connect(resSetWithInit, SIGNAL(resourcesGranted(QList<ResourcePolicy::ResourceType>)),
                     &loop,          SLOT(grantedQuit(QList<ResourcePolicy::ResourceType>)));
    startTimer();
    resSetWithInit->acquire();<commit_msg>Changed to new signals in test-init-and-connect.<commit_after>/*************************************************************************
This file is part of libresourceqt

Copyright (C) 2010 Nokia Corporation.

This library is free software; you can redistribute
it and/or modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation
version 2.1 of the License.

This library 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
Lesser General Public License for more details.

You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
USA.
*************************************************************************/
#include "test-init.h"
#include <time.h>


using namespace ResourcePolicy;

static struct timespec startTime;

long int stop_timer(void);
int      start_timer(void);


void TestInitAndConnect::init()
{
     theCase.init();
}


void Case::init()
{
    resSetWithInit           = new ResourcePolicy::ResourceSet("player");
    resSetWithoutInit        = new ResourcePolicy::ResourceSet("player");
    videoResourceWithInit    = new ResourcePolicy::VideoResource;
    videoResourceWithoutInit = new ResourcePolicy::VideoResource;
    //Add the resources.
    resSetWithInit->addResourceObject(videoResourceWithInit);
    resSetWithoutInit->addResourceObject(videoResourceWithoutInit);
}


void TestInitAndConnect::testTheCase()
{
    theCase.initAndConnect();
}


void Case::initAndConnect()
{
    resSetWithInit->initAndConnect();
    QObject::connect(resSetWithInit, SIGNAL(managerIsUp()), &loop, SLOT(quit()));
    loop.exec();
    connectedWithInitHandler();
}


void Case::connectedWithInitHandler()
{
    QVERIFY(resSetWithInit->isConnectedToManager() == true);
    QObject::connect(resSetWithInit, SIGNAL(resourcesGranted(QList<ResourcePolicy::ResourceType>)),
                     &loop,          SLOT(grantedQuit(QList<ResourcePolicy::ResourceType>)));
    startTimer();
    resSetWithInit->acquire();
{'fraction_non_alphanumeric': 0.15033557046979865, 'fraction_numerical': 0.007606263982102908, 'mean_word_length': 5.10792349726776, 'pattern_counts': {'":': 0, '<': 9, '<?xml version=': 0, '>': 19, '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': '5617057', 'n_tokens_mistral': 1190, 'n_tokens_neox': 1119, 'n_words': 364}