Index: main/waeup.ikoba/trunk/src/waeup/ikoba/customers/tests/test_application.py
===================================================================
--- main/waeup.ikoba/trunk/src/waeup/ikoba/customers/tests/test_application.py	(revision 12096)
+++ 	(revision )
@@ -1,91 +1,0 @@
-## $Id$
-##
-## Copyright (C) 2014 Uli Fouquet & Henrik Bettermann
-## This program is free software; you can redistribute it and/or modify
-## it under the terms of the GNU General Public License as published by
-## the Free Software Foundation; either version 2 of the License, or
-## (at your option) any later version.
-##
-## This program is distributed in the hope that it will be useful,
-## but WITHOUT ANY WARRANTY; without even the implied warranty of
-## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
-## GNU General Public License for more details.
-##
-## You should have received a copy of the GNU General Public License
-## along with this program; if not, write to the Free Software
-## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-##
-"""
-Tests for applications.
-"""
-from zope.interface.verify import verifyClass, verifyObject
-from zope.component import createObject
-from hurry.workflow.interfaces import (
-    IWorkflowInfo, IWorkflowState, InvalidTransitionError)
-from waeup.ikoba.customers.interfaces import (
-    IApplicationsContainer, IApplication)
-from waeup.ikoba.interfaces import IObjectHistory
-from waeup.ikoba.customers.applications import (
-    ApplicationsContainer, SampleApplication)
-from waeup.ikoba.testing import (FunctionalLayer, FunctionalTestCase)
-
-class ApplicationsContainerTestCase(FunctionalTestCase):
-
-    layer = FunctionalLayer
-
-    def test_interfaces(self):
-        # Make sure the correct interfaces are implemented.
-        self.assertTrue(
-            verifyClass(
-                IApplicationsContainer, ApplicationsContainer)
-            )
-        self.assertTrue(
-            verifyObject(
-                IApplicationsContainer, ApplicationsContainer())
-            )
-        self.assertTrue(
-            verifyClass(
-                IApplication, SampleApplication)
-            )
-        self.assertTrue(
-            verifyObject(
-                IApplication, SampleApplication())
-            )
-        return
-
-    def test_addApplication(self):
-        container = ApplicationsContainer()
-        application = createObject(u'waeup.SampleApplication')
-        id = application.application_id
-        container.addApplication(application)
-        self.assertEqual(container[id], application)
-        self.assertRaises(TypeError, container.addApplication, object())
-        self.assertEqual(application.class_name, 'SampleApplication')
-        self.assertEqual(id, 'a123')
-        return
-
-    def test_application_workflow(self):
-        application = createObject(u'waeup.SampleApplication')
-        IWorkflowInfo(application).fireTransition('create')
-        self.assertEqual(IWorkflowState(application).getState(), 'created')
-        IWorkflowInfo(application).fireTransition('submit')
-        self.assertEqual(IWorkflowState(application).getState(), 'submitted')
-        IWorkflowInfo(application).fireTransition('approve')
-        self.assertEqual(IWorkflowState(application).getState(), 'approved')
-        IWorkflowInfo(application).fireTransition('expire')
-        self.assertEqual(IWorkflowState(application).getState(), 'expired')
-        IWorkflowInfo(application).fireTransition('reset4')
-        self.assertEqual(IWorkflowState(application).getState(), 'created')
-        self.assertRaises(InvalidTransitionError,
-            IWorkflowInfo(application).fireTransition, 'approve')
-        IWorkflowInfo(application).fireTransition('submit')
-        IWorkflowInfo(application).fireTransition('reset3')
-        self.assertEqual(IWorkflowState(application).getState(), 'created')
-        return
-
-    def test_application_history(self):
-        doc = createObject(u'waeup.SampleApplication')
-        IWorkflowInfo(doc).fireTransition('create')
-        messages = ' '.join(doc.history.messages)
-        self.assertTrue('Application record created by system' in messages)
-        return
Index: main/waeup.ikoba/trunk/src/waeup/ikoba/customers/tests/test_browser.py
===================================================================
--- main/waeup.ikoba/trunk/src/waeup/ikoba/customers/tests/test_browser.py	(revision 12096)
+++ main/waeup.ikoba/trunk/src/waeup/ikoba/customers/tests/test_browser.py	(revision 12097)
@@ -96,5 +96,5 @@
         self.product.product_id = u'SAM'
         self.product.title = u'Our Samle Product'
