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


Java Context.config方法代码示例

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


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

示例1: start

import io.vertx.core.Context; //导入方法依赖的package包/类
@Test
public void start(@Mocked Context context) throws Exception {
  AtomicInteger count = new AtomicInteger();
  ClientPoolManager<HttpClientWithContext> clientMgr = new MockUp<ClientPoolManager<HttpClientWithContext>>() {
    @Mock
    HttpClientWithContext createClientPool() {
      count.incrementAndGet();
      return null;
    }
  }.getMockInstance();
  clientVerticle.init(null, context);

  JsonObject config = new SimpleJsonObject();
  config.put(ClientVerticle.CLIENT_MGR, clientMgr);
  new Expectations() {
    {
      context.config();
      result = config;
    }
  };

  clientVerticle.start();

  Assert.assertEquals(1, count.get());
}
 
开发者ID:apache,项目名称:incubator-servicecomb-java-chassis,代码行数:26,代码来源:TestClientVerticle.java

示例2: testRestServerVerticleWithRouter

import io.vertx.core.Context; //导入方法依赖的package包/类
@Test
public void testRestServerVerticleWithRouter(@Mocked Transport transport, @Mocked Vertx vertx,
    @Mocked Context context,
    @Mocked JsonObject jsonObject, @Mocked Future<Void> startFuture) throws Exception {
  URIEndpointObject endpointObject = new URIEndpointObject("http://127.0.0.1:8080");
  new Expectations() {
    {
      transport.parseAddress("http://127.0.0.1:8080");
      result = endpointObject;
    }
  };
  Endpoint endpiont = new Endpoint(transport, "http://127.0.0.1:8080");

  new Expectations() {
    {
      context.config();
      result = jsonObject;
      jsonObject.getValue(AbstractTransport.ENDPOINT_KEY);
      result = endpiont;
    }
  };
  RestServerVerticle server = new RestServerVerticle();
  // process stuff done by Expectations
  server.init(vertx, context);
  server.start(startFuture);
}
 
开发者ID:apache,项目名称:incubator-servicecomb-java-chassis,代码行数:27,代码来源:TestRestServerVerticle.java

示例3: testRestServerVerticleWithRouterSSL

import io.vertx.core.Context; //导入方法依赖的package包/类
@Test
public void testRestServerVerticleWithRouterSSL(@Mocked Transport transport, @Mocked Vertx vertx,
    @Mocked Context context,
    @Mocked JsonObject jsonObject, @Mocked Future<Void> startFuture) throws Exception {
  URIEndpointObject endpointObject = new URIEndpointObject("http://127.0.0.1:8080?sslEnabled=true");
  new Expectations() {
    {
      transport.parseAddress("http://127.0.0.1:8080?sslEnabled=true");
      result = endpointObject;
    }
  };
  Endpoint endpiont = new Endpoint(transport, "http://127.0.0.1:8080?sslEnabled=true");

  new Expectations() {
    {
      context.config();
      result = jsonObject;
      jsonObject.getValue(AbstractTransport.ENDPOINT_KEY);
      result = endpiont;
    }
  };
  RestServerVerticle server = new RestServerVerticle();
  // process stuff done by Expectations
  server.init(vertx, context);
  server.start(startFuture);
}
 
开发者ID:apache,项目名称:incubator-servicecomb-java-chassis,代码行数:27,代码来源:TestRestServerVerticle.java

示例4: testHighwayVerticle

