Compare commits
17 Commits
refactored
...
dev-mkoebi
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
9da47f12d0 | ||
|
|
7fabc97d70 | ||
|
|
389f79f83f | ||
|
|
e0ab40c374 | ||
|
|
6fffa3d961 | ||
|
|
5c423f348d | ||
|
|
c6abfd98ce | ||
|
|
b266a527be | ||
| f720f37f09 | |||
| e4f2717423 | |||
| f758abbc21 | |||
| f98995332c | |||
| 2505c6ddcd | |||
| 818089917d | |||
| b6adf386f5 | |||
| f07d3e62a8 | |||
|
|
1beaca2622 |
1
.gitignore
vendored
1
.gitignore
vendored
@@ -2,6 +2,7 @@
|
||||
## Ignore Visual Studio temporary files, build results, and
|
||||
## files generated by popular Visual Studio add-ons.
|
||||
##
|
||||
##
|
||||
## Get latest from https://github.com/github/gitignore/blob/main/VisualStudio.gitignore
|
||||
|
||||
# User-specific files
|
||||
|
||||
@@ -12,7 +12,7 @@ namespace Hochbaustatistik.Testing
|
||||
public class DatabaseOperationsTests
|
||||
{
|
||||
|
||||
[Fact]//(Skip ="Keine Datenbank-Verbindung m<>glich")]
|
||||
[Fact (Skip ="Keine Datenbank-Verbindung m<>glich")]
|
||||
public void ConnectAndExecuteHochbauTest()
|
||||
{
|
||||
DatabaseOperations.conString = "Data Source=(DESCRIPTION=(ADDRESS=(PROTOCOL=TCP)(HOST=dborap04.stadtdo.de)(PORT=1521))(CONNECT_DATA=(SERVICE_NAME=bgvp.stadtdo.de)));user id=leser;password=leser;";
|
||||
|
||||
@@ -11,7 +11,7 @@ namespace Hochbaustatistik.Testing
|
||||
{
|
||||
public class EmailTests
|
||||
{
|
||||
[Theory(Skip = "Kein lotus installiert")]
|
||||
[Theory(Skip = "Kein Lotus Notes installiert")]
|
||||
[InlineData(@"C:\TEMP\test.txt")]
|
||||
public void SenMailTest(string attachment)
|
||||
{
|
||||
|
||||
@@ -14,7 +14,6 @@ namespace Hochbaustatistik.Testing.Utilities
|
||||
{
|
||||
public class DataOpsTest
|
||||
{
|
||||
readonly string sourceFile = @"TestData\TestData.csv";
|
||||
public readonly VorgangInpro vorgang = new VorgangInpro() { Schlussabnahme = "2022" };
|
||||
|
||||
[Theory]
|
||||
@@ -119,7 +118,7 @@ namespace Hochbaustatistik.Testing.Utilities
|
||||
Assert.Equal(expected2, actuals.ElementAt(1));
|
||||
}
|
||||
|
||||
[Fact]
|
||||
[Fact(Skip = "Keine Datenbank-Verbindung möglich")]
|
||||
public void MergeInproWithITNRWTest()
|
||||
{
|
||||
var resultFile = @"C:\TEMP\hochbaustatistik.csv";
|
||||
|
||||
@@ -20,7 +20,7 @@ namespace Hochbaustatistik.Testing
|
||||
public class WebTesting
|
||||
{
|
||||
|
||||
[Fact (Skip ="Keine Daten zum Download vorhanden")]
|
||||
[Fact (Skip ="Derzeit keine Daten zum Download vorhanden")]
|
||||
public void DownloadList()
|
||||
{
|
||||
//DownloadFolder
|
||||
@@ -58,7 +58,7 @@ namespace Hochbaustatistik.Testing
|
||||
driver.Quit();
|
||||
|
||||
Assert.True(File.Exists(pathDownloadedList));
|
||||
//File.Delete(pathDownloadedList);
|
||||
File.Delete(pathDownloadedList);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -60,7 +60,7 @@ namespace Hochbaustatistik.Business
|
||||
#region Methods
|
||||
string ReplaceHiphenWithSlash(string aktenzeichen)
|
||||
{
|
||||
var regex = new Regex(Regex.Escape("-"));
|
||||
var regex = new Regex(Regex.Escape("-"),RegexOptions.None,TimeSpan.FromMilliseconds(5));
|
||||
string res = regex.Replace(aktenzeichen, "/", 1);
|
||||
return res;
|
||||
}
|
||||
|
||||
@@ -1,5 +1,6 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
using System.Text;
|
||||
|
||||
@@ -65,6 +66,7 @@ namespace Hochbaustatistik.Business
|
||||
public string Aktenstandort { get; set; }
|
||||
#endregion
|
||||
|
||||
[ExcludeFromCodeCoverage]
|
||||
public override string GenerateVorgang(Vorgang v)
|
||||
{
|
||||
StringBuilder sbInpro = new StringBuilder();
|
||||
|
||||
@@ -92,81 +92,27 @@ namespace Hochbaustatistik.Database
|
||||
vorgangInproHochbau.ZdA = reader.GetValue(6).ToString();
|
||||
|
||||
vorgangInproHochbau.Eingangsdatum = reader.GetValue(7).ToString().Split(' ').FirstOrDefault();
|
||||
var tempDate = reader.GetValue(8).ToString();
|
||||
|
||||
if (tempDate == null)
|
||||
{
|
||||
vorgangInproHochbau.Genehmigung = "";
|
||||
}
|
||||
else
|
||||
{
|
||||
vorgangInproHochbau.Genehmigung = tempDate.Split(' ').FirstOrDefault();
|
||||
}
|
||||
vorgangInproHochbau.Genehmigung = reader.GetValue(8).ToString() == null ? "" : reader.GetValue(8).ToString().Split(' ').FirstOrDefault();
|
||||
|
||||
vorgangInproHochbau.Freigabe = reader.GetValue(9).ToString();
|
||||
vorgangInproHochbau.Statistik_Relevant = reader.GetValue(10).ToString();
|
||||
vorgangInproHochbau.Statistik1 = reader.GetValue(11).ToString();
|
||||
vorgangInproHochbau.Statistik2 = reader.GetValue(12).ToString();
|
||||
|
||||
tempDate = reader.GetValue(13).ToString();
|
||||
if (tempDate == null)
|
||||
{
|
||||
vorgangInproHochbau.Genehmigung_Gemeldet = "";
|
||||
}
|
||||
else
|
||||
{
|
||||
vorgangInproHochbau.Genehmigung_Gemeldet = tempDate.Split(' ').FirstOrDefault();
|
||||
}
|
||||
vorgangInproHochbau.Genehmigung_Gemeldet = reader.GetValue(13).ToString() == null ? "" : reader.GetValue(13).ToString().Split(' ').FirstOrDefault();
|
||||
|
||||
tempDate = reader.GetValue(14).ToString();
|
||||
if (tempDate == null)
|
||||
{
|
||||
vorgangInproHochbau.Fertigstellung_Gemeldet = "";
|
||||
}
|
||||
else
|
||||
{
|
||||
vorgangInproHochbau.Fertigstellung_Gemeldet = tempDate.Split(' ').FirstOrDefault();
|
||||
}
|
||||
vorgangInproHochbau.Fertigstellung_Gemeldet = reader.GetValue(14).ToString() == null ? "" : reader.GetValue(14).ToString().Split(' ').FirstOrDefault();
|
||||
vorgangInproHochbau.Baubeginn = reader.GetValue(15).ToString() == null ? "" : reader.GetValue(15).ToString().Split(' ').FirstOrDefault();
|
||||
|
||||
tempDate = reader.GetValue(15).ToString();
|
||||
if (tempDate == null)
|
||||
{
|
||||
vorgangInproHochbau.Baubeginn = "";
|
||||
}
|
||||
else
|
||||
{
|
||||
vorgangInproHochbau.Baubeginn = tempDate.Split(' ').FirstOrDefault();
|
||||
}
|
||||
tempDate = reader.GetValue(16).ToString();
|
||||
if (tempDate == null)
|
||||
{
|
||||
vorgangInproHochbau.Teilrohbauabnahme = "";
|
||||
}
|
||||
else
|
||||
{
|
||||
vorgangInproHochbau.Teilrohbauabnahme = tempDate.Split(' ').FirstOrDefault();
|
||||
}
|
||||
vorgangInproHochbau.Teilrohbauabnahme = reader.GetValue(16).ToString() == null ? "" : reader.GetValue(16).ToString().Split(' ').FirstOrDefault();
|
||||
|
||||
tempDate = reader.GetValue(17).ToString();
|
||||
if (tempDate == null)
|
||||
{
|
||||
vorgangInproHochbau.Rohbauabnahme = "";
|
||||
}
|
||||
else
|
||||
{
|
||||
vorgangInproHochbau.Rohbauabnahme = tempDate.Split(' ').FirstOrDefault();
|
||||
}
|
||||
vorgangInproHochbau.Rohbauabnahme = reader.GetValue(17).ToString() == null ? "" : reader.GetValue(17).ToString().Split(' ').FirstOrDefault();
|
||||
|
||||
tempDate = reader.GetValue(18).ToString();
|
||||
if (tempDate == null)
|
||||
{
|
||||
vorgangInproHochbau.Schlussabnahme = "";
|
||||
}
|
||||
else
|
||||
{
|
||||
vorgangInproHochbau.Schlussabnahme = tempDate.Split(' ').FirstOrDefault();
|
||||
}
|
||||
vorgangInproHochbau.Schlussabnahme = reader.GetValue(18).ToString() == null ? "" : reader.GetValue(18).ToString().Split(' ').FirstOrDefault();
|
||||
|
||||
|
||||
string tempDate = string.Empty;
|
||||
if (tempDate == null)
|
||||
{
|
||||
vorgangInproHochbau.Vorjahr = "";
|
||||
|
||||
@@ -77,19 +77,6 @@ namespace Hochbaustatistik.Utilities
|
||||
return az;
|
||||
}
|
||||
|
||||
[ExcludeFromCodeCoverage]
|
||||
public string ApplyLastAzToNewAz(string az, string currentName, string currentStrasse, LastData ld)
|
||||
{
|
||||
int linguName = String.Compare(currentName, ld.name, StringComparison.InvariantCultureIgnoreCase);
|
||||
int linguStrasse = String.Compare(currentStrasse, ld.strasse, StringComparison.InvariantCultureIgnoreCase);
|
||||
|
||||
if (linguName > 0 || linguStrasse > 0)
|
||||
{
|
||||
az = ld.az;
|
||||
}
|
||||
return az;
|
||||
}
|
||||
|
||||
[ExcludeFromCodeCoverage]
|
||||
private void CheckForDoubleSlashAndCorrect(ref string az)
|
||||
{
|
||||
@@ -186,7 +173,7 @@ namespace Hochbaustatistik.Utilities
|
||||
public bool IsValid(string az)
|
||||
{
|
||||
string pattern = @"\b(61[/][0-9]{1}[-][0-9]{1}[-][0-9]{6})";
|
||||
Regex r = new Regex(pattern);
|
||||
Regex r = new Regex(pattern,RegexOptions.None, TimeSpan.FromMilliseconds(5));
|
||||
bool matched = r.IsMatch(az);
|
||||
bool len = az.Length == 13;
|
||||
if (matched && len)
|
||||
@@ -299,8 +286,7 @@ namespace Hochbaustatistik.Utilities
|
||||
VorgangInpro vorgangHochbauInpro = DatabaseOperations.ConnectAndExecuteHochbau(vorgang);
|
||||
if (vorgangHochbauInpro.IdStrasse == null)
|
||||
{
|
||||
vorgangHochbauInpro = DatabaseOperations.ConnectAndExecuteHochbau(vorgang, Convert.ToInt32(identifikator));// Convert.ToInt32(ReshapeIdentifikator(hochbauListe.ElementAt(record).Identifikator)));
|
||||
|
||||
vorgangHochbauInpro = DatabaseOperations.ConnectAndExecuteHochbau(vorgang, Convert.ToInt32(identifikator));
|
||||
}
|
||||
if (vorgang.Aktenzeichen.Equals("NOT_CORRECTED"))
|
||||
{
|
||||
@@ -316,7 +302,7 @@ namespace Hochbaustatistik.Utilities
|
||||
}
|
||||
#endregion
|
||||
|
||||
private class Nested
|
||||
private static class Nested
|
||||
{
|
||||
// Tell C# compiler not to mark type as beforefieldinit (https://csharpindepth.com/articles/BeforeFieldInit)
|
||||
static Nested()
|
||||
@@ -332,12 +318,4 @@ namespace Hochbaustatistik.Utilities
|
||||
_logger.Info("Singleton erzeugt.");
|
||||
}
|
||||
}
|
||||
|
||||
public struct LastData
|
||||
{
|
||||
public string az;
|
||||
public string ident;
|
||||
public string name;
|
||||
public string strasse;
|
||||
}
|
||||
}
|
||||
|
||||
57
Hochbaustatistik/config/Jenkinsfile
vendored
57
Hochbaustatistik/config/Jenkinsfile
vendored
@@ -4,7 +4,7 @@ pipeline
|
||||
{
|
||||
node
|
||||
{
|
||||
label 'Jenkins_Homer'
|
||||
label 'jenkins_homer_agent'
|
||||
}
|
||||
}
|
||||
stages
|
||||
@@ -14,17 +14,14 @@ pipeline
|
||||
environment
|
||||
{
|
||||
dotnet ="C:\\Program Files\\dotnet\\"
|
||||
scannerHome = "C:\\home\\jenkins\\tools\\hudson.plugins.sonar.MsBuildSQRunnerInstallation\\C_sonar-runner"
|
||||
token = 'sqa_71202f188aacbe40492ba767cf3e841179d3f41a'
|
||||
project = 'hochbaustatistik'
|
||||
|
||||
}
|
||||
steps
|
||||
{
|
||||
cleanWs()
|
||||
checkout scm
|
||||
bat "dotnet restore Hochbaustatistik\\Hochbaustatistik.sln"
|
||||
bat "${scannerHome}\\SonarScanner.MSBuild.exe begin /k:${project} /d:sonar.login=${token} /d:sonar.verbose=true /d:sonar.cs.opencover.reportsPaths=${WORKSPACE}\\coverage.xml"
|
||||
bat "\"${tool 'MSBuild17'}\" ${WORKSPACE}\\Hochbaustatistik\\Hochbaustatistik.sln /t:Restore /t:Rebuild /p:Configuration=Debug"
|
||||
bat "dotnet restore Hochbaustatistik.sln"
|
||||
bat "\"${tool 'MSBuild17'}\" ${WORKSPACE}\\Hochbaustatistik.sln /t:Restore /t:Rebuild /p:Configuration=Debug"
|
||||
}
|
||||
}
|
||||
stage('Test')
|
||||
@@ -37,39 +34,25 @@ pipeline
|
||||
{
|
||||
catchError(buildResult: 'SUCCESS', stageResult: 'FAILURE')
|
||||
{
|
||||
bat "dotnet test ${WORKSPACE}\\Hochbaustatistik\\Hochbaustatistik.Testing\\Hochbaustatistik.Testing.csproj /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:CoverletOutput=..\\..\\coverage.xml /p:Exclude=[Scan2Compress.GUI]*%2c[Scan2Compress.Properties]* --no-build"
|
||||
bat "dotnet test ${WORKSPACE}\\Hochbaustatistik.Testing\\Hochbaustatistik.Testing.csproj /p:CollectCoverage=true /p:CoverletOutputFormat=opencover /p:CoverletOutput=..\\..\\coverage.xml /p:Exclude=[Scan2Compress.GUI]*%2c[Scan2Compress.Properties]* --no-build"
|
||||
}
|
||||
}
|
||||
}
|
||||
stage('SonarQube')
|
||||
{
|
||||
environment
|
||||
{
|
||||
scannerHome = "C:\\home\\jenkins\\tools\\hudson.plugins.sonar.MsBuildSQRunnerInstallation\\C_sonar-runner"
|
||||
token = 'sqa_71202f188aacbe40492ba767cf3e841179d3f41a'
|
||||
project = 'hochbaustatistik'
|
||||
stage('SonarQube')
|
||||
{
|
||||
environment
|
||||
{
|
||||
scannerHome = tool 'sonar-scanner4.4'
|
||||
project = 'hochbaustatistik'
|
||||
token = 'sqa_07d4e3802cf6283fc38a002e75bd0a5eb158af87'
|
||||
}
|
||||
steps
|
||||
{
|
||||
bat "${scannerHome}\\SonarScanner.MSBuild.exe end /d:sonar.login=${token}"
|
||||
}
|
||||
}
|
||||
stage('Coverage')
|
||||
{
|
||||
environment
|
||||
{
|
||||
reportGen = "C:\\Nuget-Packages\\reportgenerator\\5.1.6\\tools\\net6.0\\ReportGenerator.exe"
|
||||
}
|
||||
steps
|
||||
{
|
||||
bat "${reportGen} -verbosity:Info -reports:${WORKSPACE}\\coverage.xml -targetdir:${WORKSPACE} -reporttypes:SonarQube;Cobertura;Html"
|
||||
}
|
||||
}
|
||||
}
|
||||
post {
|
||||
always {
|
||||
|
||||
step([$class: 'CoberturaPublisher', autoUpdateHealth: false, autoUpdateStability: false, coberturaReportFile: '**/Cobertura.xml', failUnhealthy: false, failUnstable: false, maxNumberOfBuilds: 0, onlyStable: false, sourceEncoding: 'ASCII', zoomCoverageChart: false])
|
||||
}
|
||||
steps
|
||||
{
|
||||
withSonarQubeEnv('SonarQube_Homer')
|
||||
{
|
||||
bat "${scannerHome}/bin/sonar-scanner -Dsonar.projectKey=${project} -Dsonar.login=${token}"
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user