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


Java RequestScopedInitializer类代码示例

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


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

示例1: delegateRequest_ValidRequestAndReferencesGiven_ShouldSetReferencesOnRequestInitialization

import org.glassfish.jersey.server.spi.RequestScopedInitializer; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Test
public void delegateRequest_ValidRequestAndReferencesGiven_ShouldSetReferencesOnRequestInitialization() {
	Context context = mock(Context.class);
	DefaultServiceRequest request = new DefaultServiceRequest(null, new HashMap<>(), URI.create("/"), "GET");

	RequestScopedInitializer requestScopedInitializer = getSetRequestScopedInitializer(context, request);

	Ref<ServiceRequest> serviceRequestRef = mock(Ref.class);
	Ref<Context> contextRef = mock(Ref.class);

	InjectionManager injectionManager = mock(InjectionManager.class);
	when(injectionManager.getInstance(SERVICE_REQUEST_TYPE)).thenReturn(serviceRequestRef);
	when(injectionManager.getInstance(AbstractLambdaContextReferencingBinder.LAMBDA_CONTEXT_TYPE)).thenReturn(contextRef);

	requestScopedInitializer.initialize(injectionManager);

	verify(serviceRequestRef).set(request);
	verify(contextRef).set(context);
}
 
开发者ID:bbilger,项目名称:jrestless,代码行数:21,代码来源:ServiceRequestHandlerTest.java

示例2: getSetRequestScopedInitializer

import org.glassfish.jersey.server.spi.RequestScopedInitializer; //导入依赖的package包/类
@SuppressWarnings({ "unchecked", "rawtypes" })
private RequestScopedInitializer getSetRequestScopedInitializer(Context context, ServiceRequest request) {
	ServiceRequestAndLambdaContext reqAndContext = new ServiceRequestAndLambdaContext(request, context);
	ArgumentCaptor<Consumer> containerEnhancerCaptor = ArgumentCaptor.forClass(Consumer.class);
	serviceHandler.delegateRequest(reqAndContext);
	verify(container).handleRequest(any(), any(), any(), containerEnhancerCaptor.capture());

	ContainerRequest containerRequest = mock(ContainerRequest.class);
	containerEnhancerCaptor.getValue().accept(containerRequest);

	ArgumentCaptor<RequestScopedInitializer> requestScopedInitializerCaptor = ArgumentCaptor.forClass(RequestScopedInitializer.class);

	verify(containerRequest).setRequestScopedInitializer(requestScopedInitializerCaptor.capture());

	return requestScopedInitializerCaptor.getValue();
}
 
开发者ID:bbilger,项目名称:jrestless,代码行数:17,代码来源:ServiceRequestHandlerTest.java

示例3: delegateRequest_ValidRequestAndReferencesGiven_ShouldSetReferencesOnRequestInitialization

import org.glassfish.jersey.server.spi.RequestScopedInitializer; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Test
public void delegateRequest_ValidRequestAndReferencesGiven_ShouldSetReferencesOnRequestInitialization() {
	Context context = mock(Context.class);
	DefaultGatewayRequest request = new DefaultGatewayRequest();
	request.setPath("/");
	request.setHttpMethod("GET");

	RequestScopedInitializer requestScopedInitializer = getSetRequestScopedInitializer(context, request);

	Ref<GatewayRequest> gatewayRequestRef = mock(Ref.class);
	Ref<Context> contextRef = mock(Ref.class);


	InjectionManager injectionManager = mock(InjectionManager.class);
	when(injectionManager.getInstance(GATEWAY_REQUEST_TYPE)).thenReturn(gatewayRequestRef);
	when(injectionManager.getInstance(AbstractLambdaContextReferencingBinder.LAMBDA_CONTEXT_TYPE)).thenReturn(contextRef);

	requestScopedInitializer.initialize(injectionManager);

	verify(gatewayRequestRef).set(request);
	verify(contextRef).set(context);
}
 
开发者ID:bbilger,项目名称:jrestless,代码行数:24,代码来源:GatewayRequestHandlerTest.java

示例4: getSetRequestScopedInitializer

import org.glassfish.jersey.server.spi.RequestScopedInitializer; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private RequestScopedInitializer getSetRequestScopedInitializer(Context context, GatewayRequest request) {
	GatewayRequestAndLambdaContext reqAndContext = new GatewayRequestAndLambdaContext(request, context);
	ArgumentCaptor<Consumer<ContainerRequest>> containerEnhancerCaptor = ArgumentCaptor.forClass(Consumer.class);
	gatewayHandler.delegateRequest(reqAndContext);
	verify(container).handleRequest(any(), any(), any(), containerEnhancerCaptor.capture());

	ContainerRequest containerRequest = mock(ContainerRequest.class);
	containerEnhancerCaptor.getValue().accept(containerRequest);

	ArgumentCaptor<RequestScopedInitializer> requestScopedInitializerCaptor = ArgumentCaptor.forClass(RequestScopedInitializer.class);

	verify(containerRequest).setRequestScopedInitializer(requestScopedInitializerCaptor.capture());

	return requestScopedInitializerCaptor.getValue();
}
 
