Free cookie consent management tool by TermsFeed Policy Generator

source: branches/thasling/DistributedGA/DistributedGA.Test/Form1.cs @ 16755

Last change on this file since 16755 was 13956, checked in by thasling, 8 years ago

#2615:
finally fixed bug concerning message send to the wrong peers
also made communicationRate and messageCacheCapacity as paramters
integration in P2PMigrationAnalyzer still TBD

File size: 2.6 KB
RevLine 
[13538]1using System;
2using System.Collections.Generic;
3using System.Windows.Forms;
4using DistributedGA.Core;
[13524]5using DistributedGA.Core.Domain;
6using DistributedGA.Core.Implementation;
7using DistributedGA.Core.Interface;
8
[13538]9namespace DistributedGA.Test {
10  public partial class Form1 : Form {
11    public Form1() {
12      InitializeComponent();
13    }
[13524]14
[13538]15    private void button1_Click(object sender, EventArgs e) {
16      IMessageService s = new WcfMessageService();
17      s.Init("");
18    }
[13524]19
[13538]20    private void button2_Click(object sender, EventArgs e) {
21      IMessageSender c = new WcfMessageSender();
[13956]22      //c.Init(null);
[13553]23      c.SendData(null, null);
[13538]24    }
[13524]25
[13538]26    private void button3_Click(object sender, EventArgs e) {
27      IMessageHandler h1 = new PeerNetworkMessageHandler();
[13956]28      //h1.Init("", "", "");
[13538]29      IMessageHandler h2 = new PeerNetworkMessageHandler();
[13956]30      //h2.Init("", "");
[13538]31      IMessageHandler h3 = new PeerNetworkMessageHandler();
[13956]32      //h3.Init("", "");
[13538]33      IMessageHandler h4 = new PeerNetworkMessageHandler();
[13956]34      //h4.Init("", "");
[13538]35      IMessageHandler h5 = new PeerNetworkMessageHandler();
[13956]36      //h5.Init("", "");
[13887]37      //byte[] message = CreateTestMessage();
38      //h1.PublishDataToNetwork(pop1);
39      //h1.PublishDataToNetwork(pop1);
40      //var res1 = h1.GetDataFromNetwork();
41      //var res2 = h2.GetDataFromNetwork();
42      //h1.PublishDataToNetwork(pop1);
43      //h1.PublishDataToNetwork(pop1);
44      //var res3 = h1.GetDataFromNetwork();
45      //var res4 = h2.GetDataFromNetwork();
46      //h1.PublishDataToNetwork(pop1);
47      //h1.PublishDataToNetwork(pop1);
[13553]48      var res5 = h1.GetDataFromNetwork();
49      var res6 = h2.GetDataFromNetwork();
[13538]50      int i = 0;
51    }
[13524]52
[13538]53    private void button4_Click(object sender, EventArgs e) {
54      var l = new WcfPeerListManager();
[13956]55      //l.Init(CreatePeerInfo(),"");
[13538]56      l.GetPeerList();
57    }
[13524]58
[13538]59    private void button5_Click(object sender, EventArgs e) {
60      Dictionary<string, int> d1 = new Dictionary<string, int>();
61      d1.Add("test", 5);
62      if (d1.ContainsKey("test")) {
63        int i = 0;
64      } else {
65        int j = 0;
66      }
67      Dictionary<PeerInfo, int> d2 = new Dictionary<PeerInfo, int>();
68      PeerInfo p1 = CreatePeerInfo();
69      PeerInfo p2 = CreatePeerInfo();
70      d2.Add(p1, 5);
71      if (d2.ContainsKey(p1)) {
72        int i = 0;
73      }
74      if (d2.ContainsKey(p2)) {
75        int i = 0;
76      }
77    }
[13524]78
[13538]79    private PeerInfo CreatePeerInfo() {
80      return new PeerInfo() { IpAddress = "192.168.0.4", Port = 3030 };
81    }
[13524]82
[13538]83  }
[13524]84}
Note: See TracBrowser for help on using the repository browser.