當前位置: 首頁>>代碼示例>>Java>>正文


Java Is類代碼示例

本文整理匯總了Java中com.threewks.gaetools.search.Is的典型用法代碼示例。如果您正苦於以下問題:Java Is類的具體用法?Java Is怎麽用?Java Is使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Is類屬於com.threewks.gaetools.search包,在下文中一共展示了Is類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: shouldReindexEntitiesBasedOnKeysAndWriteBackToDatastoreWhenReindexOperationProvided

import com.threewks.gaetools.search.Is; //導入依賴的package包/類
@Test
public void shouldReindexEntitiesBasedOnKeysAndWriteBackToDatastoreWhenReindexOperationProvided() {
    LongTestEntity testEntity = new LongTestEntity(1, "original");
    LongTestEntity testEntity2 = new LongTestEntity(2, "original");
    LongTestEntity testEntity3 = new LongTestEntity(3, "original");
    repository.putAsync(testEntity, testEntity2, testEntity3).complete();

    repository.searchService.removeAll();
    assertThat(repository.search().field("name", Is.Is, "original").run().getResults(), hasSize(0));

    List<Long> keys = Arrays.asList(testEntity.getId(), testEntity2.getId(), testEntity3.getId());
    int reindexed = repository.reindex(keys, 10, batch -> {
        for (LongTestEntity entity : batch) {
            entity.setName("different");
        }
        return batch;
    });
    assertThat(reindexed, is(3));

    assertThat(repository.search().field("name", Is.Is, "different").run().getResults(), hasItems(testEntity, testEntity2, testEntity3));
    assertThat(repository.getByField("name", "different"), hasItems(testEntity, testEntity2, testEntity3));
}
 
開發者ID:monPlan,項目名稱:AppleSeed,代碼行數:23,代碼來源:LongRepositoryTest.java

示例2: shouldReindexEntitiesBasedOnSearch

import com.threewks.gaetools.search.Is; //導入依賴的package包/類
@Test
public void shouldReindexEntitiesBasedOnSearch() {
    KeyTestEntity testEntity = new KeyTestEntity(1, "original");
    KeyTestEntity testEntity2 = new KeyTestEntity(2, "original");
    KeyTestEntity testEntity3 = new KeyTestEntity(3, "original");
    repository.putAsync(testEntity, testEntity2, testEntity3).complete();

    assertThat(repository.search().field("name", Is.Is, "original").run().getResults(), hasItems(testEntity, testEntity2, testEntity3));

    List<KeyTestEntity> all = ObjectifyService.ofy().load().type(KeyTestEntity.class).list();
    for (KeyTestEntity e : all) {
        e.setName("other name");
    }
    ObjectifyService.ofy().save().entities(all).now();

    List<Key<KeyTestEntity>> keys = Arrays.asList(testEntity.getKey(), testEntity2.getKey(), testEntity3.getKey());
    int reindexed = repository.reindex(keys, 10, null);
    assertThat(reindexed, is(3));

    assertThat(repository.search().field("name", Is.Is, "original").run().getResults().isEmpty(), is(true));
    assertThat(repository.search().field("name", Is.Is, "other name").run().getResults().size(), is(3));
}
 
開發者ID:monPlan,項目名稱:springboot-spwa-gae-demo,代碼行數:23,代碼來源:KeyRepositoryTest.java

示例3: shouldReindexEntitiesBasedOnSearchAndWriteBackToDatastoreWhenReindexOperationProvided

import com.threewks.gaetools.search.Is; //導入依賴的package包/類
@Test
public void shouldReindexEntitiesBasedOnSearchAndWriteBackToDatastoreWhenReindexOperationProvided() {
    KeyTestEntity testEntity = new KeyTestEntity(1, "name");
    KeyTestEntity testEntity2 = new KeyTestEntity(2, "name");
    KeyTestEntity testEntity3 = new KeyTestEntity(3, "name");
    repository.putAsync(testEntity, testEntity2, testEntity3).complete();

    assertThat(repository.search().field("id", Is.GreaterThan, 0).run().getResults(), hasItems(testEntity, testEntity2, testEntity3));

    List<Key<KeyTestEntity>> keys = Arrays.asList(testEntity.getKey(), testEntity2.getKey(), testEntity3.getKey());
    int reindexed = repository.reindex(keys, 10, batch -> {
        for (KeyTestEntity entity : batch) {
            entity.setName("different");
        }
        return batch;
    });
    assertThat(reindexed, is(3));

    assertThat(repository.search().field("name", Is.Is, "different").run().getResults(), hasItems(testEntity, testEntity2, testEntity3));
    assertThat(repository.getByField("name", "different"), hasItems(testEntity, testEntity2, testEntity3));
}
 
