[jira] [Updated] (OFBIZ-10646) Clean some Groovy files in base component

2018-11-12 Thread Jacques Le Roux (JIRA)


 [ 
https://issues.apache.org/jira/browse/OFBIZ-10646?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Jacques Le Roux updated OFBIZ-10646:

Description: 
Following discussion at [https://markmail.org/message/y3izmnxd7jd6jbkf] we need 
to clean some Groovy files in the base component, notably:
 * remove ant-scripts folder and its content.
 * Rename framework/base/groovyScript to framework/base/groovyScripts;
 * Move GroovyInit.groovy and GroovyServiceTest.groovy respectively to 
framework/base/groovyScripts and framework/common/groovyScripts and change 
their paths where used.
 * Removes GroovyInit.groovy from excludedConfigFiles block in build.gradle
 * After OFBIZ-10611 it's possible to move GroovyBaseScript.groovy from
 framework/service/src/main/java/org/apache/ofbiz/service/engine
 to
 framework/service/src/main/groovy/org/apache/ofbiz/service/engine
 * Removes FileUtilTests.groovy from basetests.xml (missed it in OFBIZ-10611)

  was:
Following discussion at https://markmail.org/message/y3izmnxd7jd6jbkf we need 
to clean some Groovy files in the base component, notably:

* remove {{ant-scripts}} folder and its content
* rename {{framework/base/groovyScript}} to {{framework/base/groovyScripts}}
* move GroovyInit.groovy and GroovyServiceTest.groovy to 
{{framework/base/groovyScripts}} and change their paths where used.
* after OFBIZ-10611 it's possible to move GroovyBaseScript.groovy  from
{{framework/service/src/main/java/org/apache/ofbiz/service/engine}}
to
{{framework/service/src/main/groovy/org/apache/ofbiz/service/engine}}





> Clean some Groovy files in base component
> -
>
> Key: OFBIZ-10646
> URL: https://issues.apache.org/jira/browse/OFBIZ-10646
> Project: OFBiz
>  Issue Type: Improvement
>  Components: framework
>Reporter: Jacques Le Roux
>Priority: Minor
>
> Following discussion at [https://markmail.org/message/y3izmnxd7jd6jbkf] we 
> need to clean some Groovy files in the base component, notably:
>  * remove ant-scripts folder and its content.
>  * Rename framework/base/groovyScript to framework/base/groovyScripts;
>  * Move GroovyInit.groovy and GroovyServiceTest.groovy respectively to 
> framework/base/groovyScripts and framework/common/groovyScripts and change 
> their paths where used.
>  * Removes GroovyInit.groovy from excludedConfigFiles block in build.gradle
>  * After OFBIZ-10611 it's possible to move GroovyBaseScript.groovy from
>  framework/service/src/main/java/org/apache/ofbiz/service/engine
>  to
>  framework/service/src/main/groovy/org/apache/ofbiz/service/engine
>  * Removes FileUtilTests.groovy from basetests.xml (missed it in OFBIZ-10611)



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Closed] (OFBIZ-10646) Clean some Groovy files in base and common components

2018-11-12 Thread Jacques Le Roux (JIRA)


 [ 
https://issues.apache.org/jira/browse/OFBIZ-10646?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Jacques Le Roux closed OFBIZ-10646.
---
   Resolution: Implemented
 Assignee: Jacques Le Roux
Fix Version/s: Upcoming Branch

Done at revision: 1846485

> Clean some Groovy files in base and common components
> -
>
> Key: OFBIZ-10646
> URL: https://issues.apache.org/jira/browse/OFBIZ-10646
> Project: OFBiz
>  Issue Type: Improvement
>  Components: framework
>Reporter: Jacques Le Roux
>Assignee: Jacques Le Roux
>Priority: Minor
> Fix For: Upcoming Branch
>
>
> Following discussion at [https://markmail.org/message/y3izmnxd7jd6jbkf] we 
> need to clean some Groovy files in the base component, notably:
>  * remove ant-scripts folder and its content.
>  * Rename framework/base/groovyScript to framework/base/groovyScripts;
>  * Move GroovyInit.groovy and GroovyServiceTest.groovy respectively to 
> framework/base/groovyScripts and framework/common/groovyScripts and change 
> their paths where used.
>  * Removes GroovyInit.groovy from excludedConfigFiles block in build.gradle
>  * After OFBIZ-10611 it's possible to move GroovyBaseScript.groovy from
>  framework/service/src/main/java/org/apache/ofbiz/service/engine
>  to
>  framework/service/src/main/groovy/org/apache/ofbiz/service/engine
>  * Removes FileUtilTests.groovy from basetests.xml (missed it in OFBIZ-10611)



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (OFBIZ-10611) Allow unit tests to be written in Groovy

2018-11-12 Thread Jacques Le Roux (JIRA)


[ 
https://issues.apache.org/jira/browse/OFBIZ-10611?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16684725#comment-16684725
 ] 

Jacques Le Roux commented on OFBIZ-10611:
-

At revision: 1846485, I removed FileUtilTests.groovy from basetests.xml, we 
missed it 

> Allow unit tests to be written in Groovy
> 
>
> Key: OFBIZ-10611
> URL: https://issues.apache.org/jira/browse/OFBIZ-10611
> Project: OFBiz
>  Issue Type: Improvement
>Affects Versions: Trunk
>Reporter: Mathieu Lirzin
>Assignee: Jacques Le Roux
>Priority: Minor
> Fix For: Upcoming Branch
>
> Attachments: 
> OFBIZ-10611_Allow-unit-tests-to-be-written-in-Groovy.patch
>
>
> Since OFBIZ-9996 it is possible to write integration tests in Groovy, meaning 
> test that depend on the dispatcher and the delegator. It would be nice if the 
> unit tests could be written in Groovy too.
> The major benefit of writing tests in Groovy is that you create inputs and 
> expected outputs more easily with objects literals. For example the following 
> java code:
> {code:java}
> Map input = new HashMap<>();
> input.put("foo", 42);
> input.put("bar", 37);
> {code}
> can be rewritten in Groovy like this:
> {code:java}
> def input = [foo: 42, bar: 37]
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (OFBIZ-10214) Update build.gradle to the latest dependencies

2018-11-12 Thread Jacques Le Roux (JIRA)


[ 
https://issues.apache.org/jira/browse/OFBIZ-10214?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16684765#comment-16684765
 ] 

Jacques Le Roux commented on OFBIZ-10214:
-

I forgot to attach the [^OFBIZ-10214-plugins.patch]

> Update build.gradle to the latest dependencies
> --
>
> Key: OFBIZ-10214
> URL: https://issues.apache.org/jira/browse/OFBIZ-10214
> Project: OFBiz
>  Issue Type: Sub-task
>  Components: Gradle
>Affects Versions: Trunk
>Reporter: Jacques Le Roux
>Priority: Minor
> Attachments: OFBIZ-10214-plugins.patch, OFBIZ-10214-test.patch, 
> OFBIZ-10214.patch, report.txt
>
>
> I'll for now wait because of OFBIZ-10036 which concerns upgrading to Tomcat 9 
> and should be the most important part of the work



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Updated] (OFBIZ-10646) Clean some Groovy files in base and common components

2018-11-12 Thread Jacques Le Roux (JIRA)


 [ 
https://issues.apache.org/jira/browse/OFBIZ-10646?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Jacques Le Roux updated OFBIZ-10646:

Summary: Clean some Groovy files in base and common components  (was: Clean 
some Groovy files in base component)

> Clean some Groovy files in base and common components
> -
>
> Key: OFBIZ-10646
> URL: https://issues.apache.org/jira/browse/OFBIZ-10646
> Project: OFBiz
>  Issue Type: Improvement
>  Components: framework
>Reporter: Jacques Le Roux
>Priority: Minor
>
> Following discussion at [https://markmail.org/message/y3izmnxd7jd6jbkf] we 
> need to clean some Groovy files in the base component, notably:
>  * remove ant-scripts folder and its content.
>  * Rename framework/base/groovyScript to framework/base/groovyScripts;
>  * Move GroovyInit.groovy and GroovyServiceTest.groovy respectively to 
> framework/base/groovyScripts and framework/common/groovyScripts and change 
> their paths where used.
>  * Removes GroovyInit.groovy from excludedConfigFiles block in build.gradle
>  * After OFBIZ-10611 it's possible to move GroovyBaseScript.groovy from
>  framework/service/src/main/java/org/apache/ofbiz/service/engine
>  to
>  framework/service/src/main/groovy/org/apache/ofbiz/service/engine
>  * Removes FileUtilTests.groovy from basetests.xml (missed it in OFBIZ-10611)



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Comment Edited] (OFBIZ-10645) Empty entity name should not be allowed in entity definition

2018-11-12 Thread Jacques Le Roux (JIRA)


[ 
https://issues.apache.org/jira/browse/OFBIZ-10645?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16683472#comment-16683472
 ] 

Jacques Le Roux edited comment on OFBIZ-10645 at 11/12/18 9:46 AM:
---

Hi Aditya,

I'm all for returning Optionals instead of null values when possible. 
{{ModelReader::buildEntity}} is private an only used by 
{{ModelReader::getEntityCache}} at 
{code}ModelEntity modelEntity = buildEntity(entityResourceHandler, (Element) 
curChild, i, def);{code}
So I think it's possible to use optional there using {{Optional::isPresent}} 
when cheking for an empty ModelEntity object (disclaimer I did not try to 
refactor ;))

For the alternative patch, I prefer to check for {{"table-name"}} also.


was (Author: jacques.le.roux):
Hi Aditya,

I'm all for returning Optionals instead of null values when possible. 
{{ModelReader::buildEntity }} is private an only used by 
{{ModelReader::getEntityCache}} at 
{code}ModelEntity modelEntity = buildEntity(entityResourceHandler, (Element) 
curChild, i, def);{code}
So I think it's possible to use optional there using Optional::isPresent when 
cheking for an empty ModelEntity object (disclaimer I did not try to refactor 
;))

For the alternative patch, I prefer to check for {{"table-name"}} also.

> Empty entity name should not be allowed in entity definition
> 
>
> Key: OFBIZ-10645
> URL: https://issues.apache.org/jira/browse/OFBIZ-10645
> Project: OFBiz
>  Issue Type: Bug
>  Components: framework
>Affects Versions: Trunk, Release Branch 16.11, Release Branch 17.12
>Reporter: Ashish Kumar Pandey
>Assignee: Aditya Sharma
>Priority: Trivial
> Attachments: EntityMaintError.png, OFBIZ-10645-alternate.patch, 
> OFBIZ-10645.patch
>
>
> Present system allows empty name in entity definition due to which there 
> SQLException in console log and error on Entity Mantainence page.
> {code:java}
> 2018-11-10 14:43:45,522 |OFBiz-batch-3    |DatabaseUtil  
> |I| Error getting primary key info from database with null tableName, will 
> try other means: java.sql.SQLException: Table name can not be null
> 2018-11-10 14:43:45,522 |OFBiz-batch-1    |DatabaseUtil  
> |I| Error getting primary key info from database with null tableName, will 
> try other means: java.sql.SQLException: Table name can not be null
> 2018-11-10 14:43:45,522 |OFBiz-batch-2    |DatabaseUtil  
> |I| Error getting primary key info from database with null tableName, will 
> try other means: java.sql.SQLException: Table name can not be null
> 2018-11-10 14:44:06,198 |OFBiz-batch-2    |DatabaseUtil  
> |W| Entity [] has no table in the database
> 2018-11-10 14:44:06,243 |pool-3-thread-1  |DatabaseUtil  
> |E| SQL Exception while executing the following:
> CREATE TABLE OFBIZ. (TEST_ID VARCHAR(20) NOT NULL, LAST_UPDATED_STAMP 
> TIMESTAMP, LAST_UPDATED_TX_STAMP TIMESTAMP, CREATED_STAMP TIMESTAMP, 
> CREATED_TX_STAMP TIMESTAMP,  PRIMARY KEY (TEST_ID))
> Error was: java.sql.SQLSyntaxErrorException: Syntax error: Encountered "(" at 
> line 1, column 21.
> java.sql.SQLSyntaxErrorException: Syntax error: Encountered "(" at line 1, 
> column 21.
>     at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at 
> org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at 
> org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at org.apache.derby.impl.jdbc.EmbedConnection.handleException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at org.apache.derby.impl.jdbc.ConnectionChild.handleException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown Source) 
> ~[derby-10.14.1.0.jar:?]
>     at 
> org.apache.derby.impl.jdbc.EmbedStatement.executeLargeUpdate(Unknown Source) 
> ~[derby-10.14.1.0.jar:?]
>     at org.apache.derby.impl.jdbc.EmbedStatement.executeUpdate(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at 
> org.apache.commons.dbcp2.DelegatingStatement.executeUpdate(DelegatingStatement.java:234)
>  ~[commons-dbcp2-2.1.1.jar:2.1.1]
>     at 
> org.apache.commons.dbcp2.DelegatingStatement.executeUpdate(DelegatingStatement.java:234)
>  ~[commons-dbcp2-2.1.1.jar:2.1.1]
>     at 
> org.apache.ofbiz.entity.jdbc.DatabaseUtil.createTable(DatabaseUtil.java:1677) 
> [ofbiz.jar:?]
>     at 
> 

[jira] [Commented] (OFBIZ-4160) Tax not added for order shipping or promotion

2018-11-12 Thread Pierre Smits (JIRA)


[ 
https://issues.apache.org/jira/browse/OFBIZ-4160?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16683545#comment-16683545
 ] 

Pierre Smits commented on OFBIZ-4160:
-

I agree. let's not dilute this issue (too much).

> Tax not added for order shipping or promotion
> -
>
> Key: OFBIZ-4160
> URL: https://issues.apache.org/jira/browse/OFBIZ-4160
> Project: OFBiz
>  Issue Type: Bug
>  Components: accounting
>Affects Versions: Release Branch 12.04, Release Branch 13.07, Trunk
> Environment: rev 1065908
>Reporter: Paul Foxworthy
>Assignee: Jacques Le Roux
>Priority: Major
>  Labels: VAT, tax
> Attachments: OFBIZ-4160_shipping_tax.patch, 
> OFBIZ-4160_weighted_shipping_tax.patch
>
>
> When shipping is calculated for the entire order or a promotion adjustment is 
> made, the relevant tax rows from the TaxAuthorityRateProduct table are not 
> being found.
> Here's a patch.
> This bug was discovered independently by Sergei Biletnikov, see 
> http://ofbiz.135035.n4.nabble.com/VAT-is-not-applied-for-the-shipping-td3234699.html.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Closed] (OFBIZ-10611) Allow unit tests to be written in Groovy

2018-11-12 Thread Jacques Le Roux (JIRA)


 [ 
https://issues.apache.org/jira/browse/OFBIZ-10611?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Jacques Le Roux closed OFBIZ-10611.
---
Resolution: Implemented

Thanks Mathieu,

Your patch is in trunk at revision: 1846393

I had to manually move the FileUtilTests.groovy file, so this did not work 
(using ToirtoiseSvn or Eclipse patching on Windows)
{code}
diff --git framework/base/groovyScript/test/FileUtilTests.groovy 
framework/base/src/test/groovy/org/apache/ofbiz/base/util/FileUtilTests.groovy
similarity index 84%
rename from framework/base/groovyScript/test/FileUtilTests.groovy
rename to 
framework/base/src/test/groovy/org/apache/ofbiz/base/util/FileUtilTests.groovy
index 9a7d0af4c3..ff39594f05 100644
--- framework/base/groovyScript/test/FileUtilTests.groovy
+++ 
framework/base/src/test/groovy/org/apache/ofbiz/base/util/FileUtilTests.groovy
{code}


> Allow unit tests to be written in Groovy
> 
>
> Key: OFBIZ-10611
> URL: https://issues.apache.org/jira/browse/OFBIZ-10611
> Project: OFBiz
>  Issue Type: Improvement
>Affects Versions: Trunk
>Reporter: Mathieu Lirzin
>Assignee: Jacques Le Roux
>Priority: Minor
> Fix For: Upcoming Branch
>
> Attachments: 
> OFBIZ-10611_Allow-unit-tests-to-be-written-in-Groovy.patch
>
>
> Since OFBIZ-9996 it is possible to write integration tests in Groovy, meaning 
> test that depend on the dispatcher and the delegator. It would be nice if the 
> unit tests could be written in Groovy too.
> The major benefit of writing tests in Groovy is that you create inputs and 
> expected outputs more easily with objects literals. For example the following 
> java code:
> {code:java}
> Map input = new HashMap<>();
> input.put("foo", 42);
> input.put("bar", 37);
> {code}
> can be rewritten in Groovy like this:
> {code:java}
> def input = [foo: 42, bar: 37]
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (OFBIZ-10645) Empty entity name should not be allowed in entity definition

2018-11-12 Thread Jacques Le Roux (JIRA)


[ 
https://issues.apache.org/jira/browse/OFBIZ-10645?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16683472#comment-16683472
 ] 

Jacques Le Roux commented on OFBIZ-10645:
-

Hi Aditya,

I'm all for returning Optionals instead of null values when possible. 
{{ModelReader::buildEntity }} is private an only used by 
{{ModelReader::getEntityCache}} at 
{code}ModelEntity modelEntity = buildEntity(entityResourceHandler, (Element) 
curChild, i, def);{code}
So I think it's possible to use optional there using Optional::isPresent when 
cheking for an empty ModelEntity object (disclaimer I did not try to refactor 
;))

For the alternative patch, I prefer to check for {{"table-name"}} also.

> Empty entity name should not be allowed in entity definition
> 
>
> Key: OFBIZ-10645
> URL: https://issues.apache.org/jira/browse/OFBIZ-10645
> Project: OFBiz
>  Issue Type: Bug
>  Components: framework
>Affects Versions: Trunk, Release Branch 16.11, Release Branch 17.12
>Reporter: Ashish Kumar Pandey
>Assignee: Aditya Sharma
>Priority: Trivial
> Attachments: EntityMaintError.png, OFBIZ-10645-alternate.patch, 
> OFBIZ-10645.patch
>
>
> Present system allows empty name in entity definition due to which there 
> SQLException in console log and error on Entity Mantainence page.
> {code:java}
> 2018-11-10 14:43:45,522 |OFBiz-batch-3    |DatabaseUtil  
> |I| Error getting primary key info from database with null tableName, will 
> try other means: java.sql.SQLException: Table name can not be null
> 2018-11-10 14:43:45,522 |OFBiz-batch-1    |DatabaseUtil  
> |I| Error getting primary key info from database with null tableName, will 
> try other means: java.sql.SQLException: Table name can not be null
> 2018-11-10 14:43:45,522 |OFBiz-batch-2    |DatabaseUtil  
> |I| Error getting primary key info from database with null tableName, will 
> try other means: java.sql.SQLException: Table name can not be null
> 2018-11-10 14:44:06,198 |OFBiz-batch-2    |DatabaseUtil  
> |W| Entity [] has no table in the database
> 2018-11-10 14:44:06,243 |pool-3-thread-1  |DatabaseUtil  
> |E| SQL Exception while executing the following:
> CREATE TABLE OFBIZ. (TEST_ID VARCHAR(20) NOT NULL, LAST_UPDATED_STAMP 
> TIMESTAMP, LAST_UPDATED_TX_STAMP TIMESTAMP, CREATED_STAMP TIMESTAMP, 
> CREATED_TX_STAMP TIMESTAMP,  PRIMARY KEY (TEST_ID))
> Error was: java.sql.SQLSyntaxErrorException: Syntax error: Encountered "(" at 
> line 1, column 21.
> java.sql.SQLSyntaxErrorException: Syntax error: Encountered "(" at line 1, 
> column 21.
>     at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at 
> org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at 
> org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at org.apache.derby.impl.jdbc.EmbedConnection.handleException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at org.apache.derby.impl.jdbc.ConnectionChild.handleException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown Source) 
> ~[derby-10.14.1.0.jar:?]
>     at 
> org.apache.derby.impl.jdbc.EmbedStatement.executeLargeUpdate(Unknown Source) 
> ~[derby-10.14.1.0.jar:?]
>     at org.apache.derby.impl.jdbc.EmbedStatement.executeUpdate(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at 
> org.apache.commons.dbcp2.DelegatingStatement.executeUpdate(DelegatingStatement.java:234)
>  ~[commons-dbcp2-2.1.1.jar:2.1.1]
>     at 
> org.apache.commons.dbcp2.DelegatingStatement.executeUpdate(DelegatingStatement.java:234)
>  ~[commons-dbcp2-2.1.1.jar:2.1.1]
>     at 
> org.apache.ofbiz.entity.jdbc.DatabaseUtil.createTable(DatabaseUtil.java:1677) 
> [ofbiz.jar:?]
>     at 
> org.apache.ofbiz.entity.jdbc.DatabaseUtil$CreateTableCallable.call(DatabaseUtil.java:1516)
>  [ofbiz.jar:?]
>     at 
> org.apache.ofbiz.entity.jdbc.DatabaseUtil$CreateTableCallable.call(DatabaseUtil.java:1502)
>  [ofbiz.jar:?]
>     at java.util.concurrent.FutureTask.run(FutureTask.java:266) 
> [?:1.8.0_66]
>     at 
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
>  [?:1.8.0_66]
>     at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
>  [?:1.8.0_66]
>     at java.lang.Thread.run(Thread.java:745) [?:1.8.0_66]
> Caused by: org.apache.derby.iapi.error.StandardException: 

[jira] [Assigned] (OFBIZ-10611) Allow unit tests to be written in Groovy

2018-11-12 Thread Jacques Le Roux (JIRA)


 [ 
https://issues.apache.org/jira/browse/OFBIZ-10611?page=com.atlassian.jira.plugin.system.issuetabpanels:all-tabpanel
 ]

Jacques Le Roux reassigned OFBIZ-10611:
---

Assignee: Jacques Le Roux

> Allow unit tests to be written in Groovy
> 
>
> Key: OFBIZ-10611
> URL: https://issues.apache.org/jira/browse/OFBIZ-10611
> Project: OFBiz
>  Issue Type: Improvement
>Affects Versions: Trunk
>Reporter: Mathieu Lirzin
>Assignee: Jacques Le Roux
>Priority: Minor
> Fix For: Upcoming Branch
>
> Attachments: 
> OFBIZ-10611_Allow-unit-tests-to-be-written-in-Groovy.patch
>
>
> Since OFBIZ-9996 it is possible to write integration tests in Groovy, meaning 
> test that depend on the dispatcher and the delegator. It would be nice if the 
> unit tests could be written in Groovy too.
> The major benefit of writing tests in Groovy is that you create inputs and 
> expected outputs more easily with objects literals. For example the following 
> java code:
> {code:java}
> Map input = new HashMap<>();
> input.put("foo", 42);
> input.put("bar", 37);
> {code}
> can be rewritten in Groovy like this:
> {code:java}
> def input = [foo: 42, bar: 37]
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Comment Edited] (OFBIZ-10327) CatalogServices #createProductCategoryAttribute doesn't check for existing attributes

2018-11-12 Thread Benjamin Jugl (JIRA)


[ 
https://issues.apache.org/jira/browse/OFBIZ-10327?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16683480#comment-16683480
 ] 

Benjamin Jugl edited comment on OFBIZ-10327 at 11/12/18 9:49 AM:
-

It seems that CategrieServices.groovy is missing. This has been provided in 
OFBIZ-10031 and has been integrated in the trunk at r1835295. Since my patch 
modifies it, it should be applied before this patch.


was (Author: bjugl):
It seems that CategrieServices.groovy is missing. This has been provided in 
OFBIZ-10031 and has been integrated in the trunk a r1835295. Since my patch 
modifies it, it should be applied before this patch.

> CatalogServices #createProductCategoryAttribute doesn't check for existing 
> attributes
> -
>
> Key: OFBIZ-10327
> URL: https://issues.apache.org/jira/browse/OFBIZ-10327
> Project: OFBiz
>  Issue Type: Bug
>Affects Versions: Trunk
>Reporter: Benjamin Jugl
>Assignee: Jacques Le Roux
>Priority: Minor
> Fix For: Upcoming Branch
>
> Attachments: 
> OFBIZ-10327_applications.prodict.groovyScripts.product.category.CategoryServices_validateCompositePrimaryKey.patch
>
>
> "This method just crashes, if there is an attribute which has the same name 
> as the one the user is trying to create.
>  There should be a check for existing attributes and a clean return, no 
> exception throwing." [~Dennis Balkir]



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (OFBIZ-10645) Empty entity name should not be allowed in entity definition

2018-11-12 Thread Mathieu Lirzin (JIRA)


[ 
https://issues.apache.org/jira/browse/OFBIZ-10645?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16683456#comment-16683456
 ] 

Mathieu Lirzin commented on OFBIZ-10645:


What I mean is that you can use 
[{{Optional}}|https://docs.oracle.com/javase/8/docs/api/java/util/Optional.html]
 type as a return value of the {{buildEntity}} method. The idea it to be 
explicit about the potential absence of value, and let the type system know.

Consider this dummy example:
{code:java}
String producer() {
if (...) {
return null;
} else {
return "result";
}
}

void consumer() {
String res = producer();
if (res != null) {
System.out.print("success");
}
}
{code}
In the above code the fact that {{null}} represent an empty value is implicit 
and the compiler has no way to check that the empty case is properly handled. 
Now let's see how we could rewrite the code using {{Optional}}:
{code:java}
Optional producer() {
if (...) {
return Optional.empty();
} else {
return Optional.of("result");
}
}

void consumer() {
producer().ifPresent(System.out::println);
}
{code}
In the above code {{producer}} return value is explicit about the potential 
emptiness of its result, additionally the compiler helps you in ensuring that 
in {{consumer}} you are not calling a method on a {{null}} value.

Of course this example is trivial enough that the additional type safety it 
brings is overkill, however in real Java code this is really helpful. Does it 
make sense?

> Empty entity name should not be allowed in entity definition
> 
>
> Key: OFBIZ-10645
> URL: https://issues.apache.org/jira/browse/OFBIZ-10645
> Project: OFBiz
>  Issue Type: Bug
>  Components: framework
>Affects Versions: Trunk, Release Branch 16.11, Release Branch 17.12
>Reporter: Ashish Kumar Pandey
>Assignee: Aditya Sharma
>Priority: Trivial
> Attachments: EntityMaintError.png, OFBIZ-10645-alternate.patch, 
> OFBIZ-10645.patch
>
>
> Present system allows empty name in entity definition due to which there 
> SQLException in console log and error on Entity Mantainence page.
> {code:java}
> 2018-11-10 14:43:45,522 |OFBiz-batch-3    |DatabaseUtil  
> |I| Error getting primary key info from database with null tableName, will 
> try other means: java.sql.SQLException: Table name can not be null
> 2018-11-10 14:43:45,522 |OFBiz-batch-1    |DatabaseUtil  
> |I| Error getting primary key info from database with null tableName, will 
> try other means: java.sql.SQLException: Table name can not be null
> 2018-11-10 14:43:45,522 |OFBiz-batch-2    |DatabaseUtil  
> |I| Error getting primary key info from database with null tableName, will 
> try other means: java.sql.SQLException: Table name can not be null
> 2018-11-10 14:44:06,198 |OFBiz-batch-2    |DatabaseUtil  
> |W| Entity [] has no table in the database
> 2018-11-10 14:44:06,243 |pool-3-thread-1  |DatabaseUtil  
> |E| SQL Exception while executing the following:
> CREATE TABLE OFBIZ. (TEST_ID VARCHAR(20) NOT NULL, LAST_UPDATED_STAMP 
> TIMESTAMP, LAST_UPDATED_TX_STAMP TIMESTAMP, CREATED_STAMP TIMESTAMP, 
> CREATED_TX_STAMP TIMESTAMP,  PRIMARY KEY (TEST_ID))
> Error was: java.sql.SQLSyntaxErrorException: Syntax error: Encountered "(" at 
> line 1, column 21.
> java.sql.SQLSyntaxErrorException: Syntax error: Encountered "(" at line 1, 
> column 21.
>     at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at 
> org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at 
> org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at org.apache.derby.impl.jdbc.EmbedConnection.handleException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at org.apache.derby.impl.jdbc.ConnectionChild.handleException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown Source) 
> ~[derby-10.14.1.0.jar:?]
>     at 
> org.apache.derby.impl.jdbc.EmbedStatement.executeLargeUpdate(Unknown Source) 
> ~[derby-10.14.1.0.jar:?]
>     at org.apache.derby.impl.jdbc.EmbedStatement.executeUpdate(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at 
> org.apache.commons.dbcp2.DelegatingStatement.executeUpdate(DelegatingStatement.java:234)
>  ~[commons-dbcp2-2.1.1.jar:2.1.1]
>     at 
> 

[jira] [Commented] (OFBIZ-4160) Tax not added for order shipping or promotion

2018-11-12 Thread Benjamin Jugl (JIRA)


[ 
https://issues.apache.org/jira/browse/OFBIZ-4160?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16683521#comment-16683521
 ] 

Benjamin Jugl commented on OFBIZ-4160:
--

That is exactly how it is used in Germany and I think most European countries 
do it the same way. But in the USA it is handled differently. They just display 
gross prices, because tax-rates vary from state to state.

Would it be advisable to open a new issue for this topic of where and how taxes 
should be shown and only deal with the shipping-tax issue in here?

> Tax not added for order shipping or promotion
> -
>
> Key: OFBIZ-4160
> URL: https://issues.apache.org/jira/browse/OFBIZ-4160
> Project: OFBiz
>  Issue Type: Bug
>  Components: accounting
>Affects Versions: Release Branch 12.04, Release Branch 13.07, Trunk
> Environment: rev 1065908
>Reporter: Paul Foxworthy
>Assignee: Jacques Le Roux
>Priority: Major
>  Labels: VAT, tax
> Attachments: OFBIZ-4160_shipping_tax.patch, 
> OFBIZ-4160_weighted_shipping_tax.patch
>
>
> When shipping is calculated for the entire order or a promotion adjustment is 
> made, the relevant tax rows from the TaxAuthorityRateProduct table are not 
> being found.
> Here's a patch.
> This bug was discovered independently by Sergei Biletnikov, see 
> http://ofbiz.135035.n4.nabble.com/VAT-is-not-applied-for-the-shipping-td3234699.html.



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Comment Edited] (OFBIZ-10645) Empty entity name should not be allowed in entity definition

2018-11-12 Thread Jacques Le Roux (JIRA)


[ 
https://issues.apache.org/jira/browse/OFBIZ-10645?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16683760#comment-16683760
 ] 

Jacques Le Roux edited comment on OFBIZ-10645 at 11/12/18 12:55 PM:


Finally, after a quick look, I don't think we need to check for the emptyness 
of {{"table-name"}} attribute of the {{entity-name}} element when the later is 
empty. Because in any case you need a non empty {{entity-name}} element for the 
{{"table-name"}} attribute to be useful (it's used as a physical redirection, 
w/o {{entity-name}} it's useless).


was (Author: jacques.le.roux):
Finally, after a quick look, I don't think we need to check for the emptyness 
of {{"table-name"}} attribute of the {{entity-name}} element when the later is 
empty. Because in any case you need a non empty {{entity-name}} element for the 
{{"table-name"}} attribute to be useful (it's used as a physical redirection, 
w/o {{"table-name"}} it's useless).

> Empty entity name should not be allowed in entity definition
> 
>
> Key: OFBIZ-10645
> URL: https://issues.apache.org/jira/browse/OFBIZ-10645
> Project: OFBiz
>  Issue Type: Bug
>  Components: framework
>Affects Versions: Trunk, Release Branch 16.11, Release Branch 17.12
>Reporter: Ashish Kumar Pandey
>Assignee: Aditya Sharma
>Priority: Trivial
> Attachments: EntityMaintError.png, OFBIZ-10645-alternate.patch, 
> OFBIZ-10645.patch
>
>
> Present system allows empty name in entity definition due to which there 
> SQLException in console log and error on Entity Mantainence page.
> {code:java}
> 2018-11-10 14:43:45,522 |OFBiz-batch-3    |DatabaseUtil  
> |I| Error getting primary key info from database with null tableName, will 
> try other means: java.sql.SQLException: Table name can not be null
> 2018-11-10 14:43:45,522 |OFBiz-batch-1    |DatabaseUtil  
> |I| Error getting primary key info from database with null tableName, will 
> try other means: java.sql.SQLException: Table name can not be null
> 2018-11-10 14:43:45,522 |OFBiz-batch-2    |DatabaseUtil  
> |I| Error getting primary key info from database with null tableName, will 
> try other means: java.sql.SQLException: Table name can not be null
> 2018-11-10 14:44:06,198 |OFBiz-batch-2    |DatabaseUtil  
> |W| Entity [] has no table in the database
> 2018-11-10 14:44:06,243 |pool-3-thread-1  |DatabaseUtil  
> |E| SQL Exception while executing the following:
> CREATE TABLE OFBIZ. (TEST_ID VARCHAR(20) NOT NULL, LAST_UPDATED_STAMP 
> TIMESTAMP, LAST_UPDATED_TX_STAMP TIMESTAMP, CREATED_STAMP TIMESTAMP, 
> CREATED_TX_STAMP TIMESTAMP,  PRIMARY KEY (TEST_ID))
> Error was: java.sql.SQLSyntaxErrorException: Syntax error: Encountered "(" at 
> line 1, column 21.
> java.sql.SQLSyntaxErrorException: Syntax error: Encountered "(" at line 1, 
> column 21.
>     at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at 
> org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at 
> org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at org.apache.derby.impl.jdbc.EmbedConnection.handleException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at org.apache.derby.impl.jdbc.ConnectionChild.handleException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown Source) 
> ~[derby-10.14.1.0.jar:?]
>     at 
> org.apache.derby.impl.jdbc.EmbedStatement.executeLargeUpdate(Unknown Source) 
> ~[derby-10.14.1.0.jar:?]
>     at org.apache.derby.impl.jdbc.EmbedStatement.executeUpdate(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at 
> org.apache.commons.dbcp2.DelegatingStatement.executeUpdate(DelegatingStatement.java:234)
>  ~[commons-dbcp2-2.1.1.jar:2.1.1]
>     at 
> org.apache.commons.dbcp2.DelegatingStatement.executeUpdate(DelegatingStatement.java:234)
>  ~[commons-dbcp2-2.1.1.jar:2.1.1]
>     at 
> org.apache.ofbiz.entity.jdbc.DatabaseUtil.createTable(DatabaseUtil.java:1677) 
> [ofbiz.jar:?]
>     at 
> org.apache.ofbiz.entity.jdbc.DatabaseUtil$CreateTableCallable.call(DatabaseUtil.java:1516)
>  [ofbiz.jar:?]
>     at 
> org.apache.ofbiz.entity.jdbc.DatabaseUtil$CreateTableCallable.call(DatabaseUtil.java:1502)
>  [ofbiz.jar:?]
>     at java.util.concurrent.FutureTask.run(FutureTask.java:266) 
> [?:1.8.0_66]
>     at 
> 

[jira] [Commented] (OFBIZ-10645) Empty entity name should not be allowed in entity definition

2018-11-12 Thread Aditya Sharma (JIRA)


[ 
https://issues.apache.org/jira/browse/OFBIZ-10645?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16683597#comment-16683597
 ] 

Aditya Sharma commented on OFBIZ-10645:
---

Thanks  [~mthl] and [~jacques.le.roux] :). Makes sense. I will update the 
solution patch.
{quote}For the alternative patch, I prefer to check for {{"table-name"}} also.
{quote}
I prefer the same but still couldn't understand as entity-name is the required 
field. How any operation can be performed for these tables without an 
entity-name?
 

> Empty entity name should not be allowed in entity definition
> 
>
> Key: OFBIZ-10645
> URL: https://issues.apache.org/jira/browse/OFBIZ-10645
> Project: OFBiz
>  Issue Type: Bug
>  Components: framework
>Affects Versions: Trunk, Release Branch 16.11, Release Branch 17.12
>Reporter: Ashish Kumar Pandey
>Assignee: Aditya Sharma
>Priority: Trivial
> Attachments: EntityMaintError.png, OFBIZ-10645-alternate.patch, 
> OFBIZ-10645.patch
>
>
> Present system allows empty name in entity definition due to which there 
> SQLException in console log and error on Entity Mantainence page.
> {code:java}
> 2018-11-10 14:43:45,522 |OFBiz-batch-3    |DatabaseUtil  
> |I| Error getting primary key info from database with null tableName, will 
> try other means: java.sql.SQLException: Table name can not be null
> 2018-11-10 14:43:45,522 |OFBiz-batch-1    |DatabaseUtil  
> |I| Error getting primary key info from database with null tableName, will 
> try other means: java.sql.SQLException: Table name can not be null
> 2018-11-10 14:43:45,522 |OFBiz-batch-2    |DatabaseUtil  
> |I| Error getting primary key info from database with null tableName, will 
> try other means: java.sql.SQLException: Table name can not be null
> 2018-11-10 14:44:06,198 |OFBiz-batch-2    |DatabaseUtil  
> |W| Entity [] has no table in the database
> 2018-11-10 14:44:06,243 |pool-3-thread-1  |DatabaseUtil  
> |E| SQL Exception while executing the following:
> CREATE TABLE OFBIZ. (TEST_ID VARCHAR(20) NOT NULL, LAST_UPDATED_STAMP 
> TIMESTAMP, LAST_UPDATED_TX_STAMP TIMESTAMP, CREATED_STAMP TIMESTAMP, 
> CREATED_TX_STAMP TIMESTAMP,  PRIMARY KEY (TEST_ID))
> Error was: java.sql.SQLSyntaxErrorException: Syntax error: Encountered "(" at 
> line 1, column 21.
> java.sql.SQLSyntaxErrorException: Syntax error: Encountered "(" at line 1, 
> column 21.
>     at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at 
> org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at 
> org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at org.apache.derby.impl.jdbc.EmbedConnection.handleException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at org.apache.derby.impl.jdbc.ConnectionChild.handleException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown Source) 
> ~[derby-10.14.1.0.jar:?]
>     at 
> org.apache.derby.impl.jdbc.EmbedStatement.executeLargeUpdate(Unknown Source) 
> ~[derby-10.14.1.0.jar:?]
>     at org.apache.derby.impl.jdbc.EmbedStatement.executeUpdate(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at 
> org.apache.commons.dbcp2.DelegatingStatement.executeUpdate(DelegatingStatement.java:234)
>  ~[commons-dbcp2-2.1.1.jar:2.1.1]
>     at 
> org.apache.commons.dbcp2.DelegatingStatement.executeUpdate(DelegatingStatement.java:234)
>  ~[commons-dbcp2-2.1.1.jar:2.1.1]
>     at 
> org.apache.ofbiz.entity.jdbc.DatabaseUtil.createTable(DatabaseUtil.java:1677) 
> [ofbiz.jar:?]
>     at 
> org.apache.ofbiz.entity.jdbc.DatabaseUtil$CreateTableCallable.call(DatabaseUtil.java:1516)
>  [ofbiz.jar:?]
>     at 
> org.apache.ofbiz.entity.jdbc.DatabaseUtil$CreateTableCallable.call(DatabaseUtil.java:1502)
>  [ofbiz.jar:?]
>     at java.util.concurrent.FutureTask.run(FutureTask.java:266) 
> [?:1.8.0_66]
>     at 
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
>  [?:1.8.0_66]
>     at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
>  [?:1.8.0_66]
>     at java.lang.Thread.run(Thread.java:745) [?:1.8.0_66]
> Caused by: org.apache.derby.iapi.error.StandardException: Syntax error: 
> Encountered "(" at line 1, column 21.
>     at org.apache.derby.iapi.error.StandardException.newException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>  

[jira] [Commented] (OFBIZ-10645) Empty entity name should not be allowed in entity definition

2018-11-12 Thread Jacques Le Roux (JIRA)


[ 
https://issues.apache.org/jira/browse/OFBIZ-10645?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16683738#comment-16683738
 ] 

Jacques Le Roux commented on OFBIZ-10645:
-

Hi Aditya,
bq. I prefer the same but still couldn't understand as entity-name is the 
required field. How any operation can be performed for these tables without an 
entity-name?
That's a difficult question, I'll have a look...

> Empty entity name should not be allowed in entity definition
> 
>
> Key: OFBIZ-10645
> URL: https://issues.apache.org/jira/browse/OFBIZ-10645
> Project: OFBiz
>  Issue Type: Bug
>  Components: framework
>Affects Versions: Trunk, Release Branch 16.11, Release Branch 17.12
>Reporter: Ashish Kumar Pandey
>Assignee: Aditya Sharma
>Priority: Trivial
> Attachments: EntityMaintError.png, OFBIZ-10645-alternate.patch, 
> OFBIZ-10645.patch
>
>
> Present system allows empty name in entity definition due to which there 
> SQLException in console log and error on Entity Mantainence page.
> {code:java}
> 2018-11-10 14:43:45,522 |OFBiz-batch-3    |DatabaseUtil  
> |I| Error getting primary key info from database with null tableName, will 
> try other means: java.sql.SQLException: Table name can not be null
> 2018-11-10 14:43:45,522 |OFBiz-batch-1    |DatabaseUtil  
> |I| Error getting primary key info from database with null tableName, will 
> try other means: java.sql.SQLException: Table name can not be null
> 2018-11-10 14:43:45,522 |OFBiz-batch-2    |DatabaseUtil  
> |I| Error getting primary key info from database with null tableName, will 
> try other means: java.sql.SQLException: Table name can not be null
> 2018-11-10 14:44:06,198 |OFBiz-batch-2    |DatabaseUtil  
> |W| Entity [] has no table in the database
> 2018-11-10 14:44:06,243 |pool-3-thread-1  |DatabaseUtil  
> |E| SQL Exception while executing the following:
> CREATE TABLE OFBIZ. (TEST_ID VARCHAR(20) NOT NULL, LAST_UPDATED_STAMP 
> TIMESTAMP, LAST_UPDATED_TX_STAMP TIMESTAMP, CREATED_STAMP TIMESTAMP, 
> CREATED_TX_STAMP TIMESTAMP,  PRIMARY KEY (TEST_ID))
> Error was: java.sql.SQLSyntaxErrorException: Syntax error: Encountered "(" at 
> line 1, column 21.
> java.sql.SQLSyntaxErrorException: Syntax error: Encountered "(" at line 1, 
> column 21.
>     at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at 
> org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at 
> org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at org.apache.derby.impl.jdbc.EmbedConnection.handleException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at org.apache.derby.impl.jdbc.ConnectionChild.handleException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown Source) 
> ~[derby-10.14.1.0.jar:?]
>     at 
> org.apache.derby.impl.jdbc.EmbedStatement.executeLargeUpdate(Unknown Source) 
> ~[derby-10.14.1.0.jar:?]
>     at org.apache.derby.impl.jdbc.EmbedStatement.executeUpdate(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at 
> org.apache.commons.dbcp2.DelegatingStatement.executeUpdate(DelegatingStatement.java:234)
>  ~[commons-dbcp2-2.1.1.jar:2.1.1]
>     at 
> org.apache.commons.dbcp2.DelegatingStatement.executeUpdate(DelegatingStatement.java:234)
>  ~[commons-dbcp2-2.1.1.jar:2.1.1]
>     at 
> org.apache.ofbiz.entity.jdbc.DatabaseUtil.createTable(DatabaseUtil.java:1677) 
> [ofbiz.jar:?]
>     at 
> org.apache.ofbiz.entity.jdbc.DatabaseUtil$CreateTableCallable.call(DatabaseUtil.java:1516)
>  [ofbiz.jar:?]
>     at 
> org.apache.ofbiz.entity.jdbc.DatabaseUtil$CreateTableCallable.call(DatabaseUtil.java:1502)
>  [ofbiz.jar:?]
>     at java.util.concurrent.FutureTask.run(FutureTask.java:266) 
> [?:1.8.0_66]
>     at 
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
>  [?:1.8.0_66]
>     at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
>  [?:1.8.0_66]
>     at java.lang.Thread.run(Thread.java:745) [?:1.8.0_66]
> Caused by: org.apache.derby.iapi.error.StandardException: Syntax error: 
> Encountered "(" at line 1, column 21.
>     at org.apache.derby.iapi.error.StandardException.newException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at org.apache.derby.iapi.error.StandardException.newException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>  

[jira] [Commented] (OFBIZ-10645) Empty entity name should not be allowed in entity definition

2018-11-12 Thread Aditya Sharma (JIRA)


[ 
https://issues.apache.org/jira/browse/OFBIZ-10645?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16683798#comment-16683798
 ] 

Aditya Sharma commented on OFBIZ-10645:
---

So we can proceed with only checking entity-name then, as loading such entities 
seems to be futile with these inferences. 

> Empty entity name should not be allowed in entity definition
> 
>
> Key: OFBIZ-10645
> URL: https://issues.apache.org/jira/browse/OFBIZ-10645
> Project: OFBiz
>  Issue Type: Bug
>  Components: framework
>Affects Versions: Trunk, Release Branch 16.11, Release Branch 17.12
>Reporter: Ashish Kumar Pandey
>Assignee: Aditya Sharma
>Priority: Trivial
> Attachments: EntityMaintError.png, OFBIZ-10645-alternate.patch, 
> OFBIZ-10645.patch
>
>
> Present system allows empty name in entity definition due to which there 
> SQLException in console log and error on Entity Mantainence page.
> {code:java}
> 2018-11-10 14:43:45,522 |OFBiz-batch-3    |DatabaseUtil  
> |I| Error getting primary key info from database with null tableName, will 
> try other means: java.sql.SQLException: Table name can not be null
> 2018-11-10 14:43:45,522 |OFBiz-batch-1    |DatabaseUtil  
> |I| Error getting primary key info from database with null tableName, will 
> try other means: java.sql.SQLException: Table name can not be null
> 2018-11-10 14:43:45,522 |OFBiz-batch-2    |DatabaseUtil  
> |I| Error getting primary key info from database with null tableName, will 
> try other means: java.sql.SQLException: Table name can not be null
> 2018-11-10 14:44:06,198 |OFBiz-batch-2    |DatabaseUtil  
> |W| Entity [] has no table in the database
> 2018-11-10 14:44:06,243 |pool-3-thread-1  |DatabaseUtil  
> |E| SQL Exception while executing the following:
> CREATE TABLE OFBIZ. (TEST_ID VARCHAR(20) NOT NULL, LAST_UPDATED_STAMP 
> TIMESTAMP, LAST_UPDATED_TX_STAMP TIMESTAMP, CREATED_STAMP TIMESTAMP, 
> CREATED_TX_STAMP TIMESTAMP,  PRIMARY KEY (TEST_ID))
> Error was: java.sql.SQLSyntaxErrorException: Syntax error: Encountered "(" at 
> line 1, column 21.
> java.sql.SQLSyntaxErrorException: Syntax error: Encountered "(" at line 1, 
> column 21.
>     at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at 
> org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at 
> org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at org.apache.derby.impl.jdbc.EmbedConnection.handleException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at org.apache.derby.impl.jdbc.ConnectionChild.handleException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown Source) 
> ~[derby-10.14.1.0.jar:?]
>     at 
> org.apache.derby.impl.jdbc.EmbedStatement.executeLargeUpdate(Unknown Source) 
> ~[derby-10.14.1.0.jar:?]
>     at org.apache.derby.impl.jdbc.EmbedStatement.executeUpdate(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at 
> org.apache.commons.dbcp2.DelegatingStatement.executeUpdate(DelegatingStatement.java:234)
>  ~[commons-dbcp2-2.1.1.jar:2.1.1]
>     at 
> org.apache.commons.dbcp2.DelegatingStatement.executeUpdate(DelegatingStatement.java:234)
>  ~[commons-dbcp2-2.1.1.jar:2.1.1]
>     at 
> org.apache.ofbiz.entity.jdbc.DatabaseUtil.createTable(DatabaseUtil.java:1677) 
> [ofbiz.jar:?]
>     at 
> org.apache.ofbiz.entity.jdbc.DatabaseUtil$CreateTableCallable.call(DatabaseUtil.java:1516)
>  [ofbiz.jar:?]
>     at 
> org.apache.ofbiz.entity.jdbc.DatabaseUtil$CreateTableCallable.call(DatabaseUtil.java:1502)
>  [ofbiz.jar:?]
>     at java.util.concurrent.FutureTask.run(FutureTask.java:266) 
> [?:1.8.0_66]
>     at 
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
>  [?:1.8.0_66]
>     at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
>  [?:1.8.0_66]
>     at java.lang.Thread.run(Thread.java:745) [?:1.8.0_66]
> Caused by: org.apache.derby.iapi.error.StandardException: Syntax error: 
> Encountered "(" at line 1, column 21.
>     at org.apache.derby.iapi.error.StandardException.newException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at org.apache.derby.iapi.error.StandardException.newException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at 
> org.apache.derby.impl.sql.compile.ParserImpl.parseStatementOrSearchCondition(Unknown
>  

[jira] [Commented] (OFBIZ-10611) Allow unit tests to be written in Groovy

2018-11-12 Thread Mathieu Lirzin (JIRA)


[ 
https://issues.apache.org/jira/browse/OFBIZ-10611?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16683641#comment-16683641
 ] 

Mathieu Lirzin commented on OFBIZ-10611:


Thanks Jacques!

> Allow unit tests to be written in Groovy
> 
>
> Key: OFBIZ-10611
> URL: https://issues.apache.org/jira/browse/OFBIZ-10611
> Project: OFBiz
>  Issue Type: Improvement
>Affects Versions: Trunk
>Reporter: Mathieu Lirzin
>Assignee: Jacques Le Roux
>Priority: Minor
> Fix For: Upcoming Branch
>
> Attachments: 
> OFBIZ-10611_Allow-unit-tests-to-be-written-in-Groovy.patch
>
>
> Since OFBIZ-9996 it is possible to write integration tests in Groovy, meaning 
> test that depend on the dispatcher and the delegator. It would be nice if the 
> unit tests could be written in Groovy too.
> The major benefit of writing tests in Groovy is that you create inputs and 
> expected outputs more easily with objects literals. For example the following 
> java code:
> {code:java}
> Map input = new HashMap<>();
> input.put("foo", 42);
> input.put("bar", 37);
> {code}
> can be rewritten in Groovy like this:
> {code:java}
> def input = [foo: 42, bar: 37]
> {code}



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (OFBIZ-10327) CatalogServices #createProductCategoryAttribute doesn't check for existing attributes

2018-11-12 Thread Benjamin Jugl (JIRA)


[ 
https://issues.apache.org/jira/browse/OFBIZ-10327?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16683480#comment-16683480
 ] 

Benjamin Jugl commented on OFBIZ-10327:
---

It seems that CategrieServices.groovy is missing. This has been provided in 
OFBIZ-10031 and has been integrated in the trunk a r1835295. Since my patch 
modifies it, it should be applied before this patch.

> CatalogServices #createProductCategoryAttribute doesn't check for existing 
> attributes
> -
>
> Key: OFBIZ-10327
> URL: https://issues.apache.org/jira/browse/OFBIZ-10327
> Project: OFBiz
>  Issue Type: Bug
>Affects Versions: Trunk
>Reporter: Benjamin Jugl
>Assignee: Jacques Le Roux
>Priority: Minor
> Fix For: Upcoming Branch
>
> Attachments: 
> OFBIZ-10327_applications.prodict.groovyScripts.product.category.CategoryServices_validateCompositePrimaryKey.patch
>
>
> "This method just crashes, if there is an attribute which has the same name 
> as the one the user is trying to create.
>  There should be a check for existing attributes and a clean return, no 
> exception throwing." [~Dennis Balkir]



--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Created] (OFBIZ-10646) Clean some Groovy files in base component

2018-11-12 Thread Jacques Le Roux (JIRA)
Jacques Le Roux created OFBIZ-10646:
---

 Summary: Clean some Groovy files in base component
 Key: OFBIZ-10646
 URL: https://issues.apache.org/jira/browse/OFBIZ-10646
 Project: OFBiz
  Issue Type: Improvement
  Components: framework
Reporter: Jacques Le Roux


Following discussion at https://markmail.org/message/y3izmnxd7jd6jbkf we need 
to clean some Groovy files in the base component, notably:

* remove {{ant-scripts}} folder and its content
* rename {{framework/base/groovyScript}} to {{framework/base/groovyScripts}}
* move GroovyInit.groovy and GroovyServiceTest.groovy to 
{{framework/base/groovyScripts}} and change their paths where used.
* after OFBIZ-10611 it's possible to move GroovyBaseScript.groovy  from
{{framework/service/src/main/java/org/apache/ofbiz/service/engine}}
to
{{framework/service/src/main/groovy/org/apache/ofbiz/service/engine}}






--
This message was sent by Atlassian JIRA
(v7.6.3#76005)


[jira] [Commented] (OFBIZ-10645) Empty entity name should not be allowed in entity definition

2018-11-12 Thread Jacques Le Roux (JIRA)


[ 
https://issues.apache.org/jira/browse/OFBIZ-10645?page=com.atlassian.jira.plugin.system.issuetabpanels:comment-tabpanel=16684046#comment-16684046
 ] 

Jacques Le Roux commented on OFBIZ-10645:
-

bq. So we can proceed with only checking entity-name
Yes
bq.  loading such entities seems to be futile with these inferences. 
not sure what you mean :)


> Empty entity name should not be allowed in entity definition
> 
>
> Key: OFBIZ-10645
> URL: https://issues.apache.org/jira/browse/OFBIZ-10645
> Project: OFBiz
>  Issue Type: Bug
>  Components: framework
>Affects Versions: Trunk, Release Branch 16.11, Release Branch 17.12
>Reporter: Ashish Kumar Pandey
>Assignee: Aditya Sharma
>Priority: Trivial
> Attachments: EntityMaintError.png, OFBIZ-10645-alternate.patch, 
> OFBIZ-10645.patch
>
>
> Present system allows empty name in entity definition due to which there 
> SQLException in console log and error on Entity Mantainence page.
> {code:java}
> 2018-11-10 14:43:45,522 |OFBiz-batch-3    |DatabaseUtil  
> |I| Error getting primary key info from database with null tableName, will 
> try other means: java.sql.SQLException: Table name can not be null
> 2018-11-10 14:43:45,522 |OFBiz-batch-1    |DatabaseUtil  
> |I| Error getting primary key info from database with null tableName, will 
> try other means: java.sql.SQLException: Table name can not be null
> 2018-11-10 14:43:45,522 |OFBiz-batch-2    |DatabaseUtil  
> |I| Error getting primary key info from database with null tableName, will 
> try other means: java.sql.SQLException: Table name can not be null
> 2018-11-10 14:44:06,198 |OFBiz-batch-2    |DatabaseUtil  
> |W| Entity [] has no table in the database
> 2018-11-10 14:44:06,243 |pool-3-thread-1  |DatabaseUtil  
> |E| SQL Exception while executing the following:
> CREATE TABLE OFBIZ. (TEST_ID VARCHAR(20) NOT NULL, LAST_UPDATED_STAMP 
> TIMESTAMP, LAST_UPDATED_TX_STAMP TIMESTAMP, CREATED_STAMP TIMESTAMP, 
> CREATED_TX_STAMP TIMESTAMP,  PRIMARY KEY (TEST_ID))
> Error was: java.sql.SQLSyntaxErrorException: Syntax error: Encountered "(" at 
> line 1, column 21.
> java.sql.SQLSyntaxErrorException: Syntax error: Encountered "(" at line 1, 
> column 21.
>     at 
> org.apache.derby.impl.jdbc.SQLExceptionFactory.getSQLException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at org.apache.derby.impl.jdbc.Util.generateCsSQLException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at 
> org.apache.derby.impl.jdbc.TransactionResourceImpl.wrapInSQLException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at 
> org.apache.derby.impl.jdbc.TransactionResourceImpl.handleException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at org.apache.derby.impl.jdbc.EmbedConnection.handleException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at org.apache.derby.impl.jdbc.ConnectionChild.handleException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at org.apache.derby.impl.jdbc.EmbedStatement.execute(Unknown Source) 
> ~[derby-10.14.1.0.jar:?]
>     at 
> org.apache.derby.impl.jdbc.EmbedStatement.executeLargeUpdate(Unknown Source) 
> ~[derby-10.14.1.0.jar:?]
>     at org.apache.derby.impl.jdbc.EmbedStatement.executeUpdate(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at 
> org.apache.commons.dbcp2.DelegatingStatement.executeUpdate(DelegatingStatement.java:234)
>  ~[commons-dbcp2-2.1.1.jar:2.1.1]
>     at 
> org.apache.commons.dbcp2.DelegatingStatement.executeUpdate(DelegatingStatement.java:234)
>  ~[commons-dbcp2-2.1.1.jar:2.1.1]
>     at 
> org.apache.ofbiz.entity.jdbc.DatabaseUtil.createTable(DatabaseUtil.java:1677) 
> [ofbiz.jar:?]
>     at 
> org.apache.ofbiz.entity.jdbc.DatabaseUtil$CreateTableCallable.call(DatabaseUtil.java:1516)
>  [ofbiz.jar:?]
>     at 
> org.apache.ofbiz.entity.jdbc.DatabaseUtil$CreateTableCallable.call(DatabaseUtil.java:1502)
>  [ofbiz.jar:?]
>     at java.util.concurrent.FutureTask.run(FutureTask.java:266) 
> [?:1.8.0_66]
>     at 
> java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)
>  [?:1.8.0_66]
>     at 
> java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)
>  [?:1.8.0_66]
>     at java.lang.Thread.run(Thread.java:745) [?:1.8.0_66]
> Caused by: org.apache.derby.iapi.error.StandardException: Syntax error: 
> Encountered "(" at line 1, column 21.
>     at org.apache.derby.iapi.error.StandardException.newException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at org.apache.derby.iapi.error.StandardException.newException(Unknown 
> Source) ~[derby-10.14.1.0.jar:?]
>     at 
>