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
80f652f3
Unverified
Commit
80f652f3
authored
Jan 29, 2019
by
Liang Ding
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
🔥
删除冗余代码
parent
2892550f
Changes
3
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
22 additions
and
22 deletions
+22
-22
src/test/java/org/b3log/solo/repository/OptionRepositoryImplTestCase.java
...g/b3log/solo/repository/OptionRepositoryImplTestCase.java
+4
-4
src/test/java/org/b3log/solo/service/OptionMgmtServiceTestCase.java
...ava/org/b3log/solo/service/OptionMgmtServiceTestCase.java
+11
-11
src/test/java/org/b3log/solo/service/OptionQueryServiceTestCase.java
...va/org/b3log/solo/service/OptionQueryServiceTestCase.java
+7
-7
No files found.
src/test/java/org/b3log/solo/repository/OptionRepositoryImplTestCase.java
View file @
80f652f3
...
@@ -29,7 +29,7 @@ import org.testng.annotations.Test;
...
@@ -29,7 +29,7 @@ import org.testng.annotations.Test;
* {@link OptionRepository} test case.
* {@link OptionRepository} 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, Apr 19, 2013
* @version 1.0.0.
1, Jan 29, 2019
* @since 0.6.0
* @since 0.6.0
*/
*/
@Test
(
suiteName
=
"repository"
)
@Test
(
suiteName
=
"repository"
)
...
@@ -45,8 +45,8 @@ public final class OptionRepositoryImplTestCase extends AbstractTestCase {
...
@@ -45,8 +45,8 @@ public final class OptionRepositoryImplTestCase extends AbstractTestCase {
final
OptionRepository
optionRepository
=
getOptionRepository
();
final
OptionRepository
optionRepository
=
getOptionRepository
();
final
JSONObject
option
=
new
JSONObject
();
final
JSONObject
option
=
new
JSONObject
();
option
.
put
(
Keys
.
OBJECT_ID
,
Option
.
ID_C_B
ROADCAST_CHANCE_EXPIRATION_TIM
E
);
option
.
put
(
Keys
.
OBJECT_ID
,
Option
.
ID_C_B
LOG_TITL
E
);
option
.
put
(
Option
.
OPTION_CATEGORY
,
Option
.
CATEGORY_C_
BROADCAST
);
option
.
put
(
Option
.
OPTION_CATEGORY
,
Option
.
CATEGORY_C_
PREFERENCE
);
option
.
put
(
Option
.
OPTION_VALUE
,
0L
);
option
.
put
(
Option
.
OPTION_VALUE
,
0L
);
Transaction
transaction
=
optionRepository
.
beginTransaction
();
Transaction
transaction
=
optionRepository
.
beginTransaction
();
...
@@ -54,6 +54,6 @@ public final class OptionRepositoryImplTestCase extends AbstractTestCase {
...
@@ -54,6 +54,6 @@ public final class OptionRepositoryImplTestCase extends AbstractTestCase {
transaction
.
commit
();
transaction
.
commit
();
Assert
.
assertEquals
(
optionRepository
.
count
(),
1
);
Assert
.
assertEquals
(
optionRepository
.
count
(),
1
);
Assert
.
assertNotNull
(
optionRepository
.
get
(
Option
.
ID_C_B
ROADCAST_CHANCE_EXPIRATION_TIM
E
));
Assert
.
assertNotNull
(
optionRepository
.
get
(
Option
.
ID_C_B
LOG_TITL
E
));
}
}
}
}
src/test/java/org/b3log/solo/service/OptionMgmtServiceTestCase.java
View file @
80f652f3
...
@@ -28,7 +28,7 @@ import org.testng.annotations.Test;
...
@@ -28,7 +28,7 @@ import org.testng.annotations.Test;
* {@link OptionMgmtService} test case.
* {@link OptionMgmtService} 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, Apr 19, 2013
* @version 1.0.0.
1, Jan 29, 2019
* @since 0.6.0
* @since 0.6.0
*/
*/
@Test
(
suiteName
=
"service"
)
@Test
(
suiteName
=
"service"
)
...
@@ -44,15 +44,15 @@ public class OptionMgmtServiceTestCase extends AbstractTestCase {
...
@@ -44,15 +44,15 @@ public class OptionMgmtServiceTestCase extends AbstractTestCase {
final
OptionMgmtService
optionMgmtService
=
getOptionMgmtService
();
final
OptionMgmtService
optionMgmtService
=
getOptionMgmtService
();
final
JSONObject
option
=
new
JSONObject
();
final
JSONObject
option
=
new
JSONObject
();
option
.
put
(
Keys
.
OBJECT_ID
,
Option
.
ID_C_B
ROADCAST_CHANCE_EXPIRATION_TIM
E
);
option
.
put
(
Keys
.
OBJECT_ID
,
Option
.
ID_C_B
LOG_TITL
E
);
option
.
put
(
Option
.
OPTION_CATEGORY
,
Option
.
CATEGORY_C_
BROADCAST
);
option
.
put
(
Option
.
OPTION_CATEGORY
,
Option
.
CATEGORY_C_
PREFERENCE
);
option
.
put
(
Option
.
OPTION_VALUE
,
0L
);
option
.
put
(
Option
.
OPTION_VALUE
,
0L
);
final
String
id
=
optionMgmtService
.
addOrUpdateOption
(
option
);
final
String
id
=
optionMgmtService
.
addOrUpdateOption
(
option
);
//System.out.println(id);
//System.out.println(id);
Assert
.
assertNotNull
(
id
);
Assert
.
assertNotNull
(
id
);
final
JSONObject
opt
=
getOptionQueryService
().
getOptionById
(
Option
.
ID_C_B
ROADCAST_CHANCE_EXPIRATION_TIM
E
);
final
JSONObject
opt
=
getOptionQueryService
().
getOptionById
(
Option
.
ID_C_B
LOG_TITL
E
);
Assert
.
assertEquals
(
opt
.
getInt
(
Option
.
OPTION_VALUE
),
0L
);
Assert
.
assertEquals
(
opt
.
getInt
(
Option
.
OPTION_VALUE
),
0L
);
}
}
...
@@ -66,8 +66,8 @@ public class OptionMgmtServiceTestCase extends AbstractTestCase {
...
@@ -66,8 +66,8 @@ public class OptionMgmtServiceTestCase extends AbstractTestCase {
final
OptionMgmtService
optionMgmtService
=
getOptionMgmtService
();
final
OptionMgmtService
optionMgmtService
=
getOptionMgmtService
();
JSONObject
option
=
new
JSONObject
();
JSONObject
option
=
new
JSONObject
();
option
.
put
(
Keys
.
OBJECT_ID
,
Option
.
ID_C_B
ROADCAST_CHANCE_EXPIRATION_TIM
E
);
option
.
put
(
Keys
.
OBJECT_ID
,
Option
.
ID_C_B
LOG_TITL
E
);
option
.
put
(
Option
.
OPTION_CATEGORY
,
Option
.
CATEGORY_C_
BROADCAST
);
option
.
put
(
Option
.
OPTION_CATEGORY
,
Option
.
CATEGORY_C_
PREFERENCE
);
option
.
put
(
Option
.
OPTION_VALUE
,
0L
);
option
.
put
(
Option
.
OPTION_VALUE
,
0L
);
final
String
id
=
optionMgmtService
.
addOrUpdateOption
(
option
);
// Add
final
String
id
=
optionMgmtService
.
addOrUpdateOption
(
option
);
// Add
...
@@ -75,13 +75,13 @@ public class OptionMgmtServiceTestCase extends AbstractTestCase {
...
@@ -75,13 +75,13 @@ public class OptionMgmtServiceTestCase extends AbstractTestCase {
Assert
.
assertNotNull
(
id
);
Assert
.
assertNotNull
(
id
);
option
=
new
JSONObject
();
option
=
new
JSONObject
();
option
.
put
(
Keys
.
OBJECT_ID
,
Option
.
ID_C_B
ROADCAST_CHANCE_EXPIRATION_TIM
E
);
option
.
put
(
Keys
.
OBJECT_ID
,
Option
.
ID_C_B
LOG_TITL
E
);
option
.
put
(
Option
.
OPTION_CATEGORY
,
Option
.
CATEGORY_C_
BROADCAST
);
option
.
put
(
Option
.
OPTION_CATEGORY
,
Option
.
CATEGORY_C_
PREFERENCE
);
option
.
put
(
Option
.
OPTION_VALUE
,
1L
);
option
.
put
(
Option
.
OPTION_VALUE
,
1L
);
optionMgmtService
.
addOrUpdateOption
(
option
);
// Update
optionMgmtService
.
addOrUpdateOption
(
option
);
// Update
final
JSONObject
opt
=
getOptionQueryService
().
getOptionById
(
Option
.
ID_C_B
ROADCAST_CHANCE_EXPIRATION_TIM
E
);
final
JSONObject
opt
=
getOptionQueryService
().
getOptionById
(
Option
.
ID_C_B
LOG_TITL
E
);
Assert
.
assertEquals
(
opt
.
getInt
(
Option
.
OPTION_VALUE
),
1L
);
Assert
.
assertEquals
(
opt
.
getInt
(
Option
.
OPTION_VALUE
),
1L
);
}
}
...
@@ -95,8 +95,8 @@ public class OptionMgmtServiceTestCase extends AbstractTestCase {
...
@@ -95,8 +95,8 @@ public class OptionMgmtServiceTestCase extends AbstractTestCase {
final
OptionMgmtService
optionMgmtService
=
getOptionMgmtService
();
final
OptionMgmtService
optionMgmtService
=
getOptionMgmtService
();
final
JSONObject
option
=
new
JSONObject
();
final
JSONObject
option
=
new
JSONObject
();
option
.
put
(
Keys
.
OBJECT_ID
,
Option
.
ID_C_B
ROADCAST_CHANCE_EXPIRATION_TIM
E
);
option
.
put
(
Keys
.
OBJECT_ID
,
Option
.
ID_C_B
LOG_TITL
E
);
option
.
put
(
Option
.
OPTION_CATEGORY
,
Option
.
CATEGORY_C_
BROADCAST
);
option
.
put
(
Option
.
OPTION_CATEGORY
,
Option
.
CATEGORY_C_
PREFERENCE
);
option
.
put
(
Option
.
OPTION_VALUE
,
0L
);
option
.
put
(
Option
.
OPTION_VALUE
,
0L
);
final
String
id
=
optionMgmtService
.
addOrUpdateOption
(
option
);
final
String
id
=
optionMgmtService
.
addOrUpdateOption
(
option
);
...
...
src/test/java/org/b3log/solo/service/OptionQueryServiceTestCase.java
View file @
80f652f3
...
@@ -28,7 +28,7 @@ import org.testng.annotations.Test;
...
@@ -28,7 +28,7 @@ import org.testng.annotations.Test;
* {@link OptionQueryService} test case.
* {@link OptionQueryService} 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.
1, Jul 16, 2017
* @version 1.0.0.
2, Jan 29, 2019
* @since 0.6.0
* @since 0.6.0
*/
*/
@Test
(
suiteName
=
"service"
)
@Test
(
suiteName
=
"service"
)
...
@@ -44,15 +44,15 @@ public class OptionQueryServiceTestCase extends AbstractTestCase {
...
@@ -44,15 +44,15 @@ public class OptionQueryServiceTestCase extends AbstractTestCase {
// Check
// Check
final
OptionQueryService
optionQueryService
=
getOptionQueryService
();
final
OptionQueryService
optionQueryService
=
getOptionQueryService
();
JSONObject
options
=
optionQueryService
.
getOptions
(
Option
.
CATEGORY_C_
BROADCAST
);
JSONObject
options
=
optionQueryService
.
getOptions
(
Option
.
CATEGORY_C_
PREFERENCE
);
Assert
.
assertNull
(
options
);
Assert
.
assertNull
(
options
);
// Add one
// Add one
final
OptionMgmtService
optionMgmtService
=
getOptionMgmtService
();
final
OptionMgmtService
optionMgmtService
=
getOptionMgmtService
();
JSONObject
option
=
new
JSONObject
();
JSONObject
option
=
new
JSONObject
();
option
.
put
(
Keys
.
OBJECT_ID
,
Option
.
ID_C_B
ROADCAST_CHANCE_EXPIRATION_TIM
E
);
option
.
put
(
Keys
.
OBJECT_ID
,
Option
.
ID_C_B
LOG_TITL
E
);
option
.
put
(
Option
.
OPTION_CATEGORY
,
Option
.
CATEGORY_C_
BROADCAST
);
option
.
put
(
Option
.
OPTION_CATEGORY
,
Option
.
CATEGORY_C_
PREFERENCE
);
option
.
put
(
Option
.
OPTION_VALUE
,
5L
);
option
.
put
(
Option
.
OPTION_VALUE
,
5L
);
final
String
id
=
optionMgmtService
.
addOrUpdateOption
(
option
);
final
String
id
=
optionMgmtService
.
addOrUpdateOption
(
option
);
...
@@ -60,11 +60,11 @@ public class OptionQueryServiceTestCase extends AbstractTestCase {
...
@@ -60,11 +60,11 @@ public class OptionQueryServiceTestCase extends AbstractTestCase {
// Check again
// Check again
option
=
optionQueryService
.
getOptionById
(
Option
.
ID_C_B
ROADCAST_CHANCE_EXPIRATION_TIM
E
);
option
=
optionQueryService
.
getOptionById
(
Option
.
ID_C_B
LOG_TITL
E
);
Assert
.
assertNotNull
(
option
);
Assert
.
assertNotNull
(
option
);
options
=
optionQueryService
.
getOptions
(
Option
.
CATEGORY_C_
BROADCAST
);
options
=
optionQueryService
.
getOptions
(
Option
.
CATEGORY_C_
PREFERENCE
);
Assert
.
assertNotNull
(
options
);
Assert
.
assertNotNull
(
options
);
Assert
.
assertEquals
(
options
.
optLong
(
Option
.
ID_C_B
ROADCAST_CHANCE_EXPIRATION_TIM
E
),
5L
);
Assert
.
assertEquals
(
options
.
optLong
(
Option
.
ID_C_B
LOG_TITL
E
),
5L
);
}
}
}
}
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