sortKeys) {
return null;
}
if (sortKeys.size() > 1) {
- throw new DASSdkException("Only one sort key is allowed.");
+ throw new DASSdkInvalidArgumentException("Only one sort key is allowed.");
}
SortKey key = sortKeys.getFirst();
return (key.getIsReversed() ? "-" : "+") + key.getName().replace("title", "name");
@@ -125,4 +124,43 @@ public OffsetDateTime getDateTime(String dateString) {
// Parse the string to an OffsetDateTime object
return OffsetDateTime.parse(dateString, formatter);
}
+
+ // A helper to fallback to a default message if ever the body would be empty or null.
+ private static String mkMessage(String msg) {
+ if (msg == null || msg.trim().isEmpty()) {
+ return "Unknown JIRA API error";
+ }
+ return msg;
+ }
+
+ /**
+ * Helper method to create a DASSdk RuntimeException from an ApiException.
+ *
+ * When the SDK exposes more exceptions (e.g. authentication errors), this method can
+ * investigate the ApiException and create the appropriate SDK exception.
+ *
+ * @param e the ApiException to convert
+ * @return the RuntimeException to throw
+ */
+ protected RuntimeException makeSdkException(ApiException e) {
+ return switch (e.getCode()) {
+ case 400 -> new DASSdkInvalidArgumentException(mkMessage(e.getResponseBody()), e);
+ case 401 -> new DASSdkUnauthenticatedException("unauthorized", e);
+ case 403 -> new DASSdkPermissionDeniedException("permission denied", e);
+ default ->
+ // For now, just create a generic SDK exception with the body of the ApiException
+ new DASSdkInvalidArgumentException(mkMessage(e.getResponseBody()), e);
+ };
+ }
+
+ protected RuntimeException makeSdkException(com.rawlabs.das.jira.rest.software.ApiException e) {
+ return switch (e.getCode()) {
+ case 400 -> new DASSdkInvalidArgumentException(mkMessage(e.getResponseBody()), e);
+ case 401 -> new DASSdkUnauthenticatedException("unauthorized", e);
+ case 403 -> new DASSdkPermissionDeniedException("permission denied", e);
+ default ->
+ // For now, just create a generic SDK exception with the body of the ApiException
+ new DASSdkInvalidArgumentException(mkMessage(e.getResponseBody()), e);
+ };
+ }
}
diff --git a/das-jira-connector/src/main/java/com/rawlabs/das/jira/tables/definitions/DASJiraAdvancedSettingsTable.java b/das-jira-connector/src/main/java/com/rawlabs/das/jira/tables/definitions/DASJiraAdvancedSettingsTable.java
index 6dc84e5..6523269 100644
--- a/das-jira-connector/src/main/java/com/rawlabs/das/jira/tables/definitions/DASJiraAdvancedSettingsTable.java
+++ b/das-jira-connector/src/main/java/com/rawlabs/das/jira/tables/definitions/DASJiraAdvancedSettingsTable.java
@@ -10,7 +10,6 @@
import com.rawlabs.das.jira.rest.platform.model.SimpleApplicationPropertyBean;
import com.rawlabs.das.jira.tables.*;
import com.rawlabs.das.sdk.DASExecuteResult;
-import com.rawlabs.das.sdk.DASSdkException;
import com.rawlabs.protocol.das.v1.query.PathKey;
import com.rawlabs.protocol.das.v1.query.Qual;
import com.rawlabs.protocol.das.v1.query.SortKey;
@@ -58,7 +57,7 @@ public Row update(Value rowId, Row newValues) {
jiraSettingsApi.setApplicationProperty(id, applicationPropertyBean);
return toRow(applicationProperty, List.of());
} catch (ApiException e) {
- throw new DASSdkException(e.getMessage(), e);
+ throw makeSdkException(e);
}
}
@@ -89,8 +88,7 @@ public Row next() {
}
};
} catch (ApiException e) {
- throw new DASSdkException(
- "Failed to fetch advanced settings: %s".formatted(e.getResponseBody()), e);
+ throw makeSdkException(e);
}
}
diff --git a/das-jira-connector/src/main/java/com/rawlabs/das/jira/tables/definitions/DASJiraBacklogIssueTable.java b/das-jira-connector/src/main/java/com/rawlabs/das/jira/tables/definitions/DASJiraBacklogIssueTable.java
index 87c69d4..2e8a87d 100644
--- a/das-jira-connector/src/main/java/com/rawlabs/das/jira/tables/definitions/DASJiraBacklogIssueTable.java
+++ b/das-jira-connector/src/main/java/com/rawlabs/das/jira/tables/definitions/DASJiraBacklogIssueTable.java
@@ -13,7 +13,7 @@
import com.rawlabs.das.jira.tables.results.DASJiraPaginatedResult;
import com.rawlabs.das.jira.tables.results.DASJiraWithParentTableResult;
import com.rawlabs.das.sdk.DASExecuteResult;
-import com.rawlabs.das.sdk.DASSdkException;
+import com.rawlabs.das.sdk.DASSdkInvalidArgumentException;
import com.rawlabs.protocol.das.v1.query.Qual;
import com.rawlabs.protocol.das.v1.query.SortKey;
import com.rawlabs.protocol.das.v1.tables.Column;
@@ -50,7 +50,7 @@ public Row update(Value rowId, Row newValues) {
String issueId = (String) extractValueFactory.extractValue(rowId);
if (boardId == null || issueId == null) {
- throw new DASSdkException("The only update operation allowed is moving issues to backlog.");
+ throw new DASSdkInvalidArgumentException("The only update operation allowed is moving issues to backlog.");
}
MoveIssuesToBacklogForBoardRequest moveIssuesToBacklogForBoardRequest =
@@ -59,7 +59,7 @@ public Row update(Value rowId, Row newValues) {
try {
boardApi.moveIssuesToBoard(boardId, moveIssuesToBacklogForBoardRequest);
} catch (ApiException e) {
- throw new DASSdkException(e.getMessage(), e);
+ throw makeSdkException(e);
}
return newValues.toBuilder()
.addColumns(
@@ -103,7 +103,7 @@ public DASJiraPage fetchPage(long offset) {
Long.valueOf(Objects.requireNonNullElse(searchResults.getTotal(), 0)),
searchResults.getNames());
} catch (ApiException e) {
- throw new DASSdkException(e.getMessage(), e);
+ throw makeSdkException(e);
}
}
};
diff --git a/das-jira-connector/src/main/java/com/rawlabs/das/jira/tables/definitions/DASJiraBoardTable.java b/das-jira-connector/src/main/java/com/rawlabs/das/jira/tables/definitions/DASJiraBoardTable.java
index 3c6c233..793921b 100644
--- a/das-jira-connector/src/main/java/com/rawlabs/das/jira/tables/definitions/DASJiraBoardTable.java
+++ b/das-jira-connector/src/main/java/com/rawlabs/das/jira/tables/definitions/DASJiraBoardTable.java
@@ -11,7 +11,6 @@
import com.rawlabs.das.jira.tables.results.DASJiraPage;
import com.rawlabs.das.jira.tables.results.DASJiraPaginatedResult;
import com.rawlabs.das.sdk.DASExecuteResult;
-import com.rawlabs.das.sdk.DASSdkException;
import com.rawlabs.protocol.das.v1.query.PathKey;
import com.rawlabs.protocol.das.v1.query.Qual;
import com.rawlabs.protocol.das.v1.query.SortKey;
@@ -62,7 +61,7 @@ public Row insert(Row row) {
GetAllBoards200ResponseValuesInner result = boardApi.createBoard(board);
return toRow(result, null);
} catch (ApiException e) {
- throw new DASSdkException(e.getMessage(), e);
+ throw makeSdkException(e);
}
}
@@ -70,7 +69,7 @@ public void delete(Value rowId) {
try {
boardApi.deleteBoard((Long) extractValueFactory.extractValue(rowId));
} catch (ApiException e) {
- throw new DASSdkException(e.getMessage(), e);
+ throw makeSdkException(e);
}
}
@@ -120,8 +119,7 @@ public DASJiraPage fetchPage(long offset) {
return new DASJiraPage<>(
getAllBoards200ResponsePage.getValues(), getAllBoards200ResponsePage.getTotal());
} catch (ApiException e) {
- throw new DASSdkException(
- "Failed to fetch boards: %s".formatted(e.getResponseBody()));
+ throw makeSdkException(e);
}
}
@@ -131,33 +129,29 @@ public Row next() {
try {
return toRow(next, columns);
} catch (ApiException e) {
- throw new DASSdkException("Failed to fetch board configuration", e);
+ throw makeSdkException(e);
}
}
};
}
} catch (ApiException e) {
- throw new DASSdkException("Failed to fetch advanced settings", e);
+ throw makeSdkException(e);
}
}
private Row toRow(
GetAllBoards200ResponseValuesInner getAllBoards200ResponseValuesInner, List columns)
throws ApiException {
- try {
- Row row = getBoardsRow(getAllBoards200ResponseValuesInner, columns);
- if (columns == null
- || columns.isEmpty()
- || columns.contains("filter_id")
- || columns.contains("sub_query")) {
- GetConfiguration200Response config =
- boardApi.getConfiguration(getAllBoards200ResponseValuesInner.getId());
- row = addConfigToRow(row, config, columns);
- }
- return row;
- } catch (ApiException e) {
- throw new DASSdkException("Failed to fetch board configuration", e);
+ Row row = getBoardsRow(getAllBoards200ResponseValuesInner, columns);
+ if (columns == null
+ || columns.isEmpty()
+ || columns.contains("filter_id")
+ || columns.contains("sub_query")) {
+ GetConfiguration200Response config =
+ boardApi.getConfiguration(getAllBoards200ResponseValuesInner.getId());
+ row = addConfigToRow(row, config, columns);
}
+ return row;
}
private Row getBoardsRow(
diff --git a/das-jira-connector/src/main/java/com/rawlabs/das/jira/tables/definitions/DASJiraComponentTable.java b/das-jira-connector/src/main/java/com/rawlabs/das/jira/tables/definitions/DASJiraComponentTable.java
index 40f4050..2481678 100644
--- a/das-jira-connector/src/main/java/com/rawlabs/das/jira/tables/definitions/DASJiraComponentTable.java
+++ b/das-jira-connector/src/main/java/com/rawlabs/das/jira/tables/definitions/DASJiraComponentTable.java
@@ -13,7 +13,6 @@
import com.rawlabs.das.jira.tables.results.DASJiraPaginatedResult;
import com.rawlabs.das.jira.tables.results.DASJiraWithParentTableResult;
import com.rawlabs.das.sdk.DASExecuteResult;
-import com.rawlabs.das.sdk.DASSdkException;
import com.rawlabs.protocol.das.v1.query.PathKey;
import com.rawlabs.protocol.das.v1.query.Qual;
import com.rawlabs.protocol.das.v1.query.SortKey;
@@ -80,7 +79,7 @@ public Row insert(Row row) {
this.projectComponentsApi.createComponent(createProjectComponent(row));
return toRow(toComponentWithCount(inserted), List.of());
} catch (ApiException e) {
- throw new DASSdkException(e.getMessage());
+ throw makeSdkException(e);
}
}
@@ -93,7 +92,7 @@ public Row update(Value rowId, Row newValues) {
projectComponentsApi.updateComponent(
(String) extractValueFactory.extractValue(rowId), createProjectComponent(newValues));
} catch (ApiException e) {
- throw new RuntimeException(e);
+ throw makeSdkException(e);
}
return super.update(rowId, newValues);
}
@@ -102,7 +101,7 @@ public void delete(Value rowId) {
try {
projectComponentsApi.deleteComponent((String) extractValueFactory.extractValue(rowId), null);
} catch (ApiException e) {
- throw new RuntimeException(e);
+ throw makeSdkException(e);
}
}
@@ -133,8 +132,7 @@ public DASJiraPage fetchPage(long offset) {
null);
return new DASJiraPage<>(components.getValues(), components.getTotal());
} catch (ApiException e) {
- throw new DASSdkException(
- "Error fetching components: %s".formatted(e.getResponseBody()), e);
+ throw makeSdkException(e);
}
}
};
@@ -259,7 +257,7 @@ public ComponentWithIssueCount toComponentWithCount(ProjectComponent projectComp
realAssigneeType,
projectComponent.getSelf());
} catch (ApiException e) {
- throw new DASSdkException(e.getMessage(), e);
+ throw makeSdkException(e);
}
}
diff --git a/das-jira-connector/src/main/java/com/rawlabs/das/jira/tables/definitions/DASJiraDashboardTable.java b/das-jira-connector/src/main/java/com/rawlabs/das/jira/tables/definitions/DASJiraDashboardTable.java
index c45a45d..945ade2 100644
--- a/das-jira-connector/src/main/java/com/rawlabs/das/jira/tables/definitions/DASJiraDashboardTable.java
+++ b/das-jira-connector/src/main/java/com/rawlabs/das/jira/tables/definitions/DASJiraDashboardTable.java
@@ -5,6 +5,7 @@
import com.fasterxml.jackson.core.JsonProcessingException;
import com.fasterxml.jackson.databind.node.ArrayNode;
+import com.rawlabs.das.jira.DASJiraUnexpectedError;
import com.rawlabs.das.jira.rest.platform.ApiException;
import com.rawlabs.das.jira.rest.platform.api.DashboardsApi;
import com.rawlabs.das.jira.rest.platform.model.*;
@@ -12,7 +13,6 @@
import com.rawlabs.das.jira.tables.results.DASJiraPage;
import com.rawlabs.das.jira.tables.results.DASJiraPaginatedResult;
import com.rawlabs.das.sdk.DASExecuteResult;
-import com.rawlabs.das.sdk.DASSdkException;
import com.rawlabs.protocol.das.v1.query.PathKey;
import com.rawlabs.protocol.das.v1.query.Qual;
import com.rawlabs.protocol.das.v1.query.SortKey;
@@ -70,8 +70,10 @@ public Row insert(Row row) {
try {
Dashboard result = dashboardsApi.createDashboard(getDashboardDetails(row), null);
return toRow(result, List.of());
- } catch (ApiException | IOException e) {
- throw new DASSdkException(e.getMessage(), e);
+ } catch (ApiException e) {
+ throw makeSdkException(e);
+ } catch (IOException e) {
+ throw new DASJiraUnexpectedError(e);
}
}
@@ -84,8 +86,10 @@ public Row update(Value rowId, Row newValues) {
getDashboardDetails(newValues),
null);
return toRow(result, List.of());
- } catch (ApiException | IOException e) {
- throw new RuntimeException(e);
+ } catch (ApiException e) {
+ throw makeSdkException(e);
+ } catch (IOException e) {
+ throw new DASJiraUnexpectedError(e);
}
}
@@ -94,7 +98,7 @@ public void delete(Value rowId) {
try {
dashboardsApi.deleteDashboard(extractValueFactory.extractValue(rowId).toString());
} catch (ApiException e) {
- throw new RuntimeException(e);
+ throw makeSdkException(e);
}
}
@@ -117,7 +121,7 @@ public DASJiraPage fetchPage(long offset) {
return new DASJiraPage<>(
page.getDashboards(), Long.valueOf(Objects.requireNonNullElse(page.getTotal(), 0)));
} catch (ApiException e) {
- throw new RuntimeException(e);
+ throw makeSdkException(e);
}
}
};
@@ -165,7 +169,7 @@ private Row toRow(Dashboard dashboard, List columns) {
addToRow("title", rowBuilder, dashboard.getName(), columns);
return rowBuilder.build();
} catch (JsonProcessingException e) {
- throw new DASSdkException(e.getMessage());
+ throw new DASJiraUnexpectedError(e);
}
}
diff --git a/das-jira-connector/src/main/java/com/rawlabs/das/jira/tables/definitions/DASJiraEpicTable.java b/das-jira-connector/src/main/java/com/rawlabs/das/jira/tables/definitions/DASJiraEpicTable.java
index 88df8eb..88e35d7 100644
--- a/das-jira-connector/src/main/java/com/rawlabs/das/jira/tables/definitions/DASJiraEpicTable.java
+++ b/das-jira-connector/src/main/java/com/rawlabs/das/jira/tables/definitions/DASJiraEpicTable.java
@@ -9,7 +9,6 @@
import com.rawlabs.das.jira.rest.software.model.EpicSearchResult;
import com.rawlabs.das.jira.tables.DASJiraTable;
import com.rawlabs.das.sdk.DASExecuteResult;
-import com.rawlabs.das.sdk.DASSdkException;
import com.rawlabs.protocol.das.v1.query.Qual;
import com.rawlabs.protocol.das.v1.query.SortKey;
import com.rawlabs.protocol.das.v1.tables.ColumnDefinition;
@@ -43,7 +42,7 @@ public DASExecuteResult execute(
EpicSearchResult result = epicApi.searchPaginatedEpics(0, withMaxResultOrLimit(limit));
return fromRowIterator(result.getValues().stream().map(v -> toRow(v, columns)).iterator());
} catch (ApiException e) {
- throw new DASSdkException(e.getMessage());
+ throw makeSdkException(e);
}
}
diff --git a/das-jira-connector/src/main/java/com/rawlabs/das/jira/tables/definitions/DASJiraGlobalSettingTable.java b/das-jira-connector/src/main/java/com/rawlabs/das/jira/tables/definitions/DASJiraGlobalSettingTable.java
index f7ea8bb..35673ce 100644
--- a/das-jira-connector/src/main/java/com/rawlabs/das/jira/tables/definitions/DASJiraGlobalSettingTable.java
+++ b/das-jira-connector/src/main/java/com/rawlabs/das/jira/tables/definitions/DASJiraGlobalSettingTable.java
@@ -4,12 +4,12 @@
import static com.rawlabs.das.jira.utils.factory.type.TypeFactory.*;
import com.fasterxml.jackson.core.JsonProcessingException;
+import com.rawlabs.das.jira.DASJiraUnexpectedError;
import com.rawlabs.das.jira.rest.platform.ApiException;
import com.rawlabs.das.jira.rest.platform.api.JiraSettingsApi;
import com.rawlabs.das.jira.rest.platform.model.ModelConfiguration;
import com.rawlabs.das.jira.tables.DASJiraTable;
import com.rawlabs.das.sdk.DASExecuteResult;
-import com.rawlabs.das.sdk.DASSdkException;
import com.rawlabs.protocol.das.v1.query.Qual;
import com.rawlabs.protocol.das.v1.query.SortKey;
import com.rawlabs.protocol.das.v1.tables.ColumnDefinition;
@@ -44,7 +44,7 @@ public DASExecuteResult execute(
Iterator iterator = List.of(toRow(config, columns)).iterator();
return fromRowIterator(iterator);
} catch (ApiException e) {
- throw new RuntimeException(e);
+ throw makeSdkException(e);
}
}
@@ -73,7 +73,7 @@ private Row toRow(ModelConfiguration configuration, List columns) {
try {
return objectMapper.writeValueAsString(c);
} catch (JsonProcessingException e) {
- throw new DASSdkException(e.getMessage(), e);
+ throw new DASJiraUnexpectedError(e);
}
})
.orElse(null),
diff --git a/das-jira-connector/src/main/java/com/rawlabs/das/jira/tables/definitions/DASJiraGroupTable.java b/das-jira-connector/src/main/java/com/rawlabs/das/jira/tables/definitions/DASJiraGroupTable.java
index 3468543..da63dd3 100644
--- a/das-jira-connector/src/main/java/com/rawlabs/das/jira/tables/definitions/DASJiraGroupTable.java
+++ b/das-jira-connector/src/main/java/com/rawlabs/das/jira/tables/definitions/DASJiraGroupTable.java
@@ -13,7 +13,6 @@
import com.rawlabs.das.jira.tables.results.DASJiraPage;
import com.rawlabs.das.jira.tables.results.DASJiraPaginatedResult;
import com.rawlabs.das.sdk.DASExecuteResult;
-import com.rawlabs.das.sdk.DASSdkException;
import com.rawlabs.protocol.das.v1.query.PathKey;
import com.rawlabs.protocol.das.v1.query.Qual;
import com.rawlabs.protocol.das.v1.query.SortKey;
@@ -61,7 +60,7 @@ public Row insert(Row row) {
groupDetails.setGroupId(group.getGroupId());
return toRow(groupDetails, List.of(), List.of(), List.of());
} catch (ApiException e) {
- throw new DASSdkException(e.getMessage());
+ throw makeSdkException(e);
}
}
@@ -71,7 +70,7 @@ public void delete(Value rowId) {
this.groupsApi.removeGroup(
null, (String) extractValueFactory.extractValue(rowId), null, null);
} catch (ApiException e) {
- throw new DASSdkException(e.getMessage());
+ throw makeSdkException(e);
}
}
@@ -112,7 +111,7 @@ public DASJiraPage fetchPage(long offset) {
withMaxResultOrLimit(limit));
return new DASJiraPage<>(result.getValues(), result.getTotal());
} catch (ApiException e) {
- throw new DASSdkException(e.getMessage());
+ throw makeSdkException(e);
}
}
}) {
@@ -134,7 +133,7 @@ public DASJiraPage fetchPage(long offset) {
groupsApi.bulkGetGroups(offset, withMaxResultOrLimit(limit), null, null, null, null);
return new DASJiraPage<>(result.getValues(), result.getTotal());
} catch (ApiException e) {
- throw new DASSdkException(e.getMessage());
+ throw makeSdkException(e);
}
}
};
diff --git a/das-jira-connector/src/main/java/com/rawlabs/das/jira/tables/definitions/DASJiraIssueCommentTable.java b/das-jira-connector/src/main/java/com/rawlabs/das/jira/tables/definitions/DASJiraIssueCommentTable.java
index dd35f9e..1e7315f 100644
--- a/das-jira-connector/src/main/java/com/rawlabs/das/jira/tables/definitions/DASJiraIssueCommentTable.java
+++ b/das-jira-connector/src/main/java/com/rawlabs/das/jira/tables/definitions/DASJiraIssueCommentTable.java
@@ -3,6 +3,7 @@
import static com.rawlabs.das.jira.utils.factory.table.ColumnFactory.createColumn;
import static com.rawlabs.das.jira.utils.factory.type.TypeFactory.*;
+import com.rawlabs.das.jira.DASJiraUnexpectedError;
import com.rawlabs.das.jira.rest.platform.ApiException;
import com.rawlabs.das.jira.rest.platform.api.*;
import com.rawlabs.das.jira.rest.platform.model.Comment;
@@ -12,7 +13,6 @@
import com.rawlabs.das.jira.tables.results.DASJiraPaginatedResult;
import com.rawlabs.das.jira.tables.results.DASJiraWithParentTableResult;
import com.rawlabs.das.sdk.DASExecuteResult;
-import com.rawlabs.das.sdk.DASSdkException;
import com.rawlabs.protocol.das.v1.query.Qual;
import com.rawlabs.protocol.das.v1.query.SortKey;
import com.rawlabs.protocol.das.v1.tables.ColumnDefinition;
@@ -61,7 +61,7 @@ private Comment extractComment(Row row) {
UserDetails.fromJson(extractValueFactory.extractValue(row, "update_author").toString()),
extractValueFactory.extractValue(row, "updated").toString());
} catch (IOException e) {
- throw new DASSdkException(e.getMessage(), e);
+ throw new DASJiraUnexpectedError(e);
}
}
@@ -71,7 +71,7 @@ public Row insert(Row row) {
Comment resultComment = issueCommentsApi.addComment(issueIdOrKey, extractComment(row), null);
return toRow(resultComment, issueIdOrKey, List.of());
} catch (ApiException e) {
- throw new DASSdkException(e.getMessage(), e);
+ throw makeSdkException(e);
}
}
@@ -88,7 +88,7 @@ public Row update(Value rowId, Row newValues) {
null);
return toRow(comment, issueIdOrKey, List.of());
} catch (ApiException e) {
- throw new RuntimeException(e);
+ throw makeSdkException(e);
}
}
@@ -114,7 +114,7 @@ public DASJiraPage fetchPage(long offset) {
issueId, offset, withMaxResultOrLimit(limit), withOrderBy(sortKeys), null);
return new DASJiraPage<>(result.getComments(), result.getTotal());
} catch (ApiException e) {
- throw new DASSdkException(e.getResponseBody());
+ throw makeSdkException(e);
}
}
};
diff --git a/das-jira-connector/src/main/java/com/rawlabs/das/jira/tables/definitions/DASJiraIssueTable.java b/das-jira-connector/src/main/java/com/rawlabs/das/jira/tables/definitions/DASJiraIssueTable.java
index cab2ca2..2e6ad8d 100644
--- a/das-jira-connector/src/main/java/com/rawlabs/das/jira/tables/definitions/DASJiraIssueTable.java
+++ b/das-jira-connector/src/main/java/com/rawlabs/das/jira/tables/definitions/DASJiraIssueTable.java
@@ -13,7 +13,6 @@
import com.rawlabs.das.jira.tables.results.DASJiraPage;
import com.rawlabs.das.jira.tables.results.DASJiraPaginatedResult;
import com.rawlabs.das.sdk.DASExecuteResult;
-import com.rawlabs.das.sdk.DASSdkException;
import com.rawlabs.protocol.das.v1.query.Qual;
import com.rawlabs.protocol.das.v1.query.SortKey;
import com.rawlabs.protocol.das.v1.tables.ColumnDefinition;
@@ -54,7 +53,7 @@ public Row insert(Row row) {
addToRow("self", builder, result.getSelf(), List.of());
return builder.build();
} catch (ApiException e) {
- throw new DASSdkException(e.getMessage());
+ throw makeSdkException(e);
}
}
@@ -62,7 +61,7 @@ public void delete(Value rowId) {
try {
issuesApi.deleteIssue(extractValueFactory.extractValue(rowId).toString(), null);
} catch (ApiException e) {
- throw new DASSdkException(e.getMessage());
+ throw makeSdkException(e);
}
}
@@ -101,7 +100,7 @@ public DASJiraPage fetchPage(long offset) {
Long.valueOf(Objects.requireNonNullElse(result.getTotal(), 0)),
result.getNames());
} catch (ApiException e) {
- throw new DASSdkException(e.getMessage());
+ throw makeSdkException(e);
}
}
};
diff --git a/das-jira-connector/src/main/java/com/rawlabs/das/jira/tables/definitions/DASJiraIssueTypeTable.java b/das-jira-connector/src/main/java/com/rawlabs/das/jira/tables/definitions/DASJiraIssueTypeTable.java
index 6ad3acd..6f677b0 100644
--- a/das-jira-connector/src/main/java/com/rawlabs/das/jira/tables/definitions/DASJiraIssueTypeTable.java
+++ b/das-jira-connector/src/main/java/com/rawlabs/das/jira/tables/definitions/DASJiraIssueTypeTable.java
@@ -8,7 +8,6 @@
import com.rawlabs.das.jira.rest.platform.model.*;
import com.rawlabs.das.jira.tables.DASJiraTable;
import com.rawlabs.das.sdk.DASExecuteResult;
-import com.rawlabs.das.sdk.DASSdkException;
import com.rawlabs.protocol.das.v1.query.PathKey;
import com.rawlabs.protocol.das.v1.query.Qual;
import com.rawlabs.protocol.das.v1.query.SortKey;
@@ -58,7 +57,7 @@ public Row insert(Row row) {
issueTypeCreateBean.setHierarchyLevel(hierarchyLevel);
return toRow(issueTypesApi.createIssueType(issueTypeCreateBean), List.of());
} catch (ApiException e) {
- throw new DASSdkException(e.getMessage());
+ throw makeSdkException(e);
}
}
@@ -69,7 +68,7 @@ public Row update(Value rowId, Row newValues) {
var result = issueTypesApi.updateIssueType(id, issueTypeUpdateBean);
return toRow(result, List.of());
} catch (ApiException e) {
- throw new RuntimeException(e);
+ throw makeSdkException(e);
}
}
@@ -78,7 +77,7 @@ public void delete(Value rowId) {
try {
issueTypesApi.deleteIssueType(id, null);
} catch (ApiException e) {
- throw new DASSdkException(e.getMessage());
+ throw makeSdkException(e);
}
}
@@ -89,7 +88,7 @@ public DASExecuteResult execute(
return fromRowIterator(
issueTypesApi.getIssueAllTypes().stream().map(i -> toRow(i, columns)).iterator());
} catch (ApiException e) {
- throw new RuntimeException(e);
+ throw makeSdkException(e);
}
}
diff --git a/das-jira-connector/src/main/java/com/rawlabs/das/jira/tables/definitions/DASJiraIssueWorklogTable.java b/das-jira-connector/src/main/java/com/rawlabs/das/jira/tables/definitions/DASJiraIssueWorklogTable.java
index 03dbd95..0332e53 100644
--- a/das-jira-connector/src/main/java/com/rawlabs/das/jira/tables/definitions/DASJiraIssueWorklogTable.java
+++ b/das-jira-connector/src/main/java/com/rawlabs/das/jira/tables/definitions/DASJiraIssueWorklogTable.java
@@ -4,6 +4,7 @@
import static com.rawlabs.das.jira.utils.factory.type.TypeFactory.*;
import com.fasterxml.jackson.core.JsonProcessingException;
+import com.rawlabs.das.jira.DASJiraUnexpectedError;
import com.rawlabs.das.jira.rest.platform.ApiException;
import com.rawlabs.das.jira.rest.platform.api.IssueSearchApi;
import com.rawlabs.das.jira.rest.platform.api.IssueWorklogsApi;
@@ -16,7 +17,6 @@
import com.rawlabs.das.jira.tables.results.DASJiraPaginatedResult;
import com.rawlabs.das.jira.tables.results.DASJiraWithParentTableResult;
import com.rawlabs.das.sdk.DASExecuteResult;
-import com.rawlabs.das.sdk.DASSdkException;
import com.rawlabs.protocol.das.v1.query.Qual;
import com.rawlabs.protocol.das.v1.query.SortKey;
import com.rawlabs.protocol.das.v1.tables.ColumnDefinition;
@@ -66,7 +66,7 @@ private Worklog extractWorklog(Row row) {
UserDetails.fromJson(updateAuthor.toJson()),
extractValueFactory.extractValue(row, "updated").toString());
} catch (IOException | URISyntaxException e) {
- throw new DASSdkException(e.getMessage());
+ throw new DASJiraUnexpectedError(e);
}
}
@@ -78,7 +78,7 @@ public Row insert(Row row) {
worklog.getIssueId(), worklog, null, null, null, null, null, null);
return toRow(resultWorklog, List.of());
} catch (ApiException e) {
- throw new DASSdkException(e.getMessage(), e);
+ throw makeSdkException(e);
}
}
@@ -97,7 +97,7 @@ public Row update(Value rowId, Row newValues) {
null);
return toRow(resultWorklog, List.of());
} catch (ApiException e) {
- throw new DASSdkException(e.getMessage());
+ throw makeSdkException(e);
}
}
@@ -125,7 +125,7 @@ public DASJiraPage fetchPage(long offset) {
result.getWorklogs(),
Long.valueOf(Objects.requireNonNullElse(result.getTotal(), 0)));
} catch (ApiException e) {
- throw new RuntimeException(e);
+ throw makeSdkException(e);
}
}
};
@@ -166,7 +166,7 @@ private Row toRow(Worklog worklog, List columns) {
objectMapper.writeValueAsString(worklog.getProperties()),
columns);
} catch (JsonProcessingException e) {
- throw new DASSdkException(e.getMessage());
+ throw new DASJiraUnexpectedError(e);
}
var updateAuthor =
diff --git a/das-jira-connector/src/main/java/com/rawlabs/das/jira/tables/definitions/DASJiraProjectRoleTable.java b/das-jira-connector/src/main/java/com/rawlabs/das/jira/tables/definitions/DASJiraProjectRoleTable.java
index 476eda0..89de7e6 100644
--- a/das-jira-connector/src/main/java/com/rawlabs/das/jira/tables/definitions/DASJiraProjectRoleTable.java
+++ b/das-jira-connector/src/main/java/com/rawlabs/das/jira/tables/definitions/DASJiraProjectRoleTable.java
@@ -10,7 +10,6 @@
import com.rawlabs.das.jira.rest.platform.model.RoleActor;
import com.rawlabs.das.jira.tables.DASJiraTable;
import com.rawlabs.das.sdk.DASExecuteResult;
-import com.rawlabs.das.sdk.DASSdkException;
import com.rawlabs.protocol.das.v1.query.PathKey;
import com.rawlabs.protocol.das.v1.query.Qual;
import com.rawlabs.protocol.das.v1.query.SortKey;
@@ -58,7 +57,7 @@ public Row insert(Row row) {
try {
return toRow(projectRolesApi.createProjectRole(createUpdateRoleRequestBean(row)), List.of());
} catch (ApiException e) {
- throw new DASSdkException(e.getMessage());
+ throw makeSdkException(e);
}
}
@@ -70,7 +69,7 @@ public Row update(Value rowId, Row newValues) {
createUpdateRoleRequestBean(newValues)),
List.of());
} catch (ApiException e) {
- throw new DASSdkException(e.getMessage());
+ throw makeSdkException(e);
}
}
@@ -78,7 +77,7 @@ public void delete(Value rowId) {
try {
projectRolesApi.deleteProjectRole((Long) extractValueFactory.extractValue(rowId), null);
} catch (ApiException e) {
- throw new DASSdkException(e.getMessage());
+ throw makeSdkException(e);
}
}
@@ -88,7 +87,7 @@ public DASExecuteResult execute(
List result = projectRolesApi.getAllProjectRoles();
return fromRowIterator(result.stream().map(r -> toRow(r, columns)).iterator());
} catch (ApiException e) {
- throw new DASSdkException(e.getMessage());
+ throw makeSdkException(e);
}
}
diff --git a/das-jira-connector/src/main/java/com/rawlabs/das/jira/tables/definitions/DASJiraProjectTable.java b/das-jira-connector/src/main/java/com/rawlabs/das/jira/tables/definitions/DASJiraProjectTable.java
index 265831a..f30ac84 100644
--- a/das-jira-connector/src/main/java/com/rawlabs/das/jira/tables/definitions/DASJiraProjectTable.java
+++ b/das-jira-connector/src/main/java/com/rawlabs/das/jira/tables/definitions/DASJiraProjectTable.java
@@ -5,6 +5,7 @@
import static com.rawlabs.das.jira.utils.factory.type.TypeFactory.*;
import com.fasterxml.jackson.core.JsonProcessingException;
+import com.rawlabs.das.jira.DASJiraUnexpectedError;
import com.rawlabs.das.jira.rest.platform.ApiException;
import com.rawlabs.das.jira.rest.platform.api.ProjectsApi;
import com.rawlabs.das.jira.rest.platform.model.*;
@@ -12,7 +13,6 @@
import com.rawlabs.das.jira.tables.results.DASJiraPage;
import com.rawlabs.das.jira.tables.results.DASJiraPaginatedResult;
import com.rawlabs.das.sdk.DASExecuteResult;
-import com.rawlabs.das.sdk.DASSdkException;
import com.rawlabs.protocol.das.v1.query.PathKey;
import com.rawlabs.protocol.das.v1.query.Qual;
import com.rawlabs.protocol.das.v1.query.SortKey;
@@ -72,7 +72,7 @@ public Row insert(Row row) {
addToRow("self", rowBuilder, projectIdentifiers.getSelf(), List.of());
return rowBuilder.build();
} catch (ApiException e) {
- throw new RuntimeException(e);
+ throw makeSdkException(e);
}
}
@@ -80,7 +80,7 @@ public void delete(Value rowId) {
try {
projectsApi.deleteProject((String) extractValueFactory.extractValue(rowId), true);
} catch (ApiException e) {
- throw new DASSdkException(e.getMessage());
+ throw makeSdkException(e);
}
}
@@ -104,7 +104,7 @@ public Row update(Value rowId, Row newValues) {
(String) extractValueFactory.extractValue(rowId), updateProjectDetails, expand);
return toRow(result, List.of());
} catch (ApiException e) {
- throw new DASSdkException(e.getMessage());
+ throw makeSdkException(e);
}
}
@@ -149,7 +149,7 @@ public DASJiraPage fetchPage(long offset) {
null);
return new DASJiraPage<>(searchResult.getValues(), searchResult.getTotal());
} catch (ApiException e) {
- throw new DASSdkException(e.getMessage(), e);
+ throw makeSdkException(e);
}
}
};
@@ -191,7 +191,7 @@ private Row toRow(Project project, List columns) {
try {
return objectMapper.writeValueAsString(p);
} catch (JsonProcessingException e) {
- throw new DASSdkException(e.getMessage(), e);
+ throw new DASJiraUnexpectedError(e);
}
})
.orElse(null);
diff --git a/das-jira-connector/src/main/java/com/rawlabs/das/jira/tables/definitions/DASJiraSprintTable.java b/das-jira-connector/src/main/java/com/rawlabs/das/jira/tables/definitions/DASJiraSprintTable.java
index 7918174..1dbea1e 100644
--- a/das-jira-connector/src/main/java/com/rawlabs/das/jira/tables/definitions/DASJiraSprintTable.java
+++ b/das-jira-connector/src/main/java/com/rawlabs/das/jira/tables/definitions/DASJiraSprintTable.java
@@ -14,7 +14,6 @@
import com.rawlabs.das.jira.tables.results.DASJiraPaginatedResult;
import com.rawlabs.das.jira.tables.results.DASJiraWithParentTableResult;
import com.rawlabs.das.sdk.DASExecuteResult;
-import com.rawlabs.das.sdk.DASSdkException;
import com.rawlabs.protocol.das.v1.query.Qual;
import com.rawlabs.protocol.das.v1.query.SortKey;
import com.rawlabs.protocol.das.v1.tables.ColumnDefinition;
@@ -60,7 +59,7 @@ public Row insert(Row row) {
Sprint sprint = sprintApi.createSprint(createSprintRequest);
return toRow(sprint, sprint.getOriginBoardId(), List.of());
} catch (ApiException e) {
- throw new DASSdkException(e.getMessage());
+ throw makeSdkException(e);
}
}
@@ -81,7 +80,7 @@ public Row update(Value rowId, Row newValues) {
(Long) extractValueFactory.extractValue(rowId), updateSprintRequest);
return toRow(sprint, sprint.getOriginBoardId(), List.of());
} catch (ApiException e) {
- throw new DASSdkException(e.getMessage());
+ throw makeSdkException(e);
}
}
@@ -90,7 +89,7 @@ public void delete(Value rowId) {
try {
sprintApi.deleteSprint((Long) extractValueFactory.extractValue(rowId));
} catch (ApiException e) {
- throw new DASSdkException(e.getMessage());
+ throw makeSdkException(e);
}
}
@@ -115,7 +114,7 @@ public DASJiraPage fetchPage(long offset) {
boardApi.getAllSprints(boardId, offset, withMaxResultOrLimit(limit), null);
return new DASJiraPage<>(result.getValues(), result.getTotal());
} catch (ApiException e) {
- throw new DASSdkException(e.getResponseBody());
+ throw makeSdkException(e);
}
}
};
diff --git a/das-jira-connector/src/main/java/com/rawlabs/das/jira/tables/definitions/DASJiraUserTable.java b/das-jira-connector/src/main/java/com/rawlabs/das/jira/tables/definitions/DASJiraUserTable.java
index f91a590..e97b46c 100644
--- a/das-jira-connector/src/main/java/com/rawlabs/das/jira/tables/definitions/DASJiraUserTable.java
+++ b/das-jira-connector/src/main/java/com/rawlabs/das/jira/tables/definitions/DASJiraUserTable.java
@@ -54,7 +54,7 @@ public Row insert(Row row) {
User user = usersApi.createUser(newUserDetails);
return toRow(user, List.of());
} catch (ApiException e) {
- throw new RuntimeException(e);
+ throw makeSdkException(e);
}
}
@@ -63,7 +63,7 @@ public void delete(Value rowId) {
try {
usersApi.removeUser(extractValueFactory.extractValue(rowId).toString(), null, null);
} catch (ApiException e) {
- throw new RuntimeException(e);
+ throw makeSdkException(e);
}
}
@@ -74,7 +74,7 @@ public DASExecuteResult execute(
List users = usersApi.getAllUsers(0, withMaxResultOrLimit(limit));
return fromRowIterator(users.stream().map(u -> toRow(u, columns)).iterator());
} catch (ApiException e) {
- throw new RuntimeException(e);
+ throw makeSdkException(e);
}
}
diff --git a/das-jira-connector/src/main/java/com/rawlabs/das/jira/tables/definitions/DASJiraWorkflowTable.java b/das-jira-connector/src/main/java/com/rawlabs/das/jira/tables/definitions/DASJiraWorkflowTable.java
index 65e30d4..4ebc22e 100644
--- a/das-jira-connector/src/main/java/com/rawlabs/das/jira/tables/definitions/DASJiraWorkflowTable.java
+++ b/das-jira-connector/src/main/java/com/rawlabs/das/jira/tables/definitions/DASJiraWorkflowTable.java
@@ -5,6 +5,7 @@
import static com.rawlabs.das.jira.utils.factory.type.TypeFactory.*;
import com.fasterxml.jackson.core.JsonProcessingException;
+import com.rawlabs.das.jira.DASJiraUnexpectedError;
import com.rawlabs.das.jira.rest.platform.ApiException;
import com.rawlabs.das.jira.rest.platform.api.WorkflowsApi;
import com.rawlabs.das.jira.rest.platform.model.PageBeanWorkflow;
@@ -13,7 +14,6 @@
import com.rawlabs.das.jira.tables.results.DASJiraPage;
import com.rawlabs.das.jira.tables.results.DASJiraPaginatedResult;
import com.rawlabs.das.sdk.DASExecuteResult;
-import com.rawlabs.das.sdk.DASSdkException;
import com.rawlabs.protocol.das.v1.query.Qual;
import com.rawlabs.protocol.das.v1.query.SortKey;
import com.rawlabs.protocol.das.v1.tables.ColumnDefinition;
@@ -50,7 +50,7 @@ public void delete(Value rowId) {
try {
workflowsApi.deleteInactiveWorkflow(rowId.toString());
} catch (ApiException e) {
- throw new RuntimeException(e);
+ throw makeSdkException(e);
}
}
@@ -79,7 +79,7 @@ public DASJiraPage fetchPage(long offset) {
null);
return new DASJiraPage<>(result.getValues(), result.getTotal());
} catch (ApiException e) {
- throw new RuntimeException(e);
+ throw makeSdkException(e);
}
}
};
@@ -103,7 +103,7 @@ private Row toRow(Workflow workflow, List columns) {
addToRow(
"statuses", rowBuilder, objectMapper.writeValueAsString(workflow.getStatuses()), columns);
} catch (JsonProcessingException e) {
- throw new DASSdkException(e.getMessage());
+ throw new DASJiraUnexpectedError(e);
}
addToRow("title", rowBuilder, workflow.getId().getName(), columns);
return rowBuilder.build();
diff --git a/das-jira-connector/src/main/java/com/rawlabs/das/jira/tables/results/DASJiraPaginatedResult.java b/das-jira-connector/src/main/java/com/rawlabs/das/jira/tables/results/DASJiraPaginatedResult.java
index f6e4253..19da9d1 100644
--- a/das-jira-connector/src/main/java/com/rawlabs/das/jira/tables/results/DASJiraPaginatedResult.java
+++ b/das-jira-connector/src/main/java/com/rawlabs/das/jira/tables/results/DASJiraPaginatedResult.java
@@ -1,6 +1,7 @@
package com.rawlabs.das.jira.tables.results;
import com.rawlabs.das.sdk.DASExecuteResult;
+import java.util.Collections;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;
@@ -9,44 +10,71 @@
public abstract class DASJiraPaginatedResult implements DASExecuteResult {
/**
- * These are the names returned by "expand" query params. They are a map from the field to its
- * name. The inverse of it allows to get the field name from the name. (E.g. "assignee" ->
- * "fields.customfield_10000") It is a multimap because the same name can be used for different
- * fields. We use always the first one.
+ * A map holding the inverse of the "expand" query parameters. (e.g. maps "assignee" to
+ * "fields.customfield_10000", taking the first mapping if multiple exist)
*/
private Map names;
- protected Iterator currentPage = null;
-
+ protected Iterator currentPage;
protected long currentCount = 0;
protected Long totalCount;
protected final Long limit;
+ /**
+ * In the constructor we immediately fetch the first page. This way, if there’s a problem (e.g.
+ * wrong parameters or permissions) an exception is thrown right away.
+ *
+ * @param limit an optional upper bound on the number of items to fetch
+ */
public DASJiraPaginatedResult(@Nullable Long limit) {
this.limit = limit;
+ DASJiraPage firstPage = fetchPage(0);
+ if (isResultEmpty(firstPage)) {
+ currentPage = Collections.emptyIterator();
+ } else {
+ currentCount = firstPage.result().size();
+ totalCount = firstPage.total();
+ currentPage = firstPage.result().iterator();
+ if (firstPage.names() != null && names == null) {
+ names = new HashMap<>();
+ firstPage
+ .names()
+ .forEach(
+ (k, v) -> {
+ if (!names.containsKey(v)) {
+ names.put(v, k);
+ }
+ });
+ }
+ }
}
- public T getNext() {
- if (hasNext()) {
- return currentPage.next();
- } else throw new IllegalStateException("No more elements");
- }
-
+ /**
+ * Fetches a page starting at the given offset. Implementations must provide the logic for
+ * fetching a single page and throw a SDK exception.
+ */
public abstract DASJiraPage fetchPage(long offset);
+ /**
+ * Iterates lazily over the pages. If the current page is exhausted and the limit or total count
+ * hasn't been reached, this method will fetch the next page.
+ */
@Override
public boolean hasNext() {
- while (isPageExhausted()) {
+ while (!currentPage.hasNext()) {
if (totalReached() || limitReached()) {
return false;
}
- DASJiraPage result = fetchPage(currentCount);
- if (isResultEmpty(result)) {
+ DASJiraPage nextPage = fetchPage(currentCount);
+ if (isResultEmpty(nextPage)) {
return false;
}
- if (names == null && result.names() != null) {
+ currentCount += nextPage.result().size();
+ totalCount = nextPage.total();
+ currentPage = nextPage.result().iterator();
+ if (nextPage.names() != null && names == null) {
names = new HashMap<>();
- result
+ nextPage
.names()
.forEach(
(k, v) -> {
@@ -55,19 +83,19 @@ public boolean hasNext() {
}
});
}
- currentCount += result.result().size();
- totalCount = result.total();
- currentPage = result.result().iterator();
}
return true;
}
- protected boolean isResultEmpty(DASJiraPage result) {
- return result.result().isEmpty();
+ public T getNext() {
+ if (hasNext()) {
+ return currentPage.next();
+ }
+ throw new IllegalStateException("No more elements");
}
- protected boolean isPageExhausted() {
- return (currentPage == null || !currentPage.hasNext());
+ protected boolean isResultEmpty(DASJiraPage result) {
+ return result.result().isEmpty();
}
protected boolean totalReached() {
@@ -75,10 +103,7 @@ protected boolean totalReached() {
}
protected boolean limitReached() {
- if (limit == null) {
- return false;
- }
- return currentCount >= limit;
+ return limit != null && currentCount >= limit;
}
public Map names() {
@@ -86,5 +111,7 @@ public Map names() {
}
@Override
- public void close() {}
+ public void close() {
+ // Implement any cleanup if needed
+ }
}
diff --git a/das-jira-connector/src/main/java/com/rawlabs/das/jira/tables/results/DASJiraWithParentTableResult.java b/das-jira-connector/src/main/java/com/rawlabs/das/jira/tables/results/DASJiraWithParentTableResult.java
index 04db969..8c7d192 100644
--- a/das-jira-connector/src/main/java/com/rawlabs/das/jira/tables/results/DASJiraWithParentTableResult.java
+++ b/das-jira-connector/src/main/java/com/rawlabs/das/jira/tables/results/DASJiraWithParentTableResult.java
@@ -1,8 +1,9 @@
package com.rawlabs.das.jira.tables.results;
import com.rawlabs.das.sdk.DASExecuteResult;
-import com.rawlabs.das.sdk.DASSdkException;
+import com.rawlabs.das.sdk.DASSdkInvalidArgumentException;
import com.rawlabs.das.sdk.DASTable;
+import com.rawlabs.das.jira.DASJiraUnexpectedError;
import com.rawlabs.protocol.das.v1.query.Qual;
import com.rawlabs.protocol.das.v1.query.SortKey;
import com.rawlabs.protocol.das.v1.tables.Row;
@@ -26,7 +27,7 @@ public DASJiraWithParentTableResult(
try (DASExecuteResult parentResult = parentTable.execute(quals, columns, sortKeys, null)) {
this.parentResult = parentResult;
} catch (IOException e) {
- throw new DASSdkException("Failed to execute parent table", e);
+ throw new DASJiraUnexpectedError(e);
}
}
@@ -50,7 +51,7 @@ public boolean hasNext() {
if (childResult.hasNext()) {
return true;
}
- } catch (DASSdkException _) {
+ } catch (DASSdkInvalidArgumentException _) {
}
}
return false;
diff --git a/das-jira-connector/src/test/java/com/rawlabs/das/jira/initializer/DASJiraInitializerTest.java b/das-jira-connector/src/test/java/com/rawlabs/das/jira/initializer/DASJiraInitializerTest.java
index 865cec4..e120f5a 100644
--- a/das-jira-connector/src/test/java/com/rawlabs/das/jira/initializer/DASJiraInitializerTest.java
+++ b/das-jira-connector/src/test/java/com/rawlabs/das/jira/initializer/DASJiraInitializerTest.java
@@ -10,6 +10,8 @@
import com.rawlabs.das.jira.rest.platform.auth.OAuth;
import java.util.Map;
import java.util.Objects;
+
+import com.rawlabs.das.sdk.DASSdkInvalidArgumentException;
import okhttp3.Request;
import org.junit.jupiter.api.DisplayName;
import org.junit.jupiter.api.Test;
@@ -21,7 +23,7 @@ public class DASJiraInitializerTest {
@DisplayName("Initialization fails when auth not provided")
public void testJiraInitializer() {
assertThrows(
- IllegalArgumentException.class,
+ DASSdkInvalidArgumentException.class,
() -> DASJiraInitializer.initializeSoftware(Map.of("base_url", "http://localhost:8080")));
}
diff --git a/das-jira-connector/src/test/java/com/rawlabs/das/jira/tables/defnitions/DASJiraAdvancedSettingsTableTest.java b/das-jira-connector/src/test/java/com/rawlabs/das/jira/tables/defnitions/DASJiraAdvancedSettingsTableTest.java
index e025c99..bb06cce 100644
--- a/das-jira-connector/src/test/java/com/rawlabs/das/jira/tables/defnitions/DASJiraAdvancedSettingsTableTest.java
+++ b/das-jira-connector/src/test/java/com/rawlabs/das/jira/tables/defnitions/DASJiraAdvancedSettingsTableTest.java
@@ -11,7 +11,7 @@
import com.rawlabs.das.jira.rest.platform.model.ApplicationProperty;
import com.rawlabs.das.jira.tables.definitions.DASJiraAdvancedSettingsTable;
import com.rawlabs.das.sdk.DASExecuteResult;
-import com.rawlabs.das.sdk.DASSdkException;
+import com.rawlabs.das.sdk.DASSdkInvalidArgumentException;
import com.rawlabs.das.jira.utils.factory.value.DefaultValueFactory;
import com.rawlabs.das.jira.utils.factory.value.ValueFactory;
import com.rawlabs.das.jira.utils.factory.value.ValueTypeTuple;
@@ -152,7 +152,7 @@ public void testGetAllAdvancedSettingsWithLimit() {
public void testGetAllAdvancedSettingsWithWithError() {
ValueFactory valueFactory = new DefaultValueFactory();
assertThrows(
- DASSdkException.class,
+ DASSdkInvalidArgumentException.class,
() -> {
try (DASExecuteResult result =
dasJiraAdvancedSettingsTable.execute(
diff --git a/das-jira-connector/src/test/java/com/rawlabs/das/jira/tables/defnitions/DASJiraBoardTableTest.java b/das-jira-connector/src/test/java/com/rawlabs/das/jira/tables/defnitions/DASJiraBoardTableTest.java
index d4363cb..54b09d4 100644
--- a/das-jira-connector/src/test/java/com/rawlabs/das/jira/tables/defnitions/DASJiraBoardTableTest.java
+++ b/das-jira-connector/src/test/java/com/rawlabs/das/jira/tables/defnitions/DASJiraBoardTableTest.java
@@ -14,7 +14,7 @@
import com.rawlabs.das.jira.rest.software.model.GetConfiguration200Response;
import com.rawlabs.das.jira.tables.definitions.DASJiraBoardTable;
import com.rawlabs.das.sdk.DASExecuteResult;
-import com.rawlabs.das.sdk.DASSdkException;
+import com.rawlabs.das.sdk.DASSdkInvalidArgumentException;
import com.rawlabs.das.jira.utils.factory.value.DefaultValueFactory;
import com.rawlabs.das.jira.utils.factory.value.ValueFactory;
import com.rawlabs.das.jira.utils.factory.value.ValueTypeTuple;
@@ -125,7 +125,7 @@ void testGetBoards() {
@DisplayName("Get with error")
void testGetWithError() {
assertThrows(
- DASSdkException.class,
+ DASSdkInvalidArgumentException.class,
() -> {
try (DASExecuteResult result =
dasJiraBoardTable.execute(