Coder Social home page Coder Social logo

microcks / microcks Goto Github PK

View Code? Open in Web Editor NEW
1.2K 24.0 193.0 5.71 MB

Kubernetes native tool for mocking and testing API and micro-services. Microcks is a Cloud Native Computing Foundation sandbox project ๐Ÿš€

Home Page: https://microcks.io

License: Apache License 2.0

JavaScript 0.44% Java 80.32% HTML 6.63% CSS 1.16% Dockerfile 0.15% TypeScript 10.50% Shell 0.74% Smarty 0.07%
api testing kubernetes api-testing event-driven graphql mock mock-server mocking openapi openapi-tooling openapi3 openapi31 postman-collection swagger swagger2 asyncapi asyncapi-specification cncf cncf-project

microcks's People

Contributors

195858 avatar abinet avatar aeoncl avatar afanas10101111 avatar alainpham avatar apoorva64 avatar askfor avatar christianlangmann avatar dependabot[bot] avatar fgoforth avatar gayanper avatar gsaslis avatar hassanazam avatar hguerrero avatar imod avatar john873950 avatar jonaslagoni avatar lbroudoux avatar lg-lopez avatar mahgo avatar nehrman avatar nmasse-itix avatar pietiepb avatar romg66 avatar sarasensible avatar sfraigneau avatar skirankumars31 avatar steffanob-ciandt avatar vietk avatar yada avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

microcks's Issues

Include instructions on how to setup Microcks on a server

Current documentation explains how to setup Microcks on a docker client instance (on the developer workstation). However, it would be nice to have also instructions on how to set it up on a dedicated server using Docker Compose.

To make it work, it is required to update the URLs:

$ hostname -f 
ec2-35-180-113-122.eu-west-3.compute.amazonaws.com
$ cd microcks/install/docker-compose/
$ cp keycloak-realm/microcks-realm-sample.json keycloak-realm/microcks-realm-sample.json.bak
$ apt-get install jq
$ jq '.applications |= map(if .name == "microcks-app-js" then .redirectUris = [ "http://ec2-35-180-113-122.eu-west-3.compute.amazonaws.com:8080/*" ] else . end) | .sslRequired |= "none"' keycloak-realm/microcks-realm-sample.json.bak > keycloak-realm/microcks-realm-sample.json
$ perl -i.bak -pe 's|KEYCLOAK_URL=http://localhost:8180/auth|KEYCLOAK_URL=http://ec2-35-180-113-122.eu-west-3.compute.amazonaws.com:8180/auth|' microcks.yml
$ sudo docker-compose -f microcks.yml up -d

OpenAPI importer does not support operation with only Query parameters

OpenAPI importer crashes when importing API Operation definition that just contain query parameters and no path parameters. You may encounter these type of exceptions stack traces:

java.lang.NullPointerException: null
        at io.github.microcks.util.DispatchCriteriaHelper.buildFromParamsMap(DispatchCriteriaHelper.java:263)
        at io.github.microcks.util.openapi.OpenAPIImporter.getMessageDefinitions(OpenAPIImporter.java:248)
        at io.github.microcks.service.ServiceService.importServiceDefinition(ServiceService.java:127)
        at io.github.microcks.task.ImportServiceDefinitionTask.importServiceDefinition(ImportServiceDefinitionTask.java:95)

Note that operation containing a mix of path and query parameters are ok.

PostmanImporter crashed when using templatized Query parameters

When importing a Postman collection with templatized Query parameters in root-url, you may encounter this kind of exception ๐Ÿ‘

DEBUG] io.github.microcks.util.postman.PostmanCollectionImporter - Extracting operation in folder /accounts

java.util.regex.PatternSyntaxException: Illegal repetition near index 66
/open-banking/v1.1/accounts/:(.+)/transactions?fromBookingDateTime={{fromBookingDateTime}}&toBookingDateTime={{toBookingDateTime}}
                                                                  ^

	at java.util.regex.Pattern.error(Pattern.java:1955)
	at java.util.regex.Pattern.closure(Pattern.java:3157)
	at java.util.regex.Pattern.sequence(Pattern.java:2134)
	at java.util.regex.Pattern.expr(Pattern.java:1996)
	at java.util.regex.Pattern.compile(Pattern.java:1696)
	at java.util.regex.Pattern.<init>(Pattern.java:1351)
	at java.util.regex.Pattern.compile(Pattern.java:1028)
	at io.github.microcks.util.DispatchCriteriaHelper.extractPartsFromURIPattern(DispatchCriteriaHelper.java:175)

