• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    公众号

Java Container类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Java中org.vertx.java.platform.Container的典型用法代码示例。如果您正苦于以下问题:Java Container类的具体用法?Java Container怎么用?Java Container使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



Container类属于org.vertx.java.platform包,在下文中一共展示了Container类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Java代码示例。

示例1: testForwardSendNoReply

import org.vertx.java.platform.Container; //导入依赖的package包/类
@Test
public void testForwardSendNoReply() throws MalformedURLException {
	String address = "testaddress";
	String message = "HelloWorld";
	String responseMediaType = "application/xml";
	long timeout = 60000;
	JsonObject config = createConfig(address, timeout);
	HttpEventBusBridgeService service = new HttpEventBusBridgeService();
	EventBusBridgeRequest request = createRequest(address, message, null, responseMediaType);
	
	Vertx vertx = Mockito.mock(Vertx.class);
	EventBus eventBus = Mockito.mock(EventBus.class);
	when(vertx.eventBus()).thenReturn(eventBus);
	when(eventBus.send(address, message)).thenReturn(eventBus);
	
	Container container = Mockito.mock(Container.class); 
	when(container.config()).thenReturn(config);

	service.forward(request, EventBusInstruction.send, vertx, container);
	verify(eventBus, times(1)).sendWithTimeout(eq(address), eq((Object) message), eq(timeout), any(NoOpResponseHandler.class));
}
 
开发者ID:j2ro,项目名称:mod-http-event-bus-bridge,代码行数:22,代码来源:HttpEventBusBridgeServiceTest.java


示例2: testForwardSendReply

import org.vertx.java.platform.Container; //导入依赖的package包/类
@Test
public void testForwardSendReply() throws MalformedURLException {
	String address = "testaddress";
	String message = "HelloWorld";
	URL responseUrl = new URL("http://localhost:8080/ebbresponse");
	String responseMediaType = "application/xml";
	HttpClient httpClient = Mockito.mock(HttpClient.class);
	long timeout = 60000;
	JsonObject config = createConfig(address, timeout);
	
	HttpEventBusBridgeService service = new HttpEventBusBridgeService();
	EventBusBridgeRequest request = createRequest(address, message, responseUrl, responseMediaType);
	
	Vertx vertx = Mockito.mock(Vertx.class);
	EventBus eventBus = Mockito.mock(EventBus.class);
	when(vertx.eventBus()).thenReturn(eventBus);
	when(eventBus.send(address, message)).thenReturn(eventBus);
	when(vertx.createHttpClient()).thenReturn(httpClient);
	
	Container container = Mockito.mock(Container.class); 
	when(container.config()).thenReturn(config);

	service.forward(request, EventBusInstruction.send, vertx, container);
	verify(eventBus, times(1)).sendWithTimeout(eq(address), eq((Object)message), eq(timeout), any(HttpResponseHandler.class));
}
 
开发者ID:j2ro,项目名称:mod-http-event-bus-bridge,代码行数:26,代码来源:HttpEventBusBridgeServiceTest.java


示例3: testForwardSendInvalidAddress

import org.vertx.java.platform.Container; //导入依赖的package包/类
@Test(expected = WebApplicationException.class)
public void testForwardSendInvalidAddress() throws MalformedURLException {
	String invalidAddress = "illegaladdress";
	String allowedAddress = "validaddress";
	String message = "HelloWorld";
	String responseMediaType = "application/xml";
	long timeout = 60000;
	JsonObject config = createConfig(allowedAddress, timeout);
	HttpEventBusBridgeService service = new HttpEventBusBridgeService();
	EventBusBridgeRequest request = createRequest(invalidAddress, message, null, responseMediaType);
	
	Vertx vertx = Mockito.mock(Vertx.class);
	
	Container container = Mockito.mock(Container.class); 
	when(container.config()).thenReturn(config);

	service.forward(request, EventBusInstruction.send, vertx, container);
}
 
开发者ID:j2ro,项目名称:mod-http-event-bus-bridge,代码行数:19,代码来源:HttpEventBusBridgeServiceTest.java


示例4: testForwardPublish

