Skip to content

Commit 1a15ffa

Browse files
committed
Using environment variables for testing
1 parent 7726320 commit 1a15ffa

File tree

1 file changed

+9
-129
lines changed

1 file changed

+9
-129
lines changed

src/test/java/SdkUnitTests.java

Lines changed: 9 additions & 129 deletions
Original file line numberDiff line numberDiff line change
@@ -30,21 +30,21 @@
3030
@FixMethodOrder(MethodSorters.NAME_ASCENDING)
3131
public class SdkUnitTests {
3232

33-
private static final String UserName = "[email protected]";
34-
private static final String UserId = "fcc5726c-xxxx-xxxx-xxxx-40bbbe6ca126";
35-
private static final String IntegratorKey = "ae30ea4e-xxxx-xxxx-xxxx-fcb57d2dc4df";
36-
private static final String IntegratorKeyImplicit = "68c1711f-xxxx-xxxx-xxxx-b49b4211d831";
37-
//private static final String ClientSecret = "b4dccdbe-xxxx-xxxx-xxxx-b2f0f7448f8f";
38-
private static final String RedirectURI = "https://www.docusign.com/api";
33+
private static final String UserName = System.getProperty("USER_NAME");
34+
private static final String UserId = System.getProperty("USER_ID");
35+
private static final String IntegratorKey = System.getProperty("INTEGRATOR_KEY_JWT");
36+
private static final String IntegratorKeyImplicit = System.getProperty("INTEGRATOR_KEY_IMPLICIT");
37+
//private static final String ClientSecret = System.getProperty("CLIENT_SECRET");
38+
private static final String RedirectURI = System.getProperty("REDIRECT_URI");
3939

4040
private static final String BaseUrl = "https://demo.docusign.net/restapi";
4141
//private static final String OAuthBaseUrl = "account-d.docusign.com";
42-
private static final String privateKeyFullPath = System.getProperty("user.dir") + "/src/test/keys/docusign_private_key.txt";
42+
private static final byte[] privateKeyBytes = System.getProperty("PRIVATE_KEY").getBytes();
4343
private static final String brandLogoFullPath = System.getProperty("user.dir") + "/src/test/docs/DS.png";
4444

4545
private static final String SignTest1File = "/src/test/docs/SignTest1.pdf";
46-
private static final String TemplateId = "cf2a46c2-xxxx-xxxx-xxxx-752547b1a419";
47-
private static final String BrandId = "dbdaedc8-xxxx-xxxx-xxxx-b7cfd55f6b64";
46+
private static final String TemplateId = System.getProperty("TEMPLATE_ID");
47+
private static final String BrandId = System.getProperty("BRAND_ID");
4848
private String[] envelopeIds = new String[0];
4949
// JUnit 4.12 runs test cases in parallel, so the envelope ID needs to be initiated as well.
5050

@@ -89,14 +89,6 @@ public void JWTLoginTest() {
8989
//Desktop.getDesktop().browse(URI.create(oauthLoginUrl));
9090
// END OF NOTE
9191

92-
byte[] privateKeyBytes = null;
93-
try {
94-
privateKeyBytes = Files.readAllBytes(Paths.get(privateKeyFullPath));
95-
} catch (IOException ioExcp) {
96-
Assert.assertEquals(null, ioExcp);
97-
}
98-
if (privateKeyBytes == null) return;
99-
10092
java.util.List<String> scopes = new ArrayList<String>();
10193
scopes.add(OAuth.Scope_SIGNATURE);
10294
scopes.add(OAuth.Scope_IMPERSONATION);
@@ -287,14 +279,6 @@ public void RequestASignatureTest() {
287279
//Desktop.getDesktop().browse(URI.create(oauthLoginUrl));
288280
// END OF NOTE
289281

290-
byte[] privateKeyBytes = null;
291-
try {
292-
privateKeyBytes = Files.readAllBytes(Paths.get(privateKeyFullPath));
293-
} catch (IOException ioExcp) {
294-
Assert.assertEquals(null, ioExcp);
295-
}
296-
if (privateKeyBytes == null) return;
297-
298282
java.util.List<String> scopes = new ArrayList<String>();
299283
scopes.add(OAuth.Scope_SIGNATURE);
300284

@@ -376,14 +360,6 @@ public void RequestSignatureFromTemplate() {
376360
//Desktop.getDesktop().browse(URI.create(oauthLoginUrl));
377361
// END OF NOTE
378362

379-
byte[] privateKeyBytes = null;
380-
try {
381-
privateKeyBytes = Files.readAllBytes(Paths.get(privateKeyFullPath));
382-
} catch (IOException ioExcp) {
383-
Assert.assertEquals(null, ioExcp);
384-
}
385-
if (privateKeyBytes == null) return;
386-
387363
java.util.List<String> scopes = new ArrayList<String>();
388364
scopes.add(OAuth.Scope_SIGNATURE);
389365

@@ -500,14 +476,6 @@ public void EmbeddedSigningTest() {
500476
//Desktop.getDesktop().browse(URI.create(oauthLoginUrl));
501477
// END OF NOTE
502478

503-
byte[] privateKeyBytes = null;
504-
try {
505-
privateKeyBytes = Files.readAllBytes(Paths.get(privateKeyFullPath));
506-
} catch (IOException ioExcp) {
507-
Assert.assertEquals(null, ioExcp);
508-
}
509-
if (privateKeyBytes == null) return;
510-
511479
java.util.List<String> scopes = new ArrayList<String>();
512480
scopes.add(OAuth.Scope_SIGNATURE);
513481

@@ -636,14 +604,6 @@ public void CreateTemplateTest() {
636604
//Desktop.getDesktop().browse(URI.create(oauthLoginUrl));
637605
// END OF NOTE
638606

639-
byte[] privateKeyBytes = null;
640-
try {
641-
privateKeyBytes = Files.readAllBytes(Paths.get(privateKeyFullPath));
642-
} catch (IOException ioExcp) {
643-
Assert.assertEquals(null, ioExcp);
644-
}
645-
if (privateKeyBytes == null) return;
646-
647607
java.util.List<String> scopes = new ArrayList<String>();
648608
scopes.add(OAuth.Scope_SIGNATURE);
649609

@@ -758,14 +718,6 @@ public void DownLoadEnvelopeDocumentsTest() {
758718
//Desktop.getDesktop().browse(URI.create(oauthLoginUrl));
759719
// END OF NOTE
760720

761-
byte[] privateKeyBytes = null;
762-
try {
763-
privateKeyBytes = Files.readAllBytes(Paths.get(privateKeyFullPath));
764-
} catch (IOException ioExcp) {
765-
Assert.assertEquals(null, ioExcp);
766-
}
767-
if (privateKeyBytes == null) return;
768-
769721
java.util.List<String> scopes = new ArrayList<String>();
770722
scopes.add(OAuth.Scope_SIGNATURE);
771723

@@ -836,14 +788,6 @@ public void ListDocumentsTest() {
836788
//Desktop.getDesktop().browse(URI.create(oauthLoginUrl));
837789
// END OF NOTE
838790

839-
byte[] privateKeyBytes = null;
840-
try {
841-
privateKeyBytes = Files.readAllBytes(Paths.get(privateKeyFullPath));
842-
} catch (IOException ioExcp) {
843-
Assert.assertEquals(null, ioExcp);
844-
}
845-
if (privateKeyBytes == null) return;
846-
847791
java.util.List<String> scopes = new ArrayList<String>();
848792
scopes.add(OAuth.Scope_SIGNATURE);
849793

@@ -957,14 +901,6 @@ public void ResendEnvelopeTest() {
957901
//Desktop.getDesktop().browse(URI.create(oauthLoginUrl));
958902
// END OF NOTE
959903

960-
byte[] privateKeyBytes = null;
961-
try {
962-
privateKeyBytes = Files.readAllBytes(Paths.get(privateKeyFullPath));
963-
} catch (IOException ioExcp) {
964-
Assert.assertEquals(null, ioExcp);
965-
}
966-
if (privateKeyBytes == null) return;
967-
968904
java.util.List<String> scopes = new ArrayList<String>();
969905
scopes.add(OAuth.Scope_SIGNATURE);
970906

@@ -1086,14 +1022,6 @@ public void GetDiagnosticLogsTest() {
10861022
//Desktop.getDesktop().browse(URI.create(oauthLoginUrl));
10871023
// END OF NOTE
10881024

1089-
byte[] privateKeyBytes = null;
1090-
try {
1091-
privateKeyBytes = Files.readAllBytes(Paths.get(privateKeyFullPath));
1092-
} catch (IOException ioExcp) {
1093-
Assert.assertEquals(null, ioExcp);
1094-
}
1095-
if (privateKeyBytes == null) return;
1096-
10971025
java.util.List<String> scopes = new ArrayList<String>();
10981026
scopes.add(OAuth.Scope_SIGNATURE);
10991027

@@ -1188,14 +1116,6 @@ public void ListStatusChangesTest() {
11881116
//Desktop.getDesktop().browse(URI.create(oauthLoginUrl));
11891117
// END OF NOTE
11901118

1191-
byte[] privateKeyBytes = null;
1192-
try {
1193-
privateKeyBytes = Files.readAllBytes(Paths.get(privateKeyFullPath));
1194-
} catch (IOException ioExcp) {
1195-
Assert.assertEquals(null, ioExcp);
1196-
}
1197-
if (privateKeyBytes == null) return;
1198-
11991119
java.util.List<String> scopes = new ArrayList<String>();
12001120
scopes.add(OAuth.Scope_SIGNATURE);
12011121

@@ -1253,14 +1173,6 @@ public void ListStatusTest() {
12531173
//Desktop.getDesktop().browse(URI.create(oauthLoginUrl));
12541174
// END OF NOTE
12551175

1256-
byte[] privateKeyBytes = null;
1257-
try {
1258-
privateKeyBytes = Files.readAllBytes(Paths.get(privateKeyFullPath));
1259-
} catch (IOException ioExcp) {
1260-
Assert.assertEquals(null, ioExcp);
1261-
}
1262-
if (privateKeyBytes == null) return;
1263-
12641176
java.util.List<String> scopes = new ArrayList<String>();
12651177
scopes.add(OAuth.Scope_SIGNATURE);
12661178

@@ -1320,14 +1232,6 @@ public void UpdateBulkRecipientsTest() {
13201232
//Desktop.getDesktop().browse(URI.create(oauthLoginUrl));
13211233
// END OF NOTE
13221234

1323-
byte[] privateKeyBytes = null;
1324-
try {
1325-
privateKeyBytes = Files.readAllBytes(Paths.get(privateKeyFullPath));
1326-
} catch (IOException ioExcp) {
1327-
Assert.assertEquals(null, ioExcp);
1328-
}
1329-
if (privateKeyBytes == null) return;
1330-
13311235
java.util.List<String> scopes = new ArrayList<String>();
13321236
scopes.add(OAuth.Scope_SIGNATURE);
13331237

@@ -1486,14 +1390,6 @@ public void UpdateChunkedUpload() {
14861390
//Desktop.getDesktop().browse(URI.create(oauthLoginUrl));
14871391
// END OF NOTE
14881392

1489-
byte[] privateKeyBytes = null;
1490-
try {
1491-
privateKeyBytes = Files.readAllBytes(Paths.get(privateKeyFullPath));
1492-
} catch (IOException ioExcp) {
1493-
Assert.assertEquals(null, ioExcp);
1494-
}
1495-
if (privateKeyBytes == null) return;
1496-
14971393
java.util.List<String> scopes = new ArrayList<String>();
14981394
scopes.add(OAuth.Scope_SIGNATURE);
14991395

@@ -1565,14 +1461,6 @@ public void UpdateBrandLogoByTypeTest() {
15651461
//Desktop.getDesktop().browse(URI.create(oauthLoginUrl));
15661462
// END OF NOTE
15671463

1568-
byte[] privateKeyBytes = null;
1569-
try {
1570-
privateKeyBytes = Files.readAllBytes(Paths.get(privateKeyFullPath));
1571-
} catch (IOException ioExcp) {
1572-
Assert.assertEquals(null, ioExcp);
1573-
}
1574-
if (privateKeyBytes == null) return;
1575-
15761464
java.util.List<String> scopes = new ArrayList<String>();
15771465
scopes.add(OAuth.Scope_SIGNATURE);
15781466

@@ -1626,14 +1514,6 @@ private String[] getLastTenEnvelopeIds() {
16261514
//Desktop.getDesktop().browse(URI.create(oauthLoginUrl));
16271515
// END OF NOTE
16281516

1629-
byte[] privateKeyBytes = null;
1630-
try {
1631-
privateKeyBytes = Files.readAllBytes(Paths.get(privateKeyFullPath));
1632-
} catch (IOException ioExcp) {
1633-
Assert.assertEquals(null, ioExcp);
1634-
}
1635-
if (privateKeyBytes == null) return envelopeIds;
1636-
16371517
java.util.List<String> scopes = new ArrayList<String>();
16381518
scopes.add(OAuth.Scope_SIGNATURE);
16391519

0 commit comments

Comments
 (0)