Hi Tom,

Hope you had a good weekend :) I have integrated all resources into
the single patch file.


On 11/22/07, Tom Bostelmann <[EMAIL PROTECTED]> wrote:
> Dion, the patch needs contain all of the contents of the patch in one file.
> There are a couple files, namely 'OffsetTestSuite.java' and
> 'TestOffsetAccountBO.java' that should be incorporated in the patch.
>
> Can you fix this and then submit it again?  It'd make my life a little
> easier ;)
>
>
> On Nov 17, 2007 11:17 PM, Dion Dodgen <[EMAIL PROTECTED] > wrote:
> > Great thanks Tom.
> >
> >
> >
> >
> > On Nov 16, 2007 6:07 PM, Tom Bostelmann < [EMAIL PROTECTED]> wrote:
> > > Thanks Dion!  I added it to the patch queue - probably going to be next
> week
> > > before I get back to you, though.  Here's the queue wiki:
> > >
> > > http://mifos.org/developers/wiki/MifosPatchQueue
> > >
> > >
> > >
> > > On Nov 14, 2007 4:58 AM, Dion Dodgen < [EMAIL PROTECTED]> wrote:
> > > >
> > > >
> > > >
> > > > Hi Tom, all,
> > > >
> > > > Sorry for the delay, hope you well.
> > > > I have reworked the initial patch. All tests pass using the correct
> > > > time zone and db use_lower_case_table_names=1.
> > > > I would like to patch this dependency as soon as offsetting reaches
> > > maturity.
> > > >
> > > > This patch covers all the persistence needs for the Offsetting module.
> > > >
> > > > I am now on suse 10.3 :)
> > > >
> > > > Thanks,
> > > > Dion
> > > >
> > > >
> -------------------------------------------------------------------------
> > > > This SF.net email is sponsored by: Splunk Inc.
> > > > Still grepping through log files to find problems?  Stop.
> > > > Now Search log events and configuration files using AJAX and a
> browser.
> > > > Download your FREE copy of Splunk now >> http://get.splunk.com/
> > > >
> > >
> > >
> > >
> -------------------------------------------------------------------------
> > > This SF.net email is sponsored by: Microsoft
> > > Defy all challenges. Microsoft(R) Visual Studio 2005.
> > > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> > >
> >
> >
> -------------------------------------------------------------------------
> > This SF.net email is sponsored by: Microsoft
> > Defy all challenges. Microsoft(R) Visual Studio 2005.
> > http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
> >
>
>
> -------------------------------------------------------------------------
> This SF.net email is sponsored by: Microsoft
> Defy all challenges. Microsoft(R) Visual Studio 2005.
> http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/
>
Index: test/org/mifos/application/accounts/offsetting/OffsetTestSuite.java
===================================================================
--- test/org/mifos/application/accounts/offsetting/OffsetTestSuite.java 
(revision 0)
+++ test/org/mifos/application/accounts/offsetting/OffsetTestSuite.java 
(revision 0)
@@ -0,0 +1,28 @@
+package org.mifos.application.accounts.offsetting;
+
+import junit.framework.Test;
+import junit.framework.TestSuite;
+import junit.textui.TestRunner;
+
+import org.mifos.application.accounts.offsetting.TestOffsetAccountBO;
+
+public class OffsetTestSuite extends TestSuite {
+       
+       OffsetTestSuite() throws Exception{
+               super();
+       }
+       
+       public static void main(String[] args) throws Exception {
+               Test tests = suite();
+               TestRunner.run(tests);
+       }
+
+       public static Test suite() throws Exception {
+               TestSuite testSuite = new OffsetTestSuite();
+               //testSuite.addTestSuite(TestOffsetBusinessService.class);
+               testSuite.addTestSuite(TestOffsetAccountBO.class);
+               return testSuite;
+               
+       }
+
+}
Index: test/org/mifos/application/accounts/offsetting/TestOffsetAccountBO.java
===================================================================
--- test/org/mifos/application/accounts/offsetting/TestOffsetAccountBO.java     
(revision 0)
+++ test/org/mifos/application/accounts/offsetting/TestOffsetAccountBO.java     
(revision 0)
@@ -0,0 +1,89 @@
+package org.mifos.application.accounts.offsetting;
+
+import static 
org.mifos.application.meeting.util.helpers.MeetingType.CUSTOMER_MEETING;
+import static org.mifos.application.meeting.util.helpers.RecurrenceType.WEEKLY;
+import static org.mifos.framework.util.helpers.TestObjectFactory.EVERY_WEEK;
+
+import java.util.Date;
+
+import org.junit.Test;
+import org.mifos.application.accounts.loan.business.LoanBO;
+import org.mifos.application.accounts.persistence.AccountPersistence;
+import org.mifos.application.accounts.util.helpers.AccountState;
+import org.mifos.application.customer.business.CustomerBO;
+import org.mifos.application.customer.util.helpers.CustomerStatus;
+import org.mifos.application.meeting.business.MeetingBO;
+import org.mifos.application.productdefinition.business.LoanOfferingBO;
+import org.mifos.application.productdefinition.util.helpers.ApplicableTo;
+import org.mifos.application.productdefinition.util.helpers.InterestType;
+import org.mifos.application.productdefinition.util.helpers.PrdStatus;
+import org.mifos.framework.MifosTestCase;
+import org.mifos.framework.util.helpers.TestObjectFactory;
+
+public class TestOffsetAccountBO extends MifosTestCase {
+       
+       protected LoanBO accountBO=null;
+       protected CustomerBO center=null;
+       protected CustomerBO group=null;
+       protected AccountPersistence accountPersistence;
+               
+       @Override       
+       public void setUp() throws Exception {
+               super.setUp();
+
+               accountBO = createLoanAccount();
+               accountPersistence = new AccountPersistence();
+               
+               /**
+           if (super.accountBO == null) {
+               //Calling super setup on the TestAccount 
+               //with a currently existing TestAccount causes
+               //a "duplicate AccountBO object insertion error".
+               //First cleaning up if a TestAccount exists then get
+               //get a new TestAccount.
+               super.setUp();
+           }
+           */
+       }
+       
+       @Test
+       public void testLoanAccountBOOfsetAllowablePersistence() {
+           assertTrue(accountBO.getOffsettingAllowable().intValue() == 1);
+       }       
+       
+       @Override
+       protected void tearDown() throws Exception {
+               try {
+                       TestObjectFactory.cleanUp(accountBO);
+                       TestObjectFactory.cleanUp(group);
+                       TestObjectFactory.cleanUp(center);
+                       accountPersistence = null;
+               }
+               catch (Exception e) {
+                       // throwing here tends to mask failures
+                       e.printStackTrace();
+               }
+
+               super.tearDown();
+       }
+
+       public LoanBO createLoanAccount() { 
+        MeetingBO meeting = TestObjectFactory.createMeeting(
+               TestObjectFactory.getNewMeetingForToday(
+                       WEEKLY, EVERY_WEEK, CUSTOMER_MEETING));
+        center=TestObjectFactory.createCenter("OffsetCenter",meeting);
+        group=TestObjectFactory.createGroupUnderCenter(
+               "OffsetGroup1", CustomerStatus.GROUP_ACTIVE, center);
+        
+        LoanOfferingBO loanOffering = TestObjectFactory.createLoanOffering(
+               "OffsetLoan1", ApplicableTo.GROUPS,
+               new Date(System.currentTimeMillis()),
+               PrdStatus.LOAN_ACTIVE,
+               300.0,1.2,(short)3,
+               InterestType.FLAT, true, true, meeting);
+        
+        return TestObjectFactory.createLoanAccount(
+               "42423142342",group, AccountState.LOANACC_ACTIVEINGOODSTANDING,
+               new Date(System.currentTimeMillis()),loanOffering);
+   }
+}
Index: test/org/mifos/application/ApplicationTestSuite.java
===================================================================
--- test/org/mifos/application/ApplicationTestSuite.java        (revision 12205)
+++ test/org/mifos/application/ApplicationTestSuite.java        (working copy)
@@ -83,6 +83,7 @@
 import org.mifos.framework.util.helpers.FrameworkUtilsSuite;
 import org.mifos.framework.util.helpers.StringToMoneyConverterTest;
 import org.mifos.config.ConfigTestSuite;
