本文整理匯總了Java中com.couchbase.client.protocol.views.ComplexKey類的典型用法代碼示例。如果您正苦於以下問題:Java ComplexKey類的具體用法?Java ComplexKey怎麽用?Java ComplexKey使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。
ComplexKey類屬於com.couchbase.client.protocol.views包,在下文中一共展示了ComplexKey類的8個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。
示例1: testFindOauth2AccessTokenByUserName
import com.couchbase.client.protocol.views.ComplexKey; //導入依賴的package包/類
@Ignore
@Test
public void testFindOauth2AccessTokenByUserName() throws InterruptedException {
CouchbaseOAuth2AccessToken defaultToken = createSampleOAuth2AccessToken();
oauth2AccessTokenRepository.save(defaultToken);
Query query = new Query();
query.setKey(ComplexKey.of(DEFAULT_USER_NAME));
List<OAuth2AccessToken> accessTokens = oauth2AccessTokenRepository.findByUserName(query);
Assert.notNull(accessTokens);
Assert.notEmpty(accessTokens);
Assert.isTrue(DEFAULT_TOKEN_ID.equals(accessTokens.get(0).getValue()));
// clean data
oauth2AccessTokenRepository.delete(DEFAULT_TOKEN_ID);
Assert.isNull(oauth2AccessTokenRepository.findOne(DEFAULT_TOKEN_ID));
}
開發者ID:tcompiegne,項目名稱:oauth2-couchbase-token-store,代碼行數:20,代碼來源:OAuth2AccessTokenRepositoryTest.java
示例2: testFindOAuth2AccessTokenByClientId
import com.couchbase.client.protocol.views.ComplexKey; //導入依賴的package包/類
@Ignore
@Test
public void testFindOAuth2AccessTokenByClientId() {
CouchbaseOAuth2AccessToken defaultToken = createSampleOAuth2AccessToken();
oauth2AccessTokenRepository.save(defaultToken);
Query query = new Query();
query.setKey(ComplexKey.of(DEFAULT_CLIENT_ID));
List<OAuth2AccessToken> accessTokens = oauth2AccessTokenRepository.findByClientId(query);
Assert.notNull(accessTokens);
Assert.notEmpty(accessTokens);
Assert.isTrue(DEFAULT_TOKEN_ID.equals(accessTokens.get(0).getValue()));
// clean data
oauth2AccessTokenRepository.delete(DEFAULT_TOKEN_ID);
Assert.isNull(oauth2AccessTokenRepository.findOne(DEFAULT_TOKEN_ID));
}
開發者ID:tcompiegne,項目名稱:oauth2-couchbase-token-store,代碼行數:19,代碼來源:OAuth2AccessTokenRepositoryTest.java
示例3: testFindOAuth2AccessTokenByClientIdAndUserName
import com.couchbase.client.protocol.views.ComplexKey; //導入依賴的package包/類
@Ignore
@Test
public void testFindOAuth2AccessTokenByClientIdAndUserName() {
CouchbaseOAuth2AccessToken defaultToken = createSampleOAuth2AccessToken();
oauth2AccessTokenRepository.save(defaultToken);
Query query = new Query();
query.setKey(ComplexKey.of(DEFAULT_CLIENT_ID, DEFAULT_USER_NAME));
List<OAuth2AccessToken> accessTokens = oauth2AccessTokenRepository.findByClientIdAndUserName(query);
Assert.notNull(accessTokens);
Assert.notEmpty(accessTokens);
Assert.isTrue(DEFAULT_TOKEN_ID.equals(accessTokens.get(0).getValue()));
// clean data
oauth2AccessTokenRepository.delete(DEFAULT_TOKEN_ID);
Assert.isNull(oauth2AccessTokenRepository.findOne(DEFAULT_TOKEN_ID));
}
開發者ID:tcompiegne,項目名稱:oauth2-couchbase-token-store,代碼行數:19,代碼來源:OAuth2AccessTokenRepositoryTest.java
示例4: getLogEntriesForTaskOnHostSinceTemp
import com.couchbase.client.protocol.views.ComplexKey; //導入依賴的package包/類
private Collection<InvocStat> getLogEntriesForTaskOnHostSinceTemp(long taskId, String hostName, long timestamp) {
if (client == null) {
getConnection();
}
View view = client.getView("Invoc", "getLogEntriesForTaskOnHostSince");
// Set up the Query object
Query query = new Query();
query.setIncludeDocs(true).setRange(ComplexKey.of(taskId, hostName, timestamp), ComplexKey.of(taskId, hostName, 999999999999999999l));
// Query the Cluster
ViewResponse result = client.query(view, query);
return createInvocStat(result);
}
示例5: findByName
import com.couchbase.client.protocol.views.ComplexKey; //導入依賴的package包/類
public static F.Promise<F.Option<User>> findByName(String name) {
Query query = new Query()
.setLimit(1)
.setIncludeDocs(true)
.setStale(Stale.FALSE)
.setRangeStart(ComplexKey.of(name))
.setRangeEnd(ComplexKey.of(name + "\uefff"));
return bucket.find("users", "by_name", query, User.class)
.map(new F.Function<Collection<User>, F.Option<User>>() {
@Override
public F.Option<User> apply(Collection<User> users) throws Throwable {
if (users.isEmpty()) {
return F.Option.None();
}
return F.Option.Some(users.iterator().next());
}
});
}
示例6: findByEmail
import com.couchbase.client.protocol.views.ComplexKey; //導入依賴的package包/類
public static F.Promise<F.Option<User>> findByEmail(String email) {
Query query = new Query()
.setLimit(1)
.setIncludeDocs(true)
.setStale(Stale.FALSE)
.setRangeStart(ComplexKey.of(email))
.setRangeEnd(ComplexKey.of(email + "\uefff"));
return bucket.find("users", "by_email", query, User.class)
.map(new F.Function<Collection<User>, F.Option<User>>() {
@Override
public F.Option<User> apply(Collection<User> users) throws Throwable {
if (users.isEmpty()) {
return F.Option.None();
}
return F.Option.Some(users.iterator().next());
}
});
}
示例7: findTokensByClientIdAndUserName
import com.couchbase.client.protocol.views.ComplexKey; //導入依賴的package包/類
@Override
public Collection<OAuth2AccessToken> findTokensByClientIdAndUserName(String clientId, String userName) {
List<OAuth2AccessToken> accessTokens = new ArrayList<OAuth2AccessToken>();
Query query = new Query();
query.setKey(ComplexKey.of(clientId, userName));
accessTokens = oAuth2AccessTokenService.findByClientIdAndUserName(query);
if (accessTokens == null) {
if (LOG.isInfoEnabled()) {
LOG.info("Failed to find access token for userName " + userName);
}
}
return accessTokens;
}
示例8: findTokensByClientId
import com.couchbase.client.protocol.views.ComplexKey; //導入依賴的package包/類
@Override
public Collection<OAuth2AccessToken> findTokensByClientId(String clientId) {
List<OAuth2AccessToken> accessTokens = new ArrayList<OAuth2AccessToken>();
Query query = new Query();
query.setKey(ComplexKey.of(clientId));
accessTokens = oAuth2AccessTokenService.findByClientId(query);
if (accessTokens == null) {
if (LOG.isInfoEnabled()) {
LOG.info("Failed to find access token for clientId " + clientId);
}
}
return accessTokens;
}