This is an automated email from the ASF dual-hosted git repository.
jleroux pushed a commit to branch trunk
in repository https://gitbox.apache.org/repos/asf/ofbiz-framework.git
The following commit(s) were added to refs/heads/trunk by this push:
new 0ebb819 Fixed: webapp position does not really work (OFBIZ-12176)
0ebb819 is described below
commit 0ebb8192474713b3d8dcb8704d2e179559942733
Author: Jacques Le Roux <[email protected]>
AuthorDate: Mon Feb 15 10:21:59 2021 +0100
Fixed: webapp position does not really work (OFBIZ-12176)
Fixes the tests:
Checks that when the same position is provided by the `WebappInfo` instance
only one is retrieved
Checks that when the same title with no position is provided by the
`WebappInfo`
instance 2 instances are retrieved. though they use the same title only
position
allows "collision"
---
.../org/apache/ofbiz/webapp/WebAppCacheTest.java | 26 +++++++++++++++++-----
1 file changed, 20 insertions(+), 6 deletions(-)
diff --git
a/framework/webapp/src/test/java/org/apache/ofbiz/webapp/WebAppCacheTest.java
b/framework/webapp/src/test/java/org/apache/ofbiz/webapp/WebAppCacheTest.java
index 3961e3e..522b008 100644
---
a/framework/webapp/src/test/java/org/apache/ofbiz/webapp/WebAppCacheTest.java
+++
b/framework/webapp/src/test/java/org/apache/ofbiz/webapp/WebAppCacheTest.java
@@ -18,12 +18,12 @@
*/
package org.apache.ofbiz.webapp;
+import static org.hamcrest.MatcherAssert.assertThat;
import static org.hamcrest.Matchers.contains;
import static org.hamcrest.Matchers.containsInAnyOrder;
import static org.hamcrest.Matchers.empty;
import static org.hamcrest.Matchers.is;
import static org.junit.Assert.assertFalse;
-import static org.hamcrest.MatcherAssert.assertThat;
import java.util.ArrayList;
@@ -92,13 +92,13 @@ public class WebAppCacheTest {
assertThat(wac.getAppBarWebInfos("foo"), is(empty()));
}
- // Checks that when a position is provided by the `WebappInfo` instance
- // it is used instead of its title.
+ // Checks that when the same position is provided by the `WebappInfo`
instance
+ // only one is retrieved
@Test
- public void getAppBarWebInfosSameTitle() {
- WebappInfo wInfo0 = new
WebappInfo.Builder().server("foo").title("foo").create();
+ public void getAppBarWebInfosSamePosition() {
+ WebappInfo wInfo0 = new
WebappInfo.Builder().server("foo").title("foo").position("1").create();
wInfos.add(wInfo0);
- WebappInfo wInfo1 = new
WebappInfo.Builder().server("foo").title("foo").create();
+ WebappInfo wInfo1 = new
WebappInfo.Builder().server("foo").title("foo").position("1").create();
wInfos.add(wInfo1);
// Ensure that there is a collision between `wInfo0` and `wInfo1`
@@ -106,6 +106,20 @@ public class WebAppCacheTest {
assertThat(wac.getAppBarWebInfos("foo").size(), is(1));
}
+ // Checks that when the same title with no position is provided by the
`WebappInfo` instance
+ // 2 instances are retrieved
+ @Test
+ public void getAppBarWebInfosSameTitle() {
+ WebappInfo wInfo0 = new
WebappInfo.Builder().server("foo").title("foo").create();
+ wInfos.add(wInfo0);
+ WebappInfo wInfo1 = new
WebappInfo.Builder().server("foo").title("foo").create();
+ wInfos.add(wInfo1);
+
+ // Ensure that there is no collision between `wInfo0` and `wInfo1`
+ // though they use the same title only position allows collision
+ assertThat(wac.getAppBarWebInfos("foo").size(), is(2));
+ }
+
// Checks that when a position is provided by the `WebappInfo` instance
// it is used instead of its title.
@Test