byte[] expected = new byte[] { 4,1,0,11,6,9,42,-122,72,-122,-9,18,1,2,2,0,0,0,17,115,101,114,118,105,99,101,47,108,111,99,97,108,104,111,115,116 };
assertTrue(Arrays.equals(expected, exported));
}
public void testEquals() throws Exception{
KerberosName one = new KerberosName("service@localhost", GSSName.NT_HOSTBASED_SERVICE);
KerberosName another = new KerberosName("service@localhost", GSSName.NT_HOSTBASED_SERVICE);
assertEquals(one, another);
one = new KerberosName("service@localhost", GSSName.NT_HOSTBASED_SERVICE);
another = new KerberosName("service/localhost", GSSName.NT_HOSTBASED_SERVICE);
assertEquals(one, another);
one = new KerberosName("service@localhost", GSSName.NT_USER_NAME);
another = new KerberosName("service@localhost", GSSName.NT_USER_NAME);
assertEquals(one, another);
one = new KerberosName("service@localhost", GSSName.NT_USER_NAME);
another = new KerberosName("service/localhost", GSSName.NT_USER_NAME);
assertFalse(one.equals(another));
final Oid KRB5_PRINCIPAL_NAMETYPE = new Oid("1.2.840.113554.1.2.2.1");
one = new KerberosName("service@localhost", KRB5_PRINCIPAL_NAMETYPE);
another = new KerberosName("service@localhost", KRB5_PRINCIPAL_NAMETYPE);
assertEquals(one, another);
one = new KerberosName("service@localhost", KRB5_PRINCIPAL_NAMETYPE);
another = new KerberosName("service/localhost",KRB5_PRINCIPAL_NAMETYPE);
assertFalse(one.equals(another));
one = new KerberosName("service@localhost", KRB5_PRINCIPAL_NAMETYPE);
another = new KerberosName("service@localhost", GSSName.NT_USER_NAME);
assertEquals(one,another);
one = new KerberosName("service@localhost", KRB5_PRINCIPAL_NAMETYPE);
another = new KerberosName("service@localhost", GSSName.NT_HOSTBASED_SERVICE);
assertFalse(one.equals(another));
one = new KerberosName("service/localhost", KRB5_PRINCIPAL_NAMETYPE);
another = new KerberosName("service@localhost", GSSName.NT_HOSTBASED_SERVICE);
assertEquals(one,another);
one = new KerberosName("service@localhost", GSSName.NT_USER_NAME);
another = new KerberosName("service@localhost", GSSName.NT_HOSTBASED_SERVICE);
assertFalse(one.equals(another));
one = new KerberosName("service/localhost", GSSName.NT_USER_NAME);
another = new KerberosName("service@localhost", GSSName.NT_HOSTBASED_SERVICE);
assertFalse(one.equals(another));
}