Package Util

Examples of Util.Log


    MessageProcessor processor = new MessageProcessor();
    Message addMessage = new Message();
    addMessage.setCommand("add");
    addMessage.setFileId("testfile.txt");
    addMessage.setFileContents(new File("testfile.txt"));
    processor.process(addMessage, new Log());
    File repositoryFile= new File("d:\\temp\\repository\\");
    assertTrue(repositoryFile.exists());
  }
View Full Code Here


    minStrategy = new MinimizeLatencyStrategy();
  }
 
  public void testGetNearestPeers() {
    myMap.get("peer3").setLatency(30);
    PeerHash nearestPeers = minStrategy.getNearestPeers(myMap, new Log());   
    assertTrue(nearestPeers.getHashtable().size() == 1);   
    assertTrue(nearestPeers.getHashtable().containsKey("peer3"));
    assertFalse(nearestPeers.getHashtable().containsKey("peer1"));
    assertFalse(nearestPeers.getHashtable().containsKey("peer2"));   
  }
View Full Code Here

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

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

      Thread.sleep(11000);
    } catch (InterruptedException e){
      System.out.println("Thread Interrupted Exception");
      e.printStackTrace();
    }
    robustStrategy.removeDeadNodes(myMap, new Log());
    assertTrue(myMap.getHashtable().size() == 0);
  }
View Full Code Here

    robustStrategy.removeDeadNodes(myMap, new Log());
    assertTrue(myMap.getHashtable().size() == 0);
  }

  public void testRemoveNoNodes() {
    robustStrategy.removeDeadNodes(myMap, new Log());
    assertTrue(myMap.getHashtable().size() == 2);
  }
View Full Code Here

    myMap.set(new Peer("key2",0,0));
    myMap.set(new Peer("key3",0,0));
  }

  public void testRemoveAllNodes() {
    dumb.removeDeadNodes(myMap, new Log());
    assertTrue(myMap.getHashtable().size() == 3);
  }
View Full Code Here

    dumb.removeDeadNodes(myMap, new Log());
    assertTrue(myMap.getHashtable().size() == 3);
  }
 
  public void testGetNearestPeers() {
    PeerHash nearestPeers = dumb.getNearestPeers(myMap, new Log());
    assertTrue(myMap.getHashtable().size() == 3);
    assertTrue(myMap.getHashtable().containsKey("key1"));
    assertTrue(myMap.getHashtable().containsKey("key2"));
    assertTrue(myMap.getHashtable().containsKey("key3"));
   
View Full Code Here

    Message testMessage = new Message();
    testMessage.setFileContents(file);
    testMessage.setCommand("add");
    testMessage.setFileId("testfile.txt");
   
    transmitter.send(testMessage, "UNIVERSI-F15A26",new Log());
  }
View Full Code Here

    myMap.set(peer4);
    minStrategy = new MinimizeStorageStrategy();
  }
 
  public void testGetNearestPeers() {
    PeerHash nearestPeers = minStrategy.getNearestPeers(myMap, new Log());
    assertTrue(nearestPeers.getHashtable().size() == 2);
    assertTrue(nearestPeers.getHashtable().containsKey("peer1"));
    assertTrue(nearestPeers.getHashtable().containsKey("peer3"));
    assertFalse(nearestPeers.getHashtable().containsKey("peer2"));
   
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.