Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
S
solo-1
Project overview
Project overview
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Administrator
solo-1
Commits
d8a19e3d
Unverified
Commit
d8a19e3d
authored
Dec 23, 2018
by
Liang Ding
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
💚
修复单元测试
parent
4159beb0
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
33 additions
and
25 deletions
+33
-25
src/main/java/org/b3log/solo/processor/console/PreferenceConsole.java
...a/org/b3log/solo/processor/console/PreferenceConsole.java
+4
-1
src/test/java/org/b3log/solo/processor/console/PreferenceConsoleTestCase.java
...log/solo/processor/console/PreferenceConsoleTestCase.java
+10
-9
src/test/resources/admin-preference.ftl
src/test/resources/admin-preference.ftl
+19
-15
No files found.
src/main/java/org/b3log/solo/processor/console/PreferenceConsole.java
View file @
d8a19e3d
...
@@ -456,7 +456,10 @@ public class PreferenceConsole {
...
@@ -456,7 +456,10 @@ public class PreferenceConsole {
renderer
.
setJSONObject
(
ret
);
renderer
.
setJSONObject
(
ret
);
try
{
try
{
final
JSONObject
requestJSONObject
=
context
.
requestJSON
();
final
JSONObject
requestJSONObject
=
context
.
requestJSON
();
final
String
ossServer
=
requestJSONObject
.
optString
(
ID_C_CLOUD_STORAGE_KEY
).
trim
();
String
ossServer
=
requestJSONObject
.
optString
(
ID_C_CLOUD_STORAGE_KEY
).
trim
();
if
(
StringUtils
.
isBlank
(
ossServer
))
{
ossServer
=
CATEGORY_C_QINIU
;
}
final
String
accessKey
=
requestJSONObject
.
optString
(
"ossAccessKey"
).
trim
();
final
String
accessKey
=
requestJSONObject
.
optString
(
"ossAccessKey"
).
trim
();
final
String
secretKey
=
requestJSONObject
.
optString
(
"ossSecretKey"
).
trim
();
final
String
secretKey
=
requestJSONObject
.
optString
(
"ossSecretKey"
).
trim
();
String
domain
=
requestJSONObject
.
optString
(
"ossDomain"
).
trim
();
String
domain
=
requestJSONObject
.
optString
(
"ossDomain"
).
trim
();
...
...
src/test/java/org/b3log/solo/processor/console/PreferenceConsoleTestCase.java
View file @
d8a19e3d
...
@@ -33,7 +33,7 @@ import java.io.StringReader;
...
@@ -33,7 +33,7 @@ import java.io.StringReader;
* {@link PreferenceConsole} test case.
* {@link PreferenceConsole} test case.
*
*
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @author <a href="http://88250.b3log.org">Liang Ding</a>
* @version 1.0.0.
0, Dec 11
, 2018
* @version 1.0.0.
1, Dec 23
, 2018
* @since 2.9.8
* @since 2.9.8
*/
*/
@Test
(
suiteName
=
"processor"
)
@Test
(
suiteName
=
"processor"
)
...
@@ -159,20 +159,21 @@ public class PreferenceConsoleTestCase extends AbstractTestCase {
...
@@ -159,20 +159,21 @@ public class PreferenceConsoleTestCase extends AbstractTestCase {
}
}
/**
/**
* update
Qiniu
.
* update
Oss
.
*
*
* @throws Exception exception
* @throws Exception exception
*/
*/
@Test
(
dependsOnMethods
=
"init"
)
@Test
(
dependsOnMethods
=
"init"
)
public
void
update
Qiniu
()
throws
Exception
{
public
void
update
Oss
()
throws
Exception
{
final
JSONObject
p
=
new
JSONObject
();
final
JSONObject
p
=
new
JSONObject
();
p
.
put
(
Option
.
ID_C_CLOUD_STORAGE_KEY
,
Option
.
CATEGORY_C_QINIU
);
p
.
put
(
Option
.
ID_C_QINIU_ACCESS_KEY
,
"1"
);
p
.
put
(
Option
.
ID_C_QINIU_ACCESS_KEY
,
"1"
);
p
.
put
(
Option
.
ID_C_QINIU_SECRET_KEY
,
"1"
);
p
.
put
(
Option
.
ID_C_QINIU_SECRET_KEY
,
"1"
);
p
.
put
(
Option
.
ID_C_QINIU_DOMAIN
,
"1"
);
p
.
put
(
Option
.
ID_C_QINIU_DOMAIN
,
"1"
);
p
.
put
(
Option
.
ID_C_QINIU_BUCKET
,
"1"
);
p
.
put
(
Option
.
ID_C_QINIU_BUCKET
,
"1"
);
final
MockHttpServletRequest
request
=
mockRequest
();
final
MockHttpServletRequest
request
=
mockRequest
();
request
.
setRequestURI
(
"/console/preference/
qiniu
"
);
request
.
setRequestURI
(
"/console/preference/
oss
"
);
request
.
setMethod
(
"PUT"
);
request
.
setMethod
(
"PUT"
);
final
BufferedReader
reader
=
new
BufferedReader
(
new
StringReader
(
p
.
toString
()));
final
BufferedReader
reader
=
new
BufferedReader
(
new
StringReader
(
p
.
toString
()));
request
.
setReader
(
reader
);
request
.
setReader
(
reader
);
...
@@ -187,15 +188,15 @@ public class PreferenceConsoleTestCase extends AbstractTestCase {
...
@@ -187,15 +188,15 @@ public class PreferenceConsoleTestCase extends AbstractTestCase {
}
}
/**
/**
* get
Qiniu
Preference.
* get
Oss
Preference.
*
*
* @throws Exception exception
* @throws Exception exception
*/
*/
@Test
(
dependsOnMethods
=
"update
Qiniu
"
)
@Test
(
dependsOnMethods
=
"update
Oss
"
)
public
void
get
Qiniu
Preference
()
throws
Exception
{
public
void
get
Oss
Preference
()
throws
Exception
{
final
MockHttpServletRequest
request
=
mockRequest
();
final
MockHttpServletRequest
request
=
mockRequest
();
request
.
setRequestURI
(
"/console/preference/
qiniu
"
);
request
.
setRequestURI
(
"/console/preference/
oss
"
);
request
.
putParameter
(
Option
.
ID_C_CLOUD_STORAGE_KEY
,
Option
.
CATEGORY_C_QINIU
);
mockAdminLogin
(
request
);
mockAdminLogin
(
request
);
final
MockHttpServletResponse
response
=
mockResponse
();
final
MockHttpServletResponse
response
=
mockResponse
();
...
...
src/test/resources/admin-preference.ftl
View file @
d8a19e3d
...
@@ -40,8 +40,8 @@
...
@@ -40,8 +40,8 @@
</div>
</div>
</li>
</li>
<li>
<li>
<div id="tabPreference_
qiniu
">
<div id="tabPreference_
oss
">
<a href="#toos/preference/
qiniu">${qiniu
Label}</a>
<a href="#toos/preference/
oss">${ossServer
Label}</a>
</div>
</div>
</li>
</li>
<li>
<li>
...
@@ -89,7 +89,7 @@
...
@@ -89,7 +89,7 @@
</select>
</select>
<label for="timeZoneId">${timeZoneId1Label}</label>
<label for="timeZoneId">${timeZoneId1Label}</label>
<select id="timeZoneId">
<select id="timeZoneId">
${timeZoneIdOptions}
${timeZoneIdOptions}
</select>
</select>
<label for="articleListDisplay">${articleListDisplay1Label}</label>
<label for="articleListDisplay">${articleListDisplay1Label}</label>
<select id="articleListDisplay">
<select id="articleListDisplay">
...
@@ -172,21 +172,25 @@
...
@@ -172,21 +172,25 @@
<button onclick="admin.preference.update()" class="right">${updateLabel}</button>
<button onclick="admin.preference.update()" class="right">${updateLabel}</button>
<div class="clear"></div>
<div class="clear"></div>
</div>
</div>
<div id="tabPreferencePanel_
qiniu
" class="none form">
<div id="tabPreferencePanel_
oss
" class="none form">
<span class="right">
<span class="right">
<a href="https://hacpai.com/article/1442418791213" target="_blank">${howConfigLabel}</a>
<a href="https://hacpai.com/article/1442418791213" target="_blank">${howConfigLabel}</a>
<button onclick="admin.preference.update
Qiniu
()">${updateLabel}</button>
<button onclick="admin.preference.update
Oss
()">${updateLabel}</button>
</span>
</span>
${qiniuOssLabel}
<input name="ossServer" id= "qiniuOss" type="radio" value="qiniu" onclick="admin.preference.ossServerChange()"/>
${aliyunOssLabel}
<input name="ossServer" id= "aliyunOss" type="radio" value="aliyun" onclick="admin.preference.ossServerChange()"/>
<div class="clear"></div>
<div class="clear"></div>
<label for="
qiniu
AccessKey">${accessKey1Label}</label>
<label for="
osS
AccessKey">${accessKey1Label}</label>
<input id="
qiniu
AccessKey" type="text"/>
<input id="
oss
AccessKey" type="text"/>
<label for="
qiniu
SecretKey">${secretKey1Label}</label>
<label for="
oss
SecretKey">${secretKey1Label}</label>
<input id="
qiniu
SecretKey" type="text"/>
<input id="
oss
SecretKey" type="text"/>
<label for="
qiniu
Domain">${domain1Label}</label>
<label for="
oss
Domain">${domain1Label}</label>
<input id="
qiniu
Domain" type="text"/>
<input id="
oss
Domain" type="text"/>
<label for="
qiniu
Bucket">${bucket1Label}</label>
<label for="
oss
Bucket">${bucket1Label}</label>
<input id="
qiniu
Bucket" type="text"/>
<input id="
oss
Bucket" type="text"/>
</div>
</div>
</div>
</div>
${plugins}
${plugins}
\ No newline at end of file
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