Search in sources :

Example 1 with MethodWrapper

use of org.mule.runtime.module.extension.internal.loader.java.type.runtime.MethodWrapper in project mule by mulesoft.

the class ExportedArtifactsCollectorTestCase method withMethod.

private void withMethod(OperationModel operationModel, Optional<Method> optionalMethod) {
    when(operationModel.getModelProperty(ImplementingMethodModelProperty.class)).thenReturn(optionalMethod.map(ImplementingMethodModelProperty::new));
    when(operationModel.getModelProperty(ExtensionOperationDescriptorModelProperty.class)).thenReturn(optionalMethod.map(method -> new ExtensionOperationDescriptorModelProperty(new MethodWrapper(method, loader))));
}
Also used : Optional.empty(java.util.Optional.empty) ParameterModel(org.mule.runtime.api.meta.model.parameter.ParameterModel) OperationModel(org.mule.runtime.api.meta.model.operation.OperationModel) Apple(org.mule.tck.testmodels.fruit.Apple) MethodWrapper(org.mule.runtime.module.extension.internal.loader.java.type.runtime.MethodWrapper) HeisenbergOperations(org.mule.test.heisenberg.extension.HeisenbergOperations) Mock(org.mockito.Mock) Optional.of(java.util.Optional.of) ExtensionsTypeLoaderFactory(org.mule.runtime.extension.api.declaration.type.ExtensionsTypeLoaderFactory) RunWith(org.junit.runner.RunWith) Shape(org.mule.test.metadata.extension.model.shapes.Shape) TypeToken(com.google.common.reflect.TypeToken) ExtensionsTestUtils.mockParameters(org.mule.test.module.extension.internal.util.ExtensionsTestUtils.mockParameters) Arrays.asList(java.util.Arrays.asList) ExtensionModelTestUtils.visitableMock(org.mule.runtime.api.util.ExtensionModelTestUtils.visitableMock) MatcherAssert.assertThat(org.hamcrest.MatcherAssert.assertThat) IntrospectionUtils.getApiMethods(org.mule.runtime.module.extension.internal.util.IntrospectionUtils.getApiMethods) ClassTypeLoader(org.mule.metadata.api.ClassTypeLoader) Method(java.lang.reflect.Method) VeganAttributes(org.mule.test.vegan.extension.VeganAttributes) Before(org.junit.Before) Set(java.util.Set) Test(org.junit.Test) Mockito.when(org.mockito.Mockito.when) ClassLoaderModelProperty(org.mule.runtime.extension.api.property.ClassLoaderModelProperty) Result(org.mule.runtime.extension.api.runtime.operation.Result) IsCollectionWithSize.hasSize(org.hamcrest.collection.IsCollectionWithSize.hasSize) ExtensionModel(org.mule.runtime.api.meta.model.ExtensionModel) List(java.util.List) MockitoJUnitRunner(org.mockito.runners.MockitoJUnitRunner) Matchers.containsInAnyOrder(org.hamcrest.Matchers.containsInAnyOrder) Type(java.lang.reflect.Type) OutputModel(org.mule.runtime.api.meta.model.OutputModel) Optional(java.util.Optional) ImplementingMethodModelProperty(org.mule.runtime.module.extension.internal.loader.java.property.ImplementingMethodModelProperty) ExtensionOperationDescriptorModelProperty(org.mule.runtime.module.extension.internal.loader.java.type.property.ExtensionOperationDescriptorModelProperty) Mockito.mock(org.mockito.Mockito.mock) ExtensionOperationDescriptorModelProperty(org.mule.runtime.module.extension.internal.loader.java.type.property.ExtensionOperationDescriptorModelProperty) MethodWrapper(org.mule.runtime.module.extension.internal.loader.java.type.runtime.MethodWrapper)

Example 2 with MethodWrapper

use of org.mule.runtime.module.extension.internal.loader.java.type.runtime.MethodWrapper in project mule by mulesoft.

the class ExportedPackagesValidatorTestCase method withMethod.