-        self.product.application_category = u'sample'
+        self.product.contract_category = u'sample'
         self.app['products'].addProduct(self.product)
 
@@ -114,7 +114,7 @@
         document.title = u'My first document'
         self.customer['documents'].addDocument(document)
-        application = createObject('waeup.SampleApplication')
-        application.title = u'My first application'
-        self.customer['applications'].addApplication(application)
+        contract = createObject('waeup.SampleContract')
+        contract.title = u'My first contract'
+        self.customer['contracts'].addContract(contract)
 
         # Set password
@@ -131,5 +131,5 @@
         self.history_path = self.customer_path + '/history'
         self.documents_path = self.customer_path + '/documents'
-        self.applications_path = self.customer_path + '/applications'
+        self.contracts_path = self.customer_path + '/contracts'
 
         self.app['configuration'].carry_over = True
@@ -1052,9 +1052,9 @@
 
 
-class ApplicationUITests(CustomersFullSetup):
-    # Tests for CustomerSampleApplication relates views and pages
-
-    def test_manage_application(self):
-        # Managers can access the pages of customer applicationsconter
+class ContractUITests(CustomersFullSetup):
+    # Tests for CustomerSampleContract relates views and pages
+
+    def test_manage_contract(self):
+        # Managers can access the pages of customer contractsconter
         # and can perform actions
         self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
@@ -1063,12 +1063,12 @@
         self.assertEqual(self.browser.url, self.customer_path)
         self.browser.open(self.customer_path)
-        self.browser.getLink("Applications").click()
-        self.browser.getLink("Add application").click()
-        self.browser.getControl(name="apptype").value = ['SampleApplication']
-        self.browser.getControl("Create application").click()
-        self.assertTrue('Sample Application created.' in self.browser.contents)
-        application = self.customer['applications']['a102']
-
-        # Application can be edited
+        self.browser.getLink("Contracts").click()
+        self.browser.getLink("Add contract").click()
+        self.browser.getControl(name="apptype").value = ['SampleContract']
+        self.browser.getControl("Create contract").click()
+        self.assertTrue('Sample Contract created.' in self.browser.contents)
+        contract = self.customer['contracts']['a102']
+
+        # Contract can be edited
         self.browser.getLink("a102").click()
         self.browser.getLink("Manage").click()
@@ -1078,5 +1078,5 @@
         self.assertTrue('Form has been saved.' in self.browser.contents)
         self.browser.getLink("View").click()
-        self.assertEqual(self.browser.url, self.applications_path + '/a102/index')
+        self.assertEqual(self.browser.url, self.contracts_path + '/a102/index')
 
         # Transitions can be performed
@@ -1086,10 +1086,10 @@
         self.browser.getControl(name="transition").value = ['approve']
         self.browser.getControl("Save").click()
-        self.assertEqual(application.state, 'approved')
-
-        # Applications can be removed
-        self.browser.getLink("Applications").click()
+        self.assertEqual(contract.state, 'approved')
+
+        # Contracts can be removed
+        self.browser.getLink("Contracts").click()
         ctrl = self.browser.getControl(name='val_id')
-        ctrl.getControl(value=application.application_id).selected = True
+        ctrl.getControl(value=contract.contract_id).selected = True
         self.browser.getControl("Remove selected", index=0).click()
         self.assertTrue('Successfully removed' in self.browser.contents)
