Where communities thrive


  • Join over 1.5M+ people
  • Join over 100K+ communities
  • Free without limits
  • Create your own community
People
Repo info
Activity
  • Jan 20 18:14

    spencergibb on main

    Changes class to use to check p… (compare)

  • Jan 19 13:31

    marcingrzejszczak on main

    Update BodyConverter.java (#174… (compare)

  • Jan 19 13:31
    marcingrzejszczak closed #1748
  • Jan 19 13:31
    marcingrzejszczak milestoned #1748
  • Jan 19 13:31
    marcingrzejszczak labeled #1748
  • Jan 18 09:41

    marcingrzejszczak on main

    Makes the code compile (compare)

  • Jan 18 09:38

    marcingrzejszczak on main

    Makes the code compile (compare)

  • Jan 17 14:51
    pivotal-cla commented #1748
  • Jan 17 14:45
    pivotal-cla commented #1748
  • Jan 17 14:45
    Reborn4Ever opened #1748
  • Jan 15 10:42

    marcingrzejszczak on snyk-fix-8fa43ed6bb902543c8d7569a54e36608

    (compare)

  • Jan 15 10:42

    marcingrzejszczak on snyk-fix-8fa43ed6bb902543c8d7569a54e36608

    fix: pom.xml to reduce vulnerab… (compare)

  • Jan 15 10:42

    marcingrzejszczak on snyk-fix-8fa43ed6bb902543c8d7569a54e36608

    (compare)

  • Jan 15 10:42

    marcingrzejszczak on snyk-fix-ba7908c657774184862ac273be3251f5

    (compare)

  • Jan 15 10:42

    marcingrzejszczak on snyk-fix-ba7908c657774184862ac273be3251f5

    fix: pom.xml to reduce vulnerab… (compare)

  • Jan 15 10:42

    marcingrzejszczak on snyk-fix-ba7908c657774184862ac273be3251f5

    (compare)

  • Jan 15 10:42

    marcingrzejszczak on snyk-fix-d3cd5e13d125485719f64d995b3d092e

    (compare)

  • Jan 15 10:42

    marcingrzejszczak on snyk-fix-d3cd5e13d125485719f64d995b3d092e

    fix: pom.xml to reduce vulnerab… (compare)

  • Jan 15 10:41

    marcingrzejszczak on snyk-fix-d3cd5e13d125485719f64d995b3d092e

    (compare)

  • Jan 15 10:41

    marcingrzejszczak on snyk-fix-567509c6277077754afdaac976f67017

    (compare)

Marcin Grzejszczak
@marcingrzejszczak
I don't really know what the exception is can you provide the full stacktrace
Monika Gupta
@monikagupta:matrix.org
[m]
thats the problem its not showing any exception at all
Marcin Grzejszczak
@marcingrzejszczak
it has to you need to turn on gradle --stacktrace or logs at info / debug to see what exactly the problem is
Monika Gupta
@monikagupta:matrix.org
[m]
2022-01-20T20:09:28.996+0530 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]
2022-01-20T20:09:28.996+0530 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] FAILURE: Build failed with an exception.
2022-01-20T20:09:28.997+0530 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]
2022-01-20T20:09:28.997+0530 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * What went wrong:
2022-01-20T20:09:28.997+0530 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] Execution failed for task ':generateContractTests'.
2022-01-20T20:09:28.998+0530 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] > Spring Cloud Contract Verifier Plugin exception: Process 'command '/Library/Java/JavaVirtualMachines/adoptopenjdk-11.jdk/Contents/Home/bin/java'' finished with non-zero exit value 1
2022-01-20T20:09:28.998+0530 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]
2022-01-20T20:09:28.998+0530 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * Try:
2022-01-20T20:09:28.998+0530 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] Run with --stacktrace option to get the stack trace. Run with --scan to get full insights.
2022-01-20T20:09:28.999+0530 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter]
2022-01-20T20:09:28.999+0530 [ERROR] [org.gradle.internal.buildevents.BuildExceptionReporter] * Get more help at https://help.gradle.org
2022-01-20T20:09:28.999+0530 [WARN] [org.gradle.internal.featurelifecycle.LoggingDeprecatedFeatureHandler]
Deprecated Gradle features were used in this build, making it incompatible with Gradle 8.0.

You can use '--warning-mode all' to show the individual deprecation warnings and determine if they come from your own scripts or plugins.

See https://docs.gradle.org/7.2/userguide/command_line_interface.html#sec:command_line_warnings
2022-01-20T20:09:29.000+0530 [ERROR] [org.gradle.internal.buildevents.BuildResultLogger]
2022-01-20T20:09:29.000+0530 [ERROR] [org.gradle.internal.buildevents.BuildResultLogger] BUILD FAILED in 39s
these are the only error logs I can see
these are some other exception logs
Monika Gupta
@monikagupta:matrix.org
[m]
is it failing for usage of testMatchers in .groovy files ?
Marcin Grzejszczak
@marcingrzejszczak
I don't see anything in the logs about it, however we have removed some code from the groovy api so maybe you should migrate to the new ones
Monika Gupta
@monikagupta:matrix.org
[m]
which version of groovy I should use ?
currently using 2.5.7
Marcin Grzejszczak
@marcingrzejszczak
I'm not talking about Groovy but Groovy Contract in Spring Cloud Contract. We deprecated some methods there so maybe that's why it's failing - I think you haven't pasted the whole log
jakub-bochenski
@jakub-bochenski
How can I refer to a "new" json key in Groovy contract? The first one works, but the inner one gives ':' unexpected error
        body(
                'new' : {
                    'new' : "aa"
                }
        )