import io.vertx.core.Context; //导入方法依赖的package包/类
@Test
public void testHighwayVerticle(@Mocked Transport transport, @Mocked Vertx vertx, @Mocked Context context,
    @Mocked JsonObject json) {
  URIEndpointObject endpiontObject = new URIEndpointObject("highway://127.0.0.1:9090");
  new Expectations() {
    {
      transport.parseAddress(anyString);
      result = endpiontObject;
    }
  };

  Endpoint endpoint = new Endpoint(transport, "highway://127.0.0.1:9090");

  new Expectations() {
    {
      context.config();
      result = json;
      json.getValue(anyString);
      result = endpoint;
    }
  };

  highwayVerticle.init(vertx, context);
  @SuppressWarnings("unchecked")
  Future<Void> startFuture = Mockito.mock(Future.class);
  highwayVerticle.startListen(startFuture);
  MockUtil.getInstance().mockHighwayConfig();
  try {
    highwayVerticle.startListen(startFuture);
    Assert.assertTrue(true);
  } catch (Exception e) {
    Assert.assertTrue(false);
  }
}
 
开发者ID:apache,项目名称:incubator-servicecomb-java-chassis,代码行数:35,代码来源:TestHighwayVerticle.java

示例5: init

import io.vertx.core.Context; //导入方法依赖的package包/类
public static void init(Context vertxContext) {
    Constants.vertx = vertxContext.owner();
    Constants.vertxContext = vertxContext;
    JsonObject config = vertxContext.config();
    PROJ_URL = config.getString("projectUrl", "http://itq46u.natappfree.cc/");
    CERT_DIR = config.getString("certDir", "/home/leibniz/");
    JDBC_URL = config.getString("jdbcUrl", "jdbc:mysql://127.0.0.1:3306/fission?useUnicode=true&characterEncoding=UTF-8&useSSL=false&autoReconnect=true&failOverReadOnly=false");
    JDBC_USER = config.getString("jdbcUser", "root");
    JDBC_PSWD = config.getString("jdbcPassword", "turingdi");
    JDBC_DRIVER = config.getString("jdbcDriver", "com.mysql.cj.jdbc.Driver");
}
 
开发者ID:Leibnizhu,项目名称:AlipayWechatPlatform,代码行数:12,代码来源:Constants.java

示例6: BoundingBoxIndexerFactory

import io.vertx.core.Context; //导入方法依赖的package包/类
/**
 * Default constructor
 */
public BoundingBoxIndexerFactory() {
  Context ctx = Vertx.currentContext();
  if (ctx != null) {
    JsonObject config = ctx.config();
    if (config != null) {
      setDefaultCrs(config.getString(ConfigConstants.QUERY_DEFAULT_CRS));
    }
  }
}
 
开发者ID:georocket,项目名称:georocket,代码行数:13,代码来源:BoundingBoxIndexerFactory.java

示例7: getMapping

import io.vertx.core.Context; //导入方法依赖的package包/类
@Override
public Map<String, Object> getMapping() {
  String precisionKey;
  Object precisionValue = null;

  // check if we have a current Vert.x context from which we can get the config
  Context ctx = Vertx.currentContext();
  if (ctx != null) {
    JsonObject config = ctx.config();
    if (config != null) {
      precisionValue = config.getString(ConfigConstants.INDEX_SPATIAL_PRECISION);
    }
  }

  if (precisionValue == null) {
    // use the maximum number of tree levels to achieve highest precision
    // see org.apache.lucene.spatial.prefix.tree.PackedQuadPrefixTree.MAX_LEVELS_POSSIBLE
    precisionKey = "tree_levels";
    precisionValue = 29;
  } else {
    precisionKey = "precision";
  }

  return ImmutableMap.of("properties", ImmutableMap.of("bbox", ImmutableMap.of(
      "type", "geo_shape",
      
      // for a discussion on the tree type to use see
      // https://github.com/elastic/elasticsearch/issues/14181
      
      // quadtree uses less memory and seems to be a lot faster than geohash
      // see http://tech.taskrabbit.com/blog/2015/06/09/elasticsearch-geohash-vs-geotree/
      "tree", "quadtree",
      
      precisionKey, precisionValue
  )));
}
 
开发者ID:georocket,项目名称:georocket,代码行数:37,代码来源:BoundingBoxIndexerFactory.java


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