[OpenbravoERP-commits] devel/pi: related to issue 41033: change assertion

2019-06-06 Thread hg
details:   https://code.openbravo.com/erp/devel/pi/rev/4239ab3ce79e
changeset: 36018:4239ab3ce79e
user:  Carlos Aristu  openbravo.com>
date:  Thu Jun 06 13:22:12 2019 +0200
summary:   related to issue 41033: change assertion

  The test compilation was still failing in CI, changing the assertion to avoid 
the problem

diffstat:

 
modules/org.openbravo.base.weld/src-test/org/openbravo/base/weld/test/testinfrastructure/CdiInfrastructure.java
 |  8 +---
 1 files changed, 5 insertions(+), 3 deletions(-)

diffs (24 lines):

diff -r 06711d4d7d57 -r 4239ab3ce79e 
modules/org.openbravo.base.weld/src-test/org/openbravo/base/weld/test/testinfrastructure/CdiInfrastructure.java
--- 
a/modules/org.openbravo.base.weld/src-test/org/openbravo/base/weld/test/testinfrastructure/CdiInfrastructure.java
   Thu Jun 06 12:41:37 2019 +0200
+++ 
b/modules/org.openbravo.base.weld/src-test/org/openbravo/base/weld/test/testinfrastructure/CdiInfrastructure.java
   Thu Jun 06 13:22:12 2019 +0200
@@ -24,7 +24,6 @@
 import static org.hamcrest.CoreMatchers.notNullValue;
 import static org.hamcrest.CoreMatchers.nullValue;
 import static org.hamcrest.Matchers.hasItem;
-import static org.hamcrest.Matchers.hasSize;
 import static org.junit.Assert.assertThat;
 
 import java.util.List;
@@ -110,7 +109,10 @@
 
 List names = 
beans.map(ExtensionBean::getName).collect(Collectors.toList());
 
-assertThat("Retrieved the expected beans", names, 
allOf(hasSize(numberOfExtensionBeans),
-hasItem("qualifiedBean"), hasItem("unqualifiedBean")));
+assertThat("Retrieved the expected number of beans", names.size(),
+equalTo(numberOfExtensionBeans));
+
+assertThat("Retrieved the expected beans", names,
+allOf(hasItem("qualifiedBean"), hasItem("unqualifiedBean")));
   }
 }


___
Openbravo-commits mailing list
Openbravo-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbravo-commits


[OpenbravoERP-commits] devel/pi: related to issue 41033: use CoreMatchers.allOf instead...

2019-06-06 Thread hg
details:   https://code.openbravo.com/erp/devel/pi/rev/06711d4d7d57
changeset: 36017:06711d4d7d57
user:  Carlos Aristu  openbravo.com>
date:  Thu Jun 06 12:41:37 2019 +0200
summary:   related to issue 41033: use CoreMatchers.allOf instead of 
Matchers.allOf

  Test was not compiling in JDK10+ due to some problem related with generics 
and "Matchers.allOf". Using "CoreMatchers.allOf" instead.

diffstat:

 
modules/org.openbravo.base.weld/src-test/org/openbravo/base/weld/test/testinfrastructure/CdiInfrastructure.java
 |  2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diffs (15 lines):

diff -r 41c47dd2afae -r 06711d4d7d57 
modules/org.openbravo.base.weld/src-test/org/openbravo/base/weld/test/testinfrastructure/CdiInfrastructure.java
--- 
a/modules/org.openbravo.base.weld/src-test/org/openbravo/base/weld/test/testinfrastructure/CdiInfrastructure.java
   Thu Jun 06 11:42:41 2019 +0200
+++ 
b/modules/org.openbravo.base.weld/src-test/org/openbravo/base/weld/test/testinfrastructure/CdiInfrastructure.java
   Thu Jun 06 12:41:37 2019 +0200
@@ -19,10 +19,10 @@
 
 package org.openbravo.base.weld.test.testinfrastructure;
 
+import static org.hamcrest.CoreMatchers.allOf;
 import static org.hamcrest.CoreMatchers.equalTo;
 import static org.hamcrest.CoreMatchers.notNullValue;
 import static org.hamcrest.CoreMatchers.nullValue;
-import static org.hamcrest.Matchers.allOf;
 import static org.hamcrest.Matchers.hasItem;
 import static org.hamcrest.Matchers.hasSize;
 import static org.junit.Assert.assertThat;


___
Openbravo-commits mailing list
Openbravo-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbravo-commits


[OpenbravoERP-commits] devel/pi: related to issue 41033: change assertion to fix error ...

