11/* part of Pyrolite, by Irmen de Jong ([email protected] ) */ 22
33using System ;
4- using System . Collections . Generic ;
54using Razorvine . Pyro ;
65// ReSharper disable CheckNamespace
76
@@ -12,31 +11,30 @@ namespace Pyrolite.TestPyroNaming
1211/// Test Pyro with the Pyro name server.
1312/// </summary>
1413public static class TestNaming {
14+ private static readonly byte [ ] HmacKey = null ;
1515
16- static byte [ ] hmacKey = null ;
17-
18- public static void Main ( String [ ] args ) {
16+ public static void Main ( ) {
1917 try {
2018 Test ( ) ;
2119 } catch ( Exception x ) {
2220 Console . WriteLine ( "unhandled exception: {0}" , x ) ;
2321 }
2422 Console . WriteLine ( "\r \n Enter to exit:" ) ; Console . ReadLine ( ) ;
2523 }
26-
27- public static void Test ( ) {
24+
25+ private static void Test ( ) {
2826
2927 Console . WriteLine ( "Testing Pyro nameserver connection (make sure it's running with a broadcast server)..." ) ;
3028 Console . WriteLine ( "Pyrolite version: " + Config . PYROLITE_VERSION ) ;
3129
32- setConfig ( ) ;
30+ SetConfig ( ) ;
3331 // Config.SERIALIZER = Config.SerializerType.pickle;
3432
3533 Console . WriteLine ( "serializer used: {0}" , Config . SERIALIZER ) ;
3634 if ( Config . SERIALIZER == Config . SerializerType . serpent )
3735 Console . WriteLine ( "note that for the serpent serializer, you need to have the Razorvine.Serpent assembly available." ) ;
3836
39- using ( NameServerProxy ns = NameServerProxy . locateNS ( null , hmacKey : hmacKey ) )
37+ using ( NameServerProxy ns = NameServerProxy . locateNS ( null , hmacKey : HmacKey ) )
4038 {
4139 Console . WriteLine ( "discovered ns at " + ns . hostname + ":" + ns . port ) ;
4240 ns . ping ( ) ;
@@ -54,13 +52,13 @@ public static void Test() {
5452
5553
5654 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 ) ;
5856 foreach ( string key in objects . Keys ) {
5957 Console . WriteLine ( key + " --> " + objects [ key ] ) ;
6058 }
6159
6260 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 ) ;
6462 foreach ( string key in objectsm . Keys ) {
6563 var registration = objectsm [ key ] ;
6664 Console . WriteLine ( key + " --> " + registration . Item1 ) ;
@@ -94,12 +92,12 @@ public static void Test() {
9492
9593 using ( PyroProxy p = new PyroProxy ( ns . lookup ( "Pyro.NameServer" ) ) )
9694 {
97- p . pyroHmacKey = hmacKey ;
95+ p . pyroHmacKey = HmacKey ;
9896 p . call ( "ping" ) ;
9997 }
10098
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 ) ;
103101
104102 try {
105103 Console . WriteLine ( "uri=" + ns . lookup ( "dotnet.test" ) ) ; // should fail....
@@ -110,8 +108,8 @@ public static void Test() {
110108 }
111109
112110 }
113-
114- static void setConfig ( )
111+
112+ private static void SetConfig ( )
115113 {
116114 string tracedir = Environment . GetEnvironmentVariable ( "PYRO_TRACE_DIR" ) ;
117115 if ( tracedir != null ) {
0 commit comments