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);
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"));
XorCompositeAssertion xorAssertion = new XorCompositeAssertion();
xorAssertion.addTerm(assertion1);
xorAssertion.addTerm(assertion2);
policy.addTerm(xorAssertion);
deployer.deployServerside(policy, null);
xorAssertion.remove(assertion2);
xorAssertion.addTerm(new PrimitiveAssertion(new QName("http://www.jboss.com/test/policy3","test3")));
deployer.deployServerside(policy, null);
xorAssertion.remove(assertion1);
xorAssertion.addTerm(new PrimitiveAssertion(new QName("http://www.jboss.com/test/policy4","test4")));
try
{
deployer.deployServerside(policy, null);
fail("deployServerSide shouldn't be able to deploy this policy (no alternative supported)!");
}