Package util

Source Code of util.IDGeneratorTest

/************************************************************************
* Copyright (C) 2010-2011  Ben Tagger                                  *
* All rights reserved.                                                 *
*                                                                      *
* This program is free software; you can redistribute it and/or        *
* modify it under the terms of the GNU General Public License version  *
* 2 as published by the Free Software Foundation.                      *
*                                                                      *
* Alternatively, this software may be distributed under the terms of   *
* the BSD license.                                                     *
*                                                                      *
* See LICENSE and COPYING for more details.                            *
************************************************************************/

package util;

import java.io.UnsupportedEncodingException;
import java.security.NoSuchAlgorithmException;

import org.apache.commons.codec.DecoderException;

import util.IDGenerator;
import util.IDGenerator.IDStrategy;

public class IDGeneratorTest {

  public static void Test1() throws DecoderException, NoSuchAlgorithmException, UnsupportedEncodingException{
    IDGenerator generator = new IDGenerator();
    System.out.println(generator.getNextID(null, IDStrategy.SEQUENTIAL));
    System.out.println(generator.getNextID(null, IDStrategy.SEQUENTIAL));
    System.out.println(generator.getNextID(null, IDStrategy.SEQUENTIAL));
    System.out.println(generator.getNextID(null, IDStrategy.SEQUENTIAL));
    System.out.println(generator.getNextID(null, IDStrategy.SEQUENTIAL));
    System.out.println(generator.getNextID(null, IDStrategy.SEQUENTIAL));
  }
 
 
  public static void Test2() throws DecoderException, NoSuchAlgorithmException, UnsupportedEncodingException{
    IDGenerator generator = new IDGenerator();
    System.out.println(generator.getNextID("ben", IDStrategy.RANDOM));
    System.out.println(generator.getNextID("alice", IDStrategy.RANDOM));
    System.out.println(generator.getNextID("bob", IDStrategy.RANDOM));
    System.out.println(generator.getNextID("dirk", IDStrategy.RANDOM));
    System.out.println(generator.getNextID("george", IDStrategy.RANDOM));
    System.out.println(generator.getNextID("jimmy", IDStrategy.RANDOM));
  }
 
  public static void main(String [] args) throws DecoderException, NoSuchAlgorithmException, UnsupportedEncodingException{
//    Test1();
    Test2();
  }
}
TOP

Related Classes of util.IDGeneratorTest

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.