Skip to content

Commit

Permalink
Merge pull request #64 from robotframework/fix/rf_remote_api_requirem…
Browse files Browse the repository at this point in the history
…ents

Fix/rf remote api requirements
  • Loading branch information
Hi-Fi committed Mar 24, 2022
2 parents 1f881eb + e5df3dc commit 82f904d
Show file tree
Hide file tree
Showing 10 changed files with 72 additions and 36 deletions.
16 changes: 10 additions & 6 deletions .github/workflows/maven.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,13 @@ jobs:
java: [ 8 ]
name: Test with Java ${{ matrix.java }}
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up JDK ${{ matrix.java }}
uses: actions/setup-java@v1.2.0
uses: actions/setup-java@v2
with:
distribution: 'zulu'
java-version: ${{ matrix.java }}
cache: 'maven'
- name: Build with Maven
run: mvn -B verify --file pom.xml
release:
Expand All @@ -25,13 +27,15 @@ jobs:
runs-on: ubuntu-latest
name: Release package
steps:
- uses: actions/checkout@v2
- uses: actions/checkout@v3
- name: Set up JDK
uses: actions/setup-java@v1.2.0
uses: actions/setup-java@v2
with:
java-version: 8
distribution: 'zulu'
java-version: '8'
cache: 'maven'
- name: Release Maven package
uses: samuelmeuli/action-maven-publish@1221d1fa792cab948a772c5e7c1f3abe84aec3bf
uses: samuelmeuli/action-maven-publish@201a45a3f311b2ee888f252ba9f4194257545709 # tag=v1.4.0
with:
gpg_private_key: ${{ secrets.gpg_private_key }}
gpg_passphrase: ${{ secrets.gpg_passphrase }}
Expand Down
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -12,3 +12,4 @@ atest/results
*.iml
/.apt_generated/
/.apt_generated_tests/
__pycache__
2 changes: 1 addition & 1 deletion README.rest
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ New version:
<dependency>
<groupId>org.robotframework</groupId>
<artifactId>jrobotremoteserver</artifactId>
<version>4.0.1</version>
<version>4.1.0</version>
</dependency>
Old version
Expand Down
38 changes: 26 additions & 12 deletions examples/AnnotationLibrary/pom.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>com.example</groupId>
<artifactId>MyRemoteLibrary</artifactId>
Expand All @@ -15,42 +15,55 @@
<dependency>
<groupId>org.robotframework</groupId>
<artifactId>javalib-core</artifactId>
<version>0.9.1</version>
<version>2.0.3</version>
</dependency>

<!-- serve the library remotely -->
<dependency>
<groupId>com.github.ombre42</groupId>
<groupId>org.robotframework</groupId>
<artifactId>jrobotremoteserver</artifactId>
<version>2.0-BETA</version>
<version>4.1.0</version>
</dependency>

<!-- escape text for HTML and copy IO streams -->
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.12.0</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.3</version>
<version>2.11.0</version>
</dependency>

<!-- used to generate the library documentation -->
<dependency>
<groupId>org.robotframework</groupId>
<artifactId>robotframework</artifactId>
<version>2.7.0</version>
<version>4.1.2</version>
<scope>test</scope>
</dependency>

<!-- unit testing framework used to generate the library documentation -->
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>6.3.1</version>
<version>7.5</version>
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>

<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<version>3.8.1</version>
<configuration>
<source>1.8</source>
<target>1.8</target>
</configuration>
</plugin>
<!-- create a jar with all dependencies i.e. a standalone jar -->
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
Expand Down Expand Up @@ -81,9 +94,9 @@

<!-- execute Robot Framework tests during the build -->
<plugin>
<groupId>com.googlecode.robotframework-maven-plugin</groupId>
<groupId>org.robotframework</groupId>
<artifactId>robotframework-maven-plugin</artifactId>
<version>1.1.1</version>
<version>2.1.0</version>
<executions>
<execution>
<phase>test</phase>
Expand All @@ -93,7 +106,8 @@
</execution>
</executions>
<configuration>

<logLevel>TRACE:INFO</logLevel>
<testCasesDirectory>src/test/resources/robotframework/tests</testCasesDirectory>
<!-- communicate to the acceptance tests that the library is being built -->
<variables>
<variable>BUILDING:True</variable>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import java.nio.charset.Charset;

import org.apache.commons.io.IOUtils;

import org.robotframework.javalib.library.AnnotationLibrary;
import org.robotframework.remoteserver.RemoteServer;