開發者ID:monPlan,項目名稱:springboot-spwa-gae-demo,代碼行數:22,代碼來源:KeyRepositoryTest.java

示例4: shouldReindexEntitiesBasedOnKeysAndWriteBackToDatastoreWhenReindexOperationProvided

import com.threewks.gaetools.search.Is; //導入依賴的package包/類
@Test
public void shouldReindexEntitiesBasedOnKeysAndWriteBackToDatastoreWhenReindexOperationProvided() {
    KeyTestEntity testEntity = new KeyTestEntity(1, "original");
    KeyTestEntity testEntity2 = new KeyTestEntity(2, "original");
    KeyTestEntity testEntity3 = new KeyTestEntity(3, "original");
    repository.putAsync(testEntity, testEntity2, testEntity3).complete();

    repository.searchService.removeAll();
    assertThat(repository.search().field("name", Is.Is, "original").run().getResults(), hasSize(0));

    List<Key<KeyTestEntity>> keys = Arrays.asList(testEntity.getKey(), testEntity2.getKey(), testEntity3.getKey());
    int reindexed = repository.reindex(keys, 10, batch -> {
        for (KeyTestEntity entity : batch) {
            entity.setName("different");
        }
        return batch;
    });
    assertThat(reindexed, is(3));

    assertThat(repository.search().field("name", Is.Is, "different").run().getResults(), hasItems(testEntity, testEntity2, testEntity3));
    assertThat(repository.getByField("name", "different"), hasItems(testEntity, testEntity2, testEntity3));
}
 
開發者ID:monPlan,項目名稱:springboot-spwa-gae-demo,代碼行數:23,代碼來源:KeyRepositoryTest.java

示例5: shouldReindexEntitiesBasedOnSearch

import com.threewks.gaetools.search.Is; //導入依賴的package包/類
@Test
public void shouldReindexEntitiesBasedOnSearch() {
    LongTestEntity testEntity = new LongTestEntity(1, "original");
    LongTestEntity testEntity2 = new LongTestEntity(2, "original");
    LongTestEntity testEntity3 = new LongTestEntity(3, "original");
    repository.putAsync(testEntity, testEntity2, testEntity3).complete();

    Search<LongTestEntity, Long> search = repository.search().field("name", Is.Is, "original");
    assertThat(search.run().getResults(), hasItems(testEntity, testEntity2, testEntity3));

    List<LongTestEntity> all = ObjectifyService.ofy().load().type(LongTestEntity.class).list();
    for (LongTestEntity e : all) {
        e.setName("other name");
    }
    ObjectifyService.ofy().save().entities(all).now();

    List<Long> keys = list(testEntity.getId(), testEntity2.getId(), testEntity3.getId());
    int reindexed = repository.reindex(keys, 10, null);
    assertThat(reindexed, is(3));

    assertThat(search.run().getResults().isEmpty(), is(true));
    assertThat(repository.search().field("name", Is.Is, "other name").run().getResultIds().size(), is(3));
}
 
開發者ID:monPlan,項目名稱:AppleSeed,代碼行數:24,代碼來源:LongRepositoryTest.java

示例6: shouldReindexEntitiesBasedOnSearch

