{
Map<String,Class> map = new HashMap<String,Class>();
map.put("http://www.jboss.com/test/policy", NopAssertionDeployer.class);
map.put("http://www.jboss.com/test/policy2", NopAssertionDeployer.class);
map.put("http://www.jboss.com/test/policy3", NopAssertionDeployer.class);
PolicyDeployer deployer = PolicyDeployer.newInstance(map);
Policy policy = new Policy("myID");
PrimitiveAssertion assertion1 = new PrimitiveAssertion(new QName("http://www.jboss.com/test/policy","test"));
PrimitiveAssertion assertion2 = new PrimitiveAssertion(new QName("http://www.jboss.com/test/policy2","test2"));
PrimitiveAssertion assertion3 = new PrimitiveAssertion(new QName("http://www.jboss.com/test/policy3","test3"));
PrimitiveAssertion assertion4 = new PrimitiveAssertion(new QName("http://www.jboss.com/test/policy4","test4"));
AndCompositeAssertion andAssertion1 = new AndCompositeAssertion();
andAssertion1.addTerm(assertion1);
andAssertion1.addTerm(assertion2);
AndCompositeAssertion andAssertion2 = new AndCompositeAssertion();
andAssertion2.addTerm(assertion3);
andAssertion2.addTerm(assertion4);
XorCompositeAssertion xorAssertion = new XorCompositeAssertion();
xorAssertion.addTerm(andAssertion1);
xorAssertion.addTerm(andAssertion2);
policy.addTerm(xorAssertion);
deployer.deployServerside(policy, null);
xorAssertion.remove(andAssertion1);
try
{
deployer.deployServerside(policy, null);
fail("deployServerSide shouldn't be able to deploy this policy (no alternative supported)!");
}
catch (UnsupportedPolicy up)
{
//OK