public void TraceEndpointMiddleware_PathAndVerbMatching_ReturnsExpected()
        {
            var opts   = new TraceOptions();
            var obs    = new TraceDiagnosticObserver(opts);
            var ep     = new TraceEndpoint(opts, obs);
            var middle = new EndpointOwinMiddleware <List <TraceResult> >(null, ep);

            Assert.True(middle.RequestVerbAndPathMatch("GET", "/trace"));
            Assert.False(middle.RequestVerbAndPathMatch("PUT", "/trace"));
            Assert.False(middle.RequestVerbAndPathMatch("GET", "/badpath"));
        }
        public void ThreadDumpEndpointMiddleware_PathAndVerbMatching_ReturnsExpected()
        {
            var          opts   = new ThreadDumpOptions();
            ThreadDumper obs    = new ThreadDumper(opts);
            var          ep     = new ThreadDumpEndpoint(opts, obs);
            var          middle = new EndpointOwinMiddleware <List <ThreadInfo> >(null, ep);

            Assert.True(middle.RequestVerbAndPathMatch("GET", "/dump"));
            Assert.False(middle.RequestVerbAndPathMatch("PUT", "/dump"));
            Assert.False(middle.RequestVerbAndPathMatch("GET", "/badpath"));
        }
Esempio n. 3
0
        public void ThreadDumpEndpointMiddleware_PathAndVerbMatching_ReturnsExpected()
        {
            var          opts        = new ThreadDumpEndpointOptions();
            var          mgmtOptions = TestHelpers.GetManagementOptions(opts);
            ThreadDumper obs         = new ThreadDumper(opts);
            var          ep          = new ThreadDumpEndpoint(opts, obs);
            var          middle      = new EndpointOwinMiddleware <List <ThreadInfo> >(null, ep, mgmtOptions);

            Assert.True(middle.RequestVerbAndPathMatch("GET", "/cloudfoundryapplication/dump"));
            Assert.False(middle.RequestVerbAndPathMatch("PUT", "/cloudfoundryapplication/dump"));
            Assert.False(middle.RequestVerbAndPathMatch("GET", "/cloudfoundryapplication/badpath"));
        }
Esempio n. 4
0
        public void TraceEndpointMiddleware_PathAndVerbMatching_ReturnsExpected()
        {
            var opts   = new TraceEndpointOptions();
            var mopts  = TestHelpers.GetManagementOptions(opts);
            var obs    = new TraceDiagnosticObserver(opts);
            var ep     = new TraceEndpoint(opts, obs);
            var middle = new EndpointOwinMiddleware <List <TraceResult> >(null, ep, mopts);

            Assert.True(middle.RequestVerbAndPathMatch("GET", "/cloudfoundryapplication/trace"));
            Assert.False(middle.RequestVerbAndPathMatch("PUT", "/cloudfoundryapplication/trace"));
            Assert.False(middle.RequestVerbAndPathMatch("GET", "/cloudfoundryapplication/badpath"));
        }
Esempio n. 5
0
        public void RefreshEndpointMiddleware_PathAndVerbMatching_ReturnsExpected()
        {
            var opts = new RefreshOptions();
            ConfigurationBuilder configurationBuilder = new ConfigurationBuilder();

            configurationBuilder.AddInMemoryCollection(OwinTestHelpers.Appsettings);
            var config = configurationBuilder.Build();
            var ep     = new RefreshEndpoint(opts, config);
            var middle = new EndpointOwinMiddleware <IList <string> >(null, ep);

            Assert.True(middle.RequestVerbAndPathMatch("GET", "/refresh"));
            Assert.False(middle.RequestVerbAndPathMatch("PUT", "/refresh"));
            Assert.False(middle.RequestVerbAndPathMatch("GET", "/badpath"));
        }
        public void InfoEndpointMiddleware_PathAndVerbMatching_ReturnsExpected()
        {
            var opts     = new InfoOptions();
            var contribs = new List <IInfoContributor>()
            {
                new GitInfoContributor()
            };
            var ep     = new InfoEndpoint(opts, contribs);
            var middle = new EndpointOwinMiddleware <Dictionary <string, object> >(null, ep);

            Assert.True(middle.RequestVerbAndPathMatch("GET", "/info"));
            Assert.False(middle.RequestVerbAndPathMatch("PUT", "/info"));
            Assert.False(middle.RequestVerbAndPathMatch("GET", "/badpath"));
        }
Esempio n. 7
0
        public void InfoEndpointMiddleware_PathAndVerbMatching_ReturnsExpected()
        {
            var opts     = new InfoEndpointOptions();
            var mgmtOpts = TestHelpers.GetManagementOptions(opts);

            var contribs = new List <IInfoContributor>()
            {
                new GitInfoContributor()
            };
            var ep     = new InfoEndpoint(opts, contribs);
            var middle = new EndpointOwinMiddleware <Dictionary <string, object> >(null, ep, mgmtOpts);

            Assert.True(middle.RequestVerbAndPathMatch("GET", "/cloudfoundryapplication/info"));
            Assert.False(middle.RequestVerbAndPathMatch("PUT", "/cloudfoundryapplication/info"));
            Assert.False(middle.RequestVerbAndPathMatch("GET", "/cloudfoundryapplication/badpath"));
        }
Esempio n. 8
0
        public void EnvEndpointMiddleware_PathAndVerbMatching_ReturnsExpected()
        {
            var opts = new EnvOptions();
            ConfigurationBuilder configurationBuilder = new ConfigurationBuilder();
            var config = configurationBuilder.Build();
            var host   = new GenericHostingEnvironment()
            {
                EnvironmentName = "EnvironmentName"
            };
            var ep     = new EnvEndpoint(opts, config, host);
            var middle = new EndpointOwinMiddleware <EnvironmentDescriptor>(null, ep);

            Assert.True(middle.RequestVerbAndPathMatch("GET", "/env"));
            Assert.False(middle.RequestVerbAndPathMatch("PUT", "/env"));
            Assert.False(middle.RequestVerbAndPathMatch("GET", "/badpath"));
        }