Coder Social home page Coder Social logo

quarkus-mockserver's Introduction

quarkus-mockserver's People

Contributors

actions-user avatar andrejpetras avatar dependabot[bot] avatar dlucasd avatar gastaldi avatar kamma31 avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar

quarkus-mockserver's Issues

With quarkus 3.11.0 I get NoClassDefFoundError on MockServerClient init

Mockserver seems to use some transitive dependencies from quarkus which seems to be removed in 3.11.0

  • 'io.swagger.core.v3:swagger-core'
  • 'com.github.fge:jackson-coreutils'
io.swagger.v3.oas.models.media.Schemajava.lang.NoClassDefFoundError: io/swagger/v3/oas/models/media/Schema
	at org.mockserver.serialization.serializers.schema.SchemaSerializer.<init>(SchemaSerializer.java:25)
	at org.mockserver.serialization.ObjectMapperFactory.addSerializers(ObjectMapperFactory.java:203)
	at org.mockserver.serialization.ObjectMapperFactory.buildObjectMapperWithDeserializerAndSerializers(ObjectMapperFactory.java:164)
	at org.mockserver.serialization.ObjectMapperFactory.createObjectMapper(ObjectMapperFactory.java:56)
	at org.mockserver.serialization.serializers.string.NottableStringSerializer.<clinit>(NottableStringSerializer.java:24)
	at org.mockserver.serialization.ObjectMapperFactory.addSerializers(ObjectMapperFactory.java:203)
	at org.mockserver.serialization.ObjectMapperFactory.buildObjectMapperWithDeserializerAndSerializers(ObjectMapperFactory.java:164)
	at org.mockserver.serialization.ObjectMapperFactory.createObjectMapper(ObjectMapperFactory.java:56)
	at org.mockserver.serialization.serializers.body.JsonSchemaBodyDTOSerializer.<clinit>(JsonSchemaBodyDTOSerializer.java:21)
	at org.mockserver.serialization.ObjectMapperFactory.addSerializers(ObjectMapperFactory.java:203)
	at org.mockserver.serialization.ObjectMapperFactory.buildObjectMapperWithDeserializerAndSerializers(ObjectMapperFactory.java:164)
	at org.mockserver.serialization.ObjectMapperFactory.createObjectMapper(ObjectMapperFactory.java:56)
	at org.mockserver.serialization.serializers.body.JsonSchemaBodySerializer.<clinit>(JsonSchemaBodySerializer.java:21)
	at org.mockserver.serialization.ObjectMapperFactory.addSerializers(ObjectMapperFactory.java:203)
	at org.mockserver.serialization.ObjectMapperFactory.buildObjectMapperWithDeserializerAndSerializers(ObjectMapperFactory.java:164)
	at org.mockserver.serialization.ObjectMapperFactory.createObjectMapper(ObjectMapperFactory.java:56)
	at org.mockserver.serialization.serializers.body.JsonBodyDTOSerializer.<clinit>(JsonBodyDTOSerializer.java:22)
	at org.mockserver.serialization.ObjectMapperFactory.addSerializers(ObjectMapperFactory.java:203)
	at org.mockserver.serialization.ObjectMapperFactory.buildObjectMapperWithDeserializerAndSerializers(ObjectMapperFactory.java:164)
	at org.mockserver.serialization.ObjectMapperFactory.createObjectMapper(ObjectMapperFactory.java:56)
	at org.mockserver.serialization.serializers.body.JsonBodySerializer.<clinit>(JsonBodySerializer.java:21)
	at org.mockserver.serialization.ObjectMapperFactory.addSerializers(ObjectMapperFactory.java:203)
	at org.mockserver.serialization.ObjectMapperFactory.buildObjectMapperWithDeserializerAndSerializers(ObjectMapperFactory.java:164)
	at org.mockserver.serialization.ObjectMapperFactory.createObjectMapper(ObjectMapperFactory.java:56)
	at org.mockserver.serialization.serializers.request.OpenAPIDefinitionDTOSerializer.<clinit>(OpenAPIDefinitionDTOSerializer.java:19)
	at org.mockserver.serialization.ObjectMapperFactory.addSerializers(ObjectMapperFactory.java:203)
	at org.mockserver.serialization.ObjectMapperFactory.buildObjectMapperWithDeserializerAndSerializers(ObjectMapperFactory.java:164)
	at org.mockserver.serialization.ObjectMapperFactory.createObjectMapper(ObjectMapperFactory.java:56)
	at org.mockserver.serialization.serializers.request.OpenAPIDefinitionSerializer.<clinit>(OpenAPIDefinitionSerializer.java:19)
	at org.mockserver.serialization.ObjectMapperFactory.addSerializers(ObjectMapperFactory.java:203)
	at org.mockserver.serialization.ObjectMapperFactory.buildObjectMapperWithDeserializerAndSerializers(ObjectMapperFactory.java:164)
	at org.mockserver.serialization.ObjectMapperFactory.createObjectMapper(ObjectMapperFactory.java:56)
	at org.mockserver.serialization.serializers.expectation.OpenAPIExpectationDTOSerializer.<clinit>(OpenAPIExpectationDTOSerializer.java:19)
	at org.mockserver.serialization.ObjectMapperFactory.addSerializers(ObjectMapperFactory.java:203)
	at org.mockserver.serialization.ObjectMapperFactory.buildObjectMapperWithDeserializerAndSerializers(ObjectMapperFactory.java:164)
	at org.mockserver.serialization.ObjectMapperFactory.createObjectMapper(ObjectMapperFactory.java:56)
	at org.mockserver.serialization.serializers.expectation.OpenAPIExpectationSerializer.<clinit>(OpenAPIExpectationSerializer.java:19)
	at org.mockserver.serialization.ObjectMapperFactory.addSerializers(ObjectMapperFactory.java:203)
	at org.mockserver.serialization.ObjectMapperFactory.buildObjectMapperWithDeserializerAndSerializers(ObjectMapperFactory.java:164)
	at org.mockserver.serialization.ObjectMapperFactory.createObjectMapper(ObjectMapperFactory.java:56)
	at org.mockserver.serialization.deserializers.string.NottableStringDeserializer.<clinit>(NottableStringDeserializer.java:25)
	at org.mockserver.serialization.ObjectMapperFactory.addDeserializers(ObjectMapperFactory.java:170)
	at org.mockserver.serialization.ObjectMapperFactory.buildObjectMapperWithDeserializerAndSerializers(ObjectMapperFactory.java:163)
	at org.mockserver.serialization.ObjectMapperFactory.<clinit>(ObjectMapperFactory.java:49)
	at org.mockserver.serialization.RequestDefinitionSerializer.<init>(RequestDefinitionSerializer.java:36)
	at org.mockserver.client.MockServerClient.<init>(MockServerClient.java:85)
	at org.mockserver.client.MockServerClient.<init>(MockServerClient.java:134)