2019-06-06 Thread hg
details:   https://code.openbravo.com/erp/devel/pi/rev/41c47dd2afae
changeset: 36016:41c47dd2afae
user:  Carlos Aristu  openbravo.com>
date:  Thu Jun 06 11:42:41 2019 +0200
summary:   related to issue 41033: change assertion to fix error in CI

diffstat:

 
modules/org.openbravo.base.weld/src-test/org/openbravo/base/weld/test/testinfrastructure/CdiInfrastructure.java
 |  7 +++
 1 files changed, 3 insertions(+), 4 deletions(-)

diffs (27 lines):

diff -r e7f7f338f322 -r 41c47dd2afae 
modules/org.openbravo.base.weld/src-test/org/openbravo/base/weld/test/testinfrastructure/CdiInfrastructure.java
--- 
a/modules/org.openbravo.base.weld/src-test/org/openbravo/base/weld/test/testinfrastructure/CdiInfrastructure.java
   Thu Jun 06 11:24:08 2019 +0200
+++ 
b/modules/org.openbravo.base.weld/src-test/org/openbravo/base/weld/test/testinfrastructure/CdiInfrastructure.java
   Thu Jun 06 11:42:41 2019 +0200
@@ -23,8 +23,8 @@
 import static org.hamcrest.CoreMatchers.notNullValue;
 import static org.hamcrest.CoreMatchers.nullValue;
 import static org.hamcrest.Matchers.allOf;
+import static org.hamcrest.Matchers.hasItem;
 import static org.hamcrest.Matchers.hasSize;
-import static 
org.hamcrest.collection.IsIterableContainingInAnyOrder.containsInAnyOrder;
 import static org.junit.Assert.assertThat;
 
 import java.util.List;
@@ -107,11 +107,10 @@
 
   private void assertExtensionBeansInjection(Stream beans) {
 int numberOfExtensionBeans = 2;
-String[] expectedNames = { "qualifiedBean", "unqualifiedBean" };
 
 List names = 
beans.map(ExtensionBean::getName).collect(Collectors.toList());
 
-assertThat("Retrieved the expected beans", names,
-allOf(hasSize(numberOfExtensionBeans), 
containsInAnyOrder(expectedNames)));
+assertThat("Retrieved the expected beans", names, 
allOf(hasSize(numberOfExtensionBeans),
+hasItem("qualifiedBean"), hasItem("unqualifiedBean")));
   }
 }


___
Openbravo-commits mailing list
Openbravo-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbravo-commits


[OpenbravoERP-commits] devel/pi: related to issue 41033: avoid API change

2019-06-06 Thread hg
details:   https://code.openbravo.com/erp/devel/pi/rev/e7f7f338f322
changeset: 36015:e7f7f338f322
user:  Carlos Aristu  openbravo.com>
date:  Thu Jun 06 11:24:08 2019 +0200
summary:   related to issue 41033: avoid API change

diffstat:

 modules/org.openbravo.base.weld/src/org/openbravo/base/weld/WeldUtils.java |  
9 ++---
 1 files changed, 6 insertions(+), 3 deletions(-)

diffs (47 lines):

diff -r 2db86bead3d4 -r e7f7f338f322 
modules/org.openbravo.base.weld/src/org/openbravo/base/weld/WeldUtils.java
--- 
a/modules/org.openbravo.base.weld/src/org/openbravo/base/weld/WeldUtils.java
Thu Jun 06 11:03:21 2019 +0200
+++ 
b/modules/org.openbravo.base.weld/src/org/openbravo/base/weld/WeldUtils.java
Thu Jun 06 11:24:08 2019 +0200
@@ -26,6 +26,7 @@
 import javax.enterprise.inject.Any;
 import javax.enterprise.inject.spi.Bean;
 import javax.enterprise.inject.spi.BeanManager;
+import javax.enterprise.util.AnnotationLiteral;
 import javax.inject.Inject;
 import javax.naming.InitialContext;
 import javax.naming.NamingException;
@@ -74,6 +75,8 @@
 staticBeanManager = theBeanManager;
   }
 
