本文整理汇总了Java中org.apache.lucene.util.SetOnce.AlreadySetException类的典型用法代码示例。如果您正苦于以下问题:Java AlreadySetException类的具体用法?Java AlreadySetException怎么用?Java AlreadySetException使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
AlreadySetException类属于org.apache.lucene.util.SetOnce包,在下文中一共展示了AlreadySetException类的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。
示例1: testReuse
import org.apache.lucene.util.SetOnce.AlreadySetException; //导入依赖的package包/类
@Test
public void testReuse() throws Exception {
Directory dir = newDirectory();
// test that IWC cannot be reused across two IWs
IndexWriterConfig conf = newIndexWriterConfig(null);
new RandomIndexWriter(random(), dir, conf).close();
// this should fail
try {
assertNotNull(new RandomIndexWriter(random(), dir, conf));
fail("should have hit AlreadySetException");
} catch (AlreadySetException e) {
// expected
}
dir.close();
}
开发者ID:europeana,项目名称:search,代码行数:18,代码来源:TestIndexWriterConfig.java
示例2: testForceCustomQueryCache
import org.apache.lucene.util.SetOnce.AlreadySetException; //导入依赖的package包/类
public void testForceCustomQueryCache() throws IOException {
Settings indexSettings = Settings.builder()
.put(Environment.PATH_HOME_SETTING.getKey(), createTempDir().toString())
.put(IndexMetaData.SETTING_VERSION_CREATED, Version.CURRENT).build();
IndexModule module = new IndexModule(IndexSettingsModule.newIndexSettings("foo", indexSettings),
new AnalysisRegistry(environment, emptyMap(), emptyMap(), emptyMap(), emptyMap(), emptyMap()));
module.forceQueryCacheProvider((a, b) -> new CustomQueryCache());
expectThrows(AlreadySetException.class, () -> module.forceQueryCacheProvider((a, b) -> new CustomQueryCache()));
IndexService indexService = newIndexService(module);
assertTrue(indexService.cache().query() instanceof CustomQueryCache);
indexService.close("simon says", false);
}
开发者ID:justor,项目名称:elasticsearch_my,代码行数:13,代码来源:IndexModuleTests.java
示例3: testSetOnce
import org.apache.lucene.util.SetOnce.AlreadySetException; //导入依赖的package包/类
@Test(expected=AlreadySetException.class)
public void testSetOnce() throws Exception {
SetOnce<Integer> set = new SetOnce<>();
set.set(new Integer(5));
assertEquals(5, set.get().intValue());
set.set(new Integer(7));
}
开发者ID:europeana,项目名称:search,代码行数:8,代码来源:TestSetOnce.java
示例4: testSetOnce
import org.apache.lucene.util.SetOnce.AlreadySetException; //导入依赖的package包/类
@Test(expected=AlreadySetException.class)
public void testSetOnce() throws Exception {
SetOnce<Integer> set = new SetOnce<Integer>();
set.set(new Integer(5));
assertEquals(5, set.get().intValue());
set.set(new Integer(7));
}
开发者ID:pkarmstr,项目名称:NYBC,代码行数:8,代码来源:TestSetOnce.java
示例5: testSettingCtor
import org.apache.lucene.util.SetOnce.AlreadySetException; //导入依赖的package包/类
@Test(expected=AlreadySetException.class)
public void testSettingCtor() throws Exception {
SetOnce<Integer> set = new SetOnce<>(new Integer(5));
assertEquals(5, set.get().intValue());
set.set(new Integer(7));
}
开发者ID:europeana,项目名称:search,代码行数:7,代码来源:TestSetOnce.java
示例6: testSettingCtor
import org.apache.lucene.util.SetOnce.AlreadySetException; //导入依赖的package包/类
@Test(expected=AlreadySetException.class)
public void testSettingCtor() throws Exception {
SetOnce<Integer> set = new SetOnce<Integer>(new Integer(5));
assertEquals(5, set.get().intValue());
set.set(new Integer(7));
}
开发者ID:pkarmstr,项目名称:NYBC,代码行数:7,代码来源:TestSetOnce.java
注:本文中的org.apache.lucene.util.SetOnce.AlreadySetException类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论