@Test public void getTestClient() throws Exception { Solr solr = this.componentManager.getInstance(Solr.class); SolrUtils solrUtils = this.componentManager.getInstance(SolrUtils.class); SolrClient client = solr.getClient("test"); assertNotNull(client); Map<String, Object> fieldAttributes = new HashMap<>(); fieldAttributes.put("name", "content"); fieldAttributes.put("type", "string"); new SchemaRequest.AddField(fieldAttributes).process(client); fieldAttributes.put("name", "testlocale"); new SchemaRequest.AddField(fieldAttributes).process(client); fieldAttributes.put("name", "testlist"); fieldAttributes.put("multiValued", true); new SchemaRequest.AddField(fieldAttributes).process(client); SolrInputDocument inputDocument = new SolrInputDocument(); solrUtils.setId("42", inputDocument); solrUtils.set("content", "content1", inputDocument); Map<String, Object> map = new HashMap<>(); map.put("teststring", "testvalue"); map.put("testint", Integer.MAX_VALUE); map.put("testlong", Long.MAX_VALUE); map.put("testfloat", Float.MAX_VALUE); map.put("testdouble", Double.MAX_VALUE); map.put("testbinary", new byte[] {1, 2, 3, 4, 5}); map.put("teststrings", Arrays.asList("testvalue1", "testvalue2")); map.put("testints", new int[] {43, 44}); solrUtils.setMap("testmap", map, inputDocument); solrUtils.setString("testlocale", Locale.FRANCE, inputDocument); client.add(inputDocument); client.commit(); SolrDocument storedDocument = client.getById("42"); assertEquals("42", solrUtils.getId(storedDocument)); assertEquals("content1", solrUtils.get("content", storedDocument)); assertEquals(Locale.FRANCE, solrUtils.get("testlocale", storedDocument, Locale.class)); Map<String, Object> storedMap = solrUtils.getMap("testmap", storedDocument); assertEquals("testvalue", storedMap.get("teststring")); assertEquals(Integer.MAX_VALUE, storedMap.get("testint")); assertEquals(Long.MAX_VALUE, storedMap.get("testlong")); assertEquals(Float.MAX_VALUE, storedMap.get("testfloat")); assertEquals(Double.MAX_VALUE, storedMap.get("testdouble")); assertArrayEquals(new byte[] {1, 2, 3, 4, 5}, (byte[]) storedMap.get("testbinary")); assertEquals(Arrays.asList("testvalue1", "testvalue2"), storedMap.get("teststrings")); assertEquals(Arrays.asList(43, 44), storedMap.get("testints")); assertNotNull(storedDocument); SchemaResponse.FieldTypeResponse response = new SchemaRequest.FieldType("__xversion").process(client); assertEquals(String.valueOf(AbstractSolrCoreInitializer.SCHEMA_BASE_VERSION), response.getFieldType().getAttributes().get("defVal")); response = new SchemaRequest.FieldType("__cversion").process(client); assertEquals(String.valueOf(TestSolrCoreInitializer.VERSION), response.getFieldType().getAttributes().get("defVal")); inputDocument = new SolrInputDocument(); solrUtils.setId("42", inputDocument); solrUtils.setAtomic(SolrUtils.ATOMIC_UPDATE_MODIFIER_ADD_DISTINCT, "testlist", "atomic", inputDocument); client.add(inputDocument); client.commit(); assertEquals(Arrays.asList("atomic"), solrUtils.get("testlist", client.getById("42"))); solrUtils.setAtomic(SolrUtils.ATOMIC_UPDATE_MODIFIER_ADD_DISTINCT, "testlist", "atomic2", inputDocument); client.add(inputDocument); client.commit(); assertEquals(Arrays.asList("atomic", "atomic2"), solrUtils.get("testlist", client.getById("42"))); solrUtils.setAtomic(SolrUtils.ATOMIC_UPDATE_MODIFIER_ADD_DISTINCT, "testlist", "atomic2", inputDocument); client.add(inputDocument); client.commit(); assertEquals(Arrays.asList("atomic", "atomic2"), solrUtils.get("testlist", client.getById("42"))); solrUtils.setAtomic(SolrUtils.ATOMIC_UPDATE_MODIFIER_REMOVE, "testlist", "atomic2", inputDocument); client.add(inputDocument); client.commit(); assertEquals(Arrays.asList("atomic"), solrUtils.get("testlist", client.getById("42"))); }
@Override public SolrClient getClient(String name) throws SolrException { return this.configuredSolr.getClient(name); }
DefaultSolr implements Solr, Initializable { @Override public SolrClient getClient(String name) throws SolrException { return this.configuredSolr.getClient(name); } }
DefaultSolr implements Solr, Initializable { @Override public SolrClient getClient(String name) throws SolrException { return this.configuredSolr.getClient(name); }  }
DefaultSolr implements Solr, Initializable { @Override public SolrClient getClient(String name) throws SolrException { return this.configuredSolr.getClient(name); }  @Override void initialize(); @Override SolrClient getClient(String name); }
DefaultSolr implements Solr, Initializable { @Override public SolrClient getClient(String name) throws SolrException { return this.configuredSolr.getClient(name); }  @Override void initialize(); @Override SolrClient getClient(String name);  }