import com.threewks.gaetools.search.Is; //導入依賴的package包/類
@Test
public void shouldReindexEntitiesBasedOnSearch() {
    StringTestEntity testEntity = new StringTestEntity("1", "original");
    StringTestEntity testEntity2 = new StringTestEntity("2", "original");
    StringTestEntity testEntity3 = new StringTestEntity("3", "original");
    repository.putAsync(testEntity, testEntity2, testEntity3).complete();

    assertThat(repository.search().field("name", Is.Is, "original").run().getResults(), hasItems(testEntity, testEntity2, testEntity3));

    List<StringTestEntity> all = ObjectifyService.ofy().load().type(StringTestEntity.class).list();
    for (StringTestEntity e : all) {
        e.setName("other name");
    }
    ObjectifyService.ofy().save().entities(all).now();
    List<String> keys = list(testEntity.getId(), testEntity2.getId(), testEntity3.getId());
    int reindexed = repository.reindex(keys, 10, null);
    assertThat(reindexed, is(3));

    assertThat(repository.search().field("name", Is.Is, "original").run().getResultIds().isEmpty(), is(true));
    assertThat(repository.search().field("name", Is.Is, "other name").run().getResultIds().size(), is(3));
}
 
開發者ID:monPlan,項目名稱:springboot-spwa-gae-demo,代碼行數:22,代碼來源:StringRepositoryTest.java

示例7: shouldReindexEntitiesBasedOnSearchAndWriteBackToDatastoreWhenReindexOperationProvided

import com.threewks.gaetools.search.Is; //導入依賴的package包/類
@Test
public void shouldReindexEntitiesBasedOnSearchAndWriteBackToDatastoreWhenReindexOperationProvided() {
    StringTestEntity testEntity = new StringTestEntity("1", "name");
    StringTestEntity testEntity2 = new StringTestEntity("2", "name");
    StringTestEntity testEntity3 = new StringTestEntity("3", "name");
    repository.putAsync(testEntity, testEntity2, testEntity3).complete();

    Search<StringTestEntity, String> search = repository.search();
    assertThat(search.run().getResults(), hasItems(testEntity, testEntity2, testEntity3));

    List<String> keys = list(testEntity.getId(), testEntity2.getId(), testEntity3.getId());
    int reindexed = repository.reindex(keys, 10, batch -> {
        for (StringTestEntity entity : batch) {
            entity.setName("different");
        }
        return batch;
    });
    assertThat(reindexed, is(3));

    assertThat(repository.search().field("name", Is.Is, "different").run().getResults(), hasItems(testEntity, testEntity2, testEntity3));
    assertThat(repository.getByField("name", "different"), hasItems(testEntity, testEntity2, testEntity3));
}
 
開發者ID:monPlan,項目名稱:springboot-spwa-gae-demo,代碼行數:23,代碼來源:StringRepositoryTest.java

示例8: shouldReindexEntitiesBasedOnKeys

import com.threewks.gaetools.search.Is; //導入依賴的package包/類
@Test
public void shouldReindexEntitiesBasedOnKeys() {
    StringTestEntity testEntity = new StringTestEntity("1", "name");
    StringTestEntity testEntity2 = new StringTestEntity("2", "name");
    StringTestEntity testEntity3 = new StringTestEntity("3", "name");
    repository.putAsync(testEntity, testEntity2, testEntity3).complete();

    repository.searchService.removeAll();
    assertThat(repository.search().field("name", Is.Is, "name").run().getResults(), hasSize(0));

    List<String> keys = Arrays.asList("1", "2", "3");
    int reindexed = repository.reindex(keys, 10, null);
    assertThat(reindexed, is(3));

    assertThat(repository.search().field("name", Is.Is, "name").run().getResultIds().size(), is(3));
}
 
開發者ID:monPlan,項目名稱:springboot-spwa-gae-demo,代碼行數:17,代碼來源:StringRepositoryTest.java

示例9: shouldReindexEntitiesBasedOnKeysAndWriteBackToDatastoreWhenReindexOperationProvided

