当前位置: 首页>>代码示例>>Java>>正文


Java StringTestEntity类代码示例

本文整理汇总了Java中com.threewks.gaetools.objectify.repository.test.StringTestEntity的典型用法代码示例。如果您正苦于以下问题:Java StringTestEntity类的具体用法?Java StringTestEntity怎么用?Java StringTestEntity使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。


StringTestEntity类属于com.threewks.gaetools.objectify.repository.test包,在下文中一共展示了StringTestEntity类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: shouldDeleteEntitiesById

import com.threewks.gaetools.objectify.repository.test.StringTestEntity; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Test
public void shouldDeleteEntitiesById() {
    StringTestEntity testEntity = new StringTestEntity("id1", "name");
    StringTestEntity testEntity2 = new StringTestEntity("id2", "name2");
    repository.putAsync(testEntity, testEntity2).complete();

    assertThat(repository.get(testEntity.getId()), is(testEntity));
    assertThat(repository.get(testEntity2.getId()), is(testEntity2));
    assertThat(repository.search().field("id", list(testEntity.getId(), testEntity2.getId())).run().getResultIds(), hasItems("id1", "id2"));

    repository.deleteByKeyAsync(testEntity.getId(), testEntity2.getId()).complete();

    assertThat(repository.get(testEntity.getId(), testEntity2.getId()), Matchers.hasItems(nullValue(), nullValue()));
    assertThat(repository.search().field("id", list(testEntity.getId(), testEntity2.getId())).run().getResultIds().isEmpty(), is(true));
}
 
开发者ID:monPlan,项目名称:springboot-spwa-gae-demo,代码行数:17,代码来源:StringRepositoryTest.java

示例2: shouldDeleteEntitiesByEntity

import com.threewks.gaetools.objectify.repository.test.StringTestEntity; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Test
public void shouldDeleteEntitiesByEntity() {
    StringTestEntity testEntity = new StringTestEntity("id1", "name");
    StringTestEntity testEntity2 = new StringTestEntity("id2", "name2");
    repository.putAsync(testEntity, testEntity2).complete();

    assertThat(repository.get(testEntity.getId()), is(testEntity));
    assertThat(repository.get(testEntity2.getId()), is(testEntity2));
    assertThat(repository.search().field("id", list(testEntity.getId(), testEntity2.getId())).run().getResultIds(), hasItems("id1", "id2"));

    repository.deleteAsync(testEntity, testEntity2).complete();

    assertThat(repository.get(testEntity.getId(), testEntity2.getId()), Matchers.hasItems(nullValue(), nullValue()));
    assertThat(repository.search().field("id", list(testEntity.getId(), testEntity2.getId())).run().getResultIds().isEmpty(), is(true));
}
 
开发者ID:monPlan,项目名称:springboot-spwa-gae-demo,代码行数:17,代码来源:StringRepositoryTest.java

示例3: shouldReindexEntitiesBasedOnSearch

import com.threewks.gaetools.objectify.repository.test.StringTestEntity; //导入依赖的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

示例4: shouldReindexEntitiesBasedOnSearchAndWriteBackToDatastoreWhenReindexOperationProvided

import com.threewks.gaetools.objectify.repository.test.StringTestEntity; //导入依赖的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

示例5: shouldReindexEntitiesBasedOnKeys

import com.threewks.gaetools.objectify.repository.test.StringTestEntity; //导入依赖的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

示例6: shouldReindexEntitiesBasedOnKeysAndWriteBackToDatastoreWhenReindexOperationProvided

import com.threewks.gaetools.objectify.repository.test.StringTestEntity; //导入依赖的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

示例7: shouldTransform

import com.threewks.gaetools.objectify.repository.test.StringTestEntity; //导入依赖的package包/类
@SuppressWarnings("rawtypes")
@Test
public void shouldTransform() {
    Key key = Key.create(StringTestEntity.class, "dcba");
    Key childKey = Key.create(key, StringTestEntity.class, "abcd");
    Key key2 = Key.create(LongTestEntity.class, 4321);
    Key childKey2 = Key.create(key, LongTestEntity.class, 1234);
    assertThat(transformer.from(key.getString()), is(key));
    assertThat(transformer.from(childKey.getString()), is(childKey));
    assertThat(transformer.from(key2.getString()), is(key2));
    assertThat(transformer.from(childKey2.getString()), is(childKey2));
}
 
开发者ID:monPlan,项目名称:springboot-spwa-gae-demo,代码行数:13,代码来源:StringToKeyTransformerTest.java

示例8: shouldTransform

import com.threewks.gaetools.objectify.repository.test.StringTestEntity; //导入依赖的package包/类
@Test
public void shouldTransform() {
    Key<StringTestEntity> key = Key.create(StringTestEntity.class, "dcba");
    Key<StringTestEntity> childKey = Key.create(key, StringTestEntity.class, "abcd");
    Key<LongTestEntity> key2 = Key.create(LongTestEntity.class, 4321);
    Key<LongTestEntity> childKey2 = Key.create(key, LongTestEntity.class, 1234);
    assertThat(transformer.from(key), is(key.getString()));
    assertThat(transformer.from(childKey), is(childKey.getString()));
    assertThat(transformer.from(key2), is(key2.getString()));
    assertThat(transformer.from(childKey2), is(childKey2.getString()));
}
 
开发者ID:monPlan,项目名称:springboot-spwa-gae-demo,代码行数:12,代码来源:KeyToStringTransformerTest.java

示例9: before

