本文整理汇总了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);
}
示例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();
}
示例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);
}
示例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();
}
示例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);
}
示例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();
}
示例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);
}
示例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);
}
示例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);
}
示例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);
}
示例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();
}
示例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);
}
示例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();
}
示例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);
}