本文整理汇总了Java中org.apache.streams.config.ComponentConfigurator类的典型用法代码示例。如果您正苦于以下问题:Java ComponentConfigurator类的具体用法?Java ComponentConfigurator怎么用?Java ComponentConfigurator使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
ComponentConfigurator类属于org.apache.streams.config包,在下文中一共展示了ComponentConfigurator类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。
示例1: prepareTest
import org.apache.streams.config.ComponentConfigurator; //导入依赖的package包/类
@BeforeClass
public void prepareTest() throws Exception {
Config reference = ConfigFactory.load();
File conf_file = new File("target/test-classes/TwitterUserstreamElasticsearchIT.conf");
assert(conf_file.exists());
Config testResourceConfig = ConfigFactory.parseFileAnySyntax(conf_file, ConfigParseOptions.defaults().setAllowMissing(false));
Config typesafe = testResourceConfig.withFallback(reference).resolve();
testConfiguration = new ComponentConfigurator<>(TwitterUserstreamElasticsearchConfiguration.class).detectConfiguration(typesafe);
testClient = ElasticsearchClientManager.getInstance(testConfiguration.getElasticsearch()).client();
ClusterHealthRequest clusterHealthRequest = Requests.clusterHealthRequest();
ClusterHealthResponse clusterHealthResponse = testClient.admin().cluster().health(clusterHealthRequest).actionGet();
assertNotEquals(clusterHealthResponse.getStatus(), ClusterHealthStatus.RED);
IndicesExistsRequest indicesExistsRequest = Requests.indicesExistsRequest(testConfiguration.getElasticsearch().getIndex());
IndicesExistsResponse indicesExistsResponse = testClient.admin().indices().exists(indicesExistsRequest).actionGet();
if(indicesExistsResponse.isExists()) {
DeleteIndexRequest deleteIndexRequest = Requests.deleteIndexRequest(testConfiguration.getElasticsearch().getIndex());
DeleteIndexResponse deleteIndexResponse = testClient.admin().indices().delete(deleteIndexRequest).actionGet();
assertTrue(deleteIndexResponse.isAcknowledged());
};
}
示例2: prepareTest
import org.apache.streams.config.ComponentConfigurator; //导入依赖的package包/类
@BeforeClass
public void prepareTest() throws Exception {
Config reference = ConfigFactory.load();
File conf_file = new File("target/test-classes/MongoElasticsearchSyncIT.conf");
assert(conf_file.exists());
Config testResourceConfig = ConfigFactory.parseFileAnySyntax(conf_file, ConfigParseOptions.defaults().setAllowMissing(false));
Config typesafe = testResourceConfig.withFallback(reference).resolve();
testConfiguration = new ComponentConfigurator<>(MongoElasticsearchSyncConfiguration.class).detectConfiguration(typesafe);
testClient = ElasticsearchClientManager.getInstance(testConfiguration.getDestination()).client();
ClusterHealthRequest clusterHealthRequest = Requests.clusterHealthRequest();
ClusterHealthResponse clusterHealthResponse = testClient.admin().cluster().health(clusterHealthRequest).actionGet();
assertNotEquals(clusterHealthResponse.getStatus(), ClusterHealthStatus.RED);
IndicesExistsRequest indicesExistsRequest = Requests.indicesExistsRequest(testConfiguration.getDestination().getIndex());
IndicesExistsResponse indicesExistsResponse = testClient.admin().indices().exists(indicesExistsRequest).actionGet();
assertFalse(indicesExistsResponse.isExists());
}
示例3: prepareTest
import org.apache.streams.config.ComponentConfigurator; //导入依赖的package包/类
@BeforeClass
public void prepareTest() throws Exception {
Config reference = ConfigFactory.load();
File conf_file = new File("target/test-classes/HdfsElasticsearchIT.conf");
assert(conf_file.exists());
Config testResourceConfig = ConfigFactory.parseFileAnySyntax(conf_file, ConfigParseOptions.defaults().setAllowMissing(false));
Config typesafe = testResourceConfig.withFallback(reference).resolve();
testConfiguration = new ComponentConfigurator<>(HdfsElasticsearchConfiguration.class).detectConfiguration(typesafe);
testClient = ElasticsearchClientManager.getInstance(testConfiguration.getDestination()).client();
ClusterHealthRequest clusterHealthRequest = Requests.clusterHealthRequest();
ClusterHealthResponse clusterHealthResponse = testClient.admin().cluster().health(clusterHealthRequest).actionGet();
assertNotEquals(clusterHealthResponse.getStatus(), ClusterHealthStatus.RED);
IndicesExistsRequest indicesExistsRequest = Requests.indicesExistsRequest(testConfiguration.getDestination().getIndex());
IndicesExistsResponse indicesExistsResponse = testClient.admin().indices().exists(indicesExistsRequest).actionGet();
if(indicesExistsResponse.isExists()) {
DeleteIndexRequest deleteIndexRequest = Requests.deleteIndexRequest(testConfiguration.getDestination().getIndex());
DeleteIndexResponse deleteIndexResponse = testClient.admin().indices().delete(deleteIndexRequest).actionGet();
assertTrue(deleteIndexResponse.isAcknowledged());
};
}
示例4: prepareTest
import org.apache.streams.config.ComponentConfigurator; //导入依赖的package包/类
@BeforeClass
public void prepareTest() throws IOException {
Config reference = ConfigFactory.load();
File conf = new File("target/test-classes/TwitterFollowNeo4jIT.conf");
assertTrue(conf.exists());
Config testResourceConfig = ConfigFactory.parseFileAnySyntax(conf, ConfigParseOptions.defaults().setAllowMissing(false));
Config typesafe = testResourceConfig.withFallback(reference).resolve();
testConfiguration = new ComponentConfigurator<>(TwitterFollowNeo4jConfiguration.class).detectConfiguration(typesafe);
testClient = Neo4jBoltClient.getInstance(testConfiguration.getNeo4j());
Session session = testClient.client().session();
Transaction transaction = session.beginTransaction();
transaction.run("MATCH ()-[r]-() DELETE r");
transaction.run("MATCH (n) DETACH DELETE n");
transaction.success();
session.close();
}
示例5: prepareTest
import org.apache.streams.config.ComponentConfigurator; //导入依赖的package包/类
@BeforeClass
public void prepareTest() throws Exception {
Config reference = ConfigFactory.load();
File conf_file = new File("target/test-classes/TwitterHistoryElasticsearchIT.conf");
assert(conf_file.exists());
Config testResourceConfig = ConfigFactory.parseFileAnySyntax(conf_file, ConfigParseOptions.defaults().setAllowMissing(false));
Config typesafe = testResourceConfig.withFallback(reference).resolve();
testConfiguration = new ComponentConfigurator<>(TwitterHistoryElasticsearchConfiguration.class).detectConfiguration(typesafe);
testClient = ElasticsearchClientManager.getInstance(testConfiguration.getElasticsearch()).client();
ClusterHealthRequest clusterHealthRequest = Requests.clusterHealthRequest();
ClusterHealthResponse clusterHealthResponse = testClient.admin().cluster().health(clusterHealthRequest).actionGet();
assertNotEquals(clusterHealthResponse.getStatus(), ClusterHealthStatus.RED);
IndicesExistsRequest indicesExistsRequest = Requests.indicesExistsRequest(testConfiguration.getElasticsearch().getIndex());
IndicesExistsResponse indicesExistsResponse = testClient.admin().indices().exists(indicesExistsRequest).actionGet();
if(indicesExistsResponse.isExists()) {
DeleteIndexRequest deleteIndexRequest = Requests.deleteIndexRequest(testConfiguration.getElasticsearch().getIndex());
DeleteIndexResponse deleteIndexResponse = testClient.admin().indices().delete(deleteIndexRequest).actionGet();
assertTrue(deleteIndexResponse.isAcknowledged());
};
}
示例6: prepareTest
import org.apache.streams.config.ComponentConfigurator; //导入依赖的package包/类
@BeforeClass
public void prepareTest() throws Exception {
Config reference = ConfigFactory.load();
File conf_file = new File("target/test-classes/ElasticsearchReindexParentIT.conf");
assert(conf_file.exists());
Config testResourceConfig = ConfigFactory.parseFileAnySyntax(conf_file, ConfigParseOptions.defaults().setAllowMissing(false));
Config typesafe = testResourceConfig.withFallback(reference).resolve();
testConfiguration = new ComponentConfigurator<>(ElasticsearchReindexConfiguration.class).detectConfiguration(typesafe);
testClient = ElasticsearchClientManager.getInstance(testConfiguration.getSource()).client();
ClusterHealthRequest clusterHealthRequest = Requests.clusterHealthRequest();
ClusterHealthResponse clusterHealthResponse = testClient.admin().cluster().health(clusterHealthRequest).actionGet();
assertThat(clusterHealthResponse.getStatus(), not(ClusterHealthStatus.RED));
IndicesExistsRequest indicesExistsRequest = Requests.indicesExistsRequest(testConfiguration.getSource().getIndexes().get(0));
IndicesExistsResponse indicesExistsResponse = testClient.admin().indices().exists(indicesExistsRequest).actionGet();
assertTrue(indicesExistsResponse.isExists());
SearchRequestBuilder countRequest = testClient
.prepareSearch(testConfiguration.getSource().getIndexes().get(0))
.setTypes(testConfiguration.getSource().getTypes().get(0));
SearchResponse countResponse = countRequest.execute().actionGet();
count = (int)countResponse.getHits().getTotalHits();
PutIndexTemplateRequestBuilder putTemplateRequestBuilder = testClient.admin().indices().preparePutTemplate("mappings");
URL templateURL = ElasticsearchParentChildWriterIT.class.getResource("/ActivityChildObjectParent.json");
ObjectNode template = MAPPER.readValue(templateURL, ObjectNode.class);
String templateSource = MAPPER.writeValueAsString(template);
putTemplateRequestBuilder.setSource(templateSource);
testClient.admin().indices().putTemplate(putTemplateRequestBuilder.request()).actionGet();
assertThat(count, not(0));
}
示例7: prepareTest
import org.apache.streams.config.ComponentConfigurator; //导入依赖的package包/类
@BeforeClass
public void prepareTest() throws Exception {
Config reference = ConfigFactory.load();
File conf_file = new File("target/test-classes/ElasticsearchReindexIT.conf");
assert(conf_file.exists());
Config testResourceConfig = ConfigFactory.parseFileAnySyntax(conf_file, ConfigParseOptions.defaults().setAllowMissing(false));
Config typesafe = testResourceConfig.withFallback(reference).resolve();
testConfiguration = new ComponentConfigurator<>(ElasticsearchReindexConfiguration.class).detectConfiguration(typesafe);
testClient = ElasticsearchClientManager.getInstance(testConfiguration.getSource()).client();
ClusterHealthRequest clusterHealthRequest = Requests.clusterHealthRequest();
ClusterHealthResponse clusterHealthResponse = testClient.admin().cluster().health(clusterHealthRequest).actionGet();
assertThat(clusterHealthResponse.getStatus(), not(ClusterHealthStatus.RED));
IndicesExistsRequest indicesExistsRequest = Requests.indicesExistsRequest(testConfiguration.getSource().getIndexes().get(0));
IndicesExistsResponse indicesExistsResponse = testClient.admin().indices().exists(indicesExistsRequest).actionGet();
assertThat(indicesExistsResponse.isExists(), is(true));
SearchRequestBuilder countRequest = testClient
.prepareSearch(testConfiguration.getSource().getIndexes().get(0))
.setTypes(testConfiguration.getSource().getTypes().get(0));
SearchResponse countResponse = countRequest.execute().actionGet();
count = (int)countResponse.getHits().getTotalHits();
assertThat(count, not(0));
}
示例8: prepareTest
import org.apache.streams.config.ComponentConfigurator; //导入依赖的package包/类
@BeforeClass
public void prepareTest() throws Exception {
Config reference = ConfigFactory.load();
File conf_file = new File("target/test-classes/ElasticsearchReindexChildIT.conf");
assert(conf_file.exists());
Config testResourceConfig = ConfigFactory.parseFileAnySyntax(conf_file, ConfigParseOptions.defaults().setAllowMissing(false));
Config typesafe = testResourceConfig.withFallback(reference).resolve();
testConfiguration = new ComponentConfigurator<>(ElasticsearchReindexConfiguration.class).detectConfiguration(typesafe);
testClient = ElasticsearchClientManager.getInstance(testConfiguration.getSource()).client();
ClusterHealthRequest clusterHealthRequest = Requests.clusterHealthRequest();
ClusterHealthResponse clusterHealthResponse = testClient.admin().cluster().health(clusterHealthRequest).actionGet();
assertNotEquals(clusterHealthResponse.getStatus(), ClusterHealthStatus.RED);
IndicesExistsRequest indicesExistsRequest = Requests.indicesExistsRequest(testConfiguration.getSource().getIndexes().get(0));
IndicesExistsResponse indicesExistsResponse = testClient.admin().indices().exists(indicesExistsRequest).actionGet();
assertThat(indicesExistsResponse.isExists(), is(true));
SearchRequestBuilder countRequest = testClient
.prepareSearch(testConfiguration.getSource().getIndexes().get(0))
.setTypes(testConfiguration.getSource().getTypes().get(0));
SearchResponse countResponse = countRequest.execute().actionGet();
count = (int)countResponse.getHits().getTotalHits();
assertNotEquals(count, 0);
}
示例9: prepareTest
import org.apache.streams.config.ComponentConfigurator; //导入依赖的package包/类
@BeforeClass
public void prepareTest() throws Exception {
Config reference = ConfigFactory.load();
File conf_file = new File("target/test-classes/ElasticsearchHdfsIT.conf");
assert(conf_file.exists());
Config testResourceConfig = ConfigFactory.parseFileAnySyntax(conf_file, ConfigParseOptions.defaults().setAllowMissing(false));
Config typesafe = testResourceConfig.withFallback(reference).resolve();
testConfiguration = new ComponentConfigurator<>(ElasticsearchHdfsConfiguration.class).detectConfiguration(typesafe);
testClient = ElasticsearchClientManager.getInstance(testConfiguration.getSource()).client();
ClusterHealthRequest clusterHealthRequest = Requests.clusterHealthRequest();
ClusterHealthResponse clusterHealthResponse = testClient.admin().cluster().health(clusterHealthRequest).actionGet();
assertNotEquals(clusterHealthResponse.getStatus(), ClusterHealthStatus.RED);
IndicesExistsRequest indicesExistsRequest = Requests.indicesExistsRequest(testConfiguration.getSource().getIndexes().get(0));
IndicesExistsResponse indicesExistsResponse = testClient.admin().indices().exists(indicesExistsRequest).actionGet();
assertThat(indicesExistsResponse.isExists(), is(true));
SearchRequestBuilder countRequest = testClient
.prepareSearch(testConfiguration.getSource().getIndexes().get(0))
.setTypes(testConfiguration.getSource().getTypes().get(0));
SearchResponse countResponse = countRequest.execute().actionGet();
count = (int)countResponse.getHits().getTotalHits();
assertNotEquals(count, 0);
}
示例10: MongoElasticsearchSync
import org.apache.streams.config.ComponentConfigurator; //导入依赖的package包/类
public MongoElasticsearchSync() {
this(new ComponentConfigurator<MongoElasticsearchSyncConfiguration>(MongoElasticsearchSyncConfiguration.class).detectConfiguration(StreamsConfigurator.getConfig()));
}
示例11: HdfsElasticsearch
import org.apache.streams.config.ComponentConfigurator; //导入依赖的package包/类
public HdfsElasticsearch() {
this(new ComponentConfigurator<>(HdfsElasticsearchConfiguration.class).detectConfiguration(StreamsConfigurator.getConfig()));
}
示例12: ElasticsearchHdfs
import org.apache.streams.config.ComponentConfigurator; //导入依赖的package包/类
public ElasticsearchHdfs() {
this(new ComponentConfigurator<>(ElasticsearchHdfsConfiguration.class).detectConfiguration(StreamsConfigurator.getConfig()));
}
示例13: TwitterFollowNeo4j
import org.apache.streams.config.ComponentConfigurator; //导入依赖的package包/类
public TwitterFollowNeo4j() {
this(new ComponentConfigurator<>(TwitterFollowNeo4jConfiguration.class).detectConfiguration(StreamsConfigurator.getConfig()));
}
示例14: TwitterHistoryElasticsearch
import org.apache.streams.config.ComponentConfigurator; //导入依赖的package包/类
public TwitterHistoryElasticsearch() {
this(new ComponentConfigurator<>(TwitterHistoryElasticsearchConfiguration.class).detectConfiguration(StreamsConfigurator.getConfig()));
}
示例15: TwitterUserstreamElasticsearch
import org.apache.streams.config.ComponentConfigurator; //导入依赖的package包/类
public TwitterUserstreamElasticsearch() {
this(new ComponentConfigurator<>(TwitterUserstreamElasticsearchConfiguration.class).detectConfiguration(StreamsConfigurator.getConfig()));
}