Skip to content

Commit e12a0fb

Browse files
🪴 code cleaned
1 parent 0057068 commit e12a0fb

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

59 files changed

+1716
-1546
lines changed

pom.xml

Lines changed: 32 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<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">
2+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
3+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
34
<modelVersion>4.0.0</modelVersion>
45
<groupId>com.contentstack</groupId>
56
<artifactId>cms</artifactId>
@@ -292,22 +293,35 @@
292293
<version>${jococo-plugin.version}</version>
293294
</plugin>
294295

295-
<plugin>
296-
<groupId>org.apache.maven.plugins</groupId>
297-
<artifactId>maven-surefire-plugin</artifactId>
298-
<version>2.22.2</version>
299-
<configuration>
300-
<properties>
301-
<configurationParameters>
302-
junit.jupiter.extensions.autodetection.enabled = true
303-
junit.jupiter.testinstance.lifecycle.default = per_class
304-
junit.jupiter.execution.parallel.enabled = true
305-
junit.jupiter.execution.parallel.mode.default = concurrent
306-
junit.jupiter.execution.parallel.config.fixed.parallelism
307-
</configurationParameters>
308-
</properties>
309-
</configuration>
310-
</plugin>
296+
<!-- <plugin>-->
297+
<!-- <groupId>org.apache.maven.plugins</groupId>-->
298+
<!-- <artifactId>maven-surefire-plugin</artifactId>-->
299+
<!-- <version>2.22.2</version>-->
300+
<!-- <configuration>-->
301+
<!-- <properties>-->
302+
<!-- <configurationParameters>-->
303+
<!-- junit.jupiter.extensions.autodetection.enabled = true-->
304+
<!-- junit.jupiter.testinstance.lifecycle.default = per_class-->
305+
<!-- junit.jupiter.execution.parallel.enabled = true-->
306+
<!-- junit.jupiter.execution.parallel.mode.default = concurrent-->
307+
<!-- junit.jupiter.execution.parallel.config.fixed.parallelism-->
308+
<!-- </configurationParameters>-->
309+
<!-- </properties>-->
310+
<!-- </configuration>-->
311+
<!-- </plugin>-->
312+
313+
<!-- <plugin>-->
314+
<!-- <groupId>org.apache.maven.plugins</groupId>-->
315+
<!-- <artifactId>maven-surefire-plugin</artifactId>-->
316+
<!-- <version>3.0.0-M3</version>-->
317+
<!-- <configuration>-->
318+
<!-- &lt;!&ndash; include tags &ndash;&gt;-->
319+
<!-- <groups>unit, api</groups>-->
320+
<!-- &lt;!&ndash; exclude tags &ndash;&gt;-->
321+
<!-- <excludedGroups>dontrun</excludedGroups>-->
322+
<!-- </configuration>-->
323+
<!-- </plugin>-->
324+
311325
</plugins>
312326

313327
<pluginManagement>
@@ -329,7 +343,7 @@
329343
</goals>
330344
</pluginExecutionFilter>
331345
<action>
332-
<ignore />
346+
<ignore/>
333347
</action>
334348
</pluginExecution>
335349
</pluginExecutions>

src/main/java/com/contentstack/cms/core/AuthInterceptor.java

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -10,14 +10,14 @@
1010
/**
1111
* <b>The type Header interceptor that extends Interceptor</b>
1212
* <p>
13-
* Interceptors are a powerful way to customize requests with Retrofit. A common
14-
* use-case where you want to intercept
15-
* the actual request is to observe, modifies, and potentially short-circuits
16-
* requests going out and the corresponding
17-
* responses coming back in. Typically, interceptors add, remove, or transform
18-
* headers on the request. Depending on the
19-
* API implementation, you'll want to pass the auth token as the value for the
20-
* Authorization header.
13+
* Interceptors are a powerful way to customize requests with Retrofit. A common use-case where you want to intercept
14+
* the actual request is to observe, modifies, and potentially short-circuits requests going out and the corresponding
15+
* responses coming back in. Typically, interceptors add, remove, or transform headers on the request. Depending on the
16+
* API implementation, you'll want to pass the auth token as the value for the Authorization header.
17+
*
18+
* @author ***REMOVED***
19+
* @version 1.0.0
20+
* @since 2022-05-19
2121
*/
2222
public class AuthInterceptor implements Interceptor {
2323

src/main/java/com/contentstack/cms/core/CMSLogger.java

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,13 @@
44

55
import java.util.logging.Logger;
66

7+
/**
8+
* The Contentstack Logger
9+
*
10+
* @author ***REMOVED***
11+
* @version 1.0.0
12+
* @since 2022-05-19
13+
*/
714
public class CMSLogger {
815

916
private final Logger logger;
@@ -28,7 +35,9 @@ public void finer(@NotNull String message) {
2835
logger.finer(message);
2936
}
3037

31-
public void warning(@NotNull String message) { logger.warning(message);}
38+
public void warning(@NotNull String message) {
39+
logger.warning(message);
40+
}
3241

3342
public void severe(@NotNull String message) {
3443
logger.severe(message);

src/main/java/com/contentstack/cms/core/CMSRuntimeException.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
package com.contentstack.cms.core;
22

3+
/**
4+
* CMSRuntimeException that extends Exception class
5+
*
6+
* @author ***REMOVED***
7+
* @version 1.0.0
8+
* @since 2022-05-19
9+
*/
310
public class CMSRuntimeException extends Exception {
411
public CMSRuntimeException(String message) {
512
super(message);

src/main/java/com/contentstack/cms/core/CSResponse.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public <T> T toModel(Class<T> tClass, Response<ResponseBody> response) throws IO
5252
return new Gson().fromJson(body, tClass);
5353
}
5454

55-
public Request requestBody(Call callInstance){
55+
public Request requestBody(Call callInstance) {
5656
return callInstance.request();
5757
}
5858

src/main/java/com/contentstack/cms/core/Callback.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
package com.contentstack.cms.core;
22

3+
/**
4+
* The Callback for the contentstack response
5+
*
6+
* @author ***REMOVED***
7+
* @version 1.0.0
8+
* @since 2022-05-19
9+
*/
310
public interface Callback {
411
void result();
512

src/main/java/com/contentstack/cms/core/ContentstackResponse.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,10 @@
1010
/**
1111
* The ContentstackResponse is the response when we execute the API Response, ContentstackResponse contains different
1212
* response type
13-
* <p>
14-
* Since: 1.0.0
13+
*
14+
* @author ***REMOVED***
15+
* @version 1.0.0
16+
* @since 2022-05-19
1517
*/
1618
public class ContentstackResponse<T> {
1719

@@ -22,7 +24,7 @@ public Response<ResponseBody> fetch(Call<ResponseBody> response) {
2224
try {
2325
return response.execute();
2426
} catch (IOException e) {
25-
throw new RuntimeException(e);
27+
throw new RuntimeException(e.getLocalizedMessage());
2628
}
2729
}
2830

@@ -40,6 +42,4 @@ ResponseBody getResponseBody() {
4042
return null;
4143
}
4244

43-
// Synchronously send the request and return its response
44-
4545
}

src/main/java/com/contentstack/cms/core/ResponseResult.java

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,13 @@
88
import java.io.IOException;
99
import java.lang.reflect.Type;
1010

11+
/**
12+
* The Contentstack ResponseResult class that accepts different types of Models
13+
*
14+
* @author ***REMOVED***
15+
* @version 1.0.0
16+
* @since 2022-05-19
17+
*/
1118
public class ResponseResult<T> {
1219

1320
public T execute(Call<T> call) throws IOException {
@@ -22,18 +29,17 @@ public T execute(Call<T> call) throws IOException {
2229
data = new Gson().fromJson(result.errorBody().string(), (Type) Error.class);
2330
}
2431
}
25-
2632
return data;
2733
}
2834
}
2935

3036
/*
3137
* class BaseCallBack<T> implements Callback<T> {
32-
*
38+
*
3339
* @Override public void onResponse(Call<T> call, Response<T> response) { if
3440
* (!response.isSuccessful()) {
3541
* System.out.println("Response Fail"); } }
36-
*
42+
*
3743
* @Override public void onFailure(Call<T> call, Throwable t) {
3844
* System.out.println("Response Fail" + t.toString()); } }
3945
* <p>

src/main/java/com/contentstack/cms/core/RetryCallback.java

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -7,9 +7,11 @@
77
import java.util.logging.Logger;
88

99
/**
10-
* The type Callback with retry.
10+
* The Contentstack RetryCallback
1111
*
12-
* @param <T> the type parameter
12+
* @author ***REMOVED***
13+
* @version 1.0.0
14+
* @since 2022-05-19
1315
*/
1416
public abstract class RetryCallback<T> implements Callback<T> {
1517

@@ -19,10 +21,10 @@ public abstract class RetryCallback<T> implements Callback<T> {
1921
private int retryCount = 0;
2022

2123
/**
22-
*
2324
* Instantiates a new Callback with retry.
2425
*
25-
* @param call the call
26+
* @param call
27+
* the call
2628
*/
2729
protected RetryCallback(Call<T> call) {
2830
this.call = call;

src/main/java/com/contentstack/cms/core/Util.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,13 @@
66

77
import java.util.Objects;
88

9+
910
/**
1011
* The Utility class that contains utility common functions
12+
*
13+
* @author ***REMOVED***
14+
* @version 1.0.0
15+
* @since 2022-05-19
1116
*/
1217
public class Util {
1318

@@ -38,7 +43,6 @@ public class Util {
3843
public static final String CONTENT_TYPE_VALUE = "application/json";
3944

4045

41-
4246
Util() throws IllegalAccessException {
4347
throw new IllegalAccessException("private=modifier");
4448
}
@@ -55,7 +59,8 @@ protected static String defaultUserAgent() {
5559
}
5660

5761
/**
58-
* @param field throws an exception for not providing a valid input
62+
* @param field
63+
* throws an exception for not providing a valid input
5964
*/
6065
public static void nullEmptyThrowsException(@NotNull String field) {
6166
Objects.requireNonNull(field);

0 commit comments

Comments
 (0)