java.lang.NoClassDefFoundError: com/github/fge/jackson/JacksonUtils
	at org.mockserver.serialization.ExpectationSerializer.deserializeArray(ExpectationSerializer.java:170)
	at org.mockserver.serialization.ExpectationSerializer.deserializeArray(ExpectationSerializer.java:158)
	at org.mockserver.client.MockServerClient.upsert(MockServerClient.java:1517)
	at org.mockserver.client.ForwardChainExpectation.respond(ForwardChainExpectation.java:84)

NPE when disable mockserver

quarkus.mockserver.devservices.enabled=false leads to a NPE because of the following line

The reason is:

if (!devServicesConfig.enabled) {
// explicitly disabled
log.debug("Not starting devservices for rest client as it has been disabled in the config");
return null;
}

Doesn't work with native tests

In your example, native tests work, because in application.properties you set:

quarkus.rest-client.activity-client.url=${quarkus.mockserver.endpoint}

If you remove that line, @QuarkusIntegrationTest fails as native tests are executed with production profile by default.

One can enforce usage of test profile while executing native test with command line option -Dquarkus.test.native-image-profile=test, so e.g. in gradle:

gradlew testNative -Dquarkus.native.enabled=true -Dquarkus.package.jar.enabled=false -Dquarkus.native.container-build=true -Dquarkus.test.native-image-profile=test -i

One can see that MockServer is started, but it seems the URL is not correctly replaced in @RestClient.

Allow test-container resue

Thanks for the implementation of the extension, this simplifies the usage of the mockserver for us a lot.

It would be great if we could reuse the test-container for multiple test runs. This would speedup the tests by a few seconds.

It could be implemented similar to the database-devservices: quarkusio/quarkus#25367

I would suggest, that it can be enabled/disabled by a property (default false?).

I will create a PR for this feature.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.