How to call karate features present in a dependency JAR from another karate feature file? [duplicate] - jar

This question already has an answer here:
How to distribute Karate testing framework? [closed]
(1 answer)
Closed 1 year ago.
I would like to re-use karate feature file present in a JAR (added as dependency to the working maven java project).
In the documentation at https://github.com/intuit/karate#karate-basejs, I can see the following :
Advanced users who build frameworks on top of Karate have the option to supply a karate-base.js file that Karate will look for on the classpath:. This is useful when you ship a JAR file containing re-usable features and JavaScript / Java code and want to 'default' a few variables that teams can 'inherit' from
But I do not understand how can I achieve this. Is it possible to share any example where the karate features present in a dependency JAR are called from a karate feature file

There is only one rule you need to be aware of. If a file exists on the Java classpath, Karate can read it if you use a classpath: prefix. This is explained in detail in the documentation: https://github.com/intuit/karate#reading-files - and you can find links to examples there.
So how you create a JAR file and how you add that to the classpath is up to you and has nothing to do with Karate.

Related

Identify the list of projects in Artifactory associated with a specific jar file using Fortify

I have an Artifactory with several projects, each having various versions of .jar files within.
How can I use Fortify to identify a vulnerability within a specific version of .jar file, say v1.2.1.
On top of this, I may have several latest versions.
Since v1.2.1 is identified to be having a vulnerability with the help of Fortify, how to identify the list of projects that internally use this v1.2.1 .jar file using Fortify ?
If you are using one of the Build integrations (i.e. generate a buildInfo) you can either:
1. Retrieve the BuildInfo json and extract the list of project dependencies from there (also, you can take a look here, here, and the best option, here). Or,
2. Use the Artifactory Query Language (AQL) to get a list of dependencies used in the project (Build).
p.s I work at JFrog

Is there a direct way to get a full ejb/servlet application example for glassfish

I have an application that is currently running on JBoss AS but does not work on Glassfish. I'm trying to work through the documentation here but I'm having trouble figuring out things like what the file structure of the application should be and what (if any) additional files are needed. This documentation also refers to examples but to get the examples you need to install Netbeans and access an update tool tied to the glassfish instance installed with Netbeans. When I do this the server won't start, the update tool won't run, and I can't get the examples. Is there an easy way to get these examples (e.g. a simple download)? I've found other examples such as this one, but they are also dependent upon Netbeans.
Is there a simple and complete ejb/servlet example for Glassfish that can be simply downloaded and does not depend upon Netbeans or other IDE?
The obvious example is the Java EE CargoTracker. It was written to show what a "real" application might look like with pure Java EE APIs so should work on both JBoss and GlassFish. You will need Maven installed to build and run it, but there are more complete details in the readme for the project. Note that some of the information is a little out of date (mostly links to java.net which has been sunset in favour of a GitHub site) but the application itself is still a good example of Java EE 7 APIs.
https://github.com/javaee/cargotracker
I found the examples on github here:
https://github.com/javaee/glassfish-samples
To get and build the examples you will need Git and Maven. These examples are small, complete, and concise. The example that was helpful for my particular problem was this example:
glassfish-samples\ws\javaee5\enterprise\servlet-stateless-ear
It demonstrated that I needed to change the structure of my project such that the servlet was in a .war file and not in a .jar file in the lib folder of my project.

Stuck with creating Keyword library using Java in Eclipse and using that JAR file in RIDE

