use of io.servicecomb.core.Invocation in project java-chassis by ServiceComb.
the class InvocationFactory method forConsumer.
public static Invocation forConsumer(ReferenceConfig referenceConfig, SchemaMeta schemaMeta, String operationName, Object[] swaggerArguments) {
OperationMeta operationMeta = schemaMeta.ensureFindOperation(operationName);
Invocation invocation = new Invocation(referenceConfig, operationMeta, swaggerArguments);
invocation.addContext(Const.SRC_MICROSERVICE, microserviceName);
return invocation;
}
use of io.servicecomb.core.Invocation in project java-chassis by ServiceComb.
the class InvokerUtils method syncInvoke.
public static Object syncInvoke(String microserviceName, String microserviceVersion, String transport, String schemaId, String operationName, Object[] args) {
ReferenceConfig referenceConfig = new ReferenceConfig(microserviceName, microserviceVersion, transport);
SchemaMeta schemaMeta = referenceConfig.getMicroserviceMeta().ensureFindSchemaMeta(schemaId);
Invocation invocation = InvocationFactory.forConsumer(referenceConfig, schemaMeta, operationName, args);
return syncInvoke(invocation);
}
use of io.servicecomb.core.Invocation in project java-chassis by ServiceComb.
the class TestVertxRestServer method testSetHttpRequestContext.
@Test
public void testSetHttpRequestContext() {
boolean status = false;
try {
Invocation invocation = Mockito.mock(Invocation.class);
RestServerRequestInternal restRequest = Mockito.mock(RestServerRequestInternal.class);
instance.setHttpRequestContext(invocation, restRequest);
Assert.assertNotNull(instance);
} catch (Exception e) {
status = true;
}
Assert.assertFalse(status);
}
use of io.servicecomb.core.Invocation in project java-chassis by ServiceComb.
the class TestVertxRestTransport method testSendException.
@Test
public void testSendException() {
boolean validAssert;
Invocation invocation = Mockito.mock(Invocation.class);
AsyncResponse asyncResp = Mockito.mock(AsyncResponse.class);
URIEndpointObject endpoint = Mockito.mock(URIEndpointObject.class);
Endpoint end = Mockito.mock(Endpoint.class);
Mockito.when(invocation.getEndpoint()).thenReturn(end);
Mockito.when(invocation.getEndpoint().getAddress()).thenReturn(endpoint);
try {
validAssert = true;
instance.send(invocation, asyncResp);
} catch (Exception e) {
validAssert = false;
}
Assert.assertFalse(validAssert);
}
use of io.servicecomb.core.Invocation in project java-chassis by ServiceComb.
the class TestServletHttpRequestCreator method testCreateMockParam.
@Test
public void testCreateMockParam() {
boolean status = true;
try {
HttpServletRequest httpRequest = Mockito.mock(HttpServletRequest.class);
ProducerServletHttpRequestArgMapper servletHttpRequestCreator = new ProducerServletHttpRequestArgMapper(httpRequest);
Invocation invocation = Mockito.mock(Invocation.class);
servletHttpRequestCreator.createContextArg(invocation);
} catch (Exception ex) {
status = false;
}
Assert.assertTrue(status);
}
Aggregations