import com.threewks.gaetools.search.Is; //導入依賴的package包/類
@Test
public void shouldReindexEntitiesBasedOnKeysAndWriteBackToDatastoreWhenReindexOperationProvided() {
    StringTestEntity testEntity = new StringTestEntity("1", "original");
    StringTestEntity testEntity2 = new StringTestEntity("2", "original");
    StringTestEntity testEntity3 = new StringTestEntity("3", "original");
    repository.putAsync(testEntity, testEntity2, testEntity3).complete();

    repository.searchService.removeAll();
    assertThat(repository.search().field("name", Is.Is, "original").run().getResults(), hasSize(0));

    List<String> keys = Arrays.asList("1", "2", "3");
    int reindexed = repository.reindex(keys, 10, batch -> {
        for (StringTestEntity entity : batch) {
            entity.setName("different");
        }
        return batch;
    });
    assertThat(reindexed, is(3));

    assertThat(repository.search().field("name", Is.Is, "different").run().getResults(), hasItems(testEntity, testEntity2, testEntity3));
    assertThat(repository.getByField("name", "different"), hasItems(testEntity, testEntity2, testEntity3));
}
 
開發者ID:monPlan,項目名稱:springboot-spwa-gae-demo,代碼行數:23,代碼來源:StringRepositoryTest.java

示例10: shouldReindexEntities

import com.threewks.gaetools.search.Is; //導入依賴的package包/類
@Test
public void shouldReindexEntities() {
    DatastoreKeyTestEntity testEntity = new DatastoreKeyTestEntity(1, "original");
    DatastoreKeyTestEntity testEntity2 = new DatastoreKeyTestEntity(2, "original");
    DatastoreKeyTestEntity testEntity3 = new DatastoreKeyTestEntity(3, "original");
    repository.putAsync(testEntity, testEntity2, testEntity3).complete();

    assertThat(repository.search().field("name", Is.Is, "original").run().getResults(), hasItems(testEntity, testEntity2, testEntity3));

    List<DatastoreKeyTestEntity> all = ObjectifyService.ofy().load().type(DatastoreKeyTestEntity.class).list();
    for (DatastoreKeyTestEntity e : all) {
        e.setName("other name");
    }
    ObjectifyService.ofy().save().entities(all).now();

    List<Key> keys = list(testEntity.getKey(), testEntity2.getKey(), testEntity3.getKey());
    int reindexed = repository.reindex(keys, 10, null);
    assertThat(reindexed, is(3));

    assertThat(repository.search().field("name", Is.Is, "original").run().getResults().isEmpty(), is(true));
    assertThat(repository.search().field("name", Is.Is, "other name").run().getResults().size(), is(3));
}
 
開發者ID:monPlan,項目名稱:springboot-spwa-gae-demo,代碼行數:23,代碼來源:DatastoreKeyRepositoryTest.java

示例11: shouldReindexEntitiesBasedOnSearchAndWriteBackToDatastoreWhenReindexOperationProvided

import com.threewks.gaetools.search.Is; //導入依賴的package包/類
@Test
public void shouldReindexEntitiesBasedOnSearchAndWriteBackToDatastoreWhenReindexOperationProvided() {
    LongTestEntity testEntity = new LongTestEntity(1, "name");
    LongTestEntity testEntity2 = new LongTestEntity(2, "name");
    LongTestEntity testEntity3 = new LongTestEntity(3, "name");
    repository.putAsync(testEntity, testEntity2, testEntity3).complete();

    assertThat(repository.search().field("id", Is.GreaterThan, 0).run().getResults(), hasItems(testEntity, testEntity2, testEntity3));

    List<Long> keys = list(testEntity.getId(), testEntity2.getId(), testEntity3.getId());
    int reindexed = repository.reindex(keys, 10, batch -> {
        for (LongTestEntity entity : batch) {
            entity.setName("different");
        }
        return batch;
    });
    assertThat(reindexed, is(3));

    assertThat(repository.search().field("name", Is.Is, "different").run().getResults(), hasItems(testEntity, testEntity2, testEntity3));
    assertThat(repository.getByField("name", "different"), hasItems(testEntity, testEntity2, testEntity3));
}
 
開發者ID:monPlan,項目名稱:AppleSeed,代碼行數:22,代碼來源:LongRepositoryTest.java

示例12: shouldReindexEntitiesBasedOnKeys