I'm new to ROBOT framework and must create library keyword using java and utilize the JAR files in RIDE editor. I have followed the below steps. But still have confusions in where to start up. Please help me to achieve this.
Steps:
1) Installed Python, wxPython, pybot, RIDE, selenium2library successfully and I'm able to work with RIDE using predefined keywords.
2) For creating own java library, Installed Eclipse Mars, Java, ROBOT IDE manually using the link https://github.com/NitorCreations/RobotFramework-EclipseIDE/wiki/Installation
The question here is,
Anything i'm missing to install?
How to proceed further with Robot Framework coding?
Note: I'm reading many materials in parts to proceed things. But that is confusing me what are the steps to be followed. Is there any single material that i can get having the sequences of steps that need to be followed for my requirements?
The below links I referred with,
https://github.com/NitorCreations/RobotFramework-EclipseIDE/wiki/Usage
Maven error "Failure to transfer..."
Create a Maven project in Eclipse complains "Could not resolve archetype"
http://robotframework.org/robotframework/latest/RobotFrameworkUserGuide.html#using-set-test-suite-global-variable-keywords
Let's start with the basics. RIDE is an editor for Robot Script files. Robot Script files are executed by the Robot Framework robot application. It is important to understand the difference between these two applications. One creates files and the other uses them.
Assuming for a moment here that you have some custom functionality in a Jar file that you would like to make available inside the Robot Script files test cases. If this is indeed the case then your focus should be on create Robot Test Libraries. In the documentation there are numerous java examples given for basing your own library on.
This means that you do not need Maven, unless you want to, to create your library. Also Eclipse IDE is not needed nor is RIDE. The library you create can be used by Robot Framework even when it's run from the command line. Feel free to use them for what they are good at: writing Robot Scripts efficiently and running Robot through menu options instead of command line windows.
When you are familiar with Eclipse and comfortable with it's features, then I can also recommend using the Eclipse Application RED which is a mature Eclipse add on for creating, running and debugging Robot scripts.
There are two ways of implementing a Java routine in Robot Framework and it depends a bit on how you run Robot Framework: Python or Jython. Running Python means that you need to run the Java in a separate JVM container and connect to it. The simplest way is via Command Line interaction. This may cause some security concerns. The second approach is to use the Remote Library approach. A good example of this is the Robot Framework Sikuli Library. An added bonus is that you can run Robot and your Java application on two separate machines/servers.
The Jython way has been discussed on StackOverflow before and I gladly refer to it. Please bear in mind that although the examples refer to RIDE, the Library org.company.Keywordlibrary works in all IDE's, provided robot framework is run using Jython.
In the Jython documentation it clearly explains how to setup an Eclipse based IDE with Jython. Do keep in mind that it's recommended to use the same interpreter in development and production. I.e. if you create your scripts in Jython, do run them in 'production' also using Jython. Otherwise you open yourself up to interpreter differences where functionality does not work or behaves differently then expected.
An alternative approach with Jython is the all-in-one Robot Framework Maven JAR plugin. Adding a custom Java Library in this setup is not too difficult. A nice short tutorial can be found on the blog of Valerio Bruno. If this is your preferred route for development, then you may want to read the RED howto on integrating the Robot Framework Maven jar.
Working on your custom functionality is likely going to be a independent project in Eclipse, but can be linked to an Robot project via the Class Path settings in red.xml if you use RED or the CLASS_PATH environment variable.
Done! I have installed RED and required add on using following below steps. It worked successfully with predefined keywords. Now I'm gonna create user defined keywords/libraries using the same editor. I don't know where to start up. Will it work creating just a java project? Should I need to include any additional libraries?
Steps followed to proceed with RED:
1. RED Version Conclusion: https://github.com/nokia/RED/blob/master/release.md
2. RED Installation Instructions: https://github.com/nokia/RED/blob/master/installation.md
3. ROBOT Framework prerequisites using RED: https://github.com/nokia/RED/blob/master/red_help/first_steps/download_install.html.md
4. To verify Installations in Eclipse: Help -> Installation Details to check if RED is visible on installed features list
5. Create Project and Tests using RED in Eclipse: https://github.com/nokia/RED/blob/master/red_help/first_steps/create_run.html.md
6. RED Steps: https://github.com/nokia/RED/blob/master/First_steps.md
7. Quick STart: https://github.com/nokia/RED/blob/master/red_help/user_guide/quick_start.html.md

GitHub fails to determine the repository language

I use GitHub for a C++ / Qt project. GitHub automatically determines the languages of the project from the file extentions. Problem: Qt has a file name ProjectName.pro, which is interpreted to be Prolog by GitHub.
How can I indicate it is NOT Prolog, but C++ ?
It is actually a known issue: https://github.com/github/linguist/issues/394
It's been submitted 6 month ago but GitHub still doesn't bother fixing it... Do you think of any workaround ?
As said in the original issue (https://github.com/github/linguist/issues/394):
Linguist now supports custom overrides for language definitions and
custom vendor paths
So in order to finally have Qt project files properly recognized as C++ in language statistics, you can add this line in your .gitattributes file.
*.pro linguist-language=C++
See https://github.com/github/linguist#overrides for more details.

JavaFX license - is including javaFX jar on your app server not breaching the license? [duplicate]

This question already has an answer here:
May JavaFX 2.0 be redistributed? [closed]
(1 answer)
Closed 7 years ago.
So I've got an application which starts via Java WebStart. It requires javafx jar to work properly. If I place the javaFX jar on my server (so that it could be downloaded when starting the application) would it be ok with the license?
I'm not sure about the license (it should be possibe to provide native bundles which include the jre + javafx), but for Java WebStart the recommended way is to install the latest JRE on client-side, which comes with JavaFX. So you don't need the javafx jar on the server.
You should include the JavaFX start classes in the main jar, however, and have the correct JavaFX Manifest entries. But since the JavaFX Ant task provided by Oracle is copying these start classes to the main jar, I guess it's ok to use them. But I'm not a lawyer.

Resources