Skip to content
This repository has been archived by the owner on Apr 26, 2021. It is now read-only.

RDM-4217 - Create Case Data with document attachment in perftest env #16

Open
wants to merge 23 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from 18 commits
Commits
Show all changes
23 commits
Select commit Hold shift + click to select a range
4bdc0bb
Added extra config parameters to simualate real user conditions duri…
Jul 26, 2018
27ce73d
Added extra config parameters to simualate real user conditions duri…
Jul 26, 2018
a3bd088
Added extra config parameters to simualate real user conditions duri…
Jul 30, 2018
6daf565
Merge branch 'master' of github.com:hmcts/ccd-test-performance
Jul 30, 2018
26ecfa1
Doc Store Performance Test added
Aug 14, 2018
15a4e77
Ignore mac files and results
Aug 14, 2018
7e87c7e
added ES endpoint tests
Oct 31, 2018
74f8a73
Amended ES scenarion
Nov 1, 2018
738cfc8
Align SPROD CCD Data
Mar 12, 2019
baaa325
Adding Probate Data Injection
Mar 22, 2019
5c83999
adding DIV & SSCS create case data
Mar 25, 2019
6de74a7
Adding updated config
Mar 25, 2019
c21ae2f
RDM-4217 Create Case Data with Document attached
Jun 11, 2019
491138f
Removing listofcases csv and SPROD, Sandbox environment configuration
Jun 12, 2019
caf42db
add gradle scripts
Jun 17, 2019
f78ff5c
Merge branch 'master' of https://github.com/hmcts/ccd-test-performanc…
Jun 17, 2019
94744e4
Merge branch 'master' of https://github.com/hmcts/ccd-test-performanc…
Jun 17, 2019
10bbf06
Merge branch 'master' of https://github.com/hmcts/ccd-test-performanc…
Jun 17, 2019
212dae4
Addressing giri's comments
Jun 19, 2019
3134fb5
Addressing reviewing comments from Giri - Moving Elastic Search test …
Jun 19, 2019
d007f60
Removing build folder
Jun 19, 2019
d77d02f
Removing .gradle folder
Jun 19, 2019
ea80273
Updated application.conf and removed the sensitive info
Jun 19, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,3 +5,4 @@ results/
src.zip
.DS_Store
/gatling.log
*.zip
Binary file modified gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
3 changes: 1 addition & 2 deletions gradle/wrapper/gradle-wrapper.properties
Original file line number Diff line number Diff line change
@@ -1,6 +1,5 @@
#Thu Apr 11 15:34:33 BST 2019
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.3-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-4.10.2-all.zip
26 changes: 22 additions & 4 deletions src/test/resources/application.conf
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ localhost {
"1547820791714750", "1547036690988904", "1545234546871901", "1548253985508219", "1547200037389206"]
//getCaseUrl = "caseworkers/"${userCcdId}"/jurisdictions/PROBATE/case-types/GrantOfRepresentation/cases/:case_reference"
getCaseUrl = "internal/cases/:case_reference"
// getPaginationMetadataUrl = "caseworkers/"${userCcdId}"/jurisdictions/PROBATE/case-types/GrantOfRepresentation/cases/pagination_metadata?state=CaseCreated"
// getPaginationMetadataUrl = "caseworkers/"${userCcdId}"/jurisdictions/PROBATE/case-types/GrantOfRepresentation/cases/pagination_metadata?state=CaseCreated"
getPaginationMetadataUrl = "caseworkers/"${userCcdId}"/jurisdictions/PROBATE/case-types/GrantOfRepresentation/cases/pagination_metadata?state=CaseCreated&case.PersonLastName=unknown"
createCaseUrl = "caseworkers/"${userCcdId}"/jurisdictions/SSCS/case-types/Benefit/cases"
getUserProfileUrl = "caseworkers/538/profile"
Expand Down Expand Up @@ -245,19 +245,37 @@ cnp_perftest {
oAuth2clientSecret = "${IDAM_OAUTH2_CLIENT_SECRET}"

cases = ["1559642192860544"]
getCaseUrl = "internal/cases/:case_reference"
ccdCaseMgmtUrl = "https://ccd-case-management-web-perftest.service.core-compute-perftest.internal"
getCaseUrl = "aggregated/caseworkers/a2fe2e87-94f7-44a9-a272-5c413a4775c0/jurisdictions/AUTOTEST1/case-types/AAT/cases/1531212825013102"
getCaseUrlV2 = "internal/cases/1559642192860544"
createCaseUrl = "caseworkers/a2fe2e87-94f7-44a9-a272-5c413a4775c0/jurisdictions/:jurisdictions_reference/case-types/:casetype_reference/cases"
validateCaseUrl = "caseworkers/176475/jurisdictions/AUTOTEST1/case-types/AAT/cases"
getUserProfileUrl = "caseworkers/176475/profile"
getUserProfileUrl = "caseworkers/a2fe2e87-94f7-44a9-a272-5c413a4775c0/profile"
getUserProfileUrlV2 = "caseworkers/539560/profile"
searchCases = "aggregated/caseworkers/176475/jurisdictions/AUTOTEST1/case-types/AAT/cases?state=CaseCreated"
getPaginationMetadataUrl = "caseworkers/176475/jurisdictions/AUTOTEST1/case-types/AAT/cases/pagination_metadata?state=CaseCreated"
saveEventUrl = "caseworkers/176475/jurisdictions/AUTOTEST1/case-types/CASETYPE2/cases/1531207599597587/events"
searchInputDetails = "aggregated/caseworkers/176475/jurisdictions/AUTOTEST1/case-types/AAT/inputs"
workbasketInputDetails = "/aggregated/caseworkers/176475/jurisdictions/AUTOTEST1/case-types/AAT/work-basket-inputs"
getPrintableDocumentsForEvent = "caseworkers/176475/jurisdictions/AUTOTEST1/case-types/CASETYPE2/cases/1531207599597587/documents"
validateCaseDetails = "caseworkers/176475/jurisdictions/AUTOTEST1/case-types/AAT/validate"
docStoreBashURL = "https://dm-store-perftest.service.core-compute-perftest.internal"
ESSearch = "searchCases"
docStoreBashURL123 = "https://dm-store-perftest.service.core-compute-perftest.internal"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

docStoreBashURL123? what does that means?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

docStoreBashURL123 not needed. removed

docStoreBashURL = "https://gateway-ccd.perftest.platform.hmcts.net"
prodSSCSWorkBasket = "aggregated/caseworkers/560966/jurisdictions/SSCS/case-types/Benefit/cases?view=WORKBASKET&page=1&case.caseReference=test1234567"
prodSSCSPagination = "caseworkers/560966/jurisdictions/SSCS/case-types/Benefit/cases/pagination_metadata?case.caseReference=test123456"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

560966 used in multiple places. Duplication problem. Perhaps extract in a variable and reuse it?

prodDIVORCED8caseReference = "aggregated/caseworkers/560966/jurisdictions/DIVORCE/case-types/DIVORCE/cases?page=1&case.D8caseReference=EZ12D81234"
prodDIVORCED8caseReferencePagination = "caseworkers/560966/jurisdictions/DIVORCE/case-types/DIVORCE/cases/pagination_metadata?case.D8caseReference=EZ12D81234"
createCaseDIVUrl = "caseworkers/81d4aa29-7ba2-4884-a5a4-e2a0211bfe7c/jurisdictions/:jurisdictions_reference/case-types/:casetype_reference/cases"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

createCaseDIVUrl, createCaseSSCSUrl, createCaseCMCUrl... all duplicated. Needs sorting out

createCaseSSCSUrl = "caseworkers/81d4aa29-7ba2-4884-a5a4-e2a0211bfe7c/jurisdictions/:jurisdictions_reference/case-types/:casetype_reference/cases"
createCaseCMCUrl = "caseworkers/81d4aa29-7ba2-4884-a5a4-e2a0211bfe7c/jurisdictions/:jurisdictions_reference/case-types/:casetype_reference/cases"
createCaseProbateGrantApplicationUrl = "caseworkers/81d4aa29-7ba2-4884-a5a4-e2a0211bfe7c/jurisdictions/:jurisdictions_reference/case-types/:casetype_reference/cases"
createCaseProbateCaveatApplicationUrl = "caseworkers/81d4aa29-7ba2-4884-a5a4-e2a0211bfe7c/jurisdictions/:jurisdictions_reference/case-types/:casetype_reference/cases"
createIACaseAppURL = "caseworkers/81d4aa29-7ba2-4884-a5a4-e2a0211bfe7c/jurisdictions/:jurisdictions_reference/case-types/:casetype_reference/cases"
createFPLCaseAppURL = "caseworkers/77a5a58b-4d17-43b1-8df4-5cccd6cb1472/jurisdictions/:jurisdictions_reference/case-types/:casetype_reference/cases"
createFRCaseAppURL = "caseworkers/44d5d0eb-0739-49e6-8c5e-bd556ef633d2/jurisdictions/:jurisdictions_reference/case-types/:casetype_reference/cases"
createETHOSCaseAppURL = "caseworkers/b1d866d5-2e78-454a-b18a-95020d0bb603/jurisdictions/:jurisdictions_reference/case-types/:casetype_reference/cases"
saveEventETHOSUploadDocsUrl = "caseworkers/30b48b61-7abf-4747-9270-8e86f466c0d6/jurisdictions/PUBLICLAW/case-types/TRIB_MVP_3_TYPE_Manc/cases/1559571632599539/events"
}