import com.threewks.gaetools.search.Is; //導入依賴的package包/類
@Test
public void shouldReindexEntitiesBasedOnKeys() {
    KeyTestEntity testEntity = new KeyTestEntity(1, "name");
    KeyTestEntity testEntity2 = new KeyTestEntity(2, "name");
    KeyTestEntity testEntity3 = new KeyTestEntity(3, "name");
    repository.putAsync(testEntity, testEntity2, testEntity3).complete();

    repository.searchService.removeAll();
    assertThat(repository.search().field("name", Is.Is, "name").run().getResults(), hasSize(0));

    List<Key<KeyTestEntity>> keys = Arrays.asList(testEntity.getKey(), testEntity2.getKey(), testEntity3.getKey());
    int reindexed = repository.reindex(keys, 10, null);
    assertThat(reindexed, is(3));

    assertThat(repository.search().field("name", Is.Is, "name").run().getResultIds().size(), is(3));
}
 
開發者ID:lorderikir,項目名稱:googlecloud-techtalk,代碼行數:17,代碼來源:KeyRepositoryTest.java

示例13: shouldReindexEntitiesAndWriteBackToDatastoreWhenReindexOperationProvided

import com.threewks.gaetools.search.Is; //導入依賴的package包/類
@Test
public void shouldReindexEntitiesAndWriteBackToDatastoreWhenReindexOperationProvided() {
    DatastoreKeyTestEntity testEntity = new DatastoreKeyTestEntity(1, "name");
    DatastoreKeyTestEntity testEntity2 = new DatastoreKeyTestEntity(2, "name");
    DatastoreKeyTestEntity testEntity3 = new DatastoreKeyTestEntity(3, "name");
    repository.putAsync(testEntity, testEntity2, testEntity3).complete();

    assertThat(repository.search().field("id", list(1, 2, 3)).run().getResults(), hasItems(testEntity, testEntity2, testEntity3));

    List<Key> keys = list(testEntity.getKey(), testEntity2.getKey(), testEntity3.getKey());
    int reindexed = repository.reindex(keys, 10, batch -> {
        for (DatastoreKeyTestEntity entity : batch) {
            entity.setName("different");
        }
        return batch;
    });
    assertThat(reindexed, is(3));

    assertThat(repository.search().field("name", Is.Is, "different").run().getResults(), hasItems(testEntity, testEntity2, testEntity3));
    assertThat(repository.getByField("name", "different"), hasItems(testEntity, testEntity2, testEntity3));
}
 
開發者ID:lorderikir,項目名稱:googlecloud-techtalk,代碼行數:22,代碼來源:DatastoreKeyRepositoryTest.java

示例14: shouldReindexEntitiesBasedOnKeys

import com.threewks.gaetools.search.Is; //導入依賴的package包/類
@Test
public void shouldReindexEntitiesBasedOnKeys() {
    LongTestEntity testEntity = new LongTestEntity(1, "name");
    LongTestEntity testEntity2 = new LongTestEntity(2, "name");
    LongTestEntity testEntity3 = new LongTestEntity(3, "name");
    repository.putAsync(testEntity, testEntity2, testEntity3).complete();

    repository.searchService.removeAll();
    assertThat(repository.search().field("name", Is.Is, "name").run().getResults(), hasSize(0));

    List<Long> keys = Arrays.asList(testEntity.getId(), testEntity2.getId(), testEntity3.getId());
    int reindexed = repository.reindex(keys, 10, null);
    assertThat(reindexed, is(3));

    assertThat(repository.search().field("name", Is.Is, "name").run().getResultIds().size(), is(3));
}
 
開發者ID:monPlan,項目名稱:AppleSeed,代碼行數:17,代碼來源:LongRepositoryTest.java

示例15: shouldDeleteEntity

import com.threewks.gaetools.search.Is; //導入依賴的package包/類
@Test
public void shouldDeleteEntity() {
    DatastoreKeyTestEntity testEntity = new DatastoreKeyTestEntity(1, "name");
    repository.putAsync(testEntity).complete();

    assertThat(repository.get(testEntity.getKey()), is(testEntity));

    repository.deleteAsync(testEntity).complete();

    assertThat(repository.get(testEntity.getKey()), is(nullValue()));
    assertThat(repository.search().field("name", Is.Is, "name").run().getResults().isEmpty(), is(true));
}
 
開發者ID:monPlan,項目名稱:AppleSeed,代碼行數:13,代碼來源:DatastoreKeyRepositoryTest.java


注:本文中的com.threewks.gaetools.search.Is類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。