protected override void ProcessRecord()
 {
     base.ProcessRecord();
     try
     {
         client?.Dispose();
         int timeout = GetPreferredTimeout();
         WriteDebug($"Cmdlet Timeout : {timeout} milliseconds.");
         client = new DashboardClient(AuthProvider, new Oci.Common.ClientConfiguration
         {
             RetryConfiguration = retryConfig,
             TimeoutMillis      = timeout,
             ClientUserAgent    = PSUserAgent
         });
         string region = GetPreferredRegion();
         if (region != null)
         {
             WriteDebug("Choosing Region:" + region);
             client.SetRegion(region);
         }
         if (Endpoint != null)
         {
             WriteDebug("Choosing Endpoint:" + Endpoint);
             client.SetEndpoint(Endpoint);
         }
     }
     catch (Exception ex)
     {
         TerminatingErrorDuringExecution(ex);
     }
 }
Exemple #2
0
        public OrleansHost()
        {
            StartSilo().Wait();
            StartClient().Wait();

            _dashboard = new DashboardClient(GrainFactory);
        }
        public async Task DashboardClient_Get_With_Right_URL_with_module_name()
        {
            // Arrange
            var loggerMock  = new Mock <ILogger <DashboardClient> >(MockBehavior.Loose);
            var handlerMock = new Mock <HttpMessageHandler>(MockBehavior.Strict);

            var reporters = new[] { Reporter.Dashboard };

            var options = new StrykerOptions
            {
                DashboardUrl    = "http://www.example.com",
                DashboardApiKey = "Access_Token",
                ProjectName     = "github.com/JohnDoe/project",
                ProjectVersion  = "test/version",
                ModuleName      = "moduleName",
                Reporters       = reporters
            };

            var readonlyInputComponent = new Mock <IReadOnlyProjectComponent>(MockBehavior.Loose).Object;

            var jsonReport = JsonReport.Build(options, readonlyInputComponent);
            var json       = jsonReport.ToJson();

            handlerMock
            .Protected()
            .Setup <Task <HttpResponseMessage> >(
                "SendAsync",
                ItExpr.IsAny <HttpRequestMessage>(),
                ItExpr.IsAny <CancellationToken>())
            .ReturnsAsync(new HttpResponseMessage()
            {
                StatusCode = System.Net.HttpStatusCode.OK,
                Content    = new StringContent(json, Encoding.UTF8, "application/json")
            })
            .Verifiable();

            var httpClient = new HttpClient(handlerMock.Object);

            var target = new DashboardClient(options, httpClient, loggerMock.Object);

            // Act
            var result = await target.PullReport("version");

            // Assert
            var expectedUri = new Uri("http://www.example.com/api/reports/github.com/JohnDoe/project/version?module=moduleName");

            handlerMock.Protected().Verify(
                "SendAsync",
                Times.Exactly(1),
                ItExpr.Is <HttpRequestMessage>(req =>
                                               req.Method == HttpMethod.Get &&
                                               req.RequestUri == expectedUri
                                               ),
                ItExpr.IsAny <CancellationToken>()
                );

            result.ShouldNotBeNull();
            result.ToJson().ShouldBe(json);
        }
