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
c3574d1a
Commit
c3574d1a
authored
Jun 28, 2012
by
Liang Ding
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
c
parent
b9b2d102
Changes
3
Expand all
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
590 additions
and
1038 deletions
+590
-1038
core/src/main/java/org/b3log/solo/service/TagQueryService.java
...src/main/java/org/b3log/solo/service/TagQueryService.java
+167
-183
core/src/main/java/org/b3log/solo/util/Articles.java
core/src/main/java/org/b3log/solo/util/Articles.java
+324
-642
core/src/test/java/org/b3log/solo/repository/impl/UserRepositoryImplTestCase.java
...3log/solo/repository/impl/UserRepositoryImplTestCase.java
+99
-213
No files found.
core/src/main/java/org/b3log/solo/service/TagQueryService.java
View file @
c3574d1a
...
@@ -33,11 +33,7 @@ import org.json.JSONObject;
...
@@ -33,11 +33,7 @@ import org.json.JSONObject;
* Tag query service.
* Tag query service.
*
*
* @author <a href="mailto:DL88250@gmail.com">Liang Ding</a>
* @author <a href="mailto:DL88250@gmail.com">Liang Ding</a>
<<<<<<< HEAD
* @version 1.0.0.2, Nov 11, 2011
=======
* @version 1.0.0.3, Jun 28, 2012
* @version 1.0.0.3, Jun 28, 2012
>>>>>>> origin/0.4.6
* @since 0.4.0
* @since 0.4.0
*/
*/
public
final
class
TagQueryService
{
public
final
class
TagQueryService
{
...
@@ -45,12 +41,7 @@ public final class TagQueryService {
...
@@ -45,12 +41,7 @@ public final class TagQueryService {
/**
/**
* Logger.
* Logger.
*/
*/
<<<<<<<
HEAD
private
static
final
Logger
LOGGER
=
Logger
.
getLogger
(
TagQueryService
.
class
.
getName
());
=======
private
static
final
Logger
LOGGER
=
Logger
.
getLogger
(
TagQueryService
.
class
.
getName
());
private
static
final
Logger
LOGGER
=
Logger
.
getLogger
(
TagQueryService
.
class
.
getName
());
>>>>>>>
origin
/
0.4
.
6
/**
/**
* Tag repository.
* Tag repository.
*/
*/
...
@@ -73,12 +64,7 @@ public final class TagQueryService {
...
@@ -73,12 +64,7 @@ public final class TagQueryService {
* </pre>, returns {@code null} if not found
* </pre>, returns {@code null} if not found
* @throws ServiceException service exception
* @throws ServiceException service exception
*/
*/
<<<<<<<
HEAD
public
JSONObject
getTagByTitle
(
final
String
tagTitle
)
throws
ServiceException
{
=======
public
JSONObject
getTagByTitle
(
final
String
tagTitle
)
throws
ServiceException
{
public
JSONObject
getTagByTitle
(
final
String
tagTitle
)
throws
ServiceException
{
>>>>>>>
origin
/
0.4
.
6
try
{
try
{
final
JSONObject
ret
=
new
JSONObject
();
final
JSONObject
ret
=
new
JSONObject
();
...
@@ -100,8 +86,6 @@ public final class TagQueryService {
...
@@ -100,8 +86,6 @@ public final class TagQueryService {
}
}
/**
/**
<<<<<<< HEAD
=======
* Gets the count of tags.
* Gets the count of tags.
*
*
* @return count of tags
* @return count of tags
...
@@ -118,7 +102,7 @@ public final class TagQueryService {
...
@@ -118,7 +102,7 @@ public final class TagQueryService {
}
}
/**
/**
>>>>>>> origin/0.4.6
>>>>>>> origin/0.4.6
* Gets all tags.
* Gets all tags.
*
*
* @return for example,
* @return for example,
...
...
core/src/main/java/org/b3log/solo/util/Articles.java
View file @
c3574d1a
This diff is collapsed.
Click to expand it.
core/src/test/java/org/b3log/solo/repository/impl/UserRepositoryImplTestCase.java
View file @
c3574d1a
<<<<<<<
HEAD
<<<<<<<
HEAD
/*
* Copyright (c) 2009, 2010, 2011, 2012, B3log Team
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package
org
.
b3log
.
solo
.
repository
.
impl
;
import
org.b3log.latke.Keys
;
import
org.b3log.latke.model.Role
;
import
org.b3log.latke.model.User
;
import
org.b3log.latke.repository.FilterOperator
;
import
org.b3log.latke.repository.Query
;
import
org.b3log.latke.repository.Transaction
;
import
org.b3log.solo.AbstractTestCase
;
import
org.b3log.solo.model.UserExt
;
import
org.b3log.solo.repository.UserRepository
;
import
org.json.JSONArray
;
import
org.json.JSONObject
;
import
org.testng.Assert
;
import
org.testng.annotations.Test
;
/**
* {@link UserRepositoryImpl} test case.
*
* @author <a href="mailto:DL88250@gmail.com">Liang Ding</a>
* @version 1.0.0.1, Feb 21, 2012
*/
@Test
(
suiteName
=
"repository"
)
public
final
class
UserRepositoryImplTestCase
extends
AbstractTestCase
{
/**
* Tests.
*
* @throws Exception exception
*/
@Test
public
void
test
()
throws
Exception
{
final
UserRepository
userRepository
=
getUserRepository
();
final
JSONObject
another
=
new
JSONObject
();
another
.
put
(
User
.
USER_NAME
,
"test1"
);
another
.
put
(
User
.
USER_EMAIL
,
"test1@gmail.com"
);
another
.
put
(
User
.
USER_PASSWORD
,
"pass1"
);
another
.
put
(
User
.
USER_ROLE
,
Role
.
DEFAULT_ROLE
);
another
.
put
(
UserExt
.
USER_ARTICLE_COUNT
,
0
);
another
.
put
(
UserExt
.
USER_PUBLISHED_ARTICLE_COUNT
,
0
);
Transaction
transaction
=
userRepository
.
beginTransaction
();
userRepository
.
add
(
another
);
transaction
.
commit
();
Assert
.
assertNull
(
userRepository
.
getAdmin
());
JSONObject
admin
=
new
JSONObject
();
admin
.
put
(
User
.
USER_NAME
,
"test"
);
admin
.
put
(
User
.
USER_EMAIL
,
"test@gmail.com"
);
admin
.
put
(
User
.
USER_PASSWORD
,
"pass"
);
admin
.
put
(
User
.
USER_ROLE
,
Role
.
ADMIN_ROLE
);
admin
.
put
(
UserExt
.
USER_ARTICLE_COUNT
,
0
);
admin
.
put
(
UserExt
.
USER_PUBLISHED_ARTICLE_COUNT
,
0
);
transaction
=
userRepository
.
beginTransaction
();
userRepository
.
add
(
admin
);
transaction
.
commit
();
Assert
.
assertTrue
(
userRepository
.
isAdminEmail
(
"test@gmail.com"
));
Assert
.
assertFalse
(
userRepository
.
isAdminEmail
(
"notFound@gmail.com"
));
admin
=
userRepository
.
getAdmin
();
Assert
.
assertNotNull
(
admin
);
Assert
.
assertEquals
(
"test"
,
admin
.
optString
(
User
.
USER_NAME
));
final
JSONObject
result
=
userRepository
.
get
(
new
Query
().
addFilter
(
User
.
USER_NAME
,
FilterOperator
.
EQUAL
,
"test1"
));
final
JSONArray
users
=
result
.
getJSONArray
(
Keys
.
RESULTS
);
Assert
.
assertEquals
(
users
.
length
(),
1
);
Assert
.
assertEquals
(
users
.
getJSONObject
(
0
).
getString
(
User
.
USER_EMAIL
),
"test1@gmail.com"
);
final
JSONObject
notFound
=
userRepository
.
getByEmail
(
"not.found@gmail.com"
);
Assert
.
assertNull
(
notFound
);
final
JSONObject
found
=
userRepository
.
getByEmail
(
"test1@gmail.com"
);
Assert
.
assertNotNull
(
found
);
Assert
.
assertEquals
(
found
.
getString
(
User
.
USER_PASSWORD
),
"pass1"
);
}
}
=======
=======
>>>>>>>
origin
/
0.4
.
6
/*
/*
* Copyright (c) 2009, 2010, 2011, 2012, B3log Team
* Copyright (c) 2009, 2010, 2011, 2012, B3log Team
*
*
...
@@ -189,17 +82,14 @@ public final class UserRepositoryImplTestCase extends AbstractTestCase {
...
@@ -189,17 +82,14 @@ public final class UserRepositoryImplTestCase extends AbstractTestCase {
Assert
.
assertNotNull
(
admin
);
Assert
.
assertNotNull
(
admin
);
Assert
.
assertEquals
(
"test"
,
admin
.
optString
(
User
.
USER_NAME
));
Assert
.
assertEquals
(
"test"
,
admin
.
optString
(
User
.
USER_NAME
));
final
JSONObject
result
=
final
JSONObject
result
=
userRepository
.
get
(
new
Query
().
setFilter
(
userRepository
.
get
(
new
Query
().
setFilter
(
new
PropertyFilter
(
User
.
USER_NAME
,
FilterOperator
.
EQUAL
,
"test1"
)));
new
PropertyFilter
(
User
.
USER_NAME
,
FilterOperator
.
EQUAL
,
"test1"
)));
final
JSONArray
users
=
result
.
getJSONArray
(
Keys
.
RESULTS
);
final
JSONArray
users
=
result
.
getJSONArray
(
Keys
.
RESULTS
);
Assert
.
assertEquals
(
users
.
length
(),
1
);
Assert
.
assertEquals
(
users
.
length
(),
1
);
Assert
.
assertEquals
(
users
.
getJSONObject
(
0
).
getString
(
User
.
USER_EMAIL
),
Assert
.
assertEquals
(
users
.
getJSONObject
(
0
).
getString
(
User
.
USER_EMAIL
),
"test1@gmail.com"
);
"test1@gmail.com"
);
final
JSONObject
notFound
=
final
JSONObject
notFound
=
userRepository
.
getByEmail
(
"not.found@gmail.com"
);
userRepository
.
getByEmail
(
"not.found@gmail.com"
);
Assert
.
assertNull
(
notFound
);
Assert
.
assertNull
(
notFound
);
final
JSONObject
found
=
userRepository
.
getByEmail
(
"test1@gmail.com"
);
final
JSONObject
found
=
userRepository
.
getByEmail
(
"test1@gmail.com"
);
...
@@ -207,7 +97,3 @@ public final class UserRepositoryImplTestCase extends AbstractTestCase {
...
@@ -207,7 +97,3 @@ public final class UserRepositoryImplTestCase extends AbstractTestCase {
Assert
.
assertEquals
(
found
.
getString
(
User
.
USER_PASSWORD
),
"pass1"
);
Assert
.
assertEquals
(
found
.
getString
(
User
.
USER_PASSWORD
),
"pass1"
);
}
}
}
}
<<<<<<<
HEAD
>>>>>>>
origin
/
0.4
.
6
=======
>>>>>>>
origin
/
0.4
.
6
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