Пример #1
0
  public void testDoesNotAssignPassiveLeafIfDisabled() throws Exception {
    ConnectionSettings.EVER_ACCEPTED_INCOMING.setValue(true);
    DHTSettings.ENABLE_PASSIVE_LEAF_DHT_MODE.setValue(false);
    long startTime =
        System.currentTimeMillis() - DHTSettings.MIN_PASSIVE_LEAF_DHT_INITIAL_UPTIME.getValue();
    PrivilegedAccessor.setValue(nodeAssigner, "startTime", new Long(startTime));

    mockery.checking(buildBandwdithExpectations(true));
    mockery.checking(
        buildDHTExpectations(
            DHTMode.INACTIVE,
            true,
            true,
            false, // can't receive unsolicited
            DHTSettings.MIN_PASSIVE_LEAF_DHT_AVERAGE_UPTIME.getValue() + 1,
            false,
            false));

    mockery.checking(
        new Expectations() {
          {
            never(dhtManager).start(with(Matchers.any(DHTMode.class)));
          }
        });

    assignerRunnable.run();
    mockery.assertIsSatisfied();
  }
Пример #2
0
 private void setSettings() throws Exception {
   FilterSettings.BLACK_LISTED_IP_ADDRESSES.set(new String[] {"*.*.*.*"});
   // Set the local host to not be banned so pushes can go through
   String ip = InetAddress.getLocalHost().getHostAddress();
   FilterSettings.WHITE_LISTED_IP_ADDRESSES.set(new String[] {ip, "127.*.*.*"});
   NetworkSettings.PORT.setValue(TEST_PORT);
   ConnectionSettings.CONNECT_ON_STARTUP.setValue(false);
   ConnectionSettings.LOCAL_IS_PRIVATE.setValue(false);
   // reset the node capabilities settings
   UltrapeerSettings.FORCE_ULTRAPEER_MODE.setValue(false);
   UltrapeerSettings.EVER_ULTRAPEER_CAPABLE.setValue(false);
   UltrapeerSettings.NEED_MIN_CONNECT_TIME.setValue(true);
   UltrapeerSettings.DISABLE_ULTRAPEER_MODE.setValue(false);
   DHTSettings.DISABLE_DHT_USER.setValue(false);
   DHTSettings.DISABLE_DHT_NETWORK.setValue(false);
   DHTSettings.EXCLUDE_ULTRAPEERS.setValue(true);
   DHTSettings.FORCE_DHT_CONNECT.setValue(false);
   DHTSettings.ENABLE_PASSIVE_DHT_MODE.setValue(true);
   DHTSettings.ENABLE_PASSIVE_LEAF_DHT_MODE.setValue(true);
 }