rename to NuGetActionFactory, add Update packages getters
authorEugene.Petrenko <eugene.petrenko@gmail.com>
Sun, 10 Jul 2011 10:09:18 +0000 (14:09 +0400)
committerEugene.Petrenko <eugene.petrenko@gmail.com>
Sun, 10 Jul 2011 10:09:18 +0000 (14:09 +0400)
nuget-agent/src/META-INF/build-agent-plugin-nuget.xml
nuget-agent/src/jetbrains/buildServer/nuget/agent/install/NuGetActionFactory.java [moved from nuget-agent/src/jetbrains/buildServer/nuget/agent/install/NuGetInstallPackageActionFactory.java with 71% similarity]
nuget-agent/src/jetbrains/buildServer/nuget/agent/install/PackagesInstallParameters.java
nuget-agent/src/jetbrains/buildServer/nuget/agent/install/PackagesInstallerRunner.java
nuget-agent/src/jetbrains/buildServer/nuget/agent/install/PackagesUpdateParameters.java [new file with mode: 0644]
nuget-agent/src/jetbrains/buildServer/nuget/agent/install/impl/NuGetActionFactoryImpl.java [moved from nuget-agent/src/jetbrains/buildServer/nuget/agent/install/impl/NuGetInstallPackageActionFactoryImpl.java with 73% similarity]
nuget-agent/src/jetbrains/buildServer/nuget/agent/install/impl/PackageInstallParametersFactoryImpl.java
nuget-tests/src/jetbrains/buildServer/nuget/tests/agent/NuGetInstallPackageActionFactoryTest.java
nuget-tests/src/jetbrains/buildServer/nuget/tests/integration/InstallPackageIntegtatoinTest.java

index b8ccaaf319bcca81c3e69275d94e4f45220772ab..5bdee14ea902b6e27a9a88561caf72dc75b6508f 100644 (file)
@@ -11,6 +11,6 @@
   <bean class="jetbrains.buildServer.nuget.agent.install.PackagesInstallerRunner"/>\r
   <bean class="jetbrains.buildServer.nuget.agent.install.PackagesInstallerRunnerRegistrar"/>\r
 \r
   <bean class="jetbrains.buildServer.nuget.agent.install.PackagesInstallerRunner"/>\r
   <bean class="jetbrains.buildServer.nuget.agent.install.PackagesInstallerRunnerRegistrar"/>\r
 \r
-  <bean class="jetbrains.buildServer.nuget.agent.install.impl.NuGetInstallPackageActionFactoryImpl"/>\r
+  <bean class="jetbrains.buildServer.nuget.agent.install.impl.NuGetActionFactoryImpl"/>\r
   <bean class="jetbrains.buildServer.nuget.agent.install.impl.PackageInstallParametersFactoryImpl"/>\r
 </beans>
\ No newline at end of file
   <bean class="jetbrains.buildServer.nuget.agent.install.impl.PackageInstallParametersFactoryImpl"/>\r
 </beans>
\ No newline at end of file
similarity index 71%
rename from nuget-agent/src/jetbrains/buildServer/nuget/agent/install/NuGetInstallPackageActionFactory.java
rename to nuget-agent/src/jetbrains/buildServer/nuget/agent/install/NuGetActionFactory.java
index 760386d9a4c90a2504558763b6d901dbb5d712e4..b7b05e84daefd5b4c237fa03ecd096e3a85cf816 100644 (file)
@@ -27,9 +27,9 @@ import java.io.File;
  * Created by Eugene Petrenko (eugene.petrenko@gmail.com)\r
  * Date: 07.07.11 18:07\r
  */\r
  * Created by Eugene Petrenko (eugene.petrenko@gmail.com)\r
  * Date: 07.07.11 18:07\r
  */\r
-public interface NuGetInstallPackageActionFactory {\r
-  BuildProcess createBuildProcess(@NotNull BuildRunnerContext context,\r
-                                  @NotNull PackagesInstallParameters params,\r
-                                  @NotNull File packagesConfig,\r
-                                  @NotNull File targetFolder) throws RunBuildException;\r
+public interface NuGetActionFactory {\r
+  BuildProcess createInstall(@NotNull BuildRunnerContext context,\r
+                             @NotNull PackagesInstallParameters params,\r
+                             @NotNull File packagesConfig,\r
+                             @NotNull File targetFolder) throws RunBuildException;\r
 }\r
 }\r