import org.vertx.java.platform.Container; //导入依赖的package包/类
@Test
public void testForwardPublish() throws MalformedURLException {
	String address = "testaddress";
	String message = "HelloWorld";
	String responseMediaType = "application/xml";
	long timeout = 60000;
	JsonObject config = createConfig(address, timeout);
	HttpEventBusBridgeService service = new HttpEventBusBridgeService();
	EventBusBridgeRequest request = createRequest(address, message, null, responseMediaType);
	
	Vertx vertx = Mockito.mock(Vertx.class);
	EventBus eventBus = Mockito.mock(EventBus.class);
	when(vertx.eventBus()).thenReturn(eventBus);
	when(eventBus.send(address, message)).thenReturn(eventBus);
	
	Container container = Mockito.mock(Container.class); 
	when(container.config()).thenReturn(config);

	service.forward(request, EventBusInstruction.publish, vertx, container);
	verify(eventBus, times(1)).publish(address, (Object) message);
}
 
开发者ID:j2ro,项目名称:mod-http-event-bus-bridge,代码行数:22,代码来源:HttpEventBusBridgeServiceTest.java


示例5: testForwardPublishInvalidAddress

import org.vertx.java.platform.Container; //导入依赖的package包/类
@Test(expected = WebApplicationException.class)
public void testForwardPublishInvalidAddress() throws MalformedURLException {
	String invalidAddress = "illegaladdress";
	String allowedAddress = "validaddress";
	String message = "HelloWorld";
	String responseMediaType = "application/xml";
	long timeout = 60000;
	JsonObject config = createConfig(allowedAddress, timeout);
	HttpEventBusBridgeService service = new HttpEventBusBridgeService();
	EventBusBridgeRequest request = createRequest(invalidAddress, message, null, responseMediaType);
	
	Vertx vertx = Mockito.mock(Vertx.class);

	Container container = Mockito.mock(Container.class); 
	when(container.config()).thenReturn(config);

	service.forward(request, EventBusInstruction.publish, vertx, container);
}
 
开发者ID:j2ro,项目名称:mod-http-event-bus-bridge,代码行数:19,代码来源:HttpEventBusBridgeServiceTest.java


示例6: SendInBlueSender

import org.vertx.java.platform.Container; //导入依赖的package包/类
public SendInBlueSender(Vertx vertx, Container container, JsonObject config)
		throws InvalidConfigurationException, URISyntaxException {
	super(vertx, container);
	if (config != null && isNotEmpty(config.getString("uri")) && isNotEmpty(config.getString("api-key"))) {
		URI uri = new URI(config.getString("uri"));
		httpClient = vertx.createHttpClient()
				.setHost(uri.getHost())
				.setPort(uri.getPort())
				.setMaxPoolSize(16)
				.setSSL("https".equals(uri.getScheme()))
				.setKeepAlive(false);
		apiKey = config.getString("api-key");
		dedicatedIp = config.getString("ip");
		splitRecipients = config.getBoolean("split-recipients", false);
		mapper = new ObjectMapper();
		mapper.setDateFormat(new SimpleDateFormat("yyyy-MM-dd HH:mm:ss"));
	} else {
		throw new InvalidConfigurationException("missing.parameters");
	}
}
 
开发者ID:web-education,项目名称:web-utils,代码行数:21,代码来源:SendInBlueSender.java


示例7: NotificationHelper

import org.vertx.java.platform.Container; //导入依赖的package包/类
public NotificationHelper(Vertx vertx, Container container) {
	this.log = container.logger();
	this.render = new Renders(vertx, container);
	final Object encodedEmailConfig = vertx.sharedData().getMap("server").get("emailConfig");

	String defaultMail = "[email protected]";
	String defaultHost = "http://localhost:8009";

	if(encodedEmailConfig != null){
		JsonObject emailConfig = new JsonObject(encodedEmailConfig.toString());
		defaultMail = emailConfig.getString("email", defaultMail);
		defaultHost = emailConfig.getString("host", defaultHost);
	}

	this.senderEmail = container.config().getString("email", defaultMail);
	this.host = container.config().getString("host", defaultHost);
}
 
开发者ID:web-education,项目名称:web-utils,代码行数:18,代码来源:NotificationHelper.java


