Free cookie consent management tool by TermsFeed Policy Generator

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

Last change on this file since 18007 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
Line 
1using System;
2using System.Collections.Generic;
3using System.Windows.Forms;
4using DistributedGA.Core;
5using DistributedGA.Core.Domain;
6using DistributedGA.Core.Implementation;
7using DistributedGA.Core.Interface;
8
9namespace DistributedGA.Test {
10  public partial class Form1 : Form {
11    public Form1() {
12      InitializeComponent();
13    }
14
15    private void button1_Click(object sender, EventArgs e) {
16      IMessageService s = new WcfMessageService();
17      s.Init("");
18    }
19
20    private void button2_Click(object sender, EventArgs e) {
21      IMessageSender c = new WcfMessageSender();
22      //c.Init(null);
23      c.SendData(null, null);
24    }
25
26    private void button3_Click(object sender, EventArgs e) {
27      IMessageHandler h1 = new PeerNetworkMessageHandler();
28      //h1.Init("", "", "");
29      IMessageHandler h2 = new PeerNetworkMessageHandler();
30      //h2.Init("", "");
31      IMessageHandler h3 = new PeerNetworkMessageHandler();
32      //h3.Init("", "");
33      IMessageHandler h4 = new PeerNetworkMessageHandler();
34      //h4.Init("", "");
35      IMessageHandler h5 = new PeerNetworkMessageHandler();
36      //h5.Init("", "");
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);
48      var res5 = h1.GetDataFromNetwork();
49      var res6 = h2.GetDataFromNetwork();
50      int i = 0;
51    }
52
53    private void button4_Click(object sender, EventArgs e) {
54      var l = new WcfPeerListManager();
55      //l.Init(CreatePeerInfo(),"");
56      l.GetPeerList();
57    }
58
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    }
78
79    private PeerInfo CreatePeerInfo() {
80      return new PeerInfo() { IpAddress = "192.168.0.4", Port = 3030 };
81    }
82
83  }
84}
Note: See TracBrowser for help on using the repository browser.