public static void SetupClient(TestContext context) { try { hfclient = TestHFClient.Create(); peer = hfclient.NewPeer(PEER_NAME, "grpc://localhost:7051"); } catch (System.Exception e) { Assert.Fail($"Unexpected Exception {e.Message}"); } }
public static void SetupClient(TestContext context) { try { TestUtils.TestUtils.ResetConfig(); hfclient = TestHFClient.Create(); } catch (System.Exception e) { Assert.Fail($"Unexpected Exception {e.Message}"); } }
public void TestNewChannel() { // Should be able to instantiate a new instance of "Channel" with the definition in the network configuration' JObject jsonConfig = GetJsonConfig(1, 0, 1); NetworkConfig config = NetworkConfig.FromJsonObject(jsonConfig); HFClient client = HFClient.Create(); TestHFClient.SetupClient(client); Channel channel = client.LoadChannelFromConfig(CHANNEL_NAME, config); Assert.IsNotNull(channel); Assert.AreEqual(CHANNEL_NAME, channel.Name); Assert.AreEqual(channel.GetPeers(PeerRole.SERVICE_DISCOVERY).Count, 1); }
public static void SetupClient(TestContext context) { try { hfclient = TestHFClient.Create(); shutdownChannel = new Channel("shutdown", hfclient); shutdownChannel.AddOrderer(hfclient.NewOrderer("shutdow_orderer", "grpc://localhost:99")); shutdownChannel.IsShutdown = true; throwOrderer = new ThrowOrderer("foo", "grpc://localhost:8", null); throwChannel = new Channel("throw", hfclient); throwChannel.AddOrderer(throwOrderer); } catch (System.Exception e) { Assert.Fail($"Unexpected Exception {e.Message}"); } }
public void TestGetChannelNoPeers() { // Should not be able to instantiate a new instance of "Channel" with no peers configured JObject jsonConfig = GetJsonConfig(1, 1, 0); NetworkConfig config = NetworkConfig.FromJsonObject(jsonConfig); HFClient client = HFClient.Create(); TestHFClient.SetupClient(client); client.LoadChannelFromConfig(CHANNEL_NAME, config); //HFClient client = HFClient.loadFromConfig(jsonConfig); //TestHFClient.setupClient(client); //client.getChannel(CHANNEL_NAME); }
public void TestGetChannel() { // Should be able to instantiate a new instance of "Channel" with orderer, org and peer defined in the network configuration JObject jsonConfig = GetJsonConfig(4, 1, 1); NetworkConfig config = NetworkConfig.FromJsonObject(jsonConfig); HFClient client = HFClient.Create(); TestHFClient.SetupClient(client); Channel channel = client.LoadChannelFromConfig(CHANNEL_NAME, config); //HFClient client = HFClient.loadFromConfig(jsonConfig); //TestHFClient.setupClient(client); //Channel channel = client.getChannel(CHANNEL_NAME); Assert.IsNotNull(channel); Assert.AreEqual(CHANNEL_NAME, channel.Name); IReadOnlyList <Orderer> orderers = channel.Orderers; Assert.IsNotNull(orderers); Assert.AreEqual(1, orderers.Count); Orderer orderer = orderers.First(); Assert.AreEqual("orderer1.example.com", orderer.Name); IReadOnlyList <Peer> peers = channel.Peers; Assert.IsNotNull(peers); Assert.AreEqual(1, peers.Count); Peer peer = peers.First(); Assert.AreEqual("peer0.org1.example.com", peer.Name); }
public void SetupClient() { hfclient = TestHFClient.Create(); orderer = hfclient.NewOrderer(ORDERER_NAME, "grpc://localhost:5151"); }