shouldBeEqual(mbp1, mbp2);
}
public void testMBeanPermissionImpliesOne() throws Exception
{
MBeanPermission implied = new MBeanPermission("mx4j.Foo#Bar[domain:k1=v1,k2=v2]", "invoke");
MBeanPermission all = new MBeanPermission("*", "*");
shouldImply(implied, implied);
shouldImply(new MBeanPermission("mx4j.Foo#Bar[domain:k2=v2,k1=v1]", "invoke"), implied);
shouldImply(new MBeanPermission("mx4j.Foo#Bar[domain:k1=v1,k2=v2]", "invoke,getAttribute"), implied);
shouldImply(new MBeanPermission("mx4j.Foo#Bar[domain:k1=v1,k2=v2]", "setAttribute,invoke"), implied);
shouldImply(new MBeanPermission("mx4j.Foo#Bar[domain:k1=v1,k2=v2]", "invoke,*"), implied);
shouldImply(new MBeanPermission("mx4j.Foo#Bar[domain:k1=v1,k2=v2]", "*"), implied);
shouldImply(new MBeanPermission("mx4j.Foo#Bar[domain:k1=v1,*]", "invoke"), implied);
shouldImply(new MBeanPermission("mx4j.Foo#Bar[domain:k2=v2,*]", "invoke"), implied);
shouldImply(new MBeanPermission("mx4j.Foo#Bar[domain:*]", "invoke"), implied);
shouldImply(new MBeanPermission("mx4j.Foo#Bar[dom?in:k1=v1,k2=v2]", "invoke"), implied);
shouldImply(new MBeanPermission("mx4j.Foo#Bar[do*in:k1=v1,k2=v2]", "invoke"), implied);
shouldImply(new MBeanPermission("mx4j.Foo#Bar[*:k1=v1,k2=v2]", "invoke"), implied);
shouldImply(new MBeanPermission("mx4j.Foo#Bar[*:*]", "invoke"), implied);
shouldImply(new MBeanPermission("mx4j.Foo#Bar", "invoke"), implied);
shouldImply(new MBeanPermission("mx4j.Foo#Bar*[domain:k1=v1,k2=v2]", "invoke"), implied);
shouldImply(new MBeanPermission("mx4j.Foo#B*[domain:k1=v1,k2=v2]", "invoke"), implied);
shouldImply(new MBeanPermission("mx4j.Foo#*[domain:k1=v1,k2=v2]", "invoke"), implied);
shouldImply(new MBeanPermission("mx4j.Foo[domain:k1=v1,k2=v2]", "invoke"), implied);
shouldImply(new MBeanPermission("mx4j.Foo#Bar*", "invoke"), implied);
shouldImply(new MBeanPermission("mx4j.Foo#B*", "invoke"), implied);
shouldImply(new MBeanPermission("mx4j.Foo#*", "invoke"), implied);
shouldImply(new MBeanPermission("mx4j.Foo", "invoke"), implied);
shouldImply(new MBeanPermission("mx4j.Foo*#Bar[domain:k1=v1,k2=v2]", "invoke"), implied);
shouldImply(new MBeanPermission("mx4j.*#Bar[domain:k1=v1,k2=v2]", "invoke"), implied);
shouldImply(new MBeanPermission("*#Bar[domain:k1=v1,k2=v2]", "invoke"), implied);
shouldImply(new MBeanPermission("#Bar[domain:k1=v1,k2=v2]", "invoke"), implied);
shouldImply(new MBeanPermission("mx4j.*#Bar", "invoke"), implied);
shouldImply(new MBeanPermission("*#Bar", "invoke"), implied);
shouldImply(new MBeanPermission("#Bar", "invoke"), implied);
shouldImply(new MBeanPermission("mx4j.*", "invoke"), implied);
shouldImply(new MBeanPermission("*", "invoke"), implied);
shouldImply(new MBeanPermission("mx4j.Foo*#*[domain:k1=v1,k2=v2]", "invoke"), implied);
shouldImply(new MBeanPermission("[domain:k1=v1,k2=v2]", "invoke"), implied);
shouldImply(all, implied);
shouldImply(new MBeanPermission("[]", "*"), all);
shouldImply(implied, new MBeanPermission(null, null, null, "invoke"));
}