cnp_saat {
Expand Down
Binary file added src/test/resources/bodies/1MB.pdf
Binary file not shown.
2 changes: 2 additions & 0 deletions src/test/resources/data/listoffiles.csv
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
filename
1MB.pdf
Original file line number Diff line number Diff line change
@@ -0,0 +1,130 @@
package uk.gov.hmcts.ccd.corecasedata.scenarios

import io.gatling.core.Predef._
import io.gatling.http.Predef._
import uk.gov.hmcts.ccd.util.{CcdTokenGenerator, PerformanceTestsConfig}

import scala.concurrent.duration._
import scala.util.Random


object CreateDIVCaseDataKJ extends PerformanceTestsConfig {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can you rename this object to CreateDIVCaseData without KJ?

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This file is not needed under scenario folder so removed


// val EventId = "applyForGrant"
private val rng: Random = new Random()
private def d8MarriagePetitionerName(): String = rng.alphanumeric.take(10).mkString
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You could have created this definition probably in PerformanceTestConfig or another abstract class CreateCaseData with a generic name and used it in the scenario like
("D8MarriagePetitionerName", getRandomGeneratedString())

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

As we discussed about this already for each case field we need to enter data with different length so would prefer to keep it like this.

private def d8MarriageRespondentName(): String = rng.alphanumeric.take(10).mkString
private def d8PetitionerEmail(): String = rng.alphanumeric.take(10).mkString
private def d8caseReference(): Int = rng.nextInt(9999)
private def d8PetitionerPhoneNumber(): Int = rng.nextInt(99999999)
private def d8PetitionerFirstName(): String = rng.alphanumeric.take(10).mkString
private def d8PetitionerLastName(): String = rng.alphanumeric.take(10).mkString
private def d8RespondentFirstName(): String = rng.alphanumeric.take(10).mkString
private def d8RespondentLastName(): String = rng.alphanumeric.take(10).mkString
private def d8DerivedPetitionerCurrentFullName(): String = rng.alphanumeric.take(10).mkString
private def caseSummaryText(): String = rng.alphanumeric.take(20).mkString
private def caseDescriptionText(): String = rng.alphanumeric.take(30).mkString
private def burnid(): Int = rng.nextInt(99999999)
private def d8MarriageDate(): Int = rng.nextInt(999)

// val EventId = "CREATE"
val randcaseType = new Random(System.currentTimeMillis())
val caseEventTypeValue = Array("CREATE")
val caseTypeValue_random_index = randcaseType.nextInt(caseEventTypeValue.length)
val EventId = caseEventTypeValue(caseTypeValue_random_index)
def PickCaseType(): String = EventId
//def PickCaseType(): String = caseEventTypeValue(randcaseType.nextInt(caseEventTypeValue.length))

println("caseTypeText Value " + EventId)
println("caseTypeText Value " + PickCaseType())

var CreateCaseUrl = caseDataUrl(config.getString("createCaseDIVUrl"))

println("create case url: " + CreateCaseUrl)

val caseTypeValue = Array("DIVORCE")
//val caseTypeValue = Array("ATCASETYPE1","ATCASETYPE2","ATCASETYPE3","ATCASETYPE4")
val jurisdictionsValue = Array("DIVORCE")

val rand = new Random(System.currentTimeMillis())
val caseType_random_index = rand.nextInt(caseTypeValue.length)

val jurisdictions_random_index = rand.nextInt(jurisdictionsValue.length)

if(!CreateCaseUrl.contains(":casetype_reference"))
{
CreateCaseUrl
}
else{
CreateCaseUrl = CreateCaseUrl.replace(":casetype_reference", caseTypeValue(caseType_random_index))
}

println("create case url: " + CreateCaseUrl)

if(!CreateCaseUrl.contains(":jurisdictions_reference"))
{
CreateCaseUrl
}
else{
CreateCaseUrl = CreateCaseUrl.replace(":jurisdictions_reference", jurisdictionsValue(jurisdictions_random_index))
}

println("create case url: " + CreateCaseUrl)
val CreateCaseTokenUrl = s"${CreateCaseUrl.replaceAll("cases", "")}event-triggers/$EventId/token"


println("create case url: " + CreateCaseUrl)
println("create case token url: " + CreateCaseTokenUrl)

val EventBodyMain =StringBody("""{"data":{"D8legalProcess":"divorce","createdDate":"2018-10-10","D8ScreenHasMarriageBroken":"No","D8ScreenHasRespondentAddress":"Yes","D8ScreenHasMarriageCert":"No","D8ScreenHasPrinter":"Yes","D8DivorceWho":"husband","D8MarriageIsSameSexCouple":"No","D8InferredPetitionerGender":"male","D8InferredRespondentGender":"female","D8MarriedInUk":"Yes","D8CertificateInEnglish":"Yes","D8CertifiedTranslation":"No","D8MarriagePlaceOfMarriage":"London","D8CountryName":"UK","D8PetitionerNameDifferentToMarriageCert":"No","D8PetitionerPhoneNumber":"07${D8PetitionerPhoneNumber}","D8DerivedPetitionerCurrentFullName":"Robert Del monte ${D8DerivedPetitionerCurrentFullName}","D8PetitionerNameChangedHow":["marriageCertificate","deedPoll"],"D8PetitionerNameChangedHowOtherDetails":"Namechangedwithnoreason","D8PetitionerContactDetailsConfidential":"keep","D8PetitionerHomeAddress":{"AddressLine1":"14AvenueRoad","AddressLine2":"RevenueLane","AddressLine3":null,"PostCode":"W45XR","PostTown":"Chiswick","County":"Middlesex","Country":"UK"},"D8DerivedPetitionerHomeAddress":"Sameasabove","D8PetitionerCorrespondenceAddress":{"AddressLine1":null,"AddressLine2":null,"AddressLine3":null,"PostCode":null,"PostTown":null,"County":null,"Country":null},"D8DerivedPetitionerCorrespondenceAddr":"Sameasabove","D8PetitionerCorrespondenceUseHomeAddress":"Yes","D8RespondentNameAsOnMarriageCertificate":"Yes","D8DerivedRespondentCurrentName":"Dimarta","D8DerivedRespondentSolicitorDetails":"NotKnown","D8RespondentHomeAddress":{"AddressLine1":"15AvenueRoad","AddressLine2":"RevenueLane","AddressLine3":null,"PostCode":"W45XR","PostTown":"Chiswick","County":"Middlesex","Country":"UK"},"D8DerivedRespondentHomeAddress":"sameasabove","D8RespondentCorrespondenceAddress":{"AddressLine1":null,"AddressLine2":null,"AddressLine3":null,"PostCode":null,"PostTown":null,"County":null,"Country":null},"D8DerivedRespondentCorrespondenceAddr":"sameasabove","D8RespondentSolicitorName":"RickSick","D8RespondentSolicitorCompany":"DivorcedSolicitors","D8RespondentCorrespondenceSendToSol":"Yes","D8RespondentSolicitorAddress":{"AddressLine1":"16AvenueRoad","AddressLine2":"RevenueLane","AddressLine3":null,"PostCode":"W45XR","PostTown":"Chiswick","County":"Middlesex","Country":"UK"},"D8DerivedRespondentSolicitorAddr":"sameasabove","D8RespondentCorrespondenceUseHomeAddress":"Yes","D8RespondentKnowsHomeAddress":"Yes","D8RespondentLivesAtLastAddress":"No","D8LivingArrangementsTogetherSeparated":"Yes","D8LivingArrangementsLastLivedTogether":"No","D8LivingArrangementsLiveTogether":"Yes","D8LivingArrangementsLastLivedTogethAddr":{"AddressLine1":null,"AddressLine2":null,"AddressLine3":null,"PostCode":null,"PostTown":null,"County":null,"Country":null},"D8DerivedLivingArrangementsLastLivedAddr":"sameasabove","D8LegalProceedings":"No","D8LegalProceedingsRelated":["property","marriage"],"D8LegalProceedingsDetails":null,"D8ReasonForDivorce":"separation-2-years","D8DerivedStatementOfCase":null,"D8ReasonForDivorceBehaviourDetails":null,"D8ReasonForDivorceDesertionDate":"2019-12-12","D8ReasonForDivorceDesertionAgreed":"No","D8ReasonForDivorceDesertionDetails":null,"D8ReasonForDivorceSeperationDate":"2017-10-10","D8ReasonForDivorceAdultery3rdPartyFName":null,"D8ReasonForDivorceAdultery3rdPartyLName":null,"D8DerivedReasonForDivorceAdultery3dPtyNm":null,"D8ReasonForDivorceAdulteryDetails":"notknown","D8ReasonForDivorceAdulteryKnowWhen":"Yes","D8ReasonForDivorceAdulteryWishToName":"No","D8ReasonForDivorceAdulteryKnowWhere":"Yes","D8ReasonForDivorceAdulteryWhereDetails":"notknown","D8ReasonForDivorceAdulteryWhenDetails":"notknown","D8ReasonForDivorceAdulteryIsNamed":"Yes","D8ReasonForDivorceAdultery3rdAddress":{"AddressLine1":"17AvenueRoad","AddressLine2":"RevenueLane","AddressLine3":null,"PostCode":"W45XR","PostTown":"Chiswick","County":"Middlesex","Country":"UK"},"D8DerivedReasonForDivorceAdultery3rdAddr":"sameasabove","D8FinancialOrder":"No","D8FinancialOrderFor":["petitioner"],"D8HelpWithFeesAppliedForFees":"Yes","D8HelpWithFeesReferenceNumber":null,"D8PaymentMethod":"card","D8DivorceCostsClaim":"No","D8DivorceIsNamed":"No","D8DivorceClaimFrom":["respondent","correspondent"],"D8JurisdictionConfidentLegal":"Yes","D8JurisdictionConnection":["A","C","E","F"],"D8JurisdictionLastTwelveMonths":"Yes","D8JurisdictionPetitionerDomicile":"No","D8JurisdictionPetitionerResidence":"Yes","D8JurisdictionRespondentDomicile":"No","D8JurisdictionRespondentResidence":"Yes","D8JurisdictionHabituallyResLast6Months":"No","Payments":[],"D8DocumentsUploaded":[],"D8DocumentsGenerated":[],"D8StatementOfTruth":"No","D8Cohort":"onlineSubmissionPrivateBeta","AosLetterHolderId":null,"D8caseReference":"EZ12D8${D8caseReference}","D8DivorceUnit":"eastMidlands","D8MarriageDate":"1${D8MarriageDate}-10-10","D8MarriagePetitionerName":"Francis Dela Cruz ${D8MarriagePetitionerName}","D8MarriageRespondentName":"Cruz Dela Francis ${D8MarriageRespondentName}","D8PetitionerFirstName":"Della ${D8PetitionerFirstName}","D8PetitionerLastName":"Francis ${D8PetitionerLastName}","D8PetitionerEmail":"dela_${D8PetitionerEmail}@francis.com","D8RespondentFirstName":"Dimello ${D8RespondentFirstName}","D8RespondentLastName":"Best ${D8RespondentLastName}","D8HelpWithFeesNeedHelp":"Yes","dueDate":"2019-10-10","SolPaymentHowToPay":"feePayByAccount","burnID":"10${burnID}","receivedDate":"2019-01-10"},"event":{"id":"create","summary": "Performance Testing Event summary ${CaseSummaryText}","description": "Performance Testing Event description ${CaseDescriptionText}"},"event_token": """" + "${eventToken}" + """","ignore_warning":false,"draft_id":null}""")


val token = CcdTokenGenerator.generateGatewayS2SToken()
val userToken = CcdTokenGenerator.generateWebUserToken()


val CreateDIVCaseDataSCN = scenario("Create DIV Case Data").during(TotalRunDuration minutes) {
exec(
_.setAll(
("D8MarriagePetitionerName", d8MarriagePetitionerName()),
("D8MarriageRespondentName", d8MarriageRespondentName()),
("D8caseReference", d8caseReference()),
("D8PetitionerPhoneNumber",d8PetitionerPhoneNumber()),
("D8PetitionerFirstName",d8PetitionerFirstName()),
("D8PetitionerLastName",d8PetitionerLastName()),
("D8DerivedPetitionerCurrentFullName",d8DerivedPetitionerCurrentFullName()),
("CaseSummaryText",caseSummaryText()),
("CaseDescriptionText",caseDescriptionText()),
("D8PetitionerEmail", d8PetitionerEmail()),
("burnID",burnid()),
("D8RespondentFirstName",d8RespondentFirstName()),
("D8RespondentLastName",d8RespondentLastName()),
("PickCaseEventType",PickCaseType()),
("D8MarriageDate", d8MarriageDate())
)
).exec(
//http("get create case event token")
http("TX01_CCD_CreateCaseEndpoint_Divorce_createcase_eventtoken")
.get(CreateCaseTokenUrl)
.header("ServiceAuthorization", token)
.header("Authorization", userToken)
.header("Content-Type","application/json")
.check(status.is(200),jsonPath("$.token").saveAs("eventToken"))
).exec(
//http("create case data")
http("TX02_CCD_CreateCaseEndpoint_Divorce_createcasedata")
.post(CreateCaseUrl)
.body(EventBodyMain).asJson
.header("ServiceAuthorization", token)
.header("Authorization", userToken)
.header("Content-Type","application/json")
.check(status is 201)
)

.pause(MinThinkTime seconds, MaxThinkTime seconds)
}


val waitForNextIteration = pace(MinWaitForNextIteration seconds, MaxWaitForNextIteration seconds)
}

Loading