import com.threewks.gaetools.objectify.repository.test.StringTestEntity; //导入依赖的package包/类
@Before
public void before() {
    TransformerManager transformerManager = ObjectifyModule.defaultTransformerManager();
    IndexTypeLookup indexTypeLookup = SearchModule.defaultIndexTypeLookup();
    SearchConfig searchConfig = new SearchConfig(transformerManager, new FieldMediatorSet(), indexTypeLookup);
    repository = new StringRepository<>(StringTestEntity.class, searchConfig);
    noSearchrepository = new StringRepository<>(StringTestEntity.class, null);
}
 
开发者ID:monPlan,项目名称:springboot-spwa-gae-demo,代码行数:9,代码来源:StringRepositoryTest.java

示例10: shouldAllowSaveAndLoadOfEntity

import com.threewks.gaetools.objectify.repository.test.StringTestEntity; //导入依赖的package包/类
@Test
public void shouldAllowSaveAndLoadOfEntity() {
    StringTestEntity testEntity = new StringTestEntity("id1", "name");
    AsyncResult<StringTestEntity> result = repository.putAsync(testEntity);
    assertThat(result, is(notNullValue()));
    StringTestEntity complete = result.complete();
    assertThat(complete, is(sameInstance(testEntity)));

    StringTestEntity load = repository.get(testEntity.getId());
    assertThat(load.equals(testEntity), is(true));
}
 
开发者ID:monPlan,项目名称:springboot-spwa-gae-demo,代码行数:12,代码来源:StringRepositoryTest.java

示例11: shouldAllowSaveAndSearchOfEntity

import com.threewks.gaetools.objectify.repository.test.StringTestEntity; //导入依赖的package包/类
@Test
public void shouldAllowSaveAndSearchOfEntity() {
    StringTestEntity testEntity = new StringTestEntity("id1", "name");
    AsyncResult<StringTestEntity> result = repository.putAsync(testEntity);
    assertThat(result, is(notNullValue()));
    StringTestEntity complete = result.complete();
    assertThat(complete, is(sameInstance(testEntity)));

    List<StringTestEntity> results = repository.search().field("name", Is.EqualTo, "name").run().getResults();
    assertThat(results, hasItem(testEntity));
}
 
开发者ID:monPlan,项目名称:springboot-spwa-gae-demo,代码行数:12,代码来源:StringRepositoryTest.java

示例12: shouldAllowSaveAndLoadOfMultipleEntities

import com.threewks.gaetools.objectify.repository.test.StringTestEntity; //导入依赖的package包/类
@Test
public void shouldAllowSaveAndLoadOfMultipleEntities() {
    StringTestEntity testEntity = new StringTestEntity("id1", "name");
    StringTestEntity testEntity2 = new StringTestEntity("id2", "name2");
    AsyncResult<List<StringTestEntity>> result = repository.putAsync(testEntity, testEntity2);
    assertThat(result, is(notNullValue()));
    List<StringTestEntity> complete = result.complete();
    assertThat(complete.contains(testEntity), is(true));
    assertThat(complete.contains(testEntity2), is(true));

    List<StringTestEntity> load = repository.get(testEntity.getId(), testEntity2.getId());
    assertThat(load, hasItems(testEntity, testEntity2));
}
 
开发者ID:monPlan,项目名称:springboot-spwa-gae-demo,代码行数:14,代码来源:StringRepositoryTest.java

示例13: shouldAllowSaveAndSearchOfMultipleEntities

import com.threewks.gaetools.objectify.repository.test.StringTestEntity; //导入依赖的package包/类
@Test
public void shouldAllowSaveAndSearchOfMultipleEntities() {
    StringTestEntity testEntity = new StringTestEntity("id1", "name");
    StringTestEntity testEntity2 = new StringTestEntity("id2", "name2");
    AsyncResult<List<StringTestEntity>> result = repository.putAsync(testEntity, testEntity2);
    assertThat(result, is(notNullValue()));
    List<StringTestEntity> complete = result.complete();
    assertThat(complete.contains(testEntity), is(true));
    assertThat(complete.contains(testEntity2), is(true));

    List<StringTestEntity> search = repository.search().field("name", list("name", "name2")).run().getResults();
    assertThat(search, hasItems(testEntity, testEntity2));
}
 
开发者ID:monPlan,项目名称:springboot-spwa-gae-demo,代码行数:14,代码来源:StringRepositoryTest.java

示例14: shouldSearchReturningIds

import com.threewks.gaetools.objectify.repository.test.StringTestEntity; //导入依赖的package包/类
@Test
public void shouldSearchReturningIds() {
    StringTestEntity testEntity = new StringTestEntity("1", "name");
    StringTestEntity testEntity2 = new StringTestEntity("2", "name2");
    repository.putAsync(testEntity, testEntity2).complete();

    List<String> search = repository.search().field("name", list("name", "name2")).run().getResultIds();
    assertThat(search, hasItems("1", "2"));
}
 
开发者ID:monPlan,项目名称:springboot-spwa-gae-demo,代码行数:10,代码来源:StringRepositoryTest.java

示例15: shouldListGivenCount

import com.threewks.gaetools.objectify.repository.test.StringTestEntity; //导入依赖的package包/类
@Test
public void shouldListGivenCount() {
    StringTestEntity testEntity = new StringTestEntity("id1", "name");
    StringTestEntity testEntity2 = new StringTestEntity("id2", "name2");
    StringTestEntity testEntity3 = new StringTestEntity("id3", "name3");
    repository.putAsync(testEntity, testEntity2, testEntity3).complete();

    List<StringTestEntity> list = repository.list(2);
    assertThat(list.size(), is(2));
    assertThat(list, hasItems(testEntity, testEntity2));
}
 
开发者ID:monPlan,项目名称:springboot-spwa-gae-demo,代码行数:12,代码来源:StringRepositoryTest.java


注:本文中的com.threewks.gaetools.objectify.repository.test.StringTestEntity类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。