@@ -1100,24 +1100,24 @@
         logcontent = open(logfile).read()
         self.assertTrue(
-            'INFO - zope.mgr - customers.browser.ApplicationManageFormPage '
+            'INFO - zope.mgr - customers.browser.ContractManageFormPage '
             '- K1000000 - a102 - saved: title'
             in logcontent)
         self.assertTrue(
-            'INFO - zope.mgr - customers.browser.ApplicationAddFormPage '
-            '- K1000000 - added: Sample Application %s'
-            % application.application_id in logcontent)
-        self.assertTrue(
-            'INFO - zope.mgr - customers.browser.ApplicationsManageFormPage '
+            'INFO - zope.mgr - customers.browser.ContractAddFormPage '
+            '- K1000000 - added: Sample Contract %s'
+            % contract.contract_id in logcontent)
+        self.assertTrue(
+            'INFO - zope.mgr - customers.browser.ContractsManageFormPage '
             '- K1000000 - removed: %s'
-            % application.application_id in logcontent)
-
-    def test_edit_sample_application(self):
+            % contract.contract_id in logcontent)
+
+    def test_edit_sample_contract(self):
         # We add a second product.
         product = createObject('waeup.Product')
         product.product_id = u'LIC'
         product.title = u'Our License Product'
-        product.application_category = u'license'
+        product.contract_category = u'license'
         self.app['products'].addProduct(product)
-        # Customers can manage applications under certain conditions
+        # Customers can manage contracts under certain conditions
         self.browser.open(self.login_path)
         self.browser.getControl(name="form.login").value = self.customer_id
@@ -1126,65 +1126,65 @@
         self.assertMatches(
             '...You logged in...', self.browser.contents)
-        self.browser.getLink("Applications").click()
-        self.browser.getLink("Add application").click()
-        self.browser.getControl(name="apptype").value = ['SampleApplication']
-        self.browser.getControl("Create application").click()
-        self.assertTrue('Sample Application created.' in self.browser.contents)
-        application = self.customer['applications']['a102']
-        # Application can be edited ...
+        self.browser.getLink("Contracts").click()
+        self.browser.getLink("Add contract").click()
+        self.browser.getControl(name="apptype").value = ['SampleContract']
+        self.browser.getControl("Create contract").click()
+        self.assertTrue('Sample Contract created.' in self.browser.contents)
+        contract = self.customer['contracts']['a102']
+        # Contract can be edited ...
         self.browser.getLink("a102").click()
-        self.browser.open(self.applications_path + '/a102/edit')
+        self.browser.open(self.contracts_path + '/a102/edit')
         #self.browser.getLink("Edit").click()
         self.assertTrue('The requested form is locked' in self.browser.contents)
         # Customer is in wrong state
         IWorkflowState(self.customer).setState(APPROVED)
-        self.browser.open(self.applications_path + '/a102/edit')
+        self.browser.open(self.contracts_path + '/a102/edit')
         self.browser.getControl(name="form.title").value = 'My second app'
-        # SAM is in the correct application_category ...
+        # SAM is in the correct contract_category ...
         self.assertTrue('<option value="SAM">' in self.browser.contents)
         # ... but NOTSAM not.
         self.assertFalse('<option value="LIC">' in self.browser.contents)
         # So far last_product_id is None.
-        self.assertTrue(self.customer['applications']['a102'].last_product_id is None)
+        self.assertTrue(self.customer['contracts']['a102'].last_product_id is None)
         self.browser.getControl(name="form.product").value = ['SAM']
         self.browser.getControl("Save").click()
         # After saving the form, last_product_id is set.
-        self.assertEqual(self.customer['applications']['a102'].last_product_id, 'SAM')
+        self.assertEqual(self.customer['contracts']['a102'].last_product_id, 'SAM')
         self.assertTrue('Form has been saved.' in self.browser.contents)
         # Saving the form again does not unset last_product_id
-        self.assertEqual(application.title, 'My second app')
-        self.browser.getControl("Save").click()
-        self.assertEqual(self.customer['applications']['a102'].last_product_id, 'SAM')
+        self.assertEqual(contract.title, 'My second app')
+        self.browser.getControl("Save").click()
+        self.assertEqual(self.customer['contracts']['a102'].last_product_id, 'SAM')
         self.assertTrue('Form has been saved.' in self.browser.contents)
         self.browser.getLink("View").click()
