public void LoadConfigTest() { SymConfigLoader symConfigLoader = new SymConfigLoader(); SymConfig symConfigPoco = symConfigLoader.loadFromFile("C:/Users/Michael/Documents/Visual Studio 2017/Projects/apiClientDotNet/apiClientDotNetTest/Resources/testConfig.json"); Assert.IsTrue(symConfigPoco.sessionAuthHost == "preview.symphony.com"); }
private void SendMessageAsync() { var task = new Task(() => { var symConfigLoader = new SymConfigLoader(); var configPathTwo = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Resources", "testConfigPsdevTwo.json"); var symConfigTwo = symConfigLoader.loadFromFile(configPathTwo); var botAuthTwo = new SymBotRSAAuth(symConfigTwo); botAuthTwo.authenticate(); var botClientTwo = SymBotClient.initBot(symConfigTwo, botAuthTwo); // Find one BOT stream id var streamClient = botClientTwo.getStreamsClient(); var streamTypes = new List <string> { "ROOM" }; var result = streamClient.getUserStreams(streamTypes, false); // Send to that stream a messages var message = new OutboundMessage { message = "<messageML>Hello world! From .NET SDK Integration Test.</messageML>" }; var stream = new apiClientDotNet.Models.Stream { streamId = result[0].id }; var messageClient = new MessageClient(botClientTwo); messageClient.sendMessage(stream.streamId, message, false); }, TaskCreationOptions.AttachedToParent); task.Start(); }
public static void Setup(TestContext conext) { var symConfigLoader = new SymConfigLoader(); var configPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Resources", "config.json"); symConfig = symConfigLoader.loadFromFile(configPath); }
public void OBOAuth() { SymConfig symConfig = new SymConfig(); SymConfigLoader symConfigLoader = new SymConfigLoader(); symConfig = symConfigLoader.loadFromFile("C:/Users/Michael/Documents/Visual Studio 2017/Projects/apiClientDotNet/apiClientDotNetTest/Resources/testConfig3.json"); SymOBOAuth oboAuth = new SymOBOAuth(symConfig); oboAuth.sessionAppAuthenticate(); SymOBOUserAuth auth = oboAuth.getUserAuth("*****@*****.**"); // auth.setSessionToken("eyJhbGciOiJSUzUxMiJ9.eyJzdWIiOiJzdGlzaGxlciIsImlzcyI6InN5bXBob255IiwiYXBwUGVybWlzc2lvbnMiOlsiQUNUX0FTX1VTRVIiLCJHRVRfQkFTSUNfQ09OVEFDVF9JTkZPIiwiR0VUX1BSRVNFTkNFIiwiTElTVF9VU0VSX1NUUkVBTVMiLCJNQU5BR0VfUk9PTVMiLCJTRU5EX01FU1NBR0VTIl0sImFwcEdyb3VwSWQiOiJhZG55LXcxNDYiLCJzZXNzaW9uSWQiOiJiNGI3N2NjMWUyYzg4ODAxMWNmNWI3MWI5YmQwYTZhNjJlNDI0MTMzMzJlMGRkNDk1NWQzYzk3ZjViNjE4MWMyNWE2MTVmYThkMjNmNjM2YmNmNDJiNTMxOGI4ZDlkNDgwMDAwMDE2NjhjZTIyOGNjMDAwMDUyYjAwMDAwMDAxOSIsInVzZXJJZCI6IjkwOTE1ODY3NzIxNzUzIn0.hSsZOBEH-OlUzOjDl_NhoxVTrlbJSEaxnmV0s5VQO92VgYaTBc0eUbcHaCYzmRtafil8dy_4_pOSMSR9VupDayklL9igT2cRHZGKvryR4_2hNDym3Xs-uYCxC83O1l9CTm2ISrSVgVabzVOznN23sZLQ6IoIj2EORS6B8eemGlGTWjZge1iav464kFosQ5glSDSecY4mTcbh4sYE3mwINlCEML5VqpEbc0Pdu1ZOesLMBHsa3KzlGuIUEjtigP4NZeYPc31G-rzxSKHWeMo3Mqwwk_0dSL6voQgw-29fly0uIGTF7wCSngk3g9n4Lv_0m4Yh5xDcyQ0h4RRxny-Sgg"); // symConfig.agentHost = "alphadyne.symphony.com"; SymOBOClient client = SymOBOClient.initOBOClient(symConfig, auth); OutboundMessage message = new OutboundMessage(); message.message = "<messageML>Hello it is mike fron NET 2</messageML>"; apiClientDotNet.Models.Stream stream = new apiClientDotNet.Models.Stream(); stream.streamId = "IzgD3nNbpoaNJ6_To7Ds0n___pmCBYMrdA"; //stream.streamId = "AQpEsS9DJM1ZRrGF7Kb7i3___pui0wKcdA"; MessageClient messageClient = new MessageClient(client); InboundMessage resp = messageClient.sendMessage(stream.streamId, message, false); Assert.IsTrue(resp.message != null); }
public void GetUserIDFromUserNameTest() { SymConfig symConfig = new SymConfig(); SymConfigLoader symConfigLoader = new SymConfigLoader(); symConfig = symConfigLoader.loadFromFile("C:/Users/Michael/Documents/Visual Studio 2017/Projects/apiClientDotNet/apiClientDotNetTest/Resources/testConfig.json"); SymBotAuth botAuth = new SymBotAuth(symConfig); botAuth.authenticate(); SymBotClient botClient = SymBotClient.initBot(symConfig, botAuth); UserClient userClient = botClient.getUsersClient(); UserInfo user = userClient.getUserFromUsername("mikepreview"); StreamClient streamClient = botClient.getStreamsClient(); RoomSearchQuery roomSearchQuery = new RoomSearchQuery(); roomSearchQuery.query = "APITestRoom"; roomSearchQuery.active = true; roomSearchQuery.isPrivate = true; NumericId id = new NumericId(); id.id = user.id; roomSearchQuery.member = id; RoomSearchResult result = streamClient.searchRooms(roomSearchQuery, 0, 0); Assert.IsTrue(user != null); }
public void MessageRoomTest() { SymConfig symConfig = new SymConfig(); SymConfigLoader symConfigLoader = new SymConfigLoader(); symConfig = symConfigLoader.loadFromFile("C:/Users/Michael/Documents/Visual Studio 2017/Projects/apiClientDotNet/apiClientDotNetTest/Resources/testConfig.json"); SymBotAuth botAuth = new SymBotAuth(symConfig); botAuth.authenticate(); SymBotClient botClient = SymBotClient.initBot(symConfig, botAuth); OutboundMessage message = new OutboundMessage(); message.message = "<messageML>Hello world!</messageML>"; FileStream fileStream = File.OpenRead("C:/Users/Michael/Documents/Visual Studio 2017/Projects/apiClientDotNet/apiClientDotNetTest/Resources/AttachmentTest.txt"); List <FileStream> attachments = new List <FileStream>(); attachments.Add(fileStream); message.attachments = attachments; apiClientDotNet.Models.Stream stream = new apiClientDotNet.Models.Stream(); stream.streamId = "fu1cJFoklnYlR9vu1AOZ5X___pzXDKPXdA"; MessageClient messageClient = new MessageClient(botClient); InboundMessage resp = messageClient.sendMessage(stream.streamId, message, false); Assert.IsTrue(resp.messageId != null); }
public void OBOLogoutTest() { SymConfig symConfig = new SymConfig(); SymConfigLoader symConfigLoader = new SymConfigLoader(); symConfig = symConfigLoader.loadFromFile("C:/Users/Michael/Documents/Visual Studio 2017/Projects/apiClientDotNet/apiClientDotNetTest/Resources/testConfig3.json"); SymOBOAuth oboAuth = new SymOBOAuth(symConfig); oboAuth.sessionAppAuthenticate(); SymOBOUserAuth auth = oboAuth.getUserAuth("*****@*****.**"); SymOBOClient client = SymOBOClient.initOBOClient(symConfig, auth); OutboundMessage message = new OutboundMessage(); message.message = "<messageML>Hello Alexa</messageML>"; apiClientDotNet.Models.Stream stream = new apiClientDotNet.Models.Stream(); stream.streamId = "IzgD3nNbpoaNJ6_To7Ds0n___pmCBYMrdA"; MessageClient messageClient = new MessageClient(client); InboundMessage resp = messageClient.sendMessage(stream.streamId, message, false); auth.logout(); //Assert.IsTrue(resp.message != null); }
public void SessionAuthenticateTest() { SymConfigLoader symConfigLoader = new SymConfigLoader(); //symConfig = symConfigLoader.loadFromFile("C:/Users/Michael/Documents/Visual Studio 2017/Projects/apiClientDotNet/apiClientDotNetTest/Resources/testConfig.json"); //SymBotAuth symBotAuth = new SymBotAuth(); //AuthTokens authTokens = symBotAuth.authenticate(symConfig); //Assert.IsTrue(authTokens.sessionToken != null && authTokens.keyManagerToken != null); }
public void RSAAuthTest() { SymConfigLoader symConfigLoader = new SymConfigLoader(); symConfig = symConfigLoader.loadFromFile("C:/Users/Michael/Documents/Visual Studio 2017/Projects/apiClientDotNet/apiClientDotNetTest/Resources/testConfig.json"); JWTHandler jwtHandler = new JWTHandler(); jwtHandler.generateJWT(symConfig); }
public void ForGivenRsaConfig_CanReadConfigAndCreateJwt() { var symConfigLoader = new SymConfigLoader(); var configPath = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Resources", "config.json"); var symConfig = symConfigLoader.loadFromFile(configPath); var jwtHandler = new JWTHandler(); var jwt = jwtHandler.generateJWT(symConfig); Assert.IsNotNull(jwt); }
public void ForGivenConfigFile_CorrectlyLoadsTheConfigurationProperties() { var symConfigLoader = new SymConfigLoader(); var configPath = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Resources", "config.json"); var symConfig = symConfigLoader.loadFromFile(configPath); Assert.IsNotNull(symConfig); Assert.IsNotNull(symConfig.agentHost); Assert.IsNotNull(symConfig.keyAuthHost); Assert.IsNotNull(symConfig.podHost); Assert.IsNotNull(symConfig.botEmailAddress); Assert.IsNotNull(symConfig.botPrivateKeyName); Assert.IsNotNull(symConfig.botUsername); }
public void ForGivenRsaConfig_CanAuthenticateAndCreateDataFeed() { var symConfig = new SymConfig(); var symConfigLoader = new SymConfigLoader(); var configPath = System.IO.Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Resources", "config.json"); symConfig = symConfigLoader.loadFromFile(configPath); var botAuth = new SymBotRSAAuth(symConfig); botAuth.authenticate(); var botClient = SymBotClient.initBot(symConfig, botAuth); DatafeedEventsService datafeedEventsService = botClient.getDatafeedEventsService(); Assert.IsNotNull(datafeedEventsService.datafeedId); }
static void Main(string[] args) { SymConfig symConfig = new SymConfigLoader().loadFromFile("config.json"); SymBotRSAAuth botAuth = new SymBotRSAAuth(symConfig); botAuth.authenticate(); SymBotClient botClient = SymBotClient.initBot(symConfig, botAuth); // start listening for messages DatafeedEventsService dataFeedService = botClient.getDatafeedEventsService(); BotLogic listener = new BotLogic(botClient); dataFeedService.addIMListener(listener); dataFeedService.getEventsFromDatafeed(); }
public void DatafeedCreateTest() { SymConfig symConfig = new SymConfig(); SymConfigLoader symConfigLoader = new SymConfigLoader(); symConfig = symConfigLoader.loadFromFile("C:/Users/Michael/Documents/Visual Studio 2017/Projects/apiClientDotNet/apiClientDotNetTest/Resources/testConfig.json"); apiClientDotNet.Authentication.SymBotAuth botAuth = new apiClientDotNet.Authentication.SymBotAuth(symConfig); botAuth.authenticate(); SymBotClient botClient = SymBotClient.initBot(symConfig, botAuth); DatafeedEventsService datafeedEventsService = botClient.getDatafeedEventsService(); //datafeedEventsService.getEventsFromDatafeed(); //Assert.IsTrue(datafeedEventsService.datafeedId != null); }
public void OBOUserLookUpTest() { SymConfig symConfig = new SymConfig(); SymConfigLoader symConfigLoader = new SymConfigLoader(); symConfig = symConfigLoader.loadFromFile("C:/Users/Michael/Documents/Visual Studio 2017/Projects/apiClientDotNet/apiClientDotNetTest/Resources/testConfig3.json"); SymOBOAuth oboAuth = new SymOBOAuth(symConfig); oboAuth.sessionAppAuthenticate(); SymOBOUserAuth auth = oboAuth.getUserAuth("*****@*****.**"); SymOBOClient client = SymOBOClient.initOBOClient(symConfig, auth); UserClient userClient = client.getUsersClient(); UserInfo user = userClient.getUserFromUsername("*****@*****.**"); Assert.IsTrue(user != null); }
public static void Setup(TestContext conext) { // Load integration test settings var integrationConfigPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Resources", "integration.parameters.json"); config = new ConfigurationBuilder().AddJsonFile(integrationConfigPath).Build(); // Create SymBotClient var symConfigLoader = new SymConfigLoader(); attachmentTestPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Resources", "AttachmentTest.txt"); var configPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Resources", "config.json"); var symConfig = symConfigLoader.loadFromFile(configPath); var botAuth = new SymBotRSAAuth(symConfig); botAuth.authenticate(); botClient = SymBotClient.initBot(symConfig, botAuth); }
public void UserListStreams() { SymConfig symConfig = new SymConfig(); SymConfigLoader symConfigLoader = new SymConfigLoader(); symConfig = symConfigLoader.loadFromFile("C:/Users/Michael/Documents/Visual Studio 2017/Projects/apiClientDotNet/apiClientDotNetTest/Resources/testConfig.json"); SymBotAuth botAuth = new SymBotAuth(symConfig); botAuth.authenticate(); SymBotClient botClient = SymBotClient.initBot(symConfig, botAuth); StreamClient streamClient = botClient.getStreamsClient(); List <string> streamTypes = new List <string>(); streamTypes.Add("IM"); streamTypes.Add("ROOM"); List <StreamListItem> result = streamClient.getUserStreams(streamTypes, false); Assert.IsTrue(result != null); }
public void ChatBotTest() { var symConfigLoader = new SymConfigLoader(); var configPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Resources", "config.json"); var symConfig = symConfigLoader.loadFromFile(configPath); var symBotRsaAuth = new SymBotRSAAuth(symConfig); symBotRsaAuth.authenticate(); symBotClient = SymBotClient.initBot(symConfig, symBotRsaAuth); // create data feed for the BOT var datafeedEventsService = new DatafeedEventsService(symBotClient); var botRoomListener = new ChatRoomListener(); var directChatListener = new DirectChatListener(); datafeedEventsService.addRoomListener(botRoomListener); datafeedEventsService.addIMListener(directChatListener); // start reading the data feed datafeedEventsService.getEventsFromDatafeed(); }
public void SearchRoom() { SymConfig symConfig = new SymConfig(); SymConfigLoader symConfigLoader = new SymConfigLoader(); symConfig = symConfigLoader.loadFromFile("C:/Users/Michael/Documents/Visual Studio 2017/Projects/apiClientDotNet/apiClientDotNetTest/Resources/testConfig.json"); SymBotAuth botAuth = new SymBotAuth(symConfig); botAuth.authenticate(); SymBotClient botClient = SymBotClient.initBot(symConfig, botAuth); StreamClient streamClient = botClient.getStreamsClient(); RoomSearchQuery roomSearchQuery = new RoomSearchQuery(); roomSearchQuery.query = "APITestRoom"; roomSearchQuery.active = true; roomSearchQuery.isPrivate = true; RoomSearchResult result = streamClient.searchRooms(roomSearchQuery, 0, 0); Assert.IsTrue(result != null); }
public void ChatBotTest() { var symConfigLoader = new SymConfigLoader(); var configPathOne = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Resources", "config.json"); var symConfigOne = symConfigLoader.loadFromFile(configPathOne); var botAuthOne = new SymBotRSAAuth(symConfigOne); botAuthOne.authenticate(); var botClientOne = SymBotClient.initBot(symConfigOne, botAuthOne); // create data feed with bot One var datafeedEventsServiceBotOne = new DatafeedEventsService(botClientOne); var botLogic = new BotLogic(datafeedEventsServiceBotOne); datafeedEventsServiceBotOne.addRoomListener(botLogic); // Send message using bot two in a room where bot one is also added SendMessageAsync(); // start reading the data feed and stop when the first message is received datafeedEventsServiceBotOne.getEventsFromDatafeed(); }
public static void Init(TestContext context) { // Load integration test settings var integrationConfigPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Resources", "integration.parameters.json"); config = new ConfigurationBuilder().AddJsonFile(integrationConfigPath).Build(); // Create SymBotClient var symConfig = new SymConfig(); var symConfigLoader = new SymConfigLoader(); var configPath = Path.Combine(AppDomain.CurrentDomain.BaseDirectory, "Resources", "config.json"); symConfig = symConfigLoader.loadFromFile(configPath); var botAuth = new SymBotRSAAuth(symConfig); botAuth.authenticate(); symBotClient = SymBotClient.initBot(symConfig, botAuth); var userReceiverEmail = config.GetSection(typeof(ConnectionsClientIntegrationTest).Name).GetSection("test_email_address_user_receiver").Value; UserClient userClient = new UserClient(symBotClient); userReceiver = userClient.getUserFromEmail(userReceiverEmail, false)[0]; }
public void OBOUserAndRoomSeaerch() { SymConfig symConfig = new SymConfig(); SymConfigLoader symConfigLoader = new SymConfigLoader(); symConfig = symConfigLoader.loadFromFile("C:/Users/Michael/Documents/Visual Studio 2017/Projects/apiClientDotNet/apiClientDotNetTest/Resources/testConfig3.json"); SymOBOAuth oboAuth = new SymOBOAuth(symConfig); oboAuth.sessionAppAuthenticate(); SymOBOUserAuth auth = oboAuth.getUserAuth("*****@*****.**"); SymOBOClient client = SymOBOClient.initOBOClient(symConfig, auth); UserClient userClient = client.getUsersClient(); UserInfo user = userClient.getUserFromUsername("*****@*****.**"); StreamClient streamClient = client.getStreamsClient(); List <string> streamTypes = new List <string>(); streamTypes.Add("IM"); streamTypes.Add("ROOM"); List <StreamListItem> result = streamClient.getUserStreams(streamTypes, false); Assert.IsTrue(user != null); }
public void OBOIMCreateTest() { SymConfig symConfig = new SymConfig(); SymConfigLoader symConfigLoader = new SymConfigLoader(); symConfig = symConfigLoader.loadFromFile("C:/Users/Michael/Documents/Visual Studio 2017/Projects/apiClientDotNet/apiClientDotNetTest/Resources/testConfig3.json"); SymOBOAuth oboAuth = new SymOBOAuth(symConfig); oboAuth.sessionAppAuthenticate(); SymOBOUserAuth auth = oboAuth.getUserAuth("*****@*****.**"); SymOBOClient client = SymOBOClient.initOBOClient(symConfig, auth); UserClient userClient = client.getUsersClient(); UserInfo user = userClient.getUserFromUsername("*****@*****.**"); StreamClient streamClient = new StreamClient(client); List <long> userids = new List <long>(); userids.Add(user.id); String streamid = streamClient.getUserListIM(userids); Assert.IsTrue(streamid != null); }