Skip to content

Commit a9529f3

Browse files
author
Vignesh Kennadi
committed
replaced postman URL with PRISM Url for Accounting YML
1 parent 67800cf commit a9529f3

28 files changed

+48
-824
lines changed

src/test/java/com/xero/api/client/AccountingApiAccountsTest.java

+9-34
Original file line numberDiff line numberDiff line change
@@ -1,45 +1,16 @@
11
package com.xero.api.client;
22

3-
import static org.junit.Assert.assertTrue;
4-
5-
import org.junit.After;
63
import org.junit.Before;
74
import org.junit.Test;
8-
import org.junit.*;
9-
105
import static org.hamcrest.MatcherAssert.*;
116
import static org.hamcrest.Matchers.*;
12-
import static org.hamcrest.Matchers.containsInAnyOrder;
13-
import static org.hamcrest.Matchers.greaterThan;
14-
import static org.hamcrest.collection.IsCollectionWithSize.hasSize;
15-
import static org.hamcrest.core.Every.everyItem;
16-
177
import com.xero.api.ApiClient;
18-
import com.xero.api.client.*;
198
import com.xero.models.accounting.*;
209

2110
import java.io.File;
22-
import java.net.URL;
23-
24-
import com.google.api.client.auth.oauth2.BearerToken;
25-
import com.google.api.client.auth.oauth2.Credential;
26-
import com.google.api.client.http.HttpRequestFactory;
27-
import com.google.api.client.http.HttpTransport;
28-
import com.google.api.client.http.javanet.NetHttpTransport;
29-
3011
import org.threeten.bp.*;
31-
import java.io.IOException;
32-
import com.fasterxml.jackson.core.type.TypeReference;
33-
34-
import java.util.Calendar;
35-
import java.util.Map;
3612
import java.util.UUID;
3713

