Test.DhtOpTester.Test3 C# (CSharp) Méthode

Test3() public méthode

public Test3 ( int &op ) : void
op int
Résultat void
    public void Test3(ref int op) {
      Console.WriteLine("Test 3: Testing 1000 puts and 1 get with 1000 " +
          "results with the same key.");
      RNGCryptoServiceProvider rng = new RNGCryptoServiceProvider();
      byte[] key = new byte[10];
      byte[] value = new byte[value_size];
      rng.GetBytes(key);
      ArrayList al_results = new ArrayList();
      BlockingQueue[] results_queue = new BlockingQueue[60];

      for(int i = 0; i < 60; i++) {
        value = new byte[value_size];
        rng.GetBytes(value);
        al_results.Add(value);
        results_queue[i] = new BlockingQueue();
        default_dht.AsyncPut(key, value, 3000, results_queue[i]);
      }
      for (int i = 0; i < 60; i++) {
        try {
          bool res = (bool) results_queue[i].Dequeue();
          Console.WriteLine("success in put : " + i);
        }
        catch {
          Console.WriteLine("Failure in put : " + i);
        }
      }
      Console.WriteLine("Insertion done...");
      this.SerialAsyncGet(key, (byte[][]) al_results.ToArray(typeof(byte[])), op++);
      Thread.Sleep(5000);
      Console.WriteLine("This checks to make sure our follow up Puts succeeded");
      this.SerialAsyncGet(key, (byte[][]) al_results.ToArray(typeof(byte[])), op++);
      Console.WriteLine("If no error messages successful up to: " + (op - 1));
    }