index 11f1289e6c65649f89f159e66c3bff560ce2a9ba..89be2b9824261ea7c4b1204993c86bd3f0e71c77 100644 (file)
@@ -18,6 +18,7 @@ package jetbrains.buildServer.nuget.agent.install;
 \r
 import jetbrains.buildServer.RunBuildException;\r
 import org.jetbrains.annotations.NotNull;\r
 \r
 import jetbrains.buildServer.RunBuildException;\r
 import org.jetbrains.annotations.NotNull;\r
+import org.jetbrains.annotations.Nullable;\r
 \r
 import java.io.File;\r
 import java.util.Collection;\r
 \r
 import java.io.File;\r
 import java.util.Collection;\r
@@ -54,4 +55,10 @@ public interface PackagesInstallParameters {
    *         numbers in directory names\r
    */\r
   boolean getExcludeVersion();\r
    *         numbers in directory names\r
    */\r
   boolean getExcludeVersion();\r
+\r
+  /**\r
+   * @return package update parameters or null if no update required\r
+   */\r
+  @Nullable\r
+  PackagesUpdateParameters getUpdatePackages();\r
 }\r
 }\r
index 9d89e573c565ed945b4d76796b21b306e81957cd..678f5d6acfca23320b4a11cdf8e40e14023942d1 100644 (file)
@@ -37,10 +37,10 @@ import static jetbrains.buildServer.nuget.agent.install.LocateNuGetConfigBuildPr
 public class PackagesInstallerRunner implements AgentBuildRunner, AgentBuildRunnerInfo {\r
   private static final Logger LOG = Logger.getInstance(PackagesInstallerRunner.class.getName());\r
 \r
 public class PackagesInstallerRunner implements AgentBuildRunner, AgentBuildRunnerInfo {\r
   private static final Logger LOG = Logger.getInstance(PackagesInstallerRunner.class.getName());\r
 \r
-  private final NuGetInstallPackageActionFactory myInstallActionFactory;\r
+  private final NuGetActionFactory myInstallActionFactory;\r
   private final PackageInstallParametersFactory myParametersFactory;\r
 \r
   private final PackageInstallParametersFactory myParametersFactory;\r
 \r
-  public PackagesInstallerRunner(@NotNull final NuGetInstallPackageActionFactory installActionFactory,\r
+  public PackagesInstallerRunner(@NotNull final NuGetActionFactory installActionFactory,\r
                                  @NotNull final PackageInstallParametersFactory parametersFactory) {\r
     myInstallActionFactory = installActionFactory;\r
     myParametersFactory = parametersFactory;\r
                                  @NotNull final PackageInstallParametersFactory parametersFactory) {\r
     myInstallActionFactory = installActionFactory;\r
     myParametersFactory = parametersFactory;\r
@@ -79,7 +79,7 @@ public class PackagesInstallerRunner implements AgentBuildRunner, AgentBuildRunn
                             if (pathToLog == null) pathToLog = config.getPath();\r
                             logger.activityStarted("install", "Installing NuGet packages for " + pathToLog, "nuget");\r
 \r
                             if (pathToLog == null) pathToLog = config.getPath();\r
                             logger.activityStarted("install", "Installing NuGet packages for " + pathToLog, "nuget");\r
 \r
-                            return myInstallActionFactory.createBuildProcess(context,\r
+                            return myInstallActionFactory.createInstall(context,\r
                                     parameters,\r
                                     config,\r
                                     targetFolder)\r
                                     parameters,\r
                                     config,\r
                                     targetFolder)\r
diff --git a/nuget-agent/src/jetbrains/buildServer/nuget/agent/install/PackagesUpdateParameters.java b/nuget-agent/src/jetbrains/buildServer/nuget/agent/install/PackagesUpdateParameters.java
new file mode 100644 (file)
index 0000000..614d75a
--- /dev/null
@@ -0,0 +1,29 @@
+/*\r
+ * Copyright 2000-2011 JetBrains s.r.o.\r
+ *\r
+ * Licensed under the Apache License, Version 2.0 (the "License");\r
+ * you may not use this file except in compliance with the License.\r
+ * You may obtain a copy of the License at\r
+ *\r
+ * http://www.apache.org/licenses/LICENSE-2.0\r
+ *\r
+ * Unless required by applicable law or agreed to in writing, software\r
+ * distributed under the License is distributed on an "AS IS" BASIS,\r
+ * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\r
+ * See the License for the specific language governing permissions and\r
+ * limitations under the License.\r
+ */\r
+\r
+package jetbrains.buildServer.nuget.agent.install;\r
+\r
+/**\r
+ * Contains settings for packages update parameters\r
+ * Created by Eugene Petrenko (eugene.petrenko@gmail.com)\r
+ * Date: 10.07.11 14:02\r
+ */\r
+public interface PackagesUpdateParameters {\r
+  /**\r
+   * @return true if update should be performed with -Safe argument\r
+   */\r
+  boolean getUseSafeUpdate();\r
+}\r
similarity index 73%
rename from nuget-agent/src/jetbrains/buildServer/nuget/agent/install/impl/NuGetInstallPackageActionFactoryImpl.java
rename to nuget-agent/src/jetbrains/buildServer/nuget/agent/install/impl/NuGetActionFactoryImpl.java
index 1eaa437ec0caa1cc568e559c4806a514c4226fce..afbf859eb31382ec3777215ed788f47585da1e6d 100644 (file)
@@ -19,7 +19,7 @@ package jetbrains.buildServer.nuget.agent.install.impl;
 import jetbrains.buildServer.RunBuildException;\r
 import jetbrains.buildServer.agent.BuildProcess;\r
 import jetbrains.buildServer.agent.BuildRunnerContext;\r
 import jetbrains.buildServer.RunBuildException;\r
 import jetbrains.buildServer.agent.BuildProcess;\r
 import jetbrains.buildServer.agent.BuildRunnerContext;\r
-import jetbrains.buildServer.nuget.agent.install.NuGetInstallPackageActionFactory;\r
+import jetbrains.buildServer.nuget.agent.install.NuGetActionFactory;\r
 import jetbrains.buildServer.nuget.agent.install.PackagesInstallParameters;\r
 import jetbrains.buildServer.nuget.agent.util.CommandlineBuildProcessFactory;\r
 import jetbrains.buildServer.util.FileUtil;\r
 import jetbrains.buildServer.nuget.agent.install.PackagesInstallParameters;\r
 import jetbrains.buildServer.nuget.agent.util.CommandlineBuildProcessFactory;\r
 import jetbrains.buildServer.util.FileUtil;\r
@@ -33,17 +33,17 @@ import java.util.List;
  * Created by Eugene Petrenko (eugene.petrenko@gmail.com)\r
  * Date: 07.07.11 17:49\r
  */\r
  * Created by Eugene Petrenko (eugene.petrenko@gmail.com)\r
  * Date: 07.07.11 17:49\r
  */\r
-public class NuGetInstallPackageActionFactoryImpl implements NuGetInstallPackageActionFactory {\r
+public class NuGetActionFactoryImpl implements NuGetActionFactory {\r
   private final CommandlineBuildProcessFactory myFactory;\r
 \r
   private final CommandlineBuildProcessFactory myFactory;\r
 \r
-  public NuGetInstallPackageActionFactoryImpl(CommandlineBuildProcessFactory factory) {\r
+  public NuGetActionFactoryImpl(CommandlineBuildProcessFactory factory) {\r
     myFactory = factory;\r
   }\r
 \r
     myFactory = factory;\r
   }\r
 \r
-  public BuildProcess createBuildProcess(@NotNull final BuildRunnerContext context,\r
-                                         @NotNull final PackagesInstallParameters params,\r
-                                         @NotNull final File packagesConfig,\r
-                                         @NotNull final File targetFolder) throws RunBuildException {\r
+  public BuildProcess createInstall(@NotNull final BuildRunnerContext context,\r
+                                    @NotNull final PackagesInstallParameters params,\r
+                                    @NotNull final File packagesConfig,\r
+                                    @NotNull final File targetFolder) throws RunBuildException {\r
     final List<String> argz = new ArrayList<String>();\r
     argz.add("install");\r
     argz.add(FileUtil.getCanonicalFile(packagesConfig).getPath()); //path to package\r
     final List<String> argz = new ArrayList<String>();\r
     argz.add("install");\r
     argz.add(FileUtil.getCanonicalFile(packagesConfig).getPath()); //path to package\r
index 79b324ac04227156e574a71ad1cf860ee86153e1..a43756fcd3d7041824cab8ef2878df1345124981 100644 (file)
@@ -20,6 +20,7 @@ import jetbrains.buildServer.RunBuildException;
 import jetbrains.buildServer.agent.BuildRunnerContext;\r
 import jetbrains.buildServer.nuget.agent.install.PackageInstallParametersFactory;\r
 import jetbrains.buildServer.nuget.agent.install.PackagesInstallParameters;\r
 import jetbrains.buildServer.agent.BuildRunnerContext;\r
 import jetbrains.buildServer.nuget.agent.install.PackageInstallParametersFactory;\r
 import jetbrains.buildServer.nuget.agent.install.PackagesInstallParameters;\r
+import jetbrains.buildServer.nuget.agent.install.PackagesUpdateParameters;\r
 import jetbrains.buildServer.util.FileUtil;\r
 import jetbrains.buildServer.util.StringUtil;\r
 import org.jetbrains.annotations.NotNull;\r
 import jetbrains.buildServer.util.FileUtil;\r
 import jetbrains.buildServer.util.StringUtil;\r
 import org.jetbrains.annotations.NotNull;\r
@@ -85,6 +86,11 @@ public class PackageInstallParametersFactoryImpl implements PackageInstallParame
       public boolean getExcludeVersion() {\r
         return !StringUtil.isEmptyOrSpaces(context.getRunnerParameters().get(NUGET_EXCLUDE_VERSION));\r
       }\r
       public boolean getExcludeVersion() {\r
         return !StringUtil.isEmptyOrSpaces(context.getRunnerParameters().get(NUGET_EXCLUDE_VERSION));\r
       }\r
+\r
+      @Nullable\r
+      public PackagesUpdateParameters getUpdatePackages() {\r
+        return null;\r
+      }\r
     };\r
   }\r
 }\r
     };\r
   }\r
 }\r
index 90d6ab9d6604d55a5209b18cfbc03481418dfc90..dd4966164672af31f9dbbdca311d2f43ec3e0a2e 100644 (file)
@@ -20,7 +20,7 @@ import jetbrains.buildServer.BaseTestCase;
 import jetbrains.buildServer.RunBuildException;\r
 import jetbrains.buildServer.agent.BuildRunnerContext;\r
 import jetbrains.buildServer.nuget.agent.install.PackagesInstallParameters;\r
 import jetbrains.buildServer.RunBuildException;\r
 import jetbrains.buildServer.agent.BuildRunnerContext;\r
 import jetbrains.buildServer.nuget.agent.install.PackagesInstallParameters;\r
-import jetbrains.buildServer.nuget.agent.install.impl.NuGetInstallPackageActionFactoryImpl;\r
+import jetbrains.buildServer.nuget.agent.install.impl.NuGetActionFactoryImpl;\r
 import jetbrains.buildServer.nuget.agent.util.CommandlineBuildProcessFactory;\r
 import org.jmock.Expectations;\r
 import org.jmock.Mockery;\r
 import jetbrains.buildServer.nuget.agent.util.CommandlineBuildProcessFactory;\r
 import org.jmock.Expectations;\r
 import org.jmock.Mockery;\r
@@ -39,7 +39,7 @@ import java.util.Collections;
 public class NuGetInstallPackageActionFactoryTest extends BaseTestCase {\r
   private Mockery m;\r
   private CommandlineBuildProcessFactory myProcessFactory;\r
 public class NuGetInstallPackageActionFactoryTest extends BaseTestCase {\r
   private Mockery m;\r
   private CommandlineBuildProcessFactory myProcessFactory;\r
-  private NuGetInstallPackageActionFactoryImpl i;\r
+  private NuGetActionFactoryImpl i;\r
   private BuildRunnerContext ctx;\r
   private PackagesInstallParameters ps;\r
   private File myTarget;\r
   private BuildRunnerContext ctx;\r
   private PackagesInstallParameters ps;\r
   private File myTarget;\r
@@ -51,7 +51,7 @@ public class NuGetInstallPackageActionFactoryTest extends BaseTestCase {
     super.setUp();\r
     m = new Mockery();\r
     myProcessFactory = m.mock(CommandlineBuildProcessFactory.class);\r
     super.setUp();\r
     m = new Mockery();\r
     myProcessFactory = m.mock(CommandlineBuildProcessFactory.class);\r
-    i = new NuGetInstallPackageActionFactoryImpl(myProcessFactory);\r
+    i = new NuGetActionFactoryImpl(myProcessFactory);\r
     ctx = m.mock(BuildRunnerContext.class);\r
     ps = m.mock(PackagesInstallParameters.class);\r
 \r
     ctx = m.mock(BuildRunnerContext.class);\r
     ps = m.mock(PackagesInstallParameters.class);\r
 \r
@@ -75,7 +75,7 @@ public class NuGetInstallPackageActionFactoryTest extends BaseTestCase {
       );\r
     }});\r
 \r
       );\r
     }});\r
 \r
