diff --git a/pom.xml b/pom.xml
index 7a0a6a4..3de1501 100644
--- a/pom.xml
+++ b/pom.xml
@@ -61,6 +61,11 @@
httpcore
4.4.14
+
+ org.apache.commons
+ commons-text
+ 1.9
+
org.apache.commons
commons-lang3
diff --git a/src/main/java/com/gooddata/http/client/GoodDataAuthException.java b/src/main/java/com/gooddata/http/client/GoodDataAuthException.java
index d392061..c3558cb 100644
--- a/src/main/java/com/gooddata/http/client/GoodDataAuthException.java
+++ b/src/main/java/com/gooddata/http/client/GoodDataAuthException.java
@@ -1,5 +1,5 @@
/*
- * (C) 2021 GoodData Corporation.
+ * (C) 2022 GoodData Corporation.
* This source code is licensed under the BSD-style license found in the
* LICENSE.txt file in the root directory of this source tree.
*/
diff --git a/src/main/java/com/gooddata/http/client/GoodDataHttpClient.java b/src/main/java/com/gooddata/http/client/GoodDataHttpClient.java
index 0846cc2..6072267 100644
--- a/src/main/java/com/gooddata/http/client/GoodDataHttpClient.java
+++ b/src/main/java/com/gooddata/http/client/GoodDataHttpClient.java
@@ -1,5 +1,5 @@
/*
- * (C) 2021 GoodData Corporation.
+ * (C) 2022 GoodData Corporation.
* This source code is licensed under the BSD-style license found in the
* LICENSE.txt file in the root directory of this source tree.
*/
@@ -8,8 +8,6 @@
import static com.gooddata.http.client.LoginSSTRetrievalStrategy.LOGIN_URL;
import static org.apache.commons.lang3.Validate.notNull;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
import org.apache.http.Header;
import org.apache.http.HttpHost;
import org.apache.http.HttpRequest;
diff --git a/src/main/java/com/gooddata/http/client/GoodDataLogoutException.java b/src/main/java/com/gooddata/http/client/GoodDataLogoutException.java
index 0aa5e36..b31384e 100644
--- a/src/main/java/com/gooddata/http/client/GoodDataLogoutException.java
+++ b/src/main/java/com/gooddata/http/client/GoodDataLogoutException.java
@@ -1,5 +1,5 @@
/*
- * (C) 2021 GoodData Corporation.
+ * (C) 2022 GoodData Corporation.
* This source code is licensed under the BSD-style license found in the
* LICENSE.txt file in the root directory of this source tree.
*/
diff --git a/src/main/java/com/gooddata/http/client/JsonUtils.java b/src/main/java/com/gooddata/http/client/JsonUtils.java
index 32f1916..c02a880 100644
--- a/src/main/java/com/gooddata/http/client/JsonUtils.java
+++ b/src/main/java/com/gooddata/http/client/JsonUtils.java
@@ -1,17 +1,19 @@
/*
- * (C) 2021 GoodData Corporation.
+ * (C) 2022 GoodData Corporation.
* This source code is licensed under the BSD-style license found in the
* LICENSE.txt file in the root directory of this source tree.
*/
package com.gooddata.http.client;
-import org.apache.commons.lang3.StringEscapeUtils;
+import org.apache.commons.text.StringEscapeUtils;
/**
* Internal JSON helper
*/
class JsonUtils {
+ private JsonUtils() {}
+
static String createLoginJson(final String login, final String password, final int verificationLevel) {
return "{\"postUserLogin\":{\"login\":\"" + StringEscapeUtils.escapeJava(login) +
"\",\"password\":\"" + StringEscapeUtils.escapeJava(password) + "\",\"remember\":0" +
diff --git a/src/main/java/com/gooddata/http/client/LoginSSTRetrievalStrategy.java b/src/main/java/com/gooddata/http/client/LoginSSTRetrievalStrategy.java
index f6cafed..dcc88d5 100644
--- a/src/main/java/com/gooddata/http/client/LoginSSTRetrievalStrategy.java
+++ b/src/main/java/com/gooddata/http/client/LoginSSTRetrievalStrategy.java
@@ -1,5 +1,5 @@
/*
- * (C) 2021 GoodData Corporation.
+ * (C) 2022 GoodData Corporation.
* This source code is licensed under the BSD-style license found in the
* LICENSE.txt file in the root directory of this source tree.
*/
diff --git a/src/main/java/com/gooddata/http/client/SSTRetrievalStrategy.java b/src/main/java/com/gooddata/http/client/SSTRetrievalStrategy.java
index b9b72e3..6fa9d94 100644
--- a/src/main/java/com/gooddata/http/client/SSTRetrievalStrategy.java
+++ b/src/main/java/com/gooddata/http/client/SSTRetrievalStrategy.java
@@ -1,5 +1,5 @@
/*
- * (C) 2021 GoodData Corporation.
+ * (C) 2022 GoodData Corporation.
* This source code is licensed under the BSD-style license found in the
* LICENSE.txt file in the root directory of this source tree.
*/
diff --git a/src/main/java/com/gooddata/http/client/SimpleSSTRetrievalStrategy.java b/src/main/java/com/gooddata/http/client/SimpleSSTRetrievalStrategy.java
index cb9c478..0e06f54 100644
--- a/src/main/java/com/gooddata/http/client/SimpleSSTRetrievalStrategy.java
+++ b/src/main/java/com/gooddata/http/client/SimpleSSTRetrievalStrategy.java
@@ -1,5 +1,5 @@
/*
- * (C) 2021 GoodData Corporation.
+ * (C) 2022 GoodData Corporation.
* This source code is licensed under the BSD-style license found in the
* LICENSE.txt file in the root directory of this source tree.
*/
@@ -8,7 +8,6 @@
import static org.apache.commons.lang3.Validate.notNull;
import org.apache.http.HttpHost;
-import org.apache.http.HttpStatus;
import org.apache.http.client.HttpClient;
import java.io.IOException;
diff --git a/src/main/java/com/gooddata/http/client/TokenUtils.java b/src/main/java/com/gooddata/http/client/TokenUtils.java
index 3e96cca..3abdee0 100644
--- a/src/main/java/com/gooddata/http/client/TokenUtils.java
+++ b/src/main/java/com/gooddata/http/client/TokenUtils.java
@@ -1,5 +1,5 @@
/*
- * (C) 2021 GoodData Corporation.
+ * (C) 2022 GoodData Corporation.
* This source code is licensed under the BSD-style license found in the
* LICENSE.txt file in the root directory of this source tree.
*/
@@ -17,6 +17,8 @@
*/
class TokenUtils {
+ private TokenUtils() {}
+
static String extractSST(final HttpResponse response) {
return extractToken(response, SST_HEADER);
}
diff --git a/src/test/java/com/gooddata/http/client/GoodDataHttpClientAT.java b/src/test/java/com/gooddata/http/client/GoodDataHttpClientAT.java
index 5eb41b6..77400b1 100644
--- a/src/test/java/com/gooddata/http/client/GoodDataHttpClientAT.java
+++ b/src/test/java/com/gooddata/http/client/GoodDataHttpClientAT.java
@@ -1,5 +1,5 @@
/*
- * (C) 2021 GoodData Corporation.
+ * (C) 2022 GoodData Corporation.
* This source code is licensed under the BSD-style license found in the
* LICENSE.txt file in the root directory of this source tree.
*/
@@ -9,18 +9,11 @@
import static com.gooddata.http.client.TestUtils.getForEntity;
import static com.gooddata.http.client.TestUtils.logout;
import static com.gooddata.http.client.TestUtils.performGet;
-import static org.junit.Assert.assertEquals;
-import org.apache.http.HttpEntity;
import org.apache.http.HttpHost;
-import org.apache.http.HttpResponse;
import org.apache.http.HttpStatus;
import org.apache.http.client.HttpClient;
-import org.apache.http.client.methods.HttpDelete;
-import org.apache.http.client.methods.HttpGet;
-import org.apache.http.entity.ContentType;
import org.apache.http.impl.client.HttpClientBuilder;
-import org.apache.http.util.EntityUtils;
import org.junit.Test;
import java.io.IOException;
@@ -31,6 +24,7 @@
* Acceptance tests. Requires GoodData credentials.
* mvn -Pat clean verify -DGDC_LOGIN=user@email.com -DGDC_PASSWORD=password [-DGDC_BACKEND=]
*/
+@SuppressWarnings("squid:S2699")
public class GoodDataHttpClientAT {
private static final String GDC_PROJECTS_PATH = "/gdc/projects";
diff --git a/src/test/java/com/gooddata/http/client/GoodDataHttpClientIntegrationTest.java b/src/test/java/com/gooddata/http/client/GoodDataHttpClientIntegrationTest.java
index 4784e02..3085c03 100644
--- a/src/test/java/com/gooddata/http/client/GoodDataHttpClientIntegrationTest.java
+++ b/src/test/java/com/gooddata/http/client/GoodDataHttpClientIntegrationTest.java
@@ -1,5 +1,5 @@
/*
- * (C) 2021 GoodData Corporation.
+ * (C) 2022 GoodData Corporation.
* This source code is licensed under the BSD-style license found in the
* LICENSE.txt file in the root directory of this source tree.
*/
@@ -36,6 +36,7 @@
import java.util.concurrent.Semaphore;
import java.util.concurrent.TimeUnit;
+@SuppressWarnings("squid:S2699")
public class GoodDataHttpClientIntegrationTest {
private static final String GDC_TOKEN_PATH = "/gdc/account/token";
diff --git a/src/test/java/com/gooddata/http/client/GoodDataHttpClientTest.java b/src/test/java/com/gooddata/http/client/GoodDataHttpClientTest.java
index a33572f..3dd4ca1 100644
--- a/src/test/java/com/gooddata/http/client/GoodDataHttpClientTest.java
+++ b/src/test/java/com/gooddata/http/client/GoodDataHttpClientTest.java
@@ -1,5 +1,5 @@
/*
- * (C) 2021 GoodData Corporation.
+ * (C) 2022 GoodData Corporation.
* This source code is licensed under the BSD-style license found in the
* LICENSE.txt file in the root directory of this source tree.
*/
diff --git a/src/test/java/com/gooddata/http/client/GoodDataLogoutExceptionMatcher.java b/src/test/java/com/gooddata/http/client/GoodDataLogoutExceptionMatcher.java
index 391a43b..9b72e5d 100644
--- a/src/test/java/com/gooddata/http/client/GoodDataLogoutExceptionMatcher.java
+++ b/src/test/java/com/gooddata/http/client/GoodDataLogoutExceptionMatcher.java
@@ -1,5 +1,5 @@
/*
- * (C) 2021 GoodData Corporation.
+ * (C) 2022 GoodData Corporation.
* This source code is licensed under the BSD-style license found in the
* LICENSE.txt file in the root directory of this source tree.
*/
diff --git a/src/test/java/com/gooddata/http/client/JsonUtilsTest.java b/src/test/java/com/gooddata/http/client/JsonUtilsTest.java
index 92aaf58..a07147f 100644
--- a/src/test/java/com/gooddata/http/client/JsonUtilsTest.java
+++ b/src/test/java/com/gooddata/http/client/JsonUtilsTest.java
@@ -1,5 +1,5 @@
/*
- * (C) 2021 GoodData Corporation.
+ * (C) 2022 GoodData Corporation.
* This source code is licensed under the BSD-style license found in the
* LICENSE.txt file in the root directory of this source tree.
*/
diff --git a/src/test/java/com/gooddata/http/client/LoginSSTRetrievalStrategyTest.java b/src/test/java/com/gooddata/http/client/LoginSSTRetrievalStrategyTest.java
index 46b6c68..8c8977e 100644
--- a/src/test/java/com/gooddata/http/client/LoginSSTRetrievalStrategyTest.java
+++ b/src/test/java/com/gooddata/http/client/LoginSSTRetrievalStrategyTest.java
@@ -1,12 +1,11 @@
/*
- * (C) 2021 GoodData Corporation.
+ * (C) 2022 GoodData Corporation.
* This source code is licensed under the BSD-style license found in the
* LICENSE.txt file in the root directory of this source tree.
*/
package com.gooddata.http.client;
import org.apache.commons.io.IOUtils;
-import org.apache.commons.logging.Log;
import org.apache.http.HttpHost;
import org.apache.http.HttpResponse;
import org.apache.http.HttpStatus;
@@ -17,15 +16,16 @@
import org.apache.http.client.methods.HttpDelete;
import org.apache.http.client.methods.HttpPost;
import org.apache.http.entity.BasicHttpEntity;
-import org.apache.http.entity.StringEntity;
import org.apache.http.message.BasicHttpResponse;
import org.apache.http.message.BasicStatusLine;
+import org.junit.After;
import org.junit.Before;
import org.junit.Rule;
import org.junit.Test;
import org.junit.rules.ExpectedException;
import org.mockito.ArgumentCaptor;
import org.mockito.Mock;
+
import org.mockito.MockitoAnnotations;
import org.slf4j.Logger;
@@ -53,6 +53,7 @@ public class LoginSSTRetrievalStrategyTest {
private static final String TT = "xxxtopsecretTT";
private LoginSSTRetrievalStrategy sstStrategy;
+ private AutoCloseable mockClass;
@Mock
public HttpClient httpClient;
@@ -69,11 +70,15 @@ public class LoginSSTRetrievalStrategyTest {
@Before
public void setUp() {
- MockitoAnnotations.initMocks(this);
+ mockClass = MockitoAnnotations.openMocks(this);
host = new HttpHost("server.com", 123);
sstStrategy = new LoginSSTRetrievalStrategy(LOGIN, PASSWORD);
}
+ @After
+ public void tearDown() throws Exception {
+ mockClass.close();
+ }
@Test
public void obtainSstHeader() throws IOException {
statusLine = new BasicStatusLine(new ProtocolVersion("https", 1, 1), HttpStatus.SC_OK, "OK");
diff --git a/src/test/java/com/gooddata/http/client/SimpleSSTRetrievalStrategyTest.java b/src/test/java/com/gooddata/http/client/SimpleSSTRetrievalStrategyTest.java
index 323dcb1..94a8e61 100644
--- a/src/test/java/com/gooddata/http/client/SimpleSSTRetrievalStrategyTest.java
+++ b/src/test/java/com/gooddata/http/client/SimpleSSTRetrievalStrategyTest.java
@@ -1,5 +1,5 @@
/*
- * (C) 2021 GoodData Corporation.
+ * (C) 2022 GoodData Corporation.
* This source code is licensed under the BSD-style license found in the
* LICENSE.txt file in the root directory of this source tree.
*/
@@ -9,7 +9,7 @@
import org.junit.Test;
-
+@SuppressWarnings("squid:S2699")
public class SimpleSSTRetrievalStrategyTest {
public static final String TOKEN = "sst token";
diff --git a/src/test/java/com/gooddata/http/client/TestUtils.java b/src/test/java/com/gooddata/http/client/TestUtils.java
index 43e60eb..88aecce 100644
--- a/src/test/java/com/gooddata/http/client/TestUtils.java
+++ b/src/test/java/com/gooddata/http/client/TestUtils.java
@@ -1,5 +1,5 @@
/*
- * (C) 2021 GoodData Corporation.
+ * (C) 2022 GoodData Corporation.
* This source code is licensed under the BSD-style license found in the
* LICENSE.txt file in the root directory of this source tree.
*/
@@ -7,10 +7,8 @@
import static org.junit.Assert.assertEquals;
-import org.apache.http.HttpEntity;
import org.apache.http.HttpHost;
import org.apache.http.HttpResponse;
-import org.apache.http.HttpStatus;
import org.apache.http.client.HttpClient;
import org.apache.http.client.methods.HttpDelete;
import org.apache.http.client.methods.HttpGet;
diff --git a/src/test/java/com/gooddata/http/client/TokenUtilsTest.java b/src/test/java/com/gooddata/http/client/TokenUtilsTest.java
index 374907a..5fb7402 100644
--- a/src/test/java/com/gooddata/http/client/TokenUtilsTest.java
+++ b/src/test/java/com/gooddata/http/client/TokenUtilsTest.java
@@ -1,5 +1,5 @@
/*
- * (C) 2021 GoodData Corporation.
+ * (C) 2022 GoodData Corporation.
* This source code is licensed under the BSD-style license found in the
* LICENSE.txt file in the root directory of this source tree.
*/
diff --git a/src/test/resources/log4j.properties b/src/test/resources/log4j.properties
index b1e2117..28be612 100644
--- a/src/test/resources/log4j.properties
+++ b/src/test/resources/log4j.properties
@@ -1,5 +1,5 @@
#
-# (C) 2021 GoodData Corporation.
+# (C) 2022 GoodData Corporation.
# This source code is licensed under the BSD-style license found in the
# LICENSE.txt file in the root directory of this source tree.
#