diff --git a/.travis.yml b/.travis.yml index 9dc729fa8..c76e8c872 100644 --- a/.travis.yml +++ b/.travis.yml @@ -28,6 +28,9 @@ services: - mysql - redis-server +before_script: + - echo "USE mysql;\nUPDATE user SET password=PASSWORD('1qazZAQ!') WHERE user='root';\nFLUSH PRIVILEGES;\n" | mysql -u root + before_install: - chmod a+x ./runtests.sh diff --git a/src/DotnetSpider.Core.Test/SpiderTest.cs b/src/DotnetSpider.Core.Test/SpiderTest.cs index f7049868b..f7c6685f7 100644 --- a/src/DotnetSpider.Core.Test/SpiderTest.cs +++ b/src/DotnetSpider.Core.Test/SpiderTest.cs @@ -32,7 +32,7 @@ public void IdentityLengthLimit() } catch (Exception exception) { - Assert.Equal($"Length of identity should less than {Env.IdentityMaxLength}.", exception.Message); + Assert.Equal($"Length of identity should less than {Env.IdentityMaxLength}", exception.Message); return; } diff --git a/src/DotnetSpider.Extension.Test/Pipeline/MySqlEntityPipelineTest.cs b/src/DotnetSpider.Extension.Test/Pipeline/MySqlEntityPipelineTest.cs index f96b07831..314b63b25 100644 --- a/src/DotnetSpider.Extension.Test/Pipeline/MySqlEntityPipelineTest.cs +++ b/src/DotnetSpider.Extension.Test/Pipeline/MySqlEntityPipelineTest.cs @@ -43,7 +43,7 @@ protected virtual IDbConnection CreateDbConnection() [Fact(DisplayName = "DataTypes")] public virtual void DataTypes() { - using (MySqlConnection conn = new MySqlConnection("Database='mysql';Data Source=127.0.0.1;User ID=root;Password=;Port=3306;SslMode=None;")) + using (MySqlConnection conn = new MySqlConnection("Database='mysql';Data Source=127.0.0.1;User ID=root;Password=1qazZAQ!;Port=3306;SslMode=None;")) { try { @@ -53,7 +53,7 @@ public virtual void DataTypes() { } - var pipeline = new MySqlEntityPipeline("Database='mysql';Data Source=localhost;User ID=root;Password=;Port=3306;SslMode=None;"); + var pipeline = new MySqlEntityPipeline("Database='mysql';Data Source=localhost;User ID=root;Password=1qazZAQ!;Port=3306;SslMode=None;"); var resultItems = new ResultItems(); resultItems.Request = new Request(); resultItems["aaaa"] = diff --git a/src/DotnetSpider.Extension.Test/TestBase.cs b/src/DotnetSpider.Extension.Test/TestBase.cs index 944270d67..f053c8630 100644 --- a/src/DotnetSpider.Extension.Test/TestBase.cs +++ b/src/DotnetSpider.Extension.Test/TestBase.cs @@ -2,6 +2,6 @@ { public abstract class TestBase { - public virtual string DefaultConnectionString { get; } = "Database='mysql';Data Source=localhost;User ID=root;Port=3306;SslMode=None;"; + public virtual string DefaultConnectionString { get; } = "Database='mysql';Data Source=localhost;Password=1qazZAQ!;User ID=root;Port=3306;SslMode=None;"; } } diff --git a/src/DotnetSpider.Extension.Test/app.config b/src/DotnetSpider.Extension.Test/app.config index 62a5bba92..c08213673 100644 --- a/src/DotnetSpider.Extension.Test/app.config +++ b/src/DotnetSpider.Extension.Test/app.config @@ -1,9 +1,9 @@  - - - - diff --git a/src/DotnetSpider.Extension/Processor/ModelProcessor.cs b/src/DotnetSpider.Extension/Processor/ModelProcessor.cs index b531b30c7..633721fe3 100644 --- a/src/DotnetSpider.Extension/Processor/ModelProcessor.cs +++ b/src/DotnetSpider.Extension/Processor/ModelProcessor.cs @@ -72,7 +72,9 @@ public ModelProcessor(IModel model, IModelExtractor extractor = null, params IDa } } - RequestExtractor = xPaths.Any(x => x == null || x == ".") ? new XPathRequestExtractor(".") : new XPathRequestExtractor(xPaths); + RequestExtractor = xPaths.Any(x => x == null || x == ".") + ? new XPathRequestExtractor(".") + : (xPaths.Count == 0 ? null : new XPathRequestExtractor(xPaths)); if (dataHandlers == null) return; foreach (var dataHandler in dataHandlers)