Permalink
Browse files

Merge remote-tracking branch 'remotes/ws-howard-dev/MVCIntegration' i…

…nto MVCIntegration

Conflicts:
	aspnet webapi migration.txt
  • Loading branch information...
2 parents d50313c + a406b05 commit 311e119f7515d35d8b64e3c6d8f379b7e27af68d @howarddierking committed Jan 15, 2012
Showing with 700 additions and 325 deletions.
  1. +24 −0 RestBugs Solution/RestBugs Solution.sln
  2. +2 −0 RestBugs Solution/RestBugs Solution.sln.DotSettings
  3. +104 −0 RestBugs Solution/RestBugs.ConsoleClient/Program.cs
  4. +36 −0 RestBugs Solution/RestBugs.ConsoleClient/Properties/AssemblyInfo.cs
  5. +66 −0 RestBugs Solution/RestBugs.ConsoleClient/RestBugs.ConsoleClient.csproj
  6. +23 −21 RestBugs Solution/RestBugs.ConsoleHost/Program.cs
  7. +25 −63 RestBugs Solution/RestBugs.Services.Specs/{BugsServiceSpecs.cs → BugsActiveControllerSpecs.cs}
  8. +29 −0 RestBugs Solution/RestBugs.Services.Specs/BugsClosedControllerSpecs.cs
  9. +29 −0 RestBugs Solution/RestBugs.Services.Specs/BugsResolvedControllerSpecs.cs
  10. +3 −4 RestBugs Solution/RestBugs.Services.Specs/RestBugs.Services.Specs.csproj
  11. +33 −23 RestBugs Solution/RestBugs.Services/Infrastructure/RazorHtmlMediaTypeFormatter.cs
  12. +7 −1 RestBugs Solution/RestBugs.Services/RestBugs.Services.csproj
  13. +12 −0 RestBugs Solution/RestBugs.Services/Services/BugAttachmentsController.cs
  14. +12 −0 RestBugs Solution/RestBugs.Services/Services/BugController.cs
  15. +12 −0 RestBugs Solution/RestBugs.Services/Services/BugHistoryController.cs
  16. +54 −0 RestBugs Solution/RestBugs.Services/Services/BugsActiveController.cs
  17. +54 −0 RestBugs Solution/RestBugs.Services/Services/BugsClosedController.cs
  18. +0 −171 RestBugs Solution/RestBugs.Services/Services/BugsController.cs
  19. +63 −0 RestBugs Solution/RestBugs.Services/Services/BugsPendingController.cs
  20. +54 −0 RestBugs Solution/RestBugs.Services/Services/BugsResolvedController.cs
  21. +1 −9 RestBugs Solution/RestBugs.Services/Services/HomeController.cs
  22. +3 −2 RestBugs Solution/RestBugs.Services/Services/TeamController.cs
  23. +46 −30 RestBugs Solution/{RestBugs.Services.Specs/User Stories.txt → design.txt}
  24. +8 −1 aspnet webapi migration.txt
@@ -23,6 +23,14 @@ Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Json", "..\..\..\..\
EndProject
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "System.Web.Http.SelfHost", "..\..\..\..\WPT\WebStackRuntime\Runtime\src\System.Web.Http.SelfHost\System.Web.Http.SelfHost.csproj", "{66492E69-CE4C-4FB1-9B1F-88DEE09D06F1}"
EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{C4336772-FFAB-4056-BDE6-4A84981F345B}"
+ ProjectSection(SolutionItems) = preProject
+ ..\aspnet webapi migration.txt = ..\aspnet webapi migration.txt
+ design.txt = design.txt
+ EndProjectSection
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "RestBugs.ConsoleClient", "RestBugs.ConsoleClient\RestBugs.ConsoleClient.csproj", "{54DCBF6E-EE50-426E-B12F-33DAB81E1074}"
+EndProject
Global
GlobalSection(TeamFoundationVersionControl) = preSolution
SccNumberOfProjects = 5
@@ -191,13 +199,29 @@ Global
{66492E69-CE4C-4FB1-9B1F-88DEE09D06F1}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{66492E69-CE4C-4FB1-9B1F-88DEE09D06F1}.Release|Mixed Platforms.Build.0 = Release|Any CPU
{66492E69-CE4C-4FB1-9B1F-88DEE09D06F1}.Release|x86.ActiveCfg = Release|Any CPU
+ {54DCBF6E-EE50-426E-B12F-33DAB81E1074}.CodeCoverage|Any CPU.ActiveCfg = Release|x86
+ {54DCBF6E-EE50-426E-B12F-33DAB81E1074}.CodeCoverage|Mixed Platforms.ActiveCfg = Release|x86
+ {54DCBF6E-EE50-426E-B12F-33DAB81E1074}.CodeCoverage|Mixed Platforms.Build.0 = Release|x86
+ {54DCBF6E-EE50-426E-B12F-33DAB81E1074}.CodeCoverage|x86.ActiveCfg = Release|x86
+ {54DCBF6E-EE50-426E-B12F-33DAB81E1074}.CodeCoverage|x86.Build.0 = Release|x86
+ {54DCBF6E-EE50-426E-B12F-33DAB81E1074}.Debug|Any CPU.ActiveCfg = Debug|x86
+ {54DCBF6E-EE50-426E-B12F-33DAB81E1074}.Debug|Mixed Platforms.ActiveCfg = Debug|x86
+ {54DCBF6E-EE50-426E-B12F-33DAB81E1074}.Debug|Mixed Platforms.Build.0 = Debug|x86
+ {54DCBF6E-EE50-426E-B12F-33DAB81E1074}.Debug|x86.ActiveCfg = Debug|x86
+ {54DCBF6E-EE50-426E-B12F-33DAB81E1074}.Debug|x86.Build.0 = Debug|x86
+ {54DCBF6E-EE50-426E-B12F-33DAB81E1074}.Release|Any CPU.ActiveCfg = Release|x86
+ {54DCBF6E-EE50-426E-B12F-33DAB81E1074}.Release|Mixed Platforms.ActiveCfg = Release|x86
+ {54DCBF6E-EE50-426E-B12F-33DAB81E1074}.Release|Mixed Platforms.Build.0 = Release|x86
+ {54DCBF6E-EE50-426E-B12F-33DAB81E1074}.Release|x86.ActiveCfg = Release|x86
+ {54DCBF6E-EE50-426E-B12F-33DAB81E1074}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
EndGlobalSection
GlobalSection(NestedProjects) = preSolution
{1FE6F881-2365-418C-AD5C-ED987F07F393} = {E3552BDA-0A81-45C8-A4B5-9B53186A50B5}
{918F3150-2444-477C-86BD-4C35F0512261} = {E3552BDA-0A81-45C8-A4B5-9B53186A50B5}
+ {54DCBF6E-EE50-426E-B12F-33DAB81E1074} = {E3552BDA-0A81-45C8-A4B5-9B53186A50B5}
{0777C6CB-7F07-4A09-BF0A-A7FF8028F48E} = {1D58AEC4-0707-4F73-8F02-8823578FC39D}
{DDC1CE0C-486E-4E35-BB3B-EAB61F8F9440} = {4776E5CD-7725-4F87-B583-F2808FCB3987}
{03A5E5F2-2E23-48F2-ABCC-6C41BAC9AC02} = {4776E5CD-7725-4F87-B583-F2808FCB3987}
@@ -0,0 +1,2 @@
+<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
+ <s:String x:Key="/Default/CodeInspection/Highlighting/InspectionSeverities/=InconsistentNaming/@EntryIndexedValue">SUGGESTION</s:String></wpf:ResourceDictionary>
@@ -0,0 +1,104 @@
+using System;
+using System.Collections.Generic;
+using System.Net.Http;
+using System.Net.Http.Headers;
+using System.Xml;
+
+namespace RestBugs.ConsoleClient
+{
+ class Program
+ {
+ static HttpClient client;
+
+ static void Main(string[] args) {
+ string baseUri = "http://localhost:8800";
+ InitializeClient();
+
+ Start(baseUri);
+ Console.ReadKey();
+ }
+
+ static void Start(string baseUri) {
+ while (true) {
+ Console.WriteLine("Retrieving list of reports\r\n");
+ XmlDocument document = GetDocument(baseUri);
+
+ XmlNodeList reports = OutputReports(document);
+
+ Console.WriteLine("\r\nChoose a report (1 - {0})", reports.Count);
+ ConsoleKeyInfo info = Console.ReadKey();
+
+ int selection = int.Parse(info.KeyChar.ToString());
+ string uri = string.Format("{0}/{1}", baseUri, reports[selection - 1].Attributes["href"].Value);
+ Console.WriteLine("\r\n" + uri + "\r\n");
+
+ document = GetDocument(uri);
+ OutputBugs(document);
+
+ Console.WriteLine("\r\nCommand:\r\n");
+ Console.WriteLine("{Bug #} r - Resolve");
+ Console.WriteLine("b - Back\r\n");
+
+ string command = Console.ReadLine();
+ HandleBugCommand(baseUri, document, command);
+ }
+ }
+
+ static void HandleBugCommand(string baseUri, XmlDocument document, string command) {
+ if (command == "b") {
+ Start(baseUri);
+ return;
+ }
+
+ string[] items = command.Split(' ');
+ int id = int.Parse(items[0]);
+ XmlNode bug =
+ document.SelectSingleNode("//tr[@class='bug-data']/td[@class='id'][.='" + id + "']").ParentNode;
+ XmlNode form = bug.SelectSingleNode("td/form[@class='resolved']");
+
+ var formPostValues = new Dictionary<string, string>();
+ formPostValues["id"] = id.ToString();
+ formPostValues["comments"] = "resolved";
+ var content = new FormUrlEncodedContent(formPostValues);
+ string href = form.Attributes["action"].InnerText;
+ string uri = string.Format("{0}{1}", baseUri, href);
+ client.PostAsync(uri, content).Wait();
+ }
+
+ static XmlNodeList OutputReports(XmlDocument document) {
+ XmlNodeList reports = document.SelectNodes("//a[@rel='bugs']");
+
+ for (int i = 1; i <= reports.Count; i++) {
+ XmlNode node = reports[i - 1];
+ Console.WriteLine("{0} - {1}", i, node.InnerText);
+ }
+ return reports;
+ }
+
+ static void OutputBugs(XmlDocument document) {
+ XmlNodeList bugs = document.SelectNodes("//tr[@class='bug-data']");
+ Console.WriteLine("ID\tName\tStatus\t\tPriority\tRank\tAssignedTo\r\n");
+ foreach (XmlElement bug in bugs) {
+ string id = bug.SelectSingleNode("td[@class='id']").InnerText.Trim();
+ string name = bug.SelectSingleNode("td[@class='name']").InnerText.Trim();
+ string status = bug.SelectSingleNode("td[@class='status']").InnerText.Trim();
+ string priority = bug.SelectSingleNode("td[@class='priority']").InnerText.Trim();
+ string rank = bug.SelectSingleNode("td[@class='rank']").InnerText.Trim();
+ string assignedTo = bug.SelectSingleNode("td[@class='assignedTo']").InnerText.Trim();
+ Console.WriteLine("{0}\t{1}\t{2}\t\t{3}\t\t{4}\t{5}", id, name, status, priority, rank, assignedTo);
+ }
+ }
+
+ static XmlDocument GetDocument(string uri) {
+ HttpResponseMessage response = client.GetAsync(uri).Result;
+ var document = new XmlDocument();
+ document.Load(response.Content.ReadAsStreamAsync().Result);
+ return document;
+ }
+
+ static void InitializeClient() {
+ client = new HttpClient();
+ client.DefaultRequestHeaders.Accept.Add(new MediaTypeWithQualityHeaderValue("text/html"));
+ }
+ }
+}
@@ -0,0 +1,36 @@
+using System.Reflection;
+using System.Runtime.CompilerServices;
+using System.Runtime.InteropServices;
+
+// General Information about an assembly is controlled through the following
+// set of attributes. Change these attribute values to modify the information
+// associated with an assembly.
+[assembly: AssemblyTitle("RestBugs.ConsoleClient")]
+[assembly: AssemblyDescription("")]
+[assembly: AssemblyConfiguration("")]
+[assembly: AssemblyCompany("Microsoft")]
+[assembly: AssemblyProduct("RestBugs.ConsoleClient")]
+[assembly: AssemblyCopyright("Copyright © Microsoft 2011")]
+[assembly: AssemblyTrademark("")]
+[assembly: AssemblyCulture("")]
+
+// Setting ComVisible to false makes the types in this assembly not visible
+// to COM components. If you need to access a type in this assembly from
+// COM, set the ComVisible attribute to true on that type.
+[assembly: ComVisible(false)]
+
+// The following GUID is for the ID of the typelib if this project is exposed to COM
+[assembly: Guid("ca22aea5-560a-4a62-ad4d-4ae874f45f13")]
+
+// Version information for an assembly consists of the following four values:
+//
+// Major Version
+// Minor Version
+// Build Number
+// Revision
+//
+// You can specify all the values or you can default the Build and Revision Numbers
+// by using the '*' as shown below:
+// [assembly: AssemblyVersion("1.0.*")]
+[assembly: AssemblyVersion("1.0.0.0")]
+[assembly: AssemblyFileVersion("1.0.0.0")]
@@ -0,0 +1,66 @@
+<?xml version="1.0" encoding="utf-8"?>
+<Project ToolsVersion="4.0" DefaultTargets="Build" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
+ <PropertyGroup>
+ <Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
+ <Platform Condition=" '$(Platform)' == '' ">x86</Platform>
+ <ProductVersion>8.0.30703</ProductVersion>
+ <SchemaVersion>2.0</SchemaVersion>
+ <ProjectGuid>{54DCBF6E-EE50-426E-B12F-33DAB81E1074}</ProjectGuid>
+ <OutputType>Exe</OutputType>
+ <AppDesignerFolder>Properties</AppDesignerFolder>
+ <RootNamespace>RestBugs.ConsoleClient</RootNamespace>
+ <AssemblyName>RestBugs.ConsoleClient</AssemblyName>
+ <TargetFrameworkVersion>v4.0</TargetFrameworkVersion>
+ <TargetFrameworkProfile>Client</TargetFrameworkProfile>
+ <FileAlignment>512</FileAlignment>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|x86' ">
+ <PlatformTarget>x86</PlatformTarget>
+ <DebugSymbols>true</DebugSymbols>
+ <DebugType>full</DebugType>
+ <Optimize>false</Optimize>
+ <OutputPath>bin\Debug\</OutputPath>
+ <DefineConstants>DEBUG;TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|x86' ">
+ <PlatformTarget>x86</PlatformTarget>
+ <DebugType>pdbonly</DebugType>
+ <Optimize>true</Optimize>
+ <OutputPath>bin\Release\</OutputPath>
+ <DefineConstants>TRACE</DefineConstants>
+ <ErrorReport>prompt</ErrorReport>
+ <WarningLevel>4</WarningLevel>
+ </PropertyGroup>
+ <ItemGroup>
+ <Reference Include="System" />
+ <Reference Include="System.Core" />
+ <Reference Include="System.Net.Http">
+ <HintPath>..\..\..\..\..\WPT\WebStackRuntime\Runtime\external\System.Net.Http.dll</HintPath>
+ </Reference>
+ <Reference Include="System.Xml.Linq" />
+ <Reference Include="System.Data.DataSetExtensions" />
+ <Reference Include="Microsoft.CSharp" />
+ <Reference Include="System.Data" />
+ <Reference Include="System.Xml" />
+ </ItemGroup>
+ <ItemGroup>
+ <Compile Include="Program.cs" />
+ <Compile Include="Properties\AssemblyInfo.cs" />
+ </ItemGroup>
+ <ItemGroup>
+ <ProjectReference Include="..\..\..\..\..\WPT\WebStackRuntime\Runtime\src\System.Net.Http.Formatting\System.Net.Http.Formatting.csproj">
+ <Project>{668E9021-CE84-49D9-98FB-DF125A9FCDB0}</Project>
+ <Name>System.Net.Http.Formatting</Name>
+ </ProjectReference>
+ </ItemGroup>
+ <Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
+ <!-- To modify your build process, add your task inside one of the targets below and uncomment it.
+ Other similar extension points exist, see Microsoft.Common.targets.
+ <Target Name="BeforeBuild">
+ </Target>
+ <Target Name="AfterBuild">
+ </Target>
+ -->
+</Project>
@@ -4,22 +4,39 @@
using System.Web.Http;
using System.Web.Http.SelfHost;
using Ninject;
- using RestBugs.Services.Infrastructure;
- using RestBugs.Services.MessageHandlers;
- using RestBugs.Services.Model;
+ using Services.Infrastructure;
+ using Services.MessageHandlers;
+ using Services.Model;
class Program
{
static void Main() {
var config = new HttpSelfHostConfiguration(new Uri("http://localhost:8800/"));
-
+
+
//config.Formatters.Add(new FormUrlEncodedMediaTypeFormatter());
config.Formatters.Add(new RazorHtmlMediaTypeFormatter());
- config.MessageHandlers.Add(new EtagMessageHandler());
-
+ //config.MessageHandlers.Add(new EtagMessageHandler());
//config.IncludeExceptionDetail = true;
+ /*
+ / - GET
+ /Team - GET | POST
+ /Team/{Team member}/Bugs - GET | POST
+ /Bugs/Active - GET | POST
+ /Bugs/Resolved - GET | POST
+ /Bugs/Closed - GET | POST
+ /Bugs/Pending - GET | POST (adding new bug posts here)
+ /Bug/{Bug} - GET | PUT | DELETE
+ /Bug/{Bug}/Attachments - GET | POST | DELETE
+ /Bug/{Bug}/History - GET
+ */
+
+ config.Routes.MapHttpRoute("active", "bugs/active", new { controller = "BugsActive" });
+ config.Routes.MapHttpRoute("closed", "bugs/closed", new { controller = "BugsClosed" });
+ config.Routes.MapHttpRoute("pending", "bugs/pending", new { controller = "BugsPending" });
+ config.Routes.MapHttpRoute("resolved", "bugs/resolved", new { controller = "BugsResolved" });
config.Routes.MapHttpRoute("default", "{controller}", new { controller = "Home" });
var kernel = new StandardKernel();
@@ -36,21 +53,6 @@ class Program
Console.ReadLine();
host.CloseAsync().Wait();
-
- //var homeServiceBaseAddress = new Uri(systemBaseAddress, "");
- //var homeServiceHost = new HttpServiceHost(typeof(HomeController), GetConfig(), homeServiceBaseAddress);
- //homeServiceHost.Open();
- //Console.WriteLine("SystemServiceHost is open...");
-
- //var bugServiceBaseAddress = new Uri(systemBaseAddress, "bugs");
- //var bugServiceHost = new HttpServiceHost(typeof(BugsController), GetConfig(), bugServiceBaseAddress);
- //bugServiceHost.Open();
- //Console.WriteLine("BugServiceHost is open...");
-
- //var teamServiceBaseAddress = new Uri(systemBaseAddress, "team");
- //var teamServiceHost = new HttpServiceHost(typeof (TeamController), GetConfig(), teamServiceBaseAddress);
- //teamServiceHost.Open();
- //Console.WriteLine("TeamServiceHost is open...");
}
}
}
Oops, something went wrong.

0 comments on commit 311e119

Please sign in to comment.