+import org.mifos.application.accounts.offsetting.OffsetTestSuite;
 
 public class ApplicationTestSuite extends TestSuite {
 
@@ -107,6 +108,7 @@
                suite.addTest(BulkEntryTestSuite.suite());
                suite.addTest(MasterTestSuite.suite());
                suite.addTest(AccountTestSuite.suite());
+               suite.addTest(OffsetTestSuite.suite());
                suite.addTest(FinancialTestSuite.suite());
                suite.addTestSuite(StringToMoneyConverterTest.class);
                suite.addTest(ConfigurationTestSuite.suite());
Index: src/org/mifos/application/accounts/business/AccountBO.hbm.xml
===================================================================
--- src/org/mifos/application/accounts/business/AccountBO.hbm.xml       
(revision 12205)
+++ src/org/mifos/application/accounts/business/AccountBO.hbm.xml       
(working copy)
@@ -13,6 +13,7 @@
                <version name="versionNo" column="VERSION_NO" type="integer"
                        unsaved-value="null" />
 
+        <property name="offsettingAllowable" column="OFFSETTING_ALLOWABLE" 
type="integer" />
                <property name="globalAccountNum" column="GLOBAL_ACCOUNT_NUM"
                        access="field" />
                <property name="createdBy" column="CREATED_BY" not-null="true"
Index: src/org/mifos/application/accounts/business/AccountBO.java
===================================================================
--- src/org/mifos/application/accounts/business/AccountBO.java  (revision 12205)
+++ src/org/mifos/application/accounts/business/AccountBO.java  (working copy)
@@ -94,6 +94,8 @@
        private Set<AccountCustomFieldEntity> accountCustomFields;
 
        private Date closedDate;
+       
+       private Integer offsettingAllowable;
 
        protected AccountBO() {
                this(null);
@@ -115,6 +117,7 @@
                accountNotes = new HashSet<AccountNotesEntity>();
                accountStatusChangeHistory = new 
HashSet<AccountStatusChangeHistoryEntity>();
                accountFlags = new HashSet<AccountFlagMapping>();
+               offsettingAllowable = new Integer(1);
        }
 
        protected AccountBO(UserContext userContext, CustomerBO customer,
@@ -137,6 +140,7 @@
                this.office = customer.getOffice();
                this.personnel = customer.getPersonnel();
                this.setAccountState(new AccountStateEntity(accountState));
+               offsettingAllowable = new Integer(1);
                setCreateDetails();
                }
 
@@ -1346,4 +1350,12 @@
                }
        }
 