-        self.assertEqual(self.browser.url, self.applications_path + '/a102/index')
+        self.assertEqual(self.browser.url, self.contracts_path + '/a102/index')
         # Customer can submit the form. The form is also saved.
         self.browser.getLink("Edit").click()
         self.browser.getControl(name="form.title").value = 'My third app'
         self.browser.getControl("Apply now").click()
-        self.assertEqual(application.title, 'My third app')
-        self.assertEqual(application.state, 'submitted')
-        self.assertTrue('Application State: submitted for approval' in self.browser.contents)
-        # Customer can't edit the application once it has been submitted
-        self.browser.open(self.applications_path + '/a102/edit')
+        self.assertEqual(contract.title, 'My third app')
+        self.assertEqual(contract.state, 'submitted')
+        self.assertTrue('Contract State: submitted for approval' in self.browser.contents)
+        # Customer can't edit the contract once it has been submitted
+        self.browser.open(self.contracts_path + '/a102/edit')
         self.assertTrue('The requested form is locked' in self.browser.contents)
 
     def test_view_slips(self):
         self.browser.addHeader('Authorization', 'Basic mgr:mgrpw')
-        # Officers can open the application overview
-        self.browser.open(self.customer_path + '/applications')
-        self.browser.getLink("Download applications overview").click()
+        # Officers can open the contract overview
+        self.browser.open(self.customer_path + '/contracts')
+        self.browser.getLink("Download contracts overview").click()
         self.assertEqual(self.browser.headers['Status'], '200 Ok')
         self.assertEqual(self.browser.headers['Content-Type'], 'application/pdf')
-        path = os.path.join(samples_dir(), 'applications_overview_slip.pdf')
+        path = os.path.join(samples_dir(), 'contracts_overview_slip.pdf')
         open(path, 'wb').write(self.browser.contents)
         print "Sample PDF overview_slip.pdf written to %s" % path
-        # Officers can open application slips
-        self.browser.open(self.customer_path + '/applications/a101')
-        self.browser.getLink("Download application slip").click()
+        # Officers can open contract slips
+        self.browser.open(self.customer_path + '/contracts/a101')
+        self.browser.getLink("Download contract slip").click()
         self.assertEqual(self.browser.headers['Status'], '200 Ok')
         self.assertEqual(self.browser.headers['Content-Type'], 'application/pdf')
-        path = os.path.join(samples_dir(), 'application_slip.pdf')
+        path = os.path.join(samples_dir(), 'contract_slip.pdf')
         open(path, 'wb').write(self.browser.contents)
-        print "Sample application_slip.pdf written to %s" % path
-
+        print "Sample contract_slip.pdf written to %s" % path
+
Index: main/waeup.ikoba/trunk/src/waeup/ikoba/customers/tests/test_catalog.py
===================================================================
--- main/waeup.ikoba/trunk/src/waeup/ikoba/customers/tests/test_catalog.py	(revision 12096)
+++ main/waeup.ikoba/trunk/src/waeup/ikoba/customers/tests/test_catalog.py	(revision 12097)
@@ -27,5 +27,5 @@
 from waeup.ikoba.testing import FunctionalLayer, FunctionalTestCase
 from waeup.ikoba.customers.customer import Customer
-from waeup.ikoba.customers.applications import SampleApplication
+from waeup.ikoba.customers.contracts import SampleContract
 
 
@@ -61,16 +61,16 @@
         product.product_id = u'SAM'
         product.title = u'Our Samle Product'
-        product.application_category = u'sample'
+        product.contract_category = u'sample'
         self.app['products'].addProduct(product)
         self.product_id = product.product_id
         self.product = self.app['products'][self.product_id]
 
