Skip to content

Commit

Permalink
PB-32731. Disable Java SDK SMS sending tests
Browse files Browse the repository at this point in the history
  • Loading branch information
eslci committed Sep 2, 2020
1 parent 51be3dd commit 89926c0
Show file tree
Hide file tree
Showing 9 changed files with 78 additions and 103 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -15,44 +15,43 @@
*/
public class AuthenticationMethodsExample extends SDKSample {

public static void main( String... args ) {
public static void main(String... args) {
new AuthenticationMethodsExample().run();
}

public void execute() {
DocumentPackage superDuperPackage = newPackageNamed(getPackageName())
.describedAs( "This is a package created using the eSignLive SDK to demonstrate the authentication methods." )
.expiresAt( now().plusMonths( 1 ).toDate() )
.withEmailMessage( "This message should be delivered to all signers" )
.withSigner( newSignerWithEmail( email1 )
.withFirstName( "Anna" )
.withLastName( "Bel" ) )
.withSigner( newSignerWithEmail( email2 )
.withFirstName( "Bobby" )
.withLastName( "Sue" )
.challengedWithQuestions( firstQuestion( "What's 1+1?" )
.answer( "2" )
.secondQuestion( "What color's the sky?" )
.answer( "blue" ) ) )
.withSigner( newSignerWithEmail( email3 )
.withFirstName( "Charlie" )
.withLastName( "Brown" )
.withSmsSentTo( sms3 ) )
.withDocument( newDocumentWithName( "dave.silanis@gmail.com's Document" )
.fromStream( documentInputStream1, DocumentType.PDF )
.withSignature( signatureFor( email1 )
.onPage( 0 )
.atPosition( 100, 100 ) )
.withSignature( signatureFor( email2 )
.onPage( 0 )
.atPosition( 100, 200 ) )
.withSignature( signatureFor( email3 )
.onPage( 0 )
.atPosition( 100, 300 ) ) )
.describedAs("This is a package created using the eSignLive SDK to demonstrate the authentication methods.")
.expiresAt(now().plusMonths(1).toDate())
.withEmailMessage("This message should be delivered to all signers")
.withSigner(newSignerWithEmail(email1)
.withFirstName("Anna")
.withLastName("Bel"))
.withSigner(newSignerWithEmail(email2)
.withFirstName("Bobby")
.withLastName("Sue")
.challengedWithQuestions(firstQuestion("What's 1+1?")
.answer("2")
.secondQuestion("What color's the sky?")
.answer("blue")))
.withSigner(newSignerWithEmail(email3)
.withFirstName("Charlie")
.withLastName("Brown"))
.withDocument(newDocumentWithName("dave.silanis@gmail.com's Document")
.fromStream(documentInputStream1, DocumentType.PDF)
.withSignature(signatureFor(email1)
.onPage(0)
.atPosition(100, 100))
.withSignature(signatureFor(email2)
.onPage(0)
.atPosition(100, 200))
.withSignature(signatureFor(email3)
.onPage(0)
.atPosition(100, 300)))
.build();

packageId = eslClient.createPackage( superDuperPackage );
retrievedPackage = eslClient.getPackage( packageId );
packageId = eslClient.createPackage(superDuperPackage);
retrievedPackage = eslClient.getPackage(packageId);
}

}
26 changes: 9 additions & 17 deletions sdk/src/main/java/com/silanis/esl/sdk/examples/SDKSample.java
Original file line number Diff line number Diff line change
Expand Up @@ -24,14 +24,13 @@ public abstract class SDKSample {

protected Properties props = Props.get();

public String email1, email2, email3, email4, email5, email6, senderEmail,
sms1, sms2, sms3, sms4, sms5, sms6, senderSms, webpageUrl, senderUID,
public String email1, email2, email3, email4, email5, email6, senderEmail, webpageUrl, senderUID,
proxyHost, proxyWithCredentialsHost, proxyUserName, proxyPassword;

public int proxyPort, proxyWithCredentialsPort;

public SDKSample() {
setupEslClientFromProps(Collections.<String,String>emptyMap(), null);
setupEslClientFromProps(Collections.<String, String>emptyMap(), null);
setProperties();
}

Expand All @@ -40,17 +39,17 @@ public SDKSample(String apiKey, String apiUrl) {
setProperties();
}

public EslClient setupEslClientFromProps(Map<String,String> additionalHeaders, ProxyConfiguration proxyConfiguration) {
public EslClient setupEslClientFromProps(Map<String, String> additionalHeaders, ProxyConfiguration proxyConfiguration) {
if (props.getProperty("api.clientId") == null) {
eslClient = new EslClient(props.getProperty("api.key"), props.getProperty("api.url"), true, proxyConfiguration).setWebpageURL(props.getProperty("webpage.url"));
} else {
ApiTokenConfig apiTokenConfig = ApiTokenConfig.newBuilder()
.clientAppId(props.getProperty("api.clientId"))
.clientAppSecret(props.getProperty("api.secret"))
.tokenType(ApiTokenConfig.TokenType.OWNER)
.baseUrl(props.getProperty("webpage.url"))
.build();
eslClient = new EslClient(apiTokenConfig, props.getProperty("api.url"), true, proxyConfiguration, true, additionalHeaders);
.clientAppId(props.getProperty("api.clientId"))
.clientAppSecret(props.getProperty("api.secret"))
.tokenType(ApiTokenConfig.TokenType.OWNER)
.baseUrl(props.getProperty("webpage.url"))
.build();
eslClient = new EslClient(apiTokenConfig, props.getProperty("api.url"), true, proxyConfiguration, true, additionalHeaders);
}
return eslClient;
}
Expand All @@ -69,13 +68,6 @@ private void setProperties() {
email5 = props.getProperty("5.email");
email6 = props.getProperty("6.email");
senderEmail = props.getProperty("sender.email");
sms1 = props.getProperty("1.sms");
sms2 = props.getProperty("2.sms");
sms3 = props.getProperty("3.sms");
sms4 = props.getProperty("4.sms");
sms5 = props.getProperty("5.sms");
sms6 = props.getProperty("6.sms");
senderSms = props.getProperty("sender.sms");
webpageUrl = props.getProperty("webpage.url");
proxyHost = props.getProperty("proxy.host");
proxyPort = Integer.parseInt(props.getProperty("proxy.port"));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ public class SendSmsToSignerExample extends SDKSample {
public static final String SIGNER2_FIRST = "Patty";
public static final String SIGNER2_LAST = "Galant";

public static void main( String... args ) {
public static void main(String... args) {
new SendSmsToSignerExample().run();
}

Expand All @@ -28,29 +28,27 @@ public void execute() {
.describedAs("This is a package created using the eSignLive SDK")
.withSettings(DocumentPackageSettingsBuilder.newDocumentPackageSettings().withInPerson())
.withSigner(SignerBuilder.newSignerWithEmail(email1)
.withFirstName(SIGNER1_FIRST)
.withLastName(SIGNER1_LAST)
.withSmsSentTo(sms1))
.withFirstName(SIGNER1_FIRST)
.withLastName(SIGNER1_LAST))
.withSigner(SignerBuilder.newSignerWithEmail(email2)
.withFirstName(SIGNER2_FIRST)
.withLastName(SIGNER2_LAST)
.withSmsSentTo(sms2))
.withFirstName(SIGNER2_FIRST)
.withLastName(SIGNER2_LAST))
.withDocument(newDocumentWithName("First Document")
.fromStream(documentInputStream1, DocumentType.PDF)
.withSignature(signatureFor(email1)
.onPage(0)
.atPosition(100, 100))
.withSignature(signatureFor(email2)
.onPage(0)
.atPosition(400, 100)))
.fromStream(documentInputStream1, DocumentType.PDF)
.withSignature(signatureFor(email1)
.onPage(0)
.atPosition(100, 100))
.withSignature(signatureFor(email2)
.onPage(0)
.atPosition(400, 100)))
.build();

packageId = eslClient.createPackage( superDuperPackage );
eslClient.sendPackage( packageId );
retrievedPackage = eslClient.getPackage( packageId );
packageId = eslClient.createPackage(superDuperPackage);
eslClient.sendPackage(packageId);
retrievedPackage = eslClient.getPackage(packageId);

eslClient.getPackageService().sendSmsToSigner(packageId, retrievedPackage.getSigner(email1));
eslClient.getPackageService().sendSmsToSigner(packageId, retrievedPackage.getSigner(email2));
retrievedPackage = eslClient.getPackage( packageId );
retrievedPackage = eslClient.getPackage(packageId);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -14,25 +14,25 @@

public class SignerSMSAuthenticationExample extends SDKSample {

public static void main( String... args ) {
public static void main(String... args) {
new SignerSMSAuthenticationExample().run();
}

public void execute() {
DocumentPackage superDuperPackage = newPackageNamed(getPackageName())
.describedAs( "This is a SMS authentication example" )
.withSigner( newSignerWithEmail( email1 )
.withFirstName( "John" )
.withLastName( "Smith" )
.withSmsSentTo( sms1 ) )
.withDocument( newDocumentWithName( "First Document" )
.fromStream( documentInputStream1, DocumentType.PDF )
.withSignature( signatureFor( email1 )
.onPage( 0 )
.atPosition( 100, 100 ) ) )
.describedAs("This is a SMS authentication example")
.withSigner(newSignerWithEmail(email1)
.withFirstName("John")
.withLastName("Smith")
.withSmsSentTo("+12042345678"))
.withDocument(newDocumentWithName("First Document")
.fromStream(documentInputStream1, DocumentType.PDF)
.withSignature(signatureFor(email1)
.onPage(0)
.atPosition(100, 100)))
.build();

packageId = eslClient.createPackage( superDuperPackage );
retrievedPackage = eslClient.getPackage( packageId );
packageId = eslClient.createPackage(superDuperPackage);
retrievedPackage = eslClient.getPackage(packageId);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,6 @@ public void execute() {
Signer signer4 = newSignerWithEmail(email2)
.withFirstName(SIGNER2_FIRST_NAME)
.withLastName(SIGNER2_LAST_NAME)
.withSmsSentTo(sms1)
.withLanguage(SIGNER2_UPDATE_LANGUAGE)
.withCustomId(SIGNER2_CUSTOM_ID).build();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ public void verifyResult() {

assertThat( "Signer 1 authentication method was not set correctly.", documentPackage.getSigner(example.email1).getAuthentication().getMethod(), is(EMAIL) );
assertThat( "Signer 2 authentication method was not set correctly.", documentPackage.getSigner(example.email2).getAuthentication().getMethod(), is(CHALLENGE) );
assertThat( "Signer 3 authentication method was not set correctly.", documentPackage.getSigner(example.email3).getAuthentication().getMethod(), is(SMS) );
assertThat( "Signer 3 authentication method was not set correctly.", documentPackage.getSigner(example.email3).getAuthentication().getMethod(), is(EMAIL) );
}

}
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package com.silanis.esl.sdk.examples;

import com.silanis.esl.sdk.DocumentPackage;
import org.junit.Ignore;
import org.junit.Test;

import static com.silanis.esl.sdk.AuthenticationMethod.SMS;
Expand All @@ -11,12 +12,12 @@
* User: jessica
* Date: 23/01/14
* Time: 11:33 AM
*
* <p>
* Test SignerSMSAuthenticationExample.
*
*/
public class SignerSMSAuthenticationExampleTest {
@Test
@Ignore("Since this example sends SMS, it is disabled.")
public void verifyResult() {
SignerSMSAuthenticationExample example = new SignerSMSAuthenticationExample();
example.run();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,6 @@ public void verifyResult() {

assertNotNull("Package signer2 is not updated correctly.", example.updatedPackage.getSigner(example.email2));
assertThat("Package signer2's authentication method is not updated correctly.", example.updatedPackage.getSigner(example.email2).getAuthentication().getMethod(), is(SMS));
assertThat("Package signer2's authentication method is not updated correctly.", example.updatedPackage.getSigner(example.email2).getAuthentication().getPhoneNumber(), is(example.sms1));
assertThat("Package signer2's authentication method is not updated correctly.", example.updatedPackage.getSigner(example.email2).getLanguage(), is(SIGNER2_UPDATE_LANGUAGE));
}
}
25 changes: 6 additions & 19 deletions tester/src/test/resources/jenkins.properties
Original file line number Diff line number Diff line change
Expand Up @@ -4,28 +4,15 @@ api.key=
api.key.WithRolesAndPermission=

sender.email=bob@e-signlive.com
sender.sms=+12042345678

sender.email.WithRolesAndPermission=bobrp@e-signlive.com
sender.sms.WithRolesAndPermission=+12042345678

1.email=auto1.silanis@e-signlive.com
1.sms=+12042345678

2.email=auto2.silanis@e-signlive.com
2.sms=+12042345678

3.email=auto3.silanis@e-signlive.com
3.sms=+12042345678

4.email=auto4.silanis@e-signlive.com
4.sms=+12042345678

5.email=auto5.silanis@e-signlive.com
5.sms=+12042345678

6.email=auto6.silanis@e-signlive.com
6.sms=+12042345678
1.email=auto1.silanis@gmail.com
2.email=auto2.silanis@gmail.com
3.email=auto3.silanis@gmail.com
4.email=auto4.silanis@gmail.com
5.email=auto5.silanis@gmail.com
6.email=auto6.silanis@gmail.com

proxy.host=localhost
proxy.port=8001
Expand Down

0 comments on commit 89926c0

Please sign in to comment.