use of org.apache.servicecomb.core.definition.OperationMeta in project incubator-servicecomb-java-chassis by apache.
the class AbstractRestInvocation method scheduleInvocation.
protected void scheduleInvocation() {
createInvocation();
invocation.onStart();
OperationMeta operationMeta = restOperationMeta.getOperationMeta();
operationMeta.getExecutor().execute(() -> {
synchronized (this.requestEx) {
try {
if (requestEx.getAttribute(RestConst.REST_REQUEST) != requestEx) {
// already timeout
// in this time, request maybe recycled and reused by web container, do not use requestEx
LOGGER.error("Rest request already timeout, abandon execute, method {}, operation {}.", operationMeta.getHttpMethod(), operationMeta.getMicroserviceQualifiedName());
return;
}
runOnExecutor();
} catch (Throwable e) {
LOGGER.error("rest server onRequest error", e);
sendFailResponse(e);
}
}
});
}
use of org.apache.servicecomb.core.definition.OperationMeta in project incubator-servicecomb-java-chassis by apache.
the class QpsControllerManagerTest method getMockOperationMeta.
public static OperationMeta getMockOperationMeta(String microserviceName, String schemaId, String operationId) {
OperationMeta operationMeta = Mockito.mock(OperationMeta.class);
SchemaMeta schemaMeta = Mockito.mock(SchemaMeta.class);
Mockito.when(operationMeta.getSchemaMeta()).thenReturn(schemaMeta);
Mockito.when(operationMeta.getSchemaQualifiedName()).thenReturn(schemaId + QpsControllerManager.SEPARATOR + operationId);
Mockito.when(operationMeta.getMicroserviceQualifiedName()).thenReturn(microserviceName + QpsControllerManager.SEPARATOR + schemaId + QpsControllerManager.SEPARATOR + operationId);
Mockito.when(operationMeta.getMicroserviceName()).thenReturn(microserviceName);
Mockito.when(schemaMeta.getSchemaId()).thenReturn(schemaId);
return operationMeta;
}
use of org.apache.servicecomb.core.definition.OperationMeta in project incubator-servicecomb-java-chassis by apache.
the class QpsControllerManagerTest method testMock.
@Test
public void testMock() {
Invocation invocation = getMockInvocation("service", "schema", "oper");
OperationMeta operationMeta = invocation.getOperationMeta();
SchemaMeta schemaMeta = operationMeta.getSchemaMeta();
Assert.assertEquals("service", operationMeta.getMicroserviceName());
Assert.assertEquals("service.schema.oper", operationMeta.getMicroserviceQualifiedName());
Assert.assertEquals("schema.oper", operationMeta.getSchemaQualifiedName());
Assert.assertEquals("schema", schemaMeta.getSchemaId());
}
Aggregations