示例8: init

import org.vertx.java.platform.Container; //导入依赖的package包/类
public void init(Vertx vertx, Container container, RouteMatcher rm,
				 Map<String, SecuredAction> securedActions) {
	super.vertx = vertx;
	super.container = container;
	super.rm = rm;
	super.securedActions = securedActions;
	super.eb = Server.getEventBus(vertx);
	if (pathPrefix == null) {
		super.pathPrefix = Server.getPathPrefix(container.config());
	}
	if (rm != null) {
		loadRoutes();
	} else {
		log.error("RouteMatcher is null.");
	}
}
 
开发者ID:web-education,项目名称:web-utils,代码行数:17,代码来源:BaseController.java


示例9: init

import org.vertx.java.platform.Container; //导入依赖的package包/类
public void init(Container container, Vertx vertx) {
	try {
		if (vertx.fileSystem().existsSync(messagesDir)) {
			Map<Locale, JsonObject> messages = messagesByDomains.get(DEFAULT_DOMAIN);
			if (messages == null) {
				messages = new HashMap<>();
				messagesByDomains.put(DEFAULT_DOMAIN, messages);
			}
			for(String path : vertx.fileSystem().readDirSync(messagesDir)) {
				if (vertx.fileSystem().propsSync(path).isRegularFile()) {
					Locale l = Locale.forLanguageTag(new File(path).getName().split("\\.")[0]);
					JsonObject jo = new JsonObject(vertx.fileSystem().readFileSync(path).toString());
					messages.put(l,jo);
				}
			}
		} else {
			log.warn("I18n directory " + messagesDir + " doesn't exist.");
		}
	} catch (Exception e) {
		log.error(e.getMessage(), e);
	}
}
 
开发者ID:web-education,项目名称:web-utils,代码行数:23,代码来源:I18n.java


示例10: VertxApplicationContext

import org.vertx.java.platform.Container; //导入依赖的package包/类
/**
 * @param loader
 * @param vertx
 * @param container 
 */
public VertxApplicationContext(final ClassLoader loader, final Vertx vertx, final Container container) {
  this.vertx = vertx;
  this.container = container;

  this.parent = new GenericApplicationContext();
  parent.setClassLoader(loader);

  ConfigurableListableBeanFactory factory = parent.getBeanFactory();

  factory.registerSingleton(VERTX_BEAN_NAME, this.vertx);
  factory.registerAlias(VERTX_BEAN_NAME, "vertx");

  factory.registerSingleton(EVENTBUS_BEAN_NAME, vertx.eventBus());
  factory.registerAlias(EVENTBUS_BEAN_NAME, "eventBus");

  factory.registerSingleton(VERTICLE_CONTAINER_BEAN_NAME, this.container);
  factory.registerAlias(VERTICLE_CONTAINER_BEAN_NAME, "verticle-container");

  parent.refresh();
  parent.start();
  parent.registerShutdownHook();
}
 
开发者ID:chipat,项目名称:mod-lang-spring-updated,代码行数:28,代码来源:VertxApplicationContext.java


示例11: init

import org.vertx.java.platform.Container; //导入依赖的package包/类
@Override
public void init(Vertx vertx, final Container container, RouteMatcher rm,
		Map<String, fr.wseduc.webutils.security.SecuredAction> securedActions) {
	super.init(vertx, container, rm, securedActions);

	ConcurrentSharedMap<Object, Object> server = vertx.sharedData().getMap("server");
	Boolean cluster = (Boolean) server.get("cluster");
	if (Boolean.TRUE.equals(cluster)) {
		ClusterManager cm = ((VertxInternal) vertx).clusterManager();
		cursusMap = cm.getSyncMap("cursusMap");
	} else {
		cursusMap = new HashMap<>();
	}

	/*
	service.refreshToken(new Handler<Boolean>() {
		public void handle(Boolean res) {
			if(!res)
				log.error("[Cursus][refreshToken] Error while retrieving the Token.");
			else
				log.info("[Cursus][refreshToken] Token refreshed.");
		}
	});
	*/
	if(cursusMap.containsKey("wallets"))
		return;
	service.refreshWallets(new Handler<Boolean>() {
		public void handle(Boolean res) {
			if(!res)
				log.error("[Cursus][refreshWallets] Error while retrieving the wallets list.");
			else
				log.info("[Cursus][refreshWallets] Wallets list refreshed.");
		}
	});

}
 
