当前位置: 首页>>代码示例>>Java>>正文


Java EsSetup.client方法代码示例

本文整理汇总了Java中com.github.tlrx.elasticsearch.test.EsSetup.client方法的典型用法代码示例。如果您正苦于以下问题:Java EsSetup.client方法的具体用法?Java EsSetup.client怎么用?Java EsSetup.client使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在com.github.tlrx.elasticsearch.test.EsSetup的用法示例。


在下文中一共展示了EsSetup.client方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: setUpHttp

import com.github.tlrx.elasticsearch.test.EsSetup; //导入方法依赖的package包/类
@BeforeClass
public static void setUpHttp() throws Exception {
    Configuration.getInstance().setProperty(CoreConfig.DISCOVERY_MODULES.name(),
            "com.rackspacecloud.blueflood.io.ElasticIO");
    Configuration.getInstance().setProperty(CoreConfig.USE_ES_FOR_UNITS.name(), "true");
    queryPort = Configuration.getInstance().getIntegerProperty(HttpConfig.HTTP_METRIC_DATA_QUERY_PORT);
    httpQueryService = new HttpQueryService();
    httpQueryService.startService();
    vendor = new HttpClientVendor();
    client = vendor.getClient();

    esSetup = new EsSetup();
    esSetup.execute(EsSetup.deleteAll());
    esSetup.execute(EsSetup.createIndex(ElasticIO.ELASTICSEARCH_INDEX_NAME_WRITE)
            .withSettings(EsSetup.fromClassPath("index_settings.json"))
            .withMapping("metrics", EsSetup.fromClassPath("metrics_mapping.json")));
    elasticIO = new ElasticIO(esSetup.client());
}
 
开发者ID:rackerlabs,项目名称:blueflood,代码行数:19,代码来源:HttpRollupHandlerWithESIntegrationTest.java

示例2: setupElasticSearch

import com.github.tlrx.elasticsearch.test.EsSetup; //导入方法依赖的package包/类
private static void setupElasticSearch() {
    // setup elasticsearch

    // setup config
    System.setProperty(CoreConfig.DISCOVERY_MODULES.name(), "com.rackspacecloud.blueflood.io.ElasticIO");
    System.setProperty(CoreConfig.EVENTS_MODULES.name(), "com.rackspacecloud.blueflood.io.EventElasticSearchIO");

    // setup elasticsearch test clusters with blueflood mappings
    esSetup = new EsSetup();
    esSetup.execute(EsSetup.deleteAll());
    esSetup.execute(EsSetup.createIndex(ElasticIO.ELASTICSEARCH_INDEX_NAME_WRITE)
            .withSettings(EsSetup.fromClassPath("index_settings.json"))
            .withMapping("metrics", EsSetup.fromClassPath("metrics_mapping.json")));
    esSetup.execute(EsSetup.createIndex(EventElasticSearchIO.EVENT_INDEX)
            .withSettings(EsSetup.fromClassPath("index_settings.json"))
            .withMapping("graphite_event", EsSetup.fromClassPath("events_mapping.json")));

    // create elaticsearch client and link it to ModuleLoader
    elasticIO = new ElasticIO(esSetup.client());
    eventsSearchIO = new EventElasticSearchIO(esSetup.client());
    ((ElasticIO) ModuleLoader.getInstance(DiscoveryIO.class, CoreConfig.DISCOVERY_MODULES)).setClient(esSetup.client());
}
 
开发者ID:rackerlabs,项目名称:blueflood,代码行数:23,代码来源:HttpIntegrationTestBase.java

示例3: setUp

import com.github.tlrx.elasticsearch.test.EsSetup; //导入方法依赖的package包/类
@BeforeClass
public static void setUp() throws Exception{
    System.setProperty(CoreConfig.EVENTS_MODULES.name(), "com.rackspacecloud.blueflood.io.EventElasticSearchIO");
    Configuration.getInstance().init();
    httpPort = Configuration.getInstance().getIntegerProperty(HttpConfig.HTTP_INGESTION_PORT);
    manageShards.add(1); manageShards.add(5); manageShards.add(6);
    context = spy(new ScheduleContext(System.currentTimeMillis(), manageShards));

    esSetup = new EsSetup();
    esSetup.execute(EsSetup.deleteAll());
    esSetup.execute(EsSetup.createIndex(EventElasticSearchIO.EVENT_INDEX)
            .withSettings(EsSetup.fromClassPath("index_settings.json"))
            .withMapping("graphite_event", EsSetup.fromClassPath("events_mapping.json")));
    eventsSearchIO = new EventElasticSearchIO(esSetup.client());
    server = new HttpMetricsIngestionServer(context);
    server.setHttpEventsIngestionHandler(new HttpEventsIngestionHandler(eventsSearchIO));

    server.startServer();

    vendor = new HttpClientVendor();
    client = vendor.getClient();
}
 