开发者ID:bbilger,项目名称:jrestless,代码行数:17,代码来源:GatewayRequestHandlerTest.java

示例5: delegateRequest_ValidRequestAndReferencesGiven_ShouldSetReferencesOnRequestInitialization

import org.glassfish.jersey.server.spi.RequestScopedInitializer; //导入依赖的package包/类
@SuppressWarnings("unchecked")
@Test
public void delegateRequest_ValidRequestAndReferencesGiven_ShouldSetReferencesOnRequestInitialization() {

	Context context = mock(Context.class);
	SNS sns = new SNS();
	sns.setTopicArn(":t");
	SNSRecord snsRecord = new SNSRecord();
	snsRecord.setSns(sns);

	RequestScopedInitializer requestScopedInitializer = getSetRequestScopedInitializer(context, snsRecord);

	Ref<SNSRecord> snsRef = mock(Ref.class);
	Ref<Context> contextRef = mock(Ref.class);

	InjectionManager injectionManager = mock(InjectionManager.class);
	when(injectionManager.getInstance(SNS_RECORD_TYPE)).thenReturn(snsRef);
	when(injectionManager.getInstance(AbstractLambdaContextReferencingBinder.LAMBDA_CONTEXT_TYPE)).thenReturn(contextRef);

	requestScopedInitializer.initialize(injectionManager);

	verify(snsRef).set(snsRecord);
	verify(contextRef).set(context);
}
 
开发者ID:bbilger,项目名称:jrestless,代码行数:25,代码来源:SnsRequestHandlerTest.java

示例6: getSetRequestScopedInitializer

import org.glassfish.jersey.server.spi.RequestScopedInitializer; //导入依赖的package包/类
@SuppressWarnings({ "unchecked", "rawtypes" })
private RequestScopedInitializer getSetRequestScopedInitializer(Context context, SNSRecord snsRecord) {
	SnsRecordAndLambdaContext reqAndContext = new SnsRecordAndLambdaContext(snsRecord, context);
	ArgumentCaptor<Consumer> containerEnhancerCaptor = ArgumentCaptor.forClass(Consumer.class);
	snsHandler.delegateRequest(reqAndContext);
	verify(container).handleRequest(any(), any(), any(), containerEnhancerCaptor.capture());

	ContainerRequest containerRequest = mock(ContainerRequest.class);
	containerEnhancerCaptor.getValue().accept(containerRequest);

	ArgumentCaptor<RequestScopedInitializer> requestScopedInitializerCaptor = ArgumentCaptor.forClass(RequestScopedInitializer.class);

	verify(containerRequest).setRequestScopedInitializer(requestScopedInitializerCaptor.capture());

	return requestScopedInitializerCaptor.getValue();
}
 
开发者ID:bbilger,项目名称:jrestless,代码行数:17,代码来源:SnsRequestHandlerTest.java

示例7: delegateRequest_ValidRequestAndNoReferencesGiven_ShouldNotFailOnRequestInitialization

import org.glassfish.jersey.server.spi.RequestScopedInitializer; //导入依赖的package包/类
@Test
public void delegateRequest_ValidRequestAndNoReferencesGiven_ShouldNotFailOnRequestInitialization() {
	Context context = mock(Context.class);
	DefaultServiceRequest request = new DefaultServiceRequest(null, new HashMap<>(), URI.create("/"), "GET");

	RequestScopedInitializer requestScopedInitializer = getSetRequestScopedInitializer(context, request);

	InjectionManager injectionManager = mock(InjectionManager.class);
	requestScopedInitializer.initialize(injectionManager);
}
 
开发者ID:bbilger,项目名称:jrestless,代码行数:11,代码来源:ServiceRequestHandlerTest.java

示例8: delegateRequest_ValidRequestAndNoReferencesGiven_ShouldNotFailOnRequestInitialization

import org.glassfish.jersey.server.spi.RequestScopedInitializer; //导入依赖的package包/类
@Test
public void delegateRequest_ValidRequestAndNoReferencesGiven_ShouldNotFailOnRequestInitialization() {

	Context context = mock(Context.class);
	DefaultGatewayRequest request = new DefaultGatewayRequest();
	request.setPath("/");
	request.setHttpMethod("GET");

	RequestScopedInitializer requestScopedInitializer = getSetRequestScopedInitializer(context, request);

	InjectionManager injectionManager = mock(InjectionManager.class);
	requestScopedInitializer.initialize(injectionManager);
}
 
开发者ID:bbilger,项目名称:jrestless,代码行数:14,代码来源:GatewayRequestHandlerTest.java

示例9: delegateRequest_ValidRequestAndNoReferencesGiven_ShouldNotFailOnRequestInitialization

