Skip to content

Commit

Permalink
adds config file and reference from config file
Browse files Browse the repository at this point in the history
  • Loading branch information
Vignesh Kennadi committed Sep 24, 2024
1 parent 2b6b528 commit 90d068c
Show file tree
Hide file tree
Showing 34 changed files with 380 additions and 77 deletions.
15 changes: 12 additions & 3 deletions src/test/java/com/xero/api/client/AccountingApiAccountsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
import java.io.File;
import org.threeten.bp.*;
import java.util.UUID;
import java.util.Properties;
import java.io.IOException;
import java.io.InputStream;

public class AccountingApiAccountsTest {

Expand All @@ -29,9 +32,15 @@ public void setUp() {

// Init AccountingApi client
// NEW Sandbox for API Mocking
defaultClient = new ApiClient("http://127.0.0.1:4010",null,null,null,null);

accountingApi = AccountingApi.getInstance(defaultClient);
Properties properties = new Properties();
try (InputStream input = AccountingApiAccountsTest.class.getClassLoader().getResourceAsStream("config.properties")){
properties.load(input);
defaultClient = new ApiClient(properties.getProperty("accounting.api.url"),null,null,null,null);
accountingApi = AccountingApi.getInstance(defaultClient);

} catch (IOException ex) {
ex.printStackTrace();
}

// ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs
if (setUpIsDone) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
import org.threeten.bp.*;
import java.io.IOException;
import java.util.UUID;
import java.util.Properties;
import java.io.InputStream;

public class AccountingApiBankTransactionTest {

Expand All @@ -29,9 +31,15 @@ public void setUp() {

// Init AccountingApi client
// NEW Sandbox for API Mocking
defaultClient = new ApiClient("http://127.0.0.1:4010",null,null,null,null);

accountingApi = AccountingApi.getInstance(defaultClient);
Properties properties = new Properties();
try (InputStream input = AccountingApiBankTransactionTest.class.getClassLoader().getResourceAsStream("config.properties")){
properties.load(input);
defaultClient = new ApiClient(properties.getProperty("accounting.api.url"),null,null,null,null);
accountingApi = AccountingApi.getInstance(defaultClient);

} catch (IOException ex) {
ex.printStackTrace();
}

// ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs
if (setUpIsDone) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
import org.threeten.bp.*;
import java.io.IOException;
import java.util.UUID;
import java.util.Properties;
import java.io.InputStream;

public class AccountingApiBankTransferTest {

Expand All @@ -30,9 +32,15 @@ public void setUp() {
xeroTenantId = "xyz";

// NEW Sandbox for API Mocking
defaultClient = new ApiClient("http://127.0.0.1:4010",null,null,null,null);

accountingApi = AccountingApi.getInstance(defaultClient);
Properties properties = new Properties();
try (InputStream input = AccountingApiBankTransferTest.class.getClassLoader().getResourceAsStream("config.properties")){
properties.load(input);
defaultClient = new ApiClient(properties.getProperty("accounting.api.url"),null,null,null,null);
accountingApi = AccountingApi.getInstance(defaultClient);

} catch (IOException ex) {
ex.printStackTrace();
}

ClassLoader classLoader = getClass().getClassLoader();
bytes = new File(classLoader.getResource("helo-heros.jpg").getFile());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@
import java.io.File;
import org.threeten.bp.*;
import java.util.UUID;
import java.util.Properties;
import java.io.IOException;
import java.io.InputStream;

public class AccountingApiBatchPaymentTest {
ApiClient defaultClient;
Expand All @@ -29,9 +32,15 @@ public void setUp() {

// Init AccountingApi client
// NEW Sandbox for API Mocking
defaultClient = new ApiClient("http://127.0.0.1:4010",null,null,null,null);

accountingApi = AccountingApi.getInstance(defaultClient);
Properties properties = new Properties();
try (InputStream input = AccountingApiBatchPaymentTest.class.getClassLoader().getResourceAsStream("config.properties")){
properties.load(input);
defaultClient = new ApiClient(properties.getProperty("accounting.api.url"),null,null,null,null);
accountingApi = AccountingApi.getInstance(defaultClient);

} catch (IOException ex) {
ex.printStackTrace();
}

ClassLoader classLoader = getClass().getClassLoader();
bytes = new File(classLoader.getResource("helo-heros.jpg").getFile());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,9 @@
import com.xero.models.accounting.*;

import java.util.UUID;
import java.util.Properties;
import java.io.IOException;
import java.io.InputStream;

public class AccountingApiBrandingThemeTest {

Expand All @@ -27,9 +30,15 @@ public void setUp() {

// Init AccountingApi client
// NEW Sandbox for API Mocking
defaultClient = new ApiClient("http://127.0.0.1:4010",null,null,null,null);

accountingApi = AccountingApi.getInstance(defaultClient);
Properties properties = new Properties();
try (InputStream input = AccountingApiBrandingThemeTest.class.getClassLoader().getResourceAsStream("config.properties")){
properties.load(input);
defaultClient = new ApiClient(properties.getProperty("accounting.api.url"),null,null,null,null);
accountingApi = AccountingApi.getInstance(defaultClient);

} catch (IOException ex) {
ex.printStackTrace();
}

// ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs
if (setUpIsDone) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,8 @@

import java.io.IOException;
import java.util.UUID;
import java.util.Properties;
import java.io.InputStream;

public class AccountingApiContactGroupTest {

Expand All @@ -28,9 +30,15 @@ public void setUp() {

// Init AccountingApi client
// NEW Sandbox for API Mocking
defaultClient = new ApiClient("http://127.0.0.1:4010",null,null,null,null);

accountingApi = AccountingApi.getInstance(defaultClient);
Properties properties = new Properties();
try (InputStream input = AccountingApiContactGroupTest.class.getClassLoader().getResourceAsStream("config.properties")){
properties.load(input);
defaultClient = new ApiClient(properties.getProperty("accounting.api.url"),null,null,null,null);
accountingApi = AccountingApi.getInstance(defaultClient);

} catch (IOException ex) {
ex.printStackTrace();
}

// ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs
if (setUpIsDone) {
Expand Down
14 changes: 11 additions & 3 deletions src/test/java/com/xero/api/client/AccountingApiContactsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
import java.util.UUID;
import java.util.List;
import java.util.ArrayList;
import java.util.Properties;
import java.io.InputStream;

public class AccountingApiContactsTest {

Expand All @@ -33,9 +35,15 @@ public void setUp() {

// Init AccountingApi client
// NEW Sandbox for API Mocking
defaultClient = new ApiClient("http://127.0.0.1:4010",null,null,null,null);

accountingApi = AccountingApi.getInstance(defaultClient);
Properties properties = new Properties();
try (InputStream input = AccountingApiContactsTest.class.getClassLoader().getResourceAsStream("config.properties")){
properties.load(input);
defaultClient = new ApiClient(properties.getProperty("accounting.api.url"),null,null,null,null);
accountingApi = AccountingApi.getInstance(defaultClient);

} catch (IOException ex) {
ex.printStackTrace();
}

ClassLoader classLoader = getClass().getClassLoader();
body = new File(classLoader.getResource("helo-heros.jpg").getFile());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
import org.threeten.bp.*;
import java.io.IOException;
import java.util.UUID;
import java.util.Properties;
import java.io.InputStream;

public class AccountingApiCreditNotesTest {

Expand All @@ -30,8 +32,15 @@ public void setUp() {
xeroTenantId = "xyz";

// NEW Sandbox for API Mocking
defaultClient = new ApiClient("http://127.0.0.1:4010",null,null,null,null);
accountingApi = AccountingApi.getInstance(defaultClient);
Properties properties = new Properties();
try (InputStream input = AccountingApiCreditNotesTest.class.getClassLoader().getResourceAsStream("config.properties")){
properties.load(input);
defaultClient = new ApiClient(properties.getProperty("accounting.api.url"),null,null,null,null);
accountingApi = AccountingApi.getInstance(defaultClient);

} catch (IOException ex) {
ex.printStackTrace();
}

ClassLoader classLoader = getClass().getClassLoader();
body = new File(classLoader.getResource("helo-heros.jpg").getFile());
Expand Down
13 changes: 11 additions & 2 deletions src/test/java/com/xero/api/client/AccountingApiEmployeesTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
import org.threeten.bp.*;
import java.io.IOException;
import java.util.UUID;
import java.util.Properties;
import java.io.InputStream;

public class AccountingApiEmployeesTest {

Expand All @@ -29,8 +31,15 @@ public void setUp() {

// Init AccountingApi client
// NEW Sandbox for API Mocking
defaultClient = new ApiClient("http://127.0.0.1:4010",null,null,null,null);
accountingApi = AccountingApi.getInstance(defaultClient);
Properties properties = new Properties();
try (InputStream input = AccountingApiEmployeesTest.class.getClassLoader().getResourceAsStream("config.properties")){
properties.load(input);
defaultClient = new ApiClient(properties.getProperty("accounting.api.url"),null,null,null,null);
accountingApi = AccountingApi.getInstance(defaultClient);

} catch (IOException ex) {
ex.printStackTrace();
}

// ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs
if (setUpIsDone) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
import org.threeten.bp.*;
import java.io.IOException;
import java.util.UUID;
import java.util.Properties;
import java.io.InputStream;

public class AccountingApiExpenseClaimsTest {

Expand All @@ -31,8 +33,15 @@ public void setUp() {

// Init AccountingApi client
// NEW Sandbox for API Mocking
defaultClient = new ApiClient("http://127.0.0.1:4010",null,null,null,null);
accountingApi = AccountingApi.getInstance(defaultClient);
Properties properties = new Properties();
try (InputStream input = AccountingApiExpenseClaimsTest.class.getClassLoader().getResourceAsStream("config.properties")){
properties.load(input);
defaultClient = new ApiClient(properties.getProperty("accounting.api.url"),null,null,null,null);
accountingApi = AccountingApi.getInstance(defaultClient);

} catch (IOException ex) {
ex.printStackTrace();
}

ClassLoader classLoader = getClass().getClassLoader();
body = new File(classLoader.getResource("helo-heros.jpg").getFile());
Expand Down
13 changes: 11 additions & 2 deletions src/test/java/com/xero/api/client/AccountingApiInvoicesTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@
import java.util.UUID;
import java.util.List;
import java.util.ArrayList;
import java.util.Properties;
import java.io.InputStream;

public class AccountingApiInvoicesTest {

Expand All @@ -32,8 +34,15 @@ public void setUp() {

// Init AccountingApi client
// NEW Sandbox for API Mocking
defaultClient = new ApiClient("http://127.0.0.1:4010",null,null,null,null);
accountingApi = AccountingApi.getInstance(defaultClient);
Properties properties = new Properties();
try (InputStream input = AccountingApiInvoicesTest.class.getClassLoader().getResourceAsStream("config.properties")){
properties.load(input);
defaultClient = new ApiClient(properties.getProperty("accounting.api.url"),null,null,null,null);
accountingApi = AccountingApi.getInstance(defaultClient);

} catch (IOException ex) {
ex.printStackTrace();
}

ClassLoader classLoader = getClass().getClassLoader();
body = new File(classLoader.getResource("helo-heros.jpg").getFile());
Expand Down
13 changes: 11 additions & 2 deletions src/test/java/com/xero/api/client/AccountingApiItemsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
import org.threeten.bp.*;
import java.io.IOException;
import java.util.UUID;
import java.util.Properties;
import java.io.InputStream;

public class AccountingApiItemsTest {

Expand All @@ -29,8 +31,15 @@ public void setUp() {

// Init AccountingApi client
// NEW Sandbox for API Mocking
defaultClient = new ApiClient("http://127.0.0.1:4010",null,null,null,null);
accountingApi = AccountingApi.getInstance(defaultClient);
Properties properties = new Properties();
try (InputStream input = AccountingApiItemsTest.class.getClassLoader().getResourceAsStream("config.properties")){
properties.load(input);
defaultClient = new ApiClient(properties.getProperty("accounting.api.url"),null,null,null,null);
accountingApi = AccountingApi.getInstance(defaultClient);

} catch (IOException ex) {
ex.printStackTrace();
}

// ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs
if (setUpIsDone) {
Expand Down
13 changes: 11 additions & 2 deletions src/test/java/com/xero/api/client/AccountingApiJournalsTest.java
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
import org.threeten.bp.*;
import java.io.IOException;
import java.util.UUID;
import java.util.Properties;
import java.io.InputStream;

public class AccountingApiJournalsTest {

Expand All @@ -28,8 +30,15 @@ public void setUp() {

// Init AccountingApi client
// NEW Sandbox for API Mocking
defaultClient = new ApiClient("http://127.0.0.1:4010",null,null,null,null);
accountingApi = AccountingApi.getInstance(defaultClient);
Properties properties = new Properties();
try (InputStream input = AccountingApiJournalsTest.class.getClassLoader().getResourceAsStream("config.properties")){
properties.load(input);
defaultClient = new ApiClient(properties.getProperty("accounting.api.url"),null,null,null,null);
accountingApi = AccountingApi.getInstance(defaultClient);

} catch (IOException ex) {
ex.printStackTrace();
}

// ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs
if (setUpIsDone) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,8 @@
import org.threeten.bp.*;
import java.io.IOException;
import java.util.UUID;
import java.util.Properties;
import java.io.InputStream;

public class AccountingApiLinkedTransactionsTest {

Expand All @@ -29,8 +31,15 @@ public void setUp() {

// Init AccountingApi client
// NEW Sandbox for API Mocking
defaultClient = new ApiClient("http://127.0.0.1:4010",null,null,null,null);
accountingApi = AccountingApi.getInstance(defaultClient);
Properties properties = new Properties();
try (InputStream input = AccountingApiLinkedTransactionsTest.class.getClassLoader().getResourceAsStream("config.properties")){
properties.load(input);
defaultClient = new ApiClient(properties.getProperty("accounting.api.url"),null,null,null,null);
accountingApi = AccountingApi.getInstance(defaultClient);

} catch (IOException ex) {
ex.printStackTrace();
}

// ADDED TO MANAGE RATE LIMITS while using SwaggerHub to mock APIs
if (setUpIsDone) {
Expand Down
Loading

0 comments on commit 90d068c

Please sign in to comment.