Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Sign in
Toggle navigation
Menu
Open sidebar
minerva
core
Commits
793b7617
Commit
793b7617
authored
Jun 17, 2021
by
Piotr Gawron
Browse files
name was removed from frontend and db
parent
18e6441b
Changes
9
Hide whitespace changes
Inline
Side-by-side
CHANGELOG
View file @
793b7617
...
...
@@ -12,6 +12,7 @@ minerva (16.0.0~beta.1) stable; urgency=medium
*
Bug
fix
:
overlay
owner
must
be
defined
(#
1488
)
*
Bug
fix
:
there
was
issue
when
upgrading
backgrounds
in
admin
panel
(#
1514
)
*
Bug
fix
:
there
was
issue
when
editing
and
saving
data
overlay
(#
1494
)
*
Bug
fix
:
problem
with
adding
comments
(#
1495
)
--
Piotr
Gawron
<
piotr
.
gawron
@
uni
.
lu
>
Wed
,
9
Jun
2021
15
:
00
:
00
+
0200
...
...
frontend-js/src/main/js/gui/CommentDialog.js
View file @
793b7617
...
...
@@ -12,6 +12,7 @@ var Reaction = require('../map/data/Reaction');
// noinspection JSUnusedLocalSymbols
var
logger
=
require
(
'
../logger
'
);
var
Functions
=
require
(
'
../Functions
'
);
var
GuiConnector
=
require
(
'
../GuiConnector
'
);
/**
*
...
...
@@ -391,7 +392,7 @@ CommentDialog.prototype.addComment = function () {
}
else
{
return
[];
}
});
})
.
catch
(
GuiConnector
.
alert
)
;
};
/**
...
...
frontend-js/src/main/js/map/data/Comment.js
View file @
793b7617
...
...
@@ -25,7 +25,7 @@ function Comment(javaObject) {
this
.
setTitle
(
javaObject
.
title
);
this
.
setContent
(
javaObject
.
content
);
}
this
.
setAuthor
(
javaObject
.
autho
r
);
this
.
setAuthor
(
javaObject
.
owne
r
);
this
.
setEmail
(
javaObject
.
email
);
}
...
...
rest-api/src/main/java/lcsb/mapviewer/api/projects/comments/CommentController.java
View file @
793b7617
...
...
@@ -135,7 +135,6 @@ public class CommentController extends BaseController {
public
Map
<
String
,
Object
>
addCommentForElement
(
@PathVariable
(
value
=
"projectId"
)
String
projectId
,
@PathVariable
(
value
=
"elementId"
)
String
elementId
,
@RequestParam
(
value
=
"name"
)
String
name
,
@RequestParam
(
value
=
"email"
)
String
email
,
@RequestParam
(
value
=
"content"
)
String
content
,
@RequestParam
(
value
=
"pinned"
,
defaultValue
=
"true"
)
String
pinned
,
...
...
@@ -147,7 +146,7 @@ public class CommentController extends BaseController {
if
(
user
.
getLogin
().
equals
(
Configuration
.
ANONYMOUS_LOGIN
))
{
user
=
null
;
}
return
commentController
.
addComment
(
projectId
,
ElementIdentifierType
.
ALIAS
.
getJsName
(),
elementId
,
name
,
return
commentController
.
addComment
(
projectId
,
ElementIdentifierType
.
ALIAS
.
getJsName
(),
elementId
,
email
,
content
,
pinned
.
toLowerCase
().
equals
(
"true"
),
pointCoordinates
,
modelId
,
user
);
}
...
...
@@ -156,7 +155,6 @@ public class CommentController extends BaseController {
public
Map
<
String
,
Object
>
addCommentForReaction
(
@PathVariable
(
value
=
"projectId"
)
String
projectId
,
@PathVariable
(
value
=
"reactionId"
)
String
reactionId
,
@RequestParam
(
value
=
"name"
)
String
name
,
@RequestParam
(
value
=
"email"
)
String
email
,
@RequestParam
(
value
=
"content"
)
String
content
,
@RequestParam
(
value
=
"pinned"
,
defaultValue
=
"true"
)
String
pinned
,
...
...
@@ -167,7 +165,7 @@ public class CommentController extends BaseController {
if
(
user
.
getLogin
().
equals
(
Configuration
.
ANONYMOUS_LOGIN
))
{
user
=
null
;
}
return
commentController
.
addComment
(
projectId
,
ElementIdentifierType
.
REACTION
.
getJsName
(),
reactionId
,
name
,
return
commentController
.
addComment
(
projectId
,
ElementIdentifierType
.
REACTION
.
getJsName
(),
reactionId
,
email
,
content
,
pinned
.
toLowerCase
().
equals
(
"true"
),
pointCoordinates
,
modelId
,
user
);
}
...
...
@@ -175,7 +173,6 @@ public class CommentController extends BaseController {
@PostMapping
(
value
=
"/models/{modelId}/points/{coordinates}"
)
public
Map
<
String
,
Object
>
addCommentForPoint
(
@PathVariable
(
value
=
"projectId"
)
String
projectId
,
@RequestParam
(
value
=
"name"
)
String
name
,
@RequestParam
(
value
=
"email"
)
String
email
,
@RequestParam
(
value
=
"content"
)
String
content
,
@RequestParam
(
value
=
"pinned"
,
defaultValue
=
"true"
)
String
pinned
,
...
...
@@ -186,7 +183,7 @@ public class CommentController extends BaseController {
if
(
user
.
getLogin
().
equals
(
Configuration
.
ANONYMOUS_LOGIN
))
{
user
=
null
;
}
return
commentController
.
addComment
(
projectId
,
ElementIdentifierType
.
POINT
.
getJsName
(),
coordinates
,
name
,
return
commentController
.
addComment
(
projectId
,
ElementIdentifierType
.
POINT
.
getJsName
(),
coordinates
,
email
,
content
,
pinned
.
toLowerCase
().
equals
(
"true"
),
pointCoordinates
,
modelId
,
user
);
}
...
...
rest-api/src/main/java/lcsb/mapviewer/api/projects/comments/CommentRestImpl.java
View file @
793b7617
...
...
@@ -138,9 +138,6 @@ public class CommentRestImpl extends BaseRestImpl {
case
"icon"
:
value
=
"icons/comment.png?v="
+
Configuration
.
getSystemBuildVersion
(
null
);
break
;
case
"author"
:
value
=
result
.
get
(
"owner"
);
break
;
case
"email"
:
value
=
comment
.
getEmail
();
break
;
...
...
@@ -238,7 +235,7 @@ public class CommentRestImpl extends BaseRestImpl {
}
public
Map
<
String
,
Object
>
addComment
(
String
projectId
,
String
elementType
,
String
elementId
,
String
name
,
String
email
,
String
content
,
boolean
pinned
,
Point2D
pointCoordinates
,
String
submodelId
,
String
email
,
String
content
,
boolean
pinned
,
Point2D
pointCoordinates
,
String
submodelId
,
User
owner
)
throws
QueryException
{
Project
project
=
getProjectService
().
getProjectByProjectId
(
projectId
);
...
...
@@ -259,14 +256,11 @@ public class CommentRestImpl extends BaseRestImpl {
}
else
{
throw
new
QueryException
(
"Unknown type of commented object: "
+
elementType
);
}
if
(
name
==
null
||
name
.
length
()
>
255
)
{
throw
new
QueryException
(
"name too long"
);
}
if
(
email
==
null
||
email
.
length
()
>
255
)
{
throw
new
QueryException
(
"email too long"
);
}
Comment
comment
=
commentService
.
addComment
(
name
,
email
,
content
,
pointCoordinates
,
commentedObject
,
pinned
,
Comment
comment
=
commentService
.
addComment
(
email
,
content
,
pointCoordinates
,
commentedObject
,
pinned
,
modelId
,
owner
);
return
preparedComment
(
comment
,
createCommentColumnSet
(
""
));
...
...
@@ -315,8 +309,8 @@ public class CommentRestImpl extends BaseRestImpl {
columns
.
add
(
"elementId"
);
columns
.
add
(
"id"
);
columns
.
add
(
"pinned"
);
columns
.
add
(
"author"
);
columns
.
add
(
"email"
);
columns
.
add
(
"owner"
);
columns
.
add
(
"removeReason"
);
return
columns
;
}
...
...
service/src/main/java/lcsb/mapviewer/services/impl/CommentService.java
View file @
793b7617
...
...
@@ -81,7 +81,7 @@ public class CommentService implements ICommentService {
}
@Override
public
Comment
addComment
(
String
name
,
String
email
,
String
content
,
Point2D
coordinates
,
Object
object
,
public
Comment
addComment
(
String
email
,
String
content
,
Point2D
coordinates
,
Object
object
,
boolean
pinned
,
int
mapId
,
User
owner
)
{
ModelData
map
=
mapDao
.
getById
(
mapId
);
Comment
comment
=
new
Comment
();
...
...
service/src/main/java/lcsb/mapviewer/services/interfaces/ICommentService.java
View file @
793b7617
...
...
@@ -25,8 +25,6 @@ public interface ICommentService {
* @param object
* determines which object is commented - it could be null; in this
* case it means that a comment is general one.
* @param name
* name of person that comments
* @param email
* email of the person that comments
* @param content
...
...
@@ -38,7 +36,7 @@ public interface ICommentService {
*
* @return comment object created based on the data provided as parameters
*/
Comment
addComment
(
String
name
,
String
email
,
String
content
,
Point2D
coordinates
,
Object
object
,
Comment
addComment
(
String
email
,
String
content
,
Point2D
coordinates
,
Object
object
,
boolean
pinned
,
int
mapId
,
User
owner
);
/**
...
...
service/src/test/java/lcsb/mapviewer/services/impl/CommentServiceTest.java
View file @
793b7617
...
...
@@ -76,15 +76,15 @@ public class CommentServiceTest extends ServiceTestFunctions {
@Test
public
void
testGetAgregatedComments
()
throws
Exception
{
commentService
.
addComment
(
"John Doe"
,
"a@a.pl"
,
"Conteneta 1"
,
new
Point2D
.
Double
(
0
,
1
),
alias
,
false
,
model
.
getId
(),
commentService
.
addComment
(
"a@a.pl"
,
"Conteneta 1"
,
new
Point2D
.
Double
(
0
,
1
),
alias
,
false
,
model
.
getId
(),
userDao
.
getUserByLogin
(
ADMIN_BUILT_IN_LOGIN
));
commentService
.
addComment
(
"John Doe"
,
"a@a.pl"
,
"Contenetb 2"
,
new
Point2D
.
Double
(
0
,
2
),
alias
,
false
,
model
.
getId
(),
commentService
.
addComment
(
"a@a.pl"
,
"Contenetb 2"
,
new
Point2D
.
Double
(
0
,
2
),
alias
,
false
,
model
.
getId
(),
userDao
.
getUserByLogin
(
ADMIN_BUILT_IN_LOGIN
));
commentService
.
addComment
(
"John Doe"
,
"a@a.pl"
,
"Contenetc 3"
,
new
Point2D
.
Double
(
0
,
3
),
alias2
,
false
,
model
.
getId
(),
commentService
.
addComment
(
"a@a.pl"
,
"Contenetc 3"
,
new
Point2D
.
Double
(
0
,
3
),
alias2
,
false
,
model
.
getId
(),
userDao
.
getUserByLogin
(
ADMIN_BUILT_IN_LOGIN
));
commentService
.
addComment
(
"John Doe"
,
"a@a.pl"
,
"Contenetc 4"
,
new
Point2D
.
Double
(
0
,
4
),
null
,
false
,
model
.
getId
(),
commentService
.
addComment
(
"a@a.pl"
,
"Contenetc 4"
,
new
Point2D
.
Double
(
0
,
4
),
null
,
false
,
model
.
getId
(),
userDao
.
getUserByLogin
(
ADMIN_BUILT_IN_LOGIN
));
commentService
.
addComment
(
"John Doe"
,
"a@a.pl"
,
"Contenetc 5"
,
new
Point2D
.
Double
(
0
,
5
),
null
,
false
,
model
.
getId
(),
commentService
.
addComment
(
"a@a.pl"
,
"Contenetc 5"
,
new
Point2D
.
Double
(
0
,
5
),
null
,
false
,
model
.
getId
(),
userDao
.
getUserByLogin
(
ADMIN_BUILT_IN_LOGIN
));
CommentService
service
=
new
CommentService
(
null
,
null
,
null
,
null
,
null
);
service
.
setCommentDao
(
commentDao
);
...
...
@@ -106,7 +106,7 @@ public class CommentServiceTest extends ServiceTestFunctions {
@Test
public
void
testAddComment
()
throws
Exception
{
long
counter
=
commentService
.
getCommentCount
();
Comment
feedback
=
commentService
.
addComment
(
"a"
,
"b"
,
"c"
,
new
Point2D
.
Double
(
0
,
0
),
null
,
false
,
model
.
getId
(),
Comment
feedback
=
commentService
.
addComment
(
"b"
,
"c"
,
new
Point2D
.
Double
(
0
,
0
),
null
,
false
,
model
.
getId
(),
userDao
.
getUserByLogin
(
ADMIN_BUILT_IN_LOGIN
));
long
counter2
=
commentService
.
getCommentCount
();
assertEquals
(
counter
+
1
,
counter2
);
...
...
@@ -116,7 +116,7 @@ public class CommentServiceTest extends ServiceTestFunctions {
@Test
public
void
testAddCommentForReaction
()
throws
Exception
{
long
counter
=
commentService
.
getCommentCount
();
Comment
feedback
=
commentService
.
addComment
(
"a"
,
"b"
,
"c"
,
new
Point2D
.
Double
(
0
,
0
),
Comment
feedback
=
commentService
.
addComment
(
"b"
,
"c"
,
new
Point2D
.
Double
(
0
,
0
),
model
.
getReactions
().
iterator
().
next
(),
false
,
model
.
getId
(),
userDao
.
getUserByLogin
(
ADMIN_BUILT_IN_LOGIN
));
long
counter2
=
commentService
.
getCommentCount
();
assertEquals
(
counter
+
1
,
counter2
);
...
...
@@ -127,7 +127,7 @@ public class CommentServiceTest extends ServiceTestFunctions {
public
void
testAddCommentForAlias
()
throws
Exception
{
Element
alias
=
model
.
getElementByElementId
(
"sa1"
);
long
counter
=
commentService
.
getCommentCount
();
Comment
feedback
=
commentService
.
addComment
(
"a"
,
"b"
,
"c"
,
new
Point2D
.
Double
(
0
,
0
),
alias
,
false
,
model
.
getId
(),
Comment
feedback
=
commentService
.
addComment
(
"b"
,
"c"
,
new
Point2D
.
Double
(
0
,
0
),
alias
,
false
,
model
.
getId
(),
userDao
.
getUserByLogin
(
ADMIN_BUILT_IN_LOGIN
));
long
counter2
=
commentService
.
getCommentCount
();
assertEquals
(
counter
+
1
,
counter2
);
...
...
@@ -136,13 +136,13 @@ public class CommentServiceTest extends ServiceTestFunctions {
@Test
public
void
testComparePointCommentId
()
throws
Exception
{
CommentService
cs
=
new
CommentService
(
null
,
null
,
null
,
null
,
null
);
CommentService
cs
=
new
CommentService
(
null
,
null
,
null
,
null
,
null
);
assertTrue
(
cs
.
equalPoints
(
"Point2D.Double[117.685546875, 204.6923828125001]"
,
"(117.69, 204.69)"
));
}
@Test
public
void
testComparePointCommentId2
()
throws
Exception
{
CommentService
cs
=
new
CommentService
(
null
,
null
,
null
,
null
,
null
);
CommentService
cs
=
new
CommentService
(
null
,
null
,
null
,
null
,
null
);
assertFalse
(
cs
.
equalPoints
(
"Point2D.Double[118.685546875, 204.6923828125001]"
,
"(117.69, 204.69)"
));
}
...
...
web/src/test/java/lcsb/mapviewer/web/CommentControllerIntegrationTest.java
View file @
793b7617
...
...
@@ -149,10 +149,6 @@ public class CommentControllerIntegrationTest extends ControllerIntegrationTest
private
List
<
FieldDescriptor
>
getCommentResponseFields
()
{
return
Arrays
.
asList
(
fieldWithPath
(
"author"
)
.
description
(
"author name"
)
.
optional
()
.
type
(
"string"
),
fieldWithPath
(
"owner"
)
.
description
(
"login of the user that created a comment"
)
.
optional
()
...
...
@@ -322,7 +318,6 @@ public class CommentControllerIntegrationTest extends ControllerIntegrationTest
.
andExpect
(
status
().
is2xxSuccessful
())
.
andReturn
().
getResponse
().
getContentAsString
();
assertFalse
(
"Normal user shouldn't see author name"
,
response
.
contains
(
"author name"
));
assertFalse
(
"Normal user shouldn't see author email"
,
response
.
contains
(
"email"
));
assertFalse
(
"Normal user shouldn't see remove reason"
,
response
.
contains
(
"removeReason"
));
...
...
@@ -432,8 +427,8 @@ public class CommentControllerIntegrationTest extends ControllerIntegrationTest
mockMvc
.
perform
(
request
)
.
andExpect
(
status
().
is2xxSuccessful
());
comment
=
commentService
.
getCommentById
(
comment
.
getId
()
+
""
);
comment
=
commentService
.
getCommentById
(
comment
.
getId
()
+
""
);
assertEquals
(
true
,
comment
.
isDeleted
());
}
...
...
@@ -441,7 +436,7 @@ public class CommentControllerIntegrationTest extends ControllerIntegrationTest
public
void
testRemoveAsCuratorWithoutAccess
()
throws
Exception
{
userService
.
revokeUserPrivilege
(
curator
,
PrivilegeType
.
READ_PROJECT
,
project
.
getProjectId
());
userService
.
revokeUserPrivilege
(
curator
,
PrivilegeType
.
WRITE_PROJECT
,
project
.
getProjectId
());
MockHttpSession
session
=
createSession
(
TEST_CURATOR_LOGIN
,
TEST_CURATOR_PASSWORD
);
Comment
comment
=
createCommentInSeparateThread
(
map
,
null
);
...
...
@@ -709,7 +704,6 @@ public class CommentControllerIntegrationTest extends ControllerIntegrationTest
MockHttpSession
session
=
createSession
(
TEST_USER_LOGIN
,
TEST_USER_PASSWORD
);
String
body
=
EntityUtils
.
toString
(
new
UrlEncodedFormEntity
(
Arrays
.
asList
(
new
BasicNameValuePair
(
"name"
,
"test_user"
),
new
BasicNameValuePair
(
"email"
,
"a@a.lu"
),
new
BasicNameValuePair
(
"content"
,
"tes content"
),
new
BasicNameValuePair
(
"pinned"
,
"true"
),
...
...
@@ -742,8 +736,6 @@ public class CommentControllerIntegrationTest extends ControllerIntegrationTest
return
requestParameters
(
parameterWithName
(
"modelId"
)
.
description
(
"map identifier"
),
parameterWithName
(
"name"
)
.
description
(
"user name"
),
parameterWithName
(
"content"
)
.
description
(
"content"
),
parameterWithName
(
"email"
)
...
...
@@ -758,7 +750,6 @@ public class CommentControllerIntegrationTest extends ControllerIntegrationTest
@Test
public
void
testAddElementCommentAsAnonymous
()
throws
Exception
{
String
body
=
EntityUtils
.
toString
(
new
UrlEncodedFormEntity
(
Arrays
.
asList
(
new
BasicNameValuePair
(
"name"
,
"test_user"
),
new
BasicNameValuePair
(
"email"
,
"a@a.lu"
),
new
BasicNameValuePair
(
"content"
,
"tes content"
),
new
BasicNameValuePair
(
"pinned"
,
"true"
),
...
...
@@ -788,7 +779,6 @@ public class CommentControllerIntegrationTest extends ControllerIntegrationTest
MockHttpSession
session
=
createSession
(
BUILT_IN_TEST_ADMIN_LOGIN
,
BUILT_IN_TEST_ADMIN_PASSWORD
);
String
body
=
EntityUtils
.
toString
(
new
UrlEncodedFormEntity
(
Arrays
.
asList
(
new
BasicNameValuePair
(
"name"
,
"test_user"
),
new
BasicNameValuePair
(
"email"
,
"a@a.lu"
),
new
BasicNameValuePair
(
"content"
,
"tes content"
),
new
BasicNameValuePair
(
"pinned"
,
"true"
),
...
...
@@ -810,7 +800,6 @@ public class CommentControllerIntegrationTest extends ControllerIntegrationTest
MockHttpSession
session
=
createSession
(
TEST_USER_LOGIN
,
TEST_USER_PASSWORD
);
String
body
=
EntityUtils
.
toString
(
new
UrlEncodedFormEntity
(
Arrays
.
asList
(
new
BasicNameValuePair
(
"name"
,
"test_user"
),
new
BasicNameValuePair
(
"modelId"
,
map
.
getId
().
toString
()))));
RequestBuilder
request
=
post
(
...
...
@@ -828,7 +817,6 @@ public class CommentControllerIntegrationTest extends ControllerIntegrationTest
MockHttpSession
session
=
createSession
(
BUILT_IN_TEST_ADMIN_LOGIN
,
BUILT_IN_TEST_ADMIN_PASSWORD
);
String
body
=
EntityUtils
.
toString
(
new
UrlEncodedFormEntity
(
Arrays
.
asList
(
new
BasicNameValuePair
(
"name"
,
"test_user"
),
new
BasicNameValuePair
(
"email"
,
"a@a.lu"
),
new
BasicNameValuePair
(
"content"
,
"tes content"
),
new
BasicNameValuePair
(
"pinned"
,
"true"
),
...
...
@@ -853,7 +841,6 @@ public class CommentControllerIntegrationTest extends ControllerIntegrationTest
MockHttpSession
session
=
createSession
(
TEST_USER_LOGIN
,
TEST_USER_PASSWORD
);
String
body
=
EntityUtils
.
toString
(
new
UrlEncodedFormEntity
(
Arrays
.
asList
(
new
BasicNameValuePair
(
"name"
,
"test_user"
),
new
BasicNameValuePair
(
"email"
,
"a@a.lu"
),
new
BasicNameValuePair
(
"content"
,
"tes content"
),
new
BasicNameValuePair
(
"pinned"
,
"true"
),
...
...
@@ -883,7 +870,6 @@ public class CommentControllerIntegrationTest extends ControllerIntegrationTest
MockHttpSession
session
=
createSession
(
BUILT_IN_TEST_ADMIN_LOGIN
,
BUILT_IN_TEST_ADMIN_PASSWORD
);
String
body
=
EntityUtils
.
toString
(
new
UrlEncodedFormEntity
(
Arrays
.
asList
(
new
BasicNameValuePair
(
"name"
,
"test_user"
),
new
BasicNameValuePair
(
"email"
,
"a@a.lu"
),
new
BasicNameValuePair
(
"content"
,
"tes content"
),
new
BasicNameValuePair
(
"pinned"
,
"true"
),
...
...
@@ -908,7 +894,6 @@ public class CommentControllerIntegrationTest extends ControllerIntegrationTest
MockHttpSession
session
=
createSession
(
BUILT_IN_TEST_ADMIN_LOGIN
,
BUILT_IN_TEST_ADMIN_PASSWORD
);
String
body
=
EntityUtils
.
toString
(
new
UrlEncodedFormEntity
(
Arrays
.
asList
(
new
BasicNameValuePair
(
"name"
,
"test_user"
),
new
BasicNameValuePair
(
"email"
,
"a@a.lu"
),
new
BasicNameValuePair
(
"content"
,
"tes content"
),
new
BasicNameValuePair
(
"pinned"
,
"true"
),
...
...
@@ -930,7 +915,6 @@ public class CommentControllerIntegrationTest extends ControllerIntegrationTest
MockHttpSession
session
=
createSession
(
TEST_USER_LOGIN
,
TEST_USER_PASSWORD
);
String
body
=
EntityUtils
.
toString
(
new
UrlEncodedFormEntity
(
Arrays
.
asList
(
new
BasicNameValuePair
(
"name"
,
"test_user"
),
new
BasicNameValuePair
(
"email"
,
"a@a.lu"
),
new
BasicNameValuePair
(
"content"
,
"tes content"
),
new
BasicNameValuePair
(
"pinned"
,
"true"
),
...
...
@@ -959,7 +943,6 @@ public class CommentControllerIntegrationTest extends ControllerIntegrationTest
MockHttpSession
session
=
createSession
(
BUILT_IN_TEST_ADMIN_LOGIN
,
BUILT_IN_TEST_ADMIN_PASSWORD
);
String
body
=
EntityUtils
.
toString
(
new
UrlEncodedFormEntity
(
Arrays
.
asList
(
new
BasicNameValuePair
(
"name"
,
"test_user"
),
new
BasicNameValuePair
(
"email"
,
"a@a.lu"
),
new
BasicNameValuePair
(
"content"
,
"tes content"
),
new
BasicNameValuePair
(
"pinned"
,
"true"
),
...
...
@@ -983,7 +966,6 @@ public class CommentControllerIntegrationTest extends ControllerIntegrationTest
MockHttpSession
session
=
createSession
(
BUILT_IN_TEST_ADMIN_LOGIN
,
BUILT_IN_TEST_ADMIN_PASSWORD
);
String
body
=
EntityUtils
.
toString
(
new
UrlEncodedFormEntity
(
Arrays
.
asList
(
new
BasicNameValuePair
(
"name"
,
"test_user"
),
new
BasicNameValuePair
(
"email"
,
"a@a.lu"
),
new
BasicNameValuePair
(
"content"
,
"tes content"
),
new
BasicNameValuePair
(
"pinned"
,
"true"
),
...
...
@@ -1058,7 +1040,7 @@ public class CommentControllerIntegrationTest extends ControllerIntegrationTest
String
invalidString
=
new
String
(
new
char
[
1024
]).
replace
(
'\0'
,
'x'
);
for
(
String
type
:
new
String
[]
{
"name"
,
"email"
})
{
for
(
String
type
:
new
String
[]
{
"email"
})
{
String
body
=
createContentBody
(
type
,
invalidString
);
RequestBuilder
request
=
post
(
...
...
@@ -1074,7 +1056,6 @@ public class CommentControllerIntegrationTest extends ControllerIntegrationTest
private
String
createContentBody
(
String
type
,
String
value
)
throws
IOException
,
UnsupportedEncodingException
{
List
<
BasicNameValuePair
>
params
=
new
ArrayList
<>(
Arrays
.
asList
(
new
BasicNameValuePair
(
"name"
,
"name"
),
new
BasicNameValuePair
(
"email"
,
"a@a.lu"
),
new
BasicNameValuePair
(
"content"
,
"tes content"
),
new
BasicNameValuePair
(
"pinned"
,
"true"
),
...
...
@@ -1100,7 +1081,7 @@ public class CommentControllerIntegrationTest extends ControllerIntegrationTest
mockMvc
.
perform
(
request
)
.
andExpect
(
status
().
is4xxClientError
());
}
@Test
public
void
testRemoveCommentAsUserWithAccess
()
throws
Exception
{
MockHttpSession
session
=
createSession
(
TEST_USER_LOGIN
,
TEST_USER_PASSWORD
);
...
...
@@ -1114,5 +1095,4 @@ public class CommentControllerIntegrationTest extends ControllerIntegrationTest
.
andExpect
(
status
().
is2xxSuccessful
());
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment