Skip to content

Commit

Permalink
Merge branch 'develop' into feature/ticket-default
Browse files Browse the repository at this point in the history
  • Loading branch information
strassl committed Jan 30, 2017
2 parents 3915887 + 7b627f5 commit 3c847bd
Show file tree
Hide file tree
Showing 9 changed files with 131 additions and 587 deletions.
452 changes: 0 additions & 452 deletions backend/src/main/resources/sql/WILL_BE_DELETED_SOON.sql

This file was deleted.

19 changes: 13 additions & 6 deletions backend/src/main/resources/sql/testBaseSamples.sql
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,7 @@ WHERE id = '00000000-0003-0000-0000-000000000101';
INSERT INTO PUBLIC.ticket (id, number, parent_ticket_id, project_id, created_by, description_comment_id, create_time, title, OPEN, story_points, initial_estimated_time, current_estimated_time, due_date)
VALUES ('00000000-0003-0000-0000-000000000102', 1, NULL, '00000000-0002-0000-0000-000000000102',
'00000000-0001-0000-0000-000000000101', NULL,
'2016-11-16 17:06:07.221000', 'Project 2 Ticket One', TRUE, 10, 20, 25,
'2016-11-16 17:06:07.221000', 'Project 2 Ticket One', TRUE, 11, 20, 25,
'2016-11-20 17:07:05.554000');
INSERT INTO PUBLIC.comment (id, user_id, ticket_id, create_time, TEXT)
VALUES ('00000000-0004-0000-0000-000000000102', '00000000-0001-0000-0000-000000000101',
Expand All @@ -71,7 +71,7 @@ WHERE id = '00000000-0003-0000-0000-000000000102';
INSERT INTO PUBLIC.ticket (id, number, parent_ticket_id, project_id, created_by, description_comment_id, create_time, title, OPEN, story_points, initial_estimated_time, current_estimated_time, due_date)
VALUES ('00000000-0003-0000-0000-000000000103', 1, NULL, '00000000-0002-0000-0000-000000000103',
'00000000-0001-0000-0000-000000000101', NULL,
'2016-11-16 17:06:07.221000', 'Project 3 Ticket One', TRUE, 10, 20, 25,
'2016-11-16 17:06:07.221000', 'Project 3 Ticket One', TRUE, 12, 20, 25,
'2016-11-20 17:07:05.554000');
INSERT INTO PUBLIC.comment (id, user_id, ticket_id, create_time, TEXT)
VALUES ('00000000-0004-0000-0000-000000000103', '00000000-0001-0000-0000-000000000101',
Expand All @@ -84,7 +84,7 @@ WHERE id = '00000000-0003-0000-0000-000000000103';
INSERT INTO PUBLIC.ticket (id, number, parent_ticket_id, project_id, created_by, description_comment_id, create_time, title, OPEN, story_points, initial_estimated_time, current_estimated_time, due_date)
VALUES ('00000000-0003-0000-0000-000000000104', 1, NULL, '00000000-0002-0000-0000-000000000104',
'00000000-0001-0000-0000-000000000101', NULL,
'2016-11-16 17:06:07.221000', 'Project 4 Ticket One', TRUE, 10, 20, 25,
'2016-11-16 17:06:07.221000', 'Project 4 Ticket One', TRUE, 20, 20, 25,
'2016-11-20 17:07:05.554000');
INSERT INTO PUBLIC.comment (id, user_id, ticket_id, create_time, TEXT)
VALUES ('00000000-0004-0000-0000-000000000104', '00000000-0001-0000-0000-000000000101',
Expand All @@ -97,14 +97,14 @@ WHERE id = '00000000-0003-0000-0000-000000000104';
INSERT INTO PUBLIC.ticket (id, number, parent_ticket_id, project_id, created_by, description_comment_id, create_time, title, OPEN, story_points, initial_estimated_time, current_estimated_time, due_date)
VALUES ('00000000-0003-0000-0000-000000000105', 2, NULL, '00000000-0002-0000-0000-000000000101',
'00000000-0001-0000-0000-000000000101', NULL,
'2016-11-16 17:06:07.221000', 'Project 1 Ticket Two', TRUE, 10, 20, 25,
'2016-11-16 17:06:07.221000', 'Project 1 Ticket Two', TRUE, 15, 20, 25,
'2016-11-20 17:07:05.554000');
INSERT INTO PUBLIC.comment (id, user_id, ticket_id, create_time, TEXT)
VALUES ('00000000-0004-0000-0000-000000000105', '00000000-0001-0000-0000-000000000101',
'00000000-0003-0000-0000-000000000104', '2016-11-16 17:09:59.019000', 'Description Project4 Ticket1');
'00000000-0003-0000-0000-000000000105', '2016-11-16 17:09:59.019000', 'Description Project4 Ticket1');
UPDATE PUBLIC.ticket
SET description_comment_id = '00000000-0004-0000-0000-000000000105'
WHERE id = '00000000-0003-0000-0000-000000000104';
WHERE id = '00000000-0003-0000-0000-000000000105';

--######################################## COMMENTS ##################################################################
--####################################################################################################################
Expand Down Expand Up @@ -281,4 +281,11 @@ INSERT INTO public.assigned_ticket_tag (ticket_id, ticket_tag_id) VALUES

-- Tags for Tickets 00000000-0003-0000-0000-0000000001 2&3 reserved for insert tests


--########################################## LOGGED TIME #############################################################
--####################################################################################################################
INSERT INTO public.logged_time (id, comment_id, category_id, time, canceled)
VALUES ('00000000-0008-0000-0000-000000000101', '00000000-0004-0000-0000-000000000101',
'00000000-0007-0000-0000-000000000101', 10, false);

COMMIT;
Original file line number Diff line number Diff line change
Expand Up @@ -13,22 +13,22 @@ import javax.inject.Inject
class AssignmentTagApiTest : ApiBaseTest() {

override fun loadTestData(): List<String> {
return arrayListOf("sql/testBaseSamples.sql", "sql/WILL_BE_DELETED_SOON.sql")
return arrayListOf("sql/testBaseSamples.sql")
}

@Inject lateinit var assignmentTagController: AssignmentTagController

var assignmentTagId: UUID = UUID.fromString("00000000-0006-0000-0000-000000000001")
var projectId: UUID = UUID.fromString("00000000-0002-0000-0000-000000000001")
var assignmentTagId: UUID = UUID.fromString("00000000-0006-0000-0000-000000000104")
var projectId: UUID = UUID.fromString("00000000-0002-0000-0000-000000000102")
var name = "New Assignment Tag"
var color = "00ffff"

var name2 = "Changed Assignment Tag"
var color2 = "ffffff"

val LOCAL_ADMIN_ID: UUID = UUID.fromString("00000000-0001-0000-0000-000000000001")
val LOCAL_OBSERVER_ID: UUID = UUID.fromString("00000000-0001-0000-0000-000000000003")
val LOCAL_USER_ID: UUID = UUID.fromString("00000000-0001-0000-0000-000000000002")
val LOCAL_ADMIN_ID: UUID = UUID.fromString("00000000-0001-0000-0000-000000000101")
val LOCAL_OBSERVER_ID: UUID = UUID.fromString("00000000-0001-0000-0000-000000000102")
val LOCAL_USER_ID: UUID = UUID.fromString("00000000-0001-0000-0000-000000000103")

@Test
fun create_assignmenttag_positive() {
Expand Down Expand Up @@ -62,8 +62,8 @@ class AssignmentTagApiTest : ApiBaseTest() {
withUser(LOCAL_USER_ID) { principal ->
val assignmentTag = assignmentTagController.getAssignmentTag(assignmentTagId)

assertEquals(assignmentTag.name, "Implementing")
assertEquals(assignmentTag.color, "0000ff")
assertEquals("dev", assignmentTag.name)
assertEquals("ff0000", assignmentTag.color)
}
}

Expand Down Expand Up @@ -99,7 +99,7 @@ class AssignmentTagApiTest : ApiBaseTest() {
fun list_assignmenttag_positive() {
withUser(LOCAL_USER_ID) { principal ->
val list = assignmentTagController.listAssignmentTags(projectId)
assertEquals(list.size, 6)
assertEquals(3, list.size)
}
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class GetApiTest : ApiBaseTest() {
@Inject lateinit var getController: GetController

override fun loadTestData(): List<String> {
return arrayListOf("sql/testBaseSamples.sql", "sql/WILL_BE_DELETED_SOON.sql")
return arrayListOf("sql/testBaseSamples.sql")
}

@Test
Expand All @@ -25,23 +25,23 @@ class GetApiTest : ApiBaseTest() {
val result = getController.get(
GetRequestJson(
userIds = listOf(
UUID.fromString("93ef43d9-20b7-461a-b960-2d1e89ba099f"),
UUID.fromString("660f2968-aa46-4870-bcc5-a3805366cff2"),
UUID.fromString("99999999-9999-9999-9999-999999999999")),
UUID.fromString("00000000-0001-0000-0000-000000000101"),
UUID.fromString("00000000-0001-0000-0000-000000000102"),
UUID.fromString("00000000-0001-0000-0000-000000000103")),
ticketIds = null,
loggedTimeIds = null,
ticketIdsForStatistic = null),
principal = p
)

assertEquals(2, result.users.size)
assertEquals(3, result.users.size)
assertEquals(0, result.tickets.size)
assertEquals(0, result.ticketStatistics.size)
assertTrue(result.users.containsKey(UUID.fromString("93ef43d9-20b7-461a-b960-2d1e89ba099f")))
assertTrue(result.users.containsKey(UUID.fromString("660f2968-aa46-4870-bcc5-a3805366cff2")))
assertTrue(result.users.containsKey(UUID.fromString("00000000-0001-0000-0000-000000000101")))
assertTrue(result.users.containsKey(UUID.fromString("00000000-0001-0000-0000-000000000102")))

val user = result.users[UUID.fromString("93ef43d9-20b7-461a-b960-2d1e89ba099f")]!!
assertEquals("Michael Heinzl", user.name)
val user = result.users[UUID.fromString("00000000-0001-0000-0000-000000000101")]!!
assertEquals("Admiral Admin", user.name)
}
}

Expand All @@ -57,7 +57,7 @@ class GetApiTest : ApiBaseTest() {
ticketIds = listOf(
firstId,
secondId,
UUID.fromString("99999999-9999-9999-9999-999999999999")),
UUID.fromString("00000000-0001-0000-0000-000000000103")),
ticketIdsForStatistic = null),
principal = p
)
Expand Down Expand Up @@ -85,7 +85,7 @@ class GetApiTest : ApiBaseTest() {
ticketIdsForStatistic = listOf(
firstId,
secondId,
UUID.fromString("99999999-9999-9999-9999-999999999999"))),
UUID.fromString("00000000-0001-0000-0000-000000000103"))),
principal = p
)

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -17,15 +17,15 @@ class LoggedTimeApiTest : ApiBaseTest() {
lateinit var loggedTimeController: LoggedTimeController

override fun loadTestData(): List<String> {
return arrayListOf("sql/testBaseSamples.sql", "sql/WILL_BE_DELETED_SOON.sql")
return arrayListOf("sql/testBaseSamples.sql")
}

@Test
fun `createLoggTime positiv`() {
withUser(ADMIN_ID) { principal ->
val duration = Duration.ofDays(1)
val commentId = UUID.fromString("00000000-0004-0000-0000-000000000001")
val categoryId = UUID.fromString("00000000-0007-0000-0000-000000000001")
val commentId = UUID.fromString("00000000-0004-0000-0000-000000000101")
val categoryId = UUID.fromString("00000000-0007-0000-0000-000000000101")
val req = CreateLoggedTimeJson(duration, commentId,
categoryId)

Expand All @@ -41,8 +41,8 @@ class LoggedTimeApiTest : ApiBaseTest() {
fun `updateLoggTime positiv`() {
withUser(ADMIN_ID) { principal ->
val duration = Duration.ofDays(2)
val categoryId = UUID.fromString("00000000-0007-0000-0000-000000000002")
val loggTimeId = UUID.fromString("00000000-0008-0000-0000-000000000001")
val categoryId = UUID.fromString("00000000-0007-0000-0000-000000000102")
val loggTimeId = UUID.fromString("00000000-0008-0000-0000-000000000101")
val req = UpdateLoggedTimeJson(duration, categoryId, false)
val result = loggedTimeController.updateLoggedTime(req = req, id = loggTimeId)
assertEquals(result.time,(duration))
Expand All @@ -53,7 +53,7 @@ class LoggedTimeApiTest : ApiBaseTest() {
@Test
fun `updateLoggTime canceled`() {
withUser(ADMIN_ID) { principal ->
val loggTimeId = UUID.fromString("00000000-0008-0000-0000-000000000001")
val loggTimeId = UUID.fromString("00000000-0008-0000-0000-000000000101")
val req = UpdateLoggedTimeJson(null, null, true)
val result = loggedTimeController.updateLoggedTime(req = req, id = loggTimeId)
assertEquals(true, result.canceled)
Expand All @@ -71,9 +71,9 @@ class LoggedTimeApiTest : ApiBaseTest() {
@Test
fun `listLoggTime With ProjectId UserId and CategoryId positiv`() {
withUser(ADMIN_ID) { principal ->
val userId = UUID.fromString("660f2968-aa46-4870-bcc5-a3805366cff2")
val projectId = UUID.fromString("00000000-0002-0000-0000-000000000001")
val categoryId = UUID.fromString("00000000-0007-0000-0000-000000000001")
val userId = UUID.fromString("00000000-0001-0000-0000-000000000103")
val projectId = UUID.fromString("00000000-0002-0000-0000-000000000101")
val categoryId = UUID.fromString("00000000-0007-0000-0000-000000000101")
loggedTimeController.getLoggedTimesForProjectAndUserAndCategory(projectId = projectId,
userId = userId, categoryId = categoryId)
}
Expand All @@ -83,8 +83,8 @@ class LoggedTimeApiTest : ApiBaseTest() {
fun `createLoggTime negativ permission`() {
withoutUser { ->
val duration = Duration.ofDays(1)
val commentId = UUID.fromString("00000000-0004-0000-0000-000000000001")
val categoryId = UUID.fromString("00000000-0007-0000-0000-000000000001")
val commentId = UUID.fromString("00000000-0004-0000-0000-000000000101")
val categoryId = UUID.fromString("00000000-0007-0000-0000-000000000101")
val req = CreateLoggedTimeJson(duration, commentId,
categoryId)

Expand All @@ -97,8 +97,8 @@ class LoggedTimeApiTest : ApiBaseTest() {
fun `updateLoggTime negativ permission`() {
withoutUser { ->
val duration = Duration.ofDays(2)
val categoryId = UUID.fromString("00000000-0007-0000-0000-000000000002")
val loggTimeId = UUID.fromString("00000000-0008-0000-0000-000000000001")
val categoryId = UUID.fromString("00000000-0007-0000-0000-000000000102")
val loggTimeId = UUID.fromString("00000000-0008-0000-0000-000000000101")
val req = UpdateLoggedTimeJson(duration, categoryId, false)
loggedTimeController.updateLoggedTime(req = req, id = loggTimeId)

Expand All @@ -116,9 +116,9 @@ class LoggedTimeApiTest : ApiBaseTest() {
@Test(expected = AccessDeniedException::class)
fun `listLoggTime With ProjectId UserId and CategoryId negativ permission`() {
withoutUser { ->
val userId = UUID.fromString("660f2968-aa46-4870-bcc5-a3805366cff2")
val projectId = UUID.fromString("00000000-0002-0000-0000-000000000001")
val categoryId = UUID.fromString("00000000-0007-0000-0000-000000000001")
val userId = UUID.fromString("00000000-0001-0000-0000-000000000103")
val projectId = UUID.fromString("00000000-0002-0000-0000-000000000101")
val categoryId = UUID.fromString("00000000-0007-0000-0000-000000000101")
loggedTimeController.getLoggedTimesForProjectAndUserAndCategory(projectId = projectId,
userId = userId, categoryId = categoryId)
}
Expand Down
Loading

0 comments on commit 3c847bd

Please sign in to comment.