Skip to content

Commit 4ef18b6

Browse files
Logging improvements and changes (#297)
* Descriptions have been added/improved on exception logs * Stack trace are always attached in exception logs * Logs are parameterized instead of concatenated, with the exception of ConfigurationLogger because of its gargantuan size * Trailing white spaces are removed from all files
1 parent 94de81f commit 4ef18b6

File tree

99 files changed

+843
-868
lines changed

Some content is hidden

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

99 files changed

+843
-868
lines changed

CONTRIBUTING.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -59,20 +59,20 @@ Pull requests can be merged by members of the [the repository maintainers' team]
5959
### License Management
6060
To be accepted into the repository, contributions must be licensed under the Apache License 2.0. Consequently, a license notice shall be included in suitable comment syntax where applicable. This license notice shall state the copyright holder(s) and point to the commit history for a full list of individual contributors, on the following format:
6161

62-
> Copyright <Year(s)> <Copyright holder of original contribution [and others].>
62+
> Copyright <Year(s)> <Copyright holder of original contribution [and others].>
6363
> For a full list of individual contributors, please see the commit history.
6464
6565
The copyright holder is either the individual contributor if they act on their own behalf, or any organization on whose behalf they contribute. When multiple copyright holders have contributed to the same file, the copyright notice shall be appended "and others". The copyright year(s) shall reflect the year(s) of contribution(s) and be updated accordingly when new contributions are made to the file. To exemplify, the copyright notice of an original contribution made by Jane Doe acting on behalf of Ericsson AB may read:
6666

67-
> Copyright 2018 Ericsson AB.
67+
> Copyright 2018 Ericsson AB.
6868
> For a full list of individual contributors, please see the commit history.
6969
7070
When John Doe, acting on his own behalf, makes a subsequent addition to the same file, the notice will be updated accordingly:
7171

72-
> Copyright 2018 Ericsson AB and others.
72+
> Copyright 2018 Ericsson AB and others.
7373
> For a full list of individual contributors, please see the commit history.
7474
7575
When John Doe makes a subsequent contribution the following year, the notice will again be updated:
7676

77-
> Copyright 2018-2019 Ericsson AB and others.
77+
> Copyright 2018-2019 Ericsson AB and others.
7878
> For a full list of individual contributors, please see the commit history.

pom.xml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -401,7 +401,7 @@
401401
<version>${springBootVersion}</version>
402402
</plugin>
403403

404-
<!-- PhoenixNAP RAML Code Generator plugin used to generate sources
404+
<!-- PhoenixNAP RAML Code Generator plugin used to generate sources
405405
from raml -->
406406
<plugin>
407407
<groupId>com.phoenixnap.oss</groupId>
@@ -548,7 +548,7 @@
548548
<goal>copy-resources</goal>
549549
</goals>
550550
<configuration>
551-
<!-- site plugin requires all resources to exist
551+
<!-- site plugin requires all resources to exist
552552
within resources/ directory -->
553553
<!-- but we don't want to break links in documentation -->
554554
<outputDirectory>${basedir}/wiki/resources/images</outputDirectory>
@@ -572,7 +572,7 @@
572572
<configuration>
573573
<!-- This is where site.xml is located -->
574574
<siteDirectory>${basedir}/wiki</siteDirectory>
575-
<!-- Github pages only generates documentation from docs
575+
<!-- Github pages only generates documentation from docs
576576
directory -->
577577
<outputDirectory>${basedir}/docs</outputDirectory>
578578
</configuration>

src/functionaltests/java/com/ericsson/ei/files/DownloadFilesTestSteps.java

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -27,15 +27,15 @@
2727
public class DownloadFilesTestSteps extends FunctionalTestBase {
2828

2929
private static final Logger LOGGER = LoggerFactory.getLogger(DownloadFilesTestSteps.class);
30-
30+
3131
private static final String SUBSCRIPTIONS_TEMPLATE_FILEPATH = "src/main/resources/templates/subscriptionsTemplate.json";
3232
private static final String RULES_TEMPLATE_FILEPATH = "src/main/resources/templates/rulesTemplate.json";
3333
private static final String EVENTS_TEMPLATE_FILEPATH = "src/main/resources/templates/eventsTemplate.json";
34-
34+
3535
private ObjectMapper objMapper = new ObjectMapper();
3636
private HttpRequest httpRequest = new HttpRequest(HttpMethod.GET);
3737
ResponseEntity<String> response;
38-
38+
3939
@LocalServerPort
4040
private int applicationPort;
4141
private String hostName = getHostName();
@@ -52,53 +52,53 @@ public void eiffel_intelligence_instance_is_up_and_running() throws Exception {
5252
response = httpRequest.performRequest();
5353
assertEquals(response.getStatusCode(), HttpStatus.OK);
5454
}
55-
55+
5656
@Then("^List available files$")
5757
public void list_available_files() throws Exception {
5858
LOGGER.debug("Listing all availble files that can be download via RestApi.");
5959
String expectedSubscriptionsValue = "/download/subscriptionsTemplate";
6060

6161
httpRequest.setEndpoint("/download");
6262
response = httpRequest.performRequest();
63-
63+
6464
assertEquals(HttpStatus.OK, response.getStatusCode());
65-
65+
6666
String actualSubscriptionsValue = objMapper.readValue(response.getBody(), JsonNode.class).get("subscriptions").asText();
6767
assertEquals("List all files don't return expected subscriptions file value. \nExpected: "
6868
+ expectedSubscriptionsValue + "\nActual: "+ actualSubscriptionsValue,
6969
expectedSubscriptionsValue, actualSubscriptionsValue);
7070
}
71-
71+
7272
@And("^Get subscription template file$")
7373
public void get_subscription_template_file() throws Exception {
7474
String expectedSubscriptionTemplateContent = FileUtils.readFileToString(new File(SUBSCRIPTIONS_TEMPLATE_FILEPATH), "UTF-8");
7575

7676
httpRequest.setEndpoint("/download/subscriptionsTemplate");
7777
response = httpRequest.performRequest();
78-
78+
7979
assertEquals(HttpStatus.OK, response.getStatusCode());
80-
80+
8181
String actualSubscriptionTemplateContent = response.getBody();
8282
assertEquals("Get SubscriptionTemplate file failed or contents is not as expected. \nExpected: "
8383
+ expectedSubscriptionTemplateContent + "\nActual: "+ actualSubscriptionTemplateContent,
8484
expectedSubscriptionTemplateContent, actualSubscriptionTemplateContent);
8585
}
86-
86+
8787
@And("^Get rules template file$")
8888
public void get_rules_template_file() throws Exception {
8989
String expectedRulesTemplateContent = FileUtils.readFileToString(new File(RULES_TEMPLATE_FILEPATH), "UTF-8");
90-
90+
9191
httpRequest.setEndpoint("/download/rulesTemplate");
9292
response = httpRequest.performRequest();
93-
93+
9494
assertEquals(HttpStatus.OK, response.getStatusCode());
95-
95+
9696
String actualRulesTemplateContent = response.getBody();
9797
assertEquals("Get RulesTemplate file failed or contents is not as expected. \nExpected: "
9898
+ expectedRulesTemplateContent + "\nActual: "+ actualRulesTemplateContent,
9999
expectedRulesTemplateContent, actualRulesTemplateContent);
100100
}
101-
101+
102102
@And("^Get event template file$")
103103
public void get_event_template_file() throws Exception {
104104
String expectedEventsTemplateContent = FileUtils.readFileToString(new File(EVENTS_TEMPLATE_FILEPATH), "UTF-8");

src/functionaltests/java/com/ericsson/ei/threadingAndWaitlistRepeat/ThreadingAndWaitlistRepeatSteps.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public class ThreadingAndWaitlistRepeatSteps extends FunctionalTestBase {
4646
@Before("@ThreadingAndWaitlistRepeatScenario")
4747
public void beforeScenario() throws IOException {
4848
tempLogFile = File.createTempFile("logfile", ".tmp");
49-
tempLogFile.deleteOnExit();
49+
tempLogFile.deleteOnExit();
5050
System.setOut(new PrintStream(tempLogFile));
5151
}
5252

@@ -76,15 +76,15 @@ public void the_waitlist_will_try_to_resend_the_events_at_given_time_interval()
7676
List<String> lines = new ArrayList<>(Files.readAllLines(tempLogFile.toPath()));
7777

7878
for (String line : lines) {
79-
Pattern pattern = Pattern.compile("\\[EIFFEL EVENT RESENT\\] id:([a-zA-Z\\d-]+)");
79+
Pattern pattern = Pattern.compile("\\[EIFFEL EVENT RESENT\\] id: ([a-zA-Z\\d-]+)");
8080
Matcher matcher = pattern.matcher(line);
8181
if (matcher.find() && !matcher.group(1).equals("")) {
8282
if (!resentEvents.contains(matcher.group(1))) {
8383
resentEvents.add(matcher.group(1));
8484
}
8585
}
8686
}
87-
assertEquals(resentEvents.size(), getEventNamesToSend().size());
87+
assertEquals(getEventNamesToSend().size(), resentEvents.size());
8888
}
8989

9090
@Then("^correct amount of threads should be spawned$")

src/functionaltests/java/com/ericsson/ei/utils/DataBaseManager.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -153,7 +153,7 @@ private List<String> compareSentEventsWithEventsInDB(List<String> checklist) {
153153

154154
/**
155155
* Retrieve a value from a database query result
156-
*
156+
*
157157
* @param key
158158
* @param index
159159
* @return String value matching the given key

src/functionaltests/java/com/ericsson/ei/utils/EventManager.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ public void sendEiffelEvents(String eiffelEventsJsonPath, List<String> eventName
4545
* Send Eiffel Event to the waitlist queue. Takes a Json String containing a
4646
* single event.
4747
48-
*
48+
*
4949
* @param eiffelEventJson
5050
*/
5151
public void sendEiffelEvent(String eiffelEventJson) {
@@ -87,7 +87,7 @@ public JsonNode getJSONFromFile(String filePath) throws IOException {
8787

8888
/**
8989
* Converts a JSON string into a tree model.
90-
*
90+
*
9191
* @param document
9292
* string of json
9393
* @return JsonNode tree model

src/functionaltests/java/com/ericsson/ei/utils/HttpExecutor.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -23,17 +23,17 @@ public final class HttpExecutor {
2323
private static final Logger LOGGER = LoggerFactory.getLogger(HttpExecutor.class);
2424

2525
private HttpExecutor() {
26-
26+
2727
}
28-
28+
2929
public static HttpExecutor getInstance() {
3030
if(instance == null) {
3131
instance = new HttpExecutor();
3232
}
33-
33+
3434
return instance;
3535
}
36-
36+
3737
/**
3838
* Close existing HttpClient and create a new one.
3939
*
@@ -49,7 +49,7 @@ public void recreateHttpClient() {
4949
}
5050
this.client = HttpClientBuilder.create().build();
5151
}
52-
52+
5353
/**
5454
* Handle the response from a HTTP request
5555
* @param request
@@ -71,7 +71,7 @@ public ResponseEntity<String> executeRequest(HttpRequestBase request) {
7171
} catch(IOException e) {
7272
LOGGER.error(e.getMessage(), e);
7373
}
74-
74+
7575
MultiValueMap<String, String> headersMap = new LinkedMultiValueMap<String, String>();
7676
for (Header header : headers) {
7777
headersMap.add(header.getName(), header.getValue());

src/functionaltests/java/com/ericsson/ei/utils/HttpRequest.java

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -62,17 +62,17 @@ public HttpRequest(HttpMethod method) {
6262
break;
6363
}
6464
}
65-
65+
6666
/*
6767
* Function that clean parameters field only.
6868
*/
6969
public void cleanParams() {
7070
params.clear();
7171
}
72-
72+
7373
/*
7474
* Function that resets the HTTP Request object so it can be reused.
75-
*
75+
*
7676
*/
7777
public void resetHttpRequestObject() {
7878
this.cleanParams();
@@ -81,10 +81,10 @@ public void resetHttpRequestObject() {
8181

8282
/*
8383
* Function for adding headers to the http request.
84-
*
84+
*
8585
* @param key , the key of the header
8686
* @param value, the value of the header
87-
*
87+
*
8888
* @return HTTPRequest
8989
*/
9090
public HttpRequest addHeader(String key, String value) {
@@ -94,10 +94,10 @@ public HttpRequest addHeader(String key, String value) {
9494

9595
/*
9696
* Function for adding parameters to the http request.
97-
*
97+
*
9898
* @param key , the key of the parameter
9999
* @param value, the value of the parameter
100-
*
100+
*
101101
* @return HTTPRequest
102102
*/
103103
public HttpRequest addParam(String key, String value) {
@@ -107,9 +107,9 @@ public HttpRequest addParam(String key, String value) {
107107

108108
/*
109109
* Function that set the body of the http request.
110-
*
110+
*
111111
* @param body , the body to be set in the http request.
112-
*
112+
*
113113
* @return HTTPRequest
114114
*/
115115
public HttpRequest setBody(String body) {
@@ -119,7 +119,7 @@ public HttpRequest setBody(String body) {
119119

120120
/*
121121
* Function that set the body of the http request.
122-
*
122+
*
123123
* @param body , the file with body content to be set in the http request.
124124
*/
125125
public void setBody(File file) {
@@ -134,7 +134,7 @@ public void setBody(File file) {
134134

135135
/*
136136
* Function that execute http request.
137-
*
137+
*
138138
* @return ResponseEntity<String> , the response of the performed http request.
139139
*/
140140
public ResponseEntity<String> performRequest() throws URISyntaxException {

src/functionaltests/resources/eiffel_events_for_test.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@
5252
"classifier": ""
5353
}
5454
],
55-
55+
5656
"identity": "pkg:maven/com.mycompany.myproduct/artifact-name@1.0.0"
5757
}
5858
},

0 commit comments

Comments
 (0)