How to inject the server port in Grails 4 integration tests? - grails-4

Since Grails 4 it is not possible anymore to get the server port in grails integration tests this way:
#Value('${local.server.port}')
Integer serverPort
What's the correct way to get the server port in tests?

The serverPort is already injected in Grails 4 integration tests as serverPort. There is no need to create a variable for it.

Related

Node js vs Apache Tomcat container

I'm new to Node.js and built my first app helloworld.js. I know java and tomcat architecture well. But I have some questions:
I wonder how to create a second web-app that always responds on the
same port but with different url.
For example
http://localhost:3000/
http://localhost:3000/app1/
http://localhost:3000/app2/
I saw that there are different ways to access the various db. In the
node js world there is something like hibernate that makes the dbms
transparent to the programmer?
There is something like tiles and tag library to build html page?
In order:
Unless you use nginx or some other reverse proxy, that is not possible. However, you can run different applications on different ports like 3001, 3002 etc, and run a server which acts as an intermediary between your client and these servers at port 3000.
Depends on framework to framework.
I am not familiar with tiles and tag, but in nodejs land, you can use ejs, handlebars or jade to design templates.

Starting node http server at any free port

I am trying to start multiple highchart export servers via C# in a single windows machine. Highchart export server is run as node http server. All node servers are started from different non communicating applications running in a single machine. I am starting the process from c# code like this.
Process process = new Process { command line arguments to start node server with port };
process.Start();
How can I specify non conflicting ports in C# code so that node servers can be started in each application ?
Node.js can help you, use c# no problem.
You will need just to check port before you use it. If port is used you can't use that port this is basic rule for TCP/IP.
Take a look here :
NodeJS pinging ports
Also npm have some app for port checking.
https://www.npmjs.com/package/tcp-ping
Port is just a number you can use it on your will but would be better to follow standards. You can use 80 or 21 if port are free .

What does this mqtt-connection module used for?

What does this mqtt-connection module in nodejs used for? Does it means with this mqtt-connection then we do not need any broker?
mqtt-connection
You can indeed create a new server listening on MQTT and connect to it using the client version.
For exemple you can run an express app with the following architecture
-server
- server.js //Start your server here
-app
- your client views and controllers go here
However, if you are planning to setup a big application, I strongly recommend you to use brokers such as Mosquito or ActiveMQ.

multiple websocket connections for load testing

I want to run a load test for a server recently developed in node.js .The problem is i am not sure if and how is it possible to establish multiple connections from one client to this one port of the server.Particularly,should there be different event listeners for every websocket that is going to be created,for example w[i].on('open',function(){....} or am i under the wrong impression?
If the websocket server was developed in nodejs, you can easily use loadtest tool.
Runs a load test on the selected HTTP or WebSockets URL. The API allows for easy integration in your own tests.
This lets you to test web sockets and http URLs. It is available as a package on NPM.

Solr with Jetty on LAMP server - Admin page access issue

I have Solr with its default Jetty that came with example directory installed on Linux server which has apache2 as its web server.
Now, within the same private LAN, when I open a browser and type in http://<ip-address>:8983/solr works ONLY when I do port forwarding otherwise it doesn't work. I am not sure what could be the problem? Please note this installation has been done on a remote server in a hosting environment for production deployment and I am a beginner wrt deployment stuff.
You can use the jetty.host parameter during startup to allow direct access to Jetty.
The -D option of the java command can be used with the followin syntax:
java -Djetty.host=0.0.0.0 -jar start.jar
In this way Jetty can be reached from all the hosts.
However this is not the ideal setup IMHO. I prefere to setup Jetty to listen only on localhost, implementing the client with another frontend server which listen on port 80. If you want to implement the frontend on another server you can use iptables to limit the incoming connection, dropping everything on the 8983 port if the IP is different from the one of your frontend server.
This image depicts my preferred setup for a LAMP stack includin SOLR:

Resources