Changeset 256

Show
Ignore:
Timestamp:
04/24/07 16:43:36 (2 years ago)
Author:
kindlund
Message:

Finished initial implementation of multi-value XML configuration data.

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • honeyclient/branches/exp/kindlund-multi_config/etc/honeyclient.xml

    r233 r256  
    8484                    -1 
    8585                </max_relative_links_to_visit> 
    86                <goodwords description="A comma-separated list of good words which will increase the score of links within a webpage." default=""> 
     86                <goodwords description="A comma-separated list of good words which will increase the score of links within a webpage." default=""> 
    8787                    news,new,big,latest,main,update,sell,free,buy 
    8888                </goodwords> 
    89                <badwords description="A comma-separated list of bad words which will decrease the score of links within a webpage." default=""> 
     89                <badwords description="A comma-separated list of bad words which will decrease the score of links within a webpage." default=""> 
    9090                    archive,privacy,legal,disclaim,about,contact,copyright,jobs,careers 
    9191                </badwords> 
     
    364364                    </Bar> 
    365365                </Foo> 
     366                <Yok> 
     367                    <childA>12345678</childA> 
     368                    <childA>ABCDEFGH</childA> 
     369                    <childB>09876543</childB> 
     370                    <childB>ZYXVTUWG</childB> 
     371                </Yok> 
    366372            </Test> 
    367373        </Config> 
  • honeyclient/branches/exp/kindlund-multi_config/lib/HoneyClient/Util/Config.pm

    r255 r256  
    441441    or diag("The getVar() call failed.  Attempted to get attribute 'default' for variable 'address' using namespace 'HoneyClient::Util::Config::Test::Undefined::Child' within the global configuration file."); 
    442442 
     443# This check tests to make sure getVar() returns the expected hashref 
     444# when getting data from a target element that contains child sub-elements. 
     445$value = getVar(name => "Yok", namespace => "HoneyClient::Util::Config::Test"); 
     446my $expectedValue = { 
     447    'childA' => [ '12345678', 'ABCDEFGH' ], 
     448    'childB' => [ '09876543', 'ZYXVTUWG' ], 
     449}; 
     450is_deeply($value, $expectedValue, "getVar(name => 'Yok', namespace => 'HoneyClient::Util::Config::Test')")  
     451    or diag("The getVar() call failed.  Attempted to get variable 'Yok' using namespace 'HoneyClient::Util::Config::Test' within the global configuration file."); 
     452 
    443453=end testing 
    444454 
  • honeyclient/branches/exp/kindlund-multi_config/t/honeyclient_util_config.t

    r131 r256  
    8383is($value, "localhost", "getVar(name => 'address', namespace => 'HoneyClient::Util::Config::Test::Undefined::Child', attribute => 'default')")  
    8484    or diag("The getVar() call failed.  Attempted to get attribute 'default' for variable 'address' using namespace 'HoneyClient::Util::Config::Test::Undefined::Child' within the global configuration file."); 
     85 
     86# This check tests to make sure getVar() returns the expected hashref 
     87# when getting data from a target element that contains child sub-elements. 
     88$value = getVar(name => "Yok", namespace => "HoneyClient::Util::Config::Test"); 
     89my $expectedValue = { 
     90    'childA' => [ '12345678', 'ABCDEFGH' ], 
     91    'childB' => [ '09876543', 'ZYXVTUWG' ], 
     92}; 
     93is_deeply($value, $expectedValue, "getVar(name => 'Yok', namespace => 'HoneyClient::Util::Config::Test')")  
     94    or diag("The getVar() call failed.  Attempted to get variable 'Yok' using namespace 'HoneyClient::Util::Config::Test' within the global configuration file."); 
    8595} 
    8696