Skip to content
This repository was archived by the owner on Dec 4, 2023. It is now read-only.

Commit 9d60e67

Browse files
authored
Formatting changes (#1076)
1 parent c01ecdd commit 9d60e67

File tree

11 files changed

+511
-401
lines changed

11 files changed

+511
-401
lines changed

libraries/bot-applicationinsights/src/main/java/com/microsoft/bot/applicationinsights/BotTelemetryClientImpl.java renamed to libraries/bot-applicationinsights/src/main/java/com/microsoft/bot/applicationinsights/ApplicationInsightsBotTelemetryClient.java

Lines changed: 264 additions & 247 deletions
Large diffs are not rendered by default.

libraries/bot-applicationinsights/src/main/java/com/microsoft/bot/applicationinsights/AvailabilityTelemetry.java

Lines changed: 38 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,9 @@
1212
import java.util.concurrent.ConcurrentMap;
1313

1414
/**
15-
* We took this class from https://github.com/microsoft/ApplicationInsights-Java/issues/1099
16-
* as this is not already migrated in ApplicationInsights-Java library.
15+
* We took this class from
16+
* https://github.com/microsoft/ApplicationInsights-Java/issues/1099 as this is
17+
* not already migrated in ApplicationInsights-Java library.
1718
*/
1819
public final class AvailabilityTelemetry extends BaseSampleSourceTelemetry<AvailabilityData> {
1920
private Double samplingPercentage;
@@ -23,7 +24,6 @@ public final class AvailabilityTelemetry extends BaseSampleSourceTelemetry<Avail
2324

2425
public static final String BASE_TYPE = "AvailabilityData";
2526

26-
2727
/**
2828
* Initializes a new instance of the AvailabilityTelemetry class.
2929
*/
@@ -38,19 +38,26 @@ public AvailabilityTelemetry() {
3838
}
3939

4040
/**
41-
* Initializes a new instance of the AvailabilityTelemetry class with the given name,
42-
* time stamp, duration, HTTP response code and success property values.
43-
* @param name A user-friendly name for the request.
44-
* @param duration The time of the request.
45-
* @param runLocation The duration, in milliseconds, of the request processing.
46-
* @param message The HTTP response code.
47-
* @param success 'true' if the request was a success, 'false' otherwise.
41+
* Initializes a new instance of the AvailabilityTelemetry class with the given
42+
* name, time stamp, duration, HTTP response code and success property values.
43+
*
44+
* @param name A user-friendly name for the request.
45+
* @param duration The time of the request.
46+
* @param runLocation The duration, in milliseconds, of the request processing.
47+
* @param message The HTTP response code.
48+
* @param success 'true' if the request was a success, 'false' otherwise.
4849
* @param measurements The measurements.
49-
* @param properties The corresponding properties.
50+
* @param properties The corresponding properties.
5051
*/
51-
public AvailabilityTelemetry(String name, Duration duration, String runLocation, String message,
52-
boolean success, ConcurrentMap<String, Double> measurements,
53-
ConcurrentMap<String, String> properties) {
52+
public AvailabilityTelemetry(
53+
String name,
54+
Duration duration,
55+
String runLocation,
56+
String message,
57+
boolean success,
58+
ConcurrentMap<String, Double> measurements,
59+
ConcurrentMap<String, String> properties
60+
) {
5461

5562
this.data = new AvailabilityData();
5663

@@ -70,9 +77,9 @@ public AvailabilityTelemetry(String name, Duration duration, String runLocation,
7077
setSuccess(success);
7178
}
7279

73-
7480
/**
7581
* Gets the ver value from the data object.
82+
*
7683
* @return The ver value.
7784
*/
7885
@Override
@@ -82,14 +89,17 @@ public int getVer() {
8289

8390
/**
8491
* Gets a map of application-defined request metrics.
92+
*
8593
* @return The map of metrics
8694
*/
8795
public ConcurrentMap<String, Double> getMetrics() {
8896
return data.getMeasurements();
8997
}
9098

9199
/**
92-
* Sets the StartTime. Uses the default behavior and sets the property on the 'data' start time.
100+
* Sets the StartTime. Uses the default behavior and sets the property on the
101+
* 'data' start time.
102+
*
93103
* @param timestamp The timestamp as Date.
94104
*/
95105
@Override
@@ -103,6 +113,7 @@ public void setTimestamp(Date timestamp) {
103113

104114
/**
105115
* Gets or human-readable name of the requested page.
116+
*
106117
* @return A human-readable name.
107118
*/
108119
public String getName() {
@@ -111,6 +122,7 @@ public String getName() {
111122

112123
/**
113124
* Sets or human-readable name of the requested page.
125+
*
114126
* @param name A human-readable name.
115127
*/
116128
public void setName(String name) {
@@ -119,6 +131,7 @@ public void setName(String name) {
119131

120132
/**
121133
* Gets or human-readable name of the run location.
134+
*
122135
* @return A human-readable name.
123136
*/
124137
public String getRunLocation() {
@@ -127,6 +140,7 @@ public String getRunLocation() {
127140

128141
/**
129142
* Sets or human-readable name of the run location.
143+
*
130144
* @param runLocation A human-readable name
131145
*/
132146
public void setRunLocation(String runLocation) {
@@ -135,6 +149,7 @@ public void setRunLocation(String runLocation) {
135149

136150
/**
137151
* Gets the unique identifier of the request.
152+
*
138153
* @return Unique identifier.
139154
*/
140155
public String getId() {
@@ -143,6 +158,7 @@ public String getId() {
143158

144159
/**
145160
* Sets the unique identifier of the request.
161+
*
146162
* @param id Unique identifier.
147163
*/
148164
public void setId(String id) {
@@ -151,6 +167,7 @@ public void setId(String id) {
151167

152168
/**
153169
* Gets a value indicating whether application handled the request successfully.
170+
*
154171
* @return Success indication.
155172
*/
156173
public boolean isSuccess() {
@@ -159,6 +176,7 @@ public boolean isSuccess() {
159176

160177
/**
161178
* Sets a value indicating whether application handled the request successfully.
179+
*
162180
* @param success Success indication.
163181
*/
164182
public void setSuccess(boolean success) {
@@ -167,6 +185,7 @@ public void setSuccess(boolean success) {
167185

168186
/**
169187
* Gets the amount of time it took the application to handle the request.
188+
*
170189
* @return Amount of time in milliseconds.
171190
*/
172191
public Duration getDuration() {
@@ -175,7 +194,9 @@ public Duration getDuration() {
175194

176195
/**
177196
* Sets the amount of time it took the application to handle the request.
178-
* @param duration Amount of time in captured in a {@link com.microsoft.applicationinsights.telemetry.Duration}.
197+
*
198+
* @param duration Amount of time in captured in a
199+
* {@link com.microsoft.applicationinsights.telemetry.Duration}.
179200
*/
180201
public void setDuration(Duration duration) {
181202
data.setDuration(duration);
@@ -214,4 +235,3 @@ public String getBaseTypeName() {
214235
return BASE_TYPE;
215236
}
216237
}
217-

libraries/bot-applicationinsights/src/main/java/com/microsoft/bot/applicationinsights/core/TelemetryInitializerMiddleware.java

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -27,11 +27,15 @@ public class TelemetryInitializerMiddleware implements Middleware {
2727

2828
/**
2929
* Initializes a new instance of the {@link TelemetryInitializerMiddleware}.
30+
*
3031
* @param withTelemetryLoggerMiddleware The TelemetryLoggerMiddleware to use.
31-
* @param withLogActivityTelemetry Boolean determining if you want to log telemetry activity
32+
* @param withLogActivityTelemetry Boolean determining if you want to log
33+
* telemetry activity
3234
*/
33-
public TelemetryInitializerMiddleware(TelemetryLoggerMiddleware withTelemetryLoggerMiddleware,
34-
Boolean withLogActivityTelemetry) {
35+
public TelemetryInitializerMiddleware(
36+
TelemetryLoggerMiddleware withTelemetryLoggerMiddleware,
37+
Boolean withLogActivityTelemetry
38+
) {
3539
telemetryLoggerMiddleware = withTelemetryLoggerMiddleware;
3640
if (withLogActivityTelemetry == null) {
3741
withLogActivityTelemetry = true;
@@ -40,9 +44,11 @@ public TelemetryInitializerMiddleware(TelemetryLoggerMiddleware withTelemetryLog
4044
}
4145

4246
/**
43-
* Stores the incoming activity as JSON in the items collection on the HttpContext.
47+
* Stores the incoming activity as JSON in the items collection on the
48+
* HttpContext.
49+
*
4450
* @param context The incoming TurnContext
45-
* @param next Delegate to run next on
51+
* @param next Delegate to run next on
4652
* @return Returns a CompletableFuture with Void value
4753
*/
4854
public CompletableFuture<Void> onTurn(TurnContext context, NextDelegate next) {
@@ -71,4 +77,3 @@ public CompletableFuture<Void> onTurn(TurnContext context, NextDelegate next) {
7177
}
7278
}
7379
}
74-

libraries/bot-applicationinsights/src/test/java/com/microsoft/bot/applicationinsights/BotTelemetryClientTests.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -38,21 +38,21 @@ public void initialize() {
3838
telemetryConfiguration.setChannel(mockTelemetryChannel);
3939
TelemetryClient telemetryClient = new TelemetryClient(telemetryConfiguration);
4040

41-
botTelemetryClient = new BotTelemetryClientImpl(telemetryClient);
41+
botTelemetryClient = new ApplicationInsightsBotTelemetryClient(telemetryClient);
4242
}
4343

4444
@Test
4545
public void nullTelemetryClientThrows() {
4646
Assert.assertThrows(IllegalArgumentException.class, () -> {
47-
new BotTelemetryClientImpl(null);
47+
new ApplicationInsightsBotTelemetryClient(null);
4848
});
4949
}
5050

5151
@Test
5252
public void nonNullTelemetryClientSucceeds() {
5353
TelemetryClient telemetryClient = new TelemetryClient();
5454

55-
BotTelemetryClient botTelemetryClient = new BotTelemetryClientImpl(telemetryClient);
55+
BotTelemetryClient botTelemetryClient = new ApplicationInsightsBotTelemetryClient(telemetryClient);
5656
}
5757

5858
@Test

libraries/bot-applicationinsights/src/test/java/com/microsoft/bot/applicationinsights/MyBotTelemetryClient.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010
import java.time.OffsetDateTime;
1111
import java.util.Map;
1212

13-
public class MyBotTelemetryClient extends BotTelemetryClientImpl {
13+
public class MyBotTelemetryClient extends ApplicationInsightsBotTelemetryClient {
1414
public MyBotTelemetryClient(TelemetryClient telemetryClient) {
1515
super(telemetryClient);
1616
}

libraries/bot-azure/src/main/java/com/microsoft/bot/azure/CosmosDbKeyEscape.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,8 @@ private CosmosDbKeyEscape() {
4848
* means a key of "?test?" would be escaped as "*3ftest*3f".
4949
*/
5050
private static final Map<Character, String> ILLEGAL_KEY_CHARACTER_REPLACEMENT_MAP = Arrays
51-
.stream(ArrayUtils.toObject(ILLEGAL_KEYS))
52-
.collect(Collectors.toMap(c -> c, c -> "*" + String.format("%02x", (int) c)));
51+
.stream(ArrayUtils.toObject(ILLEGAL_KEYS))
52+
.collect(Collectors.toMap(c -> c, c -> "*" + String.format("%02x", (int) c)));
5353

5454
/**
5555
* Converts the key into a DocumentID that can be used safely with Cosmos DB.
@@ -94,8 +94,8 @@ public static String escapeKey(String key, String suffix, Boolean compatibilityM
9494
// Allocate a builder that assumes that all remaining characters might be
9595
// replaced
9696
// to avoid any extra allocations
97-
StringBuilder sanitizedKeyBuilder = new StringBuilder(
98-
key.length() + ((key.length() - firstIllegalCharIndex) * ESCAPE_LENGTH));
97+
StringBuilder sanitizedKeyBuilder =
98+
new StringBuilder(key.length() + ((key.length() - firstIllegalCharIndex) * ESCAPE_LENGTH));
9999

100100
// Add all good characters up to the first bad character to the builder first
101101
for (Integer index = 0; index < firstIllegalCharIndex; index++) {

0 commit comments

Comments
 (0)