@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()); }
@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")); }
@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()); }