how to printout the complex contract generated by bonita test toolkit

1
0
-1

hello,

I would like to print out the contents of the complex multi contract created by bonita test toolkit...

========= here is the code for creating contract

var task1Contract = ContractBuilder.newContract()
    .complexInput("orderInput", ComplexInputBuilder.complexInput()
        .textInput("totalFee", "10")
        .textInput("status", "Received")
        .textInput("orderDate", "2021-10-10T00:00:00Z")
        .textInput("OrderSource", "Front Counter")
        .textInput("applicantFirstName", "QaSample1Fn")
        .textInput("applicantLastName", "QaSample1Ln")
        .textInput("miscInfo", "This is created via Test Toolkit")
        .textInput("notes",  "Order created from Toolkit")
        .booleanInput("funeralHome",  false)
        .complexInput("certHolder", ComplexInputBuilder.complexInput()
                .multipleTextInput("applicantRelationship", List.of("Other","Guardian"))
                .multipleTextInput("firstName",List.of("Justin","Ava"))
                .multipleTextInput("lastName", List.of("Wagner","Moreno"))
                .multipleIntegerInput("age", List.of(5, 4))
                .complexInput("service", ComplexInputBuilder.complexInput()
                                .multipleTextInput("eventType" , List.of("Birth", "Birth"))
                                .multipleTextInput("serviceType",List.of("Regular", "Regular"))
                                .multipleTextInput("service",List.of("Certified Copy: Normal", "Certified Copy: Normal"))
                                .multipleTextInput("eventCounty",List.of("Baltimore", "Baltimore"))
                                .multipleTextInput("eventDate", List.of ("2021-10-10T00:00:00Z", "2021-10-10T00:00:00Z"))
                                .multipleIntegerInput("fee",List.of(0, 0))
                                .multipleIntegerInput("quantity", List.of(1, 1)))))
    .build();

============== it's being rejected when I try to start the process

com.bonitasoft.test.toolkit.exception.StartProcessException:
status: 400
:
{"exception":"class org.bonitasoft.engine.bpm.contract.ContractViolationException","message":"Error while validating expected inputs","explanations":["{firstName=[Justin, Ava], lastName=[Wagner, Moreno], applicantRelationship=[Other
, Guardian], service={serviceType=[Regular, Regular], quantity=[1, 1], eventCounty=[Baltimore, Baltimore], service=[Certified Copy: Normal, Certified Copy: Normal], fee=[0, 0], eventType=[Birth, Birth], eventDate=[2021-10-10, 2021-1
0-10]}, age=[5, 4]} cannot be assigned to multiple COMPLEX type","{applicantLastName=QaSample1Ln, notes=Order created from Toolkit, totalFee=10, funeralHome=false, miscInfo=This is creating using Test Toolkit, certHolder={firstName=
[Justin, Ava], lastName=[Wagner, Moreno], applicantRelationship=[Other, Guardian], service={serviceType=[Regular, Regular], quantity=[1, 1], eventCounty=[Baltimore, Baltimore], service=[Certified Copy: Normal, Certified Copy: Normal
], fee=[0, 0], eventType=[Birth, Birth], eventDate=[2021-10-10, 2021-10-10]}, age=[5, 4]}, OrderSource=Front Counter, applicantFirstName=QaSample1Fn, orderDate=2021-10-10T00:00Z, status=Received} cannot be assigned to COMPLEX type"]
}
at com.company.bonita.test._WOMSOrderIT.should_create_FC_woms_order(_WOMS_ProcessIT.java:108)

=============

when I try printing out the contract

  • System.out.println(task1Contract);

after it's built I get

  • com.bonitasoft.test.toolkit.internal.contract.ContractImpl@1949309d

Comments

Submitted by RegnerRudy on Thu, 08/17/2023 - 17:47

when I analyze the error message, it looks like the contract is being sent as both multiple complex and just regular complex ... how is that possible?