38-
import java.io.File;
39-
import java.io.IOException;
40-
41-
import org.apache.commons.io.IOUtils;
42-
4314
public class AccountingApiAccountsTest {
4415

4516
ApiClient defaultClient;
@@ -58,7 +29,7 @@ public void setUp() {
5829

5930
// Init AccountingApi client
6031
// NEW Sandbox for API Mocking
61-
defaultClient = new ApiClient("https://25faf04a-c71e-40e7-b7ce-f1fae0149465.mock.pstmn.io/api.xro/2.0",null,null,null,null);
32+
defaultClient = new ApiClient("http://127.0.0.1:4010",null,null,null,null);
6233

6334
accountingApi = AccountingApi.getInstance(defaultClient);
6435

@@ -156,13 +127,17 @@ public void testGetAccountAttachments() throws Exception {
156127
public void testCreateAccountAttachmentByFileName() throws Exception {
157128

158129
System.out.println("@Test - createAccountAttachmentByFileName");
159-
UUID accountID = UUID.fromString("297c2dc5-cc47-4afd-8ec8-74990b8761e9");
160-
130+
Accounts accounts = accountingApi.getAccounts(accessToken,xeroTenantId,null, null, null);
131+
UUID accountID = accounts.getAccounts().get(0).getAccountID();
132+
// UUID accountID = UUID.fromString("297c2dc5-cc47-4afd-8ec8-74990b8761e9");
133+
161134
ClassLoader classLoader = getClass().getClassLoader();
162135
File bytes = new File(classLoader.getResource("helo-heros.jpg").getFile());
163136

164-
String newFileName = "sample5.jpg";
165-
Attachments createAccountsAttachments = accountingApi.createAccountAttachmentByFileName(accessToken,xeroTenantId,accountID, newFileName, bytes, null);
137+
String newFileName = bytes.getName();
138+
String idempotencyKey = null;
139+
// String idempotencyKey = "KEY_VALUE";
140+
Attachments createAccountsAttachments = accountingApi.createAccountAttachmentByFileName(accessToken,xeroTenantId,accountID, newFileName, bytes, idempotencyKey);
166141

167142
assertThat(createAccountsAttachments.getAttachments().get(0).getAttachmentID().toString(), is(equalTo("ab95b276-9dce-4925-9077-439818ba270f")));
168143
assertThat(createAccountsAttachments.getAttachments().get(0).getFileName().toString(), is(equalTo("sample5.jpg")));

src/test/java/com/xero/api/client/AccountingApiBankTransactionTest.java

+3-29
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,16 @@
11
package com.xero.api.client;
22

3-
import static org.junit.Assert.assertTrue;
4-
53
import org.junit.*;
64

75
import static org.hamcrest.MatcherAssert.*;
86
import static org.hamcrest.Matchers.*;
9-
import static org.hamcrest.collection.IsCollectionWithSize.hasSize;
10-
import static org.hamcrest.core.Every.everyItem;
11-
127
import com.xero.api.ApiClient;
13-
import com.xero.api.client.*;
148
import com.xero.models.accounting.*;
159

1610
import java.io.File;
17-
import java.net.URL;
18-
19-
import com.google.api.client.auth.oauth2.BearerToken;
20-
import com.google.api.client.auth.oauth2.Credential;
21-
import com.google.api.client.http.HttpRequestFactory;
22-
import com.google.api.client.http.HttpTransport;
23-
import com.google.api.client.http.javanet.NetHttpTransport;
24-
2511
import org.threeten.bp.*;
2612
import java.io.IOException;
27-
import com.fasterxml.jackson.core.type.TypeReference;
28-
29-
import java.io.File;
30-
import java.io.IOException;
31-
32-
import org.apache.commons.io.IOUtils;
33-
34-
import java.util.Calendar;
35-
import java.util.Map;
3613
import java.util.UUID;
37-
import java.util.List;
38-
import java.util.ArrayList;
39-
import java.math.BigDecimal;
4014

4115
public class AccountingApiBankTransactionTest {
4216

@@ -55,7 +29,7 @@ public void setUp() {
5529

5630
// Init AccountingApi client
5731
// NEW Sandbox for API Mocking
58-
defaultClient = new ApiClient("https://25faf04a-c71e-40e7-b7ce-f1fae0149465.mock.pstmn.io/api.xro/2.0",null,null,null,null);
32+
defaultClient = new ApiClient("http://127.0.0.1:4010",null,null,null,null);
5933

6034
accountingApi = AccountingApi.getInstance(defaultClient);
6135

@@ -158,8 +132,8 @@ public void createBankTransactionAttachmentByFileNameTest() throws IOException {
158132
UUID bankTransactionID = UUID.fromString("297c2dc5-cc47-4afd-8ec8-74990b8761e9");
159133
ClassLoader classLoader = getClass().getClassLoader();
160134
File bytes = new File(classLoader.getResource("helo-heros.jpg").getFile());
161-
String fileName = "sample5.jpg";
162-
135+
String fileName = "helo-heros.jpg";
136+
System.out.println("File path: " + bytes.getAbsolutePath());
163137
Attachments response = accountingApi.createBankTransactionAttachmentByFileName(accessToken,xeroTenantId,bankTransactionID, fileName, bytes, null);
164138
assertThat(response.getAttachments().get(0).getAttachmentID(), is(equalTo(UUID.fromString("4508a692-e52c-4ad8-a138-2f13e22bf57b"))));
165139
assertThat(response.getAttachments().get(0).getFileName().toString(), is(equalTo("sample5.jpg")));

src/test/java/com/xero/api/client/AccountingApiBankTransferTest.java

+1-28
Original file line numberDiff line numberDiff line change
@@ -1,43 +1,16 @@
11
package com.xero.api.client;
22

3-
import static org.junit.Assert.assertTrue;
43
import org.junit.*;
54

65
import static org.hamcrest.MatcherAssert.*;
76
import static org.hamcrest.Matchers.*;
8-
import static org.hamcrest.Matchers.containsInAnyOrder;
9-
import static org.hamcrest.Matchers.greaterThan;
10-
import static org.hamcrest.collection.IsCollectionWithSize.hasSize;
11-
import static org.hamcrest.core.Every.everyItem;
12-
137
import com.xero.api.ApiClient;
14-
import com.xero.api.client.*;
158
import com.xero.models.accounting.*;
169

1710
import java.io.File;
18-
import java.net.URL;
19-
20-
import com.google.api.client.auth.oauth2.BearerToken;
21-
import com.google.api.client.auth.oauth2.Credential;
22-
import com.google.api.client.http.HttpRequestFactory;
23-
import com.google.api.client.http.HttpTransport;
24-
import com.google.api.client.http.javanet.NetHttpTransport;
25-
2611
import org.threeten.bp.*;
2712
import java.io.IOException;
28-
import com.fasterxml.jackson.core.type.TypeReference;
29-
30-
import java.io.File;
31-
import java.io.IOException;
32-
33-
import org.apache.commons.io.IOUtils;
34-
35-
import java.util.Calendar;
36-
import java.util.Map;
3713
import java.util.UUID;
38-
import java.util.List;
39-
import java.util.ArrayList;
40-
import java.math.BigDecimal;
4114

4215
public class AccountingApiBankTransferTest {
4316

@@ -57,7 +30,7 @@ public void setUp() {
5730
xeroTenantId = "xyz";
5831

5932
// NEW Sandbox for API Mocking
60-
defaultClient = new ApiClient("https://25faf04a-c71e-40e7-b7ce-f1fae0149465.mock.pstmn.io/api.xro/2.0",null,null,null,null);
33+
defaultClient = new ApiClient("http://127.0.0.1:4010",null,null,null,null);
6134

6235
accountingApi = AccountingApi.getInstance(defaultClient);
6336

src/test/java/com/xero/api/client/AccountingApiBatchPaymentTest.java

+1-27
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,14 @@
11
package com.xero.api.client;
22

3-
import static org.junit.Assert.assertTrue;
4-
53
import org.junit.*;
64

75
import static org.hamcrest.MatcherAssert.*;
86
import static org.hamcrest.Matchers.*;
9-
import static org.hamcrest.Matchers.containsInAnyOrder;
10-
import static org.hamcrest.Matchers.greaterThan;
11-
import static org.hamcrest.collection.IsCollectionWithSize.hasSize;
12-
import static org.hamcrest.core.Every.everyItem;
13-
147
import com.xero.api.ApiClient;
15-
import com.xero.api.client.*;
168
import com.xero.models.accounting.*;
179

1810
import java.io.File;
19-
import java.net.URL;
20-
21-
import com.google.api.client.auth.oauth2.BearerToken;
22-
import com.google.api.client.auth.oauth2.Credential;
23-
import com.google.api.client.http.HttpRequestFactory;
24-
import com.google.api.client.http.HttpTransport;
25-
import com.google.api.client.http.javanet.NetHttpTransport;
26-
2711
import org.threeten.bp.*;
28-
import java.io.IOException;
29-
import com.fasterxml.jackson.core.type.TypeReference;
30-
31-
import java.io.File;
32-
import java.io.IOException;
33-
34-
import org.apache.commons.io.IOUtils;
35-
36-
import java.util.Calendar;
37-
import java.util.Map;
3812
import java.util.UUID;
3913

4014
public class AccountingApiBatchPaymentTest {
@@ -55,7 +29,7 @@ public void setUp() {
5529

5630
// Init AccountingApi client
5731
// NEW Sandbox for API Mocking
58-
defaultClient = new ApiClient("https://25faf04a-c71e-40e7-b7ce-f1fae0149465.mock.pstmn.io/api.xro/2.0",null,null,null,null);
32+
defaultClient = new ApiClient("http://127.0.0.1:4010",null,null,null,null);
5933

6034
accountingApi = AccountingApi.getInstance(defaultClient);
6135

src/test/java/com/xero/api/client/AccountingApiBrandingThemeTest.java

+1-29
Original file line numberDiff line numberDiff line change
@@ -1,40 +1,12 @@
11
package com.xero.api.client;
22

3-
import static org.junit.Assert.assertTrue;
4-
53
import org.junit.*;
64

75
import static org.hamcrest.MatcherAssert.*;
86
import static org.hamcrest.Matchers.*;
9-
import static org.hamcrest.Matchers.containsInAnyOrder;
10-
import static org.hamcrest.Matchers.greaterThan;
11-
import static org.hamcrest.collection.IsCollectionWithSize.hasSize;
12-
import static org.hamcrest.core.Every.everyItem;
13-
147
import com.xero.api.ApiClient;
15-
import com.xero.api.client.*;
168
import com.xero.models.accounting.*;
179

18-
import java.io.File;
19-
import java.net.URL;
20-
21-
import com.google.api.client.auth.oauth2.BearerToken;
22-
import com.google.api.client.auth.oauth2.Credential;
23-
import com.google.api.client.http.HttpRequestFactory;
24-
import com.google.api.client.http.HttpTransport;
25-
import com.google.api.client.http.javanet.NetHttpTransport;
26-
27-
import org.threeten.bp.*;
28-
import java.io.IOException;
29-
import com.fasterxml.jackson.core.type.TypeReference;
30-
31-
import java.io.File;
32-
import java.io.IOException;
33-
34-
import org.apache.commons.io.IOUtils;
35-
36-
import java.util.Calendar;
37-
import java.util.Map;
3810
import java.util.UUID;
3911

4012
public class AccountingApiBrandingThemeTest {
@@ -55,7 +27,7 @@ public void setUp() {
5527

5628
// Init AccountingApi client
5729
// NEW Sandbox for API Mocking
58-
defaultClient = new ApiClient("https://25faf04a-c71e-40e7-b7ce-f1fae0149465.mock.pstmn.io/api.xro/2.0",null,null,null,null);
30+
defaultClient = new ApiClient("http://127.0.0.1:4010",null,null,null,null);
5931

6032
accountingApi = AccountingApi.getInstance(defaultClient);
6133

src/test/java/com/xero/api/client/AccountingApiContactGroupTest.java

+1-31
Original file line numberDiff line numberDiff line change
@@ -1,44 +1,14 @@
11
package com.xero.api.client;
22

3-
import static org.junit.Assert.assertTrue;
4-
53
import org.junit.*;
64

75
import static org.hamcrest.MatcherAssert.*;
86
import static org.hamcrest.Matchers.*;
9-
import static org.hamcrest.Matchers.containsInAnyOrder;
10-
import static org.hamcrest.Matchers.greaterThan;
11-
import static org.hamcrest.collection.IsCollectionWithSize.hasSize;
12-
import static org.hamcrest.core.Every.everyItem;
13-
147
import com.xero.api.ApiClient;
15-
import com.xero.api.client.*;
168
import com.xero.models.accounting.*;
179

18-
import java.io.File;
19-
import java.net.URL;
20-
21-
import com.google.api.client.auth.oauth2.BearerToken;
22-
import com.google.api.client.auth.oauth2.Credential;
23-
import com.google.api.client.http.HttpRequestFactory;
24-
import com.google.api.client.http.HttpTransport;
25-
import com.google.api.client.http.javanet.NetHttpTransport;
26-
27-
import org.threeten.bp.*;
2810
import java.io.IOException;
29-
import com.fasterxml.jackson.core.type.TypeReference;
30-
31-
import java.io.File;
32-
import java.io.IOException;
33-
34-
import org.apache.commons.io.IOUtils;
35-
36-
import java.util.Calendar;
37-
import java.util.Map;
3811
import java.util.UUID;
39-
import java.util.List;
40-
import java.util.ArrayList;
41-
import java.math.BigDecimal;
4212

4313
public class AccountingApiContactGroupTest {
4414

@@ -58,7 +28,7 @@ public void setUp() {
5828

5929
// Init AccountingApi client
6030
// NEW Sandbox for API Mocking
61-
defaultClient = new ApiClient("https://25faf04a-c71e-40e7-b7ce-f1fae0149465.mock.pstmn.io/api.xro/2.0",null,null,null,null);
31+
defaultClient = new ApiClient("http://127.0.0.1:4010",null,null,null,null);
6232

6333
accountingApi = AccountingApi.getInstance(defaultClient);
6434

src/test/java/com/xero/api/client/AccountingApiContactsTest.java

+1-25
Original file line numberDiff line numberDiff line change
@@ -1,42 +1,18 @@
11
package com.xero.api.client;
22

3-
import static org.junit.Assert.assertTrue;
4-
53
import org.junit.*;
64

75
import static org.hamcrest.MatcherAssert.*;
86
import static org.hamcrest.Matchers.*;
9-
import static org.hamcrest.collection.IsCollectionWithSize.hasSize;
10-
import static org.hamcrest.core.Every.everyItem;
11-
127
import com.xero.api.ApiClient;
13-
import com.xero.api.client.*;
148
import com.xero.models.accounting.*;
159

1610
import java.io.File;
17-
import java.net.URL;
18-
19-
import com.google.api.client.auth.oauth2.BearerToken;
20-
import com.google.api.client.auth.oauth2.Credential;
21-
import com.google.api.client.http.HttpRequestFactory;
22-
import com.google.api.client.http.HttpTransport;
23-
import com.google.api.client.http.javanet.NetHttpTransport;
24-
2511
import org.threeten.bp.*;
2612
import java.io.IOException;
27-
import com.fasterxml.jackson.core.type.TypeReference;
28-
29-
import java.io.File;
30-
import java.io.IOException;
31-
32-
import org.apache.commons.io.IOUtils;
33-
34-
import java.util.Calendar;
35-
import java.util.Map;
3613
import java.util.UUID;
3714
import java.util.List;
3815
import java.util.ArrayList;
39-
import java.math.BigDecimal;
4016

4117
public class AccountingApiContactsTest {
4218

@@ -57,7 +33,7 @@ public void setUp() {
5733

5834
// Init AccountingApi client
5935
// NEW Sandbox for API Mocking
60-
defaultClient = new ApiClient("https://25faf04a-c71e-40e7-b7ce-f1fae0149465.mock.pstmn.io/api.xro/2.0",null,null,null,null);
36+
defaultClient = new ApiClient("http://127.0.0.1:4010",null,null,null,null);
6137

6238
accountingApi = AccountingApi.getInstance(defaultClient);
6339

0 commit comments

Comments
 (0)