예제 #1
0
        public void SetUp()
        {
            adminService = new FakeAdminService(NetworkStoreType.Memory);
            adminService.Start();

            NetworkProfile      networkProfile = new NetworkProfile(new FakeServiceConnector(adminService));
            NetworkConfigSource netConfig      = new NetworkConfigSource();

            netConfig.AddNetworkNode(FakeServiceAddress.Local);
            networkProfile.Configuration = netConfig;
            networkProfile.StartService(FakeServiceAddress.Local, ServiceType.Manager);
            networkProfile.StartService(FakeServiceAddress.Local, ServiceType.Root);
            networkProfile.RegisterRoot(FakeServiceAddress.Local);
            networkProfile.StartService(FakeServiceAddress.Local, ServiceType.Block);
            networkProfile.RegisterBlock(FakeServiceAddress.Local);
            networkProfile.Refresh();

            networkProfile.AddPath(FakeServiceAddress.Local, PathName, PathTypeName);
            networkProfile.Refresh();

            HeapTokenStore    tokenStore    = new HeapTokenStore();
            HeapConsumerStore consumerStore = new HeapConsumerStore();

            consumerStore.Add(Consumer);

            provider                      = new FakeOAuthProvider();
            provider.TokenStore           = tokenStore;
            provider.ConsumerStore        = consumerStore;
            provider.TokenGenerator       = new GuidTokenGenerator();
            provider.RequestIdValidator   = new HeapRequestIdValidator(20);
            provider.VerificationProvider = new MD5HashVerificationProvider();

            authenticator = new OAuthAuthenticator();

            clientService = new RestPathClientService(new HttpServiceAddress(PathServiceAddress), FakeServiceAddress.Local,
                                                      new FakeServiceConnector(adminService));
            clientService.Authenticator = authenticator;
            clientService.Init();

            StartListner();
        }
예제 #2
0
        public void SetUp()
        {
            adminService = new FakeAdminService(NetworkStoreType.Memory);
            adminService.Start();

            NetworkProfile networkProfile = new NetworkProfile(new FakeServiceConnector(adminService));
            NetworkConfigSource netConfig = new NetworkConfigSource();
            netConfig.AddNetworkNode(FakeServiceAddress.Local);
            networkProfile.Configuration = netConfig;
            networkProfile.StartService(FakeServiceAddress.Local, ServiceType.Manager);
            networkProfile.StartService(FakeServiceAddress.Local, ServiceType.Root);
            networkProfile.RegisterRoot(FakeServiceAddress.Local);
            networkProfile.StartService(FakeServiceAddress.Local, ServiceType.Block);
            networkProfile.RegisterBlock(FakeServiceAddress.Local);
            networkProfile.Refresh();

            networkProfile.AddPath(FakeServiceAddress.Local, PathName, PathTypeName);
            networkProfile.Refresh();

            HeapTokenStore tokenStore = new HeapTokenStore();
            HeapConsumerStore consumerStore = new HeapConsumerStore();
            consumerStore.Add(Consumer);

            provider = new FakeOAuthProvider();
            provider.TokenStore = tokenStore;
            provider.ConsumerStore = consumerStore;
            provider.TokenGenerator = new GuidTokenGenerator();
            provider.RequestIdValidator = new HeapRequestIdValidator(20);
            provider.VerificationProvider = new MD5HashVerificationProvider();

            authenticator = new OAuthAuthenticator();

            clientService = new RestPathClientService(new HttpServiceAddress(PathServiceAddress), FakeServiceAddress.Local,
                                                      new FakeServiceConnector(adminService));
            clientService.Authenticator = authenticator;
            clientService.Init();

            StartListner();
        }