Package org.apache.accumulo.core.client.security.tokens

Examples of org.apache.accumulo.core.client.security.tokens.NullToken


   
    byte[] serialized = AuthenticationTokenSerializer.serialize(new PasswordToken(randomBytes));
    PasswordToken passwordToken = AuthenticationTokenSerializer.deserialize(PasswordToken.class, serialized);
    assertArrayEquals(randomBytes, passwordToken.getPassword());
   
    serialized = AuthenticationTokenSerializer.serialize(new NullToken());
    AuthenticationToken nullToken = AuthenticationTokenSerializer.deserialize(NullToken.class, serialized);
    assertEquals(new NullToken(), nullToken);
  }
View Full Code Here


  }
 
  @Test
  public void testEqualsAndHashCode() {
    Credentials nullNullCreds = new Credentials(null, null);
    Credentials abcNullCreds = new Credentials("abc", new NullToken());
    Credentials cbaNullCreds = new Credentials("cba", new NullToken());
    Credentials abcBlahCreds = new Credentials("abc", new PasswordToken("blah"));
   
    // check hash codes
    assertEquals(0, nullNullCreds.hashCode());
    assertEquals("abc".hashCode(), abcNullCreds.hashCode());
    assertEquals(abcNullCreds.hashCode(), abcBlahCreds.hashCode());
    assertFalse(abcNullCreds.hashCode() == cbaNullCreds.hashCode());
   
    // identity
    assertEquals(abcNullCreds, abcNullCreds);
    assertEquals(new Credentials("abc", new NullToken()), abcNullCreds);
    // equal, but different token constructors
    assertEquals(new Credentials("abc", new PasswordToken("abc".getBytes(Constants.UTF8))), new Credentials("abc", new PasswordToken("abc")));
    // test not equals
    assertFalse(nullNullCreds.equals(abcBlahCreds));
    assertFalse(nullNullCreds.equals(abcNullCreds));
View Full Code Here

 
  @Test
  public void testToString() {
    Credentials creds = new Credentials(null, null);
    assertEquals(Credentials.class.getName() + ":null:null:<hidden>", creds.toString());
    creds = new Credentials("", new NullToken());
    assertEquals(Credentials.class.getName() + "::" + NullToken.class.getName() + ":<hidden>", creds.toString());
    creds = new Credentials("abc", null);
    assertEquals(Credentials.class.getName() + ":abc:null:<hidden>", creds.toString());
    creds = new Credentials("abc", new PasswordToken(""));
    assertEquals(Credentials.class.getName() + ":abc:" + PasswordToken.class.getName() + ":<hidden>", creds.toString());
View Full Code Here

  String username;
  private final MockAccumulo acu;
  private final Instance instance;
 
  MockConnector(String username, MockInstance instance) throws AccumuloSecurityException {
    this(new Credentials(username, new NullToken()), new MockAccumulo(MockInstance.getDefaultFileSystem()), instance);
  }
View Full Code Here

TOP

Related Classes of org.apache.accumulo.core.client.security.tokens.NullToken

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.