private void withMethod(OperationModel operationModel, Optional<Method> optionalMethod) {
    when(operationModel.getModelProperty(ImplementingMethodModelProperty.class)).thenReturn(optionalMethod.map(ImplementingMethodModelProperty::new));
    when(operationModel.getModelProperty(ExtensionOperationDescriptorModelProperty.class)).thenReturn(optionalMethod.map(method -> new ExtensionOperationDescriptorModelProperty(new MethodWrapper(method, loader))));
}
Also used : CoreMatchers.is(org.hamcrest.CoreMatchers.is) Optional.empty(java.util.Optional.empty) ParameterModel(org.mule.runtime.api.meta.model.parameter.ParameterModel) OperationModel(org.mule.runtime.api.meta.model.operation.OperationModel) Apple(org.mule.tck.testmodels.fruit.Apple) MethodWrapper(org.mule.runtime.module.extension.internal.loader.java.type.runtime.MethodWrapper) Mock(org.mockito.Mock) Optional.of(java.util.Optional.of) ExtensionsTypeLoaderFactory(org.mule.runtime.extension.api.declaration.type.ExtensionsTypeLoaderFactory) CoreMatchers.not(org.hamcrest.CoreMatchers.not) RunWith(org.junit.runner.RunWith) Shape(org.mule.test.metadata.extension.model.shapes.Shape) TypeToken(com.google.common.reflect.TypeToken) IsEmptyCollection(org.hamcrest.collection.IsEmptyCollection) ExtensionsTestUtils.mockParameters(org.mule.test.module.extension.internal.util.ExtensionsTestUtils.mockParameters) Arrays.asList(java.util.Arrays.asList) ExtensionModelTestUtils.visitableMock(org.mule.runtime.api.util.ExtensionModelTestUtils.visitableMock) MatcherAssert.assertThat(org.hamcrest.MatcherAssert.assertThat) IntrospectionUtils.getApiMethods(org.mule.runtime.module.extension.internal.util.IntrospectionUtils.getApiMethods) ClassTypeLoader(org.mule.metadata.api.ClassTypeLoader) Problem(org.mule.runtime.extension.api.loader.Problem) ApiTestClass(org.mule.test.module.extension.api.ApiTestClass) Method(java.lang.reflect.Method) VeganAttributes(org.mule.test.vegan.extension.VeganAttributes) Before(org.junit.Before) CoreMatchers.containsString(org.hamcrest.CoreMatchers.containsString) ProblemsReporter(org.mule.runtime.extension.api.loader.ProblemsReporter) Test(org.junit.Test) Mockito.when(org.mockito.Mockito.when) ClassLoaderModelProperty(org.mule.runtime.extension.api.property.ClassLoaderModelProperty) InternalTestClass(org.mule.test.module.extension.internal.InternalTestClass) Result(org.mule.runtime.extension.api.runtime.operation.Result) ExtensionModel(org.mule.runtime.api.meta.model.ExtensionModel) List(java.util.List) MockitoJUnitRunner(org.mockito.runners.MockitoJUnitRunner) Type(java.lang.reflect.Type) OutputModel(org.mule.runtime.api.meta.model.OutputModel) Optional(java.util.Optional) ImplementingMethodModelProperty(org.mule.runtime.module.extension.internal.loader.java.property.ImplementingMethodModelProperty) ExtensionOperationDescriptorModelProperty(org.mule.runtime.module.extension.internal.loader.java.type.property.ExtensionOperationDescriptorModelProperty) Mockito.mock(org.mockito.Mockito.mock) ExtensionOperationDescriptorModelProperty(org.mule.runtime.module.extension.internal.loader.java.type.property.ExtensionOperationDescriptorModelProperty) MethodWrapper(org.mule.runtime.module.extension.internal.loader.java.type.runtime.MethodWrapper)

Aggregations

TypeToken (com.google.common.reflect.TypeToken)2 Method (java.lang.reflect.Method)2 Type (java.lang.reflect.Type)2 Arrays.asList (java.util.Arrays.asList)2 List (java.util.List)2 Optional (java.util.Optional)2 Optional.empty (java.util.Optional.empty)2 Optional.of (java.util.Optional.of)2 MatcherAssert.assertThat (org.hamcrest.MatcherAssert.assertThat)2 Before (org.junit.Before)2 Test (org.junit.Test)2 RunWith (org.junit.runner.RunWith)2 Mock (org.mockito.Mock)2 Mockito.mock (org.mockito.Mockito.mock)2 Mockito.when (org.mockito.Mockito.when)2 MockitoJUnitRunner (org.mockito.runners.MockitoJUnitRunner)2 ClassTypeLoader (org.mule.metadata.api.ClassTypeLoader)2 ExtensionModel (org.mule.runtime.api.meta.model.ExtensionModel)2 OutputModel (org.mule.runtime.api.meta.model.OutputModel)2 OperationModel (org.mule.runtime.api.meta.model.operation.OperationModel)2