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

myrle pushed a commit to branch develop
in repository 
https://gitbox.apache.org/repos/asf/fineract-cn-deposit-account-management.git

commit ebda8e9613833710e1845054094032ac2cddf366
Author: mgeiss <mge...@mifos.org>
AuthorDate: Thu Sep 7 11:07:49 2017 +0200

    fixed bug while closing an unused product
---
 .../AbstractDepositAccountManagementTest.java      |  4 +++
 .../io/mifos/deposit/TestProductDefinition.java    | 29 ++++++++++++++++++++++
 .../repository/ProductDefinitionCommandEntity.java |  2 +-
 3 files changed, 34 insertions(+), 1 deletion(-)

diff --git 
a/component-test/src/main/java/io/mifos/deposit/AbstractDepositAccountManagementTest.java
 
b/component-test/src/main/java/io/mifos/deposit/AbstractDepositAccountManagementTest.java
index 6617bc6..d757ad2 100644
--- 
a/component-test/src/main/java/io/mifos/deposit/AbstractDepositAccountManagementTest.java
+++ 
b/component-test/src/main/java/io/mifos/deposit/AbstractDepositAccountManagementTest.java
@@ -25,6 +25,7 @@ import io.mifos.deposit.api.v1.EventConstants;
 import io.mifos.deposit.api.v1.client.DepositAccountManager;
 import io.mifos.deposit.service.DepositAccountManagementConfiguration;
 import io.mifos.deposit.service.internal.service.helper.AccountingService;
+import io.mifos.deposit.service.internal.service.helper.RhythmService;
 import org.junit.After;
 import org.junit.Before;
 import org.junit.ClassRule;
@@ -76,6 +77,9 @@ public abstract class AbstractDepositAccountManagementTest 
extends SuiteTestEnvi
   @MockBean
   AccountingService accountingServiceSpy;
 
+  @MockBean
+  RhythmService rhythmService;
+
   private AutoUserContext autoUserContext;
 
   AbstractDepositAccountManagementTest() {
diff --git 
a/component-test/src/main/java/io/mifos/deposit/TestProductDefinition.java 
b/component-test/src/main/java/io/mifos/deposit/TestProductDefinition.java
index 7125390..9d2e417 100644
--- a/component-test/src/main/java/io/mifos/deposit/TestProductDefinition.java
+++ b/component-test/src/main/java/io/mifos/deposit/TestProductDefinition.java
@@ -145,6 +145,35 @@ public class TestProductDefinition extends 
AbstractDepositAccountManagementTest
     
Assert.assertTrue(super.eventRecorder.wait(EventConstants.DELETE_PRODUCT_DEFINITION,
 productDefinition.getIdentifier()));
   }
 
+  @Test
+  public void shouldDeleteProductDefinitionEvenWhenActed() throws Exception {
+    final ProductDefinition productDefinition = Fixture.productDefinition();
+
+    super.depositAccountManager.create(productDefinition);
+
+    super.eventRecorder.wait(EventConstants.POST_PRODUCT_DEFINITION, 
productDefinition.getIdentifier());
+
+    final ProductDefinitionCommand activateProduct = new 
ProductDefinitionCommand();
+    activateProduct.setAction(ProductDefinitionCommand.Action.ACTIVATE.name());
+    activateProduct.setNote(RandomStringUtils.randomAlphanumeric(2048));
+
+    super.depositAccountManager.process(productDefinition.getIdentifier(), 
activateProduct);
+
+    super.eventRecorder.wait(EventConstants.POST_PRODUCT_DEFINITION_COMMAND, 
productDefinition.getIdentifier());
+
+    final ProductDefinitionCommand deactivateProduct = new 
ProductDefinitionCommand();
+    
deactivateProduct.setAction(ProductDefinitionCommand.Action.DEACTIVATE.name());
+    deactivateProduct.setNote(RandomStringUtils.randomAlphanumeric(2048));
+
+    super.depositAccountManager.process(productDefinition.getIdentifier(), 
deactivateProduct);
+
+    super.eventRecorder.wait(EventConstants.POST_PRODUCT_DEFINITION_COMMAND, 
productDefinition.getIdentifier());
+
+    
super.depositAccountManager.deleteProductDefinition(productDefinition.getIdentifier());
+
+    
Assert.assertTrue(super.eventRecorder.wait(EventConstants.DELETE_PRODUCT_DEFINITION,
 productDefinition.getIdentifier()));
+  }
+
   @Test(expected = ProductDefinitionValidationException.class)
   public void shouldNotDeleteProductDefinitionInstanceExists() throws 
Exception {
     final ProductDefinition productDefinition = Fixture.productDefinition();
diff --git 
a/service/src/main/java/io/mifos/deposit/service/internal/repository/ProductDefinitionCommandEntity.java
 
b/service/src/main/java/io/mifos/deposit/service/internal/repository/ProductDefinitionCommandEntity.java
index 6eae234..42208d7 100644
--- 
a/service/src/main/java/io/mifos/deposit/service/internal/repository/ProductDefinitionCommandEntity.java
+++ 
b/service/src/main/java/io/mifos/deposit/service/internal/repository/ProductDefinitionCommandEntity.java
@@ -38,7 +38,7 @@ public class ProductDefinitionCommandEntity {
   @GeneratedValue(strategy = GenerationType.IDENTITY)
   @Column(name = "id", nullable = false)
   private Long id;
-  @ManyToOne(fetch = FetchType.LAZY, cascade = CascadeType.ALL)
+  @ManyToOne(fetch = FetchType.LAZY)
   @JoinColumn(name = "product_definition_id", nullable = false)
   private ProductDefinitionEntity productDefinition;
   @Column(name = "a_action", nullable = false)

-- 
To stop receiving notification emails like this one, please contact
my...@apache.org.

Reply via email to