From e0d8f87dd64efc55f05e6dccd8743d8c031beffb Mon Sep 17 00:00:00 2001 From: norangebit Date: Sat, 18 Jan 2020 12:54:19 +0100 Subject: [PATCH 1/6] remove all formating warning --- .../ids/wedroid/app/view/LoginActivity.kt | 3 +- config/checkstyle/checkstyle.xml | 2 - .../ids/wedroid/wrapper/api/BoardService.java | 10 ++-- .../wrapper/api/CardCommentService.java | 10 ++-- .../ids/wedroid/wrapper/api/CardService.java | 13 ++++-- .../wedroid/wrapper/api/ChecklistService.java | 12 +++-- .../ids/wedroid/wrapper/api/ListService.java | 11 +++-- .../wedroid/wrapper/api/SwimlanesService.java | 10 ++-- .../ids/wedroid/wrapper/api/UserService.java | 14 ++++-- .../ding/ids/wedroid/wrapper/entity/Card.java | 2 +- .../wrapper/entity/MemberPermission.java | 8 ++-- .../wedroid/wrapper/api/BoardServiceTest.java | 18 ++++---- .../wrapper/api/CardCommentServiceTest.java | 19 ++++---- .../wedroid/wrapper/api/CardServiceTest.java | 46 +++++++++---------- .../wrapper/api/ChecklistServiceTest.java | 16 +++---- .../wedroid/wrapper/api/ListServiceTest.java | 12 ++--- .../wrapper/api/SwimlanesServiceTest.java | 17 +++---- .../wedroid/wrapper/api/UserServiceTest.java | 31 ++++++------- 18 files changed, 143 insertions(+), 111 deletions(-) diff --git a/app/src/main/java/it/unisannio/ding/ids/wedroid/app/view/LoginActivity.kt b/app/src/main/java/it/unisannio/ding/ids/wedroid/app/view/LoginActivity.kt index 556ad04..d7405ff 100644 --- a/app/src/main/java/it/unisannio/ding/ids/wedroid/app/view/LoginActivity.kt +++ b/app/src/main/java/it/unisannio/ding/ids/wedroid/app/view/LoginActivity.kt @@ -65,7 +65,7 @@ class LoginActivity : AppCompatActivity() { override fun onResponse(call: Call, response: Response) { - if (response.code() != 200) { + if (response.code() != HTTP_CODE_OK) { Toast.makeText( applicationContext, R.string.login_wrong_field, @@ -93,5 +93,6 @@ class LoginActivity : AppCompatActivity() { companion object { const val LOGIN_OK = 0 const val LOGIN_ERROR = 1 + const val HTTP_CODE_OK = 200 } } diff --git a/config/checkstyle/checkstyle.xml b/config/checkstyle/checkstyle.xml index ca6d646..54f31f4 100644 --- a/config/checkstyle/checkstyle.xml +++ b/config/checkstyle/checkstyle.xml @@ -54,7 +54,6 @@ - @@ -191,7 +190,6 @@ - diff --git a/wrapper/src/main/java/it/unisannio/ding/ids/wedroid/wrapper/api/BoardService.java b/wrapper/src/main/java/it/unisannio/ding/ids/wedroid/wrapper/api/BoardService.java index ed74ea9..bed0174 100644 --- a/wrapper/src/main/java/it/unisannio/ding/ids/wedroid/wrapper/api/BoardService.java +++ b/wrapper/src/main/java/it/unisannio/ding/ids/wedroid/wrapper/api/BoardService.java @@ -1,13 +1,17 @@ package it.unisannio.ding.ids.wedroid.wrapper.api; -import java.util.List; - import it.unisannio.ding.ids.wedroid.wrapper.entity.Board; import it.unisannio.ding.ids.wedroid.wrapper.entity.BoardPrototype; import it.unisannio.ding.ids.wedroid.wrapper.entity.LabelPrototype; import it.unisannio.ding.ids.wedroid.wrapper.entity.MemberPermission; +import java.util.List; import retrofit2.Call; -import retrofit2.http.*; +import retrofit2.http.Body; +import retrofit2.http.DELETE; +import retrofit2.http.GET; +import retrofit2.http.POST; +import retrofit2.http.PUT; +import retrofit2.http.Path; public interface BoardService { diff --git a/wrapper/src/main/java/it/unisannio/ding/ids/wedroid/wrapper/api/CardCommentService.java b/wrapper/src/main/java/it/unisannio/ding/ids/wedroid/wrapper/api/CardCommentService.java index c1d0b4f..232c28c 100644 --- a/wrapper/src/main/java/it/unisannio/ding/ids/wedroid/wrapper/api/CardCommentService.java +++ b/wrapper/src/main/java/it/unisannio/ding/ids/wedroid/wrapper/api/CardCommentService.java @@ -1,10 +1,14 @@ package it.unisannio.ding.ids.wedroid.wrapper.api; import it.unisannio.ding.ids.wedroid.wrapper.entity.Comment; -import retrofit2.Call; -import retrofit2.http.*; - import java.util.List; +import retrofit2.Call; +import retrofit2.http.DELETE; +import retrofit2.http.Field; +import retrofit2.http.FormUrlEncoded; +import retrofit2.http.GET; +import retrofit2.http.POST; +import retrofit2.http.Path; public interface CardCommentService { diff --git a/wrapper/src/main/java/it/unisannio/ding/ids/wedroid/wrapper/api/CardService.java b/wrapper/src/main/java/it/unisannio/ding/ids/wedroid/wrapper/api/CardService.java index 1f3790a..c59dabd 100644 --- a/wrapper/src/main/java/it/unisannio/ding/ids/wedroid/wrapper/api/CardService.java +++ b/wrapper/src/main/java/it/unisannio/ding/ids/wedroid/wrapper/api/CardService.java @@ -1,10 +1,17 @@ package it.unisannio.ding.ids.wedroid.wrapper.api; import it.unisannio.ding.ids.wedroid.wrapper.entity.Card; -import retrofit2.Call; -import retrofit2.http.*; - import java.util.List; +import retrofit2.Call; +import retrofit2.http.Body; +import retrofit2.http.DELETE; +import retrofit2.http.Field; +import retrofit2.http.FormUrlEncoded; +import retrofit2.http.GET; +import retrofit2.http.Headers; +import retrofit2.http.POST; +import retrofit2.http.PUT; +import retrofit2.http.Path; public interface CardService { diff --git a/wrapper/src/main/java/it/unisannio/ding/ids/wedroid/wrapper/api/ChecklistService.java b/wrapper/src/main/java/it/unisannio/ding/ids/wedroid/wrapper/api/ChecklistService.java index 477d761..6aecf68 100644 --- a/wrapper/src/main/java/it/unisannio/ding/ids/wedroid/wrapper/api/ChecklistService.java +++ b/wrapper/src/main/java/it/unisannio/ding/ids/wedroid/wrapper/api/ChecklistService.java @@ -4,10 +4,16 @@ import it.unisannio.ding.ids.wedroid.wrapper.entity.Checklist; import it.unisannio.ding.ids.wedroid.wrapper.entity.ChecklistItem; import it.unisannio.ding.ids.wedroid.wrapper.entity.ChecklistItemStatus; import it.unisannio.ding.ids.wedroid.wrapper.entity.ChecklistPrototype; -import retrofit2.Call; -import retrofit2.http.*; - import java.util.List; +import retrofit2.Call; +import retrofit2.http.Body; +import retrofit2.http.DELETE; +import retrofit2.http.Field; +import retrofit2.http.FormUrlEncoded; +import retrofit2.http.GET; +import retrofit2.http.POST; +import retrofit2.http.PUT; +import retrofit2.http.Path; public interface ChecklistService { diff --git a/wrapper/src/main/java/it/unisannio/ding/ids/wedroid/wrapper/api/ListService.java b/wrapper/src/main/java/it/unisannio/ding/ids/wedroid/wrapper/api/ListService.java index 7e79754..4d929a9 100644 --- a/wrapper/src/main/java/it/unisannio/ding/ids/wedroid/wrapper/api/ListService.java +++ b/wrapper/src/main/java/it/unisannio/ding/ids/wedroid/wrapper/api/ListService.java @@ -1,11 +1,14 @@ package it.unisannio.ding.ids.wedroid.wrapper.api; import it.unisannio.ding.ids.wedroid.wrapper.entity.WList; -import retrofit2.Call; -import retrofit2.http.*; - import java.util.List; - +import retrofit2.Call; +import retrofit2.http.DELETE; +import retrofit2.http.Field; +import retrofit2.http.FormUrlEncoded; +import retrofit2.http.GET; +import retrofit2.http.POST; +import retrofit2.http.Path; public interface ListService { diff --git a/wrapper/src/main/java/it/unisannio/ding/ids/wedroid/wrapper/api/SwimlanesService.java b/wrapper/src/main/java/it/unisannio/ding/ids/wedroid/wrapper/api/SwimlanesService.java index cac6d9f..aaa9746 100644 --- a/wrapper/src/main/java/it/unisannio/ding/ids/wedroid/wrapper/api/SwimlanesService.java +++ b/wrapper/src/main/java/it/unisannio/ding/ids/wedroid/wrapper/api/SwimlanesService.java @@ -1,10 +1,14 @@ package it.unisannio.ding.ids.wedroid.wrapper.api; import it.unisannio.ding.ids.wedroid.wrapper.entity.Swimlane; -import retrofit2.Call; -import retrofit2.http.*; - import java.util.List; +import retrofit2.Call; +import retrofit2.http.DELETE; +import retrofit2.http.Field; +import retrofit2.http.FormUrlEncoded; +import retrofit2.http.GET; +import retrofit2.http.POST; +import retrofit2.http.Path; public interface SwimlanesService { /** diff --git a/wrapper/src/main/java/it/unisannio/ding/ids/wedroid/wrapper/api/UserService.java b/wrapper/src/main/java/it/unisannio/ding/ids/wedroid/wrapper/api/UserService.java index 9213a4e..2d61f47 100644 --- a/wrapper/src/main/java/it/unisannio/ding/ids/wedroid/wrapper/api/UserService.java +++ b/wrapper/src/main/java/it/unisannio/ding/ids/wedroid/wrapper/api/UserService.java @@ -3,10 +3,16 @@ package it.unisannio.ding.ids.wedroid.wrapper.api; import it.unisannio.ding.ids.wedroid.wrapper.entity.Action; import it.unisannio.ding.ids.wedroid.wrapper.entity.Board; import it.unisannio.ding.ids.wedroid.wrapper.entity.User; -import retrofit2.Call; -import retrofit2.http.*; - import java.util.List; +import retrofit2.Call; +import retrofit2.http.Body; +import retrofit2.http.DELETE; +import retrofit2.http.Field; +import retrofit2.http.FormUrlEncoded; +import retrofit2.http.GET; +import retrofit2.http.Headers; +import retrofit2.http.POST; +import retrofit2.http.Path; public interface UserService { @@ -44,7 +50,7 @@ public interface UserService { Call delete(@Path("user") String userId); -/******************** Don't work ****************************************************/ + /******************** Don't work ****************************************************/ @FormUrlEncoded @POST("api/users") diff --git a/wrapper/src/main/java/it/unisannio/ding/ids/wedroid/wrapper/entity/Card.java b/wrapper/src/main/java/it/unisannio/ding/ids/wedroid/wrapper/entity/Card.java index 25a58da..75e7f27 100644 --- a/wrapper/src/main/java/it/unisannio/ding/ids/wedroid/wrapper/entity/Card.java +++ b/wrapper/src/main/java/it/unisannio/ding/ids/wedroid/wrapper/entity/Card.java @@ -8,7 +8,7 @@ public class Card { //Constructor for add card public Card(String authorId, String title, String swimlaneId, String description) { - this.authorId= authorId; + this.authorId = authorId; this.title = title; this.swimlaneId = swimlaneId; this.description = description; diff --git a/wrapper/src/main/java/it/unisannio/ding/ids/wedroid/wrapper/entity/MemberPermission.java b/wrapper/src/main/java/it/unisannio/ding/ids/wedroid/wrapper/entity/MemberPermission.java index 0e7049c..733df54 100644 --- a/wrapper/src/main/java/it/unisannio/ding/ids/wedroid/wrapper/entity/MemberPermission.java +++ b/wrapper/src/main/java/it/unisannio/ding/ids/wedroid/wrapper/entity/MemberPermission.java @@ -4,7 +4,7 @@ public class MemberPermission { /** * The user is an admin of the board */ - public final static MemberPermission ADMIN = new MemberPermission( + public static final MemberPermission ADMIN = new MemberPermission( true, false, false @@ -13,7 +13,7 @@ public class MemberPermission { /** * The use is an normal member of the board */ - public final static MemberPermission NORMAL = new MemberPermission( + public static final MemberPermission NORMAL = new MemberPermission( false, false, false @@ -22,7 +22,7 @@ public class MemberPermission { /** * The user isn't allowed to make comments on the board */ - public final static MemberPermission NO_COMMENTS = new MemberPermission( + public static final MemberPermission NO_COMMENTS = new MemberPermission( false, true, false @@ -31,7 +31,7 @@ public class MemberPermission { /** * The user is only allowed to make comments on the board */ - public final static MemberPermission COMMENT_ONLY = new MemberPermission( + public static final MemberPermission COMMENT_ONLY = new MemberPermission( false, false, true diff --git a/wrapper/src/test/java/it/unisannio/ding/ids/wedroid/wrapper/api/BoardServiceTest.java b/wrapper/src/test/java/it/unisannio/ding/ids/wedroid/wrapper/api/BoardServiceTest.java index 2b009e3..5ca4912 100644 --- a/wrapper/src/test/java/it/unisannio/ding/ids/wedroid/wrapper/api/BoardServiceTest.java +++ b/wrapper/src/test/java/it/unisannio/ding/ids/wedroid/wrapper/api/BoardServiceTest.java @@ -1,10 +1,18 @@ package it.unisannio.ding.ids.wedroid.wrapper.api; +import static junit.framework.TestCase.assertNotNull; +import static junit.framework.TestCase.assertTrue; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; + import it.unisannio.ding.ids.wedroid.wrapper.entity.Board; import it.unisannio.ding.ids.wedroid.wrapper.entity.BoardBackgroundColor; import it.unisannio.ding.ids.wedroid.wrapper.entity.BoardPermission; import it.unisannio.ding.ids.wedroid.wrapper.entity.BoardPrototype; import it.unisannio.ding.ids.wedroid.wrapper.entity.PresentParentTask; +import java.io.IOException; +import java.net.HttpURLConnection; +import java.util.List; import okhttp3.mockwebserver.MockResponse; import okhttp3.mockwebserver.MockWebServer; import org.junit.After; @@ -13,12 +21,6 @@ import org.junit.Test; import retrofit2.Retrofit; import retrofit2.converter.gson.GsonConverterFactory; -import java.io.IOException; -import java.net.HttpURLConnection; -import java.util.List; - -import static org.junit.Assert.*; - public class BoardServiceTest { private MockWebServer mockWebServer = new MockWebServer(); private BoardService service = null; @@ -59,8 +61,8 @@ public class BoardServiceTest { mockWebServer.enqueue(response); try { - List boards = service.getPublicBoards(). - execute().body(); + List boards = service.getPublicBoards() + .execute().body(); assertNotNull(boards); assertEquals(2, boards.size()); diff --git a/wrapper/src/test/java/it/unisannio/ding/ids/wedroid/wrapper/api/CardCommentServiceTest.java b/wrapper/src/test/java/it/unisannio/ding/ids/wedroid/wrapper/api/CardCommentServiceTest.java index e34daba..e72f843 100644 --- a/wrapper/src/test/java/it/unisannio/ding/ids/wedroid/wrapper/api/CardCommentServiceTest.java +++ b/wrapper/src/test/java/it/unisannio/ding/ids/wedroid/wrapper/api/CardCommentServiceTest.java @@ -1,6 +1,12 @@ package it.unisannio.ding.ids.wedroid.wrapper.api; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertNotNull; + import it.unisannio.ding.ids.wedroid.wrapper.entity.Comment; +import java.io.IOException; +import java.net.HttpURLConnection; +import java.util.List; import okhttp3.mockwebserver.MockResponse; import okhttp3.mockwebserver.MockWebServer; import org.junit.After; @@ -9,13 +15,6 @@ import org.junit.Test; import retrofit2.Retrofit; import retrofit2.converter.gson.GsonConverterFactory; -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 CardCommentServiceTest { private MockWebServer mockWebServer = new MockWebServer(); private CardCommentService service = null; @@ -110,17 +109,17 @@ public class CardCommentServiceTest { } } - private final static String COMMENT_1 = "{" + + private static final String COMMENT_1 = "{" + "\"_id\":\"zwzAgjHdW4fNJ9YLc\"," + "\"comment\":\"comment 1\"," + "\"authorId\":\"Si69gNgkJfQuk6uiJ\"" + "}"; - private final static String COMMENT_2 = "{" + + private static final String COMMENT_2 = "{" + "\"_id\":\"zwzAgjHdW4fNJ9YLt\"," + "\"comment\":\"comment 2\"," + "\"authorId\":\"Si69gNgkJfQuk6uiJ\"" + "}"; - private final static String COMMENT_3 = "{" + + private static final String COMMENT_3 = "{" + "\"_id\":\"DofhD9v96DbX7Wirp\"," + "\"userId\":\"Si69gNgkJfQuk6uiJ\"," + "\"text\":\"commento api\"," + diff --git a/wrapper/src/test/java/it/unisannio/ding/ids/wedroid/wrapper/api/CardServiceTest.java b/wrapper/src/test/java/it/unisannio/ding/ids/wedroid/wrapper/api/CardServiceTest.java index e8b6625..abbebf2 100644 --- a/wrapper/src/test/java/it/unisannio/ding/ids/wedroid/wrapper/api/CardServiceTest.java +++ b/wrapper/src/test/java/it/unisannio/ding/ids/wedroid/wrapper/api/CardServiceTest.java @@ -1,22 +1,20 @@ package it.unisannio.ding.ids.wedroid.wrapper.api; -import org.junit.After; -import org.junit.Before; -import org.junit.Test; - -import it.unisannio.ding.ids.wedroid.wrapper.entity.Card; -import retrofit2.Retrofit; -import retrofit2.converter.gson.GsonConverterFactory; -import okhttp3.mockwebserver.MockResponse; -import okhttp3.mockwebserver.MockWebServer; - -import java.io.IOException; -import java.net.HttpURLConnection; -import java.util.List; - import static org.junit.Assert.assertEquals; import static org.junit.Assert.assertNotNull; +import it.unisannio.ding.ids.wedroid.wrapper.entity.Card; +import java.io.IOException; +import java.net.HttpURLConnection; +import java.util.List; +import okhttp3.mockwebserver.MockResponse; +import okhttp3.mockwebserver.MockWebServer; +import org.junit.After; +import org.junit.Before; +import org.junit.Test; +import retrofit2.Retrofit; +import retrofit2.converter.gson.GsonConverterFactory; + public class CardServiceTest { private MockWebServer mockWebServer = new MockWebServer(); private CardService service = null; @@ -45,7 +43,7 @@ public class CardServiceTest { } @Test - public void getAllCardsTest(){ + public void getAllCardsTest() { MockResponse response = new MockResponse() .setResponseCode(HttpURLConnection.HTTP_OK) .setBody( @@ -56,8 +54,8 @@ public class CardServiceTest { mockWebServer.enqueue(response); try { - List cards = service.getAllCards("oKthRbLqoXZr5NNua","iA6pmp6fENvF7AaTX"). - execute().body(); + List cards = service.getAllCards("oKthRbLqoXZr5NNua","iA6pmp6fENvF7AaTX") + .execute().body(); assertNotNull(cards); assertEquals("Numbero of card not ok",2, cards.size()); @@ -75,7 +73,7 @@ public class CardServiceTest { } @Test - public void getCardTest(){ + public void getCardTest() { MockResponse response = new MockResponse() .setResponseCode(HttpURLConnection.HTTP_OK) .setBody(card); @@ -84,12 +82,12 @@ public class CardServiceTest { "oKthRbLqoXZr5NNua","iA6pmp6fENvF7AaTX","J5a86fPe2DhqN3QbF") .execute().body(); assertNotNull(card); - assertEquals("J5a86fPe2DhqN3QbF", card.getId() ); + 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){ + } catch (IOException e) { e.printStackTrace(); } mockWebServer.enqueue(response); @@ -97,7 +95,7 @@ public class CardServiceTest { } @Test - public void newCardTest(){ + public void newCardTest() { MockResponse response = new MockResponse() .setResponseCode(HttpURLConnection.HTTP_OK) .setBody( @@ -133,7 +131,7 @@ public class CardServiceTest { .execute().body(); assertNotNull(cards); assertEquals(3, cards.size()); - for(int i = 0; i < cards.size(); i++){ + 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()); @@ -159,9 +157,9 @@ public class CardServiceTest { } private static final String card = - "{"+ + "{" + "\"_id\":\"J5a86fPe2DhqN3QbF\"," + - "\"title\":\"title1\","+ + "\"title\":\"title1\"," + "\"boardId\":\"oKthRbLqoXZr5NNua\"," + "\"listId\":\"iA6pmp6fENvF7AaTX\"," + "\"description\":\"proof\"," + diff --git a/wrapper/src/test/java/it/unisannio/ding/ids/wedroid/wrapper/api/ChecklistServiceTest.java b/wrapper/src/test/java/it/unisannio/ding/ids/wedroid/wrapper/api/ChecklistServiceTest.java index b8b2e5c..a02ec66 100644 --- a/wrapper/src/test/java/it/unisannio/ding/ids/wedroid/wrapper/api/ChecklistServiceTest.java +++ b/wrapper/src/test/java/it/unisannio/ding/ids/wedroid/wrapper/api/ChecklistServiceTest.java @@ -1,9 +1,15 @@ package it.unisannio.ding.ids.wedroid.wrapper.api; +import static junit.framework.TestCase.assertNotNull; +import static org.junit.Assert.assertEquals; + import it.unisannio.ding.ids.wedroid.wrapper.entity.Checklist; import it.unisannio.ding.ids.wedroid.wrapper.entity.ChecklistItem; import it.unisannio.ding.ids.wedroid.wrapper.entity.ChecklistItemStatus; import it.unisannio.ding.ids.wedroid.wrapper.entity.ChecklistPrototype; +import java.io.IOException; +import java.net.HttpURLConnection; +import java.util.List; import okhttp3.mockwebserver.MockResponse; import okhttp3.mockwebserver.MockWebServer; import org.junit.After; @@ -12,12 +18,6 @@ import org.junit.Test; import retrofit2.Retrofit; import retrofit2.converter.gson.GsonConverterFactory; -import java.io.IOException; -import java.net.HttpURLConnection; -import java.util.List; - -import static org.junit.Assert.*; - public class ChecklistServiceTest { private MockWebServer mockWebServer = new MockWebServer(); private ChecklistService service = null; @@ -59,8 +59,8 @@ public class ChecklistServiceTest { try { List checklists = service.getAllChecklists( "board id", "card id" - ). - execute().body(); + ) + .execute().body(); assertNotNull(checklists); assertEquals(2, checklists.size()); diff --git a/wrapper/src/test/java/it/unisannio/ding/ids/wedroid/wrapper/api/ListServiceTest.java b/wrapper/src/test/java/it/unisannio/ding/ids/wedroid/wrapper/api/ListServiceTest.java index 5db7826..581f341 100644 --- a/wrapper/src/test/java/it/unisannio/ding/ids/wedroid/wrapper/api/ListServiceTest.java +++ b/wrapper/src/test/java/it/unisannio/ding/ids/wedroid/wrapper/api/ListServiceTest.java @@ -1,6 +1,12 @@ package it.unisannio.ding.ids.wedroid.wrapper.api; +import static junit.framework.TestCase.assertEquals; +import static junit.framework.TestCase.assertNotNull; + import it.unisannio.ding.ids.wedroid.wrapper.entity.WList; +import java.io.IOException; +import java.net.HttpURLConnection; +import java.util.List; import okhttp3.mockwebserver.MockResponse; import okhttp3.mockwebserver.MockWebServer; import org.junit.After; @@ -9,12 +15,6 @@ import org.junit.Test; import retrofit2.Retrofit; import retrofit2.converter.gson.GsonConverterFactory; -import java.io.IOException; -import java.net.HttpURLConnection; -import java.util.List; - -import static org.junit.Assert.*; - public class ListServiceTest { private MockWebServer mockWebServer = new MockWebServer(); private ListService service = null; diff --git a/wrapper/src/test/java/it/unisannio/ding/ids/wedroid/wrapper/api/SwimlanesServiceTest.java b/wrapper/src/test/java/it/unisannio/ding/ids/wedroid/wrapper/api/SwimlanesServiceTest.java index 29e35aa..dff5a72 100644 --- a/wrapper/src/test/java/it/unisannio/ding/ids/wedroid/wrapper/api/SwimlanesServiceTest.java +++ b/wrapper/src/test/java/it/unisannio/ding/ids/wedroid/wrapper/api/SwimlanesServiceTest.java @@ -1,7 +1,13 @@ package it.unisannio.ding.ids.wedroid.wrapper.api; +import static junit.framework.TestCase.assertNotNull; +import static org.junit.Assert.assertEquals; + import it.unisannio.ding.ids.wedroid.wrapper.entity.Color; import it.unisannio.ding.ids.wedroid.wrapper.entity.Swimlane; +import java.io.IOException; +import java.net.HttpURLConnection; +import java.util.List; import okhttp3.mockwebserver.MockResponse; import okhttp3.mockwebserver.MockWebServer; import org.junit.After; @@ -10,12 +16,6 @@ import org.junit.Test; import retrofit2.Retrofit; import retrofit2.converter.gson.GsonConverterFactory; -import java.io.IOException; -import java.net.HttpURLConnection; -import java.util.List; - -import static org.junit.Assert.*; - public class SwimlanesServiceTest { private MockWebServer mockWebServer = new MockWebServer(); private SwimlanesService service = null; @@ -62,6 +62,7 @@ public class SwimlanesServiceTest { for (int i = 0; i < 2; i++) assertEquals("title " + (i + 1), lists.get(i).getTitle()); + } catch (IOException e) { e.printStackTrace(); } @@ -108,8 +109,8 @@ public class SwimlanesServiceTest { } } - final static String SWIMLANE_1 = "{\n\"_id\": \"BS4AA79YABBCpDDau\",\n\"title\": \"title 1\"\n}"; - final static String SWIMLANE_2 = "{" + + static final String SWIMLANE_1 = "{\n\"_id\": \"BS4AA79YABBCpDDau\",\n\"title\": \"title 1\"\n}"; + static final String SWIMLANE_2 = "{" + "\"_id\":\"JNmpXKCupbtyPkYMG\"," + "\"title\":\"title 2\"," + "\"boardId\":\"TtjXrJyvPkG3xsbkw\"," + diff --git a/wrapper/src/test/java/it/unisannio/ding/ids/wedroid/wrapper/api/UserServiceTest.java b/wrapper/src/test/java/it/unisannio/ding/ids/wedroid/wrapper/api/UserServiceTest.java index 917f8e7..7892995 100644 --- a/wrapper/src/test/java/it/unisannio/ding/ids/wedroid/wrapper/api/UserServiceTest.java +++ b/wrapper/src/test/java/it/unisannio/ding/ids/wedroid/wrapper/api/UserServiceTest.java @@ -1,25 +1,25 @@ package it.unisannio.ding.ids.wedroid.wrapper.api; +import static junit.framework.TestCase.assertNotNull; +import static junit.framework.TestCase.assertTrue; +import static org.junit.Assert.assertEquals; +import static org.junit.Assert.assertFalse; + import it.unisannio.ding.ids.wedroid.wrapper.entity.Service; import it.unisannio.ding.ids.wedroid.wrapper.entity.User; import it.unisannio.ding.ids.wedroid.wrapper.entity.UserEmail; import it.unisannio.ding.ids.wedroid.wrapper.entity.UserProfile; +import java.io.IOException; +import java.net.HttpURLConnection; +import java.util.List; import okhttp3.mockwebserver.MockResponse; import okhttp3.mockwebserver.MockWebServer; import org.junit.After; import org.junit.Before; import org.junit.Test; -import static org.junit.Assert.*; - -import retrofit2.Call; import retrofit2.Retrofit; import retrofit2.converter.gson.GsonConverterFactory; -import javax.jws.soap.SOAPBinding; -import java.io.IOException; -import java.net.HttpURLConnection; -import java.util.List; - public class UserServiceTest { private MockWebServer mockWebServer = new MockWebServer(); private UserService service = null; @@ -49,7 +49,7 @@ public class UserServiceTest { } @Test - public void getAllUsersTest(){ + public void getAllUsersTest() { MockResponse response = new MockResponse() .setResponseCode(HttpURLConnection.HTTP_OK) .setBody( @@ -59,7 +59,7 @@ public class UserServiceTest { ); mockWebServer.enqueue(response); - try{ + try { List users = service.getAllUser().execute().body(); assertNotNull(users); assertEquals("Si69gNgkJfQuk6uiJ", users.get(0).getId()); @@ -68,14 +68,13 @@ public class UserServiceTest { assertEquals("noemi", users.get(1).getUsername()); assertEquals("jPdkf3a9bmfZWx3GR", users.get(2).getId()); assertEquals("umberto", users.get(2).getUsername()); - } - catch (IOException e){ + } catch (IOException e) { e.printStackTrace(); } } @Test - public void getUser(){ + public void getUser() { MockResponse response = new MockResponse() .setResponseCode(HttpURLConnection.HTTP_OK) .setBody(user1); @@ -114,7 +113,7 @@ public class UserServiceTest { } @Test - public void getCurrentUser(){ + public void getCurrentUser() { MockResponse mockResponse = new MockResponse() .setResponseCode(HttpURLConnection.HTTP_OK) .setBody(user2); @@ -155,7 +154,7 @@ public class UserServiceTest { "\"profile\":{\"boardView\":\"board-view-swimlanes\",\"templatesBoardId\":\"eLvE8FnqvACfC9Rtb\"," + "\"cardTemplatesSwimlaneId\":\"zo82BZYxFTNBpb7jX\",\"listTemplatesSwimlaneId\":\"Kja32A85P2HADWKFA\"," + "\"boardTemplatesSwimlaneId\":\"j6ZuPbwaN9nsCDxyS\",\"listSortBy\":\"-modifiedAt\"}," + - "\"createdAt\":\"2019-10-14T18:14:38.249Z\","+ + "\"createdAt\":\"2019-10-14T18:14:38.249Z\"," + "\"modifiedAt\":\"2019-11-09T17:55:36.976Z\"," + "\"services\":{\n" + " \"password\":{\n" + @@ -185,7 +184,7 @@ public class UserServiceTest { "}\n" + "}"; - private final String user2 = "{" + + private static final String user2 = "{" + "\"_id\":\"jPdkf3a9bmfZWx3GR\"," + "\"createdAt\":\"2019-10-14T18:14:38.249Z\"," + "\"username\":\"umberto\"," + -- 2.45.2 From aa30060dc216a342f474c7a9ac67a583b279bebb Mon Sep 17 00:00:00 2001 From: norangebit Date: Mon, 30 Dec 2019 14:33:15 +0100 Subject: [PATCH 2/6] add javadoc to moveCard --- .../ding/ids/wedroid/wrapper/api/CardService.java | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/wrapper/src/main/java/it/unisannio/ding/ids/wedroid/wrapper/api/CardService.java b/wrapper/src/main/java/it/unisannio/ding/ids/wedroid/wrapper/api/CardService.java index c59dabd..22c4c75 100644 --- a/wrapper/src/main/java/it/unisannio/ding/ids/wedroid/wrapper/api/CardService.java +++ b/wrapper/src/main/java/it/unisannio/ding/ids/wedroid/wrapper/api/CardService.java @@ -79,6 +79,15 @@ public interface CardService { Call putCard(@Path("board") String boardID, @Path("list") String listID, @Path("card") String cardID, @Body Card card); + /** + * Move a card from a list to an other + * + * @param boardID The id of the Board + * @param oldListID The id of the source list + * @param cardID The id of the card + * @param newListId The id of the destination list + * @return The card with the matching ID + */ @FormUrlEncoded @PUT("/api/boards/{board}/lists/{list}/cards/{card}") Call moveCard( -- 2.45.2 From 51971269d4ea4816b65624700d91e2687dc345f5 Mon Sep 17 00:00:00 2001 From: norangebit Date: Sat, 18 Jan 2020 14:09:01 +0100 Subject: [PATCH 3/6] clean up build script files --- app/build.gradle | 44 +++++++++++++++++----------------------- build.gradle | 4 ---- wrapper/build.gradle.kts | 1 - 3 files changed, 19 insertions(+), 30 deletions(-) diff --git a/app/build.gradle b/app/build.gradle index 60f6666..4180076 100644 --- a/app/build.gradle +++ b/app/build.gradle @@ -6,7 +6,6 @@ apply plugin: 'kotlin-android-extensions' apply plugin: 'kotlin-kapt' - apply plugin: 'io.gitlab.arturbosch.detekt' android { @@ -32,53 +31,48 @@ android { } dependencies { - // standard - implementation project(':wrapper') - detektPlugins "io.gitlab.arturbosch.detekt:detekt-formatting:1.2.2" - implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" implementation 'androidx.appcompat:appcompat:1.1.0' implementation 'androidx.core:core-ktx:1.1.0' implementation 'androidx.constraintlayout:constraintlayout:1.1.3' implementation 'com.google.android.material:material:1.0.0' + implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version" // wrapper implementation project(':wrapper') // retrofit - implementation "com.squareup.retrofit2:retrofit:2.6.2" implementation "com.squareup.retrofit2:converter-gson:2.6.2" + implementation "com.squareup.retrofit2:retrofit:2.6.2" // room database - implementation "androidx.room:room-runtime:$rootProject.roomVersion" - implementation "androidx.room:room-ktx:$rootProject.roomVersion" kapt "androidx.room:room-compiler:$rootProject.roomVersion" + implementation "androidx.room:room-ktx:$rootProject.roomVersion" + implementation "androidx.room:room-runtime:$rootProject.roomVersion" // lifecycle components - implementation "androidx.lifecycle:lifecycle-extensions:$rootProject.archLifecycleVersion" - //noinspection LifecycleAnnotationProcessorWithJava8 kapt "androidx.lifecycle:lifecycle-compiler:$rootProject.archLifecycleVersion" - // ViewModel Kotlin support + implementation "androidx.lifecycle:lifecycle-extensions:$rootProject.archLifecycleVersion" + // viewmode kotlin support implementation "androidx.lifecycle:lifecycle-viewmodel-ktx:$rootProject.archLifecycleVersion" - // Coroutines + // coroutines api "org.jetbrains.kotlinx:kotlinx-coroutines-android:$rootProject.coroutines" // UI - implementation "com.google.android.material:material:$rootProject.materialVersion" implementation "androidx.swiperefreshlayout:swiperefreshlayout:1.0.0" - //Card view implementation 'androidx.cardview:cardview:1.0.0' + implementation "com.google.android.material:material:$rootProject.materialVersion" - // TESTING - testImplementation 'junit:junit:4.12' - testImplementation "io.mockk:mockk:1.9.3" + // testing testImplementation "com.squareup.okhttp3:mockwebserver:4.2.1" - androidTestImplementation 'androidx.test.ext:junit:1.1.1' + testImplementation "io.mockk:mockk:1.9.3" + testImplementation 'junit:junit:4.12' + + // android testing + androidTestImplementation "androidx.arch.core:core-testing:$rootProject.androidxArchVersion" + androidTestImplementation "androidx.arch.core:core-testing:$rootProject.coreTestingVersion" + androidTestImplementation "androidx.room:room-testing:$rootProject.roomVersion" androidTestImplementation 'androidx.test.espresso:espresso-core:3.2.0' androidTestImplementation 'androidx.test.espresso:espresso-contrib:3.2.0' androidTestImplementation 'androidx.test:runner:1.2.0' androidTestImplementation 'androidx.test:rules:1.2.0' + androidTestImplementation 'androidx.test.ext:junit:1.1.1' - implementation "com.squareup.retrofit2:retrofit:2.6.2" - implementation "com.squareup.retrofit2:converter-gson:2.6.2" - - androidTestImplementation "androidx.room:room-testing:$rootProject.roomVersion" - androidTestImplementation "androidx.arch.core:core-testing:$rootProject.androidxArchVersion" - androidTestImplementation "androidx.arch.core:core-testing:$rootProject.coreTestingVersion" - + // detekt + detektPlugins "io.gitlab.arturbosch.detekt:detekt-formatting:1.2.2" } diff --git a/build.gradle b/build.gradle index e65847d..1038f12 100644 --- a/build.gradle +++ b/build.gradle @@ -1,5 +1,3 @@ -// Top-level build file where you can add configuration options common to all sub-projects/modules. - buildscript { ext.kotlin_version = '1.3.60' repositories { @@ -12,8 +10,6 @@ buildscript { classpath 'com.android.tools.build:gradle:3.5.3' classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlin_version" classpath "io.gitlab.arturbosch.detekt:detekt-gradle-plugin:1.2.2" - // NOTE: Do not place your application dependencies here; they belong - // in the individual module build.gradle files } } diff --git a/wrapper/build.gradle.kts b/wrapper/build.gradle.kts index 64a9c29..6d3203c 100644 --- a/wrapper/build.gradle.kts +++ b/wrapper/build.gradle.kts @@ -1,5 +1,4 @@ plugins { - // apply the java-library plugin to add support for Java Library `java-library` } -- 2.45.2 From dedb7abb2d413b0ccc7df97a7d4ca58459b3dce6 Mon Sep 17 00:00:00 2001 From: norangebit Date: Sat, 18 Jan 2020 14:25:40 +0100 Subject: [PATCH 4/6] add authors --- README.md | 10 ++++------ 1 file changed, 4 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index eb76347..b8279d5 100644 --- a/README.md +++ b/README.md @@ -6,10 +6,8 @@ Client Android per Wekan sviluppato per il progetto del corso magistrale Ingegneria del Software per l'Università del Sannio. +## Authors - - - - - - +- Furno Umberto +- Mignone Raffaele +- Mincolelli Noemi -- 2.45.2 From 61ad425f2a62feccb2e9742a927bd6fb17925772 Mon Sep 17 00:00:00 2001 From: norangebit Date: Sat, 18 Jan 2020 14:40:22 +0100 Subject: [PATCH 5/6] remove placeholder files --- .../wedroid/app/ExampleInstrumentedTest.kt | 24 ------------------- .../ding/ids/wedroid/app/ExampleUnitTest.kt | 17 ------------- 2 files changed, 41 deletions(-) delete mode 100644 app/src/androidTest/java/it/unisannio/ding/ids/wedroid/app/ExampleInstrumentedTest.kt delete mode 100644 app/src/test/java/it/unisannio/ding/ids/wedroid/app/ExampleUnitTest.kt diff --git a/app/src/androidTest/java/it/unisannio/ding/ids/wedroid/app/ExampleInstrumentedTest.kt b/app/src/androidTest/java/it/unisannio/ding/ids/wedroid/app/ExampleInstrumentedTest.kt deleted file mode 100644 index 8910003..0000000 --- a/app/src/androidTest/java/it/unisannio/ding/ids/wedroid/app/ExampleInstrumentedTest.kt +++ /dev/null @@ -1,24 +0,0 @@ -package it.unisannio.ding.ids.wedroid.app - -import androidx.test.platform.app.InstrumentationRegistry -import androidx.test.ext.junit.runners.AndroidJUnit4 - -import org.junit.Test -import org.junit.runner.RunWith - -import org.junit.Assert.* - -/** - * Instrumented test, which will execute on an Android device. - * - * See [testing documentation](http://d.android.com/tools/testing). - */ -@RunWith(AndroidJUnit4::class) -class ExampleInstrumentedTest { - @Test - fun useAppContext() { - // Context of the app under test. - val appContext = InstrumentationRegistry.getInstrumentation().targetContext - assertEquals("it.unisannio.ding.ids.wedroid.app", appContext.packageName) - } -} diff --git a/app/src/test/java/it/unisannio/ding/ids/wedroid/app/ExampleUnitTest.kt b/app/src/test/java/it/unisannio/ding/ids/wedroid/app/ExampleUnitTest.kt deleted file mode 100644 index 27c2f01..0000000 --- a/app/src/test/java/it/unisannio/ding/ids/wedroid/app/ExampleUnitTest.kt +++ /dev/null @@ -1,17 +0,0 @@ -package it.unisannio.ding.ids.wedroid.app - -import org.junit.Test - -import org.junit.Assert.* - -/** - * Example local unit test, which will execute on the development machine (host). - * - * See [testing documentation](http://d.android.com/tools/testing). - */ -class ExampleUnitTest { - @Test - fun addition_isCorrect() { - assertEquals(4, 2 + 2) - } -} -- 2.45.2 From 7a40c6f36ae924890b8e9697ced0bebfaa385ad1 Mon Sep 17 00:00:00 2001 From: norangebit Date: Sat, 18 Jan 2020 14:40:46 +0100 Subject: [PATCH 6/6] fix #29 --- app/src/main/res/layout/activity_login.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/src/main/res/layout/activity_login.xml b/app/src/main/res/layout/activity_login.xml index 1d6bf2a..0d4b0a5 100644 --- a/app/src/main/res/layout/activity_login.xml +++ b/app/src/main/res/layout/activity_login.xml @@ -10,7 +10,7 @@ android:id="@+id/username" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginBottom="100dp" + android:layout_marginBottom="50dp" android:ems="10" android:hint="UserName" android:inputType="textPersonName" @@ -22,7 +22,7 @@ android:id="@+id/password" android:layout_width="wrap_content" android:layout_height="wrap_content" - android:layout_marginBottom="50dp" + android:layout_marginBottom="100dp" android:ems="10" android:hint="Password" android:inputType="textPassword" -- 2.45.2