import org.glassfish.jersey.server.spi.RequestScopedInitializer; //导入依赖的package包/类
@Test
public void delegateRequest_ValidRequestAndNoReferencesGiven_ShouldNotFailOnRequestInitialization() {

	Context context = mock(Context.class);
	SNS sns = new SNS();
	sns.setTopicArn(":t");
	SNSRecord snsRecord = new SNSRecord();
	snsRecord.setSns(sns);

	RequestScopedInitializer requestScopedInitializer = getSetRequestScopedInitializer(context, snsRecord);

	InjectionManager injectionManager = mock(InjectionManager.class);
	requestScopedInitializer.initialize(injectionManager);
}
 
开发者ID:bbilger,项目名称:jrestless,代码行数:15,代码来源:SnsRequestHandlerTest.java

示例10: delegateRequest_ValidRequestAndNoReferencesGiven_ShouldNotFailOnRequestInitialization

import org.glassfish.jersey.server.spi.RequestScopedInitializer; //导入依赖的package包/类
@Test
public void delegateRequest_ValidRequestAndNoReferencesGiven_ShouldNotFailOnRequestInitialization() {
	JsonObject jsonRequest = new WebActionRequestBuilder()
			.setHttpMethod("GET")
			.setPath("/")
			.buildJson();

	RequestScopedInitializer requestScopedInitializer = getSetRequestScopedInitializer(jsonRequest);

	InjectionManager injectionManager = mock(InjectionManager.class);
	requestScopedInitializer.initialize(injectionManager);
}
 
开发者ID:bbilger,项目名称:jrestless,代码行数:13,代码来源:WebActionRequestHandlerTest.java

示例11: getSetRequestScopedInitializer

import org.glassfish.jersey.server.spi.RequestScopedInitializer; //导入依赖的package包/类
@SuppressWarnings("unchecked")
private RequestScopedInitializer getSetRequestScopedInitializer(JsonObject request) {
	ArgumentCaptor<Consumer<ContainerRequest>> containerEnhancerCaptor = ArgumentCaptor.forClass(Consumer.class);
	handler.delegateJsonRequest(request);
	verify(container).handleRequest(any(), any(), any(), containerEnhancerCaptor.capture());

	ContainerRequest containerRequest = mock(ContainerRequest.class);
	containerEnhancerCaptor.getValue().accept(containerRequest);

	ArgumentCaptor<RequestScopedInitializer> requestScopedInitializerCaptor = ArgumentCaptor.forClass(RequestScopedInitializer.class);

	verify(containerRequest).setRequestScopedInitializer(requestScopedInitializerCaptor.capture());

	return requestScopedInitializerCaptor.getValue();
}
 
开发者ID:bbilger,项目名称:jrestless,代码行数:16,代码来源:WebActionRequestHandlerTest.java

示例12: delegateJsonRequest_ValidRequestAndReferencesGiven_ShouldSetReferencesOnRequestInitialization

import org.glassfish.jersey.server.spi.RequestScopedInitializer; //导入依赖的package包/类
@Test
public void delegateJsonRequest_ValidRequestAndReferencesGiven_ShouldSetReferencesOnRequestInitialization() {

	WebActionRequestBuilder requestBuilder = new WebActionRequestBuilder()
			.setHttpMethod("GET")
			.setPath("/");

	JsonObject jsonRequest = requestBuilder.buildJson();
	DefaultWebActionRequest request = requestBuilder.build();

	RequestScopedInitializer requestScopedInitializer = getSetRequestScopedInitializer(jsonRequest);

	@SuppressWarnings("unchecked")
	Ref<WebActionRequest> gatewayRequestRef = mock(Ref.class);

	InjectionManager injectionManager = mock(InjectionManager.class);
	when(injectionManager.getInstance(WEB_ACTION_REQUEST_TYPE)).thenReturn(gatewayRequestRef);

	requestScopedInitializer.initialize(injectionManager);

	verify(gatewayRequestRef).set(request);
}
 
开发者ID:bbilger,项目名称:jrestless,代码行数:23,代码来源:WebActionRequestHandlerTest.java

示例13: getRequestScopedInitializer

import org.glassfish.jersey.server.spi.RequestScopedInitializer; //导入依赖的package包/类
/**
 * <p>getRequestScopedInitializer.</p>
 *
 * @return a {@link org.glassfish.jersey.server.spi.RequestScopedInitializer} object.
 */
public static RequestScopedInitializer getRequestScopedInitializer() {
    return getRequest().getRequestScopedInitializer();
}
 
开发者ID:icode,项目名称:ameba,代码行数:9,代码来源:Requests.java

示例14: setRequestScopedInitializer

import org.glassfish.jersey.server.spi.RequestScopedInitializer; //导入依赖的package包/类
/**
 * <p>setRequestScopedInitializer.</p>
 *
 * @param requestScopedInitializer a {@link org.glassfish.jersey.server.spi.RequestScopedInitializer} object.
 */
public static void setRequestScopedInitializer(RequestScopedInitializer requestScopedInitializer) {
    getRequest().setRequestScopedInitializer(requestScopedInitializer);
}
 
开发者ID:icode,项目名称:ameba,代码行数:9,代码来源:Requests.java


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