开发者ID:rackerlabs,项目名称:blueflood,代码行数:23,代码来源:HttpMetricsIngestionServerShutdownIntegrationTest.java

示例4: setup

import com.github.tlrx.elasticsearch.test.EsSetup; //导入方法依赖的package包/类
@Before
public void setup() throws Exception {
    esSetup = new EsSetup();
    esSetup.execute(EsSetup.deleteAll());
    esSetup.execute(EsSetup
            .createIndex(EventElasticSearchIO.EVENT_INDEX)
            .withMapping(EventElasticSearchIO.ES_TYPE, EsSetup.fromClassPath("events_mapping.json")));
    searchIO = new EventElasticSearchIO(esSetup.client());

    createTestEvents(TENANT_1, TENANT_1_EVENTS_NUM);
    createTestEvents(TENANT_2, TENANT_2_EVENTS_NUM);
    createTestEvents(TENANT_WITH_SYMBOLS, TENANT_WITH_SYMBOLS_NUM);
    createRangeEvents(TENANT_RANGE, TENANT_RANGE_EVENTS_NUM, RANGE_STEP_IN_SECONDS);

    esSetup.client().admin().indices().prepareRefresh().execute().actionGet();
}
 
开发者ID:rackerlabs,项目名称:blueflood,代码行数:17,代码来源:EventElasticSearchIOTest.java

示例5: setupClass

import com.github.tlrx.elasticsearch.test.EsSetup; //导入方法依赖的package包/类
@BeforeClass
public static void setupClass() throws Exception {
    final Settings settings = ImmutableSettings.settingsBuilder().put("script.disable_dynamic", false)
            .put("script.native.visibility.type", "ezbake.data.elastic.security.EzSecurityScriptFactory").build();

    esSetup = new EsSetup(settings);
    esSetup.execute(EsSetup.deleteAll());

    if (esSetup.client() == null) {
        throw new Exception("Could not start EsSetup node!");
    }
}
 
开发者ID:ezbake,项目名称:ezelastic,代码行数:13,代码来源:ElasticClientTest.java

示例6: setUpClass

import com.github.tlrx.elasticsearch.test.EsSetup; //导入方法依赖的package包/类
@BeforeClass
public static void setUpClass() throws Exception {
    gson = new GsonBuilder().setDateFormat("ddHHmm'Z' MMM yy").create();
    configuration = new EzConfiguration(new ClasspathConfigurationLoader()).getProperties();

    final EzBakeApplicationConfigurationHelper appConfig = new EzBakeApplicationConfigurationHelper(configuration);

    final String securityId = appConfig.getSecurityID();
    fakeSecurity =
            ThriftTestUtils.generateTestSecurityToken(securityId, securityId, Collections.singletonList("U"));
    applicationName = appConfig.getApplicationName();
    configuration.setProperty(EzBakePropertyConstants.ELASTICSEARCH_CLUSTER_NAME, "elasticsearch");
    final ElasticsearchConfigurationHelper helper = new ElasticsearchConfigurationHelper(configuration);

    final Settings settings = ImmutableSettings.settingsBuilder()
            .put("script.native.visibility.type", "ezbake.data.elastic.security.EzSecurityScriptFactory")
            .put("cluster.name", helper.getElasticsearchClusterName()).put("script.disable_dynamic", false)
            .put("network.host", helper.getElasticsearchHost())
            .put("transport.tcp.port", helper.getElasticsearchPort()).put("node.local", false).build();

    esSetup = new EsSetup(settings);
    esSetup.execute(EsSetup.deleteAll());

    if (esSetup.client() == null) {
        throw new Exception("Could not start EsSetup node!");
    }
}
 
开发者ID:ezbake,项目名称:ezelastic,代码行数:28,代码来源:IT_EzElasticIntegrationTest.java

示例7: setUp

