1
1
/* part of Pyrolite, by Irmen de Jong ([email protected] ) */
2
2
3
3
using System ;
4
- using System . Collections . Generic ;
5
4
using Razorvine . Pyro ;
6
5
// ReSharper disable CheckNamespace
7
6
@@ -12,31 +11,30 @@ namespace Pyrolite.TestPyroNaming
12
11
/// Test Pyro with the Pyro name server.
13
12
/// </summary>
14
13
public static class TestNaming {
14
+ private static readonly byte [ ] HmacKey = null ;
15
15
16
- static byte [ ] hmacKey = null ;
17
-
18
- public static void Main ( String [ ] args ) {
16
+ public static void Main ( ) {
19
17
try {
20
18
Test ( ) ;
21
19
} catch ( Exception x ) {
22
20
Console . WriteLine ( "unhandled exception: {0}" , x ) ;
23
21
}
24
22
Console . WriteLine ( "\r \n Enter to exit:" ) ; Console . ReadLine ( ) ;
25
23
}
26
-
27
- public static void Test ( ) {
24
+
25
+ private static void Test ( ) {
28
26
29
27
Console . WriteLine ( "Testing Pyro nameserver connection (make sure it's running with a broadcast server)..." ) ;
30
28
Console . WriteLine ( "Pyrolite version: " + Config . PYROLITE_VERSION ) ;
31
29
32
- setConfig ( ) ;
30
+ SetConfig ( ) ;
33
31
// Config.SERIALIZER = Config.SerializerType.pickle;
34
32
35
33
Console . WriteLine ( "serializer used: {0}" , Config . SERIALIZER ) ;
36
34
if ( Config . SERIALIZER == Config . SerializerType . serpent )
37
35
Console . WriteLine ( "note that for the serpent serializer, you need to have the Razorvine.Serpent assembly available." ) ;
38
36
39
- using ( NameServerProxy ns = NameServerProxy . locateNS ( null , hmacKey : hmacKey ) )
37
+ using ( NameServerProxy ns = NameServerProxy . locateNS ( null , hmacKey : HmacKey ) )
40
38
{
41
39
Console . WriteLine ( "discovered ns at " + ns . hostname + ":" + ns . port ) ;
42
40
ns . ping ( ) ;
@@ -54,13 +52,13 @@ public static void Test() {
54
52
55
53
56
54
Console . WriteLine ( "\n objects registered in the name server:" ) ;
57
- IDictionary < string , string > objects = ns . list ( null , null ) ;
55
+ var objects = ns . list ( null , null ) ;
58
56
foreach ( string key in objects . Keys ) {
59
57
Console . WriteLine ( key + " --> " + objects [ key ] ) ;
60
58
}
61
59
62
60
Console . WriteLine ( "\n objects registered in the name server, with metadata:" ) ;
63
- IDictionary < string , Tuple < string , ISet < string > > > objectsm = ns . list_with_meta ( null , null ) ;
61
+ var objectsm = ns . list_with_meta ( null , null ) ;
64
62
foreach ( string key in objectsm . Keys ) {
65
63
var registration = objectsm [ key ] ;
66
64
Console . WriteLine ( key + " --> " + registration . Item1 ) ;
@@ -94,12 +92,12 @@ public static void Test() {
94
92
95
93
using ( PyroProxy p = new PyroProxy ( ns . lookup ( "Pyro.NameServer" ) ) )
96
94
{
97
- p . pyroHmacKey = hmacKey ;
95
+ p . pyroHmacKey = HmacKey ;
98
96
p . call ( "ping" ) ;
99
97
}
100
98
101
- int num_removed = ns . remove ( null , "dotnet." , null ) ;
102
- Console . WriteLine ( "number of removed entries: {0}" , num_removed ) ;
99
+ int numRemoved = ns . remove ( null , "dotnet." , null ) ;
100
+ Console . WriteLine ( "number of removed entries: {0}" , numRemoved ) ;
103
101
104
102
try {
105
103
Console . WriteLine ( "uri=" + ns . lookup ( "dotnet.test" ) ) ; // should fail....
@@ -110,8 +108,8 @@ public static void Test() {
110
108
}
111
109
112
110
}
113
-
114
- static void setConfig ( )
111
+
112
+ private static void SetConfig ( )
115
113
{
116
114
string tracedir = Environment . GetEnvironmentVariable ( "PYRO_TRACE_DIR" ) ;
117
115
if ( tracedir != null ) {
0 commit comments