Author: deepak
Date: Wed Nov 2 17:49:10 2016 New Revision: 1767746 URL: http://svn.apache.org/viewvc?rev=1767746&view=rev Log: Improved: Added unit test case for following workeffort related services - createWorkEffortAndPartyAssign - deleteWorkEffort - copyWorkEffort - duplicateWorkEffort - makeCommunicationEventWorkEffort - assignPartyToWorkEffort - updatePartyToWorkEffortAssignment - deletePartyToWorkEffortAssignment - quickAssignPartyToWorkEffort (OFBIZ-8619)(OFBIZ-8677)(OFBIZ-8678)(OFBIZ-8679)(OFBIZ-8681)(OFBIZ-8682) (OFBIZ-8683)(OFBIZ-8685)(OFBIZ-8686) Thanks Pawan Verma for your contribution. Added: ofbiz/trunk/applications/workeffort/minilang/test/ ofbiz/trunk/applications/workeffort/minilang/test/WorkEffortTests.xml (with props) ofbiz/trunk/applications/workeffort/testdef/data/ ofbiz/trunk/applications/workeffort/testdef/data/WorkEffortTestData.xml (with props) Modified: ofbiz/trunk/applications/workeffort/testdef/workefforttests.xml Added: ofbiz/trunk/applications/workeffort/minilang/test/WorkEffortTests.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/workeffort/minilang/test/WorkEffortTests.xml?rev=1767746&view=auto ============================================================================== --- ofbiz/trunk/applications/workeffort/minilang/test/WorkEffortTests.xml (added) +++ ofbiz/trunk/applications/workeffort/minilang/test/WorkEffortTests.xml Wed Nov 2 17:49:10 2016 @@ -0,0 +1,203 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +--> + +<simple-methods xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xmlns="http://ofbiz.apache.org/Simple-Method" xsi:schemaLocation="http://ofbiz.apache.org/Simple-Method http://ofbiz.apache.org/dtds/simple-methods.xsd"> + <simple-method method-name="testCreateWorkEffortAndPartyAssign" short-description="Test the service createWorkEffortAndPartyAssign" login-required="false"> + <set field="serviceCtx.partyId" value="TestParty-1"/> + <set field="serviceCtx.roleTypeId" value="CONTACT"/> + <set field="serviceCtx.statusId" value="PAS_ASSIGNED"/> + <set field="serviceCtx.workEffortId" value="TestWorkEffort-1"/> + <set field="serviceCtx.partyTypeId" value="PARTY_GROUP"/> + <set field="serviceCtx.workEffortName" value="Test WorkEffort Event"/> + <set field="serviceCtx.workEffortTypeId" value="TASK"/> + <set field="serviceCtx.currentStatusId" value="PTS_CREATED"/> + <entity-one entity-name="UserLogin" value-field="userLogin"> + <field-map field-name="userLoginId" value="system"/> + </entity-one> + <set field="serviceCtx.userLogin" from-field="userLogin"/> + <call-service service-name="createWorkEffortAndPartyAssign" in-map-name="serviceCtx"> + <result-to-field result-name="workEffortId"/> + </call-service> + <entity-one entity-name="WorkEffort" value-field="workEffort"/> + <set field="lookupKeyValue.workEffortId" from-field="workEffortId"/> + <set field="lookupKeyValue.partyId" value="TestParty-1"/> + <set field="lookupKeyValue.roleTypeId" value="CONTACT"/> + <find-by-and entity-name="WorkEffortPartyAssignment" map="lookupKeyValue" list="workEffortPartyAssignmentList"/> + <first-from-list entry="workEffortPartyAssignment" list="workEffortPartyAssignmentList"/> + <assert> + <not><if-empty field="workEffort"/></not> + <not><if-empty field="workEffortPartyAssignment"/></not> + <if-compare field="workEffort.workEffortTypeId" operator="equals" value="TASK"/> + <if-compare field="workEffort.currentStatusId" operator="equals" value="PTS_CREATED"/> + <if-compare field="workEffortPartyAssignment.statusId" operator="equals" value="PAS_ASSIGNED"/> + </assert> + <check-errors/> + </simple-method> + <simple-method method-name="testDeleteWorkEffort" short-description="Test the service deleteWorkEffort" login-required="false"> + <set field="serviceCtx.workEffortId" value="TestWorkEffort-1"/> + <entity-one entity-name="UserLogin" value-field="userLogin"> + <field-map field-name="userLoginId" value="system"/> + </entity-one> + <set field="serviceCtx.userLogin" from-field="userLogin"/> + <call-service service-name="deleteWorkEffort" in-map-name="serviceCtx"/> + <entity-one entity-name="WorkEffort" value-field="workEffort"> + <field-map field-name="workEffortId" value="TestWorkEffort-1"/> + </entity-one> + <assert> + <if-empty field="workEffort"/> + </assert> + <check-errors/> + </simple-method> + <simple-method method-name="testCopyWorkEffort" short-description="Test the service copyWorkEffort" login-required="false"> + <set field="serviceCtx.sourceWorkEffortId" value="TestWorkeffort-3"/> + <entity-one entity-name="UserLogin" value-field="userLogin"> + <field-map field-name="userLoginId" value="system"/> + </entity-one> + <set field="serviceCtx.userLogin" from-field="userLogin"/> + <call-service service-name="copyWorkEffort" in-map-name="serviceCtx"> + <result-to-field result-name="workEffortId"/> + </call-service> + <entity-one entity-name="WorkEffort" value-field="workEffort"/> + <assert> + <not><if-empty field="workEffort"/></not> + <if-compare operator="equals" field="workEffort.workEffortName" value="New Test Workeffort"/> + </assert> + <check-errors/> + </simple-method> + <simple-method method-name="testDuplicateWorkEffort" short-description="Test the service duplicateWorkEffort" login-required="false"> + <set field="serviceCtx.oldWorkEffortId" value="TestWorkeffort-3"/> + <entity-one entity-name="UserLogin" value-field="userLogin"> + <field-map field-name="userLoginId" value="system"/> + </entity-one> + <set field="serviceCtx.userLogin" from-field="userLogin"/> + <call-service service-name="duplicateWorkEffort" in-map-name="serviceCtx"> + <result-to-field result-name="workEffortId"/> + </call-service> + <entity-one entity-name="WorkEffort" value-field="workEffort"/> + <assert> + <not><if-empty field="workEffort"/></not> + <if-compare operator="equals" field="workEffort.workEffortName" value="New Test Workeffort"/> + </assert> + <check-errors/> + </simple-method> + <simple-method method-name="testMakeCommunicationEventWorkEffort" short-description="Test the service makeCommunicationEventWorkEffort" login-required="false"> + <set field="serviceCtx.communicationEventId" value="TestEvent-1"/> + <set field="serviceCtx.workEffortId" value="TestWorkeffort-3"/> + <entity-one entity-name="UserLogin" value-field="userLogin"> + <field-map field-name="userLoginId" value="system"/> + </entity-one> + <set field="serviceCtx.userLogin" from-field="userLogin"/> + <call-service service-name="makeCommunicationEventWorkEffort" in-map-name="serviceCtx"> + <result-to-field result-name="workEffortId"/> + <result-to-field result-name="communicationEventId"/> + </call-service> + <entity-one entity-name="CommunicationEventWorkEff" value-field="communicationEventWorkEff"/> + <assert> + <not><if-empty field="communicationEventWorkEff"/></not> + </assert> + <check-errors/> + </simple-method> + <simple-method method-name="testAssignPartyToWorkEffort" short-description="Test the service assignPartyToWorkEffort" login-required="false"> + <set field="serviceCtx.partyId" value="TestParty"/> + <set field="serviceCtx.roleTypeId" value="CONTENT_AUTHOR"/> + <set field="serviceCtx.statusId" value="PAS_ASSIGNED"/> + <set field="serviceCtx.workEffortId" value="TestWorkeffort-3"/> + <set field="serviceCtx.fromDate" value="2009-09-09 01:01:01" type="Timestamp"/> + <entity-one entity-name="UserLogin" value-field="userLogin"> + <field-map field-name="userLoginId" value="system"/> + </entity-one> + <set field="serviceCtx.userLogin" from-field="userLogin"/> + <call-service service-name="assignPartyToWorkEffort" in-map-name="serviceCtx"> + <result-to-field result-name="fromDate"/> + </call-service> + <entity-one entity-name="WorkEffortPartyAssignment" value-field="workEffortPartyAssignment"> + <field-map field-name="partyId" value="TestParty"/> + <field-map field-name="roleTypeId" value="CONTENT_AUTHOR"/> + <field-map field-name="workEffortId" value="TestWorkeffort-3"/> + </entity-one> + <assert> + <not><if-empty field="workEffortPartyAssignment"/></not> + </assert> + <check-errors/> + </simple-method> + <simple-method method-name="testUpdatePartyToWorkEffortAssignment" short-description="Test the service updatePartyToWorkEffortAssignment" login-required="false"> + <set field="serviceCtx.partyId" value="TestParty"/> + <set field="serviceCtx.roleTypeId" value="CUSTOMER"/> + <set field="serviceCtx.statusId" value="PRTYASGN_ASSIGNED"/> + <set field="serviceCtx.workEffortId" value="TestWorkeffort-3"/> + <set field="serviceCtx.fromDate" value="2009-09-09 02:02:02" type="Timestamp"/> + <entity-one entity-name="UserLogin" value-field="userLogin"> + <field-map field-name="userLoginId" value="system"/> + </entity-one> + <set field="serviceCtx.userLogin" from-field="userLogin"/> + <call-service service-name="updatePartyToWorkEffortAssignment" in-map-name="serviceCtx"/> + <entity-one entity-name="WorkEffortPartyAssignment" value-field="workEffortPartyAssignment"> + <field-map field-name="partyId" value="TestParty"/> + <field-map field-name="roleTypeId" value="CUSTOMER"/> + <field-map field-name="workEffortId" value="TestWorkeffort-3"/> + <field-map field-name="fromDate" value="2009-09-09 02:02:02"/> + </entity-one> + <assert> + <not><if-empty field="workEffortPartyAssignment"/></not> + <if-compare operator="equals" field="workEffortPartyAssignment.statusId" value="PRTYASGN_ASSIGNED"/> + </assert> + <check-errors/> + </simple-method> + <simple-method method-name="testDeletePartyToWorkEffortAssignment" short-description="Test the service deletePartyToWorkEffortAssignment" login-required="false"> + <set field="serviceCtx.partyId" value="TestParty"/> + <set field="serviceCtx.roleTypeId" value="ACCOUNTANT"/> + <set field="serviceCtx.workEffortId" value="TestWorkeffort-3"/> + <set field="serviceCtx.fromDate" value="2009-09-09 02:02:02" type="Timestamp"/> + <entity-one entity-name="UserLogin" value-field="userLogin"> + <field-map field-name="userLoginId" value="system"/> + </entity-one> + <set field="serviceCtx.userLogin" from-field="userLogin"/> + <call-service service-name="deletePartyToWorkEffortAssignment" in-map-name="serviceCtx"/> + <entity-one entity-name="WorkEffortPartyAssignment" value-field="workEffortPartyAssignment"> + <field-map field-name="partyId" value="TestParty"/> + <field-map field-name="roleTypeId" value="ACCOUNTANT"/> + <field-map field-name="workEffortId" value="TestWorkeffort-3"/> + <field-map field-name="fromDate" value="2009-09-09 02:02:02"/> + </entity-one> + <assert> + <not><if-empty field="workEffortPartyAssignment"/></not> + <not><if-empty field="workEffortPartyAssignment.thruDate"/></not> + </assert> + <check-errors/> + </simple-method> + <simple-method method-name="testQuickAssignPartyToWorkEffort" short-description="Test the service quickAssignPartyToWorkEffort" login-required="false"> + <set field="serviceCtx.quickAssignPartyId" value="TestCompany"/> + <set field="serviceCtx.workEffortId" value="TestWorkeffort-3"/> + <entity-one entity-name="UserLogin" value-field="userLogin"> + <field-map field-name="userLoginId" value="system"/> + </entity-one> + <set field="serviceCtx.userLogin" from-field="userLogin"/> + <call-service service-name="quickAssignPartyToWorkEffort" in-map-name="serviceCtx"/> + <set field="lookupKeyValue.workEffortId" value="TestWorkeffort-3"/> + <set field="lookupKeyValue.partyId" value="TestCompany"/> + <find-by-and entity-name="WorkEffortPartyAssignment" map="lookupKeyValue" list="workEffortPartyAssignmentList"/> + <first-from-list entry="workEffortPartyAssignment" list="workEffortPartyAssignmentList"/> + <assert> + <not><if-empty field="workEffortPartyAssignment"/></not> + </assert> + <check-errors/> + </simple-method> +</simple-methods> \ No newline at end of file Propchange: ofbiz/trunk/applications/workeffort/minilang/test/WorkEffortTests.xml ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ofbiz/trunk/applications/workeffort/minilang/test/WorkEffortTests.xml ------------------------------------------------------------------------------ svn:keywords = Date Rev Author URL Id Propchange: ofbiz/trunk/applications/workeffort/minilang/test/WorkEffortTests.xml ------------------------------------------------------------------------------ svn:mime-type = text/xml Added: ofbiz/trunk/applications/workeffort/testdef/data/WorkEffortTestData.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/workeffort/testdef/data/WorkEffortTestData.xml?rev=1767746&view=auto ============================================================================== --- ofbiz/trunk/applications/workeffort/testdef/data/WorkEffortTestData.xml (added) +++ ofbiz/trunk/applications/workeffort/testdef/data/WorkEffortTestData.xml Wed Nov 2 17:49:10 2016 @@ -0,0 +1,82 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- +Licensed to the Apache Software Foundation (ASF) under one +or more contributor license agreements. See the NOTICE file +distributed with this work for additional information +regarding copyright ownership. The ASF licenses this file +to you under the Apache License, Version 2.0 (the +"License"); you may not use this file except in compliance +with the License. You may obtain a copy of the License at + +http://www.apache.org/licenses/LICENSE-2.0 + +Unless required by applicable law or agreed to in writing, +software distributed under the License is distributed on an +"AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY +KIND, either express or implied. See the License for the +specific language governing permissions and limitations +under the License. +--> + +<entity-engine-xml> + <Party partyId="TestCompany" partyTypeId="PARTY_GROUP" statusId="PARTY_ENABLED"/> + <PartyGroup partyId="TestCompany" groupName="Your Company Name Here"/> + <PartyRole partyId="TestCompany" roleTypeId="BILL_FROM_VENDOR"/> + <PartyRole partyId="TestCompany" roleTypeId="BILL_TO_CUSTOMER"/> + <PartyRole partyId="TestCompany" roleTypeId="INTERNAL_ORGANIZATIO"/> + <PartyRole partyId="TestCompany" roleTypeId="ACCOUNTANT"/> + <PartyRole partyId="TestCompany" roleTypeId="_NA_"/> + <PartyStatus partyId="TestCompany" statusId="PARTY_ENABLED" statusDate="2001-01-01 12:00:00.0"/> + + <Party partyId="TestParty" partyTypeId="PERSON" statusId="PARTY_ENABLED"/> + <Person partyId="TestParty" firstName="Test" lastName="Party"/> + <PartyRole partyId="TestParty" roleTypeId="CONTACT"/> + <PartyRole partyId="TestParty" roleTypeId="CUSTOMER"/> + <PartyRole partyId="TestParty" roleTypeId="ACCOUNTANT"/> + <PartyRole partyId="TestParty" roleTypeId="CONTENT_AUTHOR"/> + <PartyStatus partyId="TestParty" statusId="PARTY_ENABLED" statusDate="2001-01-01 12:00:00.0"/> + + <Party partyId="TestParty-1" partyTypeId="PERSON" statusId="PARTY_ENABLED"/> + <Person partyId="TestParty-1" firstName="Test" lastName="Party"/> + <PartyRole partyId="TestParty-1" roleTypeId="CONTACT"/> + <PartyRole partyId="TestParty-1" roleTypeId="CUSTOMER"/> + <PartyRole partyId="TestParty-1" roleTypeId="ACCOUNTANT"/> + <PartyStatus partyId="TestParty-1" statusId="PARTY_ENABLED" statusDate="2001-01-01 12:00:00.0"/> + + <ContactMech contactMechId="TestContactMech" contactMechTypeId="EMAIL_ADDRESS" infoString="[hidden email]"/> + <ContactMech contactMechId="TestContactMech2" contactMechTypeId="EMAIL_ADDRESS" infoString="[hidden email]"/> + <PartyContactMech partyId="TestCompany" contactMechId="TestContactMech" fromDate="2001-05-13 00:00:00.000"/> + <PartyContactMech partyId="TestParty" contactMechId="TestContactMech2" fromDate="2001-05-13 00:00:00.000"/> + + <WorkEffort workEffortId="TestWorkeffort-2" currentStatusId="PTS_CREATED" workEffortName="Test Workeffort" workEffortTypeId="TASK"/> + <WorkEffort workEffortId="TestWorkeffort-3" currentStatusId="PTS_CREATED" workEffortName="New Test Workeffort" workEffortTypeId="TASK"/> + <WorkEffort workEffortId="TestWorkeffort-4" currentStatusId="PTS_CREATED" workEffortName="New Test Workeffort" workEffortTypeId="TASK"/> + + <WorkEffortPartyAssignment partyId="TestParty" roleTypeId="CONTACT" workEffortId="TestWorkeffort-3" fromDate="2009-09-09 01:01:01" statusId="PAS_ASSIGNED"/> + <WorkEffortPartyAssignment partyId="TestParty" roleTypeId="CUSTOMER" workEffortId="TestWorkeffort-3" fromDate="2009-09-09 02:02:02" statusId="PAS_ASSIGNED"/> + <WorkEffortPartyAssignment partyId="TestParty" roleTypeId="ACCOUNTANT" workEffortId="TestWorkeffort-3" fromDate="2009-09-09 02:02:02" statusId="PAS_ASSIGNED"/> + <WorkEffortPartyAssignment partyId="TestParty-1" roleTypeId="ACCOUNTANT" workEffortId="TestWorkeffort-3" fromDate="2009-09-09 02:02:02" statusId="PAS_ASSIGNED"/> + + <CommunicationEvent communicationEventId="TestEvent-1" communicationEventTypeId="EMAIL_COMMUNICATION" statusId="COM_IN_PROGRESS" contactMechIdFrom="TestContactMech" contactMechIdTo="TestContactMech2" roleTypeIdFrom="BILL_TO_CUSTOMER" roleTypeIdTo="CUSTOMER" partyIdFrom="TestCompany" partyIdTo="TestParty" entryDate="2010-10-27 15:04:17.895" subject="Test Subject 1" contentMimeTypeId="text/plain" /> + + <NoteData noteId="TestNote-1" noteInfo="This is test note."/> + <WorkEffortNote noteId="TestNote-1" workEffortId="TestWorkeffort-3" internalNote="Y"/> + <WorkEffortAssoc workEffortIdFrom="TestWorkeffort-2" workEffortIdTo="TestWorkeffort-3" workEffortAssocTypeId="ROUTING_COMPONENT" sequenceNum="0" fromDate="2001-05-13 00:00:00.000"/> + + <WorkEffortKeyword workEffortId="TestWorkeffort-2" keyword="test keyword" relevancyWeight="1"/> + <WorkEffortKeyword workEffortId="TestWorkeffort-2" keyword="test keyword 2" relevancyWeight="2"/> + <WorkEffortKeyword workEffortId="TestWorkeffort-3" keyword="test keyword" relevancyWeight="2"/> + + <!-- Test data for Timesheet. --> + <Timesheet timesheetId="TestTimesheet-1" partyId="TestParty" statusId="TIMESHEET_COMPLETED" comments="Test timesheet 1"/> + <Timesheet timesheetId="TestTimesheet-2" partyId="TestParty-1" statusId="TIMESHEET_IN_PROCESS" comments="Test timesheet 2"/> + <Timesheet timesheetId="TestTimesheet-3" partyId="TestParty-1" statusId="TIMESHEET_IN_PROCESS" comments="Test timesheet 3"/> + + <TimeEntry timeEntryId="TestTimeEntry-1" hours="8.0" workEffortId="TestWorkeffort-3"/> + <TimeEntry timeEntryId="TestTimeEntry-2" hours="8.0" workEffortId="TestWorkeffort-4"/> + + <Invoice invoiceId="TestInvoice" invoiceTypeId="SALES_INVOICE" partyIdFrom="TestParty" partyId="Company" statusId="INVOICE_READY" invoiceDate="2009-07-06 16:48:40.952" paidDate="2009-07-06 16:52:52.901" dueDate="2009-08-05 16:48:40.952" currencyUomId="USD"/> + <TimeEntry timeEntryId="TestTimeEntry-3" hours="8.0" workEffortId="TestWorkeffort-4" invoiceId="TestInvoice" partyId="TestParty" rateTypeId="STANDARD"/> + + <RateAmount rateTypeId="STANDARD" workEffortId="_NA_" partyId="TestParty" periodTypeId="RATE_HOUR" emplPositionTypeId="_NA_" fromDate="2000-01-01 00:00:00.0" rateAmount="95.00" rateCurrencyUomId="USD"/> +</entity-engine-xml> \ No newline at end of file Propchange: ofbiz/trunk/applications/workeffort/testdef/data/WorkEffortTestData.xml ------------------------------------------------------------------------------ svn:eol-style = native Propchange: ofbiz/trunk/applications/workeffort/testdef/data/WorkEffortTestData.xml ------------------------------------------------------------------------------ svn:keywords = Date Rev Author URL Id Propchange: ofbiz/trunk/applications/workeffort/testdef/data/WorkEffortTestData.xml ------------------------------------------------------------------------------ svn:mime-type = text/xml Modified: ofbiz/trunk/applications/workeffort/testdef/workefforttests.xml URL: http://svn.apache.org/viewvc/ofbiz/trunk/applications/workeffort/testdef/workefforttests.xml?rev=1767746&r1=1767745&r2=1767746&view=diff ============================================================================== --- ofbiz/trunk/applications/workeffort/testdef/workefforttests.xml (original) +++ ofbiz/trunk/applications/workeffort/testdef/workefforttests.xml Wed Nov 2 17:49:10 2016 @@ -21,10 +21,16 @@ xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="http://ofbiz.apache.org/dtds/test-suite.xsd"> <!-- TODO: Move these test implementations to a separate simple methods document --> + <test-case case-name="workeffort-tests-data-load"> + <entity-xml action="load" entity-xml-url="component://workeffort/testdef/data/WorkEffortTestData.xml"/> + </test-case> <test-case case-name="testCreateEventService Direct Simple Method"> <simple-method-test location="component://workeffort/minilang/workeffort/WorkEffortSimpleServices.xml" name="testCreateEventService"/> </test-case> <test-case case-name="testCreateProjectService Direct Simple Method"> <simple-method-test location="component://workeffort/minilang/workeffort/WorkEffortSimpleServices.xml" name="testCreateProjectService"/> </test-case> + <test-case case-name="workeffort-tests"> + <simple-method-test location="component://workeffort/minilang/test/WorkEffortTests.xml"/> + </test-case> </test-suite> |
Free forum by Nabble | Edit this page |