Elasticsearch 6.2 (java/gradle) integration test - elasticsearch

I am spending days trying to find solution what to use for this "simple" test:
inside of test stand up ES node that will be used for test only
connect with transport client to that ES instance and add new index.
(that is just a start of all integration tests, but I need to see how
to do one if anyone has an example)
Note: we have to continue to use transport client, we know it is going away.
We are upgrading from ES version 2 to version 6 and trying to keep integration tests as much unchanged as possible.
This is exactly the same issue as this person had in lower version, we had it that way but it is not supported anymore in 6, and how do I accomplish the same now: Start elasticsearch within gradle build for integration tests
I am finding comments about "existing gradle plugin" will do the job - what is that plugin and how to use it?
Or, example with ESIntegTestCase would be perfect too, anything that works. Thank you!

Related

spring-mvc-404 page not found error in maven project

I have been trying to understand and clone the spring mvc login and registration process. As far as I know I am following the same code and process. Only thing I have changed is database details.0 Which works fine I am able to insert the data into the MySQL (8.0.27) database using test file. I am getting the same error even when I am trying his code I am getting error.
here is my code: https://drive.google.com/drive/folders/1JNkZp_O1Lh0y_1NdZ-A85KI1gfgy0_Em?usp=sharing
here is GitHub code: https://github.com/javabyranjith/spring-framework-mvc/tree/master/springmvc-userlogin
Errors I am getting:
action keyword in form was giving error "element loginProcess is not found"-> so I changed it to the form action then it worked
The origin server did not find a current representation for the target resource or is not willing to disclose that one exists.
my questions are
can a different version of Apache Tomcat(10.0.13) server can cause the issue?
since I am using new Eclipse so I have updated the new libraries can this cause the issues?
Please suggest the changes so that I can run this project. Suggest the changes here or directly change it in the google drive folder.
Tomcat 10 does not work with Spring 5. Downgrade to Tomcat 9.
10th has jakarta packages renamed from javax, which spring 5 does not support.
Friendly advice, if you are using code from git, they left versions of stuff like java and tomcat for a reason, and the newest versions like Tomcat 10 and JDK17 went through a lot of changes, so always try with suggested versions and try to migrate them to higher ones. Except for Tomcat 10, you will have to wait for Spring 6 for that.
As for the new eclipse, it does not make any difference, the maven project is still the maven project, src, and pom.xml, the structure remained the same.
First try with suggested versions then you can ramp them up once you are sure that it is working.

Using Nutch and Elasticsearch with indexer-elastic-rest

I've used Nutch and Elasticsearch many times before, however, I believe I was using the default setup to where Nutch used the binary transport method for communicating with Elasticsearch. It was simple and worked out of the box so I've used it alot.
I've been in the process of updating crawl system and it seems now the better option is to use the Jest REST api library.
However, I'm a bit confused about it...
First how do I install the Jest library to be used with Nutch and Elasticsearch. I know I can download or clone via Github but.. how is it connected?
Do I literally just update the dependencies in the /indexer-elastic-rest *.xml files for Nutch and then just build again with ant?
My first install of Nutch was using the binary zip. I just recently started using the src package so ant/maven is somewhat new to me - which is why this all a bit confusing. All the blogs and articles say to "and then rebuild with ant"...
Second - does the Jest library take care of all Java REST api code or do I have to write Java code now?

SonarQube Web-API - api/resources not returning all projects

I use the following url to extract a number of metrics for each of the projects we have in SonarQube:
/api/resources?metrics=lines,ncloc,reliability_rating, ...
But, it is missing data for (at least) one of the projects. But if I use the following:
/api/resources?resource=69644
It will pull the data for the project. What would cause the project to not show up in the first use case?
We are currently on SonarQube 5.6.
I'm going to answer my own question...
Turns out this particular endpoint has a hard coded limit of 500 components. Which is a known issue and will not be fixed and the endpoint has been deprecated.
To get the same functionality I've switched to using api/projects/index to get the list of projects and then use api/measures/component for each project I'm interested in getting metrics for.

Running Two Sonar Instances with One DB

As per this question: Sonar throwing error BadDatabaseVersion it is not possible to run two sonar instances using the same database. Everything I've read so far implies the only solution is to shut down both instances and only restart the one you want to keep. Is my only other option to run two sonar instances, to have another sonar database? This seems pretty costly, and it seems that the only thing holding back sonar from running another instance is sharing server.core.id
So I guess I have two questions:
1) Why is sonar built with this dependency?
2) Are there any other options to run two instances on the same db?
Indeed, SonarQube currently can't have 2 servers started on the same DB. This limitation (that is referenced in this JIRA ticket) has beeen here by design since the very beginning - to make sure that you can't start 2 servers having a different set of plugins but pointing to the same DB.
To answer your second question, there's no way to have 2 instances pointing to the same DB. But we've starting a big refactoring to eventually make it possible to have a cluster of SonarQube instances, so feel free to watch the SONAR-5391 ticket and vote for it.

A good strategy for knowing the versions of deployed applications?

In order to know which revision number the application is built from, we use to give the ears we deploy to Glassfish names like myapp_2012-01-20_rev22123.ear. Then we can simply login to Glassfish and see what version is deployed in the web interface (as the appname is the name of the ear file). A downside of this approach is that we need to do a manual undeploy/redeploy to update the name...
But I would like to script the undeploy/deploy process, and having each version of an ear get a different name is not very suitable to scripting this redeployment process. Glassfish 2 does not support the "list applications" goal that Glassfish 3 has, which I could have used to retrieve the application name to undeploy.
So is there any good strategy that will easily allow us to see what version is deployed of an application, and that does not suffer from the above fault?
It would be preferable if this meant we did not have to change the existing applications (like add a jsp page or something to show the current scm revision), but a change in a Maven build script would be acceptable.
I faced a similar issue, I finally came around it by using maven-buildnumber-plugin and writing a simple servlet to get build information. You can find the details in the blog post I made.
Why not use the built-in GlassFish Server versioning to assign a version number at deploy time? This will also enable you to rollback to prior versions. For example:
asadmin deploy --name MyApplication:2012-01-20_rev22123 MyApplication.ear
There is more information on application versioning here:
http://docs.oracle.com/cd/E18930_01/html/821-2417/gihzx.html#gkhhv
Hope this helps.

Resources