From cd16470e029270d32fecbfcadf6f4c541883be6c Mon Sep 17 00:00:00 2001 From: Rob Szkutak Date: Tue, 31 Jan 2017 01:11:15 -0600 Subject: [PATCH] Fix several issues causing self test to fail in various places --- deploy/lib/util.rb | 2 +- deploy/lib/xquery/setup.xqy | 8 +++--- deploy/test/test_server_config.rb | 41 ++++++++----------------------- 3 files changed, 15 insertions(+), 36 deletions(-) diff --git a/deploy/lib/util.rb b/deploy/lib/util.rb index ecf96ebb..6fee0ec7 100644 --- a/deploy/lib/util.rb +++ b/deploy/lib/util.rb @@ -149,7 +149,7 @@ def xquery_safe end def xquery_unsafe - REXML::Text::unnormalize(self).gsub(/\{\{/, '{').gsub(/\}\}/, '}') + REXML::Text::unnormalize(self) end end diff --git a/deploy/lib/xquery/setup.xqy b/deploy/lib/xquery/setup.xqy index 2a3edf8b..f4b58b8b 100644 --- a/deploy/lib/xquery/setup.xqy +++ b/deploy/lib/xquery/setup.xqy @@ -2603,8 +2603,8 @@ declare function setup:add-phrase-throughs( for $pt in $db-config/db:phrase-throughs/db:phrase-through return admin:database-phrase-through( - $pt/db:namespace-uri, - $pt/db:localname + $pt/db:namespace-uri/string(), + $pt/db:localname/string() ) ) }; @@ -2638,8 +2638,8 @@ declare function setup:add-phrase-arounds( for $pa in $db-config/db:phrase-arounds/db:phrase-around return admin:database-phrase-around( - $pa/db:namespace-uri, - $pa/db:collation + $pa/db:namespace-uri/string(), + $pa/db:localname/string() ) ) }; diff --git a/deploy/test/test_server_config.rb b/deploy/test/test_server_config.rb index 5650d398..5978b7e5 100644 --- a/deploy/test/test_server_config.rb +++ b/deploy/test/test_server_config.rb @@ -139,50 +139,29 @@ end end - describe "test_credentials" do + describe "test_ml_server_missing" do before do ARGV << "local" + end - test_env = "blah" + it "should raise exception about missing ml.server definition" do + test_env = "doesnotexist" properties = ServerConfig.properties properties["environment"] = test_env properties["ml.environment"] = test_env - @s = ServerConfig.new({ - :config_file => File.expand_path(properties["ml.config.file"], __FILE__), - :properties => properties, - :logger => Logger.new(STDOUT) - }) - - filename = "#{test_env}.properties" - path = ServerConfig.path - @properties_file = ServerConfig.expand_path("#{path}/#{filename}") - end - - it "should prompt the user for credentials" do - File.exists?(@properties_file).must_equal false - - with_stdin do |user| - user.puts "bob" - user.puts "smith" - @s.credentials + assert_raises RuntimeError do + ServerConfig.new({ + :config_file => File.expand_path(properties["ml.config.file"], __FILE__), + :properties => properties, + :logger => Logger.new(STDOUT) + }) end - - File.exists?(@properties_file).must_equal true - - props_data = File.read(@properties_file) - - user = $1 if props_data =~ /user=(\w+)/ - password = $1 if props_data =~ /password=(\w+)/ - - user.must_equal 'bob' - password.must_equal 'smith' end after do - File.delete(@properties_file) @s = nil end