當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。