From f0f88aee98a431f6e744f8c28ffb0ee580da2c41 Mon Sep 17 00:00:00 2001 From: Christian Arenas Date: Tue, 11 Jul 2017 12:43:06 +0200 Subject: [PATCH 1/2] Add PicBaseUrl with a replaced parameter --- docker-compose.override.yml | 4 ++-- docker-compose.prod.yml | 4 ++-- .../Catalog.API/Controllers/CatalogController.cs | 5 ++--- .../Catalog/Catalog.API/Controllers/PicController.cs | 10 +++++----- src/Services/Catalog/Catalog.API/settings.json | 2 +- .../Marketing.API/Controllers/CampaignsController.cs | 2 +- src/Services/Marketing/Marketing.API/appsettings.json | 5 +++-- 7 files changed, 16 insertions(+), 16 deletions(-) diff --git a/docker-compose.override.yml b/docker-compose.override.yml index ca962be9b..8d0880f92 100644 --- a/docker-compose.override.yml +++ b/docker-compose.override.yml @@ -29,7 +29,7 @@ services: - ASPNETCORE_ENVIRONMENT=Development - ASPNETCORE_URLS=http://0.0.0.0:80 - ConnectionString=${ESHOP_AZURE_CATALOG_DB:-Server=sql.data;Database=Microsoft.eShopOnContainers.Services.CatalogDb;User Id=sa;Password=Pass@word} - - PicBaseUrl=${ESHOP_AZURE_STORAGE_CATALOG:-http://localhost:5101/api/v1/pic/} #Local: You need to open your local dev-machine firewall at range 5100-5110. + - PicBaseUrl=${ESHOP_AZURE_STORAGE_CATALOG:-http://localhost:5101/api/v1/catalog/items/[0]/pic/} #Local: You need to open your local dev-machine firewall at range 5100-5110. - EventBusConnection=${ESHOP_AZURE_SERVICE_BUS:-rabbitmq} - AzureStorageAccountName=${ESHOP_AZURE_STORAGE_CATALOG_NAME} - AzureStorageAccountKey=${ESHOP_AZURE_STORAGE_CATALOG_KEY} @@ -70,7 +70,7 @@ services: - EventBusConnection=${ESHOP_AZURE_SERVICE_BUS:-rabbitmq} - identityUrl=http://identity.api #Local: You need to open your local dev-machine firewall at range 5100-5110. - CampaignDetailFunctionUri=${ESHOP_AZUREFUNC_CAMPAIGN_DETAILS_URI} - - PicBaseUrl=${ESHOP_AZURE_STORAGE_MARKETING:-http://localhost:5110/api/v1/pic/} + - PicBaseUrl=${ESHOP_AZURE_STORAGE_MARKETING:-http://localhost:5110/api/v1/campaigns/[0]/pic/} - AzureStorageAccountName=${ESHOP_AZURE_STORAGE_MARKETING_NAME} - AzureStorageAccountKey=${ESHOP_AZURE_STORAGE_MARKETING_KEY} ports: diff --git a/docker-compose.prod.yml b/docker-compose.prod.yml index 8c1628ffb..fa2f1ccd8 100644 --- a/docker-compose.prod.yml +++ b/docker-compose.prod.yml @@ -34,7 +34,7 @@ services: - ASPNETCORE_ENVIRONMENT=Production ASPNETCORE_URLS=http://0.0.0.0:80 - ConnectionString=${ESHOP_AZURE_CATALOG_DB:-Server=sql.data;Database=Microsoft.eShopOnContainers.Services.CatalogDb;User Id=sa;Password=Pass@word} - - PicBaseUrl=${ESHOP_AZURE_STORAGE_CATALOG:-http://localhost:5101/api/v1/pic/} #Local: You need to open your local dev-machine firewall at range 5100-5110. + - PicBaseUrl=${ESHOP_AZURE_STORAGE_CATALOG} #Local: You need to open your local dev-machine firewall at range 5100-5110. - EventBusConnection=${ESHOP_AZURE_SERVICE_BUS:-rabbitmq} - AzureStorageAccountName=${ESHOP_AZURE_STORAGE_CATALOG_NAME} - AzureStorageAccountKey=${ESHOP_AZURE_STORAGE_CATALOG_KEY} @@ -75,7 +75,7 @@ services: - EventBusConnection=${ESHOP_AZURE_SERVICE_BUS:-rabbitmq} - identityUrl=http://identity.api #Local: You need to open your local dev-machine firewall at range 5100-5110. - CampaignDetailFunctionUri=${ESHOP_AZUREFUNC_CAMPAIGN_DETAILS_URI} - - PicBaseUrl=${ESHOP_AZURE_STORAGE_MARKETING:-http://localhost:5110/api/v1/pic/} + - PicBaseUrl=${ESHOP_AZURE_STORAGE_MARKETING} - AzureStorageAccountName=${ESHOP_AZURE_STORAGE_MARKETING_NAME} - AzureStorageAccountKey=${ESHOP_AZURE_STORAGE_MARKETING_KEY} ports: diff --git a/src/Services/Catalog/Catalog.API/Controllers/CatalogController.cs b/src/Services/Catalog/Catalog.API/Controllers/CatalogController.cs index ca1ef9e3b..fe52b9128 100644 --- a/src/Services/Catalog/Catalog.API/Controllers/CatalogController.cs +++ b/src/Services/Catalog/Catalog.API/Controllers/CatalogController.cs @@ -232,13 +232,12 @@ namespace Microsoft.eShopOnContainers.Services.Catalog.API.Controllers private List ChangeUriPlaceholder(List items) { var baseUri = _settings.PicBaseUrl; - + items.ForEach(catalogItem => { catalogItem.PictureUri = _settings.AzureStorageEnabled ? baseUri + catalogItem.PictureFileName - : baseUri + catalogItem.Id; - + : baseUri.Replace("[0]", catalogItem.Id.ToString()); }); return items; diff --git a/src/Services/Catalog/Catalog.API/Controllers/PicController.cs b/src/Services/Catalog/Catalog.API/Controllers/PicController.cs index 75029dc95..7043ce9f7 100644 --- a/src/Services/Catalog/Catalog.API/Controllers/PicController.cs +++ b/src/Services/Catalog/Catalog.API/Controllers/PicController.cs @@ -9,7 +9,6 @@ using System.Threading.Tasks; namespace Microsoft.eShopOnContainers.Services.Catalog.API.Controllers { - [Route("api/v1/[controller]")] public class PicController : Controller { private readonly IHostingEnvironment _env; @@ -22,17 +21,18 @@ namespace Microsoft.eShopOnContainers.Services.Catalog.API.Controllers _catalogContext = catalogContext; } - [HttpGet("{id}")] + [HttpGet] + [Route("api/v1/catalog/items/{catalogItemId:int}/pic")] // GET: // - public async Task GetImage(int id) + public async Task GetImage(int catalogItemId) { - if (id <= 0) + if (catalogItemId <= 0) { return BadRequest(); } var item = await _catalogContext.CatalogItems - .SingleOrDefaultAsync(ci => ci.Id == id); + .SingleOrDefaultAsync(ci => ci.Id == catalogItemId); if (item != null) { diff --git a/src/Services/Catalog/Catalog.API/settings.json b/src/Services/Catalog/Catalog.API/settings.json index b6dc3b5f7..dafeca845 100644 --- a/src/Services/Catalog/Catalog.API/settings.json +++ b/src/Services/Catalog/Catalog.API/settings.json @@ -1,6 +1,6 @@ { "ConnectionString": "Server=tcp:127.0.0.1,5433;Initial Catalog=Microsoft.eShopOnContainers.Services.CatalogDb;User Id=sa;Password=Pass@word", - "PicBaseUrl": "http://localhost:5101", + "PicBaseUrl": "http://localhost:5101/api/v1/catalog/items/[0]/pic/", "UseCustomizationData": false, "Logging": { "IncludeScopes": false, diff --git a/src/Services/Marketing/Marketing.API/Controllers/CampaignsController.cs b/src/Services/Marketing/Marketing.API/Controllers/CampaignsController.cs index ff7abcd45..146802626 100644 --- a/src/Services/Marketing/Marketing.API/Controllers/CampaignsController.cs +++ b/src/Services/Marketing/Marketing.API/Controllers/CampaignsController.cs @@ -221,7 +221,7 @@ namespace Microsoft.eShopOnContainers.Services.Marketing.API.Controllers return _settings.AzureStorageEnabled ? baseUri + campaign.PictureName - : baseUri + campaign.Id; + : baseUri.Replace("[0]", campaign.Id.ToString()); } } } \ No newline at end of file diff --git a/src/Services/Marketing/Marketing.API/appsettings.json b/src/Services/Marketing/Marketing.API/appsettings.json index 0137a2ae8..21aae065a 100644 --- a/src/Services/Marketing/Marketing.API/appsettings.json +++ b/src/Services/Marketing/Marketing.API/appsettings.json @@ -5,12 +5,13 @@ "Default": "Warning" } }, - "ConnectionString": "127.0.0.1", + "ConnectionString": "Server=tcp:127.0.0.1,5433;Initial Catalog=Microsoft.eShopOnContainers.Services.MarketingDb;User Id=sa;Password=Pass@word", "MongoConnectionString": "mongodb://nosql.data", "MongoDatabase": "MarketingDb", "IdentityUrl": "http://localhost:5105", - "ExternalCatalogBaseUrl": "http://localhost:5110", + "PicBaseUrl": "http://localhost:5110/api/v1/campaigns/[0]/pic/", "AzureServiceBusEnabled": false, "SubscriptionClientName": "Marketing", "AzureStorageEnabled": false + } From 0546040ebc0d4d75eb9773ed2a7a9b72bfcffd40 Mon Sep 17 00:00:00 2001 From: Christian Arenas Date: Tue, 11 Jul 2017 12:43:29 +0200 Subject: [PATCH 2/2] Modify the mvc client id to mvctest client --- test/Services/LoadTest/Basket.API/AddBasket.webtest | 12 ++++++------ test/Services/LoadTest/Basket.API/Checkout.webtest | 12 ++++++------ .../LoadTest/Basket.API/DeleteBasket.webtest | 12 ++++++------ test/Services/LoadTest/Basket.API/GetBasket.webtest | 12 ++++++------ .../Location.API/CreateOrUpdateUserLocation.webtest | 12 ++++++------ .../LoadTest/Location.API/GetAllLocations.webtest | 12 ++++++------ .../LoadTest/Location.API/GetLocation.webtest | 12 ++++++------ .../LoadTest/Location.API/GetUserLocation.webtest | 12 ++++++------ .../LoadTest/Marketing.API/GetAllCampaigns.webtest | 12 ++++++------ .../LoadTest/Marketing.API/GetCampaign.webtest | 12 ++++++------ .../LoadTest/Marketing.API/GetUserCampaigns.webtest | 12 ++++++------ .../LoadTest/Ordering.API/CancelOrder.webtest | 12 ++++++------ .../LoadTest/Ordering.API/GetAllOrders.webtest | 12 ++++++------ .../LoadTest/Ordering.API/GetCardTypes.webtest | 12 ++++++------ test/Services/LoadTest/Ordering.API/GetOrder.webtest | 12 ++++++------ .../Services/LoadTest/Ordering.API/ShipOrder.webtest | 12 ++++++------ .../LoadTest/WebMVC/AddProductsWithLogin.webtest | 12 ++++++------ test/Services/LoadTest/WebMVC/CatalogFilter.webtest | 12 ++++++------ test/Services/LoadTest/WebMVC/CreateNewOrder.webtest | 12 ++++++------ test/Services/LoadTest/WebMVC/LoginAndLogout.webtest | 12 ++++++------ 20 files changed, 120 insertions(+), 120 deletions(-) diff --git a/test/Services/LoadTest/Basket.API/AddBasket.webtest b/test/Services/LoadTest/Basket.API/AddBasket.webtest index b50f64aef..2f7b209e9 100644 --- a/test/Services/LoadTest/Basket.API/AddBasket.webtest +++ b/test/Services/LoadTest/Basket.API/AddBasket.webtest @@ -1,7 +1,7 @@  - +
@@ -27,9 +27,9 @@ - + -
+
@@ -40,10 +40,10 @@ - + - + @@ -52,7 +52,7 @@ -
+
diff --git a/test/Services/LoadTest/Basket.API/Checkout.webtest b/test/Services/LoadTest/Basket.API/Checkout.webtest index a387f9c02..dce57e7ed 100644 --- a/test/Services/LoadTest/Basket.API/Checkout.webtest +++ b/test/Services/LoadTest/Basket.API/Checkout.webtest @@ -1,7 +1,7 @@  - +
@@ -27,9 +27,9 @@ - + -
+
@@ -40,10 +40,10 @@ - + - + @@ -52,7 +52,7 @@ -
+
diff --git a/test/Services/LoadTest/Basket.API/DeleteBasket.webtest b/test/Services/LoadTest/Basket.API/DeleteBasket.webtest index b8a25d080..4734f6f3b 100644 --- a/test/Services/LoadTest/Basket.API/DeleteBasket.webtest +++ b/test/Services/LoadTest/Basket.API/DeleteBasket.webtest @@ -1,7 +1,7 @@  - +
@@ -27,9 +27,9 @@ - + -
+
@@ -40,10 +40,10 @@ - + - + @@ -52,7 +52,7 @@ -
+
diff --git a/test/Services/LoadTest/Basket.API/GetBasket.webtest b/test/Services/LoadTest/Basket.API/GetBasket.webtest index 79369ac0e..bceee151b 100644 --- a/test/Services/LoadTest/Basket.API/GetBasket.webtest +++ b/test/Services/LoadTest/Basket.API/GetBasket.webtest @@ -1,7 +1,7 @@  - +
@@ -27,9 +27,9 @@ - + -
+
@@ -40,10 +40,10 @@ - + - + @@ -52,7 +52,7 @@ -
+
diff --git a/test/Services/LoadTest/Location.API/CreateOrUpdateUserLocation.webtest b/test/Services/LoadTest/Location.API/CreateOrUpdateUserLocation.webtest index 2f8739585..d95b56cf8 100644 --- a/test/Services/LoadTest/Location.API/CreateOrUpdateUserLocation.webtest +++ b/test/Services/LoadTest/Location.API/CreateOrUpdateUserLocation.webtest @@ -1,7 +1,7 @@  - +
@@ -27,9 +27,9 @@ - + -
+
@@ -40,10 +40,10 @@ - + - + @@ -52,7 +52,7 @@ -
+
diff --git a/test/Services/LoadTest/Location.API/GetAllLocations.webtest b/test/Services/LoadTest/Location.API/GetAllLocations.webtest index a759235d3..6900daf36 100644 --- a/test/Services/LoadTest/Location.API/GetAllLocations.webtest +++ b/test/Services/LoadTest/Location.API/GetAllLocations.webtest @@ -1,7 +1,7 @@  - +
@@ -27,9 +27,9 @@ - + -
+
@@ -40,10 +40,10 @@ - + - + @@ -52,7 +52,7 @@ -
+
diff --git a/test/Services/LoadTest/Location.API/GetLocation.webtest b/test/Services/LoadTest/Location.API/GetLocation.webtest index 65148277e..bcaa470d7 100644 --- a/test/Services/LoadTest/Location.API/GetLocation.webtest +++ b/test/Services/LoadTest/Location.API/GetLocation.webtest @@ -1,7 +1,7 @@  - +
@@ -27,9 +27,9 @@ - + -
+
@@ -40,10 +40,10 @@ - + - + @@ -52,7 +52,7 @@ -
+
diff --git a/test/Services/LoadTest/Location.API/GetUserLocation.webtest b/test/Services/LoadTest/Location.API/GetUserLocation.webtest index e0d8aeeff..767580b71 100644 --- a/test/Services/LoadTest/Location.API/GetUserLocation.webtest +++ b/test/Services/LoadTest/Location.API/GetUserLocation.webtest @@ -1,7 +1,7 @@  - +
@@ -27,9 +27,9 @@ - + -
+
@@ -40,10 +40,10 @@ - + - + @@ -52,7 +52,7 @@ -
+
diff --git a/test/Services/LoadTest/Marketing.API/GetAllCampaigns.webtest b/test/Services/LoadTest/Marketing.API/GetAllCampaigns.webtest index 183c24a1f..462f44079 100644 --- a/test/Services/LoadTest/Marketing.API/GetAllCampaigns.webtest +++ b/test/Services/LoadTest/Marketing.API/GetAllCampaigns.webtest @@ -1,7 +1,7 @@  - +
@@ -27,9 +27,9 @@ - + -
+
@@ -40,10 +40,10 @@ - + - + @@ -52,7 +52,7 @@ -
+
diff --git a/test/Services/LoadTest/Marketing.API/GetCampaign.webtest b/test/Services/LoadTest/Marketing.API/GetCampaign.webtest index 3775e3694..2726b89a6 100644 --- a/test/Services/LoadTest/Marketing.API/GetCampaign.webtest +++ b/test/Services/LoadTest/Marketing.API/GetCampaign.webtest @@ -1,7 +1,7 @@  - +
@@ -27,9 +27,9 @@ - + -
+
@@ -40,10 +40,10 @@ - + - + @@ -52,7 +52,7 @@ -
+
diff --git a/test/Services/LoadTest/Marketing.API/GetUserCampaigns.webtest b/test/Services/LoadTest/Marketing.API/GetUserCampaigns.webtest index 28d898eeb..6978b6766 100644 --- a/test/Services/LoadTest/Marketing.API/GetUserCampaigns.webtest +++ b/test/Services/LoadTest/Marketing.API/GetUserCampaigns.webtest @@ -1,7 +1,7 @@  - +
@@ -27,9 +27,9 @@ - + -
+
@@ -40,10 +40,10 @@ - + - + @@ -52,7 +52,7 @@ -
+
diff --git a/test/Services/LoadTest/Ordering.API/CancelOrder.webtest b/test/Services/LoadTest/Ordering.API/CancelOrder.webtest index 2c4b39e9f..dc7d55244 100644 --- a/test/Services/LoadTest/Ordering.API/CancelOrder.webtest +++ b/test/Services/LoadTest/Ordering.API/CancelOrder.webtest @@ -1,7 +1,7 @@  - +
@@ -27,9 +27,9 @@ - + -
+
@@ -40,10 +40,10 @@ - + - + @@ -52,7 +52,7 @@ -
+
diff --git a/test/Services/LoadTest/Ordering.API/GetAllOrders.webtest b/test/Services/LoadTest/Ordering.API/GetAllOrders.webtest index fd30d2519..c9860e076 100644 --- a/test/Services/LoadTest/Ordering.API/GetAllOrders.webtest +++ b/test/Services/LoadTest/Ordering.API/GetAllOrders.webtest @@ -1,7 +1,7 @@  - +
@@ -27,9 +27,9 @@ - + -
+
@@ -40,10 +40,10 @@ - + - + @@ -52,7 +52,7 @@ -
+
diff --git a/test/Services/LoadTest/Ordering.API/GetCardTypes.webtest b/test/Services/LoadTest/Ordering.API/GetCardTypes.webtest index a07bf85f8..fb3ca3dc3 100644 --- a/test/Services/LoadTest/Ordering.API/GetCardTypes.webtest +++ b/test/Services/LoadTest/Ordering.API/GetCardTypes.webtest @@ -1,7 +1,7 @@  - +
@@ -27,9 +27,9 @@ - + -
+
@@ -40,10 +40,10 @@ - + - + @@ -52,7 +52,7 @@ -
+
diff --git a/test/Services/LoadTest/Ordering.API/GetOrder.webtest b/test/Services/LoadTest/Ordering.API/GetOrder.webtest index b3341290f..73024671b 100644 --- a/test/Services/LoadTest/Ordering.API/GetOrder.webtest +++ b/test/Services/LoadTest/Ordering.API/GetOrder.webtest @@ -1,7 +1,7 @@  - +
@@ -27,9 +27,9 @@ - + -
+
@@ -40,10 +40,10 @@ - + - + @@ -52,7 +52,7 @@ -
+
diff --git a/test/Services/LoadTest/Ordering.API/ShipOrder.webtest b/test/Services/LoadTest/Ordering.API/ShipOrder.webtest index bdeaae363..85e6ed92d 100644 --- a/test/Services/LoadTest/Ordering.API/ShipOrder.webtest +++ b/test/Services/LoadTest/Ordering.API/ShipOrder.webtest @@ -1,7 +1,7 @@  - +
@@ -27,9 +27,9 @@ - + -
+
@@ -40,10 +40,10 @@ - + - + @@ -52,7 +52,7 @@ -
+
diff --git a/test/Services/LoadTest/WebMVC/AddProductsWithLogin.webtest b/test/Services/LoadTest/WebMVC/AddProductsWithLogin.webtest index eb1110ef6..12df248d8 100644 --- a/test/Services/LoadTest/WebMVC/AddProductsWithLogin.webtest +++ b/test/Services/LoadTest/WebMVC/AddProductsWithLogin.webtest @@ -1,7 +1,7 @@  - +
@@ -27,9 +27,9 @@ - + -
+
@@ -40,10 +40,10 @@ - + - + @@ -52,7 +52,7 @@ -
+
diff --git a/test/Services/LoadTest/WebMVC/CatalogFilter.webtest b/test/Services/LoadTest/WebMVC/CatalogFilter.webtest index 62d76dd3d..5be4227b7 100644 --- a/test/Services/LoadTest/WebMVC/CatalogFilter.webtest +++ b/test/Services/LoadTest/WebMVC/CatalogFilter.webtest @@ -1,7 +1,7 @@  - +
@@ -27,9 +27,9 @@ - + -
+
@@ -40,10 +40,10 @@ - + - + @@ -52,7 +52,7 @@ -
+
diff --git a/test/Services/LoadTest/WebMVC/CreateNewOrder.webtest b/test/Services/LoadTest/WebMVC/CreateNewOrder.webtest index 43d515fee..7cf3b32d9 100644 --- a/test/Services/LoadTest/WebMVC/CreateNewOrder.webtest +++ b/test/Services/LoadTest/WebMVC/CreateNewOrder.webtest @@ -1,7 +1,7 @@  - +
@@ -27,9 +27,9 @@ - + -
+
@@ -40,10 +40,10 @@ - + - + @@ -52,7 +52,7 @@ -
+
diff --git a/test/Services/LoadTest/WebMVC/LoginAndLogout.webtest b/test/Services/LoadTest/WebMVC/LoginAndLogout.webtest index 5475d5695..09eb965c9 100644 --- a/test/Services/LoadTest/WebMVC/LoginAndLogout.webtest +++ b/test/Services/LoadTest/WebMVC/LoginAndLogout.webtest @@ -1,7 +1,7 @@  - +
@@ -27,9 +27,9 @@ - + -
+
@@ -40,10 +40,10 @@ - + - + @@ -52,7 +52,7 @@ -
+