@Override public void accept(ExtensionDeclarer extensionDeclarer, ExtensionLoadingContext context) { extensionDeclarer.named(EXTENSION_NAME) .describedAs("Crafted Extension") .onVersion("1.0.0") .withCategory(COMMUNITY) .fromVendor("Mulesoft"); } }
private void fillDeclarer(ExtensionDeclarer declarer, String name, String version, String category, String vendor, XmlDslModel xmlDslModel, String description) { declarer.named(name) .describedAs(description) .fromVendor(vendor) .onVersion(version) .withCategory(Category.valueOf(category.toUpperCase())) .withXmlDsl(xmlDslModel); }
@Test public void enrichWithCustomNamespaceValue() { extensionDeclarer.named(EXTENSION_NAME).onVersion(EXTENSION_VERSION); XmlDslModel dslModel = enrich(DefaultXmlExtension.class); assertThat(dslModel, is(notNullValue())); assertThat(dslModel.getSchemaVersion(), is(EXTENSION_VERSION)); assertThat(dslModel.getPrefix(), is(NAMESPACE)); assertThat(dslModel.getNamespace(), equalTo(String.format(DEFAULT_NAMESPACE_LOCATION_MASK, NAMESPACE))); assertThat(dslModel.getXsdFileName(), is(String.format(XSD_FILENAME_MASK, NAMESPACE))); assertThat(dslModel.getSchemaLocation(), is(String.format(DEFAULT_SCHEMA_LOCATION_MASK, String.format(DEFAULT_NAMESPACE_LOCATION_MASK, NAMESPACE), String.format(XSD_FILENAME_MASK, NAMESPACE)))); }
@Test public void enrichWithDefaultValues() { extensionDeclarer.named(EXTENSION_NAME).onVersion(EXTENSION_VERSION); XmlDslModel dslModel = enrich(NoXmlSupport.class); assertThat(dslModel, is(notNullValue())); assertThat(dslModel.getSchemaVersion(), is(EXTENSION_VERSION)); assertThat(dslModel.getPrefix(), is(EXTENSION_HYPHENAZED_NAME)); assertThat(dslModel.getNamespace(), equalTo(String.format(DEFAULT_NAMESPACE_LOCATION_MASK, EXTENSION_HYPHENAZED_NAME))); assertThat(dslModel.getXsdFileName(), is(String.format(XSD_FILENAME_MASK, EXTENSION_HYPHENAZED_NAME))); assertThat(dslModel.getSchemaLocation(), is(String.format(DEFAULT_SCHEMA_LOCATION_MASK, String.format(DEFAULT_NAMESPACE_LOCATION_MASK, EXTENSION_HYPHENAZED_NAME), String.format(XSD_FILENAME_MASK, EXTENSION_HYPHENAZED_NAME)))); }
@Test public void enrichWithCustomValues() { extensionDeclarer.named(EXTENSION_NAME).onVersion(EXTENSION_VERSION); XmlDslModel dslModel = enrich(XmlSupport.class); assertThat(dslModel, is(notNullValue())); assertThat(dslModel.getSchemaVersion(), is(EXTENSION_VERSION)); assertThat(dslModel.getPrefix(), is(NAMESPACE)); assertThat(dslModel.getNamespace(), is(NAMESPACE_LOCATION)); assertThat(dslModel.getXsdFileName(), is(String.format(XSD_FILENAME_MASK, NAMESPACE))); assertThat(dslModel.getSchemaLocation(), is(String.format(DEFAULT_SCHEMA_LOCATION_MASK, NAMESPACE_LOCATION, String.format(XSD_FILENAME_MASK, NAMESPACE)))); }
@Test public void enrichWithCustomSchemaLocationValue() { extensionDeclarer.named(EXTENSION).onVersion(EXTENSION_VERSION); XmlDslModel dslModel = enrich(CustomSchemaLocationXmlExtension.class); assertThat(dslModel, is(notNullValue())); assertThat(dslModel.getSchemaVersion(), is(EXTENSION_VERSION)); assertThat(dslModel.getPrefix(), is(EXTENSION.toLowerCase())); assertThat(dslModel.getNamespace(), equalTo(NAMESPACE_LOCATION)); assertThat(dslModel.getXsdFileName(), is(String.format(XSD_FILENAME_MASK, hyphenize(EXTENSION)))); assertThat(dslModel.getSchemaLocation(), is(String.format(DEFAULT_SCHEMA_LOCATION_MASK, NAMESPACE_LOCATION, String.format(XSD_FILENAME_MASK, hyphenize(EXTENSION))))); }
@Override public void accept(ExtensionDeclarer extensionDeclarer, ExtensionLoadingContext context) { extensionDeclarer.named(EXTENSION_NAME) .describedAs("Crafted Extension") .onVersion("1.0.0") .withCategory(COMMUNITY) .fromVendor("Mulesoft"); } }
context.getExtensionDeclarer() .named(extensionElement.getName()) .onVersion(version) .fromVendor(extensionElement.getVendor()) .withCategory(extensionElement.getCategory())
private ExtensionDeclarer getExtensionDeclarer(ExtensionLoadingContext context) { Extension extension = MuleExtensionAnnotationParser.getExtension(extensionType); return context.getExtensionDeclarer() .named(extension.name()) .onVersion(version) .fromVendor(extension.vendor()) .withCategory(extension.category()) .withModelProperty(new SoapExtensionModelProperty()) .withModelProperty(new ExtensionTypeDescriptorModelProperty(new TypeWrapper(extensionType, typeLoader))) .withModelProperty(new ImplementingTypeModelProperty(extensionType)); }
private ExtensionModel mockedExtension(final String name, final String config, final String connectionProvider, boolean supportsConnectivityTesting) { final ExtensionDeclarer extensionDeclarer = new ExtensionDeclarer(); extensionDeclarer.named(name) .onVersion("4.0.0") .fromVendor("MuleSoft testcase") .withCategory(Category.COMMUNITY) .withConfig(config) .withConnectionProvider(connectionProvider) .supportsConnectivityTesting(supportsConnectivityTesting) .withConnectionManagementType(ConnectionManagementType.NONE); return new ExtensionModelFactory() .create(new DefaultExtensionLoadingContext(extensionDeclarer, currentThread().getContextClassLoader(), new NullDslResolvingContext())); }
@Override public void accept(ExtensionDeclarer extensionDeclarer, ExtensionLoadingContext context) { ConfigurationDeclarer configurationDeclarer = extensionDeclarer.named(EXTENSION_NAME) .describedAs("Crafted Config Properties Extension") .onVersion("1.0.0") .withCategory(COMMUNITY) .fromVendor("Mulesoft") .withConfig("secure-configuration-properties"); ParameterGroupDeclarer defaultParameterGroup = configurationDeclarer.onDefaultParameterGroup(); defaultParameterGroup .withRequiredParameter("file").ofType(BaseTypeBuilder.create(JAVA).stringType().build()); ParameterGroupDeclarer parameterGroupDeclarer = configurationDeclarer.onParameterGroup("encrypt").withDslInlineRepresentation(true); parameterGroupDeclarer.withRequiredParameter("algorithm").ofType(BaseTypeBuilder.create(JAVA).stringType().build()); parameterGroupDeclarer.withRequiredParameter("mode").ofType(BaseTypeBuilder.create(JAVA).stringType().build()); } }
@Test public void enrichWithCustomNamespaceValue() { extensionDeclarer.named(EXTENSION_NAME).onVersion(EXTENSION_VERSION); XmlDslModel dslModel = enrich(DefaultXmlExtension.class); assertThat(dslModel, is(notNullValue())); assertThat(dslModel.getSchemaVersion(), is(EXTENSION_VERSION)); assertThat(dslModel.getPrefix(), is(NAMESPACE)); assertThat(dslModel.getNamespace(), equalTo(String.format(DEFAULT_NAMESPACE_LOCATION_MASK, NAMESPACE))); assertThat(dslModel.getXsdFileName(), is(String.format(XSD_FILENAME_MASK, NAMESPACE))); assertThat(dslModel.getSchemaLocation(), is(String.format(DEFAULT_SCHEMA_LOCATION_MASK, String.format(DEFAULT_NAMESPACE_LOCATION_MASK, NAMESPACE), String.format(XSD_FILENAME_MASK, NAMESPACE)))); }
@Test public void enrichWithDefaultValues() { extensionDeclarer.named(EXTENSION_NAME).onVersion(EXTENSION_VERSION); XmlDslModel dslModel = enrich(NoXmlSupport.class); assertThat(dslModel, is(notNullValue())); assertThat(dslModel.getSchemaVersion(), is(EXTENSION_VERSION)); assertThat(dslModel.getPrefix(), is(EXTENSION_HYPHENAZED_NAME)); assertThat(dslModel.getNamespace(), equalTo(String.format(DEFAULT_NAMESPACE_LOCATION_MASK, EXTENSION_HYPHENAZED_NAME))); assertThat(dslModel.getXsdFileName(), is(String.format(XSD_FILENAME_MASK, EXTENSION_HYPHENAZED_NAME))); assertThat(dslModel.getSchemaLocation(), is(String.format(DEFAULT_SCHEMA_LOCATION_MASK, String.format(DEFAULT_NAMESPACE_LOCATION_MASK, EXTENSION_HYPHENAZED_NAME), String.format(XSD_FILENAME_MASK, EXTENSION_HYPHENAZED_NAME)))); }
@Test public void enrichWithCustomSchemaLocationValue() { extensionDeclarer.named(EXTENSION).onVersion(EXTENSION_VERSION); XmlDslModel dslModel = enrich(CustomSchemaLocationXmlExtension.class); assertThat(dslModel, is(notNullValue())); assertThat(dslModel.getSchemaVersion(), is(EXTENSION_VERSION)); assertThat(dslModel.getPrefix(), is(EXTENSION.toLowerCase())); assertThat(dslModel.getNamespace(), equalTo(NAMESPACE_LOCATION)); assertThat(dslModel.getXsdFileName(), is(String.format(XSD_FILENAME_MASK, hyphenize(EXTENSION)))); assertThat(dslModel.getSchemaLocation(), is(String.format(DEFAULT_SCHEMA_LOCATION_MASK, NAMESPACE_LOCATION, String.format(XSD_FILENAME_MASK, hyphenize(EXTENSION))))); }
@Test public void enrichWithCustomValues() { extensionDeclarer.named(EXTENSION_NAME).onVersion(EXTENSION_VERSION); XmlDslModel dslModel = enrich(XmlSupport.class); assertThat(dslModel, is(notNullValue())); assertThat(dslModel.getSchemaVersion(), is(EXTENSION_VERSION)); assertThat(dslModel.getPrefix(), is(NAMESPACE)); assertThat(dslModel.getNamespace(), is(NAMESPACE_LOCATION)); assertThat(dslModel.getXsdFileName(), is(String.format(XSD_FILENAME_MASK, NAMESPACE))); assertThat(dslModel.getSchemaLocation(), is(String.format(DEFAULT_SCHEMA_LOCATION_MASK, NAMESPACE_LOCATION, String.format(XSD_FILENAME_MASK, NAMESPACE)))); }
context.getExtensionDeclarer() .named(extensionElement.getName()) .onVersion(version) .fromVendor(extensionElement.getVendor()) .withCategory(extensionElement.getCategory())
@Override public void accept(ExtensionDeclarer extensionDeclarer, ExtensionLoadingContext context) { ConfigurationDeclarer configurationDeclarer = extensionDeclarer.named(EXTENSION_NAME) .describedAs("Crafted Config Properties Extension") .onVersion("1.0.0") .withCategory(COMMUNITY) .fromVendor("Mulesoft") .withConfig("secure-configuration-properties"); ParameterGroupDeclarer defaultParameterGroup = configurationDeclarer.onDefaultParameterGroup(); defaultParameterGroup .withRequiredParameter("file").ofType(BaseTypeBuilder.create(JAVA).stringType().build()); ParameterGroupDeclarer parameterGroupDeclarer = configurationDeclarer.onParameterGroup("encrypt").withDslInlineRepresentation(true); parameterGroupDeclarer.withRequiredParameter("algorithm").ofType(BaseTypeBuilder.create(JAVA).stringType().build()); parameterGroupDeclarer.withRequiredParameter("mode").ofType(BaseTypeBuilder.create(JAVA).stringType().build()); } }
.named(MULE_NAME) .describedAs("Mule Runtime and Integration Platform: Core components") .onVersion(MULE_VERSION) .fromVendor(MULESOFT_VENDOR) .withCategory(COMMUNITY)
.describedAs(EXTENSION_DESCRIPTION) .fromVendor(VENDOR) .onVersion(VERSION) .withCategory(COMMUNITY) .withMinMuleVersion(MIN_MULE_VERSION)