use of org.apache.solr.rest.ManagedResource in project lucene-solr by apache.
the class TestModelManager method test.
@Test
public void test() throws Exception {
final SolrResourceLoader loader = new SolrResourceLoader(tmpSolrHome.toPath());
final RestManager.Registry registry = loader.getManagedResourceRegistry();
assertNotNull("Expected a non-null RestManager.Registry from the SolrResourceLoader!", registry);
final String resourceId = "/schema/fstore1";
registry.registerManagedResource(resourceId, ManagedFeatureStore.class, new LTRQParserPlugin());
final String resourceId2 = "/schema/mstore1";
registry.registerManagedResource(resourceId2, ManagedModelStore.class, new LTRQParserPlugin());
final NamedList<String> initArgs = new NamedList<>();
final RestManager restManager = new RestManager();
restManager.init(loader, initArgs, new ManagedResourceStorage.InMemoryStorageIO());
final ManagedResource res = restManager.getManagedResource(resourceId);
assertTrue(res instanceof ManagedFeatureStore);
assertEquals(res.getResourceId(), resourceId);
}
Aggregations