public static void mockExecutorFactory(OperationModel operationModel, ComponentExecutorFactory operationExecutorFactory) { when(operationModel.getModelProperty(ComponentExecutorModelProperty.class)) .thenReturn(of(new ComponentExecutorModelProperty(operationExecutorFactory))); }
router .withModelProperty(new ImplementingMethodModelProperty(method.get())) .withModelProperty(new ComponentExecutorModelProperty(new ReflectiveOperationExecutorFactory<>(declaringClass.get(), method.get())));
@Override public void enrich(ExtensionLoadingContext extensionLoadingContext) { extensionLoadingContext.getExtensionDeclarer().getDeclaration().getOperations().stream() .filter(o -> o.getName().equals("doSomethingAsync")) .findFirst() .ifPresent(operation -> operation.addModelProperty( new ComponentExecutorModelProperty((model, params) -> new PrivilegedNonBlockingComponentExecutor()))); } }
.withModelProperty(new ComponentExecutorModelProperty(new ReflectiveOperationExecutorFactory<>(declaringClass.get(), method.get())));
/** * Declares the invoke operation. * * @param configDeclarer the soap config declarer * @param loader a {@link ClassTypeLoader} to load some parameters types. * @param soapErrors the {@link ErrorModel}s that this operation can throw. */ void declare(ConfigurationDeclarer configDeclarer, ClassTypeLoader loader, Set<ErrorModel> soapErrors) { ReflectionCache reflectionCache = new ReflectionCache(); OperationDeclarer operation = configDeclarer.withOperation(OPERATION_NAME) .describedAs(OPERATION_DESCRIPTION) .requiresConnection(true) .blocking(true) .withModelProperty(new ComponentExecutorModelProperty(new SoapOperationExecutorFactory())) .withModelProperty(new ConnectivityModelProperty(ForwardingSoapClient.class)); soapErrors.forEach(operation::withErrorModel); declareMetadata(operation, loader); declareOutput(operation, loader); declareMetadataKeyParameters(operation, loader, reflectionCache); declareRequestParameters(operation, loader); }
operationDeclarer .withModelProperty(new ImplementingMethodModelProperty(method.get())) .withModelProperty(new ComponentExecutorModelProperty(new ReflectiveOperationExecutorFactory<>(declaringClass.get(), method.get())));
private OperationDeclaration buildUnauthorizeOperation() { OperationDeclaration operation = new OperationDeclaration(UNAUTHORIZE_OPERATION_NAME); operation.setDescription("Deletes all the access token information of a given resource owner id so that it's impossible to " + "execute any operation for that user without doing the authorization dance again"); operation.setBlocking(true); operation.setExecutionType(BLOCKING); operation.setOutput(toDeclaration(voidType)); operation.setOutputAttributes(toDeclaration(voidType)); operation.setRequiresConnection(false); operation.setSupportsStreaming(false); operation.setTransactional(false); operation.addModelProperty(new ComponentExecutorModelProperty((model, params) -> new UnauthorizeOperationExecutor())); ParameterGroupDeclaration group = operation.getParameterGroup(DEFAULT_GROUP_NAME); group.showInDsl(false); ParameterDeclaration parameter = new ParameterDeclaration(RESOURCE_OWNER_ID_PARAMETER_NAME); parameter.setDescription("The id of the resource owner which access should be invalidated"); parameter.setExpressionSupport(SUPPORTED); parameter.setLayoutModel(LayoutModel.builder().build()); parameter.setRequired(false); parameter.setParameterRole(BEHAVIOUR); parameter.setType(stringType, false); group.addParameter(parameter); return operation; }
router .withModelProperty(new ImplementingMethodModelProperty(method.get())) .withModelProperty(new ComponentExecutorModelProperty(new ReflectiveOperationExecutorFactory<>(declaringClass.get(), method.get())));
.withModelProperty(new ComponentExecutorModelProperty(new ReflectiveOperationExecutorFactory<>(declaringClass.get(), method.get())));
operationDeclarer .withModelProperty(new ImplementingMethodModelProperty(method.get())) .withModelProperty(new ComponentExecutorModelProperty(new ReflectiveOperationExecutorFactory<>(declaringClass.get(), method.get())));
private OperationDeclaration buildUnauthorizeOperation() { OperationDeclaration operation = new OperationDeclaration(UNAUTHORIZE_OPERATION_NAME); operation.setDescription("Deletes all the access token information of a given resource owner id so that it's impossible to " + "execute any operation for that user without doing the authorization dance again"); operation.setBlocking(true); operation.setExecutionType(BLOCKING); operation.setOutput(toDeclaration(voidType)); operation.setOutputAttributes(toDeclaration(voidType)); operation.setRequiresConnection(false); operation.setSupportsStreaming(false); operation.setTransactional(false); operation.addModelProperty(new ComponentExecutorModelProperty((model, params) -> new UnauthorizeOperationExecutor())); ParameterGroupDeclaration group = operation.getParameterGroup(DEFAULT_GROUP_NAME); group.showInDsl(false); ParameterDeclaration parameter = new ParameterDeclaration(RESOURCE_OWNER_ID_PARAMETER_NAME); parameter.setDescription("The id of the resource owner which access should be invalidated"); parameter.setExpressionSupport(SUPPORTED); parameter.setLayoutModel(LayoutModel.builder().build()); parameter.setRequired(false); parameter.setParameterRole(BEHAVIOUR); parameter.setType(stringType, false); group.addParameter(parameter); return operation; }