You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@nlpcraft.apache.org by se...@apache.org on 2020/09/21 09:48:00 UTC

[incubator-nlpcraft] 01/02: Tests configuration fixes fr maven.

This is an automated email from the ASF dual-hosted git repository.

sergeykamov pushed a commit to branch NLPCRAFT-132
in repository https://gitbox.apache.org/repos/asf/incubator-nlpcraft.git

commit 54d5155d132375da4300279b465450b7adc547ff
Author: Sergey Kamov <se...@apache.org>
AuthorDate: Mon Sep 21 12:07:36 2020 +0300

    Tests configuration fixes fr maven.
---
 nlpcraft/pom.xml                                    | 21 +++++++++++++++++++++
 .../apache/nlpcraft/NCTestExampleModelsSpec.scala   |  9 ++++++++-
 .../enrichers/date/tools/NCDateGeneratorSpec.scala  |  5 ++---
 pom.xml                                             |  1 +
 4 files changed, 32 insertions(+), 4 deletions(-)

diff --git a/nlpcraft/pom.xml b/nlpcraft/pom.xml
index ea34cdb..e7662bc 100644
--- a/nlpcraft/pom.xml
+++ b/nlpcraft/pom.xml
@@ -270,6 +270,26 @@
 
         <plugins>
             <plugin>
+                <groupId>org.codehaus.mojo</groupId>
+                <artifactId>properties-maven-plugin</artifactId>
+                <version>${maven.read.project.properties.plugin.ver}</version>
+                <executions>
+                    <execution>
+                        <goals>
+                            <goal>set-system-properties</goal>
+                        </goals>
+                        <configuration>
+                            <properties>
+                                <property>
+                                    <name>tests.env.maven</name>
+                                    <value>true</value>
+                                </property>
+                            </properties>
+                        </configuration>
+                    </execution>
+                </executions>
+            </plugin>
+            <plugin>
                 <groupId>com.bazaarvoice.maven.plugins</groupId>
                 <artifactId>process-exec-maven-plugin</artifactId>
                 <version>${maven.bazaarvoice.plugin.ver}</version>
@@ -338,6 +358,7 @@
                             </includes>
                             <excludes>
                                 <exclude>**/NCConversationSpec.*</exclude>
+                                <exclude>**/NCDateGeneratorSpec.*</exclude>
                             </excludes>
                         </configuration>
                     </execution>
diff --git a/nlpcraft/src/test/scala/org/apache/nlpcraft/NCTestExampleModelsSpec.scala b/nlpcraft/src/test/scala/org/apache/nlpcraft/NCTestExampleModelsSpec.scala
index 2e57177..8000ba0 100644
--- a/nlpcraft/src/test/scala/org/apache/nlpcraft/NCTestExampleModelsSpec.scala
+++ b/nlpcraft/src/test/scala/org/apache/nlpcraft/NCTestExampleModelsSpec.scala
@@ -26,12 +26,19 @@ import org.junit.jupiter.api.{Assertions, Test}
 class NCTestExampleModelsSpec {
     @Test
     def test(): Unit = {
-        val models = "" +
+        var models = "" +
             "org.apache.nlpcraft.examples.alarm.AlarmModel," +
             "org.apache.nlpcraft.examples.time.TimeModel," +
             "org.apache.nlpcraft.examples.lightswitch.LightSwitchModel," +
             "org.apache.nlpcraft.examples.echo.EchoModel"
 
+        val testEnvMavenStr = System.getProperty("tests.env.maven")
+
+        println("testEnvMavenStr="+testEnvMavenStr)
+
+        if (testEnvMavenStr == null || testEnvMavenStr.toLowerCase != "true")
+            models = s"$models,org.apache.nlpcraft.examples.weather.WeatherModel"
+
         // Instruct auto-validator what models to test.
         System.setProperty("NLPCRAFT_TEST_MODELS", models)
 
diff --git a/nlpcraft/src/test/scala/org/apache/nlpcraft/server/nlp/enrichers/date/tools/NCDateGeneratorSpec.scala b/nlpcraft/src/test/scala/org/apache/nlpcraft/server/nlp/enrichers/date/tools/NCDateGeneratorSpec.scala
index 4db3503..7c817e3 100644
--- a/nlpcraft/src/test/scala/org/apache/nlpcraft/server/nlp/enrichers/date/tools/NCDateGeneratorSpec.scala
+++ b/nlpcraft/src/test/scala/org/apache/nlpcraft/server/nlp/enrichers/date/tools/NCDateGeneratorSpec.scala
@@ -26,18 +26,17 @@ import org.apache.nlpcraft.server.nlp.enrichers.date.NCDateFormatType._
 import org.apache.nlpcraft.server.nlp.enrichers.date.tools.NCDateGenerator.LHM_SS
 import org.apache.nlpcraft.server.nlp.enrichers.date.{NCDateParser, NCDateRange}
 import org.junit.jupiter.api.Assertions.{assertTrue, fail}
-import org.junit.jupiter.api.{Disabled, Test}
+import org.junit.jupiter.api.Test
 
 import scala.collection.JavaConverters._
 import scala.collection._
-import scala.collection.mutable.{LinkedHashMap ⇒ LHM}
+import scala.collection.mutable.{LinkedHashMap => LHM}
 import scala.language.implicitConversions
 
 /**
  * Tests for dates templates generators.
  * Excluded from suite because added for manual testing.
  */
-@Disabled
 class NCDateGeneratorSpec  {
     private def print(
         f: LHM[String, String] ⇒ Unit, cnt: Int = 500, asc: Boolean = true, keys2Check: Option[Seq[String]] = None
diff --git a/pom.xml b/pom.xml
index 86c7009..44a6c20 100644
--- a/pom.xml
+++ b/pom.xml
@@ -120,6 +120,7 @@
         <maven.source.plugin.ver>3.0.1</maven.source.plugin.ver>
         <maven.gpg.plugin.ver>1.6</maven.gpg.plugin.ver>
         <maven.bazaarvoice.plugin.ver>0.9</maven.bazaarvoice.plugin.ver>
+        <maven.read.project.properties.plugin.ver>1.0.0</maven.read.project.properties.plugin.ver>
         <apache.rat.plugin.ver>0.13</apache.rat.plugin.ver>
         <org.antlr4.ver>4.8</org.antlr4.ver>
         <akka.http.2.12.ver>10.2.0</akka.http.2.12.ver>