Exemple #4
0
        protected override async void OnAppearing()
        {
            base.OnAppearing();
            DashboardClient dashboardClient = new DashboardClient();
            Dashboard       dashboard       = await dashboardClient.GetDashboardAsync();

            BindingContext = dashboard;
        }
        public async Task DashboardClient_Get_Returns_Null_When_Statuscode_Not_200()
        {
            // Arrange
            var loggerMock  = new Mock <ILogger <DashboardClient> >(MockBehavior.Loose);
            var handlerMock = new Mock <HttpMessageHandler>(MockBehavior.Strict);

            var reporters = new string[] {
                "dashboard"
            };


            var options = new StrykerOptions(
                dashboardUrl: "http://www.example.com",
                dashboardApiKey: "Acces_Token",
                projectName: "github.com/JohnDoe/project",
                projectVersion: "test/version",
                reporters: reporters
                );


            handlerMock
            .Protected()
            .Setup <Task <HttpResponseMessage> >(
                "SendAsync",
                ItExpr.IsAny <HttpRequestMessage>(),
                ItExpr.IsAny <CancellationToken>())
            .ReturnsAsync(new HttpResponseMessage()
            {
                StatusCode = System.Net.HttpStatusCode.BadRequest,
            })
            .Verifiable();

            var httpClient = new HttpClient(handlerMock.Object);

            var target = new DashboardClient(options, httpClient, loggerMock.Object);

            // Act
            var result = await target.PullReport("version");

            // Assert
            var expectedUri = new Uri("http://www.example.com/api/reports/github.com/JohnDoe/project/version");

            handlerMock.Protected().Verify(
                "SendAsync",
                Times.Exactly(1),
                ItExpr.Is <HttpRequestMessage>(req =>
                                               req.Method == HttpMethod.Get &&
                                               req.RequestUri == expectedUri
                                               ),
                ItExpr.IsAny <CancellationToken>()
                );

            result.ShouldBeNull();
        }
        public async Task DashboardClient_Calls_With_Right_URL_With_Module_Appended()
        {
            // Arrange
            var loggerMock  = new Mock <ILogger <DashboardClient> >(MockBehavior.Loose);
            var handlerMock = new Mock <HttpMessageHandler>(MockBehavior.Strict);

            var href = "http://www.example.com/api/projectName/version";

            handlerMock
            .Protected()
            .Setup <Task <HttpResponseMessage> >(
                "SendAsync",
                ItExpr.IsAny <HttpRequestMessage>(),
                ItExpr.IsAny <CancellationToken>())
            .ReturnsAsync(new HttpResponseMessage()
            {
                StatusCode = System.Net.HttpStatusCode.OK,
                Content    = new StringContent($"{{\"Href\": \"{href}\"}}", Encoding.UTF8, "text/html")
            })
            .Verifiable();

            var httpClient = new HttpClient(handlerMock.Object);

            var reporters = new[] { Reporter.Dashboard };

            var options = new StrykerOptions
            {
                DashboardUrl    = "http://www.example.com",
                DashboardApiKey = "Access_Token",
                ProjectName     = "github.com/JohnDoe/project",
                ProjectVersion  = "test/version",
                ModuleName      = "moduleName",
                Reporters       = reporters
            };
            var target = new DashboardClient(options, httpClient, loggerMock.Object);


            // Act
            var result = await target.PublishReport(new MockJsonReport(null, null), "version");

            var expectedUri = new Uri("http://www.example.com/api/reports/github.com/JohnDoe/project/version?module=moduleName");

            handlerMock.Protected().Verify(
                "SendAsync",
                Times.Exactly(1),
                ItExpr.Is <HttpRequestMessage>(req =>
                                               req.Method == HttpMethod.Put &&
                                               req.RequestUri == expectedUri
                                               ),
                ItExpr.IsAny <CancellationToken>()
                );

            result.ShouldBe(href);
        }
        [Authorize]     // we can live without it, because ControllerCommon.CheckAuthorizedGoogleEmail() will redirect to /login anyway, but it is quicker that this automatically redirects without clicking another URL link.
