Esempio n. 1
0
        public async Task GetServerNodeAsyncTest()
        {
            string machineName  = Environment.MachineName;
            var    nodeReturned = await client.GetServerNodeAsync(machineName);

            var node = new ServerNode();

            Assert.IsNotNull(nodeReturned, "nodeReturned is null");
            Assert.IsTrue(node.Name == nodeReturned.Name);
            // Assert.IsTrue(node.ServerId == nodeReturned.ServerId); // generated GUIDs will always be different
            // Assert.IsTrue(node.Created == nodeReturned.Created); // will always be different
            Assert.IsTrue(node.UriHashRange == nodeReturned.UriHashRange);
            Assert.IsTrue(node.IsApproved == nodeReturned.IsApproved);
        }
Esempio n. 2
0
        static async Task GetOrCreateServerNode(FetchoConfiguration cfg)
        {
            if (cfg.FetchoWorkspaceServerBaseUri.Length == 0)
            {
                return;
            }

            var fetchoClient = new FetchoAPIV1Client(new Uri(cfg.FetchoWorkspaceServerBaseUri));

            cfg.CurrentServerNode = await fetchoClient.GetServerNodeAsync(Environment.MachineName);

            if (cfg.CurrentServerNode == null)
            {
                cfg.CurrentServerNode = await fetchoClient.CreateServerNodeAsync(new ServerNode());
            }
        }