Package util

Examples of util.Log


 
  public void testTwoValuesTheSame() {
    myMap.get("peer1").setNumberOfFiles(5);
    myMap.get("peer2").setNumberOfFiles(3);
    myMap.get("peer3").setNumberOfFiles(3);
    PeerHash nearestPeers = minStrategy.getNearestPeers(myMap, new Log());
    assertTrue(nearestPeers.getHashtable().size() == 2);
    assertTrue(nearestPeers.getHashtable().containsKey("peer2"));
    assertTrue(nearestPeers.getHashtable().containsKey("peer3"));
    assertFalse(nearestPeers.getHashtable().containsKey("peer1"));
  }
View Full Code Here


  public void testThreeValuesTheSame() {
    myMap.get("peer1").setNumberOfFiles(3);
    myMap.get("peer2").setNumberOfFiles(3);
    myMap.get("peer3").setNumberOfFiles(3);
   
    PeerHash nearestPeers = minStrategy.getNearestPeers(myMap, new Log());
    assertTrue(nearestPeers.getHashtable().size() == 2);
    assertFalse(nearestPeers.getHashtable().containsKey("peer4"));
    Iterator it = nearestPeers.getHashtable().keySet().iterator();
    while(it.hasNext()) {
      String key = (String) it.next();
View Full Code Here

  public void testChooser() throws Exception{
   
    PeerHash peers = new PeerHash();
   
    //No Nodes
    assertTrue(AutonomicStrategyChooser.chooseStrategy(peers,new Log()) instanceof RobustStrategy);
   
    //1 Nodes
    peers.set(new Peer("peer1",0,0));
    assertTrue(AutonomicStrategyChooser.chooseStrategy(peers,new Log()) instanceof RobustStrategy);
   
//    2 Nodes
    peers.set(new Peer("peer2",0,0));
    assertTrue(AutonomicStrategyChooser.chooseStrategy(peers,new Log()) instanceof RobustStrategy);
   
    //3 Nodes
    peers.set(new Peer("peer3",0,0));
    assertTrue(AutonomicStrategyChooser.chooseStrategy(peers,new Log()) instanceof RobustStrategy);
   
//    4 Nodes
    peers.set(new Peer("peer4",0,0));
    assertTrue(AutonomicStrategyChooser.chooseStrategy(peers,new Log()) instanceof MinimizeLatencyStrategy);
   
    //5 Nodes
    peers.set(new Peer("peer5",0,0));
    assertTrue(AutonomicStrategyChooser.chooseStrategy(peers,new Log()) instanceof MinimizeLatencyStrategy);
   
//    6 Nodes
    peers.set(new Peer("peer6",0,0));
    assertTrue(AutonomicStrategyChooser.chooseStrategy(peers,new Log()) instanceof MinimizeLatencyStrategy);
   
    //7 Nodes
    peers.set(new Peer("peer7",0,0));
    assertTrue(AutonomicStrategyChooser.chooseStrategy(peers,new Log()) instanceof MinimizeStorageStrategy);
   
//    8 Nodes
    peers.set(new Peer("peer8",0,0));
    assertTrue(AutonomicStrategyChooser.chooseStrategy(peers,new Log()) instanceof MinimizeStorageStrategy);
   
    //9 Nodes
    peers.set(new Peer("peer9",0,0));
    assertTrue(AutonomicStrategyChooser.chooseStrategy(peers,new Log()) instanceof MinimizeStorageStrategy);
   
//    10 Nodes
    peers.set(new Peer("peer10",0,0));
    assertTrue(AutonomicStrategyChooser.chooseStrategy(peers,new Log()) instanceof MinimizeStorageStrategy);
   
   
  }
View Full Code Here

TOP

Related Classes of util.Log

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.