#endif
        public ActionResult ServerDiagnostics()
        {
            StringBuilder sb = new StringBuilder(@"<HTML><body><h1>ServerDiagnostics</h1>");

            Program.ServerDiagnostic(sb);
            BrokersWatcher.gWatcher.ServerDiagnostic(sb);
            MemDb.gMemDb.ServerDiagnostic(sb);
            SqWebsocketMiddleware.ServerDiagnostic(sb);
            DashboardClient.ServerDiagnostic(sb);

            return(Content(sb.Append("</body></HTML>").ToString(), "text/html"));
        }
        public async Task DashboardClient_Calls_With_Right_URL_With_Module_Appended()
        {
            // Arrange
            var loggerMock  = new Mock <ILogger <DashboardClient> >(MockBehavior.Loose);
            var handlerMock = new Mock <HttpMessageHandler>(MockBehavior.Strict);

            handlerMock
            .Protected()
            .Setup <Task <HttpResponseMessage> >(
                "SendAsync",
                ItExpr.IsAny <HttpRequestMessage>(),
                ItExpr.IsAny <CancellationToken>())
            .ReturnsAsync(new HttpResponseMessage()
            {
                StatusCode = System.Net.HttpStatusCode.OK,
                Content    = new StringContent("{\"Href\": \"http://www.example.com/api/projectName/version\"}", Encoding.UTF8, "text/html")
            })
            .Verifiable();

            var httpClient = new HttpClient(handlerMock.Object);

            var reporters = new String[1];

            reporters[0] = "dashboard";

            var options = new StrykerOptions(
                dashboardUrl: "http://www.example.com",
                dashboardApiKey: "Acces_Token",
                projectName: "github.com/JohnDoe/project",
                projectVersion: "test/version",
                reporters: reporters,
                moduleName: "moduleName"
                );

            var target = new DashboardClient(options, httpClient, loggerMock.Object);


            // Act
            await target.PublishReport("string_json", "version");

            var expectedUri = new Uri("http://www.example.com/api/reports/github.com/JohnDoe/project/version?module=moduleName");

            handlerMock.Protected().Verify(
                "SendAsync",
                Times.Exactly(1),
                ItExpr.Is <HttpRequestMessage>(req =>
                                               req.Method == HttpMethod.Put &&
                                               req.RequestUri == expectedUri
                                               ),
                ItExpr.IsAny <CancellationToken>()
                );
        }
Exemple #9
0
        public async Task <ActionResult> Dash(string dashId)
        {
            var pbi             = new PowerBiAuthentication(new powerbiWebToken());
            var dashboardClient = new DashboardClient(pbi);
            var dashes          = await dashboardClient.List();

            ViewBag.dashes      = dashes.value;
            ViewBag.accessToken = pbi.GetAccessToken();

            var firstDash = dashes.value.First(d => d.id == dashId);
            var tiles     = await dashboardClient.Tiles(firstDash.id);

            return(View("Index", model: tiles));
        }
Exemple #10
0
        private async static Task QueryDashboards()
        {
            var dashboardClient = new DashboardClient(pbi);
            var dashboards      = await dashboardClient.List();

            foreach (var dashboard in dashboards.value)
            {
                Console.WriteLine("{0}\t{1}", dashboard.displayName, dashboard.id);

                var tiles = await dashboardClient.Tiles(dashboard.id);

                foreach (var tile in tiles.value)
                {
                    Console.WriteLine(tile.embedUrl);
                }
            }
        }
        private async Task <bool> Initialise()
        {
            busyIndicator.IsBusy = true;
            if (_selectedDashBoard == null)
            {
                int rowId;
                int.TryParse(dashboardName, out rowId);
                var dbrdLst = await api.Query <DashboardClient>() as IEnumerable <UserReportDevExpressClient>;

                if (rowId != 0)
                {
                    _selectedDashBoard = dbrdLst?.FirstOrDefault(x => x.RowId == rowId) as DashboardClient;
                }
                else
                {
                    _selectedDashBoard = dbrdLst?.FirstOrDefault(x => string.Compare(x._Name, dashboardName, StringComparison.CurrentCultureIgnoreCase) == 0) as DashboardClient;
                }
            }
            if (_selectedDashBoard != null)
            {
                var result = await api.Read(_selectedDashBoard);

                if (result == ErrorCodes.Succes)
                {
                    if (_selectedDashBoard.Layout != null)
                    {
                        ReadDataFromDB(_selectedDashBoard.Layout);
                    }
                    dashboardViewerUniconta.TitleContent = _selectedDashBoard.Name;
                }
                else
                {
                    UnicontaMessageBox.Show(Uniconta.ClientTools.Localization.lookup(result.ToString()), Uniconta.ClientTools.Localization.lookup("Error"));
                }
            }

            if (_selectedDashBoard == null)
            {
                busyIndicator.IsBusy = false;
            }
            return(true);
        }
        public async Task DashboardClient_Logs_And_Returns_Null_On_Publish_Report_Does_Not_Return_200()
        {
            // Arrange
            var loggerMock  = new Mock <ILogger <DashboardClient> >(MockBehavior.Loose);
            var handlerMock = new Mock <HttpMessageHandler>(MockBehavior.Strict);

            handlerMock
            .Protected()
            .Setup <Task <HttpResponseMessage> >(
                "SendAsync",
                ItExpr.IsAny <HttpRequestMessage>(),
                ItExpr.IsAny <CancellationToken>())
            .ReturnsAsync(new HttpResponseMessage()
            {
                StatusCode = System.Net.HttpStatusCode.BadRequest,
                Content    = new StringContent("Error message", Encoding.UTF8, "text/html")
            })
            .Verifiable();

            var httpClient = new HttpClient(handlerMock.Object);
            var options    = new StrykerOptions
            {
                DashboardUrl    = "http://www.example.com/",
                DashboardApiKey = "Access_Token"
            };

            var target = new DashboardClient(options, httpClient, loggerMock.Object);

            // Act
            var result = await target.PublishReport(new MockJsonReport(null, null), "version");

            loggerMock.Verify(
                x => x.Log(
                    It.Is <LogLevel>(logLevel => logLevel == LogLevel.Error),
                    It.IsAny <EventId>(),
                    It.Is <It.IsAnyType>((v, t) => true),
                    It.IsAny <Exception>(),
                    It.Is <Func <It.IsAnyType, Exception, string> >((v, t) => true)));

            result.ShouldBeNull();
        }
 public DashBoardViewerPage(UnicontaBaseEntity dashBoard) : base(dashBoard)
 {
     _selectedDashBoard = dashBoard as DashboardClient;
     InitPage();
 }
