Skip to content

Commit cc62e8d

Browse files
committed
minor refactoring
1 parent bd6eede commit cc62e8d

10 files changed

Lines changed: 20 additions & 19 deletions

File tree

java/src/main/java/com/cybersource/ws/client/Client.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -210,7 +210,7 @@ private static Document soapWrapAndSign(
210210
if (!logSignedData) {
211211
logger.log(
212212
Logger.LT_REQUEST,
213-
"UUID > "+(mc.getUniqueKey()).toString() + "\n" +
213+
"UUID > "+(logger.getUniqueKey()).toString() + "\n" +
214214
"Input request is" + "\n" +
215215
"======================================= \n"
216216
+ mapToString(request, true, PCI.REQUEST));

java/src/main/java/com/cybersource/ws/client/HttpClientConnection.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ void postDocument(Document request, long requestSentTime)
7878
* SimpleHttpConnectionManager(boolean alwaysClose) :
7979
* alwaysClose - if set true, the connection manager will always close connections upon release.
8080
*/
81-
81+
8282
HttpClient httpClient = new HttpClient(new SimpleHttpConnectionManager(true));
8383
setTimeout(httpClient, mc.getTimeout() * 1000);
8484
setProxy(httpClient);
@@ -255,7 +255,7 @@ public boolean retryMethod(
255255
// if it's OK to retry methods that have been sent
256256
try {
257257
Thread.sleep(retryWaitInterval);
258-
logger.log( Logger.LT_INFO+" Retrying Request -- ",mc.getUniqueKey().toString()+ " Retry Count -- "+executionCount);
258+
logger.log( Logger.LT_INFO, " Retrying Request -- "+logger.getUniqueKey().toString()+ " Retry Count -- "+executionCount);
259259
} catch (InterruptedException e) {
260260
e.printStackTrace();
261261
}

java/src/main/java/com/cybersource/ws/client/LoggerWrapper.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,8 @@
1818

1919
package com.cybersource.ws.client;
2020

21+
import java.util.UUID;
22+
2123
/**
2224
* An internal class used by the clients to encapsulate the logger, primarily
2325
* to avoid having to check if the Logger object is null before logging. It
@@ -27,6 +29,7 @@
2729
public class LoggerWrapper implements Logger {
2830
private Logger logger = null;
2931
private MyStopWatch stopWatch = new MyStopWatch();
32+
private UUID uniqueKey=UUID.randomUUID();
3033

3134
/**
3235
* Constructor.
@@ -72,6 +75,14 @@ public LoggerWrapper(
7275

7376
}
7477

78+
/**
79+
* Getter method for uniqueKey
80+
* @return UUID
81+
*/
82+
public UUID getUniqueKey() {
83+
return uniqueKey;
84+
}
85+
7586
/**
7687
* Calls the encapsulated Logger object's prepare() method.
7788
*

java/src/main/java/com/cybersource/ws/client/MerchantConfig.java

Lines changed: 0 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,6 @@ public class MerchantConfig {
3737
private final static int DEFAULT_TIMEOUT = 130;
3838
private final static int DEFAULT_PROXY_PORT = 8080;
3939

40-
private UUID uniqueKey=UUID.randomUUID();
41-
4240
private final Properties props;
4341

4442
private final String merchantID;
@@ -856,14 +854,6 @@ private int getIntegerProperty(
856854
}
857855
}
858856

859-
/**
860-
* Getter method for uniqueKey
861-
* @return UUID
862-
*/
863-
public UUID getUniqueKey() {
864-
return uniqueKey;
865-
}
866-
867857
/**
868858
* Getter method for numberOfRetries
869859
* @return int

java/src/main/java/com/cybersource/ws/client/PoolingHttpClientConnection.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -337,7 +337,7 @@ public boolean retryRequest(IOException exception, int executionCount, HttpConte
337337
if (!httpClientContext.isRequestSent()) {
338338
try {
339339
Thread.sleep(retryWaitInterval);
340-
logger.log(Logger.LT_INFO, "Retrying Request -- " + mc.getUniqueKey() + " Retry Count -- " + executionCount);
340+
logger.log(Logger.LT_INFO, "Retrying Request -- " + logger.getUniqueKey() + " Retry Count -- " + executionCount);
341341
} catch (InterruptedException ex) {
342342
ex.printStackTrace();
343343
}

java/src/main/java/com/cybersource/ws/client/XMLClient.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -368,7 +368,7 @@ private static Document soapWrapAndSign(
368368

369369
if (!logSignedData) {
370370
logger.log(Logger.LT_REQUEST,
371-
"UUID > "+(mc.getUniqueKey()).toString() + "\n" +
371+
"UUID > "+(logger.getUniqueKey()).toString() + "\n" +
372372
"Input request is" + "\n" +
373373
"======================================= \n"
374374
+ Utility.nodeToString(doc, PCI.REQUEST));

java/src/main/resources/cybs.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ targetAPIVersion=1.164
1212
# If serverURL is provided then it takes precedence over the above settings. By default
1313
# the serverURL config is commented out.
1414
sendToProduction=false
15-
sendToAkamai=true
15+
sendToAkamai=false
1616
#serverURL=https://ics2wstesta.ic3.com/commerce/1.x/transactionProcessor
1717

1818
#To enable HttpClientConnection

java/src/test/java/com/cybersource/ws/client/CustomHttpConnectionClass.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -171,7 +171,7 @@ public boolean retryMethod(
171171
// if it's OK to retry methods that have been sent
172172
try {
173173
Thread.sleep(retryWaitInterval);
174-
logger.log( Logger.LT_INFO+" Retrying Request -- ",mc.getUniqueKey().toString()+ " Retry Count -- "+executionCount);
174+
logger.log( Logger.LT_INFO," Retrying Request -- " +logger.getUniqueKey().toString()+ " Retry Count -- "+executionCount);
175175
} catch (InterruptedException e) {
176176
// TODO Auto-generated catch block
177177
e.printStackTrace();

samples/nvp/cybs.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ targetAPIVersion=1.164
1212
# If serverURL is provided then it takes precedence over the above settings. By default
1313
# the serverURL config is commented out.
1414
sendToProduction=false
15-
sendToAkamai=true
15+
sendToAkamai=false
1616
#serverURL=https://ics2wstesta.ic3.com/commerce/1.x/transactionProcessor
1717

1818
#To enable HttpClientConnection

samples/xml/cybs.properties

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ targetAPIVersion=1.164
1212
# If serverURL is provided then it takes precedence over the above settings. By default
1313
# the serverURL config is commented out.
1414
sendToProduction=false
15-
sendToAkamai=true
15+
sendToAkamai=false
1616
#serverURL=https://ics2wstesta.ic3.com/commerce/1.x/transactionProcessor
1717

1818
#To enable HttpClientConnection

0 commit comments

Comments
 (0)