mirror of https://github.com/apache/lucene.git
adjust tests to work without libxml2
git-svn-id: https://svn.apache.org/repos/asf/lucene/solr/trunk@540702 13f79535-47bb-0310-9956-ffa450edef68
This commit is contained in:
parent
502b3248d6
commit
a74e62d8c3
|
@ -59,7 +59,7 @@ class DocumentTest < Test::Unit::TestCase
|
|||
def test_boost
|
||||
doc = Solr::Document.new :name => "McGrump"
|
||||
doc.boost = 300.28
|
||||
assert_match(/<doc boost=['"]300.28['"]>[\s]+<field name=['"]name['"]>McGrump<\/field>[\s]+<\/doc>/, doc.to_xml.to_s)
|
||||
assert_match(/<doc boost=['"]300.28['"]>[\s]*<field name=['"]name['"]>McGrump<\/field>[\s]*<\/doc>/, doc.to_xml.to_s)
|
||||
end
|
||||
|
||||
end
|
||||
|
|
|
@ -22,7 +22,7 @@ class RequestTest < Test::Unit::TestCase
|
|||
request = Solr::Request::Commit.new
|
||||
assert_equal :xml, request.response_format
|
||||
assert_equal 'update', request.handler
|
||||
assert_equal '<commit waitSearcher="true" waitFlush="true"/>', request.to_s
|
||||
assert_match(/<commit waitSearcher=["']true["'] waitFlush=["'']true["'']\/>/, request.to_s)
|
||||
end
|
||||
|
||||
def test_add_doc_request
|
||||
|
|
|
@ -10,24 +10,29 @@
|
|||
# See the License for the specific language governing permissions and
|
||||
# limitations under the License.
|
||||
|
||||
require 'solr'
|
||||
require 'test/unit'
|
||||
begin
|
||||
require 'solr'
|
||||
require 'test/unit'
|
||||
require 'xml/libxml'
|
||||
|
||||
class XPathMapperTest < Test::Unit::TestCase
|
||||
class XPathMapperTest < Test::Unit::TestCase
|
||||
|
||||
def setup
|
||||
@doc = XML::Document.file(File.expand_path(File.dirname(__FILE__)) + "/xpath_test_file.xml")
|
||||
end
|
||||
def setup
|
||||
@doc = XML::Document.file(File.expand_path(File.dirname(__FILE__)) + "/xpath_test_file.xml")
|
||||
end
|
||||
|
||||
def test_simple_xpath
|
||||
mapping = {:solr_field1 => :'/root/parent/child',
|
||||
:solr_field2 => :'/root/parent/child/@attribute'}
|
||||
def test_simple_xpath
|
||||
mapping = {:solr_field1 => :'/root/parent/child',
|
||||
:solr_field2 => :'/root/parent/child/@attribute'}
|
||||
|
||||
mapper = Solr::Importer::XPathMapper.new(mapping)
|
||||
mapped_data = mapper.map(@doc)
|
||||
mapper = Solr::Importer::XPathMapper.new(mapping)
|
||||
mapped_data = mapper.map(@doc)
|
||||
|
||||
assert_equal ['text1', 'text2'], mapped_data[:solr_field1]
|
||||
assert_equal ['attribute1', 'attribute2'], mapped_data[:solr_field2]
|
||||
end
|
||||
assert_equal ['text1', 'text2'], mapped_data[:solr_field1]
|
||||
assert_equal ['attribute1', 'attribute2'], mapped_data[:solr_field2]
|
||||
end
|
||||
|
||||
end
|
||||
end
|
||||
rescue LoadError => e
|
||||
puts "XPathMapperTest not run because #{e}"
|
||||
end
|
Loading…
Reference in New Issue