use of org.apache.camel.processor.validation.ValidatingProcessor in project camel by apache.
the class ValidatingProcessorNotUseSharedSchemaTest method setUp.
@Override
protected void setUp() throws Exception {
validating = new ValidatingProcessor();
validating.setSchemaFile(new File("src/test/resources/org/apache/camel/processor/ValidatingProcessor.xsd"));
validating.setUseSharedSchema(false);
super.setUp();
}
use of org.apache.camel.processor.validation.ValidatingProcessor in project camel by apache.
the class ValidatingProcessorFromSourceTest method setUp.
@Override
protected void setUp() throws Exception {
super.setUp();
File file = new File("src/test/resources/org/apache/camel/processor/ValidatingProcessor.xsd");
String body = context.getTypeConverter().convertTo(String.class, file);
validating = new ValidatingProcessor();
validating.setSchemaSource(new StringSource(body));
// loading scheme can be forced so lets try it
validating.loadSchema();
}
use of org.apache.camel.processor.validation.ValidatingProcessor in project camel by apache.
the class ValidatorEndpoint method createProducer.
@Override
public Producer createProducer() throws Exception {
if (!schemaReaderConfigured) {
if (resourceResolver != null) {
schemaReader.setResourceResolver(resourceResolver);
} else if (resourceResolverFactory != null) {
resourceResolver = resourceResolverFactory.createResourceResolver(getCamelContext(), resourceUri);
// set the created resource resolver to the resourceResolver variable, so that it can
// be accessed by the endpoint
schemaReader.setResourceResolver(resourceResolver);
} else {
schemaReader.setResourceResolver(new DefaultValidatorResourceResolverFactory().createResourceResolver(getCamelContext(), resourceUri));
}
schemaReader.setSchemaLanguage(getSchemaLanguage());
schemaReader.setSchemaFactory(getSchemaFactory());
// force loading of schema at create time otherwise concurrent
// processing could cause thread safe issues for the
// javax.xml.validation.SchemaFactory
schemaReader.loadSchema();
// configure only once
schemaReaderConfigured = true;
}
ValidatingProcessor validator = new ValidatingProcessor(schemaReader);
configureValidator(validator);
return new ValidatorProducer(this, validator);
}
use of org.apache.camel.processor.validation.ValidatingProcessor in project camel by apache.
the class ValidatingProcessorFromUrlTest method setUp.
@Override
protected void setUp() throws Exception {
super.setUp();
validating = new ValidatingProcessor();
URL url = ObjectHelper.loadResourceAsURL("org/apache/camel/processor/ValidatingProcessor.xsd");
validating.setSchemaUrl(url);
// loading scheme can be forced so lets try it
validating.loadSchema();
}
use of org.apache.camel.processor.validation.ValidatingProcessor in project camel by apache.
the class ValidatingProcessorTest method setUp.
@Override
protected void setUp() throws Exception {
validating = new ValidatingProcessor();
validating.setSchemaFile(new File("src/test/resources/org/apache/camel/processor/ValidatingProcessor.xsd"));
super.setUp();
}
Aggregations