+  public static final AnnotationLiteral ANY_LITERAL = 
Any.Literal.INSTANCE;
+
   /**
* Method which uses the static instance of the bean manager cached in this 
class. This method
* should only be used by objects which are not created by Weld. Objects 
created by Weld should
@@ -84,7 +87,7 @@
   @SuppressWarnings("unchecked")
   public static  T getInstanceFromStaticBeanManager(Class type) {
 final BeanManager theBeanManager = getStaticInstanceBeanManager();
-final Set> beans = theBeanManager.getBeans(type, 
Any.Literal.INSTANCE);
+final Set> beans = theBeanManager.getBeans(type, ANY_LITERAL);
 for (Bean bean : beans) {
   if (bean.getBeanClass() == type) {
 return (T) theBeanManager.getReference(bean, type,
@@ -109,7 +112,7 @@
*/
   @SuppressWarnings("unchecked")
   public  T getInstance(Class type) {
-final Set> beans = beanManager.getBeans(type, 
Any.Literal.INSTANCE);
+final Set> beans = beanManager.getBeans(type, ANY_LITERAL);
 for (Bean bean : beans) {
   if (bean.getBeanClass() == type) {
 return (T) beanManager.getReference(bean, type, 
beanManager.createCreationalContext(bean));
@@ -124,7 +127,7 @@
   @SuppressWarnings("unchecked")
   public static  List getInstances(Class type) {
 final BeanManager beanManager = WeldUtils.getStaticInstanceBeanManager();
-final Set> beans = beanManager.getBeans(type, 
Any.Literal.INSTANCE);
+final Set> beans = beanManager.getBeans(type, ANY_LITERAL);
 
 final List instances = new ArrayList<>();
 for (Bean bean : beans) {


___
Openbravo-commits mailing list
Openbravo-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbravo-commits


[OpenbravoERP-commits] devel/pi: related to issue 41033: fix javadoc wrong text

2019-06-06 Thread hg
details:   https://code.openbravo.com/erp/devel/pi/rev/2db86bead3d4
changeset: 36014:2db86bead3d4
user:  Carlos Aristu  openbravo.com>
date:  Thu Jun 06 11:03:21 2019 +0200
summary:   related to issue 41033: fix javadoc wrong text

diffstat:

 
modules/org.openbravo.base.weld/src-test/org/openbravo/base/weld/test/testinfrastructure/UnqualifiedBean.java
 |  2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diffs (12 lines):

diff -r 6061bd189bd1 -r 2db86bead3d4 
modules/org.openbravo.base.weld/src-test/org/openbravo/base/weld/test/testinfrastructure/UnqualifiedBean.java
--- 
a/modules/org.openbravo.base.weld/src-test/org/openbravo/base/weld/test/testinfrastructure/UnqualifiedBean.java
 Thu Jun 06 11:01:58 2019 +0200
+++ 
b/modules/org.openbravo.base.weld/src-test/org/openbravo/base/weld/test/testinfrastructure/UnqualifiedBean.java
 Thu Jun 06 11:03:21 2019 +0200
@@ -19,7 +19,7 @@
 
 package org.openbravo.base.weld.test.testinfrastructure;
 
-/** Simple qualified bean without a qualifier */
+/** Simple bean without a qualifier */
 public class UnqualifiedBean extends ExtensionBean {
 
   @Override


___
Openbravo-commits mailing list
Openbravo-commits@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/openbravo-commits


[OpenbravoERP-commits] devel/pi: related to issue 41033: add missing test classes

2019-06-06 Thread hg
details:   https://code.openbravo.com/erp/devel/pi/rev/6061bd189bd1
changeset: 36013:6061bd189bd1
user:  Carlos Aristu  openbravo.com>
date:  Thu Jun 06 11:01:58 2019 +0200
summary:   related to issue 41033: add missing test classes

diffstat:

 
modules/org.openbravo.base.weld/src-test/org/openbravo/base/weld/test/testinfrastructure/ExtensionBean.java
   |  27 
 
modules/org.openbravo.base.weld/src-test/org/openbravo/base/weld/test/testinfrastructure/QualifiedBean.java
   |  33 ++
 
modules/org.openbravo.base.weld/src-test/org/openbravo/base/weld/test/testinfrastructure/UnqualifiedBean.java
 |  30 +
 3 files changed, 90 insertions(+), 0 deletions(-)

diffs (102 lines):

diff -r 7148f9e42956 -r 6061bd189bd1 
modules/org.openbravo.base.weld/src-test/org/openbravo/base/weld/test/testinfrastructure/ExtensionBean.java
--- /dev/null   Thu Jan 01 00:00:00 1970 +
+++ 
b/modules/org.openbravo.base.weld/src-test/org/openbravo/base/weld/test/testinfrastructure/ExtensionBean.java
   Thu Jun 06 11:01:58 2019 +0200
@@ -0,0 +1,27 @@
+/*
+ *
+ * The contents of this file are subject to the Openbravo  Public  License
+ * Version  1.1  (the  "License"),  being   the  Mozilla   Public  License
+ * Version 1.1  with a permitted attribution clause; you may not  use this
+ * file except in compliance with the License. You  may  obtain  a copy of
+ * the License at http://www.openbravo.com/legal/license.html 
+ * Software distributed under the License  is  distributed  on  an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ * License for the specific  language  governing  rights  and  limitations
+ * under the License.
+ * The Original Code is Openbravo ERP.
+ * The Initial Developer of the Original Code is Openbravo SLU
+ * All portions are Copyright (C) 2019 Openbravo SLU
+ * All Rights Reserved.
+ * Contributor(s):  __.
+ 
+ */
+
+package org.openbravo.base.weld.test.testinfrastructure;
+
+/** Simple abstract bean */
+public abstract class ExtensionBean {
+
+  public abstract String getName();
+
+}
diff -r 7148f9e42956 -r 6061bd189bd1 
modules/org.openbravo.base.weld/src-test/org/openbravo/base/weld/test/testinfrastructure/QualifiedBean.java
--- /dev/null   Thu Jan 01 00:00:00 1970 +
+++ 
b/modules/org.openbravo.base.weld/src-test/org/openbravo/base/weld/test/testinfrastructure/QualifiedBean.java
   Thu Jun 06 11:01:58 2019 +0200
@@ -0,0 +1,33 @@
+/*
+ *
+ * The contents of this file are subject to the Openbravo  Public  License
+ * Version  1.1  (the  "License"),  being   the  Mozilla   Public  License
+ * Version 1.1  with a permitted attribution clause; you may not  use this
+ * file except in compliance with the License. You  may  obtain  a copy of
+ * the License at http://www.openbravo.com/legal/license.html 
+ * Software distributed under the License  is  distributed  on  an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ * License for the specific  language  governing  rights  and  limitations
+ * under the License.
+ * The Original Code is Openbravo ERP.
+ * The Initial Developer of the Original Code is Openbravo SLU
+ * All portions are Copyright (C) 2019 Openbravo SLU
+ * All Rights Reserved.
+ * Contributor(s):  __.
+ 
+ */
+
+package org.openbravo.base.weld.test.testinfrastructure;
+
+import org.openbravo.client.kernel.ComponentProvider.Qualifier;
+
+/** Simple qualified bean */
+@Qualifier("")
+public class QualifiedBean extends ExtensionBean {
+
+  @Override
+  public String getName() {
+return "qualifiedBean";
+  }
+
+}
diff -r 7148f9e42956 -r 6061bd189bd1 
modules/org.openbravo.base.weld/src-test/org/openbravo/base/weld/test/testinfrastructure/UnqualifiedBean.java
--- /dev/null   Thu Jan 01 00:00:00 1970 +
+++ 
b/modules/org.openbravo.base.weld/src-test/org/openbravo/base/weld/test/testinfrastructure/UnqualifiedBean.java
 Thu Jun 06 11:01:58 2019 +0200
@@ -0,0 +1,30 @@
+/*
+ *
+ * The contents of this file are subject to the Openbravo  Public  License
+ * Version  1.1  (the  "License"),  being   the  Mozilla   Public  License
+ * Version 1.1  with a permitted attribution clause; you may not  use this
+ * file except in compliance with the License. You  may  obtain  a copy of
+ * the License at http://www.openbravo.com/legal/license.html 
+ * Software distributed under the License  is  distributed  on  an "AS IS"
+ * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
+ * License for the specific  language  governing  rights  and  

[OpenbravoERP-commits] devel/pi: 3 new changesets

2019-06-06 Thread hg
details:   https://code.openbravo.com/erp/devel/pi/rev/aebfddd2027d
changeset: 36010:aebfddd2027d
user:  Carlos Aristu  openbravo.com>
date:  Thu Jun 06 10:34:38 2019 +0200
summary:   fixes bug 41033: ImportEntryPreProcessors with qualifiers are not 
executed

  As part of the refactor to provide the ImportEntryBuilder[1], the injection 
of the import entry preprocessors was changed. As the instances of that class 
are created outside of the Weld scope, the preprocessors are injected using 
"WeldUtils.getInstances()" method instead of using @Inject.

  The problem here is that "WeldUtils.getInstances()" looked for all beans of 
an specific type that does not have a qualifier. For this reason, import entry 
preprocessors with qualifiers were not being found and, therefore, not executed 
by the ImportEntryBuilder before creating the import entry.

  To fix this problem now "WeldUtils.getInstances()" has been changed in order 
to look for any bean of a particular type (regardless of whether it is 
qualified or not). This is done by specifying the @Any qualifier to the 
"BeanManager.getBeans()" method.

  Thus, now WeldUtils.getInstances() behaves exactly in the same way as when 
using @Inject together with @Any when we are inside the scope of Weld.

 [1] 
https://code.openbravo.com/erp/devel/pi/rev/90c48060859cc70935add00e77e8065dedb197cc

details:   https://code.openbravo.com/erp/devel/pi/rev/3f43ae2410c8
changeset: 36011:3f43ae2410c8
user:  Carlos Aristu  openbravo.com>
date:  Thu Jun 06 10:58:49 2019 +0200
summary:   related to issue 41033: code improvements

  - Use Any AnnotationLiteral (available since CDI 2.0)
  - Use diamond operator
  - Remove unused injection of ImportEntryPreProcessor in the 
ImportEntryManager (they are used in the ImportEntryBuilder)

details:   https://code.openbravo.com/erp/devel/pi/rev/7148f9e42956
changeset: 36012:7148f9e42956
user:  Carlos Aristu  openbravo.com>
date:  Thu Jun 06 10:59:01 2019 +0200
summary:   related to issue 41033: add test cases

diffstat:

 
modules/org.openbravo.base.weld/src-test/org/openbravo/base/weld/test/testinfrastructure/CdiInfrastructure.java
 |  39 +-
 modules/org.openbravo.base.weld/src/org/openbravo/base/weld/WeldUtils.java 
 |  15 +--
 src/org/openbravo/service/importprocess/ImportEntryManager.java
 |   4 -
 3 files changed, 43 insertions(+), 15 deletions(-)

diffs (155 lines):

diff -r f395c484a710 -r 7148f9e42956 
modules/org.openbravo.base.weld/src-test/org/openbravo/base/weld/test/testinfrastructure/CdiInfrastructure.java
--- 
a/modules/org.openbravo.base.weld/src-test/org/openbravo/base/weld/test/testinfrastructure/CdiInfrastructure.java
   Wed Jun 05 23:51:37 2019 +
+++ 
b/modules/org.openbravo.base.weld/src-test/org/openbravo/base/weld/test/testinfrastructure/CdiInfrastructure.java
   Thu Jun 06 10:59:01 2019 +0200
@@ -11,7 +11,7 @@
  * under the License.
  * The Original Code is Openbravo ERP.
  * The Initial Developer of the Original Code is Openbravo SLU
- * All portions are Copyright (C) 2015 Openbravo SLU
+ * All portions are Copyright (C) 2015-2019 Openbravo SLU
  * All Rights Reserved.
  * Contributor(s):  __.
  
@@ -22,12 +22,22 @@
 import static org.hamcrest.CoreMatchers.equalTo;
 import static org.hamcrest.CoreMatchers.notNullValue;
 import static org.hamcrest.CoreMatchers.nullValue;
+import static org.hamcrest.Matchers.allOf;
+import static org.hamcrest.Matchers.hasSize;
+import static 
org.hamcrest.collection.IsIterableContainingInAnyOrder.containsInAnyOrder;
 import static org.junit.Assert.assertThat;
 
+import java.util.List;
+import java.util.stream.Collectors;
+import java.util.stream.Stream;
+
+import javax.enterprise.inject.Any;
+import javax.enterprise.inject.Instance;
 import javax.inject.Inject;
 
 import org.jboss.arquillian.junit.InSequence;
 import org.junit.Test;
+import org.openbravo.base.weld.WeldUtils;
 import org.openbravo.base.weld.test.WeldBaseTest;
 
 /**
@@ -48,12 +58,17 @@
   @Inject
   private RequestScopedBean requestBean;
 
+  @Inject
+  @Any
+  private Instance extensionBeans;
+
   /** beans are correctly injected */
   @Test
   public void beansAreInjected() {
 assertThat("application bean is injected", applicationBean, 
notNullValue());
 assertThat("session bean is injected", sessionBean, notNullValue());
 assertThat("request bean is injected", requestBean, notNullValue());
+assertThat("beans are injected with @Any", extensionBeans.isUnsatisfied(), 
equalTo(false));
   }
 
   /** starts application and session scopes */
@@ -77,4 +92,26 @@
 assertThat(sessionBean.getValue(), equalTo("session"));
 assertThat(requestBean.getValue(), nullValue());
   }
+
+  /** get any instance of a particular bean type */
+  @Test
+  public void