import com.github.tlrx.elasticsearch.test.EsSetup; //导入方法依赖的package包/类
@BeforeClass
public static void setUp() throws Exception {
    System.setProperty(CoreConfig.EVENTS_MODULES.name(), "com.rackspacecloud.blueflood.io.EventElasticSearchIO");
    Configuration.getInstance().init();
    httpPort = Configuration.getInstance().getIntegerProperty(HttpConfig.HTTP_INGESTION_PORT);
    queryPort = Configuration.getInstance().getIntegerProperty(HttpConfig.HTTP_METRIC_DATA_QUERY_PORT);
    manageShards.add(1); manageShards.add(5); manageShards.add(6);
    context = spy(new ScheduleContext(System.currentTimeMillis(), manageShards));

    esSetup = new EsSetup();
    esSetup.execute(EsSetup.deleteAll());
    esSetup.execute(EsSetup.createIndex(EventElasticSearchIO.EVENT_INDEX)
            .withSettings(EsSetup.fromClassPath("index_settings.json"))
            .withMapping("graphite_event", EsSetup.fromClassPath("events_mapping.json")));
    eventsSearchIO = new EventElasticSearchIO(esSetup.client());
    HttpMetricsIngestionServer server = new HttpMetricsIngestionServer(context);
    server.setHttpEventsIngestionHandler(new HttpEventsIngestionHandler(eventsSearchIO));

    httpIngestionService = new HttpIngestionService();
    httpIngestionService.setMetricsIngestionServer(server);
    httpIngestionService.startService(context);

    httpQueryService = new HttpQueryService();
    HttpMetricDataQueryServer queryServer = new HttpMetricDataQueryServer();
    queryServer.setEventsIO(eventsSearchIO);
    httpQueryService.setServer(queryServer);
    httpQueryService.startService();

    vendor = new HttpClientVendor();
    client = vendor.getClient();
}
 
开发者ID:rackerlabs,项目名称:blueflood,代码行数:32,代码来源:HttpAnnotationsEndToEndTest.java

示例8: setup

import com.github.tlrx.elasticsearch.test.EsSetup; //导入方法依赖的package包/类
@Before
public void setup() throws IOException {
    esSetup = new EsSetup();
    esSetup.execute(EsSetup.deleteAll());
    esSetup.execute(EsSetup.createIndex(ElasticIO.ELASTICSEARCH_INDEX_NAME_WRITE)
            .withSettings(EsSetup.fromClassPath("index_settings.json"))
            .withMapping("metrics", EsSetup.fromClassPath("metrics_mapping.json")));

    elasticIO = new ElasticIO(esSetup.client());

    elasticIO.insertDiscovery(createTestMetrics(TENANT_A));
    elasticIO.insertDiscovery(createTestMetrics(TENANT_B));
    elasticIO.insertDiscovery(createTestMetricsFromInterface(TENANT_C));

    esSetup.execute(EsSetup.createIndex(ElasticTokensIO.ELASTICSEARCH_TOKEN_INDEX_NAME_WRITE)
                           .withMapping("tokens", EsSetup.fromClassPath("tokens_mapping.json")));

    String TOKEN_INDEX_NAME_OLD = ElasticTokensIO.ELASTICSEARCH_TOKEN_INDEX_NAME_WRITE + "_v1";
    esSetup.execute(EsSetup.createIndex(TOKEN_INDEX_NAME_OLD)
                           .withMapping("tokens", EsSetup.fromClassPath("tokens_mapping.json")));

    elasticTokensIO = new ElasticTokensIO(esSetup.client()) {
        @Override
        protected String[] getIndexesToSearch() {
            return new String[] {ElasticTokensIO.ELASTICSEARCH_TOKEN_INDEX_NAME_READ,
                                 TOKEN_INDEX_NAME_OLD};
        }
    };

    //inserting to metric_tokens
    elasticTokensIO.insertDiscovery(createTestTokens(TENANT_A));
    elasticTokensIO.insertDiscovery(createTestTokens(TENANT_B));
    elasticTokensIO.insertDiscovery(createTestTokens(TENANT_C));

    //inserting same tokens to old version of metric_tokens
    this.insertTokenDiscovery(createTestTokens(TENANT_A), TOKEN_INDEX_NAME_OLD, esSetup.client());
    this.insertTokenDiscovery(createTestTokens(TENANT_B), TOKEN_INDEX_NAME_OLD, esSetup.client());
    this.insertTokenDiscovery(createTestTokens(TENANT_C), TOKEN_INDEX_NAME_OLD, esSetup.client());

    esSetup.client().admin().indices().prepareRefresh().execute().actionGet();
}
 
开发者ID:rackerlabs,项目名称:blueflood,代码行数:42,代码来源:ElasticIOIntegrationTest.java


注:本文中的com.github.tlrx.elasticsearch.test.EsSetup.client方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。