@Test public void parseSimplePathParameter() { ExtensionDeclaration declaration = marvelDeclarer.getDeclaration(); ConfigurationDeclaration config = findConfigByName(declaration, IronMan.CONFIG_NAME); List<ParameterDeclaration> params = config.getAllParameters(); assertThat(params, hasSize(2)); ParameterDeclaration pathParam = params.get(0); Optional<PathModel> pathModel = pathParam.getDisplayModel().getPathModel(); assertThat(pathModel.isPresent(), is(true)); assertThat(pathModel.get().getType(), is(ANY)); assertThat(pathModel.get().acceptsUrls(), is(true)); assertThat(pathModel.get().getFileExtensions(), empty()); }
pathModel = new PathModel(pathAnnotation.type(), pathAnnotation.acceptsUrls(), pathAnnotation.location(),
private void declareConfigurationProperties(ExtensionDeclarer extensionDeclarer, ClassTypeLoader typeLoader) { ConstructDeclarer configuration = extensionDeclarer.withConstruct("configurationProperties") .allowingTopLevelDefinition() .withStereotype(APP_CONFIG) .describedAs("References a file with configuration properties. Each property has a key and a value. \n" + "The key can be referenced from the mule configuration files using the following semantics: \n" + "${key_name}. This allows to externalize configuration and change it based\n" + "on the environment the application is being deployed to."); configuration.onDefaultParameterGroup() .withRequiredParameter("file") .ofType(typeLoader.load(String.class)) .withExpressionSupport(NOT_SUPPORTED) .withDisplayModel(DisplayModel.builder().path(new PathModel(FILE, false, EMBEDDED, new String[] {"properties"})).build()) .describedAs(" The location of the file with the configuration properties to use. " + "It may be a location in the classpath or an absolute location. The file location\n" + " value may also contains references to properties that will only be resolved based on " + "system properties or properties set at deployment time."); }
@Test public void parsePathParameterWithFileExtensions() { ExtensionDeclaration declaration = marvelDeclarer.getDeclaration(); OperationDeclaration findInstructionsOperation = getOperation(declaration, "findInstructions"); List<ParameterDeclaration> params = findInstructionsOperation.getAllParameters(); assertThat(params, hasSize(2)); ParameterDeclaration pathParam = params.get(0); Optional<PathModel> pathModel = pathParam.getDisplayModel().getPathModel(); assertThat(pathModel.isPresent(), is(true)); assertThat(pathModel.get().getType(), is(ANY)); assertThat(pathModel.get().acceptsUrls(), is(false)); assertThat(pathModel.get().getFileExtensions(), hasItem("xml")); }
pathModel = new PathModel(pathAnnotation.type(), pathAnnotation.acceptsUrls(), pathAnnotation.location(),
@Test public void parsePathParameterThatIsDirectory() { ExtensionDeclaration declaration = marvelDeclarer.getDeclaration(); ConfigurationDeclaration config = findConfigByName(declaration, IronMan.CONFIG_NAME); ConnectionProviderDeclaration missileProvider = findProviderByName(config, MissileProvider.NAME); List<ParameterDeclaration> params = missileProvider.getAllParameters(); assertThat(params, hasSize(1)); ParameterDeclaration pathParam = params.get(0); Optional<PathModel> pathModel = pathParam.getDisplayModel().getPathModel(); assertThat(pathModel.isPresent(), is(true)); assertThat(pathModel.get().getType(), is(DIRECTORY)); assertThat(pathModel.get().acceptsUrls(), is(false)); assertThat(pathModel.get().getFileExtensions(), empty()); }