Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
ARSnova Backend
Manage
Activity
Members
Labels
Code
Merge requests
0
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Operate
Environments
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Help
Help
Support
GitLab documentation
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Privacy
Imprint
Contact
Snippets
Groups
Projects
Show more breadcrumbs
Paul-Christian Volkmer
ARSnova Backend
Commits
0965f979
Commit
0965f979
authored
10 years ago
by
Christoph Thelen
Browse files
Options
Downloads
Patches
Plain Diff
Add support for "include_docs" parameter on CouchDB views
parent
1602d355
Branches
Branches containing commit
Tags
Tags containing commit
No related merge requests found
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
src/main/java/de/thm/arsnova/dao/NovaView.java
+16
-0
16 additions, 0 deletions
src/main/java/de/thm/arsnova/dao/NovaView.java
src/test/java/de/thm/arsnova/dao/NovaViewTest.java
+12
-0
12 additions, 0 deletions
src/test/java/de/thm/arsnova/dao/NovaViewTest.java
with
28 additions
and
0 deletions
src/main/java/de/thm/arsnova/dao/NovaView.java
+
16
−
0
View file @
0965f979
...
...
@@ -36,6 +36,16 @@ public class NovaView extends View {
protected
StaleMode
stale
=
StaleMode
.
NONE
;
protected
boolean
includeDocs
=
false
;
public
boolean
isIncludeDocs
()
{
return
includeDocs
;
}
public
void
setIncludeDocs
(
boolean
includeDocs
)
{
this
.
includeDocs
=
includeDocs
;
}
public
NovaView
(
final
String
fullname
)
{
super
(
fullname
);
}
...
...
@@ -122,6 +132,12 @@ public class NovaView extends View {
query
.
append
(
"stale=update_after"
);
}
}
if
(
includeDocs
!=
false
)
{
if
(
query
.
length
()
>
0
)
{
query
.
append
(
"&"
);
}
query
.
append
(
"include_docs=true"
);
}
if
(
query
.
length
()
==
0
)
{
return
null
;
...
...
This diff is collapsed.
Click to expand it.
src/test/java/de/thm/arsnova/dao/NovaViewTest.java
+
12
−
0
View file @
0965f979
...
...
@@ -149,6 +149,18 @@ public class NovaViewTest {
assertNull
(
v4
.
getQueryString
());
}
@Test
public
void
shouldSupportIncludeDocsParameter
()
{
final
NovaView
v1
=
new
NovaView
(
null
);
final
NovaView
v2
=
new
NovaView
(
null
);
final
NovaView
v3
=
new
NovaView
(
null
);
v1
.
setIncludeDocs
(
true
);
v2
.
setIncludeDocs
(
false
);
assertEncodedEquals
(
"include_docs"
,
"true"
,
v1
.
getQueryString
());
assertNull
(
v2
.
getQueryString
());
assertNull
(
v3
.
getQueryString
());
}
private
void
assertEncodedEquals
(
final
String
key
,
final
String
expected
,
final
String
actual
)
{
try
{
assertEquals
(
key
+
"="
+
URLEncoder
.
encode
(
expected
,
"UTF-8"
),
actual
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
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