Skip to content

Commit 31c0e30

Browse files
committed
fixing unit test
1 parent 0218cec commit 31c0e30

File tree

3 files changed

+70
-48
lines changed

3 files changed

+70
-48
lines changed

README.md

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -21,8 +21,6 @@ Add it as a maven dependency:
2121
</dependency>
2222
```
2323

24-
25-
2624
## Configuration and Usage for Direct Logger
2725

2826
You need a stackify-api.properties file on your classpath that defines the configuration required for the Log API:
@@ -116,7 +114,6 @@ For legacy support of **Java 1.6 and 1.7** use the following maven dependency:
116114
</dependency>
117115
```
118116

119-
120117
## License
121118

122119
Copyright 2019 Stackify, LLC.

pom.xml

Lines changed: 63 additions & 36 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
1-
<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">
1+
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
2+
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
23
<modelVersion>4.0.0</modelVersion>
34

45
<groupId>com.stackify</groupId>
@@ -9,12 +10,6 @@
910
<description>Stackify API for Java</description>
1011
<url>https://github.com/stackify/stackify-api-java</url>
1112

12-
<parent>
13-
<groupId>org.sonatype.oss</groupId>
14-
<artifactId>oss-parent</artifactId>
15-
<version>9</version>
16-
</parent>
17-
1813
<licenses>
1914
<license>
2015
<name>The Apache Software License, Version 2.0</name>
@@ -46,6 +41,17 @@
4641

4742
<properties>
4843
<java.version>1.8</java.version>
44+
<slf4j-api.version>1.7.28</slf4j-api.version>
45+
<jackson.version>2.7.9</jackson.version>
46+
<jackson-databind.version>2.7.9.6</jackson-databind.version>
47+
<httpclient.version>4.5.9</httpclient.version>
48+
<junixsocket.version>2.2.0</junixsocket.version>
49+
<failsafe.version>2.3.0</failsafe.version>
50+
<protobuf.version>3.9.1</protobuf.version>
51+
<lombok.version>1.18.8</lombok.version>
52+
<junit.version>4.11</junit.version>
53+
<mockito.version>1.9.5</mockito.version>
54+
<powermock.version>1.5.6</powermock.version>
4955
</properties>
5056

5157
<dependencies>
@@ -55,63 +61,63 @@
5561
<dependency>
5662
<groupId>org.slf4j</groupId>
5763
<artifactId>slf4j-api</artifactId>
58-
<version>1.7.28</version>
64+
<version>${slf4j-api.version}</version>
5965
</dependency>
6066

6167
<dependency>
6268
<groupId>com.fasterxml.jackson.core</groupId>
6369
<artifactId>jackson-core</artifactId>
64-
<version>2.7.9</version>
70+
<version>${jackson.version}</version>
6571
</dependency>
6672

6773
<dependency>
6874
<groupId>com.fasterxml.jackson.core</groupId>
6975
<artifactId>jackson-annotations</artifactId>
70-
<version>2.7.9</version>
76+
<version>${jackson.version}</version>
7177
</dependency>
7278

7379
<dependency>
7480
<groupId>com.fasterxml.jackson.core</groupId>
7581
<artifactId>jackson-databind</artifactId>
76-
<version>2.7.9.6</version>
77-
</dependency>
78-
79-
<dependency>
80-
<groupId>com.google.protobuf</groupId>
81-
<artifactId>protobuf-java</artifactId>
82-
<version>3.9.1</version>
82+
<version>${jackson-databind.version}</version>
8383
</dependency>
8484

8585
<dependency>
8686
<groupId>org.apache.httpcomponents</groupId>
8787
<artifactId>httpclient</artifactId>
88-
<version>4.5.9</version>
88+
<version>${httpclient.version}</version>
8989
</dependency>
9090

9191
<dependency>
9292
<groupId>com.kohlschutter.junixsocket</groupId>
9393
<artifactId>junixsocket-common</artifactId>
94-
<version>2.2.0</version>
94+
<version>${junixsocket.version}</version>
9595
</dependency>
9696

9797
<dependency>
9898
<groupId>com.kohlschutter.junixsocket</groupId>
9999
<artifactId>junixsocket-native-common</artifactId>
100-
<version>2.2.0</version>
100+
<version>${junixsocket.version}</version>
101101
</dependency>
102102

103103
<dependency>
104104
<groupId>net.jodah</groupId>
105105
<artifactId>failsafe</artifactId>
106-
<version>2.3.0</version>
106+
<version>${failsafe.version}</version>
107+
</dependency>
108+
109+
<dependency>
110+
<groupId>com.google.protobuf</groupId>
111+
<artifactId>protobuf-java</artifactId>
112+
<version>${protobuf.version}</version>
107113
</dependency>
108114

109115
<!-- Provided dependencies -->
110116

111117
<dependency>
112118
<groupId>org.projectlombok</groupId>
113119
<artifactId>lombok</artifactId>
114-
<version>1.18.8</version>
120+
<version>${lombok.version}</version>
115121
<scope>provided</scope>
116122
</dependency>
117123

@@ -122,42 +128,42 @@
122128
<dependency>
123129
<groupId>org.slf4j</groupId>
124130
<artifactId>slf4j-log4j12</artifactId>
125-
<version>1.7.28</version>
131+
<version>${slf4j-api.version}</version>
126132
<scope>test</scope>
127133
</dependency>
128134

129135
<dependency>
130136
<groupId>junit</groupId>
131137
<artifactId>junit</artifactId>
132-
<version>4.11</version>
138+
<version>${junit.version}</version>
133139
<scope>test</scope>
134140
</dependency>
135141

136142
<dependency>
137143
<groupId>org.mockito</groupId>
138144
<artifactId>mockito-core</artifactId>
139-
<version>1.9.5</version>
145+
<version>${mockito.version}</version>
140146
<scope>test</scope>
141147
</dependency>
142148

143149
<dependency>
144150
<groupId>org.powermock</groupId>
145151
<artifactId>powermock-core</artifactId>
146-
<version>1.5.6</version>
152+
<version>${powermock.version}</version>
147153
<scope>test</scope>
148154
</dependency>
149155

150156
<dependency>
151157
<groupId>org.powermock</groupId>
152158
<artifactId>powermock-module-junit4</artifactId>
153-
<version>1.5.6</version>
159+
<version>${powermock.version}</version>
154160
<scope>test</scope>
155161
</dependency>
156162

157163
<dependency>
158164
<groupId>org.powermock</groupId>
159165
<artifactId>powermock-api-mockito</artifactId>
160-
<version>1.5.6</version>
166+
<version>${powermock.version}</version>
161167
<scope>test</scope>
162168
</dependency>
163169

@@ -172,14 +178,6 @@
172178
</resource>
173179
</resources>
174180

175-
<extensions>
176-
<extension>
177-
<groupId>org.apache.maven.wagon</groupId>
178-
<artifactId>wagon-webdav-jackrabbit</artifactId>
179-
<version>2.2</version>
180-
</extension>
181-
</extensions>
182-
183181
<plugins>
184182

185183
<plugin>
@@ -231,6 +229,35 @@
231229
</executions>
232230
</plugin>
233231

232+
<plugin>
233+
<groupId>org.apache.maven.plugins</groupId>
234+
<artifactId>maven-enforcer-plugin</artifactId>
235+
<version>1.0</version>
236+
<executions>
237+
<execution>
238+
<id>enforce-bytecode-version</id>
239+
<goals>
240+
<goal>enforce</goal>
241+
</goals>
242+
<configuration>
243+
<rules>
244+
<enforceBytecodeVersion>
245+
<maxJdkVersion>${java.version}</maxJdkVersion>
246+
</enforceBytecodeVersion>
247+
</rules>
248+
<fail>true</fail>
249+
</configuration>
250+
</execution>
251+
</executions>
252+
<dependencies>
253+
<dependency>
254+
<groupId>org.codehaus.mojo</groupId>
255+
<artifactId>extra-enforcer-rules</artifactId>
256+
<version>1.2</version>
257+
</dependency>
258+
</dependencies>
259+
</plugin>
260+
234261
</plugins>
235262

236263
</build>

src/main/java/com/stackify/api/common/log/LogTransportAgentSocket.java

Lines changed: 7 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -61,22 +61,20 @@ public LogTransportAgentSocket(@NonNull final ApiConfiguration apiConfig,
6161
*/
6262
public void send(@NonNull final LogMsgGroup group) throws Exception {
6363

64-
// run pre-processor
65-
66-
logTransportPreProcessor.execute(group);
67-
68-
// convert to protobuf model
64+
try {
6965

70-
StackifyProto.LogGroup logGroup = LogMsgGroupConverter.convert(group);
66+
// run pre-processor
67+
logTransportPreProcessor.execute(group);
7168

72-
// post to stackify
69+
// convert to protobuf model
70+
StackifyProto.LogGroup logGroup = LogMsgGroupConverter.convert(group);
7371

74-
try {
72+
// post to stackify
7573
HttpPost httpPost = new HttpPost(URI_PREFIX + "/log");
7674
httpPost.setHeader("Content-Type", "application/x-protobuf");
7775
httpPost.setEntity(new ByteArrayEntity(logGroup.toByteArray()));
7876
httpSocketClient.send(httpPost);
79-
} catch (Exception e) {
77+
} catch (Throwable e) {
8078
log.info("Queueing logs for retransmission due to Exception");
8179
log.debug(e.getMessage(), e);
8280
throw e;

0 commit comments

Comments
 (0)