jakub-bochenski
@jakub-bochenski
I guess I need to use [ instead of {
Nusky Azhar
@nuskyazhar

Hey guys, I have a webflux project where rest endpoints are defined with @RouterOperation annotation and handlers for those routes are defined as RouterFunctions

@RouterOperation(
path="/customer",
method=GET,
operation=@Operation(
parameters={
@Parameter(in=QUERY,name=id)
}
)
)
RouterFunction<ServerResponse> routs(CustomerHandler ch, BusinessHandler bh){
return RouterFunctions.route("/customer", ch::getCustomer).andRoute("/business", bh::getBusiness);
}

I want to set up RestAssuredWebTestClient.standaloneSetup(pass the router function here)

How do we set it up?

Monika Gupta
@monikagupta:matrix.org
[m]
hi @marcingrzejszczak thanks for the help yesterday I was able to resolve issue .. but I'm facing one more issue once contractfiles are generated , ContractVerifierUtil.java isnt able to load file even though file is present in same folder @Test
public void validate_assignWork() throws Exception {
// given:
MockMvcRequestSpecification request = given()
.header("Content-Type", "application/json")
.body(fileToBytes(this, "assignWork_request_assignWorkRequest.json"));
1 reply
its not able to load this file assignWork_request_assignWorkRequest.json
are there any changes specific to this as well
I am trying to migrate from 2.2.0 to 3.0.5

package sync

import org.springframework.cloud.contract.spec.Contract

/ Endpoint to assignWork based on query /
Contract.make {
request {
method 'POST'
url '/api/workassignment/workInstruction/assignWork'
body(file("payload/request/assignWorkRequest.json"))
headers {
contentType(applicationJson())
}
}
response {
status 200
body(file("payload/response/assignWorkResponse.json"))
bodyMatchers {
jsonPath('$.data', byType())
jsonPath('$.data[0].ItemId', byEquality())
jsonPath('$.data[0].AcceptedQuantity', byEquality())
jsonPath('$.data[0].Status', byType())
jsonPath('$.data[0].Status.StatusId', byEquality())
jsonPath('$.data[0].Zone', byEquality())
jsonPath('$.data[0].InstructionType.InstructionTypeId', byEquality())
jsonPath('$.data[0].InstructionType', byType())
jsonPath('$.data[0].WorkInstructionId', byEquality())
jsonPath('$.data[0].Sequence', byEquality())
jsonPath('$.data[0].DestinationLpn', byEquality())
jsonPath('$.data[0].WorkAssignmentId.WorkAssignmentId', byEquality())
jsonPath('$.data[0].WorkAssignmentId', byType())
jsonPath('$.data[0].Item', byType())
jsonPath('$.data[0].Item.Barcode', byType())
jsonPath('$.data[0].Item.Barcode[0]', byEquality())
jsonPath('$.data[0].Item.Barcode[1]', byEquality())
jsonPath('$.data[0].SourceLocation', byType())
jsonPath('$.data[0].SourceLocation.Aisle', byEquality())
jsonPath('$.data[0].SourceLocation.Level', byEquality())
jsonPath('$.data[0].SourceLocation.Bay', byEquality())
jsonPath('$.data[0].SourceLocation.Position', byEquality())
jsonPath('$.data[0].SourceLocation.Alias', byEquality())
jsonPath('$.data[0].SourceLocation.CheckDigit', byEquality())
}
headers {
contentType(applicationJson())
}
}
}

Monika Gupta
@monikagupta:matrix.org
[m]
I tried to change file to fileAsBytes too but still same issue
Marcin Grzejszczak
@marcingrzejszczak
but if your json is in the same folder as test you should reference this as assignWorkResponse.json" and not payload/response/assignWorkResponse.json"
Monika Gupta
@monikagupta:matrix.org
[m]
this is how generated tests look like
but SyncTest this file isnt able to load assignWork_request_assignWorkRequest.json file
they are in same package
Farroque Ariff
@Farroque

Hi,

regarding https://cloud.spring.io/spring-cloud-contract/2.0.x/single/spring-cloud-contract.html#_async_support

Is the async() value in spring cloud contract groovy/yaml contract having effect even when converted into pact JSON?

In our use case we transform to pact & it does not seem to get encoded

So when the verifier generates the test using the pact the test does not work properly..

1 reply
Defrim Hasani
@defrimhasani
hi @marcingrzejszczak
is there any known issues on windows vs unix ant patterns when picking contracts and generating tests.
When I run build the project in windows, it generates 0 tests, but when I do the same using WSL2 it picks the right files.
Marcin Grzejszczak
@marcingrzejszczak
that sounds like a bug
Defrim Hasani
@defrimhasani

`
WINDOWS
[INFO] --- spring-cloud-contract-maven-plugin:3.0.2:generateTests (default-generateTests) @ report-collection-service ---
[INFO] Generating server tests source code for Spring Cloud Contract Verifier contract verification
[INFO] Download dependency is provided - will retrieve contracts from a remote location
[INFO] Passed username and password - will set a custom credentials provider
[INFO] Cloning repo from [https://gitlab.saas-p.com/ptx/payments/report-collection-service-contracts.git] to [C:\Users\DEFRIM~1.HAS\AppData\Local\Temp\1\git-contracts-1642714661487-0]
[INFO] Cloned repo to [C:\Users\DEFRIM~1.HAS\AppData\Local\Temp\1\git-contracts-1642714661487-0]
[INFO] Won't check out the same branch. Skipping
[INFO] Will pick a pattern from the contractPath property
[INFO] Pattern to pick contracts equals [^C:\Users\DEFRIM~1.HAS\AppData\Local\Temp\1\git-contracts-1642714661487-0\contracts\com.bottomline.ptx\rcs\v1(\)?.\\\.$]
[INFO] Ant Pattern to pick files equals [////]
[INFO] Directory with contract is present at [C:\Users\DEFRIM~1.HAS\AppData\Local\Temp\1\git-contracts-1642714661487-0\contracts\com.bottomline.ptx\rcs\v1]
[INFO] Test Source directory: C:\Users\defrim.hasani\Bottomline\Projects\PTXPayments\RCS\report-collection-service\target\generated-test-sources\contracts added.
[INFO] Using [null] as base class for test classes, [null] as base package for tests, [com.bottomline.ptx.rcs.contracts] as package with base classes, base class mappings []
[INFO] Generated 0 test classes.

WSL
[INFO] --- spring-cloud-contract-maven-plugin:3.0.2:generateTests (default-generateTests) @ report-collection-service ---
[INFO] Generating server tests source code for Spring Cloud Contract Verifier contract verification
[INFO] Download dependency is provided - will retrieve contracts from a remote location
[INFO] Passed username and password - will set a custom credentials provider
[INFO] Cloning repo from [https://gitlab.saas-p.com/ptx/payments/report-collection-service-contracts.git] to [/tmp/git-contracts-1642715065710-0]
[INFO] Cloned repo to [/tmp/git-contracts-1642715065710-0]
[INFO] Won't check out the same branch. Skipping
[INFO] Will pick a pattern from the contractPath property
[INFO] Pattern to pick contracts equals [^/tmp/git-contracts-1642715065710-0/contracts/com.bottomline.ptx/rcs/v1(/)?./.$]
[INFO] Ant Pattern to pick files equals [//]
[INFO] Directory with contract is present at [/tmp/git-contracts-1642715065710-0/contracts/com.bottomline.ptx/rcs/v1]
[INFO] Test Source directory: /mnt/c/Users/defrim.hasani/bottomline/projects/PTXPayments/RCS/report-collection-service/target/generated-test-sources/contracts added.
[INFO] Using [null] as base class for test classes, [null] as base package for tests, [com.bottomline.ptx.rcs.contracts] as package with base classes, base class mappings []
[INFO] Creating new class file [/mnt/c/Users/defrim.hasani/bottomline/projects/PTXPayments/RCS/report-collection-service/target/generated-test-sources/contracts/com/bottomline/ptx/rcs/contracts/LoginToBacsTest.java]
[INFO] Generated 1 test classes.
`

Marcin Grzejszczak
@marcingrzejszczak
are you using the latest version cause I remember that those have been fixed a long time ago
oh 3.0.2
yeah sth is wrong
Defrim Hasani
@defrimhasani
We tried that on two windows machines - same behaviour
Marcin Grzejszczak
@marcingrzejszczak
must be a bug
you could theoretically configure the plugin to provide the pattern manually AFAIR
as a workaround
Defrim Hasani
@defrimhasani
do you have any config doc for configuring this manually?
Marcin Grzejszczak
@marcingrzejszczak
try setting contractsPath manually
Defrim Hasani
@defrimhasani
ok we added <includedFiles>*</includedFiles> and it picked then up
not sure if it's expected to work, but it did
Marcin Grzejszczak
@marcingrzejszczak
whatever works, whatever works :D
Defrim Hasani
@defrimhasani
thanks again Marcin - appreciated.
Marcin Grzejszczak
@marcingrzejszczak
no problem
Farroque Ariff
@Farroque
@marcingrzejszczak if the async might be missing from the pact - any recommendation on what can be done to get that to work? We write the contract in groovy but convert to pact and use that everywhere
1 reply
Farroque Ariff
@Farroque
Thanks, will check. Also, any pointers/tip to help get a head start on the PactConverter are much appreciated
and the other way round
Farroque Ariff
@Farroque
👍