diff --git a/azure-pipelines.yml b/azure-pipelines.yml new file mode 100644 index 0000000000..53335aef9b --- /dev/null +++ b/azure-pipelines.yml @@ -0,0 +1,47 @@ +# Starter pipeline +# Start with a minimal pipeline that you can customize to build and deploy your code.. +# Add steps that build, run tests, deploy, and more: +# https://aka.ms/yaml + +variables: + InjectAlmOctaneTasks: 'true' + AlmOctaneConnection11: 'qa9' + AlmOctaneConnection11Workspaces: '31006' + ALMOctaneLogLevel: 'debug' + system.debug: 'true' + system.debugContext: 'true' + GithubRepositoryConnection: 'elokshin' + +jobs: +- job: AlmOctanePipelineStart + condition: always() + +- job: A + steps: + - bash: echo $(Build.SourceBranchName) + displayName: 'Run a one-line script' + dependsOn: + - AlmOctanePipelineStart + +- job: B + dependsOn: AlmOctanePipelineStart + pool: + vmImage: 'ubuntu-latest' + steps: + - task: Maven@3 + inputs: + mavenPomFile: 'pom.xml' + mavenOptions: '-Xmx3072m' + javaHomeOption: 'JDKVersion' + jdkVersionOption: '1.8' + jdkArchitectureOption: 'x64' + publishJUnitResults: true + testResultsFiles: '**/surefire-reports/TEST-*.xml' + goals: 'package' + +- job: AlmOctanePipelineEnd + condition: always() + dependsOn: + - AlmOctanePipelineStart + - A + - B diff --git a/integration-tests/src/test/java/com/hp/devops/demoapp/RestServletTest.java b/integration-tests/src/test/java/com/hp/devops/demoapp/RestServletTest.java index 2fb101ff75..51b82a26fc 100644 --- a/integration-tests/src/test/java/com/hp/devops/demoapp/RestServletTest.java +++ b/integration-tests/src/test/java/com/hp/devops/demoapp/RestServletTest.java @@ -62,7 +62,12 @@ public void testGetBands() throws Exception { public void testReloadDb() throws Exception { spec.log().all().expect().statusCode(200).contentType(ContentType.TEXT).body(equalTo("done")).get("/reloadDB"); } - + + @Test + public void testWithVeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeryLoooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooongNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaame(){ + System.out.println("This is a test with a very long name"); + } + @Test public void testVoteForBand() throws Exception { String response1 = spec.log().all().expect().statusCode(200).when().put("/band/1/vote").asString(); diff --git a/integration-tests/src/test/java/com/hp/devops/demoapp/new_file.txt b/integration-tests/src/test/java/com/hp/devops/demoapp/new_file.txt new file mode 100644 index 0000000000..e69de29bb2 diff --git a/paths.txt b/paths.txt index faab39537c..2f98ebc872 100644 --- a/paths.txt +++ b/paths.txt @@ -1 +1,2 @@ C:\Users\vaingart\workspace\indi-integrations\jenkins\plugin\work\jobs\hp_example\workspace\ui-tests\target\nga-surefire-listener + diff --git a/redme/readme.txt b/redme/readme.txt index 5216f6e732..0aacb6fb58 100644 --- a/redme/readme.txt +++ b/redme/readme.txt @@ -5,5 +5,5 @@ rerw gfsdgdfd test3466ttt 3245trw -gfdgdfkjlj +gfdgdfkjl diff --git a/run.bat b/run.bat new file mode 100644 index 0000000000..8015e7c2c6 --- /dev/null +++ b/run.bat @@ -0,0 +1,34 @@ +@echo off +rem This is a custom script written by TeamCity using windows-1252 charset. +@echo off +echo "The current directory is %CD%" +git config --global user.email "evgene.lokshin@microfocus.com" +git config --global user.name "lokshin" + +set checkoutDir= C:\TeamCity\buildAgent\work\d512b84dc2f018e1 +echo "checkoutDir: %checkoutDir%" + +echo "===== create a new file and push to git ======" + +set hour=%time:~0,2% +if "%hour:~0,1%" == " " set hour=0%hour:~1,1% + +set "datetimef=%hour%_%time:~3,2%_%time:~6,2%" +set filename=MyFile-%BUILD_NUMBER%-%datetimef%.txt +set full_filename=%checkoutDir%\%filename% +echo "%full_filename% was created" + +rem cd %checkoutDir% + +echo "this is my awesome text file" > %filename% +git add . +echo "git commit -m "Add %filename% to branch Master"" +git commit -m "Add %filename% to branch Master" +call git push -u origin master --verbose + +echo "remove %filename% from git repo" +git rm %filename% +echo "git commit -m "remove %filename%" --author="_alm_octane_auto <_alm_octane_auto@microfocus.com>"" +git commit -m "remove %filename%" +echo "git push origin master" +call git push -u origin master --verbose \ No newline at end of file diff --git a/test.txt b/test.txt new file mode 100644 index 0000000000..a3e1c27c6e --- /dev/null +++ b/test.txt @@ -0,0 +1,2 @@ +sasgafgfgdfh +11 diff --git a/ui-tests-testng/src/test/java/com/hp/devops/demoapp/tests/ui/TestSuiteA.java b/ui-tests-testng/src/test/java/com/hp/devops/demoapp/tests/ui/TestSuiteA.java index 86cba6c9cb..b847076ff9 100644 --- a/ui-tests-testng/src/test/java/com/hp/devops/demoapp/tests/ui/TestSuiteA.java +++ b/ui-tests-testng/src/test/java/com/hp/devops/demoapp/tests/ui/TestSuiteA.java @@ -18,6 +18,7 @@ * User: gullery * Date: 03/12/15 * Time: 15:50 + * * To change this template use File | Settings | File Templates. */ public class TestSuiteA { @@ -88,6 +89,7 @@ public void testCase1() { Assert.assertEquals(query.isDisplayed(), true); } + @Test public void testCase2() { System.out.println("Proudly running test " + Thread.currentThread().getStackTrace()[1]); @@ -117,4 +119,4 @@ public void testCase3() { public void afterClass() { driver.quit(); } -} \ No newline at end of file +} diff --git a/ui-tests-testng/src/test/java/com/hp/devops/demoapp/tests/ui/TestSuiteB.java b/ui-tests-testng/src/test/java/com/hp/devops/demoapp/tests/ui/TestSuiteB.java index b9e8293500..a0cdb7990b 100644 --- a/ui-tests-testng/src/test/java/com/hp/devops/demoapp/tests/ui/TestSuiteB.java +++ b/ui-tests-testng/src/test/java/com/hp/devops/demoapp/tests/ui/TestSuiteB.java @@ -46,8 +46,8 @@ private void setUP() { appUrl = autHost + ":" + autPort; } else { - proxyHost = ""; - proxyPort = ""; + proxyHost = ""; + proxyPort = ""; autHost = "http://myd-vm02771.hpswlabs.adapps.hp.com"; autPort = "8080"; appUrl = autHost + ":" + autPort + "/jenkins"; diff --git a/ui-tests/src/test/java/com/hp/devops/demoapp/tests/ui/SpecialTests.java b/ui-tests/src/test/java/com/hp/devops/demoapp/tests/ui/SpecialTests.java index 9f4077f640..e0102ae958 100644 --- a/ui-tests/src/test/java/com/hp/devops/demoapp/tests/ui/SpecialTests.java +++ b/ui-tests/src/test/java/com/hp/devops/demoapp/tests/ui/SpecialTests.java @@ -10,4 +10,5 @@ */ public interface SpecialTests { //addgin commnets + } diff --git a/ui-tests/src/test/java/com/hp/devops/demoapp/tests/ui/TestA.java b/ui-tests/src/test/java/com/hp/devops/demoapp/tests/ui/TestA.java index d35559c6a5..7e5e3b7bc7 100644 --- a/ui-tests/src/test/java/com/hp/devops/demoapp/tests/ui/TestA.java +++ b/ui-tests/src/test/java/com/hp/devops/demoapp/tests/ui/TestA.java @@ -31,7 +31,7 @@ public class TestA { static private boolean isBehindProxy = false; static private String testProxy; static private String appUrl; - +//comment @BeforeClass static public void beforeAll() { @@ -52,7 +52,7 @@ static public void beforeAll() { System.out.println("testProxy is " + testProxy + "; can be modified via environment variable, i.e., 'export testproxy=web-proxy.bbn.hp.com:8080'"); } else { - System.out.println("We do not use proxy."); + System.out.println("We do not use proxy!?"); } if (isBehindProxy) { @@ -68,7 +68,7 @@ static public void beforeAll() { if (System.getProperty("appUrl") != null) { appUrl = System.getProperty("appUrl"); } - System.out.println("App URL is " + appUrl + "; can be modifed via system property, i.e., '-DappUrl=\"http://54.146.140.70:9000\"'"); + System.out.println("App URL is " + appUrl + "; can be modifed via system property, i.e., '-DappUrl=\"http://54.146.140.70:9000\"'"); driver.get(appUrl); @@ -89,6 +89,11 @@ public void testUIcaseA() { Assert.assertEquals(query.isDisplayed(), true); } + @Test + public void testWithVeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeryLoooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooooongNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaame(){ + System.out.println("This is a test with a very long name"); + } + @Category(SpecialTests.class) @Test @Ignore diff --git a/ui-tests/src/test/java/com/hp/devops/demoapp/tests/ui/TestC.java b/ui-tests/src/test/java/com/hp/devops/demoapp/tests/ui/TestC.java index 41e14fa375..2024486f56 100644 --- a/ui-tests/src/test/java/com/hp/devops/demoapp/tests/ui/TestC.java +++ b/ui-tests/src/test/java/com/hp/devops/demoapp/tests/ui/TestC.java @@ -44,7 +44,7 @@ public static void setUpBeforeClass() throws Exception { System.out.println("testProxy is " + testProxy + "; can be modified via environment variable, i.e., 'export testproxy=web-proxy.bbn.hp.com:8080'"); } else { - System.out.println("We do not use proxy"); + System.out.println("We do not use proxy."); } if (isBehindProxy) { @@ -109,7 +109,7 @@ public void testUIcaseF() { } Assert.assertEquals(query.isDisplayed(), true); } - +//test @Test public void testUIcaseAlwaysPass() { System.out.println("Proudly running test " + Thread.currentThread().getStackTrace()[1]); diff --git a/ui-tests/src/test/java/com/hp/devops/demoapp/tests/ui/TestD.java b/ui-tests/src/test/java/com/hp/devops/demoapp/tests/ui/TestD.java index ada71116bb..a3a661f2e0 100644 --- a/ui-tests/src/test/java/com/hp/devops/demoapp/tests/ui/TestD.java +++ b/ui-tests/src/test/java/com/hp/devops/demoapp/tests/ui/TestD.java @@ -11,7 +11,7 @@ public class TestD { @Test public void testUIcaseAlwaysPass() { - System.out.println("Proudly running test " + Thread.currentThread().getStackTrace()[1]); + System.out.println("Proudly running test " + Thread.currentThread().getStackTrace()[1]); Assert.assertTrue(true); } } diff --git a/webapp/src/test/java/com/hp/devops/demoapp/BandTest.java b/webapp/src/test/java/com/hp/devops/demoapp/BandTest.java index aa8b94e74c..21db1f0418 100644 --- a/webapp/src/test/java/com/hp/devops/demoapp/BandTest.java +++ b/webapp/src/test/java/com/hp/devops/demoapp/BandTest.java @@ -16,65 +16,85 @@ * To change this template use File | Settings | File Templates. */ public class BandTest { - //private String NON_RELATED; - private JSONObject test; + //private String NON_RELATED; + private JSONObject test; - @Before - public void beforeEach() { - test = new JSONObject(); - test.put("id", 1); - test.put("name", "Name"); - test.put("logo", "Logo"); - test.put("song", "Song"); - test.put("votes", 10); - } + @Before + public void beforeEach() { + test = new JSONObject(); + test.put("id", 1); + test.put("name", "Name"); + test.put("logo", "Logo"); + test.put("song", "Song"); + test.put("votes", 10); + } - @Test - public void bandTestA() { - try { - Band band = new Band(null); - Assert.fail("the flow MUST have been fallen before"); - } catch (Exception e) { - Assert.assertEquals(e.getClass(), NullPointerException.class); - } - } + @Test + public void bandTestA() { + try { + Band band = new Band(null); + Assert.fail("the flow MUST have been fallen before"); + } catch (Exception e) { + Assert.assertEquals(e.getClass(), NullPointerException.class); + } + } - @Test - public void bandTestB() { - try { - Band band = new Band(new JSONObject()); - Assert.fail("the flow MUST have been fallen before"); - } catch (Exception e) { - Assert.assertEquals(e.getClass(), InvalidParameterException.class); - Assert.assertEquals(e.getMessage(), "json must have an id property"); - } - } + @Test + public void bandTestA11() { + try { + Band band = new Band(null); + Assert.fail("the flow MUST have been fallen before"); + } catch (Exception e) { + Assert.assertEquals(e.getClass(), NullPointerException.class); + } + } - @Test - public void bandTestC() { - test.remove("name"); - test.remove("logo"); - Band band = new Band(test); - Assert.assertEquals(band.id, 1); - Assert.assertEquals(band.name, ""); - Assert.assertEquals(band.logo, ""); - Assert.assertEquals(band.song, "Song"); - Assert.assertEquals(band.votes, 10); - } + @Test + public void bandTestA1() { + try { + Band band = new Band(null); + Assert.fail("the flow MUST have been fallen before"); + } catch (Exception e) { + Assert.assertEquals(e.getClass(), NullPointerException.class); + } + } - @Test - @Ignore - public void bandTestD() { - Band band = new Band(test); - Assert.assertEquals(test.toString(), band.toJSON().toString()); - } + @Test + public void bandTestB() { + try { + Band band = new Band(new JSONObject()); + Assert.fail("the flow MUST have been fallen before"); + } catch (Exception e) { + Assert.assertEquals(e.getClass(), InvalidParameterException.class); + Assert.assertEquals(e.getMessage(), "json must have an id property"); + } + } - @Test - public void bandTestE() { - Band band = new Band(test); - JSONObject tmp = new JSONObject(); - tmp.put("id", test.get("id")); - tmp.put("votes", test.get("votes")); - Assert.assertEquals(tmp.toString(), band.toJSONVotes().toString()); - } + @Test + public void bandTestC() { + test.remove("name"); + test.remove("logo"); + Band band = new Band(test); + Assert.assertEquals(band.id, 1); + Assert.assertEquals(band.name, ""); + Assert.assertEquals(band.logo, ""); + Assert.assertEquals(band.song, "Song"); + Assert.assertEquals(band.votes, 10); + } + + @Test + @Ignore + public void bandTestD() { + Band band = new Band(test); + Assert.assertEquals(test.toString(), band.toJSON().toString()); + } + + @Test + public void bandTestE() { + Band band = new Band(test); + JSONObject tmp = new JSONObject(); + tmp.put("id", test.get("id")); + tmp.put("votes", test.get("votes")); + Assert.assertEquals(tmp.toString(), band.toJSONVotes().toString()); + } } diff --git a/webapp/src/test/java/com/hp/devops/demoapp/CalcsTest.java b/webapp/src/test/java/com/hp/devops/demoapp/CalcsTest.java index 00872dcb71..c9dc1d64a0 100644 --- a/webapp/src/test/java/com/hp/devops/demoapp/CalcsTest.java +++ b/webapp/src/test/java/com/hp/devops/demoapp/CalcsTest.java @@ -50,7 +50,6 @@ public void eq_test_B() { public void neq_test_A() { assertTrue(Calcs.nonEqual(0, 1)); } -//add comment @Test public void neq_test_B() { assertTrue(Calcs.nonEqual(-1, 0)); @@ -61,6 +60,6 @@ public void neq_test_C_BrokenTest() { assertTrue(Calcs.nonEqual(5, 5)); } -// @Test -// public void always_true_A() {assertTrue(Calcs.alwaysTrue());} + @Test + public void always_true_A() {assertTrue(Calcs.alwaysTrue());} } diff --git a/webapp/src/test/java/com/hp/devops/demoapp/UtilsTest.java b/webapp/src/test/java/com/hp/devops/demoapp/UtilsTest.java index bbb5cdc3ef..eb16e0f814 100644 --- a/webapp/src/test/java/com/hp/devops/demoapp/UtilsTest.java +++ b/webapp/src/test/java/com/hp/devops/demoapp/UtilsTest.java @@ -26,6 +26,12 @@ public void nodifyTestB() { assertEquals(result.length, 0); // 0 is the right answer } + @Test + public void test1WithVeeonaeeeaaaaaaaame() { + String[] result = Utils.nodify(""); + assertEquals(result.length, 0); // 0 is the right answer + } + @Test public void nodifyTestC() { String[] result = Utils.nodify("/api"); @@ -63,11 +69,13 @@ public void nodifyTestG() { } @Test -public void failTestForCoverageAnalysisA() { + public void failTestForCoverageAnalysisA() { String[] result = Utils.nodify("/api/some/more"); assertEquals(true, true); } + + //alla @Test public void testSimpleLogical() { boolean result = Utils.simpleLogical();