Exemple #14
0
 public DashboardTests()
 {
     _dashboardClient = new DashboardClient("[YOUR API KEY]");
 }
Exemple #15
0
        public static void Start()
        {
            if (started)
            {
                return;
            }

            started = true;

            Navigator.Start(new NavigationManager(multithreaded: true));
            Finder.Start(new FinderManager());
            Constructor.Start(new ConstructorManager());

            OperationClient.Start(new OperationManager());

            AuthClient.Start(
                types: true,
                property: true,
                queries: true,
                permissions: true,
                operations: true,
                defaultPasswordExpiresLogic: false);

            Navigator.EntitySettings <UserEntity>().OverrideView += (usr, ctrl) =>
            {
                ctrl.Child <EntityLine>("Role").After(new ValueLine().Set(Common.RouteProperty, "[UserEmployeeMixin].AllowLogin"));
                ctrl.Child <EntityLine>("Role").After(new EntityLine().Set(Common.RouteProperty, "[UserEmployeeMixin].Employee"));

                return(ctrl);
            };

            LinksClient.Start(widget: true, contextualMenu: true);

            ProcessClient.Start(package: true, packageOperation: true);
            SchedulerClient.Start();

            FilePathClient.Start();
            ExcelClient.Start(toExcel: true, excelReport: false);
            UserQueryClient.Start();
            ChartClient.Start();
            DashboardClient.Start();

            HelpClient.Start();

            ExceptionClient.Start();

            NoteClient.Start(typeof(UserEntity), /*Note*/ typeof(OrderEntity));
            AlertClient.Start(typeof(UserEntity), /*Alert*/ typeof(OrderEntity));
            SMSClient.Start();

            ProfilerClient.Start();

            OmniboxClient.Start();
            OmniboxClient.Register(new SpecialOmniboxProvider());
            OmniboxClient.Register(new EntityOmniboxProvider());
            OmniboxClient.Register(new DynamicQueryOmniboxProvider());
            OmniboxClient.Register(new UserQueryOmniboxProvider());
            OmniboxClient.Register(new ChartOmniboxProvider());
            OmniboxClient.Register(new UserChartOmniboxProvider());
            OmniboxClient.Register(new DashboardOmniboxProvider());

            SouthwindClient.Start();

            DisconnectedClient.Start();

            Navigator.Initialize();
        }
