I've a requirement to develop a custom sonarqube plugin that will act as a proxy service.
I'm thinking of creating a simple Java application which:
Application will keep on listening for request
Receives a REST api URL (some 3rd party address) from caller as request
Hits REST api and receives JSON response back
Forward the response back to original caller
My question is, is it possible within sonarqube?
Supposing, it is possible:
Second question - I’ve gone thru sonarqube documentation, but I’m not able to pinpoint which plugin class to use. Should I use PageDefinition only?
Please suggest.
Thanks
P.S. - Similar question was posted on sonarqube community, posting it here for broader audience.
I'm thinking of creating a simple Java application which:
Application will keep on listening for request
Receives a REST api URL (some 3rd party address) from caller as request
Hits REST api and receives JSON response back
Forward the response back to original caller
My question is, is it possible within sonarqube?
It is possible to add third party library into a Custom SonarQube Plugin. You can create tasks in which you can do whatever you implement.
Supposing, it is possible: Second question - I’ve gone thru sonarqube
documentation, but I’m not able to pinpoint which plugin class to use.
Should I use PageDefinition only?
You should implement WebService Extension Point which allow you to extend SonarQube web API and add new bahaviours on requests.
PageDefinition is a way to add some web pages on the WebUI.
Related
I have to write code to automatically create a JIRA based on some action performed in my workplace. The solution that my manager proposed is to create a JIRA creation agent. We are using REST architecture.
Last time I wrote a client. Now I have to write an agent. What I don't understand is the key and more like the technical difference between the two. Like how exactly these are different as for someone with very less experience with REST I feel hard to understand the core difference.
Do I have to code them in a different style? or what are some good practices to write these kinds of code?
I tried reading different blogs and related posts but couldn't find anything satisfactory to point out the differences.
This may be semantically different based on your company's internal linguistics, but typically it is as follows:
REST Server is the software which provides the API which is exposed
REST Client is the software which uses the REST Server's API to make requests and get the resulting information (usually JSON). This is more of an interface to make the requests
REST Agent uses the REST Client to make the requests but actually uses the resulting JSON and processes it to perform some sort of action
However colloquially people use REST Client and REST Agent interchangeably. The main thing is delineation of who is providing information with API and who is making requests for information through an API.
EDIT: In order to clarify in your case the agent would be making a request through the API but would most likely be a PUT or POST request to create a JIRA issue.
I am working on a discord bot that posts rss messages to channels. I currently have this:
New item gets posted in the rss feed
Zapier gets notified by the rss feed
Zapier sends out a webhook to my java application
My application receives the message
Application does some processing and sends it to discord
However, I'm now stuck at step 4. I am guessing I should make my java listen to the webhook url of zappier but I could not find out how to make this endpoint.
I was hoping someone could help me out.
P.S. If my idea is stupid or someone knows another way for getting the rss messages to my application please let me know.
To be honest, I haven't use Zapier yet until now but based on the comments, I believe this answer will help you get to the point and write the app for sure because they are conceptually the same.
Recently I developed a telegram bot that have the same behavior. It had webhook pointing to a url that I defined and then it pushed all updates as a json to my URL.
For fetching these kind of data and use them in our app, we should follow these procedures:
Create a web-app with a url endpoint that can receive json object
set your zapier webhook to point exactly to that URL
If you're using java as your web-app, you should have a library like Jackson,GSon to convert your data to a corresponding Java Bean/POJO which you have made.
use that object inside your application
To create POJO object, you should consider the json structure and based on that you should create Java Bean class for binding. refer to this example for that -> How to convert Java object to / from JSON (Jackson)
Take note some frameworks like Spring-MVC they have integrated with
libraries like Jackson and they do all of the binding work for you
automatically.
David here, from the Zapier Platform team.
I just wanted to mention that if all you want to do is send messages from RSS -> Discord, you don't need to develop your own app for that (unless you want to, in which case, power to you!).
You can find a blueprint for that Zap here: https://zapier.com/apps/discord/integrations/rss/25366/post-new-rss-items-to-a-discord-channel
Let me know if you've got any other questions!
I have a REST client in Java that is ready to connect to a REST server, send a specific request and get a response back. However, the actual REST server is not available during development time (it is hosted by a 3rd party and only available in the isolated local net of the target machine) and we still want to test connectivity and interaction with the server.
Can you point me to a product or technology that in the first place lets me quickly create a fake REST server (or at least mock it) according to the specification of the REST call parameters? I did some research on the web but haven't had a "yes, this is it!" moment yet.
You can use any rest mocking framework to achieve this. As per my experience
Wiremock is the best framework for RES API Mocking.
http://wiremock.org/
You can use mockwebserver library by square. It's pretty simple to use and do exactly what you attempt to do.
Little usage sample:
MockWebServer server = new MockWebServer();
server.enqueue(new MockResponse().setBody("hello world"));
server.start();
For client testing, I would recommend a tool like SOAP UI or Postman. But for mocking the REST service itself, I would actually recommend just creating some dummy endpoints in your Java web application and using that. At each endpoint you could do something hard code a simple response, in JSON, XML, or whatever would make sense with your service. Then, when you finally come to actual development, you will already have a functioning framework for your REST service. You would just need to fill in the missing pieces.
This makes sense because you are going to need to setup REST support in your Java code anyway, and the amount of effort to just add stubs should be minimal. This approach is also attractive from the point of view that it avoids any potential surprises from switching from a mock REST service to the actual one.
I've been asked to use Zapier to send SMS and add as a Subscriber to MailChimp once the addNewContact endpoint is called.
I've never worked with Zapier so I'm having trouble understanding how to proceed; in Zapier one can create an App or a Zap. Are they the same?
My task is to use Zapier for the purposes mentioned above, so if I could get some clarification/guidelines as to where to start and how to proceed it would be greatly appreciated.
We use JAX-RS/Jersey 2.1 so the main idea I have would be to call a REST API that belongs to Zapier with which I can make the request to send an SMS and add the newly created contact as a subscriber in MailChimp.
We previously created a Zap which triggered an SMS once the contact endpoint was called but this was done for a specific client, so this isn't the solution we're looking for since the authentication keys, clients and contact information will be dynamic.
My problem is that in the Zapier documentation I can't find anything related to my requirements, all I find is UI solutions directly working in zapier.
Thanks in advance.
A zap is the main interface in Zapier where you construct an integration between available apps by setting up a trigger source to capture data, and subsequent actions to receive data.
An app is typically a branded service, and it's what you use within zaps to create your integration. Apps are provided by Zapier (you just need to authenticate within each service to use them) and you can also create your own apps.
There are also generic apps (like webhooks) that you can use to send data to an external service, such as your own REST API.
You can also send SMS directly within Zapier by using a service like Twilio.
I would like to program a WebService embedded on my android device (not the client part).
I've been evaluating Restlet Framework (Restlet) but i don't know if I go on the right way.
What do you think? Is that framework viable for my goal?
Any suggestion is welcome!
Thank you so much!
Regards.
You should check whether Restlet is compliant with android,
not just from server side code, but also from client side code (respectively).
This means for example that every JAR that Restlet framework depends on has to contain code that is compliant with Android.
An alternative approach would be to run a simple HTTP server on your device, for example the following nano http server I read about.
Another interesting project you should check is jetty for android which will hopefully give you support for servlet API as well.
Yes, you will have to spend some time on developing mapping requests and building resource handling logic, but that task is not that difficult:
A. You already have Android code for JSON processing -
For example, look here
B. Using the Java URL object you can analyze the URL of the request and understand which resource you should handle (i.e - add resource to collection, fetch collections, etc).
C. After performing the CRUD operation (i.e - store your resource in some SQLIte table), you can send back a response, and once again, composing JSON if needed is easy.