Search in sources :

Example 1 with StereotypeModel

use of org.mule.runtime.api.meta.model.stereotype.StereotypeModel in project mule by mulesoft.

the class StereotypesDeclarationEnricherTestCase method operationParameterWithFlowReferenceParameter.

@Test
public void operationParameterWithFlowReferenceParameter() {
    OperationModel operation = configuration.getOperationModel("withFlowReference").get();
    assertThat(operation.getAllParameterModels(), hasSize(1));
    ParameterModel param = operation.getAllParameterModels().get(0);
    List<StereotypeModel> stereotypes = param.getAllowedStereotypes();
    assertThat(stereotypes, hasSize(1));
    assertThat(stereotypes.get(0), is(FLOW));
}
Also used : StereotypeModel(org.mule.runtime.api.meta.model.stereotype.StereotypeModel) ParameterModel(org.mule.runtime.api.meta.model.parameter.ParameterModel) OperationModel(org.mule.runtime.api.meta.model.operation.OperationModel) Test(org.junit.Test)

Example 2 with StereotypeModel

use of org.mule.runtime.api.meta.model.stereotype.StereotypeModel in project mule by mulesoft.

the class StereotypesDeclarationEnricherTestCase method connectionProviderWithMultipleConfigReferenceParameter.

@Test
public void connectionProviderWithMultipleConfigReferenceParameter() {
    ParameterModel paramWithReferences = configuration.getConnectionProviders().get(0).getAllParameterModels().get(0);
    List<StereotypeModel> allowedStereotypes = paramWithReferences.getAllowedStereotypes();
    assertThat(allowedStereotypes, hasSize(2));
    assertStereotype(allowedStereotypes.get(0), HeisenbergExtension.HEISENBERG, "config", CONFIG);
    assertStereotype(allowedStereotypes.get(1), MARVEL_EXTENSION, CONFIG_NAME, CONFIG);
}
Also used : StereotypeModel(org.mule.runtime.api.meta.model.stereotype.StereotypeModel) ParameterModel(org.mule.runtime.api.meta.model.parameter.ParameterModel) Test(org.junit.Test)

Example 3 with StereotypeModel

use of org.mule.runtime.api.meta.model.stereotype.StereotypeModel in project mule by mulesoft.

the class StereotypesDeclarationEnricherTestCase method configWithObjectStoreReference.

@Test
public void configWithObjectStoreReference() {
    ParameterModel osParam = configuration.getAllParameterModels().stream().filter(p -> p.getName().equals("spellStore")).findFirst().get();
    assertThat(osParam.getAllowedStereotypes(), hasSize(1));
    StereotypeModel stereotypeModel = osParam.getAllowedStereotypes().get(0);
    assertThat(stereotypeModel, is(OBJECT_STORE));
}
Also used : StereotypeModel(org.mule.runtime.api.meta.model.stereotype.StereotypeModel) ParameterModel(org.mule.runtime.api.meta.model.parameter.ParameterModel) Test(org.junit.Test)

Example 4 with StereotypeModel

use of org.mule.runtime.api.meta.model.stereotype.StereotypeModel in project mule by mulesoft.

the class StereotypesDeclarationEnricherTestCase method configurationWithConfigReferenceParameter.

@Test
public void configurationWithConfigReferenceParameter() {
    List<ParameterModel> params = configuration.getAllParameterModels();
    assertThat(params, hasSize(3));
    ParameterModel param = params.get(0);
    List<StereotypeModel> allowedStereotypes = param.getAllowedStereotypes();
    assertThat(allowedStereotypes, hasSize(1));
    assertStereotype(allowedStereotypes.get(0), MARVEL_EXTENSION, CONFIG_NAME, CONFIG);
}
Also used : StereotypeModel(org.mule.runtime.api.meta.model.stereotype.StereotypeModel) ParameterModel(org.mule.runtime.api.meta.model.parameter.ParameterModel) Test(org.junit.Test)

Example 5 with StereotypeModel

use of org.mule.runtime.api.meta.model.stereotype.StereotypeModel in project mule by mulesoft.

the class DefaultExtensionModelFactoryTestCase method customStereotype.

@Test
public void customStereotype() {
    ExtensionModel extensionModel = createExtension(HeisenbergExtension.class);
    OperationModel operation = extensionModel.getConfigurationModels().get(0).getOperationModel("callSaul").get();
    StereotypeModel stereotypeModel = operation.getStereotype();
    assertThat(stereotypeModel.isAssignableTo(PROCESSOR), is(true));
    assertThat(stereotypeModel.getType(), is(new EmpireStereotype().getName().toUpperCase()));
    assertThat(stereotypeModel.getNamespace(), is(HEISENBERG.toUpperCase()));
    assertThat(stereotypeModel.getParent().get(), is(PROCESSOR));
}
Also used : StereotypeModel(org.mule.runtime.api.meta.model.stereotype.StereotypeModel) EmpireStereotype(org.mule.test.heisenberg.extension.stereotypes.EmpireStereotype) ExtensionModel(org.mule.runtime.api.meta.model.ExtensionModel) OperationModel(org.mule.runtime.api.meta.model.operation.OperationModel) Test(org.junit.Test) SmallTest(org.mule.tck.size.SmallTest)

Aggregations

StereotypeModel (org.mule.runtime.api.meta.model.stereotype.StereotypeModel)10 Test (org.junit.Test)8 OperationModel (org.mule.runtime.api.meta.model.operation.OperationModel)5 ExtensionModel (org.mule.runtime.api.meta.model.ExtensionModel)4 ParameterModel (org.mule.runtime.api.meta.model.parameter.ParameterModel)4 SmallTest (org.mule.tck.size.SmallTest)4 List (java.util.List)2 Collectors.toList (java.util.stream.Collectors.toList)2 OBJECT_STORE (org.mule.runtime.extension.api.stereotype.MuleStereotypes.OBJECT_STORE)2 EmpireStereotype (org.mule.test.heisenberg.extension.stereotypes.EmpireStereotype)2 AnnotatedElement (java.lang.reflect.AnnotatedElement)1 Arrays (java.util.Arrays)1 Arrays.asList (java.util.Arrays.asList)1 Arrays.stream (java.util.Arrays.stream)1 Collections.emptyList (java.util.Collections.emptyList)1 Collections.singletonList (java.util.Collections.singletonList)1 NoSuchElementException (java.util.NoSuchElementException)1 Optional (java.util.Optional)1 CoreMatchers.equalTo (org.hamcrest.CoreMatchers.equalTo)1 CoreMatchers.instanceOf (org.hamcrest.CoreMatchers.instanceOf)1