Exemple #16
0
        private void WebStart()
        {
            Navigator.Start(new NavigationManager("haradwaithwinds"));
            Finder.Start(new FinderManager());
            Constructor.Start(new ConstructorManager(), new ClientConstructorManager());

            OperationClient.Start(new OperationManager(), true);

            AuthClient.Start(
                types: true,
                property: true,
                queries: true,
                resetPassword: true,
                passwordExpiration: false,
                singleSignOnMessage: false);

            Navigator.EntitySettings <UserEntity>().CreateViewOverrides()
            .AfterLine((UserEntity u) => u.Role, (html, tc) => html.ValueLine(tc, u => u.Mixin <UserEmployeeMixin>().AllowLogin))
            .AfterLine((UserEntity u) => u.Role, (html, tc) => html.EntityLine(tc, u => u.Mixin <UserEmployeeMixin>().Employee));

            AuthAdminClient.Start(
                types: true,
                properties: true,
                queries: true,
                operations: true,
                permissions: true);

            MailingClient.Start(
                smtpConfig: true,
                newsletter: false,
                pop3Config: false,
                emailReport: false,
                quickLinkFrom: null);

            SMSClient.Start();

            SessionLogClient.Start();
            ExceptionClient.Start();
            UserQueriesClient.Start();
            FilesClient.Start(
                file: true,
                embeddedFile: true,
                filePath: false,
                embeddedFilePath: true);

            MapClient.Start();
            ChartClient.Start();
            ExcelClient.Start(
                toExcelPlain:  true,
                excelReport: false,
                excelAttachment: false);

            WordClient.Start();
            DashboardClient.Start();

            DisconnectedClient.Start();
            ProcessClient.Start(
                packages: true,
                packageOperations: true);

            TranslationClient.Start(new AlreadyTranslatedTranslator(new BingTranslator()),
                                    translatorUser: true,
                                    translationReplacement: false,
                                    instanceTranslator: true);

            SchedulerClient.Start(simpleTask: true);

            NoteClient.Start(typeof(UserEntity), /*Note*/ typeof(OrderEntity));
            AlertClient.Start(typeof(UserEntity), /*Alert*/ typeof(OrderEntity));
            LinksClient.Start(widget: true, contextualItems: true);

            ViewLogClient.Start();
            DiffLogClient.Start();

            HelpClient.Start("Images", "http://localhost:7654/");

            SouthwindClient.Start();

            CacheClient.Start();

            ProfilerClient.Start();

            ScriptHtmlHelper.Manager.MainAssembly = typeof(SouthwindClient).Assembly;
            SignumControllerFactory.MainAssembly  = typeof(SouthwindClient).Assembly;
            SignumControllerFactory.EveryController().AddFilters(ctx =>
                                                                 ctx.FilterInfo.AuthorizationFilters.OfType <AuthenticationRequiredAttribute>().Any() ? null : new AuthenticationRequiredAttribute());
            SignumControllerFactory.EveryController().AddFilters(new SignumExceptionHandlerAttribute());
            SignumControllerFactory.EveryController().AddFilters(new ProfilerFilterAttribute());
            SignumControllerFactory.RegisterAvoidValidate();

            Navigator.Initialize();

            OmniboxClient.Start();
            OmniboxClient.Register(new SpecialOmniboxProvider());
            OmniboxClient.Register(new EntityOmniboxProvider());
            OmniboxClient.Register(new DynamicQueryOmniboxProvider());
            OmniboxClient.Register(new UserQueryOmniboxProvider());
            OmniboxClient.Register(new ChartOmniboxProvider());
            OmniboxClient.Register(new UserChartOmniboxProvider());
            OmniboxClient.Register(new DashboardOmniboxProvider());
            OmniboxClient.Register(new HelpOmniboxProvider());
            OmniboxClient.Register(new MapOmniboxProvider());
        } //WebStart