-    i.createBuildProcess(ctx, ps, myConfig, myTarget);\r
+    i.createInstall(ctx, ps, myConfig, myTarget);\r
     m.assertIsSatisfied();\r
   }\r
 \r
     m.assertIsSatisfied();\r
   }\r
 \r
@@ -95,7 +95,7 @@ public class NuGetInstallPackageActionFactoryTest extends BaseTestCase {
       );\r
     }});\r
 \r
       );\r
     }});\r
 \r
-    i.createBuildProcess(ctx, ps, myConfig, myTarget);\r
+    i.createInstall(ctx, ps, myConfig, myTarget);\r
     m.assertIsSatisfied();\r
   }\r
 \r
     m.assertIsSatisfied();\r
   }\r
 \r
@@ -115,7 +115,7 @@ public class NuGetInstallPackageActionFactoryTest extends BaseTestCase {
       );\r
     }});\r
 \r
       );\r
     }});\r
 \r
-    i.createBuildProcess(ctx, ps, myConfig, myTarget);\r
+    i.createInstall(ctx, ps, myConfig, myTarget);\r
     m.assertIsSatisfied();\r
   }\r
 }\r
     m.assertIsSatisfied();\r
   }\r
 }\r
index a5835b71a35ec4270bc3c363031336a3165d7559..257c426a08670e835737aea2e3189dfe1af704eb 100644 (file)
@@ -24,7 +24,7 @@ import jetbrains.buildServer.agent.*;
 import jetbrains.buildServer.nuget.agent.install.PackageInstallParametersFactory;\r
 import jetbrains.buildServer.nuget.agent.install.PackagesInstallParameters;\r
 import jetbrains.buildServer.nuget.agent.install.PackagesInstallerRunner;\r
 import jetbrains.buildServer.nuget.agent.install.PackageInstallParametersFactory;\r
 import jetbrains.buildServer.nuget.agent.install.PackagesInstallParameters;\r
 import jetbrains.buildServer.nuget.agent.install.PackagesInstallerRunner;\r
