package eu.europa.esig.dss.validation.policy.bbb;

import static org.junit.Assert.assertNotNull;

import java.io.File;

import javax.xml.XMLConstants;
import javax.xml.bind.JAXBContext;
import javax.xml.bind.Unmarshaller;
import javax.xml.validation.Schema;
import javax.xml.validation.SchemaFactory;

import eu.europa.esig.jaxb.policy.ConstraintsParameters;
import eu.europa.esig.jaxb.policy.Level;
import eu.europa.esig.jaxb.policy.LevelConstraint;
import eu.europa.esig.jaxb.policy.MultiValuesConstraint;
import eu.europa.esig.jaxb.policy.ValueConstraint;

public class AbstractValidationPolicy {

	public ConstraintsParameters getConstraintsParameters() throws Exception {
		SchemaFactory sf = SchemaFactory.newInstance(XMLConstants.W3C_XML_SCHEMA_NS_URI);
		Schema schema = sf.newSchema(new File("src/main/resources/policy/policy.xsd"));

		JAXBContext jaxbContext = JAXBContext.newInstance(eu.europa.esig.jaxb.policy.ObjectFactory.class);
		Unmarshaller unmarshaller = jaxbContext.createUnmarshaller();
		unmarshaller.setSchema(schema);

		ConstraintsParameters constraints = (ConstraintsParameters) unmarshaller.unmarshal(new File("src/main/resources/policy/constraint.xml"));
		assertNotNull(constraints);

		return constraints;
	}
	
	
	public MultiValuesConstraint createMultiValueConstraint(Level level) {
		MultiValuesConstraint result = new MultiValuesConstraint();
		result.setLevel(level);
		return result;
	}
	
	public ValueConstraint createValueConstraint(Level level) {
		ValueConstraint result = new ValueConstraint();
		result.setLevel(level);
		return result;
	}
	
	public LevelConstraint createLevelConstraint(Level level) {
		LevelConstraint result = new LevelConstraint();
		result.setLevel(level);
		return result;
	}

}

@@ -295,16 +295,144 @@
 ctory;%0A%0A
+import eu.europa.esig.dss.validation.policy.EtsiValidationPolicy;%0Aimport eu.europa.esig.dss.validation.policy.ValidationPolicy;%0A
 import e
@@ -1361,19 +1361,139 @@
 nts;%0A%09%7D%0A
-%09
 %0A%09
+public ValidationPolicy getPolicy() throws Exception %7B%0A%09%09return new EtsiValidationPolicy(getConstraintsParameters());%0A%09%7D%0A
 %0A%09public
@@ -1657,34 +1657,33 @@
 turn result;%0A%09%7D%0A
-%09
 %0A
+
 %09public ValueCon
@@ -1823,17 +1823,16 @@
 ult;%0A%09%7D%0A
-%09
 %0A%09public

Fix compilation