Package org.apache.hadoop.security

Examples of org.apache.hadoop.security.TokenStorage.readFields()


      URLConnection connection = remoteURL.openConnection();
     
      InputStream in = connection.getInputStream();
      TokenStorage ts = new TokenStorage();
      dis = new DataInputStream(in);
      ts.readFields(dis);
      file = new DataOutputStream(new FileOutputStream(filename));
      ts.write(file);
      file.flush();
      System.out.println("Successfully wrote token of " + file.size()
          + " bytes  to " + filename);
View Full Code Here


   
    // now read the data back in and verify correct values
    TokenStorage ts = new TokenStorage();
    DataInputStream dis =
      new DataInputStream(new ByteArrayInputStream(baos.toByteArray()));
    ts.readFields(dis);
    Token<? extends TokenIdentifier> newToken = ts.getToken(new Text(SHORT_NAME));
   
    assertEquals("Should only be one token in storage", ts.numberOfTokens(), 1);
    assertEquals("Service value should have survived",
        "127.0.0.1:2005", newToken.getService().toString());
View Full Code Here

   
    // open and read it back
    DataInputStream dis =
      new DataInputStream(new FileInputStream(tmpFileName));   
    ts = new TokenStorage();
    ts.readFields(dis);
    dis.close();
   
    // get the tokens and compare the services
    Collection<Token<? extends TokenIdentifier>> list = ts.getAllTokens();
    assertEquals("getAllTokens should return collection of size 2",
View Full Code Here

    Path localJobTokenFile = new Path (jobTokenFile);
    FileSystem localFS = FileSystem.getLocal(conf);
    FSDataInputStream in = localFS.open(localJobTokenFile);
   
    TokenStorage ts = new TokenStorage();
    ts.readFields(in);

    if(LOG.isDebugEnabled()) {
      LOG.debug("Task: Loaded jobTokenFile from: "+localJobTokenFile.toUri().getPath()
        +"; num of sec keys  = " + ts.numberOfSecretKeys());
    }
View Full Code Here

TOP
Copyright © 2018 www.massapi.com. 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.