From 4ea505510f6a33379cef9b23c1dab9827b30f619 Mon Sep 17 00:00:00 2001 From: Umberto Furno Date: Tue, 12 Nov 2019 00:37:18 +0100 Subject: [PATCH 1/9] Interface card service --- .idea/compiler.xml | 9 +++++++++ wrapper/src/main/java/wekan/wrapper/api/CardService.java | 4 ++++ wrapper/src/main/java/wekan/wrapper/entity/Card.java | 4 ++++ .../src/test/java/wekan/wrapper/api/CardServiceTest.java | 4 ++++ 4 files changed, 21 insertions(+) create mode 100644 .idea/compiler.xml create mode 100644 wrapper/src/main/java/wekan/wrapper/api/CardService.java create mode 100644 wrapper/src/main/java/wekan/wrapper/entity/Card.java create mode 100644 wrapper/src/test/java/wekan/wrapper/api/CardServiceTest.java diff --git a/.idea/compiler.xml b/.idea/compiler.xml new file mode 100644 index 0000000..d25b9f1 --- /dev/null +++ b/.idea/compiler.xml @@ -0,0 +1,9 @@ + + + + + + + + + \ No newline at end of file diff --git a/wrapper/src/main/java/wekan/wrapper/api/CardService.java b/wrapper/src/main/java/wekan/wrapper/api/CardService.java new file mode 100644 index 0000000..f70e9e0 --- /dev/null +++ b/wrapper/src/main/java/wekan/wrapper/api/CardService.java @@ -0,0 +1,4 @@ +package wekan.wrapper.api; + +public interface CardService { +} diff --git a/wrapper/src/main/java/wekan/wrapper/entity/Card.java b/wrapper/src/main/java/wekan/wrapper/entity/Card.java new file mode 100644 index 0000000..d1b3ea6 --- /dev/null +++ b/wrapper/src/main/java/wekan/wrapper/entity/Card.java @@ -0,0 +1,4 @@ +package wekan.wrapper.entity; + +public class Card { +} diff --git a/wrapper/src/test/java/wekan/wrapper/api/CardServiceTest.java b/wrapper/src/test/java/wekan/wrapper/api/CardServiceTest.java new file mode 100644 index 0000000..bb69155 --- /dev/null +++ b/wrapper/src/test/java/wekan/wrapper/api/CardServiceTest.java @@ -0,0 +1,4 @@ +package wekan.wrapper.api; + +public class CardServiceTest { +} From 3186d43791d05e2c780a9d9fedf565036cc50aa9 Mon Sep 17 00:00:00 2001 From: Umberto Furno Date: Tue, 12 Nov 2019 00:42:57 +0100 Subject: [PATCH 2/9] Interface card service --- .../java/wekan/wrapper/api/CardService.java | 70 +++++++++++++++++++ 1 file changed, 70 insertions(+) diff --git a/wrapper/src/main/java/wekan/wrapper/api/CardService.java b/wrapper/src/main/java/wekan/wrapper/api/CardService.java index f70e9e0..8786152 100644 --- a/wrapper/src/main/java/wekan/wrapper/api/CardService.java +++ b/wrapper/src/main/java/wekan/wrapper/api/CardService.java @@ -1,4 +1,74 @@ package wekan.wrapper.api; +import retrofit2.Call; +import retrofit2.http.*; +import wekan.wrapper.entity.Card; + +import java.util.List; + public interface CardService { + + /** + * Get all cards belonging to a list + * + * @param boardID The board ID of cards + * @param lidtID The list ID of cards + * @return list of cards in the list + */ + @GET("/api/boards/{board}/lists/{list}/cards") + Call> getAllCards(@Path("board") String boardID, @Path("list") String lidtID); + + /** + * Delete a card + * + * @param boardID The board ID of card + * @param listID The list ID of card + * @param cardID The card ID + * @return void + */ + @DELETE("/api/boards/{board}/lists/{list}/cards/{card}") + Call deleteCard(@Path("board") String boardID, @Path("list") String listID, @Path("card") String cardID); + + /** + * + * @param card new Card + * @param boardID The ID of the board destination + * @param listID The ID of the list destination + * @return the card with matching ID + */ + @POST("/api/boards/{board}/lists/{list}/cards") + Call newCard(@Body Card card, @Path("board") String boardID, @Path("list") String listID); + + /** + * Get information card + * @param boardID the ID of the board + * @param listID the ID of the list + * @param cardID the ID of the card + * @return card body + */ + @GET("/api/boards/{board}/lists/{list}/cards/{card}") + Call getCard(@Path("board") String boardID, @Path("list") String listID, @Path("card") String cardID); + + /** + * Get list of cards by swinlaneID + * @param boardID the ID of the board + * @param swimlaneID the ID of the swimlane + * @return list of swimlane cards + */ + @GET("/api/boards/{board}/swimlanes/{swimlane}/cards") + Call> getCardsForswimlane(@Path("board") String boardID, @Path("swimlane") String swimlaneID); + + /** + * Update a card + * + * @param card params to update + * @param boardID the id of the board + * @param listID the id of the list + * @param cardID the id of the card to modify + * @return The card with the matching ID + */ + @Headers("Content-Type: application/merge-patch+json") + @PUT("/api/boards/{board}/lists/{list}/cards/{card}") + Call putCard(@Body Card card, @Path("board") String boardID, @Path("list") String listID, + @Path("card") String cardID); } From 63297f3817eebdf7276c5dbce2f742e4265791d9 Mon Sep 17 00:00:00 2001 From: Umberto Furno Date: Tue, 12 Nov 2019 00:55:42 +0100 Subject: [PATCH 3/9] Implementation card object --- .../main/java/wekan/wrapper/entity/Card.java | 326 ++++++++++++++++++ 1 file changed, 326 insertions(+) diff --git a/wrapper/src/main/java/wekan/wrapper/entity/Card.java b/wrapper/src/main/java/wekan/wrapper/entity/Card.java index d1b3ea6..8c64fb5 100644 --- a/wrapper/src/main/java/wekan/wrapper/entity/Card.java +++ b/wrapper/src/main/java/wekan/wrapper/entity/Card.java @@ -1,4 +1,330 @@ package wekan.wrapper.entity; +import com.google.gson.annotations.SerializedName; + +import java.util.ArrayList; +import java.util.Date; +import java.util.List; + public class Card { + + public Card(String authorId, String title, String swimlaneId, String description) { + this.authorId= authorId; + this.title = title; + this.swimlaneId = swimlaneId; + this.description = description; + } + + public Card() { + + } + + public String getId() { + return id; + } + + public void setId(String id) { + this.id = id; + } + + public String getTitle() { + return title; + } + + public void setTitle(String title) { + this.title = title; + } + + public Boolean getArchived() { + return archived; + } + + public void setArchived(Boolean archived) { + this.archived = archived; + } + + public String getParentId() { + return parentId; + } + + public void setParentId(String parentId) { + this.parentId = parentId; + } + + public String getListId() { + return listId; + } + + public void setListId(String listId) { + this.listId = listId; + } + + public String getSwimlaneId() { + return swimlaneId; + } + + public void setSwimlaneId(String swimlaneId) { + this.swimlaneId = swimlaneId; + } + + public String getBoardId() { + return boardId; + } + + public void setBoardId(String boardId) { + this.boardId = boardId; + } + + public String getCoverId() { + return coverId; + } + + public void setCoverId(String coverId) { + this.coverId = coverId; + } + + public String getColor() { + return color; + } + + public void setColor(String color) { + this.color = color; + } + + public Date getCreatedAt() { + return createdAt; + } + + public void setCreatedAt(Date createdAt) { + this.createdAt = createdAt; + } + + public Date getModifiedAt() { + return modifiedAt; + } + + public void setModifiedAt(Date modifiedAt) { + this.modifiedAt = modifiedAt; + } + + public List getCustomFields() { + return customFields; + } + + public void setCustomFields(List customFields) { + this.customFields = customFields; + } + + public Date getDateLastActivity() { + return dateLastActivity; + } + + public void setDateLastActivity(Date dateLastActivity) { + this.dateLastActivity = dateLastActivity; + } + + public String getDescription() { + return description; + } + + public void setDescription(String description) { + this.description = description; + } + + public String getRequestedBy() { + return requestedBy; + } + + public void setRequestedBy(String requestedBy) { + this.requestedBy = requestedBy; + } + + public String getAssignedBy() { + return assignedBy; + } + + public void setAssignedBy(String assignedBy) { + this.assignedBy = assignedBy; + } + + public List getLabelIds() { + return labelIds; + } + + public void setLabelIds(List labelIds) { + this.labelIds = labelIds; + } + + public List getMembers() { + return members; + } + + public void setMembers(List members) { + this.members = members; + } + + public List getAssignees() { + return assignees; + } + + public void setAssignees(List assignees) { + this.assignees = assignees; + } + + public Date getReceivedAt() { + return receivedAt; + } + + public void setReceivedAt(Date receivedAt) { + this.receivedAt = receivedAt; + } + + public Date getStartAt() { + return startAt; + } + + public void setStartAt(Date startAt) { + this.startAt = startAt; + } + + public Date getDueAt() { + return dueAt; + } + + public void setDueAt(Date dueAt) { + this.dueAt = dueAt; + } + + public Date getEndAt() { + return endAt; + } + + public void setEndAt(Date endAt) { + this.endAt = endAt; + } + + public int getSpentTime() { + return spentTime; + } + + public void setSpentTime(int spentTime) { + this.spentTime = spentTime; + } + + public Boolean getOvertime() { + return isOvertime; + } + + public void setOvertime(Boolean overtime) { + isOvertime = overtime; + } + + public String getUserId() { + return userId; + } + + public void setUserId(String userId) { + this.userId = userId; + } + + public int getSort() { + return sort; + } + + public void setSort(int sort) { + this.sort = sort; + } + + public int getSubtaskSort() { + return subtaskSort; + } + + public void setSubtaskSort(int subtaskSort) { + this.subtaskSort = subtaskSort; + } + + public String getType() { + return type; + } + + public void setType(String type) { + this.type = type; + } + + public String getLinkedId() { + return linkedId; + } + + public void setLinkedId(String linkedId) { + this.linkedId = linkedId; + } + + @Override + public String toString() { + return "Card{" + + "id='" + id + '\'' + + ", title='" + title + '\'' + + ", archived=" + archived + + ", parentId='" + parentId + '\'' + + ", listId='" + listId + '\'' + + ", swimlaneId='" + swimlaneId + '\'' + + ", boardId='" + boardId + '\'' + + ", coverId='" + coverId + '\'' + + ", color='" + color + '\'' + + ", createdAt=" + createdAt + + ", modifiedAt=" + modifiedAt + + ", customFields=" + customFields + + ", dateLastActivity=" + dateLastActivity + + ", description='" + description + '\'' + + ", requestedBy='" + requestedBy + '\'' + + ", assignedBy='" + assignedBy + '\'' + + ", labelIds=" + labelIds + + ", members=" + members + + ", assignees=" + assignees + + ", receivedAt='" + receivedAt + '\'' + + ", startAt='" + startAt + '\'' + + ", dueAt='" + dueAt + '\'' + + ", endAt='" + endAt + '\'' + + ", spentTime=" + spentTime + + ", isOvertime=" + isOvertime + + ", userId='" + userId + '\'' + + ", sort=" + sort + + ", subtaskSort=" + subtaskSort + + ", type='" + type + '\'' + + ", linkedId='" + linkedId + '\'' + + '}'; + } + + @SerializedName("_id") + private String id; + private String title; + private Boolean archived; + private String parentId; + private String listId; + private String swimlaneId; + private String boardId; + private String coverId; + private String color; + private Date createdAt; + private Date modifiedAt; + private List customFields; + private Date dateLastActivity; + private String description; + private String requestedBy; + private String assignedBy; + private List labelIds; + private List members; + private List assignees; + private Date receivedAt; + private Date startAt; + private Date dueAt; + private Date endAt; + private int spentTime; + private Boolean isOvertime; + private String userId; + private int sort; + private int subtaskSort; + private String type; + private String linkedId; + private String authorId; } From f990979d93080686e351be0cf710097a335f8b01 Mon Sep 17 00:00:00 2001 From: Umberto Furno Date: Tue, 12 Nov 2019 01:01:31 +0100 Subject: [PATCH 4/9] Test card service --- .../wekan/wrapper/api/CardServiceTest.java | 192 ++++++++++++++++++ 1 file changed, 192 insertions(+) diff --git a/wrapper/src/test/java/wekan/wrapper/api/CardServiceTest.java b/wrapper/src/test/java/wekan/wrapper/api/CardServiceTest.java index bb69155..04ead54 100644 --- a/wrapper/src/test/java/wekan/wrapper/api/CardServiceTest.java +++ b/wrapper/src/test/java/wekan/wrapper/api/CardServiceTest.java @@ -1,4 +1,196 @@ package wekan.wrapper.api; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import retrofit2.Retrofit; +import retrofit2.converter.gson.GsonConverterFactory; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import wekan.wrapper.entity.Card; + +import java.io.IOException; +import java.net.HttpURLConnection; +import java.util.List; + +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + public class CardServiceTest { + private MockWebServer mockWebServer = new MockWebServer(); + private CardService service = null; + + @Before + public void setUp() { + try { + mockWebServer.start(); + service = new Retrofit.Builder() + .baseUrl(mockWebServer.url("")) + .addConverterFactory(GsonConverterFactory.create()) + .build() + .create(CardService.class); + } catch (IOException e) { + e.printStackTrace(); + } + + } + + @After + public void teardown() { + try { + mockWebServer.shutdown(); + } catch (IOException e) { + e.printStackTrace(); + } + } + + @Test + public void getAllCardsTest(){ + MockResponse response = new MockResponse() + .setResponseCode(HttpURLConnection.HTTP_OK) + .setBody( + "[{\"_id\":\"J5a86fPe2DhqN3QbF0\",\"title\":\"card 0\",\"description\":\"proof 0\"}," + + "{\"_id\":\"J5a86fPe2DhqN3QbF1\",\"title\":\"card 1\",\"description\":\"proof 1\"}]" + ); + + mockWebServer.enqueue(response); + + try { + List cards = service.getAllCards("oKthRbLqoXZr5NNua","iA6pmp6fENvF7AaTX"). + execute().body(); + + assertNotNull(cards); + assertEquals("Numbero of card not ok",2, cards.size()); + + for (int i = 0; i < cards.size(); i++) { + assertEquals("J5a86fPe2DhqN3QbF" + i, cards.get(i).getId()); + assertEquals("card " + i, cards.get(i).getTitle()); + assertEquals("proof " + i, cards.get(i).getDescription()); + } + + + } catch (IOException e) { + e.printStackTrace(); + } + } + + @Test + public void getCardTest(){ + MockResponse response = new MockResponse() + .setResponseCode(HttpURLConnection.HTTP_OK) + .setBody(card); + try { + Card card = service.getCard( + "oKthRbLqoXZr5NNua","iA6pmp6fENvF7AaTX","J5a86fPe2DhqN3QbF") + .execute().body(); + assertNotNull(card); + assertEquals("J5a86fPe2DhqN3QbF", card.getId() ); + assertEquals("patch", card.getTitle()); + assertEquals("iA6pmp6fENvF7AaTX", card.getListId()); + assertEquals("2019-11-10T11:21:31.116Z", card.getCreatedAt().toString()); + + }catch (IOException e){ + e.printStackTrace(); + } + mockWebServer.enqueue(response); + + } + + @Test + public void newCardTest(){ + MockResponse response = new MockResponse() + .setResponseCode(HttpURLConnection.HTTP_OK) + .setBody( + "{\"_id\":\"FGgYsTzrwLJM8QT6W\"}" + ); + + mockWebServer.enqueue(response); + + try { + Card card = service.newCard( + cardToAdd, + "oKthRbLqoXZr5NNua","iA6pmp6fENvF7AaTX") + .execute().body(); + + assertNotNull(card); + assertEquals("FGgYsTzrwLJM8QT6W", card.getId()); + + } catch (IOException e) { + e.printStackTrace(); + } + } + + @Test + public void getCardsForSwimlaneTest() throws IOException { + MockResponse response = new MockResponse() + .setResponseCode(HttpURLConnection.HTTP_OK) + .setBody("[{\"_id\":\"J5a86fPe2DhqN3QbF0\",\"title\":\"card 0\",\"description\":\"proof\",\"listId\":\"iA6pmp6fENvF7AaTX0\"}," + + "{\"_id\":\"J5a86fPe2DhqN3QbF1\",\"title\":\"card 1\",\"description\":\"proof\",\"listId\":\"iA6pmp6fENvF7AaTX1\"}," + + "{\"_id\":\"J5a86fPe2DhqN3QbF2\",\"title\":\"card 2\",\"description\":\"proof\",\"listId\":\"iA6pmp6fENvF7AaTX2\"}]"); + + mockWebServer.enqueue(response); + List cards = service.getCardsForswimlane( + "oKthRbLqoXZr5NNua","ScwkAWCRW23duajxJ") + .execute().body(); + assertNotNull(cards); + assertEquals(3, cards.size()); + for(int i = 0; i < cards.size(); i++){ + assertEquals("J5a86fPe2DhqN3QbF" + i, cards.get(i).getId()); + assertEquals("card " + i, cards.get(i).getTitle()); + assertEquals("iA6pmp6fENvF7AaTX" + i, cards.get(i).getListId()); + assertEquals("proof", cards.get(i).getDescription()); + } + + + } + + @Test + public void updateCardTest() throws Exception { + MockResponse response = new MockResponse() + .setResponseCode(HttpURLConnection.HTTP_OK) + .setBody("{\"_id\":\"sig8KLcMcPTGx5GfF\"}"); + + mockWebServer.enqueue(response); + Card update = new Card(); + update.setTitle("newTitle"); + + Card card = service.putCard(update, "","","") + .execute().body(); + assertNotNull(card); + assertEquals("sig8KLcMcPTGx5GfF", card.getId()); + + } + + + private static final String card = + "{"+ + "\"_id\":\"J5a86fPe2DhqN3QbF\"," + + "\"title\":\"title1\","+ + "\"boardId\":\"oKthRbLqoXZr5NNua\"," + + "\"listId\":\"iA6pmp6fENvF7AaTX\"," + + "\"description\":\"proof\"," + + "\"userId\":\"jPdkf3a9bmfZWx3GR\"," + + "\"swimlaneId\":\"ScwkAWCRW23duajxJ\"," + + "\"sort\":\"1\"," + + "\"members\":\"[]\"," + + "\"archived\":\"false\"," + + "\"parentId\":\"\"," + + "\"coverId\":\"\"," + + "\"createdAt\":\"2019-11-10T11:21:31.116Z\"," + + "\"modifiedAt\":\"2019-11-10T21:49:58.023Z\"," + + "\"customFields\":\"[]\"," + + "\"dateLastActivity\":\"2019-11-10T21:49:58.024Z\"," + + "\"requestedBy\":\"\"," + + "\"assignedBy\":\"\"," + + "\"labelIds\":\"[]\"," + + "\"assignees\":\"[]\"," + + "\"spentTime\":\"0\"," + + "\"isOvertime\":\"false\"," + + "\"subtaskSort\":\"-1\"," + + "\"type\":\"cardType-card\"," + + "\"linkedId\":\"" + + "}"; + private static final Card cardToAdd = new Card( + "jPdkf3a9bmfZWx3GR","cardAdded","ScwkAWCRW23duajxJ", + "proof"); } From 8be32f94fd15bcaf2ca23e31a216b02ffe830b44 Mon Sep 17 00:00:00 2001 From: Umberto Furno Date: Tue, 12 Nov 2019 01:05:18 +0100 Subject: [PATCH 5/9] Class Card --- wrapper/src/main/java/wekan/wrapper/entity/Card.java | 4 +--- 1 file changed, 1 insertion(+), 3 deletions(-) diff --git a/wrapper/src/main/java/wekan/wrapper/entity/Card.java b/wrapper/src/main/java/wekan/wrapper/entity/Card.java index 8c64fb5..24b6918 100644 --- a/wrapper/src/main/java/wekan/wrapper/entity/Card.java +++ b/wrapper/src/main/java/wekan/wrapper/entity/Card.java @@ -1,13 +1,12 @@ package wekan.wrapper.entity; import com.google.gson.annotations.SerializedName; - -import java.util.ArrayList; import java.util.Date; import java.util.List; public class Card { + //Constructor for update card public Card(String authorId, String title, String swimlaneId, String description) { this.authorId= authorId; this.title = title; @@ -16,7 +15,6 @@ public class Card { } public Card() { - } public String getId() { From 56c212156cd79cb247083ff4ab2a0967d25b560b Mon Sep 17 00:00:00 2001 From: norangebit Date: Tue, 12 Nov 2019 11:09:43 +0100 Subject: [PATCH 6/9] rename LabelColor to Color - add Color.WHITE --- .../wekan/wrapper/entity/{LabelColor.java => Color.java} | 4 +++- wrapper/src/main/java/wekan/wrapper/entity/Label.java | 6 +++--- .../src/main/java/wekan/wrapper/entity/LabelPrototype.java | 2 +- 3 files changed, 7 insertions(+), 5 deletions(-) rename wrapper/src/main/java/wekan/wrapper/entity/{LabelColor.java => Color.java} (94%) diff --git a/wrapper/src/main/java/wekan/wrapper/entity/LabelColor.java b/wrapper/src/main/java/wekan/wrapper/entity/Color.java similarity index 94% rename from wrapper/src/main/java/wekan/wrapper/entity/LabelColor.java rename to wrapper/src/main/java/wekan/wrapper/entity/Color.java index a44be64..7841f36 100644 --- a/wrapper/src/main/java/wekan/wrapper/entity/LabelColor.java +++ b/wrapper/src/main/java/wekan/wrapper/entity/Color.java @@ -2,7 +2,9 @@ package wekan.wrapper.entity; import com.google.gson.annotations.SerializedName; -public enum LabelColor { +public enum Color { + @SerializedName("white") + WHITE, @SerializedName("green") GREEN, @SerializedName("yellow") diff --git a/wrapper/src/main/java/wekan/wrapper/entity/Label.java b/wrapper/src/main/java/wekan/wrapper/entity/Label.java index 57a1d52..000fb6b 100644 --- a/wrapper/src/main/java/wekan/wrapper/entity/Label.java +++ b/wrapper/src/main/java/wekan/wrapper/entity/Label.java @@ -6,9 +6,9 @@ public class Label { @SerializedName("_id") private String id; private String name; - private LabelColor color; + private Color color; - public Label(String id, String name, LabelColor color) { + public Label(String id, String name, Color color) { this.id = id; this.name = name; this.color = color; @@ -22,7 +22,7 @@ public class Label { return name; } - public LabelColor getColor() { + public Color getColor() { return color; } diff --git a/wrapper/src/main/java/wekan/wrapper/entity/LabelPrototype.java b/wrapper/src/main/java/wekan/wrapper/entity/LabelPrototype.java index 5f8beb5..221d342 100644 --- a/wrapper/src/main/java/wekan/wrapper/entity/LabelPrototype.java +++ b/wrapper/src/main/java/wekan/wrapper/entity/LabelPrototype.java @@ -10,7 +10,7 @@ public class LabelPrototype { * @param name The name of the new label * @param color The color of the new label */ - public LabelPrototype(String name, LabelColor color) { + public LabelPrototype(String name, Color color) { label = new Label(null, name, color); } } From 53d3459fc1e7cceac7f28b9fd9299584d87dde61 Mon Sep 17 00:00:00 2001 From: Umberto Furno Date: Tue, 12 Nov 2019 12:17:39 +0100 Subject: [PATCH 7/9] modufy params --- wrapper/src/main/java/wekan/wrapper/api/CardService.java | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/wrapper/src/main/java/wekan/wrapper/api/CardService.java b/wrapper/src/main/java/wekan/wrapper/api/CardService.java index 8786152..19f5e96 100644 --- a/wrapper/src/main/java/wekan/wrapper/api/CardService.java +++ b/wrapper/src/main/java/wekan/wrapper/api/CardService.java @@ -37,7 +37,7 @@ public interface CardService { * @return the card with matching ID */ @POST("/api/boards/{board}/lists/{list}/cards") - Call newCard(@Body Card card, @Path("board") String boardID, @Path("list") String listID); + Call newCard(@Path("board") String boardID, @Path("list") String listID, @Body Card card); /** * Get information card @@ -69,6 +69,6 @@ public interface CardService { */ @Headers("Content-Type: application/merge-patch+json") @PUT("/api/boards/{board}/lists/{list}/cards/{card}") - Call putCard(@Body Card card, @Path("board") String boardID, @Path("list") String listID, - @Path("card") String cardID); + Call putCard(@Path("board") String boardID, @Path("list") String listID, + @Path("card") String cardID, @Body Card card); } From 182b070b834c3c5a3380dd5ea63ea19732d355ab Mon Sep 17 00:00:00 2001 From: Umberto Furno Date: Tue, 12 Nov 2019 12:18:09 +0100 Subject: [PATCH 8/9] Add color class --- wrapper/src/main/java/wekan/wrapper/entity/Card.java | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/wrapper/src/main/java/wekan/wrapper/entity/Card.java b/wrapper/src/main/java/wekan/wrapper/entity/Card.java index 24b6918..14d7bde 100644 --- a/wrapper/src/main/java/wekan/wrapper/entity/Card.java +++ b/wrapper/src/main/java/wekan/wrapper/entity/Card.java @@ -6,7 +6,7 @@ import java.util.List; public class Card { - //Constructor for update card + //Constructor for add card public Card(String authorId, String title, String swimlaneId, String description) { this.authorId= authorId; this.title = title; @@ -81,11 +81,11 @@ public class Card { this.coverId = coverId; } - public String getColor() { + public Color getColor() { return color; } - public void setColor(String color) { + public void setColor(Color color) { this.color = color; } @@ -302,7 +302,7 @@ public class Card { private String swimlaneId; private String boardId; private String coverId; - private String color; + private Color color; private Date createdAt; private Date modifiedAt; private List customFields; From 4595d7bbe76f2f688015b47fe0c7cee5b3c23fbd Mon Sep 17 00:00:00 2001 From: Umberto Furno Date: Tue, 12 Nov 2019 12:22:40 +0100 Subject: [PATCH 9/9] Refact param --- .../test/java/wekan/wrapper/api/CardServiceTest.java | 10 +++------- 1 file changed, 3 insertions(+), 7 deletions(-) diff --git a/wrapper/src/test/java/wekan/wrapper/api/CardServiceTest.java b/wrapper/src/test/java/wekan/wrapper/api/CardServiceTest.java index 04ead54..be4bbe0 100644 --- a/wrapper/src/test/java/wekan/wrapper/api/CardServiceTest.java +++ b/wrapper/src/test/java/wekan/wrapper/api/CardServiceTest.java @@ -32,7 +32,6 @@ public class CardServiceTest { } catch (IOException e) { e.printStackTrace(); } - } @After @@ -108,8 +107,7 @@ public class CardServiceTest { try { Card card = service.newCard( - cardToAdd, - "oKthRbLqoXZr5NNua","iA6pmp6fENvF7AaTX") + "oKthRbLqoXZr5NNua","iA6pmp6fENvF7AaTX",cardToAdd) .execute().body(); assertNotNull(card); @@ -140,8 +138,6 @@ public class CardServiceTest { assertEquals("iA6pmp6fENvF7AaTX" + i, cards.get(i).getListId()); assertEquals("proof", cards.get(i).getDescription()); } - - } @Test @@ -154,14 +150,13 @@ public class CardServiceTest { Card update = new Card(); update.setTitle("newTitle"); - Card card = service.putCard(update, "","","") + Card card = service.putCard("","","",update) .execute().body(); assertNotNull(card); assertEquals("sig8KLcMcPTGx5GfF", card.getId()); } - private static final String card = "{"+ "\"_id\":\"J5a86fPe2DhqN3QbF\"," + @@ -190,6 +185,7 @@ public class CardServiceTest { "\"type\":\"cardType-card\"," + "\"linkedId\":\"" + "}"; + private static final Card cardToAdd = new Card( "jPdkf3a9bmfZWx3GR","cardAdded","ScwkAWCRW23duajxJ", "proof");