Expand All @@ -26,8 +27,8 @@ public String getKeywordDocumentation(String keywordName) {
*/
public static void main(String[] args) throws Exception {
RemoteServer.configureLogging();
RemoteServer server = new RemoteServer();
server.addLibrary(MyRemoteLibrary.class, 8270);
RemoteServer server = new RemoteServer(8270);
server.putLibrary("/", new MyRemoteLibrary());
server.start();
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
package com.example.keywords;

import static org.apache.commons.lang.StringEscapeUtils.escapeHtml;
import static org.apache.commons.lang3.StringEscapeUtils.*;

import java.util.Iterator;
import java.util.Queue;
Expand Down Expand Up @@ -47,7 +47,7 @@ public void logQueue() {
Iterator<Object> iter = queue.iterator();
while (iter.hasNext()) {
Object element = iter.next();
String value = escapeHtml(element.toString());
String value = escapeHtml4(element.toString());
sb.append("<tr>");
sb.append("<td>" + value + "</td>");
sb.append("<td>" + element.getClass().getName() + "</td>");
Expand Down
24 changes: 12 additions & 12 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>org.robotframework</groupId>
<artifactId>jrobotremoteserver</artifactId>
<version>4.0.2-SNAPSHOT</version>
<version>4.1.1-SNAPSHOT</version>
<packaging>jar</packaging>
<name>jrobotremoteserver</name>
<description>Serves remote test libraries for Robot Framework that are implemented in Java.</description>
Expand Down Expand Up @@ -55,12 +55,12 @@
<dependency>
<groupId>org.eclipse.jetty</groupId>
<artifactId>jetty-servlet</artifactId>
<version>9.4.31.v20200723</version>
<version>9.4.45.v20220203</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
<artifactId>commons-lang3</artifactId>
<version>3.11</version>
<version>3.12.0</version>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
Expand All @@ -70,12 +70,12 @@
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-core</artifactId>
<version>2.13.3</version>
<version>2.17.2</version>
</dependency>
<dependency>
<groupId>org.apache.logging.log4j</groupId>
<artifactId>log4j-jcl</artifactId>
<version>2.13.3</version>
<version>2.17.2</version>
</dependency>
<dependency>
<groupId>org.robotframework</groupId>
Expand All @@ -91,7 +91,7 @@
<dependency>
<groupId>org.testng</groupId>
<artifactId>testng</artifactId>
<version>7.3.0</version>
<version>7.5</version>
<scope>test</scope>
</dependency>
<dependency>
Expand All @@ -102,7 +102,7 @@
<dependency>
<groupId>org.jboss.resteasy</groupId>
<artifactId>tjws</artifactId>
<version>3.9.3.Final</version>
<version>3.15.3.Final</version>
<scope>test</scope>
</dependency>
</dependencies>
Expand Down Expand Up @@ -138,7 +138,7 @@
</goals>
</execution>
</executions>
<version>3.2.0</version>
<version>3.3.0</version>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
Expand All @@ -161,7 +161,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-javadoc-plugin</artifactId>
<version>3.1.1</version>
<version>3.2.0</version>
<executions>
<execution>
<goals>
Expand All @@ -182,7 +182,7 @@
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>1.8</version>
<version>3.0.0</version>
<executions>
<execution>
<id>define-classpath</id>
Expand All @@ -203,7 +203,7 @@
<plugin>
<groupId>org.robotframework</groupId>
<artifactId>robotframework-maven-plugin</artifactId>
<version>1.7.2</version>
<version>2.1.0</version>
<executions>
<execution>
<id>FullDynamic</id>
Expand Down Expand Up @@ -381,7 +381,7 @@
<plugin>
<groupId>org.sonatype.plugins</groupId>
<artifactId>nexus-staging-maven-plugin</artifactId>
<version>1.6.7</version>
<version>1.6.8</version>
<extensions>true</extensions>
<configuration>
<serverId>ossrh</serverId>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -235,7 +235,7 @@ public void start() throws Exception {
}

/**
* Configures logging systems used by <tt>RemoteServer</tt> and its
* Configures logging systems used by <i>RemoteServer</i> and its
* dependencies. Specifically,
* <ul>
* <li>Configure Log4J to log to the console</li>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
package org.robotframework.remoteserver.servlet;

import java.util.*;
import java.util.stream.Collectors;

import org.apache.commons.lang3.StringUtils;
import org.apache.commons.lang3.exception.ExceptionUtils;
Expand Down Expand Up @@ -198,6 +199,21 @@ public List<String> get_keyword_types(String keyword) {
return types == null ? new ArrayList<String>() : types;
}

public Map<String, Object> get_library_information() {
return get_keyword_names().stream()
.map(k->new AbstractMap.SimpleEntry<>(k, getLibraryInformation(k)))
.collect(Collectors.toMap(Map.Entry::getKey, Map.Entry::getValue));
}

private Object getLibraryInformation(String keyword) {
Map<String, Object> info = new HashMap<>();
info.put("args", get_keyword_arguments(keyword));
info.put("types", get_keyword_types(keyword));
info.put("tags", get_keyword_tags(keyword));
info.put("doc", get_keyword_documentation(keyword));
return info;
}

/**
* Stops the remote server if it is configured to allow that.
*
Expand Down

0 comments on commit 82f904d

Please sign in to comment.