Skip to content

Commit 62b2ad9

Browse files
committed
make it work with any server, prod/dev/stage
1 parent 7c1e565 commit 62b2ad9

1 file changed

Lines changed: 15 additions & 2 deletions

File tree

src/test/java/com/groupdocs/sdk/api/TestSignatureApiUseCases.java

Lines changed: 15 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,8 +13,11 @@
1313

1414
import org.apache.commons.io.IOUtils;
1515
import org.junit.Test;
16+
import org.junit.experimental.categories.Category;
1617

18+
import com.groupdocs.sdk.common.ApiInvoker;
1719
import com.groupdocs.sdk.common.FileStream;
20+
import com.groupdocs.sdk.common.GroupDocsRequestSigner;
1821
import com.groupdocs.sdk.model.SignatureEnvelopeDocumentResponse;
1922
import com.groupdocs.sdk.model.SignatureEnvelopeFieldSettings;
2023
import com.groupdocs.sdk.model.SignatureEnvelopeResponse;
@@ -23,16 +26,25 @@
2326
import com.groupdocs.sdk.model.SignatureRoleInfo;
2427
import com.groupdocs.sdk.model.SignatureStatusResponse;
2528

29+
@Category(IntegrationTest.class)
2630
public class TestSignatureApiUseCases extends AbstractIntegrationTest {
2731

2832
SignatureApi api = new SignatureApi();
33+
String server = "dev-"; // use "" for production
34+
35+
{
36+
api.setBasePath("https://" + server + "api.groupdocs.com/v2.0");
37+
ApiInvoker.getInstance().setRequestSigner(new GroupDocsRequestSigner("e205c73b479f0e5a66501fac3e89d86b"));
38+
userId = "16698cae909805f2";
39+
}
2940

3041
@Test
3142
public void testSendEnvelopeForSigning() throws Exception {
3243
//upload document
3344
File file = new File(".", "src/test/resources/interactiveform_enabled.pdf");
3445
InputStream is = new FileInputStream(file);
3546
StorageApi storageApi = new StorageApi();
47+
storageApi.setBasePath("https://" + server + "api.groupdocs.com/v2.0");
3648
String documentId = storageApi.Upload(userId, "samples/signature/" + file.getName(), null, new FileStream(is)).getResult().getGuid();
3749
IOUtils.closeQuietly(is);
3850
assertThat(documentId, not(nullValue()));
@@ -97,11 +109,12 @@ public void testSendEnvelopeForSigning() throws Exception {
97109
api.AddSignatureEnvelopeField(userId, envelopeId, documentId, recipientId, fieldId, envField);
98110

99111
//send envelope
100-
SignatureStatusResponse envelopeSend = api.SignatureEnvelopeSend(userId, envelopeId, null);
112+
FileStream fs = new FileStream(IOUtils.toInputStream("http://jake.dyndns.biz:8080/dummyCallbackHandler"));
113+
SignatureStatusResponse envelopeSend = api.SignatureEnvelopeSend(userId, envelopeId, fs);
101114
assertThat(envelopeSend, not(nullValue()));
102115
assertThat(envelopeSend.getStatus(), equalTo("Ok"));
103116

104-
String embedUrl = "https://apps.groupdocs.com/signature/signembed/" + envelopeId + "/" + recipientId;
117+
String embedUrl = "https://" + server + "apps.groupdocs.com/signature/signembed/" + envelopeId + "/" + recipientId;
105118
System.out.println("Use following URL to sign the envelope: " + embedUrl);
106119
}
107120

0 commit comments

Comments
 (0)