You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@struts.apache.org by ya...@apache.org on 2018/11/18 12:58:36 UTC

[struts] branch struts-2-5-x updated (24e1511 -> fe630db)

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

yasserzamani pushed a change to branch struts-2-5-x
in repository https://gitbox.apache.org/repos/asf/struts.git.


    from 24e1511  Merge pull request #271 from JCgH4164838Gh792C124B5/localS2_2_5_x_Branch
     new d7a7c90  [WW-4977] Fixing flaky test in Jsr168DispatcherTest and Jsr286DispatcherTest.
     new 8ab1022  WW-4866 Includes 1.8+ JDKs
     new b75c0ba  WW-4866 Includes 9+ JDKs
     new fe630db  Refactor environment dependant tests

The 4 revisions listed above as "new" are entirely new to this
repository and will be described in separate emails.  The revisions
listed as "add" were already present in the repository and have only
been added to this reference.


Summary of changes:
 .../config/providers/EnvsValueSubstitutorTest.java | 76 ++++++++--------------
 ...lConfigurationProviderEnvsSubstitutionTest.java | 36 +++-------
 .../portlet/dispatcher/Jsr168DispatcherTest.java   |  1 +
 .../portlet/dispatcher/Jsr286DispatcherTest.java   |  1 +
 pom.xml                                            |  4 +-
 5 files changed, 42 insertions(+), 76 deletions(-)


[struts] 01/04: [WW-4977] Fixing flaky test in Jsr168DispatcherTest and Jsr286DispatcherTest.

Posted by ya...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

yasserzamani pushed a commit to branch struts-2-5-x
in repository https://gitbox.apache.org/repos/asf/struts.git

commit d7a7c909ea26aa657b969de08d68ba046468df11
Author: ORDTesters <or...@gmail.com>
AuthorDate: Mon Nov 12 07:18:42 2018 +0330

    [WW-4977] Fixing flaky test in Jsr168DispatcherTest and Jsr286DispatcherTest.
    
    (cherry picked from commit 2d4e26f)
---
 .../java/org/apache/struts2/portlet/dispatcher/Jsr168DispatcherTest.java | 1 +
 .../java/org/apache/struts2/portlet/dispatcher/Jsr286DispatcherTest.java | 1 +
 2 files changed, 2 insertions(+)

