Skip to content

Commit 6dcdb88

Browse files
committed
removing sysouts, defaulting/comments props in cybs file and fixing junit
1 parent b011631 commit 6dcdb88

10 files changed

Lines changed: 99 additions & 107 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
@@ -331,7 +331,7 @@ static private MerchantConfig getMerchantConfigObject(Map<String, String> reques
331331
} else {
332332
mc = new MerchantConfig(props, merchantID);
333333
}
334-
System.out.println("merchant config object got created");
334+
//System.out.println("merchant config object got created");
335335
return mc;
336336
}
337337

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

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,11 +39,11 @@ public void run() {
3939
long idleTime = getIdleTime();
4040
wait(getSleepTime());
4141
PoolingHttpClientConnectionManager poolConnMgr = (PoolingHttpClientConnectionManager) connMgr;
42-
System.out.println("before closing expired and idl conn, stats is "+poolConnMgr.getTotalStats() + "Current Time: "+ java.time.LocalTime.now());
42+
//System.out.println("before closing expired and idl conn, stats is "+poolConnMgr.getTotalStats() + "Current Time: "+ java.time.LocalTime.now());
4343
long startTimer = System.currentTimeMillis();
4444
connMgr.closeExpiredConnections();
4545
connMgr.closeIdleConnections(idleTime, TimeUnit.MILLISECONDS);
46-
System.out.println("Took " + (System.currentTimeMillis() - startTimer) + "ms to close expired and idl conn, now stats is "+poolConnMgr.getTotalStats());
46+
//System.out.println("Took " + (System.currentTimeMillis() - startTimer) + "ms to close expired and idl conn, now stats is "+poolConnMgr.getTotalStats());
4747
}
4848
}
4949
} catch (InterruptedException ex) {

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -534,7 +534,7 @@ public MerchantConfig(Properties _props, String _merchantID)
534534
useSignAndEncrypted = getBooleanProperty(merchantID, "useSignAndEncrypted", false);
535535

536536
if(useHttpClient && useHttpClientWithConnectionPool) {
537-
throw new ConfigException("both variables useHttpClient and useHttpClientWithConnectionPool cannot be true at same time");
537+
throw new ConfigException("both useHttpClient and useHttpClientWithConnectionPool cannot be true at same time");
538538
}
539539

540540
if(useHttpClientWithConnectionPool) {

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

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -206,7 +206,6 @@ public void run() {
206206
* @throws IOException
207207
*/
208208
public static void onShutdown() throws IOException {
209-
System.out.println("Triggered sdk shut down");
210209
if (httpClient != null) {
211210
httpClient.close();
212211
}
@@ -348,7 +347,6 @@ public boolean retryRequest(IOException exception, int executionCount, HttpConte
348347
}
349348

350349
if (exception instanceof NoHttpResponseException) {
351-
System.out.println("not retrying as it is NoHttpResponseException and request is sent");
352350
return false;
353351
}
354352

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

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -533,7 +533,7 @@ static private MerchantConfig getMerchantConfigObject(Document request, Properti
533533
} else {
534534
mc = new MerchantConfig(props, merchantID);
535535
}
536-
System.out.println("merchant config object got created");
536+
//System.out.println("merchant config object got created");
537537
return mc;
538538
}
539539
/**

java/src/main/resources/cybs.properties

Lines changed: 24 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ keysDirectory=
33
keyAlias=
44
keyPassword=
55
targetAPIVersion=1.164
6-
# KeyFilename is the name of the JKS file
7-
#keyFilename=<---JKS Filename --->
6+
# KeyFilename is the name of the JKS file.
7+
# keyFilename=
88

9-
# the following flags can be used to control the endpoint to which requests will be sent.
9+
# the following flags can be used to control the endpoint to which requests will be sent.
1010
# Set sendToProduction=true to send requests to Cybersource production environment.
1111
# Set sendToAkamai=true to send requests through Akamai to Cybersource.
1212
# If serverURL is provided then it takes precedence over the above settings. By default
@@ -16,22 +16,22 @@ sendToAkamai=false
1616
#serverURL=https://ics2wstesta.ic3.com/commerce/1.x/transactionProcessor
1717

1818
#To enable HttpClientConnection
19-
useHttpClient=false
19+
#useHttpClient=false
20+
2021
#To enable poolingHttpClientConnection
21-
useHttpClientWithConnectionPool=false
22+
#useHttpClientWithConnectionPool=false
2223
# Following configure parameters will only work with useHttpClientWithConnectionPool=true
23-
# Optional parameters, default values configured in application
24-
maxConnections=1000
25-
defaultMaxConnectionsPerRoute=1000
26-
maxConnectionsPerRoute=1000
27-
connectionRequestTimeoutMs=1000
28-
connectionTimeoutMs=2000
29-
socketTimeoutMs=2000
30-
evictThreadSleepTimeMs=3000
31-
maxKeepAliveTimeMs=30000
32-
24+
# Both useHttpClient and useHttpClientWithConnectionPool cannot be true at same time.
25+
#maxConnections=1000
26+
#defaultMaxConnectionsPerRoute=1000
27+
#maxConnectionsPerRoute=1000
28+
#connectionRequestTimeoutMs=1000
29+
#connectionTimeoutMs=5000
30+
#socketTimeoutMs=13000
31+
#evictThreadSleepTimeMs=3000
32+
#maxKeepAliveTimeMs=30000
3333

34-
# Following configure parameters will only work with useHttpClient=true or usePoolingHttpClient=true
34+
# Following retry parameters are required only in case of useHttpClient=true or usePoolingHttpClient=true
3535
# "allow retry" property toggle value "true/false" to turn on /off the auto request retry.
3636
# Number of retries is the number of attempts made to send the request.
3737
# Retry interval is the wait time in between the attempts to send the request.
@@ -50,7 +50,7 @@ retryInterval=1000
5050
# program will read it from keysDirectory path.
5151
enableJdkCert=false
5252

53-
# If 'enableCacert' property parameter is set to true, certificates will be read from the cacerts file specified at keysDirectory location.
53+
# If 'enableCacert' property parameter is set to true, certificates will be read from the cacerts file specified at keysDirectory location.
5454
# If keysDirectory path is not set,certificate will be loaded from Java Installation cacerts file. The cacerts file should be of the same name as specified in keyFilename.
5555
enableCacert=false
5656
# Enter the password for cacert file. Default password for JDK cacert is changeit
@@ -59,24 +59,23 @@ cacertPassword=
5959
# Mechanism to differentiate whether Payload is encrypted or not
6060
useSignAndEncrypted=false
6161

62-
timeout=1000
62+
timeout=10
6363

6464
# logging should normally be disabled in production as it would slow down the
6565
# processing. Enable it only when troubleshooting an issue.
6666
enableLog=true
6767
logDirectory=../../logs
6868
logMaximumSize=10
6969

70-
# If this property is set to false then the p12 certificate of a merchant will be reloaded
71-
# every time a transaction is made
72-
70+
# If this property is set to false then the p12 certificate of a merchant will be reloaded
71+
# every time a transaction is made
7372
certificateCacheEnabled=true
7473

74+
#If this property is set to true we will cache the merchantConfig object based on keyAlias/merchantID
75+
merchantConfigCacheEnabled=false
76+
7577
# Optional proxy server settings
7678
#proxyHost=<-- Set the Proxy Host-->
7779
#proxyPort=< -- Set the Proxy port-->
7880
#proxyUser=< -- Proxy user name-->
79-
#proxyPassword=< -- Proxy passsword-->
80-
81-
#If this property is set to true we will cache the merchantConfig object based on keyAlias/merchantID
82-
merchantConfigCacheEnabled=false
81+
#proxyPassword=< -- Proxy passsword-->

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

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ public void setUp() throws Exception
3737
@Test
3838
public void checkRetryConfigValuesForHttpClient() throws Exception
3939
{
40-
String errMsg="Invalid value of numberOfRetries and/or retryInterval";
40+
String expectedErrMsg="Invalid value of numberOfRetries and/or retryInterval(in ms)";
4141
// request fails as number of retry value is incorrect
4242
props.setProperty("useHttpClient", "true");
4343
props.setProperty("useHttpClientWithConnectionPool", "false");
@@ -50,7 +50,7 @@ public void checkRetryConfigValuesForHttpClient() throws Exception
5050
Client.runTransaction(new HashMap(), props);
5151
}
5252
catch(ClientException e){
53-
assertEquals(errMsg, e.getMessage());
53+
assertEquals(expectedErrMsg, e.getMessage());
5454
}
5555

5656
}
@@ -79,7 +79,7 @@ public void checkRetryConfigValuesForNonHttpClient() throws Exception
7979
@Test
8080
public void checkNegativeForHttp() throws Exception
8181
{
82-
String errMsg="Invalid value of numberOfRetries and/or retryInterval";
82+
String expectedErrMsg="Invalid value of numberOfRetries and/or retryInterval(in ms)";
8383
// request fails as number of retry and retry interval values are in negative
8484
props.setProperty("useHttpClient", "true");
8585
props.setProperty("useHttpClientWithConnectionPool", "false");
@@ -92,7 +92,7 @@ public void checkNegativeForHttp() throws Exception
9292
}
9393
catch (ClientException e)
9494
{
95-
assertEquals(errMsg, e.getMessage());
95+
assertEquals(expectedErrMsg, e.getMessage());
9696
}
9797
}
9898

java/src/test/resources/test_cybs.properties

Lines changed: 22 additions & 23 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
1-
merchantID=cybs_ncg
2-
keysDirectory=/Users/mayuk/Horizon/Horizon-Project-Documents/cybssdk
3-
keyAlias=cybs_ncg
4-
keyPassword=cybs_ncg
5-
targetAPIVersion=1.139
1+
merchantID=< ---merchant_id ---->
2+
keysDirectory=<--- P12 key directory location -->
3+
keyAlias=<--- key alias name for P12 key --->
4+
keyPassword=<--- P12 key password --->
5+
targetAPIVersion=<-- API Version Number -->
66

77
# the following flags can be used to control the endpoint to which requests will be sent.
88
# Set sendToProduction=true to send requests to Cybersource production environment.
@@ -11,24 +11,23 @@ targetAPIVersion=1.139
1111
# the serverURL config is commented out.
1212
sendToProduction=false
1313
sendToAkamai=false
14-
#serverURL=http://ratelimiter.ic3.com:9198
15-
14+
#serverURL=< -- Service URL or Transaction Processor URL -->
1615

1716
#To enable HttpClientConnection
18-
useHttpClient=false
17+
#useHttpClient=false
18+
1919
#To enable poolingHttpClientConnection
20-
useHttpClientWithConnectionPool=false
20+
#useHttpClientWithConnectionPool=false
2121
# Following configure parameters will only work with useHttpClientWithConnectionPool=true
2222
# Optional parameters, default values configured in application
23-
enabledShutdownHook=true
24-
maxConnections=1000
25-
defaultMaxConnectionsPerRoute=1000
26-
maxConnectionsPerRoute=1000
27-
connectionRequestTimeoutMs=1000
28-
connectionTimeoutMs=2000
29-
socketTimeoutMs=2000
30-
evictThreadSleepTimeMs=3000
31-
maxKeepAliveTimeMs=30000
23+
#maxConnections=1000
24+
#defaultMaxConnectionsPerRoute=1000
25+
#maxConnectionsPerRoute=1000
26+
#connectionRequestTimeoutMs=1000
27+
#connectionTimeoutMs=5000
28+
#socketTimeoutMs=13000
29+
#evictThreadSleepTimeMs=3000
30+
#maxKeepAliveTimeMs=30000
3231

3332
# Following configure parameters will only work with useHttpClient=true or usePoolingHttpClient=true
3433
# "allow retry" property toggle value "true/false" to turn on /off the auto request retry.
@@ -63,19 +62,19 @@ timeout=1000
6362
# logging should normally be disabled in production as it would slow down the
6463
# processing. Enable it only when troubleshooting an issue.
6564
enableLog=true
66-
logDirectory=/Users/mayuk/Horizon/Horizon-Project-Documents/cybssdk/log
65+
logDirectory=<-- Directory where cybs.log file needs to be created -->
6766
logMaximumSize=10
6867

6968
# If this property is set to false then the p12 certificate of a merchant will be reloaded
7069
# every time a transaction is made
7170

7271
certificateCacheEnabled=true
7372

73+
#If this property is set to true we will cache the merchantConfig object based on keyAlias/merchantID
74+
merchantConfigCacheEnabled=false
75+
7476
# Optional proxy server settings
7577
#proxyHost=<-- Set the Proxy Host-->
7678
#proxyPort=< -- Set the Proxy port-->
7779
#proxyUser=< -- Proxy user name-->
78-
#proxyPassword=< -- Proxy passsword-->
79-
80-
#If this property is set to true we will cache the merchantConfig object based on keyAlias/merchantID
81-
merchantConfigCacheEnabled=false
80+
#proxyPassword=< -- Proxy passsword-->

samples/nvp/cybs.properties

Lines changed: 21 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -3,10 +3,10 @@ keysDirectory=
33
keyAlias=
44
keyPassword=
55
targetAPIVersion=1.164
6-
# KeyFilename is the name of the JKS file.
6+
# KeyFilename is the name of the JKS file.
77
# keyFilename=
88

9-
# the following flags can be used to control the endpoint to which requests will be sent.
9+
# the following flags can be used to control the endpoint to which requests will be sent.
1010
# Set sendToProduction=true to send requests to Cybersource production environment.
1111
# Set sendToAkamai=true to send requests through Akamai to Cybersource.
1212
# If serverURL is provided then it takes precedence over the above settings. By default
@@ -16,22 +16,22 @@ sendToAkamai=false
1616
#serverURL=https://ics2wstesta.ic3.com/commerce/1.x/transactionProcessor
1717

1818
#To enable HttpClientConnection
19-
useHttpClient=false
19+
#useHttpClient=false
20+
2021
#To enable poolingHttpClientConnection
21-
useHttpClientWithConnectionPool=false
22+
#useHttpClientWithConnectionPool=false
2223
# Following configure parameters will only work with useHttpClientWithConnectionPool=true
23-
# Optional parameters, default values configured in application
24-
enabledShutdownHook=true
25-
maxConnections=1000
26-
defaultMaxConnectionsPerRoute=1000
27-
maxConnectionsPerRoute=1000
28-
connectionRequestTimeoutMs=1000
29-
connectionTimeoutMs=2000
30-
socketTimeoutMs=2000
31-
evictThreadSleepTimeMs=3000
32-
maxKeepAliveTimeMs=30000
24+
# Both useHttpClient and useHttpClientWithConnectionPool cannot be true at same time.
25+
#maxConnections=1000
26+
#defaultMaxConnectionsPerRoute=1000
27+
#maxConnectionsPerRoute=1000
28+
#connectionRequestTimeoutMs=1000
29+
#connectionTimeoutMs=5000
30+
#socketTimeoutMs=13000
31+
#evictThreadSleepTimeMs=3000
32+
#maxKeepAliveTimeMs=30000
3333

34-
# Following configure parameters will only work with useHttpClient=true or usePoolingHttpClient=true
34+
# Following retry parameters are required only in case of useHttpClient=true or usePoolingHttpClient=true
3535
# "allow retry" property toggle value "true/false" to turn on /off the auto request retry.
3636
# Number of retries is the number of attempts made to send the request.
3737
# Retry interval is the wait time in between the attempts to send the request.
@@ -50,7 +50,7 @@ retryInterval=1000
5050
# program will read it from keysDirectory path.
5151
enableJdkCert=false
5252

53-
# If 'enableCacert' property parameter is set to true, certificates will be read from the cacerts file specified at keysDirectory location.
53+
# If 'enableCacert' property parameter is set to true, certificates will be read from the cacerts file specified at keysDirectory location.
5454
# If keysDirectory path is not set,certificate will be loaded from Java Installation cacerts file. The cacerts file should be of the same name as specified in keyFilename.
5555
enableCacert=false
5656
# Enter the password for cacert file. Default password for JDK cacert is changeit
@@ -67,18 +67,15 @@ enableLog=true
6767
logDirectory=../../logs
6868
logMaximumSize=10
6969

70-
# If this property is set to false then the p12 certificate of a merchant will be reloaded
71-
# every time a transaction is made
72-
70+
# If this property is set to false then the p12 certificate of a merchant will be reloaded
71+
# every time a transaction is made
7372
certificateCacheEnabled=true
7473

75-
74+
#If this property is set to true we will cache the merchantConfig object based on keyAlias/merchantID
75+
merchantConfigCacheEnabled=false
7676

7777
# Optional proxy server settings
7878
#proxyHost=<-- Set the Proxy Host-->
7979
#proxyPort=< -- Set the Proxy port-->
8080
#proxyUser=< -- Proxy user name-->
81-
#proxyPassword=< -- Proxy passsword-->
82-
83-
#If this property is set to true we will cache the merchantConfig object based on keyAlias/merchantID
84-
merchantConfigCacheEnabled=false
81+
#proxyPassword=< -- Proxy passsword-->

0 commit comments

Comments
 (0)