From f4ddc125cf304031d7ca184f7dc38074c8eec82c Mon Sep 17 00:00:00 2001
From: papai0709
Date: Tue, 18 Mar 2025 22:31:47 +0530
Subject: [PATCH 01/10] Set up CI with Azure Pipelines
[skip ci]
---
azure-pipelines.yml | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
create mode 100644 azure-pipelines.yml
diff --git a/azure-pipelines.yml b/azure-pipelines.yml
new file mode 100644
index 000000000..e8f3d6f54
--- /dev/null
+++ b/azure-pipelines.yml
@@ -0,0 +1,22 @@
+# Maven
+# Build your Java project and run tests with Apache Maven.
+# Add steps that analyze code, save build artifacts, deploy, and more:
+# https://docs.microsoft.com/azure/devops/pipelines/languages/java
+
+trigger:
+- main
+
+pool:
+ vmImage: ubuntu-latest
+
+steps:
+- task: Maven@3
+ inputs:
+ mavenPomFile: 'pom.xml'
+ mavenOptions: '-Xmx3072m'
+ javaHomeOption: 'JDKVersion'
+ jdkVersionOption: '1.11'
+ jdkArchitectureOption: 'x64'
+ publishJUnitResults: true
+ testResultsFiles: '**/surefire-reports/TEST-*.xml'
+ goals: 'package'
From f55b8491908d1e31e539d3c9950d653aad8435c0 Mon Sep 17 00:00:00 2001
From: papai0709
Date: Wed, 19 Mar 2025 08:21:44 +0530
Subject: [PATCH 02/10] 1. Initial commit with one new class file added 2. One
test method added
---
.../com/microsoft/demo/Pipeline_Test.java | 20 +++++++++++++++++++
src/test/java/MyTest.java | 11 ++++++++++
2 files changed, 31 insertions(+)
create mode 100644 src/main/java/com/microsoft/demo/Pipeline_Test.java
diff --git a/src/main/java/com/microsoft/demo/Pipeline_Test.java b/src/main/java/com/microsoft/demo/Pipeline_Test.java
new file mode 100644
index 000000000..468f4043a
--- /dev/null
+++ b/src/main/java/com/microsoft/demo/Pipeline_Test.java
@@ -0,0 +1,20 @@
+package com.microsoft.demo;
+
+public class Pipeline_Test {
+ public String MyTestPipeline(String s){
+ String rev = "";
+ char [] w = s.toCharArray();
+
+ for(int i = s.length()-1; i>=0; i--){
+ rev = rev.concat(String.valueOf(w[i]));
+ }
+ return rev;
+ }
+
+
+// public static void main(String[] args) {
+// String a = MyTest("abcd");
+// System.out.print(a);
+// }
+}
+
diff --git a/src/test/java/MyTest.java b/src/test/java/MyTest.java
index 9e1d2abed..237752ff1 100644
--- a/src/test/java/MyTest.java
+++ b/src/test/java/MyTest.java
@@ -1,4 +1,5 @@
import com.microsoft.demo.Demo;
+import com.microsoft.demo.Pipeline_Test;
import org.junit.Test;
public class MyTest {
@@ -11,4 +12,14 @@ public void test_method_1() {
@Test
public void test_method_2() {
}
+
+ @Test
+ public void test_method_3(){
+ Pipeline_Test pt = new Pipeline_Test();
+ String s ="ABCDEFG";
+ String rev = pt.MyTestPipeline(s);
+ if (rev.length()==7)
+ System.out.println("Test Passed on Length");
+
+ }
}
\ No newline at end of file
From f3afe91c13d69a2b12602a09623dfa52ead306ad Mon Sep 17 00:00:00 2001
From: papai0709
Date: Wed, 19 Mar 2025 08:23:57 +0530
Subject: [PATCH 03/10] Improved Java SDk version
---
azure-pipelines.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/azure-pipelines.yml b/azure-pipelines.yml
index e8f3d6f54..a7454c196 100644
--- a/azure-pipelines.yml
+++ b/azure-pipelines.yml
@@ -15,7 +15,7 @@ steps:
mavenPomFile: 'pom.xml'
mavenOptions: '-Xmx3072m'
javaHomeOption: 'JDKVersion'
- jdkVersionOption: '1.11'
+ jdkVersionOption: '1.19'
jdkArchitectureOption: 'x64'
publishJUnitResults: true
testResultsFiles: '**/surefire-reports/TEST-*.xml'
From e164de7432df610eb5424cdbb939468be2c866bf Mon Sep 17 00:00:00 2001
From: papai0709
Date: Wed, 19 Mar 2025 08:40:44 +0530
Subject: [PATCH 04/10] Reverted Java SDk version
---
azure-pipelines.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/azure-pipelines.yml b/azure-pipelines.yml
index a7454c196..e8f3d6f54 100644
--- a/azure-pipelines.yml
+++ b/azure-pipelines.yml
@@ -15,7 +15,7 @@ steps:
mavenPomFile: 'pom.xml'
mavenOptions: '-Xmx3072m'
javaHomeOption: 'JDKVersion'
- jdkVersionOption: '1.19'
+ jdkVersionOption: '1.11'
jdkArchitectureOption: 'x64'
publishJUnitResults: true
testResultsFiles: '**/surefire-reports/TEST-*.xml'
From 97481bdb3b72c2514b82e4656346f163bedce7dd Mon Sep 17 00:00:00 2001
From: papai0709
Date: Wed, 19 Mar 2025 08:43:29 +0530
Subject: [PATCH 05/10] Added length test
---
src/test/java/MyTest.java | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/src/test/java/MyTest.java b/src/test/java/MyTest.java
index 237752ff1..c9517bb4f 100644
--- a/src/test/java/MyTest.java
+++ b/src/test/java/MyTest.java
@@ -3,6 +3,9 @@
import org.junit.Test;
public class MyTest {
+
+ Pipeline_Test pt = new Pipeline_Test();
+ String s ="ABCDEFG";
@Test
public void test_method_1() {
Demo d = new Demo();
@@ -15,11 +18,16 @@ public void test_method_2() {
@Test
public void test_method_3(){
- Pipeline_Test pt = new Pipeline_Test();
- String s ="ABCDEFG";
String rev = pt.MyTestPipeline(s);
if (rev.length()==7)
System.out.println("Test Passed on Length");
}
+
+ @Test
+ public void test_check_length(){
+ String rev = pt.MyTestPipeline(s);
+ if (rev.length()<9)
+ System.out.println("Length Not Matching..!");
+ }
}
\ No newline at end of file
From 88f7db8fb3c097c5ea9d4ac028485224cd6a1a49 Mon Sep 17 00:00:00 2001
From: papai0709
Date: Wed, 19 Mar 2025 08:51:27 +0530
Subject: [PATCH 06/10] Increased maven version
---
azure-pipelines.yml | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/azure-pipelines.yml b/azure-pipelines.yml
index e8f3d6f54..8ef809124 100644
--- a/azure-pipelines.yml
+++ b/azure-pipelines.yml
@@ -10,7 +10,7 @@ pool:
vmImage: ubuntu-latest
steps:
-- task: Maven@3
+- task: Maven@4
inputs:
mavenPomFile: 'pom.xml'
mavenOptions: '-Xmx3072m'
From 347b4e7778dabb919326853ad4618bea75769702 Mon Sep 17 00:00:00 2001
From: papai0709
Date: Wed, 19 Mar 2025 09:11:49 +0530
Subject: [PATCH 07/10] Addded New Function & Fail test
---
.../com/microsoft/demo/Pipeline_Test.java | 43 ++++++++++++++++++-
src/test/java/MyTest.java | 7 +++
2 files changed, 48 insertions(+), 2 deletions(-)
diff --git a/src/main/java/com/microsoft/demo/Pipeline_Test.java b/src/main/java/com/microsoft/demo/Pipeline_Test.java
index 468f4043a..ca20b39a6 100644
--- a/src/main/java/com/microsoft/demo/Pipeline_Test.java
+++ b/src/main/java/com/microsoft/demo/Pipeline_Test.java
@@ -1,6 +1,9 @@
package com.microsoft.demo;
+import java.util.Random;
+
public class Pipeline_Test {
+
public String MyTestPipeline(String s){
String rev = "";
char [] w = s.toCharArray();
@@ -11,10 +14,46 @@ public String MyTestPipeline(String s){
return rev;
}
+ public char[] random_password(int len)
+ {
+ System.out.println("Generating password using random function : ");
+ System.out.print("Your new password is : ");
+
+ // A strong password has Cap_chars, Lower_chars,
+ // numeric value and symbols. So we are using all of
+ // them to generate our password
+ String Capital_chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ";
+ String Small_chars = "abcdefghijklmnopqrstuvwxyz";
+ String numbers = "0123456789";
+ String symbols = "!@#$%^&*_=+-/.?<>)";
+
+
+ String values = Capital_chars + Small_chars +
+ numbers + symbols;
+
+ // Using random method
+ Random rndm_method = new Random();
+
+ char[] password = new char[len];
+
+ for (int i = 0; i < len; i++)
+ {
+ // Use of charAt() method : to get character value
+ // Use of nextInt() as it is scanning the value as int
+ password[i] =
+ values.charAt(rndm_method.nextInt(values.length()));
+
+ }
+ return password;
+ }
// public static void main(String[] args) {
-// String a = MyTest("abcd");
-// System.out.print(a);
+//
+// int length = 10;
+// System.out.println(random_password(length));
// }
}
+
+
+
diff --git a/src/test/java/MyTest.java b/src/test/java/MyTest.java
index c9517bb4f..98a4dec4b 100644
--- a/src/test/java/MyTest.java
+++ b/src/test/java/MyTest.java
@@ -1,5 +1,6 @@
import com.microsoft.demo.Demo;
import com.microsoft.demo.Pipeline_Test;
+import org.junit.Assert;
import org.junit.Test;
public class MyTest {
@@ -30,4 +31,10 @@ public void test_check_length(){
if (rev.length()<9)
System.out.println("Length Not Matching..!");
}
+
+ @Test
+ public void validateRandomPassword(){
+ char [] password = pt.random_password(10);
+ Assert.fail();
+ }
}
\ No newline at end of file
From 805d021dc6665138216ad32b09f88e7cfc536f3a Mon Sep 17 00:00:00 2001
From: papai0709
Date: Wed, 19 Mar 2025 09:14:34 +0530
Subject: [PATCH 08/10] Addded New Function & fixed failed test
---
src/test/java/MyTest.java | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/src/test/java/MyTest.java b/src/test/java/MyTest.java
index 98a4dec4b..592272c13 100644
--- a/src/test/java/MyTest.java
+++ b/src/test/java/MyTest.java
@@ -1,6 +1,5 @@
import com.microsoft.demo.Demo;
import com.microsoft.demo.Pipeline_Test;
-import org.junit.Assert;
import org.junit.Test;
public class MyTest {
@@ -35,6 +34,7 @@ public void test_check_length(){
@Test
public void validateRandomPassword(){
char [] password = pt.random_password(10);
- Assert.fail();
+ if(password.length==10)
+ System.out.println("Password Length Matched..!");
}
}
\ No newline at end of file
From 4dd7feaed8eb05bdb429afe1ff4b3f33c77448d1 Mon Sep 17 00:00:00 2001
From: papai0709
Date: Wed, 19 Mar 2025 11:25:12 +0530
Subject: [PATCH 09/10] Set up CI with Azure Pipelines
[skip ci]
---
azure-pipelines-1.yml | 22 ++++++++++++++++++++++
1 file changed, 22 insertions(+)
create mode 100644 azure-pipelines-1.yml
diff --git a/azure-pipelines-1.yml b/azure-pipelines-1.yml
new file mode 100644
index 000000000..e8f3d6f54
--- /dev/null
+++ b/azure-pipelines-1.yml
@@ -0,0 +1,22 @@
+# Maven
+# Build your Java project and run tests with Apache Maven.
+# Add steps that analyze code, save build artifacts, deploy, and more:
+# https://docs.microsoft.com/azure/devops/pipelines/languages/java
+
+trigger:
+- main
+
+pool:
+ vmImage: ubuntu-latest
+
+steps:
+- task: Maven@3
+ inputs:
+ mavenPomFile: 'pom.xml'
+ mavenOptions: '-Xmx3072m'
+ javaHomeOption: 'JDKVersion'
+ jdkVersionOption: '1.11'
+ jdkArchitectureOption: 'x64'
+ publishJUnitResults: true
+ testResultsFiles: '**/surefire-reports/TEST-*.xml'
+ goals: 'package'
From dc9fcfacdb87985c2e10e333d2c1afdb61dc9d4b Mon Sep 17 00:00:00 2001
From: papai0709
Date: Wed, 19 Mar 2025 11:33:40 +0530
Subject: [PATCH 10/10] Update azure-pipelines.yml for Azure Pipelines
---
azure-pipelines.yml | 1 +
1 file changed, 1 insertion(+)
diff --git a/azure-pipelines.yml b/azure-pipelines.yml
index 8ef809124..03ca7d3b8 100644
--- a/azure-pipelines.yml
+++ b/azure-pipelines.yml
@@ -5,6 +5,7 @@
trigger:
- main
+- test
pool:
vmImage: ubuntu-latest