开发者ID:OPEN-ENT-NG,项目名称:cursus,代码行数:37,代码来源:CursusController.java


示例12: CollaborativeEditorController

import org.vertx.java.platform.Container; //导入依赖的package包/类
/**
 * Default constructor
 * @param vertx vertx
 * @param collection MongoDB collection to request.
 */
public CollaborativeEditorController(Vertx vertx, String collection, Container container) {
    super(collection);
    JsonObject config = container.config();
    this.etherpadHelper = new EtherpadHelper(vertx, collection, config.getString("etherpad-url", null),
            config.getString("etherpad-api-key", null), config.getString("etherpad-public-url", null),
            config.getBoolean("trust-all-certificate", true), config.getString("etherpad-domain", null));
}
 
开发者ID:OPEN-ENT-NG,项目名称:collaborative-editor,代码行数:13,代码来源:CollaborativeEditorController.java


示例13: forward

import org.vertx.java.platform.Container; //导入依赖的package包/类
/**
 * Service to forward HTTP request onto the vertx event bus.
 * @param request EventBusBridgeRequest object
 * @param instruction Instruction (i.e. send or publish)
 * @param vertx Vertx instance
 * @param container Container instance
 * @return Message
 * @throws MalformedURLException If the response url contained in the request is invalid
 */
@POST
@Path("/{instruction}")
@Consumes({ MediaType.APPLICATION_XML, MediaType.APPLICATION_JSON })
public Response forward(final EventBusBridgeRequest request, @PathParam("instruction") final EventBusInstruction instruction,
		                @Context final Vertx vertx, @Context final Container container) throws MalformedURLException {
	String address = request.getAddress();
	JsonObject config = container.config();

	validateRequest(request, config);

	Object messageObject = EventBusMessageTypeConverter.convertIncomingMessage(request.getMessage(), request.getEventBusMessageType());
	switch (instruction) {
		case send:
			Long timeout = config.getLong("timeout", DEFAULT_TIMEOUT);
			String mediaType = request.getResponseMediaType() != null ? request.getResponseMediaType() : DEFAULT_RESPONSE_MEDIA_TYPE;
			URL responseUrl = request.getResponseUrl() != null ? new URL(request.getResponseUrl()) : null;
			send(address, messageObject, responseUrl, mediaType, vertx, timeout);
			break;
		case publish:
			publish(address, messageObject, vertx);
			break;
		default:
			throw new IllegalArgumentException("Illegal event bus instruction provided: " + instruction);
	}
	return Response.accepted().build();
}
 
开发者ID:j2ro,项目名称:mod-http-event-bus-bridge,代码行数:36,代码来源:HttpEventBusBridgeService.java


示例14: GoMailSender

