jenkins selenium grid v2 confiduration - selenium-webdriver

I need a help with configuration and updating jenkins selenium plugin.
I can configure selenium hub and nodes outside of jenkins and run tests from maven so selenium itself is not a problem.
1 problem: jenkins selenium plugin already defines default node with list of available browsers (5 firefox, 5 chromes, 2 IE). I would like all my test to be run on other machine than jenkins. so I was able to point my remote node to jenkins machine and it is registered there. my question is how I remove default node browser configuration ???
2 problem: how can I update to latest selenium-server-standalone version (which currently is 2.24.1). right now I can see jenkins is using 2.15.0. I tried to add jar in ...jenkins/plugins/selenium/WEB-INF/lib and update license.xml but after I restarted jenkins it still uses older version
thanks for help

I can answer on you second question. To update selenium-server-standalone version you must perform the following steps:
1) Download the latest version of selenium-server-standalone
2) Put it in to YourJenkinsHomeDirectory/plugins/selenium/WEB-INF/lib
3) Edit licenses.xml file in YourJenkinsHomeDirectory/plugins/selenium/WEB-INF
Edit following (Edit the text highlighted in bold. Paste the value of the version of your selenium-server-standalone):
l:dependency name='Unnamed - org.seleniumhq.selenium:selenium-server-standalone:pom:2.39.0' groupId='org.seleniumhq.selenium' artifactId='selenium-server-standalone' version='2.39.0'
Save file
4) Go to YourJenkinsHomeDirectory/Home/plugins/selenium/META-INF/maven/org.jenkins-ci.plugins/selenium
5) Edit pom.xml
Than find next:
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-server-standalone</artifactId>
<version>2.39.0</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-java</artifactId>
<version>2.39.0</version>
<scope>test</scope>
</dependency>
</dependencies>
And edit <version>2.39.0</version> in both block. Paste the value of the version of your selenium-server-standalone
Save file
6) Restart your Jenkins (simply go to this http://your-jenkins-url/restart) as default the url is: http://localhost:8080. Now Jenkins should restart
7)Go to your Selenium Grid hub http://localhost:4444/grid/console
8)Now you should see your updated version
Good luck :)

Related

How to install Apache Camel?

