|
13 | 13 |
|
14 | 14 | import org.apache.commons.io.IOUtils; |
15 | 15 | import org.junit.Test; |
| 16 | +import org.junit.experimental.categories.Category; |
16 | 17 |
|
| 18 | +import com.groupdocs.sdk.common.ApiInvoker; |
17 | 19 | import com.groupdocs.sdk.common.FileStream; |
| 20 | +import com.groupdocs.sdk.common.GroupDocsRequestSigner; |
18 | 21 | import com.groupdocs.sdk.model.SignatureEnvelopeDocumentResponse; |
19 | 22 | import com.groupdocs.sdk.model.SignatureEnvelopeFieldSettings; |
20 | 23 | import com.groupdocs.sdk.model.SignatureEnvelopeResponse; |
|
23 | 26 | import com.groupdocs.sdk.model.SignatureRoleInfo; |
24 | 27 | import com.groupdocs.sdk.model.SignatureStatusResponse; |
25 | 28 |
|
| 29 | +@Category(IntegrationTest.class) |
26 | 30 | public class TestSignatureApiUseCases extends AbstractIntegrationTest { |
27 | 31 |
|
28 | 32 | 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 | + } |
29 | 40 |
|
30 | 41 | @Test |
31 | 42 | public void testSendEnvelopeForSigning() throws Exception { |
32 | 43 | //upload document |
33 | 44 | File file = new File(".", "src/test/resources/interactiveform_enabled.pdf"); |
34 | 45 | InputStream is = new FileInputStream(file); |
35 | 46 | StorageApi storageApi = new StorageApi(); |
| 47 | + storageApi.setBasePath("https://" + server + "api.groupdocs.com/v2.0"); |
36 | 48 | String documentId = storageApi.Upload(userId, "samples/signature/" + file.getName(), null, new FileStream(is)).getResult().getGuid(); |
37 | 49 | IOUtils.closeQuietly(is); |
38 | 50 | assertThat(documentId, not(nullValue())); |
@@ -97,11 +109,12 @@ public void testSendEnvelopeForSigning() throws Exception { |
97 | 109 | api.AddSignatureEnvelopeField(userId, envelopeId, documentId, recipientId, fieldId, envField); |
98 | 110 |
|
99 | 111 | //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); |
101 | 114 | assertThat(envelopeSend, not(nullValue())); |
102 | 115 | assertThat(envelopeSend.getStatus(), equalTo("Ok")); |
103 | 116 |
|
104 | | - String embedUrl = "https://apps.groupdocs.com/signature/signembed/" + envelopeId + "/" + recipientId; |
| 117 | + String embedUrl = "https://" + server + "apps.groupdocs.com/signature/signembed/" + envelopeId + "/" + recipientId; |
105 | 118 | System.out.println("Use following URL to sign the envelope: " + embedUrl); |
106 | 119 | } |
107 | 120 |
|
|
0 commit comments