use of org.apache.jackrabbit.oak.plugins.index.solr.configuration.nodestate.NodeStateSolrServersObserver in project jackrabbit-oak by apache.
the class SolrBaseTest method setUp.
@Before
public void setUp() throws Exception {
store = SegmentNodeStoreBuilders.builder(new MemoryStore()).build();
provider = new TestUtils();
server = provider.getSolrServer();
configuration = provider.getConfiguration();
hook = new EditorHook(new IndexUpdateProvider(new SolrIndexEditorProvider(provider, provider)));
Oak oak = new Oak().with(new InitialContent()).with(new OpenSecurityProvider()).with(// synchronous
new SolrIndexInitializer(false)).with(new SolrQueryIndexProvider(provider, provider)).with(new NodeStateSolrServersObserver()).with(new SolrIndexEditorProvider(provider, provider));
repository = oak.createContentRepository();
}
use of org.apache.jackrabbit.oak.plugins.index.solr.configuration.nodestate.NodeStateSolrServersObserver in project jackrabbit-oak by apache.
the class SolrOakRepositoryStub method preCreateRepository.
@Override
protected void preCreateRepository(Jcr jcr) {
File f = new File("target" + File.separatorChar + "queryjcrtest-" + System.currentTimeMillis());
final SolrClient solrServer;
try {
solrServer = new EmbeddedSolrServerProvider(new EmbeddedSolrServerConfiguration(f.getPath(), "oak")).getSolrServer();
} catch (Exception e) {
throw new RuntimeException(e);
}
SolrServerProvider solrServerProvider = new SolrServerProvider() {
@Override
public void close() throws IOException {
}
@CheckForNull
@Override
public SolrClient getSolrServer() throws Exception {
return solrServer;
}
@Override
public SolrClient getIndexingSolrServer() throws Exception {
return solrServer;
}
@Override
public SolrClient getSearchingSolrServer() throws Exception {
return solrServer;
}
};
try {
assertNotNull(solrServer);
// safely remove any previous document on the index
solrServer.deleteByQuery("*:*");
solrServer.commit();
} catch (Exception e) {
throw new RuntimeException(e);
}
OakSolrConfiguration configuration = new DefaultSolrConfiguration() {
@Nonnull
@Override
public CommitPolicy getCommitPolicy() {
return CommitPolicy.HARD;
}
};
OakSolrConfigurationProvider oakSolrConfigurationProvider = new DefaultSolrConfigurationProvider(configuration);
jcr.with(new SolrIndexInitializer(false)).with(AggregateIndexProvider.wrap(new SolrQueryIndexProvider(solrServerProvider, oakSolrConfigurationProvider))).with(new NodeStateSolrServersObserver()).with(new SolrIndexEditorProvider(solrServerProvider, oakSolrConfigurationProvider));
}
Aggregations