{"exception":"class org.bonitasoft.engine.bpm.contract.ContractViolationException","message":"Error while validating expected inputs","explanations":["

{firstName=[Justin, Ava],

lastName=[Wagner, Moreno],

applicantRelationship=[Other, Guardian],

service={serviceType=[Regular, Regular],

quantity=[1, 1],

eventCounty=[Baltimore, Baltimore],

service=[Certified Copy: Normal, Certified Copy: Normal],

fee=[0, 0],

eventType=[Birth, Birth],

eventDate=[2021-10-10, 2021-10-10]},

age=[5, 4]}

cannot be assigned to multiple COMPLEX type","

===============

{applicantLastName=QaSample1Ln,

notes=Order created from Toolkit,

totalFee=10,

funeralHome=false,

miscInfo=This is creating using Test Toolkit,

certHolder={firstName=[Justin, Ava],

lastName=[Wagner, Moreno],

applicantRelationship=[Other, Guardian],

service={serviceType=[Regular, Regular],

quantity=[1, 1],

eventCounty=[Baltimore, Baltimore],

service=[Certified Copy: Normal, Certified Copy: Normal], fee=[0, 0],

eventType=[Birth, Birth],

eventDate=[2021-10-10, 2021-10-10]},

age=[5, 4]},

OrderSource=Front Counter,

applicantFirstName=QaSample1Fn,

orderDate=2021-10-10T00:00Z,

status=Received}

cannot be assigned to COMPLEX type"]

}

Submitted by RegnerRudy on Thu, 08/17/2023 - 21:57

this question can be closed.

thank you.

1 answer

1
+1
-1
This one is the BEST answer!

my friend gave me the answer as to why the contract was not built correctly

I was getting the multipleComplexInputs mixed up with using lists

=================

var orderInputContract = ContractBuilder.newContract()
.complexInput("orderInput", ComplexInputBuilder.complexInput()
.textInput("applicantEmail", "")
.textInput("applicantPhone", "")
.textInput("applicantStreetAddres", "")
.textInput("applicantCity", "")
.textInput("applicantState", "")
.textInput("applicantZipCode", "")
.textInput("applicantSignature", "")
.textInput("applicantTitle", "")
.textInput("applicantLicenseNo", "")
.textInput("payments", "")
.textInput("vitalChekOrderAmount", "")
.textInput("dvrAccountId", "")
.textInput("voidLegacyId", "")
.textInput("voidId", "")
.textInput("applicantPhoneType", "")
.textInput("sourceOrderId", "")
.integerInput("orderId", 1234)
.textInput("totalFee", "10")
.textInput("status", "Received")
.textInput("orderDate", "2021-10-10T00:00:00Z")
.textInput("orderSource", "Front Counter")
.textInput("applicantFirstName", "QaSample1Fn")
.textInput("applicantLastName", "QaSample1Ln")
.textInput("miscInfo", "This is creating using Test Toolkit")
.textInput("notes", "Order created from Toolkit")
.booleanInput("funeralHome", false)
.multipleComplexInput("certHolder", List.of(ComplexInputBuilder.complexInput()
.textInput("middleName ", "")
.textInput("sex", "")
.textInput("newFirstName", "")
.textInput("newLastName", "")
.textInput("ssn", "")
.textInput("motherFirstName", "")
.textInput("motherLastName", "")
.textInput("motherMaidenName", "")
.textInput("fatherFirstName", "")
.textInput("fatherLastName", "")
.textInput("applicantRelationship", "Guardian")
.textInput("firstName", "Robert")
.textInput("lastName", "Woods")
.integerInput("age", 4)
.multipleComplexInput("service", List.of(ComplexInputBuilder.complexInput()
.textInput("reasonRequestingCert", "")
.textInput("spouseFirstName", "")
.textInput("spouseLastName", "")
.textInput("spouse2FirstName", "")
.textInput("spouse2LastName", "")
.textInput("personRepresentedFirstName", "")
.textInput("personRepresentedLastName", "")
.textInput("reasonDivorce", "")
.textInput("certNumber", "")
.multipleFileInput("attachments", List.of())
.textInput("facility", "")
.textInput("funeralHomeOrder", "")
.textInput("distribution", "")
.textInput("eventType", "Birth")
.textInput("serviceType", "Regular")
.textInput("service", "Certified Copy: Normal")
.textInput("eventCounty", "Baltimore")
.textInput("eventDate", "2022-07-01T00:00:00Z")
.decimalInput("fee", 10.0)
.integerInput("quantity", 1))))))
.build();

Comments

Submitted by romain.bioteau on Fri, 08/18/2023 - 09:04

Hi, I'll add having a toString() implementation for Contract in the TODO list. Thanks for the feedback.

Romain

Submitted by RegnerRudy on Fri, 08/18/2023 - 13:47

thanks @Romain... much appreciated.

-Rudy

Notifications