+       public Integer getOffsettingAllowable() {
+               return offsettingAllowable;
+       }
+
+       public void setOffsettingAllowable(Integer offsettingAllowable) {
+               this.offsettingAllowable = offsettingAllowable;
+       }
+
 }
Index: src/org/mifos/framework/persistence/DatabaseVersionPersistence.java
===================================================================
--- src/org/mifos/framework/persistence/DatabaseVersionPersistence.java 
(revision 12205)
+++ src/org/mifos/framework/persistence/DatabaseVersionPersistence.java 
(working copy)
@@ -27,7 +27,7 @@
 
 public class DatabaseVersionPersistence {
 
-       public static final int APPLICATION_VERSION = 159;
+       public static final int APPLICATION_VERSION = 160;
        public static final int FIRST_NUMBERED_VERSION = 100;
 
        public static void register(Map<Integer, Upgrade> register, Upgrade 
upgrade) {
Index: sql/downgrade_from_160.sql
===================================================================
--- sql/downgrade_from_160.sql  (revision 0)
+++ sql/downgrade_from_160.sql  (revision 0)
@@ -0,0 +1,3 @@
+ALTER TABLE ACCOUNT DROP COLUMN OFFSETTING_ALLOWABLE;  
+UPDATE DATABASE_VERSION SET DATABASE_VERSION = 159 WHERE DATABASE_VERSION = 
160;
+  
Index: sql/latest-schema.sql
===================================================================
--- sql/latest-schema.sql       (revision 12205)
+++ sql/latest-schema.sql       (working copy)
@@ -2109,6 +2109,7 @@
   UPDATED_DATE DATE,
   CLOSED_DATE DATE,
   VERSION_NO INTEGER,
+  OFFSETTING_ALLOWABLE SMALLINT NOT NULL,
   PRIMARY KEY(ACCOUNT_ID),
   FOREIGN KEY(ACCOUNT_STATE_ID)
     REFERENCES ACCOUNT_STATE(ACCOUNT_STATE_ID)
Index: sql/upgrade_to_160.sql
===================================================================
--- sql/upgrade_to_160.sql      (revision 0)
+++ sql/upgrade_to_160.sql      (revision 0)
@@ -0,0 +1,4 @@
+ALTER TABLE ACCOUNT ADD COLUMN OFFSETTING_ALLOWABLE SMALLINT NOT NULL;
+UPDATE ACCOUNT SET OFFSETTING_ALLOWABLE = 1 WHERE OFFSETTING_ALLOWABLE IS NULL;
+UPDATE DATABASE_VERSION SET DATABASE_VERSION = 160 WHERE DATABASE_VERSION = 
159;
+  
Index: sql/latest-data.sql
===================================================================
--- sql/latest-data.sql (revision 12205)
+++ sql/latest-data.sql (working copy)
@@ -17,7 +17,7 @@
 -- apply Index.sql
 -- apply all upgrades to date
 
-INSERT INTO DATABASE_VERSION(DATABASE_VERSION) VALUES(159);
+INSERT INTO DATABASE_VERSION(DATABASE_VERSION) VALUES(160);
 
 /* The table Currency holds configuration related items for a currency like 
display symbol,rounding mode etc which is to be applied on a currency -- 
Configuration */
 /* To set the default currency, enter 1 in the default_currency field */
-------------------------------------------------------------------------
This SF.net email is sponsored by: Microsoft
Defy all challenges. Microsoft(R) Visual Studio 2005.
http://clk.atdmt.com/MRT/go/vse0120000070mrt/direct/01/

Reply via email to