diff --git a/plugins/portlet/src/test/java/org/apache/struts2/portlet/dispatcher/Jsr168DispatcherTest.java b/plugins/portlet/src/test/java/org/apache/struts2/portlet/dispatcher/Jsr168DispatcherTest.java
index ef0c5c0..be2ea35 100644
--- a/plugins/portlet/src/test/java/org/apache/struts2/portlet/dispatcher/Jsr168DispatcherTest.java
+++ b/plugins/portlet/src/test/java/org/apache/struts2/portlet/dispatcher/Jsr168DispatcherTest.java
@@ -261,6 +261,7 @@ public class Jsr168DispatcherTest extends MockObjectTestCase {
         Map<String, String> initParams = new HashMap<String, String>();
         initParams.put("viewNamespace", "/view");
         initParams.put("editNamespace", "/edit");
+        initParams.put(StrutsConstants.STRUTS_ALWAYS_SELECT_FULL_NAMESPACE, "true");
 
         initPortletConfig(initParams, new HashMap<String, Object>());
         initRequest(requestParams, new HashMap<String, Object>(), sessionMap, mode, WindowState.NORMAL, false, null);
diff --git a/plugins/portlet/src/test/java/org/apache/struts2/portlet/dispatcher/Jsr286DispatcherTest.java b/plugins/portlet/src/test/java/org/apache/struts2/portlet/dispatcher/Jsr286DispatcherTest.java
index 6d8ff4b..c5f4346 100644
--- a/plugins/portlet/src/test/java/org/apache/struts2/portlet/dispatcher/Jsr286DispatcherTest.java
+++ b/plugins/portlet/src/test/java/org/apache/struts2/portlet/dispatcher/Jsr286DispatcherTest.java
@@ -142,6 +142,7 @@ public class Jsr286DispatcherTest extends MockObjectTestCase {
 		Map<String, String> initParams = new HashMap<String, String>();
 		initParams.put("viewNamespace", "/view");
 		initParams.put("editNamespace", "/edit");
+		initParams.put(StrutsConstants.STRUTS_ALWAYS_SELECT_FULL_NAMESPACE, "true");
 
 		initPortletConfig(initParams, new HashMap<String, Object>());
 		initRequest(requestParams, new HashMap<String, Object>(), sessionMap,


[struts] 04/04: Refactor environment dependant tests

Posted by ya...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

yasserzamani pushed a commit to branch struts-2-5-x
in repository https://gitbox.apache.org/repos/asf/struts.git

commit fe630db5f299ba4037be29e3ce12e933d7042b2f
Author: Sebastian Peters <se...@gmail.com>
AuthorDate: Sun Nov 18 00:50:48 2018 +0330

    Refactor environment dependant tests
    
    * use org.apache.commons.lang3.SystemUtils for env detection
    * use assertThat for more concise assertions
    * move setup code to setUp
    * some formatting
    
    (cherry picked from commit 8d341df)
---
 .../config/providers/EnvsValueSubstitutorTest.java | 76 ++++++++--------------
 ...lConfigurationProviderEnvsSubstitutionTest.java | 36 +++-------
 2 files changed, 38 insertions(+), 74 deletions(-)

diff --git a/core/src/test/java/com/opensymphony/xwork2/config/providers/EnvsValueSubstitutorTest.java b/core/src/test/java/com/opensymphony/xwork2/config/providers/EnvsValueSubstitutorTest.java
index 4c2ab15..a360c63 100644
--- a/core/src/test/java/com/opensymphony/xwork2/config/providers/EnvsValueSubstitutorTest.java
+++ b/core/src/test/java/com/opensymphony/xwork2/config/providers/EnvsValueSubstitutorTest.java
@@ -18,70 +18,50 @@
  */
 package com.opensymphony.xwork2.config.providers;
 
+import static org.hamcrest.core.Is.is;
+import static org.junit.Assert.assertThat;
+
+import org.apache.commons.lang3.SystemUtils;
 import org.apache.struts2.StrutsInternalTestCase;
 
 public class EnvsValueSubstitutorTest extends StrutsInternalTestCase {
 
-    private boolean osIsWindows = false;  // Assume Linux/Unix environment by default
+    private ValueSubstitutor substitutor;
 
     @Override
     protected void setUp() throws Exception {
         super.setUp();
-
-        final String os = System.getProperty("os.name");
-        if (os != null && os.startsWith("Windows")) {
-            osIsWindows = true;   // Determined that the OS is Windows (must use different environment variables)
-        }
-        else {
-            osIsWindows = false;  // Assume Linux/Unix environment by default
-        }
+        substitutor = new EnvsValueSubstitutor();
     }
 
-    public void testSimpleValue() throws Exception {
-
-        String expected;
-        String actual;
-        final ValueSubstitutor substitutor = new EnvsValueSubstitutor();
-
-        if (osIsWindows) {
-            // given
-            expected = System.getenv("USERNAME");
-
-            // when
-            actual = substitutor.substitute("${env.USERNAME}");
+    public void testEnvSimpleValue() {
+        if (SystemUtils.IS_OS_WINDOWS) {
+            assertThat(substitutor.substitute("${env.USERNAME}"), is(System.getenv("USERNAME")));
+        } else {
+            assertThat(substitutor.substitute("${env.USER}"), is(System.getenv("USER")));
         }
-        else {
-            // given
-            expected = System.getenv("USER");
-
-            // when
-            actual = substitutor.substitute("${env.USER}");
-        }
-
-        // then
-        assertEquals(expected, actual);
     }
 
-    public void testDefaultValue() throws Exception {
-        // given
-        String expected = "defaultValue";
-        ValueSubstitutor substitutor = new EnvsValueSubstitutor();
+    public void testEnvSimpleDefaultValue() {
+        final String defaultValue = "defaultValue";
+        assertThat(substitutor.substitute("${env.UNKNOWN:" + defaultValue + "}"), is(defaultValue));
+    }
 
-        // when
-        String actual = substitutor.substitute("${env.UNKNOWN:" + expected + "}");
+    public void testSystemSimpleValue() {
+        final String key = "sysPropKey";
+        final String value = "sysPropValue";
+        System.setProperty(key, value);
 
-        // then
-        assertEquals(expected, actual);
+        assertThat(substitutor.substitute("${" + key + "}"), is(value));
     }
 
-    public void testNoSubstitution() throws Exception {
-        // given
-        ValueSubstitutor substitutor = new EnvsValueSubstitutor();
-
-        // when
-        String actual = substitutor.substitute("val1");
+    public void testSystemSimpleDefaultValue() {
+        final String defaultValue = "defaultValue";
+        assertThat(substitutor.substitute("${UNKNOWN:" + defaultValue + "}"), is(defaultValue));
+    }
 
-        // then
-        assertEquals("val1", actual);
+    public void testNoSubstitution() {
+        final String value = "val1";
+        assertThat(substitutor.substitute(value), is(value));
     }
-}
\ No newline at end of file
+}
diff --git a/core/src/test/java/com/opensymphony/xwork2/config/providers/XmlConfigurationProviderEnvsSubstitutionTest.java b/core/src/test/java/com/opensymphony/xwork2/config/providers/XmlConfigurationProviderEnvsSubstitutionTest.java
index eb76000..7fb20f0 100644
--- a/core/src/test/java/com/opensymphony/xwork2/config/providers/XmlConfigurationProviderEnvsSubstitutionTest.java
+++ b/core/src/test/java/com/opensymphony/xwork2/config/providers/XmlConfigurationProviderEnvsSubstitutionTest.java
@@ -18,55 +18,39 @@
  */
 package com.opensymphony.xwork2.config.providers;
 
-import com.opensymphony.xwork2.config.ConfigurationException;
-import com.opensymphony.xwork2.config.ConfigurationProvider;
+import org.apache.commons.lang3.SystemUtils;
 import org.apache.struts2.StrutsConstants;
 
 public class XmlConfigurationProviderEnvsSubstitutionTest extends ConfigurationTestBase {
 
-    private boolean osIsWindows = false;  // Assume Linux/Unix environment by default
-
     @Override
     protected void setUp() throws Exception {
         super.setUp();
 
-        final String os = System.getProperty("os.name");
-        if (os != null && os.startsWith("Windows")) {
-            osIsWindows = true;   // Determined that the OS is Windows (must use different environment variables)
-        }
-        else {
-            osIsWindows = false;  // Assume Linux/Unix environment by default
-        }
-    }
-
-    public void testSubstitution() throws ConfigurationException {
-        final String filename = "com/opensymphony/xwork2/config/providers/xwork-test-envs-substitution.xml";
-        ConfigurationProvider provider = buildConfigurationProvider(filename);
-
-        configurationManager.addContainerProvider(provider);
+        configurationManager.addContainerProvider(buildConfigurationProvider(
+                "com/opensymphony/xwork2/config/providers/xwork-test-envs-substitution.xml"));
         configurationManager.reload();
         configuration = configurationManager.getConfiguration();
         container = configuration.getContainer();
+    }
 
-        String foo = container.getInstance(String.class, "foo");
-        assertEquals("bar", foo);
+    public void testSubstitution() {
+        assertEquals("bar", container.getInstance(String.class, "foo"));
 
         String user;
-        if (osIsWindows) {
+        if (SystemUtils.IS_OS_WINDOWS) {
             user = container.getInstance(String.class, "username");
             assertEquals(System.getenv("USERNAME"), user);
-        }
-        else {
+        } else {
             user = container.getInstance(String.class, "user");
             assertEquals(System.getenv("USER"), user);
         }
 
         String home;
-        if (osIsWindows) {
+        if (SystemUtils.IS_OS_WINDOWS) {
             home = container.getInstance(String.class, "homedrive.homepath");
             assertEquals("Current HOMEDRIVE.HOMEPATH = " + System.getenv("HOMEDRIVE") + System.getenv("HOMEPATH"), home);
-        }
-        else {
+        } else {
             home = container.getInstance(String.class, "home");
             assertEquals("Current HOME = " + System.getenv("HOME"), home);
         }


[struts] 02/04: WW-4866 Includes 1.8+ JDKs

Posted by ya...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

yasserzamani pushed a commit to branch struts-2-5-x
in repository https://gitbox.apache.org/repos/asf/struts.git

commit 8ab102209f590e04091554d61a63dfd956c68643
Author: Lukasz Lenart <lu...@apache.org>
AuthorDate: Sun Nov 11 12:26:12 2018 +0330

    WW-4866 Includes 1.8+ JDKs
    
    (cherry picked from commit 2d86cc6)
---
 pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pom.xml b/pom.xml
index abef807..d20dfd6 100644
--- a/pom.xml
+++ b/pom.xml
@@ -146,7 +146,7 @@
         <profile>
             <id>jdk8</id>
             <activation>
-                <jdk>1.8</jdk>
+                <jdk>[1.8,)</jdk>
             </activation>
             <build>
                 <pluginManagement>


[struts] 03/04: WW-4866 Includes 9+ JDKs

Posted by ya...@apache.org.
This is an automated email from the ASF dual-hosted git repository.

yasserzamani pushed a commit to branch struts-2-5-x
in repository https://gitbox.apache.org/repos/asf/struts.git

commit b75c0ba5e1f69d60ef2f57583d078ce72e6b2f66
Author: Lukasz Lenart <lu...@apache.org>
AuthorDate: Sun Nov 11 16:12:07 2018 +0330

    WW-4866 Includes 9+ JDKs
    
    (cherry picked from commit af3ee07)
---
 pom.xml | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/pom.xml b/pom.xml
index d20dfd6..f7b12bd 100644
--- a/pom.xml
+++ b/pom.xml
@@ -165,7 +165,7 @@
         <profile>
             <id>jdk9</id>
             <activation>
-                <jdk>9</jdk>
+                <jdk>[9,)</jdk>
             </activation>
             <properties>
                 <!-- coverall version 4.3.0 does not work with java 9, see https://github.com/trautonen/coveralls-maven-plugin/issues/112 -->