@Test public void test() throws IOException { ValidateSwitchYardScanner scanner = new ValidateSwitchYardScanner(); List<URL> urls = new ArrayList<URL>(); urls.add(new File("./target/test-classes").toURI().toURL()); ScannerInput<SwitchYardModel> input = new ScannerInput<SwitchYardModel>().setURLs(urls); SwitchYardModel switchyard = scanner.scan(input).getModel(); List<ValidateModel> models = switchyard.getValidates().getValidates(); Assert.assertEquals(9, models.size()); assertModelInstanceOK((JavaValidateModel) models.get(0)); assertModelInstanceOK((JavaValidateModel) models.get(1)); assertModelInstanceOK((JavaValidateModel) models.get(2)); }
@Override public ScannerOutput<SwitchYardModel> scan(ScannerInput<SwitchYardModel> input) throws IOException { SwitchYardNamespace switchyardNamespace = input.getSwitchyardNamespace(); SwitchYardModel switchyardModel = new V1SwitchYardModel(switchyardNamespace.uri()); ValidatesModel validatesModel = null; ValidateNamespace validateNamespace = ValidateNamespace.DEFAULT; for (ValidateNamespace value : ValidateNamespace.values()) { if (value.versionMatches(switchyardNamespace)) { validateNamespace = value; break; } } List<Class<?>> validatorClasses = scanForValidators(input.getURLs()); for (Class<?> validator : validatorClasses) { List<ValidatorTypes> supportedValidators = ValidatorUtil.listValidations(validator); for (ValidatorTypes supportedValidate : supportedValidators) { JavaValidateModel validateModel = new V1JavaValidateModel(validateNamespace.uri()); String bean = CDIUtil.getNamedAnnotationValue(validator); if (bean != null) { validateModel.setBean(bean); } else { validateModel.setClazz(validator.getName()); } validateModel.setName(supportedValidate.getName()); if (validatesModel == null) { validatesModel = new V1ValidatesModel(switchyardNamespace.uri()); switchyardModel.setValidates(validatesModel); } validatesModel.addValidate(validateModel); } } return new ScannerOutput<SwitchYardModel>().setModel(switchyardModel); }
ValidateSwitchYardScanner implements Scanner<SwitchYardModel> { @Override public ScannerOutput<SwitchYardModel> scan(ScannerInput<SwitchYardModel> input) throws IOException { SwitchYardNamespace switchyardNamespace = input.getSwitchyardNamespace(); SwitchYardModel switchyardModel = new V1SwitchYardModel(switchyardNamespace.uri()); ValidatesModel validatesModel = null; ValidateNamespace validateNamespace = ValidateNamespace.DEFAULT; for (ValidateNamespace value : ValidateNamespace.values()) { if (value.versionMatches(switchyardNamespace)) { validateNamespace = value; break; } } List<Class<?>> validatorClasses = scanForValidators(input.getURLs()); for (Class<?> validator : validatorClasses) { List<ValidatorTypes> supportedValidators = ValidatorUtil.listValidations(validator); for (ValidatorTypes supportedValidate : supportedValidators) { JavaValidateModel validateModel = new V1JavaValidateModel(validateNamespace.uri()); String bean = CDIUtil.getNamedAnnotationValue(validator); if (bean != null) { validateModel.setBean(bean); } else { validateModel.setClazz(validator.getName()); } validateModel.setName(supportedValidate.getName()); if (validatesModel == null) { validatesModel = new V1ValidatesModel(switchyardNamespace.uri()); switchyardModel.setValidates(validatesModel); } validatesModel.addValidate(validateModel); } } return new ScannerOutput<SwitchYardModel>().setModel(switchyardModel); } }
ValidateSwitchYardScanner implements Scanner<SwitchYardModel> { @Override public ScannerOutput<SwitchYardModel> scan(ScannerInput<SwitchYardModel> input) throws IOException { SwitchYardNamespace switchyardNamespace = input.getSwitchyardNamespace(); SwitchYardModel switchyardModel = new V1SwitchYardModel(switchyardNamespace.uri()); ValidatesModel validatesModel = null; ValidateNamespace validateNamespace = ValidateNamespace.DEFAULT; for (ValidateNamespace value : ValidateNamespace.values()) { if (value.versionMatches(switchyardNamespace)) { validateNamespace = value; break; } } List<Class<?>> validatorClasses = scanForValidators(input.getURLs()); for (Class<?> validator : validatorClasses) { List<ValidatorTypes> supportedValidators = ValidatorUtil.listValidations(validator); for (ValidatorTypes supportedValidate : supportedValidators) { JavaValidateModel validateModel = new V1JavaValidateModel(validateNamespace.uri()); String bean = CDIUtil.getNamedAnnotationValue(validator); if (bean != null) { validateModel.setBean(bean); } else { validateModel.setClazz(validator.getName()); } validateModel.setName(supportedValidate.getName()); if (validatesModel == null) { validatesModel = new V1ValidatesModel(switchyardNamespace.uri()); switchyardModel.setValidates(validatesModel); } validatesModel.addValidate(validateModel); } } return new ScannerOutput<SwitchYardModel>().setModel(switchyardModel); }  }
ValidateSwitchYardScanner implements Scanner<SwitchYardModel> { @Override public ScannerOutput<SwitchYardModel> scan(ScannerInput<SwitchYardModel> input) throws IOException { SwitchYardNamespace switchyardNamespace = input.getSwitchyardNamespace(); SwitchYardModel switchyardModel = new V1SwitchYardModel(switchyardNamespace.uri()); ValidatesModel validatesModel = null; ValidateNamespace validateNamespace = ValidateNamespace.DEFAULT; for (ValidateNamespace value : ValidateNamespace.values()) { if (value.versionMatches(switchyardNamespace)) { validateNamespace = value; break; } } List<Class<?>> validatorClasses = scanForValidators(input.getURLs()); for (Class<?> validator : validatorClasses) { List<ValidatorTypes> supportedValidators = ValidatorUtil.listValidations(validator); for (ValidatorTypes supportedValidate : supportedValidators) { JavaValidateModel validateModel = new V1JavaValidateModel(validateNamespace.uri()); String bean = CDIUtil.getNamedAnnotationValue(validator); if (bean != null) { validateModel.setBean(bean); } else { validateModel.setClazz(validator.getName()); } validateModel.setName(supportedValidate.getName()); if (validatesModel == null) { validatesModel = new V1ValidatesModel(switchyardNamespace.uri()); switchyardModel.setValidates(validatesModel); } validatesModel.addValidate(validateModel); } } return new ScannerOutput<SwitchYardModel>().setModel(switchyardModel); }  @Override ScannerOutput<SwitchYardModel> scan(ScannerInput<SwitchYardModel> input); }
ValidateSwitchYardScanner implements Scanner<SwitchYardModel> { @Override public ScannerOutput<SwitchYardModel> scan(ScannerInput<SwitchYardModel> input) throws IOException { SwitchYardNamespace switchyardNamespace = input.getSwitchyardNamespace(); SwitchYardModel switchyardModel = new V1SwitchYardModel(switchyardNamespace.uri()); ValidatesModel validatesModel = null; ValidateNamespace validateNamespace = ValidateNamespace.DEFAULT; for (ValidateNamespace value : ValidateNamespace.values()) { if (value.versionMatches(switchyardNamespace)) { validateNamespace = value; break; } } List<Class<?>> validatorClasses = scanForValidators(input.getURLs()); for (Class<?> validator : validatorClasses) { List<ValidatorTypes> supportedValidators = ValidatorUtil.listValidations(validator); for (ValidatorTypes supportedValidate : supportedValidators) { JavaValidateModel validateModel = new V1JavaValidateModel(validateNamespace.uri()); String bean = CDIUtil.getNamedAnnotationValue(validator); if (bean != null) { validateModel.setBean(bean); } else { validateModel.setClazz(validator.getName()); } validateModel.setName(supportedValidate.getName()); if (validatesModel == null) { validatesModel = new V1ValidatesModel(switchyardNamespace.uri()); switchyardModel.setValidates(validatesModel); } validatesModel.addValidate(validateModel); } } return new ScannerOutput<SwitchYardModel>().setModel(switchyardModel); }  @Override ScannerOutput<SwitchYardModel> scan(ScannerInput<SwitchYardModel> input);  }