Skip to content

Commit

Permalink
Item9750: rewrite regex conversion to mongodb queries to take advant…
Browse files Browse the repository at this point in the history
…age of the new mongodb OR and simplify

horrid hack to get the MongoDBPlugin started for unit tests. Hopefully Crawford and I can figure out a real way to implement this

implement in mongodb sorting, and in the process, de-array the FIELD, TOPICINFO, TOPICPARENT and FILEATTACHMENT meta data, as mongodb can't (as yet) sort_by array elements

rewrite the serialisation into mongodb

git-svn-id: http://svn.foswiki.org/trunk@9567 0b4bb1d4-4e5a-0410-9cc4-b2b747904278
  • Loading branch information
SvenDowideit authored and SvenDowideit committed Oct 16, 2010
1 parent 3911eba commit a8050b6
Show file tree
Hide file tree
Showing 2 changed files with 38 additions and 0 deletions.
16 changes: 16 additions & 0 deletions UnitTestContrib/test/unit/Fn_SEARCH.pm
Expand Up @@ -113,7 +113,23 @@ SUB

sub loadExtraConfig {
my $this = shift; # the Test::Unit::TestCase object

#turn on the MongoDBPlugin so that the saved data goes into mongoDB
#This is temoprary until Crawford and I cna find a way to push dependencies into unit tests
if (($Foswiki::cfg{Store}{SearchAlgorithm} =~ /MongDB/) or
($Foswiki::cfg{Store}{QueryAlgorithm} =~ /MongDB/)) {
$Foswiki::cfg{Plugins}{MongoDBPlugin}{Module} = 'Foswiki::Plugins::MongoDBPlugin';
$Foswiki::cfg{Plugins}{MongoDBPlugin}{Enabled} = 1;
$Foswiki::cfg{Plugins}{MongoDBPlugin}{EnableOnSaveUpdates} = 1;
}

$this->SUPER::loadExtraConfig();

if (($Foswiki::cfg{Store}{SearchAlgorithm} =~ /MongDB/) or
($Foswiki::cfg{Store}{QueryAlgorithm} =~ /MongDB/)) {
require Foswiki::Plugins::MongoDBPlugin;
Foswiki::Plugins::MongoDBPlugin::getMongoDB()->remove('current', {'_web' => $this->{test_web}});
}
}


Expand Down
22 changes: 22 additions & 0 deletions UnitTestContrib/test/unit/QueryTests.pm
Expand Up @@ -138,6 +138,28 @@ SUB
return \@groups;
}


sub loadExtraConfig {
my $this = shift; # the Test::Unit::TestCase object

#turn on the MongoDBPlugin so that the saved data goes into mongoDB
#This is temoprary until Crawford and I cna find a way to push dependencies into unit tests
if (($Foswiki::cfg{Store}{SearchAlgorithm} =~ /MongDB/) or
($Foswiki::cfg{Store}{QueryAlgorithm} =~ /MongDB/)) {
$Foswiki::cfg{Plugins}{MongoDBPlugin}{Module} = 'Foswiki::Plugins::MongoDBPlugin';
$Foswiki::cfg{Plugins}{MongoDBPlugin}{Enabled} = 1;
$Foswiki::cfg{Plugins}{MongoDBPlugin}{EnableOnSaveUpdates} = 1;
}

$this->SUPER::loadExtraConfig();

if (($Foswiki::cfg{Store}{SearchAlgorithm} =~ /MongDB/) or
($Foswiki::cfg{Store}{QueryAlgorithm} =~ /MongDB/)) {
require Foswiki::Plugins::MongoDBPlugin;
Foswiki::Plugins::MongoDBPlugin::getMongoDB()->remove('current', {'_web' => $this->{test_web}});
}
}

sub check {
my ( $this, $s, %opts ) = @_;

Expand Down

0 comments on commit a8050b6

Please sign in to comment.