-import jetbrains.buildServer.nuget.agent.install.impl.NuGetInstallPackageActionFactoryImpl;\r
+import jetbrains.buildServer.nuget.agent.install.impl.NuGetActionFactoryImpl;\r
 import jetbrains.buildServer.nuget.agent.util.BuildProcessBase;\r
 import jetbrains.buildServer.nuget.agent.util.CommandlineBuildProcessFactory;\r
 import jetbrains.buildServer.nuget.tests.util.BuildProcessTestCase;\r
 import jetbrains.buildServer.nuget.agent.util.BuildProcessBase;\r
 import jetbrains.buildServer.nuget.agent.util.CommandlineBuildProcessFactory;\r
 import jetbrains.buildServer.nuget.tests.util.BuildProcessTestCase;\r
@@ -151,7 +151,7 @@ public class InstallPackageIntegtatoinTest extends BuildProcessTestCase {
     }});\r
 \r
     BuildProcess proc = new PackagesInstallerRunner(\r
     }});\r
 \r
     BuildProcess proc = new PackagesInstallerRunner(\r
-            new NuGetInstallPackageActionFactoryImpl(executingFactory()),\r
+            new NuGetActionFactoryImpl(executingFactory()),\r
             myParametersFactory\r
     ).createBuildProcess(myBuild, myContext);\r
 \r
             myParametersFactory\r
     ).createBuildProcess(myBuild, myContext);\r
 \r