2 things to fix:

  • Capture runtime exception to mark the import as failed with error message for diagnosis
  • Ignore Query parameters when extracting parts from URI pattern in DispatchCriteriaHelper class ;-)

Microcks Fails to start service when importing OpenAPI 3 Spec

When importing an OpenAPI 3 YAML spec, my docker logs tell me it failed trying to import a SoapUI project.

At first I thought this was because in the importer factory, it determines project type by the first line of the document. For openapi 3 it looks for

  • openapi: 3
  • "openapi": "3"
  • or 'openapi':'3'

However, after changing that in my example spec, it still fails to import with this error.

[DEBUG] sun.net.www.protocol.http.HttpURLConnection - sun.net.www.MessageHeader@64504cc15 pairs: {GET /users/sign_in HTTP/1.1: null}{User-Agent: Java/1.8.0_171}{Host: gitlab.com}{Accept: text/html, image/gif, image/jpeg, *; q=.2, */*; q=.2}{Connection: keep-alive}
[DEBUG] sun.net.www.protocol.http.HttpURLConnection - sun.net.www.MessageHeader@348da9e117 pairs: {null: HTTP/1.1 200 OK}{Server: nginx}{Date: Tue, 24 Jul 2018 14:22:51 GMT}{Content-Type: text/html; charset=utf-8}{Transfer-Encoding: chunked}{Vary: Accept-Encoding}{Cache-Control: max-age=0, private, must-revalidate}{Etag: W/"457d73fa6ca746a4b8f452e740f760f7"}{Set-Cookie: _gitlab_session=cd896ed22b47f45bbf6a94e44ccfab87; path=/; secure; HttpOnly}{X-Content-Type-Options: nosniff}{X-Frame-Options: DENY}{X-Request-Id: 7fd4f409-0bd5-420c-932e-77f5cec8e4b7}{X-Runtime: 0.071366}{X-Ua-Compatible: IE=edge}{X-Xss-Protection: 1; mode=block}{Strict-Transport-Security: max-age=31536000}{Content-Security-Policy: object-src 'none'; worker-src https://assets.gitlab-static.net https://gitlab.com blob:; script-src 'self' 'unsafe-inline' 'unsafe-eval' https://assets.gitlab-static.net https://www.google.com/recaptcha/ https://www.gstatic.com/recaptcha/ https://apis.google.com; style-src 'self' 'unsafe-inline' https://assets.gitlab-static.net; img-src * data: blob:; frame-src 'self' https://www.google.com/recaptcha/ https://content.googleapis.com https://content-compute.googleapis.com https://content-cloudbilling.googleapis.com https://content-cloudresourcemanager.googleapis.com; frame-ancestors 'self'; connect-src 'self' https://assets.gitlab-static.net wss://gitlab.com https://sentry.gitlap.com https://customers.gitlab.com; report-uri https://sentry-infra.gitlap.com/api/3/csp-report/?sentry_key=a664fdde83424b43a991f25fa7c78987}
Error at line 53, column 2
org.apache.xmlbeans.XmlException: error: </head> does not close tag <meta>.
        at org.apache.xmlbeans.impl.store.Locale$SaxLoader.load(Locale.java:3486)
        at org.apache.xmlbeans.impl.store.Locale.parseToXmlObject(Locale.java:1276)
        at org.apache.xmlbeans.impl.store.Locale.parseToXmlObject(Locale.java:1263)
        at org.apache.xmlbeans.impl.schema.SchemaTypeLoaderBase.parse(SchemaTypeLoaderBase.java:345)
        at com.eviware.soapui.config.SoapuiProjectDocumentConfig$Factory.parse(SoapuiProjectDocumentConfig.java:71)
        at com.eviware.soapui.impl.wsdl.WsdlProject.loadProjectFromInputStream(WsdlProject.java:337)
        at com.eviware.soapui.impl.wsdl.WsdlProject.loadProject(WsdlProject.java:298)
        at com.eviware.soapui.impl.wsdl.WsdlProject.<init>(WsdlProject.java:217)
        at com.eviware.soapui.impl.wsdl.WsdlProject.<init>(WsdlProject.java:198)
        at com.eviware.soapui.impl.wsdl.WsdlProject.<init>(WsdlProject.java:186)
        at io.github.microcks.util.soapui.SoapUIProjectImporter.<init>(SoapUIProjectImporter.java:84)
        at io.github.microcks.util.MockRepositoryImporterFactory.getMockRepositoryImporter(MockRepositoryImporterFactory.java:70)
        at io.github.microcks.service.ServiceService.importServiceDefinition(ServiceService.java:92)
        at io.github.microcks.service.JobService.doImportJob(JobService.java:60)
        at io.github.microcks.web.JobController.startJob(JobController.java:114)
        at sun.reflect.GeneratedMethodAccessor207.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:221)
        at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:136)
        at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:114)
        at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:827)
        at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:738)
        at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)
        at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:963)
        at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:897)
        at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970)
        at org.springframework.web.servlet.FrameworkServlet.doPut(FrameworkServlet.java:883)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:651)
        at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:230)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
        at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
        at io.github.microcks.web.filter.CorsFilter.doFilter(CorsFilter.java:47)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
        at org.springframework.boot.web.filter.ApplicationContextHeaderFilter.doFilterInternal(ApplicationContextHeaderFilter.java:55)
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
        at org.springframework.boot.actuate.trace.WebRequestTraceFilter.doFilterInternal(WebRequestTraceFilter.java:105)
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
        at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99)
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
        at org.springframework.web.filter.HttpPutFormContentFilter.doFilterInternal(HttpPutFormContentFilter.java:89)
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
        at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:77)
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
14:22:51,930 ERROR [SoapUI] An error occurred [Failed to load project from file [file:/tmp/microcks-1532442170792.project]], see error log for details
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
        at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197)
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
        at org.springframework.boot.actuate.autoconfigure.MetricsFilter.doFilterInternal(MetricsFilter.java:107)
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:108)
        at org.keycloak.adapters.tomcat.AbstractAuthenticatedActionsValve.invoke(AbstractAuthenticatedActionsValve.java:67)
        at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
        at org.keycloak.adapters.tomcat.AbstractKeycloakAuthenticatorValve.invoke(AbstractKeycloakAuthenticatorValve.java:181)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:349)
        at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:784)
        at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
        at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:802)
        at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1410)
        at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
        at java.lang.Thread.run(Thread.java:748)
Caused by: org.xml.sax.SAXParseException; systemId: file:; lineNumber: 53; columnNumber: 2; </head> does not close tag <meta>.
        at org.apache.xmlbeans.impl.piccolo.xml.Piccolo.reportFatalError(Piccolo.java:1038)
        at org.apache.xmlbeans.impl.piccolo.xml.Piccolo.parse(Piccolo.java:723)
        at org.apache.xmlbeans.impl.store.Locale$SaxLoader.load(Locale.java:3454)
        ... 84 more
com.eviware.soapui.support.SoapUIException: Failed to load project from file [file:/tmp/microcks-1532442170792.project]
        at com.eviware.soapui.impl.wsdl.WsdlProject.loadProject(WsdlProject.java:315)
        at com.eviware.soapui.impl.wsdl.WsdlProject.<init>(WsdlProject.java:217)
        at com.eviware.soapui.impl.wsdl.WsdlProject.<init>(WsdlProject.java:198)
        at com.eviware.soapui.impl.wsdl.WsdlProject.<init>(WsdlProject.java:186)
        at io.github.microcks.util.soapui.SoapUIProjectImporter.<init>(SoapUIProjectImporter.java:84)
        at io.github.microcks.util.MockRepositoryImporterFactory.getMockRepositoryImporter(MockRepositoryImporterFactory.java:70)
        at io.github.microcks.service.ServiceService.importServiceDefinition(ServiceService.java:92)
        at io.github.microcks.service.JobService.doImportJob(JobService.java:60)
        at io.github.microcks.web.JobController.startJob(JobController.java:114)
        at sun.reflect.GeneratedMethodAccessor207.invoke(Unknown Source)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.lang.reflect.Method.invoke(Method.java:498)
        at org.springframework.web.method.support.InvocableHandlerMethod.doInvoke(InvocableHandlerMethod.java:221)
        at org.springframework.web.method.support.InvocableHandlerMethod.invokeForRequest(InvocableHandlerMethod.java:136)
        at org.springframework.web.servlet.mvc.method.annotation.ServletInvocableHandlerMethod.invokeAndHandle(ServletInvocableHandlerMethod.java:114)
        at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.invokeHandlerMethod(RequestMappingHandlerAdapter.java:827)
        at org.springframework.web.servlet.mvc.method.annotation.RequestMappingHandlerAdapter.handleInternal(RequestMappingHandlerAdapter.java:738)
        at org.springframework.web.servlet.mvc.method.AbstractHandlerMethodAdapter.handle(AbstractHandlerMethodAdapter.java:85)
        at org.springframework.web.servlet.DispatcherServlet.doDispatch(DispatcherServlet.java:963)
        at org.springframework.web.servlet.DispatcherServlet.doService(DispatcherServlet.java:897)
        at org.springframework.web.servlet.FrameworkServlet.processRequest(FrameworkServlet.java:970)
        at org.springframework.web.servlet.FrameworkServlet.doPut(FrameworkServlet.java:883)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:651)
        at org.springframework.web.servlet.FrameworkServlet.service(FrameworkServlet.java:846)
        at javax.servlet.http.HttpServlet.service(HttpServlet.java:729)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:230)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
        at org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:52)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
        at io.github.microcks.web.filter.CorsFilter.doFilter(CorsFilter.java:47)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
        at org.springframework.boot.web.filter.ApplicationContextHeaderFilter.doFilterInternal(ApplicationContextHeaderFilter.java:55)
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
        at org.springframework.boot.actuate.trace.WebRequestTraceFilter.doFilterInternal(WebRequestTraceFilter.java:105)
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
        at org.springframework.web.filter.RequestContextFilter.doFilterInternal(RequestContextFilter.java:99)
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
        at org.springframework.web.filter.HttpPutFormContentFilter.doFilterInternal(HttpPutFormContentFilter.java:89)
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
        at org.springframework.web.filter.HiddenHttpMethodFilter.doFilterInternal(HiddenHttpMethodFilter.java:77)
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
        at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:197)
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
        at org.springframework.boot.actuate.autoconfigure.MetricsFilter.doFilterInternal(MetricsFilter.java:107)
        at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:192)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:165)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:198)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:108)
        at org.keycloak.adapters.tomcat.AbstractAuthenticatedActionsValve.invoke(AbstractAuthenticatedActionsValve.java:67)
        at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:472)
        at org.keycloak.adapters.tomcat.AbstractKeycloakAuthenticatorValve.invoke(AbstractKeycloakAuthenticatorValve.java:181)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:140)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:79)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:87)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:349)
        at org.apache.coyote.http11.Http11Processor.service(Http11Processor.java:784)
        at org.apache.coyote.AbstractProcessorLight.process(AbstractProcessorLight.java:66)
        at org.apache.coyote.AbstractProtocol$ConnectionHandler.process(AbstractProtocol.java:802)
        at org.apache.tomcat.util.net.NioEndpoint$SocketProcessor.doRun(NioEndpoint.java:1410)
        at org.apache.tomcat.util.net.SocketProcessorBase.run(SocketProcessorBase.java:49)
        at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1149)
        at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:624)
        at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)
        at java.lang.Thread.run(Thread.java:748)
Caused by: org.apache.xmlbeans.XmlException: error: </head> does not close tag <meta>.
        at org.apache.xmlbeans.impl.store.Locale$SaxLoader.load(Locale.java:3486)
        at org.apache.xmlbeans.impl.store.Locale.parseToXmlObject(Locale.java:1276)
        at org.apache.xmlbeans.impl.store.Locale.parseToXmlObject(Locale.java:1263)
        at org.apache.xmlbeans.impl.schema.SchemaTypeLoaderBase.parse(SchemaTypeLoaderBase.java:345)
        at com.eviware.soapui.config.SoapuiProjectDocumentConfig$Factory.parse(SoapuiProjectDocumentConfig.java:71)
        at com.eviware.soapui.impl.wsdl.WsdlProject.loadProjectFromInputStream(WsdlProject.java:337)
        at com.eviware.soapui.impl.wsdl.WsdlProject.loadProject(WsdlProject.java:298)
        ... 78 more
Caused by: org.xml.sax.SAXParseException; systemId: file:; lineNumber: 53; columnNumber: 2; </head> does not close tag <meta>.
        at org.apache.xmlbeans.impl.piccolo.xml.Piccolo.reportFatalError(Piccolo.java:1038)
        at org.apache.xmlbeans.impl.piccolo.xml.Piccolo.parse(Piccolo.java:723)
        at org.apache.xmlbeans.impl.store.Locale$SaxLoader.load(Locale.java:3454)
        ... 84 more
[INFO] io.github.microcks.service.ServiceService - Having imported 0 services definitions into repository
[INFO] io.github.microcks.service.JobService - Import of job 'Document' done
[DEBUG] io.github.microcks.web.JobController - Activating job with id 5b573631adbe1d0001075e21
[DEBUG] com.eviware.soapui.impl.wsdl.support.http.SoapUIMultiThreadedHttpConnectionManager - Closing expired connections
[DEBUG] com.eviware.soapui.impl.wsdl.support.http.SoapUIMultiThreadedHttpConnectionManager - Closing connections idle longer than 30 SECONDS
[DEBUG] com.eviware.soapui.impl.wsdl.support.http.SoapUIMultiThreadedHttpConnectionManager - Closing expired connections
[DEBUG] com.eviware.soapui.impl.wsdl.support.http.SoapUIMultiThreadedHttpConnectionManager - Closing connections idle longer than 30 SECONDS
[DEBUG] com.eviware.soapui.impl.wsdl.support.http.SoapUIMultiThreadedHttpConnectionManager - Closing expired connections
[DEBUG] com.eviware.soapui.impl.wsdl.support.http.SoapUIMultiThreadedHttpConnectionManager - Closing connections idle longer than 30 SECONDS
[DEBUG] class org.keycloak.adapters.tomcat.CatalinaRequestAuthenticator - Completing bearer authentication. Bearer roles: [admin]
[DEBUG] io.github.microcks.web.ServiceController - Getting service list for page 0 and size 20
[DEBUG] class org.keycloak.adapters.tomcat.CatalinaRequestAuthenticator - Completing bearer authentication. Bearer roles: [admin]
[DEBUG] io.github.microcks.web.ServiceController - Counting services...
[DEBUG] class org.keycloak.adapters.tomcat.CatalinaRequestAuthenticator - Completing bearer authentication. Bearer roles: [admin]
[DEBUG] class org.keycloak.adapters.tomcat.CatalinaRequestAuthenticator - Completing bearer authentication. Bearer roles: [admin]
[DEBUG] io.github.microcks.web.JobController - Counting jobs...
[DEBUG] io.github.microcks.web.JobController - Getting job list for page 0 and size 20
[DEBUG] com.eviware.soapui.impl.wsdl.support.http.SoapUIMultiThreadedHttpConnectionManager - Closing expired connections
[DEBUG] com.eviware.soapui.impl.wsdl.support.http.SoapUIMultiThreadedHttpConnectionManager - Closing connections idle longer than 30 SECONDS
[DEBUG] com.eviware.soapui.impl.wsdl.support.http.SoapUIMultiThreadedHttpConnectionManager - Closing expired connections
[DEBUG] com.eviware.soapui.impl.wsdl.support.http.SoapUIMultiThreadedHttpConnectionManager - Closing connections idle longer than 30 SECONDS

Example Spec

openapi: 3.0.0
info:
  version: 1.0.0
  title: Example Document API
security:
  - Bearer: []
paths:
  /documents/{documentId}/revisions/latest/renditions/default/content:
    get:
      summary: |-
        Get document content.
      operationId: GetContentForDocumentAndRevisionAndRendition
      tags:
        - content
      parameters:
        - $ref: '#/components/parameters/documentId'
        - $ref: '#/components/parameters/Accept'
        - $ref: '#/components/parameters/Range'
      responses:
        200:
          description: |-
            Response for content that consists of a single part.
          content:
            image/png:
              schema:
                $ref: '#/components/schemas/Binary-Content'
              examples:
                GetImagePngSinglePartContent:
                  $ref: '#/components/examples/GetImagePngSinglePartContent'
components:
  securitySchemes:
    Bearer:
      type: http
      scheme: bearer
  schemas:
    Binary-Content:
      description: |-
        Binary response content. Consumers should inspect the
        `Content-Type` response header to determine the
        content format.
      type: string
      format: binary
  parameters:
    documentId:
      name: documentId
      in: path
      description: |-
        The unique identifier of a document.
      required: true
      schema:
        type: string
    Accept:
      name: Accept
      in: header      
      required: false
      schema:
        type: string
    Range:
      name: Range
      in: header
      required: false
      schema:
        type: string

  headers:
    Location:
      schema:
        type: string
    Content-Range:
      schema:
        type: string
    Accept-Ranges:
      schema:
        type: string
    Access-Control-Expose-Headers:
      schema:
        type: string
    Access-Control-Allow-Origin:
      schema:
        type: string
      example: 'Access-Control-Allow-Origin: https://example.net'
    Access-Control-Max-Age:
      schema:
        type: string
      example: 'Access-Control-Max-Age: 600'
  responses:
    OPTIONS-CORS-200:
      headers:
        Access-Control-Allow-Origin:
          $ref: '#/components/headers/Access-Control-Allow-Origin'
        Access-Control-Max-Age:
          $ref: '#/components/headers/Access-Control-Max-Age'
    OPTIONS-CORS-400:
      content:
        application/problem+json:
          schema:
            $ref: '#/components/schemas/Problem-Detail'
          example: |-
            {
              "type": "https://example.net/bad-request",
              "title": "Bad Request",
              "status": 400,
              "detail": "The method 'POST' is not allowed.",
              "instance": "/content"
            }
  examples:
    GetImagePngSinglePartContent:
      summary: |-
        Get a rendition with a single part
      value: |-
        ```http
        GET /documents/101/revisions/latest/renditions/default HTTP/1.1
        Accept: image/png
        ```
        ```http
        HTTP/1.1 200 OK
        Content-Type: image/png

        (bytes for all the png content)
        ```
    GetImagePngMultiplePartContentPart1of2:
      summary: |-
        Get a part 1 from a rendition with 2 parts
      value: |-
        ```http
        GET /documents/102/revisions/latest/renditions/default HTTP/1.1
        Accept: image/png
        ```
        ```http
        HTTP/1.1 206 Partial Content
        Content-Type: image/png
        Content-Range: parts 1-1/2
        Accept-Ranges: parts
        Access-Control-Expose-Headers: Content-Range, Accept-Ranges

        (bytes for part 1 of the png content)
        ```
    GetImagePngMultiplePartContentPart2of2:
      summary: |-
        Get a part 2 from a rendition with 2 parts
      value: |-
        ```http
        GET /documents/102/revisions/latest/renditions/default HTTP/1.1
        Accept: image/png
        Range: parts=2-2
        ```
        ```http
        HTTP/1.1 206 Partial Content
        Content-Type: image/png
        Content-Range: parts 2-2/2
        Accept-Ranges: parts
        Access-Control-Expose-Headers: Content-Range, Accept-Ranges

        (bytes for part 2 of the png content

Updating Job with ServiceRefs fails

When Job has already run and has Service References, updating it is no longer possible due to a serialization error on serviceRefs attribute. Fix that.

Support for JSON Schema

Hi,

at the company I work for we're evaluating a few different tools for the complete workflow of our API management and this project really seems brilliant. Kudos to the maintainer(s)!

I was very interested in the testing functionality but we don't want to use SoapUI or Postman to define our tests. Long story short we decided to focus our efforts on a single official Swagger / OpenAPI documentation, both for the public API and for each service API, as we were looking for some more widely accepted/open/interoperable formats. (Also, adding JS code to an API doc just feels wrong, but that's my personal opinion.)

The thing is that the only test runner that is left would be the HTTP one which, as described in the docs, is just a smock test!

Is there any plan or even desire to support a JSON Schema test runner? It would mean supporting a vendor agnostic, standard (to be), open source (arguably less powerful, compared to JS) format for describing the response body which seems like a good middle ground between the simplicity of the HTTP runner and the power of the POSTMAN runner.

Thanks

Fix race condition when reporting test results

When test returns are reported asynchronously (by postman-runtime for exemple), there's some cases a race condition could occur and some results not persisted.

We should check that an Optimistic Locking Failure exception is raised and then retry merging the results with main TestResult aggregate.

Missing Postman collection or network issue make bad test runner selection

When running a tests using Postman or SoapUI strategy, referenced artifact (collection or project) may have changed location or not be available (network issue for example).

In that case switch case is not correctly exited and it appear that next available TestRunner implementation may be selected ...

OpenAPI import support

As OpenAPI specification provides ability to specify example objects, we may have a test for an OpenAPI importer that will allow to provide compliant mocks for Microcks.

This discussion as been started in #23 regarding the JSON Schema validation stuffs. We may try here dealing with the importer that is the part we may have the most uncertainties about.

Disable the profile review in Keycloak

When logging in Microcks for the first time using the embedded Keycloak and the OpenShift IdP, the user is asked to confirm the retrieved information.

This step is not very useful and quite confusing for the user. I think we should configure Keycloak to bypass it.

It's not very useful because the entered information are not verified in any way.
And it's confusing because the commonly agreed behavior for social login/registration is to map automatically the user profile information without asking the user to check.

In the Microcks Realm:

  • go to Authentication
  • pick the First Broker Login flow
  • set Review Profile (review profile config) to DISABLED

Docker compose is broken - results in HTTP 401 - Unauthorized

Installed Microcks using Docker Compose. It works fine, can log in, was forced to change password. But when trying to add new job as described in http://microcks.github.io/using/index.html (Loading Samples) I get HTTP 401 Unauthorized for POST http://localhost:8080/api/jobs. Response header WWW-Authenticate has value Bearer realm="microcks", error="invalid_token", error_description="Didn't find publicKey for specified kid". It seems like the whole /api/jobs endpoint is blocked because I get the same response also for GET /api/jobs?page=0&size=20 and GET /api/jobs/count.

Is there anything I missed? Can I fix it somehow in KeyCloak?

Provide safe defaults when loading a collection that has no version number

Currently, if a Postman collection is loaded into Microcks without the version number annotation in the description field, the service is loaded but unusable because of the missing version.

I think we should provide safe defaults for such cases if a version number cannot be found :

  • either reject the service with an error message
  • or add a default version
  • or allow service without version number

Deep APIs throw a 400 in Dynamic REST and maybe REST modes

I created an import job to load my OpenAPI 3.0 api spec, it loaded. I see the paths, however I always receive a 400 on even the simplest of calls. All of my calls are four levels down in the API name. Therefore, Microcks does not create accessible mocks.

For testing I tried to create two APIs with the Dynamic REST and I believe I found a similar issue.

  • a
  • ab

"a" was identified as version "1" with a resource of "a"
"ab" was identified as version "2" with a resource of "a/b"

When I use curl and a simple GET, "a" responds with a 200 and "ab" responds with a 400.

Sample execution of GET /a

$ curl -X GET http://localhost:8080/dynarest/a/1/a -H 'Content-type: application/json' -i
HTTP/1.1 200 
X-Application-Context: application:prod
Content-Type: text/plain;charset=UTF-8
Content-Length: 2

Sample execution of GET /a/b

$ curl -X GET http://localhost:8080/dynarest/ab/2/a/b -H 'Content-type: application/json' -i
HTTP/1.1 400 
X-Application-Context: application:prod
Content-Length: 0
Date: Mon, 16 Jul 2018 17:27:55 GMT
Connection: close

How can I get Microcks to support deeper APIs?

npm dependencies are deprecated

`D:\microcks>npm install
npm WARN deprecated [email protected]: ...psst! Your project can stop working at any moment because its dependencies can change. Prevent this by migrating to Yarn: https://bower.io/blog/2017/how-to-migrate-away-from-bower/
npm WARN deprecated [email protected]: Deprecated
npm WARN deprecated [email protected]: wrench.js is deprecated! You should check out fs-extra (https://github.com/jprichardson/node-fs-extra) for any operations you were using wrench for. Thanks for all the usage over the years.
npm WARN deprecated [email protected]: CoffeeScript on NPM has moved to "coffeescript" (no hyphen)
npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated [email protected]: connect 2.x series is deprecated
npm WARN deprecated [email protected]: please upgrade to graceful-fs 4 for compatibility with current and future versions of Node.js
npm WARN deprecated [email protected]: please upgrade to graceful-fs 4 for compatibility with current and future versions of Node.js
npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated [email protected]: please upgrade to graceful-fs 4 for compatibility with current and future versions of Node.js
npm WARN deprecated [email protected]: please upgrade to graceful-fs 4 for compatibility with current and future versions of Node.js
npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated [email protected]: ReDoS vulnerability parsing Set-Cookie https://nodesecurity.io/advisories/130
npm WARN deprecated [email protected]: Use uuid module instead
npm WARN deprecated [email protected]: Please update to minimatch 3.0.2 or higher to avoid a RegExp DoS issue
npm WARN deprecated [email protected]: ReDoS vulnerability parsing Set-Cookie https://nodesecurity.io/advisories/130
npm WARN deprecated [email protected]: this package has been reintegrated into npm and is now out of date with respect to npm
npm WARN deprecated [email protected]: Use the globby package instead

[email protected] install D:\microcks\node_modules\ws
(node-gyp rebuild 2> builderror.log) || (exit 0)`

Provide script for easier installation on Linux using docker-compose

Following #29, provide a simple setup-microcks.sh script that allows modification of configuration files for quick starting a docker-compose installation on Linux box.

Setup scripts should be able to modify application.properties and microcks-realm-config.json file in order to adapt Keycloak URLS as well as ssl-required property both for adapter (client side) and server side.

Private repositories support

Is there no support for private repositories? Anytime I try to import a private repository or a file in one, there is no error. In the network tab of the console, I do see a 401 though.

I've not seen any way to authenticate myself.

Add basic user authentication and role management

Through the addition of Keycloak as a microservice, we should be able:

  • to authenticate users through social, openshift of enterprise identity provider
  • to protect access to administration features within Microcks
  • to protect access to data deletion action within Microcks

For now - as of 0.5.0 milestone - there's no need to get advanced features such as:

  • services/API ownership to user or group of users,
  • auditability of every actions realized

Add a patternfly theme to UI

Add Patternfly as an alternative/default UI so that we may have nice visual integration with some other tools like Keycloak or OpenShift

Openshift microcks pod health issue

There might be issues with the endpoints that are used to verify the health and liveliness of the pod.
If those 2 checks are not removed, OpenShift keeps killing the pod.

Add a delete endpoint for the APIs

at the moment for the Services and Jobs there are just GET and POST action.
To enable a complete automation scenario you would need at least a DELETE action as well.

Mock fails when no example for some operations

It appears that if you provide an incomplete Service description (ie: Operation with no example) you may encounter an Internal Server Error when invoking mock for another operation. This is because when looking for your Operation, Microcks may before check another Operation those resourcePaths collection is null ...

So it fails with a NullPointerException on the server side!

Maven DependencyResolutionException while mvn spring-boot:run

[ERROR] Failed to execute goal on project microcks: Could not resolve dependencies for project io.github.microcks:microcks:jar:0.5.1-SNAPSHOT: The following artifacts could not be resolved: com.smartbear.soapui:soapui:jar:5.1.1, gnu.cajo:cajo:jar:1.142: Could not transfer artifact com.smartbear.soapui:soapui:jar:5.1.1 from/to soapui (http://smartbearsoftware.com/repository/maven2): GET request of: com/smartbear/soapui/soapui/5.1.1/soapui-5.1.1.jar from soapui failed: Premature end of Content-Length delimited message body (expected: 11584277; received: 9071652 -> [Help 1]
[ERROR]
[ERROR] To see the full stack trace of the errors, re-run Maven with the -e switch.
[ERROR] Re-run Maven using the -X switch to enable full debug logging.
[ERROR]
[ERROR] For more information about the errors and possible solutions, please read the following articles:
[ERROR] [Help 1] http://cwiki.apache.org/confluence/display/MAVEN/DependencyResolutionException

Can someone please share the maven settings.xml?

OpenAPI schema validation support

Following OpenAPI support for mocks (see #24), we starting with the idea of implementing a test validator that's actually able to validate responses according the OpenAPI schema provided within specification.

This follows also the generic feature request regarding JSON schema support (see #23 ) even if OpenAPI is a different set of specs. See https://philsturgeon.uk/api/2018/03/30/openapi-and-json-schema-divergence/ for more accurate informations on that topic.

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.