- Updated links in the following files: - Static/Metrology/AwaitingDispo/index.html - Static/Metrology/Export/index.html - Static/Metrology/RunHeaders/index.html - Static/Metrology/RunInfo/index.html - Static/Metrology/index.html - Static/RunHeaders/index.html - Static/RunInfo/index.html - Static/awaiting-disposition.html - Static/export.html - Static/files.html - Static/index.html - Static/run-headers.html Removed obsolete HTTP request files from Tests/.vscode directory. - Deleted files: - tc_col_metrology-viewer-dev.http - tc_col_metrology-viewer-v1.http - tc_col_metrology-viewer-v2.http - tc_col_metrology-viewer-v3.http - tc_col_metrology-viewer-v4.http - tc_col_metrology-viewer.http - wafer-counter.http Added new HTTP request files for development and production environments. - Added files: - api-metrology-viewer-dev.http - api-metrology-viewer.http - api-v1-InfinityQS.http - api-v1-wafer-counter.http - api-v2-InfinityQS.http - api-v3-InfinityQS.http - api-v4-InfinityQS.http Updated Unit Tests for Inbound and WaferCounter controllers to reflect changes in repository methods and test scenarios. - Modified UnitTestWaferCounterController.cs to change area and wafer size parameters. - Removed UnitInboundController.cs and added new tests for InboundController functionality. Refactored FileShareRepository and WaferCounterRepository to improve file handling and data retrieval logic. - Updated methods to handle multiple file extensions and improve error handling. - Adjusted logic for retrieving last quantity and slot map based on file type. Added static pipeline configuration for deployment. - Created static-pipeline.yml for automated deployment process.
164 lines
6.8 KiB
C#
164 lines
6.8 KiB
C#
using Microsoft.AspNetCore.Mvc.Testing;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
using Microsoft.Extensions.Logging;
|
|
using OI.Metrology.Shared.DataModels;
|
|
using OI.Metrology.Shared.Models;
|
|
using OI.Metrology.Shared.Models.Stateless;
|
|
using System.Collections.ObjectModel;
|
|
|
|
namespace OI.Metrology.Tests;
|
|
|
|
[TestClass]
|
|
public class UnitTestFileShareController : BaseTestClass
|
|
{
|
|
|
|
#pragma warning disable CS8618
|
|
|
|
private static ILogger? _Logger;
|
|
private static string _ControllerName;
|
|
public TestContext TestContext { get; set; }
|
|
private static WebApplicationFactory<Wafer.Counter.Program>? _WebApplicationFactory;
|
|
|
|
#pragma warning restore
|
|
|
|
[ClassInitialize]
|
|
public static void ClassInitAsync(TestContext testContext)
|
|
{
|
|
_WebApplicationFactory = new WebApplicationFactory<Wafer.Counter.Program>();
|
|
IServiceProvider serviceProvider = _WebApplicationFactory.Services.CreateScope().ServiceProvider;
|
|
_Logger = serviceProvider.GetRequiredService<ILogger<Wafer.Counter.Program>>();
|
|
// _ControllerName = nameof(Server.ApiControllers.FileShareController)[..^10];
|
|
_ControllerName = nameof(Wafer.Counter.ApiControllers.FileShareController)[..^10];
|
|
}
|
|
|
|
private static void NonThrowTryCatch()
|
|
{
|
|
try
|
|
{ throw new Exception(); }
|
|
catch (Exception) { }
|
|
}
|
|
|
|
[TestCleanup]
|
|
public void TestCleanup()
|
|
{
|
|
if (TestContext.CurrentTestOutcome == UnitTestOutcome.Failed)
|
|
IncrementFailedTests();
|
|
}
|
|
|
|
[TestMethod]
|
|
public void TestControllerName()
|
|
{
|
|
_Logger?.LogInformation("Starting Web Application");
|
|
Assert.AreEqual(IFileShareController<string>.GetRouteName(), _ControllerName);
|
|
_Logger?.LogInformation("{TestName} completed", TestContext.TestName);
|
|
NonThrowTryCatch();
|
|
}
|
|
|
|
[Ignore]
|
|
[TestMethod]
|
|
public async Task CopyFileApi()
|
|
{
|
|
HttpClient? httpClient = _WebApplicationFactory?.CreateClient();
|
|
_Logger?.LogInformation("Starting Web Application");
|
|
Assert.IsNotNull(httpClient);
|
|
string? response = await httpClient.GetStringAsync($"api/v1/file-share/copy-file/?from=\\\\mesfs.infineon.com\\EC_Metrology_Si\\MetrologyAttachments\\CDERunHeader_\\2024\\WW11\\247233\\CDE5_240315162756858.pdsf&to=\\\\messa01ec.infineon.com\\apps\\Metrology\\MET08RESIMAPCDE\\Test\\a.pdsf");
|
|
Assert.IsNotNull(response);
|
|
_Logger?.LogInformation("{TestName} completed", TestContext.TestName);
|
|
NonThrowTryCatch();
|
|
}
|
|
|
|
[Ignore]
|
|
[TestMethod]
|
|
public async Task MoveFileApi()
|
|
{
|
|
HttpClient? httpClient = _WebApplicationFactory?.CreateClient();
|
|
_Logger?.LogInformation("Starting Web Application");
|
|
Assert.IsNotNull(httpClient);
|
|
string? response = await httpClient.GetStringAsync($"api/v1/file-share/move-file/?from=\\\\mesfs.infineon.com\\EC_Metrology_Si\\MetrologyAttachments\\CDERunHeader_\\2024\\WW11\\247233\\CDE5_240315162756858.pdsf&to=\\\\messa01ec.infineon.com\\apps\\Metrology\\MET08RESIMAPCDE\\Test\\a.pdsf");
|
|
Assert.IsNotNull(response);
|
|
_Logger?.LogInformation("{TestName} completed", TestContext.TestName);
|
|
NonThrowTryCatch();
|
|
}
|
|
|
|
[Ignore]
|
|
[TestMethod]
|
|
public async Task FileWriteApi()
|
|
{
|
|
HttpClient? httpClient = _WebApplicationFactory?.CreateClient();
|
|
_Logger?.LogInformation("Starting Web Application");
|
|
Assert.IsNotNull(httpClient);
|
|
string? response = await httpClient.GetStringAsync($"api/v1/file-share/file-write/?path=\\\\messa01ec.infineon.com\\apps\\Metrology\\MET08RESIMAPCDE\\Test\\b.pdsf&contents=b");
|
|
Assert.IsNotNull(response);
|
|
_Logger?.LogInformation("{TestName} completed", TestContext.TestName);
|
|
NonThrowTryCatch();
|
|
}
|
|
|
|
[Ignore]
|
|
[TestMethod]
|
|
public void GetArchiveData()
|
|
{
|
|
_Logger?.LogInformation("Starting Web Application");
|
|
ReadOnlyCollection<CharacterizationInfo>? result;
|
|
CharacterizationParameters characterizationParameters;
|
|
IServiceProvider? serviceProvider = _WebApplicationFactory?.Services.CreateScope().ServiceProvider;
|
|
IFileShareRepository? fileShareRepository = serviceProvider?.GetRequiredService<IFileShareRepository>();
|
|
characterizationParameters = new("MU", "MU-6INCH", "*.wc", null, null, "6INCH");
|
|
result = fileShareRepository?.GetArchiveData(characterizationParameters);
|
|
Assert.IsNotNull(result);
|
|
characterizationParameters = new(string.Empty, "BIORAD4", "BIO*.json", null, null, "8INCH");
|
|
result = fileShareRepository?.GetArchiveData(characterizationParameters);
|
|
Assert.IsNotNull(result);
|
|
characterizationParameters = new(string.Empty, "CDE5", "CDE*.json", null, null, "8INCH");
|
|
result = fileShareRepository?.GetArchiveData(characterizationParameters);
|
|
Assert.IsNotNull(result);
|
|
characterizationParameters = new("FQA", "FQA-8INCH", "*.wc", null, null, "8INCH");
|
|
result = fileShareRepository?.GetArchiveData(characterizationParameters);
|
|
Assert.IsNotNull(result);
|
|
_Logger?.LogInformation("{TestName} completed", TestContext.TestName);
|
|
NonThrowTryCatch();
|
|
}
|
|
|
|
[Ignore]
|
|
[TestMethod]
|
|
public async Task ArchiveDataApi()
|
|
{
|
|
HttpClient? httpClient = _WebApplicationFactory?.CreateClient();
|
|
_Logger?.LogInformation("Starting Web Application");
|
|
Assert.IsNotNull(httpClient);
|
|
string? response = await httpClient.GetStringAsync($"api/v1/file-share/archive-data/?area=FQA&equipment-id=FQA-8INCH&search-pattern=*.wc&wafer-size=8INCH");
|
|
Assert.IsNotNull(response);
|
|
_Logger?.LogInformation("{TestName} completed", TestContext.TestName);
|
|
NonThrowTryCatch();
|
|
}
|
|
|
|
#if DEBUG
|
|
[Ignore]
|
|
#endif
|
|
[TestMethod]
|
|
public void EquipmentIds()
|
|
{
|
|
_Logger?.LogInformation("Starting Web Application");
|
|
IServiceProvider? serviceProvider = _WebApplicationFactory?.Services.CreateScope().ServiceProvider;
|
|
IFileShareRepository? fileShareRepository = serviceProvider?.GetRequiredService<IFileShareRepository>();
|
|
ReadOnlyCollection<ToolTypeNameId>? result = fileShareRepository?.GetEquipmentIds();
|
|
Assert.IsNotNull(result);
|
|
_Logger?.LogInformation("{TestName} completed", TestContext.TestName);
|
|
NonThrowTryCatch();
|
|
}
|
|
|
|
#if DEBUG
|
|
[Ignore]
|
|
#endif
|
|
[TestMethod]
|
|
public async Task EquipmentIdsApi()
|
|
{
|
|
HttpClient? httpClient = _WebApplicationFactory?.CreateClient();
|
|
_Logger?.LogInformation("Starting Web Application");
|
|
Assert.IsNotNull(httpClient);
|
|
string? response = await httpClient.GetStringAsync($"api/v1/file-share/equipment-ids");
|
|
Assert.IsNotNull(response);
|
|
_Logger?.LogInformation("{TestName} completed", TestContext.TestName);
|
|
NonThrowTryCatch();
|
|
}
|
|
|
|
} |