import org.vertx.java.platform.Container; //导入依赖的package包/类
public GoMailSender(Vertx vertx, Container container, JsonObject config)
		throws InvalidConfigurationException, URISyntaxException {
	super(vertx, container);

	if (config != null && isNotEmpty(config.getString("uri")) && isNotEmpty(config.getString("user"))
			&& isNotEmpty(config.getString("password")) && isNotEmpty(config.getString("platform"))) {
		ByteArrayOutputStream userAndPassword = new ByteArrayOutputStream();
		try {
			userAndPassword.write(config.getString("user").getBytes());
			userAndPassword.write(':');
			userAndPassword.write(config.getString("password").getBytes());
		} catch (IOException e) {
			log.error(e);
		}
		basicAuthHeader = "Basic " + Base64.encodeBytes(userAndPassword.toByteArray());
		URI uri = new URI(config.getString("uri"));
		httpClient = vertx.createHttpClient().setHost(uri.getHost()).setPort(uri.getPort()).setMaxPoolSize(16)
				.setSSL("https".equals(uri.getScheme())).setKeepAlive(false);
		platform = config.getString("platform");
		mapper = new ObjectMapper();
		mapper.setDateFormat(new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ssXXX"));
		mapper.addMixInAnnotations(Bounce.class, GoMailBounceMixIn.class);

	} else {
		throw new InvalidConfigurationException("missing.parameters");
	}
}
 
开发者ID:web-education,项目名称:web-utils,代码行数:28,代码来源:GoMailSender.java


示例15: Controller

import org.vertx.java.platform.Container; //导入依赖的package包/类
public Controller(Vertx vertx, Container container, RouteMatcher rm,
		Map<String, SecuredAction> securedActions) {
	super(vertx, container);
	this.rm = rm;
	this.uriBinding = new HashMap<>();
	this.securedActions = securedActions;
	if (vertx != null) {
		this.eb = Server.getEventBus(vertx);
	}
	if (rm != null) {
		loadRoutes();
	}
	this.accessLogger = new AccessLogger();
}
 
开发者ID:web-education,项目名称:web-utils,代码行数:15,代码来源:Controller.java


示例16: Renders

import org.vertx.java.platform.Container; //导入依赖的package包/类
public Renders(Vertx vertx, Container container) {
	this.container = container;
	if (container != null) {
		this.pathPrefix = Server.getPathPrefix(container.config());
	}
	this.i18n = I18n.getInstance();
	this.vertx = vertx;
}
 
开发者ID:web-education,项目名称:web-utils,代码行数:9,代码来源:Renders.java


示例17: init

import org.vertx.java.platform.Container; //导入依赖的package包/类
@Override
public final void init(Vertx vertx, Container container, ClassLoader cl) {
  if (this.vertx != null || this.container != null || this.loader != null) {
    throw new IllegalStateException("The 'init(v,c,l)' method has already been called for this VerticleFactory");
  }
  this.vertx = vertx;
  this.container = container;
  this.loader = cl;
}
 
开发者ID:chipat,项目名称:mod-lang-spring-updated,代码行数:10,代码来源:SpringVerticleFactory.java


示例18: DefaultPlatformManager

import org.vertx.java.platform.Container; //导入依赖的package包/类
public DefaultPlatformManager(Vertx vertx, Container container, ContextManager context) {
  this.vertx = vertx;
  this.container = container;
  this.context = context;
  String modDir = System.getProperty(MODS_DIR_PROP_NAME);
  if (modDir != null && !modDir.trim().equals("")) {
    modRoot = new File(modDir);
  } else {
    modRoot =  new File(LOCAL_MODS_DIR);
  }
}
 
开发者ID:kuujo,项目名称:vertigo,代码行数:12,代码来源:DefaultPlatformManager.java


示例19: DefaultComponent

import org.vertx.java.platform.Container; //导入依赖的package包/类
protected DefaultComponent(InstanceContext context, Vertx vertx, Container container, Cluster cluster) {
  this.address = context.address();
  this.log = LoggerFactory.getLogger(String.format("%s-%s", DefaultComponent.class.getName(), address));
  this.vertx = vertx;
  this.container = container;
  this.context = context;
  this.cluster = cluster;
  this.coordinator = new DefaultComponentCoordinator(context, vertx, cluster);
  this.input = new DefaultInputCollector(vertx, context.input());
  this.output = new DefaultOutputCollector(vertx, context.output());
  this.logger = PortLoggerFactory.getLogger(String.format("%s-%s", getClass().getCanonicalName(), address), output);
}
 
开发者ID:kuujo,项目名称:vertigo,代码行数:13,代码来源:DefaultComponent.java


示例20: init

import org.vertx.java.platform.Container; //导入依赖的package包/类
@Override
public void init(Vertx vertx, Container container, RouteMatcher rm,
				 Map<String, fr.wseduc.webutils.security.SecuredAction> securedActions) {
	super.init(vertx, container, rm, securedActions);
	eventStore = EventStoreFactory.getFactory().getEventStore(ShareBigFiles.class.getSimpleName());
}
 
开发者ID:OPEN-ENT-NG,项目名称:share-big-files,代码行数:7,代码来源:ShareBigFilesController.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java SecretVerifier类代码示例发布时间:2022-05-22
下一篇:
Java VerificationError类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap