Skip to content

Commit

Permalink
bump up dependencies
Browse files Browse the repository at this point in the history
  • Loading branch information
akamarouski committed Nov 29, 2023
1 parent 22348d2 commit 9d5647a
Show file tree
Hide file tree
Showing 5 changed files with 65 additions and 69 deletions.
21 changes: 18 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,3 +1,18 @@
.idea/
out/
target/
.project
target
bin
.classpath
/test-output
/.settings
**/.settings
/com
/application.log
/sql.log
*.checkstyle
.idea
*.iml
test-output
*.log
/reports
/out
dependency-reduced-pom.xml
47 changes: 14 additions & 33 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -12,11 +12,10 @@
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<selenium.version>4.15.0</selenium.version>
<commons-logging.version>1.2</commons-logging.version>
<commons-io.version>2.7</commons-io.version>
<commons-lang3.version>3.5</commons-lang3.version>
<jackson-databind.version>2.9.10.8</jackson-databind.version>
<httpclient.version>4.5.13</httpclient.version>
<genson.version>0.99</genson.version>
<commons-lang3.version>3.14.0</commons-lang3.version>
<jackson-databind.version>2.16.0</jackson-databind.version>
<httpclient.version>5.2.2</httpclient.version>
<genson.version>1.6</genson.version>
<jersey-bundle.version>1.19.4</jersey-bundle.version>
<lombok.version>1.18.30</lombok.version>
<maven-shade-plugin.version>3.5.0</maven-shade-plugin.version>
Expand All @@ -26,31 +25,21 @@
<maven-javadoc-plugin.version>3.6.2</maven-javadoc-plugin.version>
</properties>
<dependencies>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${lombok.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-grid</artifactId>
<version>4.15.0</version>
<version>${selenium.version}</version>
</dependency>
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-api</artifactId>
<version>${selenium.version}</version>
</dependency>
<dependency>
<groupId>commons-logging</groupId>
<artifactId>commons-logging</artifactId>
<version>${commons-logging.version}</version>
</dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>${commons-io.version}</version>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${lombok.version}</version>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.apache.commons</groupId>
Expand All @@ -63,8 +52,8 @@
<version>${jackson-databind.version}</version>
</dependency>
<dependency>
<groupId>org.apache.httpcomponents</groupId>
<artifactId>httpclient</artifactId>
<groupId>org.apache.httpcomponents.client5</groupId>
<artifactId>httpclient5</artifactId>
<version>${httpclient.version}</version>
</dependency>
<dependency>
Expand All @@ -77,11 +66,10 @@
<artifactId>jersey-bundle</artifactId>
<version>${jersey-bundle.version}</version>
</dependency>

<dependency>
<groupId>javax.annotation</groupId>
<artifactId>javax.annotation-api</artifactId>
<version>1.2</version>
<groupId>jakarta.annotation</groupId>
<artifactId>jakarta.annotation-api</artifactId>
<version>3.0.0-M1</version>
</dependency>
</dependencies>
<build>
Expand Down Expand Up @@ -118,13 +106,6 @@
</goals>
<configuration>
<minimizeJar>false</minimizeJar>
<archive>
<manifest>
<mainClass>
org.openqa.selenium.grid.Bootstrap
</mainClass>
</manifest>
</archive>
<filters>
<filter>
<artifact>*:*</artifact>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,19 +16,20 @@
package com.zebrunner.mcloud.grid.util;

import com.owlike.genson.Genson;
import com.owlike.genson.GensonBuilder;

import javax.ws.rs.ext.ContextResolver;
import javax.ws.rs.ext.Provider;

/**
* GensonProvider - allows to deserialize timestamp to Date.
*
*
* @author akhursevich
*/
@Provider
public class GensonProvider implements ContextResolver<Genson> {

private final Genson genson = new Genson.Builder().useTimeInMillis(true).create();
private final Genson genson = new GensonBuilder().create();

@Override
public Genson getContext(Class<?> type) {
Expand Down
8 changes: 5 additions & 3 deletions src/main/java/com/zebrunner/mcloud/grid/util/HttpClient.java
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
import org.apache.commons.lang3.concurrent.LazyInitializer;
import org.apache.commons.lang3.exception.ExceptionUtils;

public class HttpClient {
public final class HttpClient {
private static final Logger LOGGER = Logger.getLogger(HttpClient.class.getName());

private static final LazyInitializer<Client> CLIENT = new LazyInitializer<>() {
Expand All @@ -48,6 +48,10 @@ protected Client initialize() throws ConcurrentException {
}
};

private HttpClient() {
//hide
}

public static Executor uri(Path path, String serviceUrl, Object... parameters) {
String url = path.build(serviceUrl, parameters);
return uri(url, null);
Expand Down Expand Up @@ -183,7 +187,5 @@ public void setObject(T object) {
public String toString() {
return "Response [status=" + status + ", object=" + object + "]";
}

}

}
53 changes: 25 additions & 28 deletions src/main/java/com/zebrunner/mcloud/grid/util/HttpClientApache.java
Original file line number Diff line number Diff line change
Expand Up @@ -17,40 +17,39 @@

import java.io.IOException;
import java.net.URI;
import java.time.Duration;
import java.util.logging.Level;
import java.util.logging.Logger;

import org.apache.http.HttpEntity;
import org.apache.http.client.config.RequestConfig;
import org.apache.http.client.methods.CloseableHttpResponse;
import org.apache.http.client.methods.HttpDelete;
import org.apache.http.client.methods.HttpEntityEnclosingRequestBase;
import org.apache.http.client.methods.HttpGet;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.client.methods.HttpPut;
import org.apache.http.client.methods.HttpUriRequest;
import org.apache.http.impl.client.CloseableHttpClient;
import org.apache.http.impl.client.HttpClientBuilder;
import org.apache.http.util.EntityUtils;
import org.apache.hc.client5.http.classic.methods.HttpDelete;
import org.apache.hc.client5.http.classic.methods.HttpGet;
import org.apache.hc.client5.http.classic.methods.HttpPost;
import org.apache.hc.client5.http.classic.methods.HttpPut;
import org.apache.hc.client5.http.classic.methods.HttpUriRequest;
import org.apache.hc.client5.http.classic.methods.HttpUriRequestBase;
import org.apache.hc.client5.http.config.RequestConfig;
import org.apache.hc.client5.http.impl.classic.CloseableHttpClient;
import org.apache.hc.client5.http.impl.classic.CloseableHttpResponse;
import org.apache.hc.client5.http.impl.classic.HttpClientBuilder;
import org.apache.hc.core5.http.HttpEntity;
import org.apache.hc.core5.http.ParseException;
import org.apache.hc.core5.http.io.entity.EntityUtils;
import org.apache.hc.core5.util.Timeout;

import com.zebrunner.mcloud.grid.integration.client.Path;
import com.zebrunner.mcloud.grid.util.HttpClient.Response;

public class HttpClientApache {
public final class HttpClientApache {

private static Logger LOGGER = Logger.getLogger(HttpClientApache.class.getName());

private final static RequestConfig DEFAULT_REQUEST_CFG = RequestConfig.custom()
.setConnectionRequestTimeout(1000)
.setConnectTimeout(1000)
.setSocketTimeout(3000)
private static final Logger LOGGER = Logger.getLogger(HttpClientApache.class.getName());
private static final RequestConfig DEFAULT_REQUEST_CFG = RequestConfig.custom()
.setConnectionRequestTimeout(Timeout.of(Duration.ofSeconds(3)))
.build();

private RequestConfig requestConfig = DEFAULT_REQUEST_CFG;

private String url;

private HttpClientApache() {
//hide
}

public static HttpClientApache create() {
Expand All @@ -75,12 +74,11 @@ public Response<String> get() {
return execute(new HttpGet(url));
}

public static class HttpGetWithEntity extends HttpEntityEnclosingRequestBase {
public static class HttpGetWithEntity extends HttpUriRequestBase {
public static final String METHOD_NAME = "GET";

public HttpGetWithEntity(final String uri) {
super();
setURI(URI.create(uri));
super(METHOD_NAME, URI.create(uri));
}

@Override
Expand Down Expand Up @@ -129,17 +127,16 @@ public Response<String> delete() {
}

private Response<String> execute(HttpUriRequest req) {
Response<String> result = new Response<String>();
Response<String> result = new Response<>();
try (CloseableHttpClient httpClient = HttpClientBuilder.create()
.setDefaultRequestConfig(requestConfig)
.build();
CloseableHttpResponse response = httpClient.execute(req)) {
result.setStatus(response.getStatusLine().getStatusCode());
result.setStatus(response.getCode());
result.setObject(EntityUtils.toString(response.getEntity()));
} catch (IOException e) {
} catch (IOException | ParseException e) {
LOGGER.log(Level.SEVERE, e.getMessage(), e);
}
return result;
}

}

0 comments on commit 9d5647a

Please sign in to comment.