How do you install Apache-Camel?
I've just started reading 'Camel in Action' 2nd ed.
In section 1.2.1, is suggests downloading the binary distribution.
I found this link to from the releases page:
Release 2.24.1
But I can only see a source-code download.
I've tried to compile from the source, but that always encounters an error.
How do you just install the binary on either Ubuntu/Redhat/Fedora?
Or have I misunderstood Apache-Camel as being a library that you can just install?
Must it always be compiled with maven?
Camel, Java-projects and build-tools
Apache Camel works like any other Java library or framework, meaning that in order to use the framework you'll have to include its java binaries (i.e .jar files) to your project as dependencies. Now to make things simpler most developers use either Maven or Gradle to create, manage and build their java projects.
From these two I would recommend Maven as it seems to be the preferred option for Camel developers with most examples (including ones in official camel site) using it. To install maven follow the official how to install maven guide.
Maven archetypes
To create example camel project you can use maven archetypes which are basically project templates that can be used to create various types of new projects. If you're reading Camel in Action you might be better off using Camel version 2.x.x in your projects with Java Development Kit version 8. Camel 3.x.x is pretty similar so it should be fairly easy to learn that after learning the basics with 2.x.x.
After installing maven you can use your Java IDE (i.e IntelliJ, VSCode, Eclipse or Netbeans) to create project from maven archetype with groupId: org.apache.camel.archetypes artifactId: camel-archetype-java and version: 2.25.4
Or use maven command line command:
# Create new camel java project for Camel version 2.25.4
mvn archetype:generate -DarchetypeGroupId="org.apache.camel.archetypes" -DarchetypeArtifactId=camel-archetype-java -DarchetypeVersion="2.25.4"
Camel project
The new project should contain project file pom.xml where you can specify all the dependencies for your project. The the camel-archetype-java should have the following dependencies listed in the dependencies section of pom.xml.
<dependencies>
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-core</artifactId>
</dependency>
<!-- logging -->
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-api</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<scope>runtime</scope>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-slf4j-impl</artifactId>
<scope>runtime</scope>
</dependency>
<!-- testing -->
<dependency>
<groupId>org.apache.camel</groupId>
<artifactId>camel-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>
The example route in camel-archetype-java archetypes Myroutebuilder.java is pretty complex for beginners. Hello world on a timer is generally a more simpler test on to see if things work.
package com.example;
import org.apache.camel.LoggingLevel;
import org.apache.camel.builder.RouteBuilder;
public class MyRouteBuilder extends RouteBuilder {
public void configure() {
// from("file:src/data?noop=true")
// .choice()
// .when(xpath("/person/city = 'London'"))
// .log("UK message")
// .to("file:target/messages/uk")
// .otherwise()
// .log("Other message")
// .to("file:target/messages/others");
from("timer:timerName?period=3000")
.routeId("helloWorldTimer")
.log(LoggingLevel.INFO, "Hello world");
}
}
The project generated from archetype comes with exec-maven-plugin which allows you to run the project with mvn exec:java
Java development kit - JDK
If you're using JDK 11 instead of JDK 8 you'll have to modify maven-compiler-plugin configuration a bit.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.0</version>
<configuration>
<!--
<source>1.8</source>
<target>1.8</target>
-->
<source>11</source>
<target>11</target>
</configuration>
</plugin>
If you've multiple versions of JDK installed you'll have to configure your IDE to use the correct one for the project. With IntelliJ you can configure JDK used by the project from project structure settings.
With VSCode you'll need both JDK 11 and JDK 8 as VSCode Java extensions require JDK 11 to run.
Example settings.json entries for OpenJDK:
"java.configuration.runtimes": [
{
"name": "JavaSE-11",
"path": "C:\\Program Files\\AdoptOpenJDK\\jdk-11.x.x.xxx-hotspot",
"default": true
},
{
"name": "JavaSE-1.8",
"path": "C:\\Program Files\\RedHat\\java-1.8.0-openjdk-1.8.0.xxx-x",
}
],
"java.home": "C:\\Program Files\\AdoptOpenJDK\\jdk-11.x.x.xxx-hotspot"
You might also want to setup your path variable so that java -version returns correct version from the command-line.
What you really need is download the binaries for Apache Camel. The best way to get them is make use of maven (https://maven.apache.org/install.html), and existing project from GitHub and get started.
You can go to the following link: https://github.com/dilipsundarraj1/TeachApacheCamel. You can either download the project as zip file or clone the project (you need to have git installed on your machine).
After you downloaded / cloned the project use go to one of the projects: learncamel-simple-file and open the folder in command prompt.
In the command prompt run the command mvn dependency:resolve. (I am assuming you have maven and java installed on your machine). This command will download all the required binaries in the folder: c:\user\<userid>\.m2\repository, where userid is specific to you machine.
Hope it helps.

upgraded flink from 1.10 to 1.11, met error 'No ExecutorFactory found to execute the application'

java.lang.IllegalStateException: No ExecutorFactory found to execute the application.
at org.apache.flink.core.execution.DefaultExecutorServiceLoader.getExecutorFactory(DefaultExecutorServiceLoader.java:84)
at org.apache.flink.streaming.api.environment.StreamExecutionEnvironment.executeAsync(StreamExecutionEnvironment.java:1803)
at org.apache.flink.streaming.api.environment.StreamExecutionEnvironment.execute(StreamExecutionEnvironment.java:1713)
at org.apache.flink.streaming.api.environment.LocalStreamEnvironment.execute(LocalStreamEnvironment.java:74)
at org.apache.flink.streaming.api.environment.StreamExecutionEnvironment.execute(StreamExecutionEnvironment.java:1699)
at org.apache.flink.streaming.api.environment.StreamExecutionEnvironment.execute(StreamExecutionEnvironment.java:1681)
at com.cep.StaticAlarmGenerationEntryTest.main(StaticAlarmGenerationEntryTest.java:149)
The error I met after I upgraded FLink from 1.10 to 1.11, and my IDE is eclipse.
and I tried to add artifactId:flink-clients_${scala.binary.version}, but still failed. Anybody already met and solved this issue, pls tell me. thanks a lot.
See the 1.11 release note, where you now have to add an explicit dependency on flink-clients.
I have solved my problem this way :
1.Use Java 8, apparently Flink has some sort of problem with Java 11 or 15
2.Change all the Scopes to "compile"
you can change scopes in this path : Project Structure → Modules → Dependencies → There is a table that one of its column's name is Scope
I found the reason why the error happened event I add dependency flink-clients. I upgraded Flink from 1.10 to 1.11, just edited the version of Flink, but not changed Scala version. Here also should change Scala version to 2.12. And the project is generated base on 1.10 archetype and Scala version is 2.11. Every time I build the project, it use the 2.11 environments.
So the fast way to solve this issue is :
use mvn archetype:generate -DarchetypeGroupId=org.apache.flink -DarchetypeArtifactId=flink-quickstart-java -DarchetypeVersion=1.11.0 this command to generate new project.
copy all your old code to this new project. You will find that the flink-clinets already added in the pom.xml.
I had this problem when I was packaging up the flink job in a shaded jar. When shading, if there are files with the same name in multiple jars it will overwrite the file as it unzips each jar into the new shaded jar.
Flink uses the file META-INF/services/org.apache.flink.core.execution.PipelineExecutorFactory to discover different executor factories and this file is present in multiple jars, each with different contents.
To fix this, I had to tell the maven-shade plugin to combine these files together as it came across them, and this solved the problem for me.
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-shade-plugin</artifactId>
<version>3.1.0</version>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>shade</goal>
</goals>
<configuration>
<shadedArtifactAttached>true</shadedArtifactAttached>
<shadedClassifierName>job</shadedClassifierName>
<transformers>
<!-- add this to combine the PipelineExecutorFactory files into one -->
<transformer implementation="org.apache.maven.plugins.shade.resource.AppendingTransformer">
<resource>META-INF/services/org.apache.flink.core.execution.PipelineExecutorFactory</resource>
</transformer>
</transformers>
...

How to create .bat file for rest assured project?

I am working on a Rest-Assured project which consists of testng.xml file also. I am trying to run the testng.xml file through batch. But it gives me error as -
could not find or load main class org.testng.TestNG
Below is the code for the batch file :-
cd C:\Users\workspace\RestAssured
set projectPath=C:\Users\workspace\RestAssured
java org.testng.TestNG "%projectPath%\testng.xml"
pause
I went through numerous batch file creation solution but still I am not able to replicate it. And also, in some solutions I see they have added classpath also like - set classpath=C:\Users\workspace\RestAssured\bin. But this bin folder doesn't exist in my project.
And also, Let's say, I have my project at C drive location. How to take the path of the project dynamically for different users?
You need to ensure that you set the class path properly.
Here's what you need to do:
Download the latest version of TestNG 7.0.0 from here.
Download the dependencies that TestNG and have them made available in a folder (say lib). The easiest way of figuring out the actual download URLs is by doing
http://repo1.maven.org/maven2" + groupId + "/ + artifactId + "/" + version (replace all . with /)
<dependency>
<groupId>com.beust</groupId>
<artifactId>jcommander</artifactId>
<version>1.72</version>
</dependency>
<dependency>
<groupId>org.apache.ant</groupId>
<artifactId>ant</artifactId>
<version>1.10.3</version>
</dependency>
<dependency>
<groupId>junit</groupId>
<artifactId>junit</artifactId>
<version>4.12</version>
</dependency>
<dependency>
<groupId>org.yaml</groupId>
<artifactId>snakeyaml</artifactId>
<version>1.21</version>
</dependency>
Once you have everything in your lib folder, create a batch file wherein you set the classpath to refer to all the jars in the lib folder,
cd C:\Users\workspace\RestAssured
set projectPath=%cd%
java -classpath "lib/*" org.testng.TestNG "%projectPath%\testng.xml"
pause
This should take care of all of your questions.

Gradle with Integrated SQL Security

I'm currently working on converting one of our Maven projects to use Gradle.
Here is the issue I'm currently facing:
This project is using SQL Integrated security. Here is how Maven handles it (this took us a while to figure it out):
<dependency>
<groupId>com.microsoft.sqlserver</groupId>
<artifactId>sqljdbc4</artifactId>
<version>4.0</version>
<scope>system</scope>
<systemPath>${project.basedir}/libs/sqljdbc4.jar</systemPath>
</dependency>
after run gradle init --type pom
this specific dependency has been converted to something like this:
system group: 'com.microsoft.jdbcdriver', name: 'sqljdbc', version:'4.0.1'
which is not right. Gradle can't build. More specifically, the system scope does not even exist in Gradle's API (neither I found it in any third party Gradle plugin).
Any help from whom had any experience with Gradle SQL integrated security would highly appreciated.
It is very easy to emulate scope system with Gradle by adding a configuration.
Create configuration system and set it as the compile classpath. Any dependencies added to system will now be available during compilation (though I doubt you need a specific JDBC driver for compilation), but the dependencies in system will not be added to the published dependencies of the module:
configurations {
system.extendsFrom compile
}
sourceSets {
main {
compileClasspath = configurations.system
}
}
Now you can easily add the JAR of the JDBC driver to the system configuration. This assumes you still want to refer to a local file just like with Maven:
dependencies {
system files('libs/sqljdbc-4.0.1.jar')
}
But if you have the JAR in a (local) repository, it is better to use the repository:
dependencies {
system 'com.microsoft.jdbcdriver:sqljdbc:4.0.1'
}

Unable to deploy profile to JBoss Fuse 6.1 using fabric8:deploy

I am trying to deploy a simple Camel route to my local instance of JBoss Fuse 6.1 (GA release). I am trying to use the fabric8-maven-plugin to do so, but everytime I run fabric8:deploy, I receive the following error
Failed to execute goal io.fabric8:fabric8-maven-plugin:1.0.0.redhat-379:deploy (default-cli) on project filemover: Error executing: IO-Error while contacting the server: org.apache.http.NoHttpResponseException: The target server failed to respond
Here is my current plugin-definition from my pom file
<plugin>
<groupId>io.fabric8</groupId>
<artifactId>fabric8-maven-plugin</artifactId>
<version>1.0.0.redhat-379</version>
<configuration>
<profile>sample-filemover</profile>
<parentProfiles>feature-camel</parentProfiles>
<features>mq-fabric-camel</features>
</configuration>
</plugin>
My ~/.m2/user/settings.xml file contains the following server definition
<server>
<id>fabric8.upload.repo</id>
<username>admin</username>
<password>admin</password>
</server>
And I am executing the following mvn command
mvn fabric8:deploy -Dmaven.test.skip=true
(I realize I am skipping the tests, but I am trying to just deploy a profile at this time)
I can log onto the management console just fine and can see the root container no problem. Have I missed something in the configuration of Fuse to enable this?
I just spend some hours in the same problem.
Just change the version to 1.1.0.CR5 and you can deploy using mvn fabric8:deploy
Best Regards
are you sure you are trying on the correct server? Just put the fabric URL server where you want to deploy. I'm using that plugin version and it works correctly.
I know may be it's too late, but just for let you know, you can deploy in any server with
mvn clean fabric8:deploy -Dfabric8.jolokiaUrl=http://localhost:8181/jolokia
Cheers

Resources