Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
A
ac
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Deploy
Releases
Container registry
Model registry
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
OATS-CADC
ac
Commits
ac715d75
Commit
ac715d75
authored
10 years ago
by
Jeff Burke
Browse files
Options
Downloads
Patches
Plain Diff
s1711: updated unit test
parent
72877d86
No related branches found
No related tags found
No related merge requests found
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
projects/cadcAccessControl-Server/test/src/ca/nrc/cadc/ac/server/web/GroupsActionTest.java
+11
-25
11 additions, 25 deletions
.../test/src/ca/nrc/cadc/ac/server/web/GroupsActionTest.java
with
11 additions
and
25 deletions
projects/cadcAccessControl-Server/test/src/ca/nrc/cadc/ac/server/web/GroupsActionTest.java
+
11
−
25
View file @
ac715d75
...
@@ -106,7 +106,6 @@ public class GroupsActionTest
...
@@ -106,7 +106,6 @@ public class GroupsActionTest
}
}
@Test
@Test
@Ignore
public
void
testDoActionAccessControlException
()
throws
Exception
public
void
testDoActionAccessControlException
()
throws
Exception
{
{
String
message
=
"Permission Denied"
;
String
message
=
"Permission Denied"
;
...
@@ -116,7 +115,6 @@ public class GroupsActionTest
...
@@ -116,7 +115,6 @@ public class GroupsActionTest
}
}
@Test
@Test
@Ignore
public
void
testDoActionIllegalArgumentException
()
throws
Exception
public
void
testDoActionIllegalArgumentException
()
throws
Exception
{
{
String
message
=
"message"
;
String
message
=
"message"
;
...
@@ -126,7 +124,6 @@ public class GroupsActionTest
...
@@ -126,7 +124,6 @@ public class GroupsActionTest
}
}
@Test
@Test
@Ignore
public
void
testDoActionMemberNotFoundException
()
throws
Exception
public
void
testDoActionMemberNotFoundException
()
throws
Exception
{
{
String
message
=
"Member not found: foo"
;
String
message
=
"Member not found: foo"
;
...
@@ -136,7 +133,6 @@ public class GroupsActionTest
...
@@ -136,7 +133,6 @@ public class GroupsActionTest
}
}
@Test
@Test
@Ignore
public
void
testDoActionGroupNotFoundException
()
throws
Exception
public
void
testDoActionGroupNotFoundException
()
throws
Exception
{
{
String
message
=
"Group not found: foo"
;
String
message
=
"Group not found: foo"
;
...
@@ -146,7 +142,6 @@ public class GroupsActionTest
...
@@ -146,7 +142,6 @@ public class GroupsActionTest
}
}
@Test
@Test
@Ignore
public
void
testDoActionUserNotFoundException
()
throws
Exception
public
void
testDoActionUserNotFoundException
()
throws
Exception
{
{
String
message
=
"User not found: foo"
;
String
message
=
"User not found: foo"
;
...
@@ -156,7 +151,6 @@ public class GroupsActionTest
...
@@ -156,7 +151,6 @@ public class GroupsActionTest
}
}
@Test
@Test
@Ignore
public
void
testDoActionMemberAlreadyExistsException
()
throws
Exception
public
void
testDoActionMemberAlreadyExistsException
()
throws
Exception
{
{
String
message
=
"Member already exists: foo"
;
String
message
=
"Member already exists: foo"
;
...
@@ -166,7 +160,6 @@ public class GroupsActionTest
...
@@ -166,7 +160,6 @@ public class GroupsActionTest
}
}
@Test
@Test
@Ignore
public
void
testDoActionGroupAlreadyExistsException
()
throws
Exception
public
void
testDoActionGroupAlreadyExistsException
()
throws
Exception
{
{
String
message
=
"Group already exists: foo"
;
String
message
=
"Group already exists: foo"
;
...
@@ -176,7 +169,6 @@ public class GroupsActionTest
...
@@ -176,7 +169,6 @@ public class GroupsActionTest
}
}
@Test
@Test
@Ignore
public
void
testDoActionUnsupportedOperationException
()
throws
Exception
public
void
testDoActionUnsupportedOperationException
()
throws
Exception
{
{
String
message
=
"Not yet implemented."
;
String
message
=
"Not yet implemented."
;
...
@@ -186,30 +178,26 @@ public class GroupsActionTest
...
@@ -186,30 +178,26 @@ public class GroupsActionTest
}
}
@Test
@Test
@Ignore
public
void
testDoActionTransientException
()
throws
Exception
public
void
testDoActionTransientException
()
throws
Exception
{
{
try
try
{
{
ServletOutputStream
out
=
EasyMock
.
createMock
(
ServletOutputStream
.
class
);
HttpServletResponse
response
=
EasyMock
.
createMock
(
HttpServletResponse
.
class
);
HttpServletResponse
response
=
EasyMock
.
createMock
(
HttpServletResponse
.
class
);
EasyMock
.
expect
(
response
.
isCommitted
()).
andReturn
(
Boolean
.
FALSE
);
EasyMock
.
expect
(
response
.
isCommitted
()).
andReturn
(
Boolean
.
FALSE
);
response
.
set
Header
(
"
Content
-
Type
"
,
"text/plain"
);
response
.
setContentType
(
"text/plain"
);
EasyMock
.
expectLastCall
().
once
();
EasyMock
.
expectLastCall
().
once
();
EasyMock
.
expect
(
response
.
getOutputStream
()).
andReturn
(
out
);
EasyMock
.
expect
(
response
.
getWriter
()).
andReturn
(
new
PrintWriter
(
new
StringWriter
()));
EasyMock
.
expect
(
response
.
getWriter
()).
andReturn
(
new
PrintWriter
(
new
StringWriter
()));
EasyMock
.
expectLastCall
().
once
();
EasyMock
.
expectLastCall
().
once
();
response
.
setStatus
(
503
);
response
.
setStatus
(
503
);
EasyMock
.
expectLastCall
().
once
();
EasyMock
.
expectLastCall
().
once
();
EasyMock
.
replay
(
response
);
GroupLogInfo
logInfo
=
EasyMock
.
createMock
(
GroupLogInfo
.
class
);
GroupLogInfo
logInfo
=
EasyMock
.
createMock
(
GroupLogInfo
.
class
);
logInfo
.
setSuccess
(
false
);
logInfo
.
setSuccess
(
false
);
EasyMock
.
expectLastCall
().
once
();
EasyMock
.
expectLastCall
().
once
();
logInfo
.
setMessage
(
"Internal Transient Error: foo"
);
logInfo
.
setMessage
(
"Internal Transient Error: foo"
);
EasyMock
.
expectLastCall
().
once
();
EasyMock
.
expectLastCall
().
once
();
EasyMock
.
replay
(
logInfo
);
EasyMock
.
replay
(
out
,
response
,
logInfo
);
GroupsActionImpl
action
=
new
GroupsActionImpl
(
logInfo
);
GroupsActionImpl
action
=
new
GroupsActionImpl
(
logInfo
);
action
.
setException
(
new
TransientException
(
"foo"
));
action
.
setException
(
new
TransientException
(
"foo"
));
...
@@ -222,27 +210,25 @@ public class GroupsActionTest
...
@@ -222,27 +210,25 @@ public class GroupsActionTest
}
}
}
}
private
void
testDoAction
(
final
String
message
,
final
int
responseCode
,
final
Exception
e
)
private
void
testDoAction
(
String
message
,
int
responseCode
,
Exception
e
)
throws
Exception
throws
Exception
{
{
try
try
{
{
ServletOutputStream
out
=
EasyMock
.
createMock
(
ServletOutputStream
.
class
);
out
.
write
(
message
.
getBytes
());
EasyMock
.
expectLastCall
().
once
();
HttpServletResponse
response
=
EasyMock
.
createMock
(
HttpServletResponse
.
class
);
HttpServletResponse
response
=
EasyMock
.
createMock
(
HttpServletResponse
.
class
);
response
.
setHeader
(
"Content-Type"
,
"text/plain"
);
EasyMock
.
expect
(
response
.
isCommitted
()).
andReturn
(
Boolean
.
FALSE
);
response
.
setContentType
(
"text/plain"
);
EasyMock
.
expectLastCall
().
once
();
EasyMock
.
expect
(
response
.
getWriter
()).
andReturn
(
new
PrintWriter
(
new
StringWriter
()));
EasyMock
.
expectLastCall
().
once
();
EasyMock
.
expectLastCall
().
once
();
response
.
setStatus
(
responseCode
);
response
.
setStatus
(
responseCode
);
EasyMock
.
expectLastCall
().
once
();
EasyMock
.
expectLastCall
().
once
();
EasyMock
.
expect
(
response
.
getOutputStream
()).
andReturn
(
out
);
EasyMock
.
replay
(
response
);
GroupLogInfo
logInfo
=
EasyMock
.
createMock
(
GroupLogInfo
.
class
);
GroupLogInfo
logInfo
=
EasyMock
.
createMock
(
GroupLogInfo
.
class
);
logInfo
.
setMessage
(
message
);
logInfo
.
setMessage
(
message
);
EasyMock
.
expectLastCall
().
once
();
EasyMock
.
expectLastCall
().
once
();
EasyMock
.
replay
(
logInfo
);
EasyMock
.
replay
(
out
,
response
,
logInfo
);
GroupsActionImpl
action
=
new
GroupsActionImpl
(
logInfo
);
GroupsActionImpl
action
=
new
GroupsActionImpl
(
logInfo
);
action
.
setException
(
e
);
action
.
setException
(
e
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment