polish integration test
authorEugene Petrenko <eugene.petrenko@gmail.com>
Thu, 21 Jul 2011 22:03:07 +0000 (02:03 +0400)
committerEugene Petrenko <eugene.petrenko@gmail.com>
Thu, 21 Jul 2011 22:03:07 +0000 (02:03 +0400)
nuget-tests/src/jetbrains/buildServer/nuget/tests/integration/IntegrationTestBase.java
nuget-tests/src/jetbrains/buildServer/nuget/tests/integration/PackagesPublishIntegrationTest.java

index a929b2541c1a688af47c73955bb75aaac9fef8a6..e92b6ede2956500cc2b63b58f273f025a9f91b54 100644 (file)
@@ -38,6 +38,7 @@ import java.util.Collection;
  * Date: 22.07.11 1:26\r
  */\r
 public class IntegrationTestBase extends BuildProcessTestCase {\r
  * Date: 22.07.11 1:26\r
  */\r
 public class IntegrationTestBase extends BuildProcessTestCase {\r
+  private StringBuilder myCommandsOutput;\r
   protected File myRoot;\r
   protected Mockery m;\r
   protected AgentRunningBuild myBuild;\r
   protected File myRoot;\r
   protected Mockery m;\r
   protected AgentRunningBuild myBuild;\r
@@ -50,10 +51,16 @@ public class IntegrationTestBase extends BuildProcessTestCase {
   protected NuGetFetchParameters myNuGet;\r
   private BuildProcess myMockProcess;\r
 \r
   protected NuGetFetchParameters myNuGet;\r
   private BuildProcess myMockProcess;\r
 \r
+  @NotNull\r
+  protected String getCommandsOutput() {\r
+    return myCommandsOutput.toString();\r
+  }\r
+\r
   @BeforeMethod\r
   @Override\r
   protected void setUp() throws Exception {\r
     super.setUp();\r
   @BeforeMethod\r
   @Override\r
   protected void setUp() throws Exception {\r
     super.setUp();\r
+    myCommandsOutput = new StringBuilder();\r
     myRoot = createTempDir();\r
     m = new Mockery();\r
     myBuild = m.mock(AgentRunningBuild.class);\r
     myRoot = createTempDir();\r
     m = new Mockery();\r
     myBuild = m.mock(AgentRunningBuild.class);\r
@@ -118,6 +125,8 @@ public class IntegrationTestBase extends BuildProcessTestCase {
             System.out.println(result.getStdout());\r
             System.out.println(result.getStderr());\r
 \r
             System.out.println(result.getStdout());\r
             System.out.println(result.getStderr());\r
 \r
+            myCommandsOutput.append(result.getStdout()).append("\n\n").append(result.getStderr()).append("\n\n");\r
+\r
             return result.getExitCode() == 0\r
                     ? BuildFinishedStatus.FINISHED_SUCCESS\r
                     : BuildFinishedStatus.FINISHED_FAILED;\r
             return result.getExitCode() == 0\r
                     ? BuildFinishedStatus.FINISHED_SUCCESS\r
                     : BuildFinishedStatus.FINISHED_FAILED;\r
index ccc3f6c0352ae64cf630139c2cee79c38ede6081..5d2095d26b561b13b27a4e1da44bf49b5ee392b9 100644 (file)
@@ -49,6 +49,8 @@ public class PackagesPublishIntegrationTest extends IntegrationTestBase {
   public void test_publish_packages() throws IOException, RunBuildException {\r
     final File pkg = preparePackage();\r
     callPublishRunner(pkg);\r
   public void test_publish_packages() throws IOException, RunBuildException {\r
     final File pkg = preparePackage();\r
     callPublishRunner(pkg);\r
+\r
+    Assert.assertTrue(getCommandsOutput().contains("Your package was uploaded"));\r
   }\r
 \r
   @Test\r
   }\r
 \r
   @Test\r
@@ -97,7 +99,7 @@ public class PackagesPublishIntegrationTest extends IntegrationTestBase {
       allowing(myPublishParameters).getCreateOnly(); will(returnValue(true));\r
       allowing(myPublishParameters).getNuGetExeFile(); will(returnValue(Paths.getPathToNuGet()));\r
       allowing(myPublishParameters).getPublishSource(); will(returnValue(null));\r
       allowing(myPublishParameters).getCreateOnly(); will(returnValue(true));\r
       allowing(myPublishParameters).getNuGetExeFile(); will(returnValue(Paths.getPathToNuGet()));\r
       allowing(myPublishParameters).getPublishSource(); will(returnValue(null));\r
-      allowing(myPublishParameters).getApiKey(); will(returnValue("88001628-cb42-4c35-91be-4015cf638bcf"));\r
+      allowing(myPublishParameters).getApiKey(); will(returnValue(getQ()));\r
 \r
       allowing(myParametersFactory).loadPublishParameters(myContext);will(returnValue(myPublishParameters));\r
     }});\r
 \r
       allowing(myParametersFactory).loadPublishParameters(myContext);will(returnValue(myPublishParameters));\r
     }});\r
@@ -114,4 +116,12 @@ public class PackagesPublishIntegrationTest extends IntegrationTestBase {
     final BuildProcess proc = runner.createBuildProcess(myBuild, myContext);\r
     assertRunSuccessfully(proc, BuildFinishedStatus.FINISHED_SUCCESS);\r
   }\r
     final BuildProcess proc = runner.createBuildProcess(myBuild, myContext);\r
     assertRunSuccessfully(proc, BuildFinishedStatus.FINISHED_SUCCESS);\r
   }\r
+\r
+  private String getQ() {\r
+    final int i1 = 88001628;\r
+    final int universe = 42;\r
+    final int num = 4015;\r
+    final String nuget = 91 + "be" + "-" + num + "cf638bcf";\r
+    return (i1 + "-" + "cb" + universe + "-" + 4 + "c") + 35 + "-" + nuget;\r
+  }\r
 }\r
 }\r