-        application = createObject('waeup.SampleApplication')
-        application.title = u'My Samle Application'
-        application.product = product
-        application.last_product_id = product.product_id
-        self.customer['applications'].addApplication(application)
-        self.application_id = application.application_id
-        self.application = self.customer['applications'][self.application_id]
+        contract = createObject('waeup.SampleContract')
+        contract.title = u'My Samle Contract'
+        contract.product = product
+        contract.last_product_id = product.product_id
+        self.customer['contracts'].addContract(contract)
+        self.contract_id = contract.contract_id
+        self.contract = self.customer['contracts'][self.contract_id]
 
         document = createObject('waeup.CustomerSampleDocument')
@@ -125,5 +125,5 @@
 
     def test_search_by_id(self):
-        # We can find a certain application id
+        # We can find a certain contract id
         cat = queryUtility(ICatalog, name='documents_catalog')
         results = cat.searchResults(document_id=(self.document_id,
@@ -134,5 +134,5 @@
 
 
-class ApplicationsCatalogTests(CatalogTestSetup):
+class ContractsCatalogTests(CatalogTestSetup):
 
     layer = FunctionalLayer
@@ -140,45 +140,45 @@
     def test_get_catalog(self):
         # We can get an customers catalog if we wish
-        cat = queryUtility(ICatalog, name='applications_catalog')
+        cat = queryUtility(ICatalog, name='contracts_catalog')
         assert cat is not None
 
     def test_search_by_id(self):
-        # We can find a certain application id
-        cat = queryUtility(ICatalog, name='applications_catalog')
-        results = cat.searchResults(application_id=(self.application_id,
-                                                self.application_id))
+        # We can find a certain contract id
+        cat = queryUtility(ICatalog, name='contracts_catalog')
+        results = cat.searchResults(contract_id=(self.contract_id,
+                                                self.contract_id))
         results = [x for x in results] # Turn results generator into list
         assert len(results) == 1
-        assert results[0] is self.customer['applications'][self.application_id]
+        assert results[0] is self.customer['contracts'][self.contract_id]
 
     def test_search_by_category(self):
         # We can find a certain name
-        cat = queryUtility(ICatalog, name='applications_catalog')
-        results = cat.searchResults(application_category=('sample', 'sample'))
+        cat = queryUtility(ICatalog, name='contracts_catalog')
+        results = cat.searchResults(contract_category=('sample', 'sample'))
         results = [x for x in results] # Turn results generator into list
         assert len(results) == 1
-        assert results[0] is self.customer['applications'][self.application_id]
+        assert results[0] is self.customer['contracts'][self.contract_id]
 
     def test_search_by_last_product_id(self):
         # We can find a certain name
-        cat = queryUtility(ICatalog, name='applications_catalog')
+        cat = queryUtility(ICatalog, name='contracts_catalog')
         results = cat.searchResults(last_product_id=('SAM', 'SAM'))
         results = [x for x in results] # Turn results generator into list
         assert len(results) == 1
-        assert results[0] is self.customer['applications'][self.application_id]
+        assert results[0] is self.customer['contracts'][self.contract_id]
         assert results[0].product is self.product
 
     def test_product_removal(self):
         # This test does not only test catalog components, it also ensures
-        # that the product attribute of an application is cleared
+        # that the product attribute of an contract is cleared
         # but the last_product_id is not.
         del self.app['products'][self.product_id]
-        self.assertTrue(self.application.product is None)
-        self.assertEqual(self.application.last_product_id, 'SAM')
-        cat = queryUtility(ICatalog, name='applications_catalog')
+        self.assertTrue(self.contract.product is None)
+        self.assertEqual(self.contract.last_product_id, 'SAM')
+        cat = queryUtility(ICatalog, name='contracts_catalog')
         results = cat.searchResults(last_product_id=('SAM', 'SAM'))
         results = [x for x in results]
         assert len(results) == 1
-        assert results[0] is self.customer['applications'][self.application_id]
+        assert results[0] is self.customer['contracts'][self.contract_id]
         assert results[0].product is None
         # Product removal is being logged in customers.log
Index: main/waeup.ikoba/trunk/src/waeup/ikoba/customers/tests/test_contract.py
===================================================================
--- main/waeup.ikoba/trunk/src/waeup/ikoba/customers/tests/test_contract.py	(revision 12097)
+++ main/waeup.ikoba/trunk/src/waeup/ikoba/customers/tests/test_contract.py	(revision 12097)
@@ -0,0 +1,91 @@
+## $Id$
+##
+## Copyright (C) 2014 Uli Fouquet & Henrik Bettermann
+## This program is free software; you can redistribute it and/or modify
+## it under the terms of the GNU General Public License as published by
+## the Free Software Foundation; either version 2 of the License, or
+## (at your option) any later version.
+##
+## This program is distributed in the hope that it will be useful,
+## but WITHOUT ANY WARRANTY; without even the implied warranty of
+## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+## GNU General Public License for more details.
+##
+## You should have received a copy of the GNU General Public License
+## along with this program; if not, write to the Free Software
+## Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
+##
+"""
+Tests for contracts.
+"""
+from zope.interface.verify import verifyClass, verifyObject
+from zope.component import createObject
+from hurry.workflow.interfaces import (
+    IWorkflowInfo, IWorkflowState, InvalidTransitionError)
+from waeup.ikoba.customers.interfaces import (
+    IContractsContainer, IContract)
+from waeup.ikoba.interfaces import IObjectHistory
+from waeup.ikoba.customers.contracts import (
+    ContractsContainer, SampleContract)
+from waeup.ikoba.testing import (FunctionalLayer, FunctionalTestCase)
+
+class ContractsContainerTestCase(FunctionalTestCase):
+
+    layer = FunctionalLayer
+
+    def test_interfaces(self):
+        # Make sure the correct interfaces are implemented.
+        self.assertTrue(
+            verifyClass(
+                IContractsContainer, ContractsContainer)
+            )
+        self.assertTrue(
+            verifyObject(
+                IContractsContainer, ContractsContainer())
+            )
+        self.assertTrue(
+            verifyClass(
+                IContract, SampleContract)
+            )
+        self.assertTrue(
+            verifyObject(
+                IContract, SampleContract())
+            )
+        return
+
+    def test_addContract(self):
+        container = ContractsContainer()
+        contract = createObject(u'waeup.SampleContract')
+        id = contract.contract_id
+        container.addContract(contract)
+        self.assertEqual(container[id], contract)
+        self.assertRaises(TypeError, container.addContract, object())
+        self.assertEqual(contract.class_name, 'SampleContract')
+        self.assertEqual(id, 'a123')
+        return
+
+    def test_contract_workflow(self):
+        contract = createObject(u'waeup.SampleContract')
+        IWorkflowInfo(contract).fireTransition('create')
+        self.assertEqual(IWorkflowState(contract).getState(), 'created')
+        IWorkflowInfo(contract).fireTransition('submit')
+        self.assertEqual(IWorkflowState(contract).getState(), 'submitted')
+        IWorkflowInfo(contract).fireTransition('approve')
+        self.assertEqual(IWorkflowState(contract).getState(), 'approved')
+        IWorkflowInfo(contract).fireTransition('expire')
+        self.assertEqual(IWorkflowState(contract).getState(), 'expired')
+        IWorkflowInfo(contract).fireTransition('reset4')
+        self.assertEqual(IWorkflowState(contract).getState(), 'created')
+        self.assertRaises(InvalidTransitionError,
+            IWorkflowInfo(contract).fireTransition, 'approve')
+        IWorkflowInfo(contract).fireTransition('submit')
+        IWorkflowInfo(contract).fireTransition('reset3')
+        self.assertEqual(IWorkflowState(contract).getState(), 'created')
+        return
+
+    def test_contract_history(self):
+        doc = createObject(u'waeup.SampleContract')
+        IWorkflowInfo(doc).fireTransition('create')
+        messages = ' '.join(doc.history.messages)
+        self.assertTrue('Contract record created by system' in messages)
+        return
