rename server PackageInfo class to SourcePackageInfo
authorEugene Petrenko <eugene.petrenko@gmail.com>
Tue, 19 Jul 2011 07:38:33 +0000 (11:38 +0400)
committerEugene Petrenko <eugene.petrenko@gmail.com>
Tue, 19 Jul 2011 07:38:33 +0000 (11:38 +0400)
nuget-server/src/jetbrains/buildServer/nuget/server/exec/ListPackagesCommand.java
nuget-server/src/jetbrains/buildServer/nuget/server/exec/ListPackagesCommandImpl.java
nuget-server/src/jetbrains/buildServer/nuget/server/exec/ListPackagesCommandProcessor.java
nuget-server/src/jetbrains/buildServer/nuget/server/exec/SourcePackageInfo.java [moved from nuget-server/src/jetbrains/buildServer/nuget/server/exec/PackageInfo.java with 82% similarity]
nuget-server/src/jetbrains/buildServer/nuget/server/trigger/NamedPackagesUpdateChecker.java
nuget-tests/src/jetbrains/buildServer/nuget/tests/server/ListPackagesCommandProcessorTest.java
nuget-tests/src/jetbrains/buildServer/nuget/tests/server/ListPackagesCommandTest.java
nuget-tests/src/jetbrains/buildServer/nuget/tests/server/NamedPackagesUpdateCheckerTest.java

index f1a17a17a46caee92632f9a209b08a55730967bf..1b78079c145d6fea24a471f1e1ce70df62aa0a97 100644 (file)
@@ -28,7 +28,7 @@ import java.util.Collection;
  */\r
 public interface ListPackagesCommand {\r
   @NotNull\r
  */\r
 public interface ListPackagesCommand {\r
   @NotNull\r
-  Collection<PackageInfo> checkForChanges(\r
+  Collection<SourcePackageInfo> checkForChanges(\r
           @NotNull File nugetPath,\r
           @Nullable String source,\r
           @NotNull String packageId,\r
           @NotNull File nugetPath,\r
           @Nullable String source,\r
           @NotNull String packageId,\r
index 4bffd6c5b5603037b62c9e4f9eb5a9aad95eb082..5e3b194d26d2cb69e91df7fa15e1f413c6fb9602 100644 (file)
@@ -37,7 +37,7 @@ public class ListPackagesCommandImpl implements ListPackagesCommand {
   }\r
 \r
   @NotNull\r
   }\r
 \r
   @NotNull\r
-  public Collection<PackageInfo> checkForChanges(\r
+  public Collection<SourcePackageInfo> checkForChanges(\r
           @NotNull final File nugetPath,\r
           @Nullable final String source,\r
           @NotNull final String packageId,\r
           @NotNull final File nugetPath,\r
           @Nullable final String source,\r
           @NotNull final String packageId,\r
index 1dfd8529f959df754de7b45b7519471163ac2b9c..dac3c2552efb0db90fbbd61512b0b6bc69ed4d6c 100644 (file)
@@ -32,10 +32,10 @@ import java.util.List;
 * Created by Eugene Petrenko (eugene.petrenko@gmail.com)\r
 * Date: 14.07.11 13:23\r
 */\r
 * Created by Eugene Petrenko (eugene.petrenko@gmail.com)\r
 * Date: 14.07.11 13:23\r
 */\r
-public class ListPackagesCommandProcessor implements NuGetOutputProcessor<Collection<PackageInfo>> {\r
+public class ListPackagesCommandProcessor implements NuGetOutputProcessor<Collection<SourcePackageInfo>> {\r
   private static final Logger LOG = Logger.getInstance(ListPackagesCommandProcessor.class.getName());\r
   private final String mySource;\r
   private static final Logger LOG = Logger.getInstance(ListPackagesCommandProcessor.class.getName());\r
   private final String mySource;\r
-  private final List<PackageInfo> myPackages = new ArrayList<PackageInfo>();\r
+  private final List<SourcePackageInfo> myPackages = new ArrayList<SourcePackageInfo>();\r
 \r
   public ListPackagesCommandProcessor(@NotNull final String source) {\r
     mySource = source;\r
 \r
   public ListPackagesCommandProcessor(@NotNull final String source) {\r
     mySource = source;\r
@@ -58,7 +58,7 @@ public class ListPackagesCommandProcessor implements NuGetOutputProcessor<Collec
         if (StringUtil.isEmptyOrSpaces(id)) return;\r
         if (StringUtil.isEmptyOrSpaces(version)) return;\r
 \r
         if (StringUtil.isEmptyOrSpaces(id)) return;\r
         if (StringUtil.isEmptyOrSpaces(version)) return;\r
 \r
-        myPackages.add(new PackageInfo(mySource, id, version));\r
+        myPackages.add(new SourcePackageInfo(mySource, id, version));\r
 \r
       }\r
 \r
 \r
       }\r
 \r
@@ -83,7 +83,7 @@ public class ListPackagesCommandProcessor implements NuGetOutputProcessor<Collec
   }\r
 \r
   @NotNull\r
   }\r
 \r
   @NotNull\r
-  public Collection<PackageInfo> getResult() {\r
+  public Collection<SourcePackageInfo> getResult() {\r
     return Collections.unmodifiableList(myPackages);\r
   }\r
 }\r
     return Collections.unmodifiableList(myPackages);\r
   }\r
 }\r
similarity index 82%
rename from nuget-server/src/jetbrains/buildServer/nuget/server/exec/PackageInfo.java
rename to nuget-server/src/jetbrains/buildServer/nuget/server/exec/SourcePackageInfo.java
index 7e519967c2d06f79b6fe4171d27f53eed73e8fd5..0b8cad7ca80716f7567811c047c1895aef048306 100644 (file)
@@ -22,14 +22,14 @@ import org.jetbrains.annotations.NotNull;
  * Created by Eugene Petrenko (eugene.petrenko@gmail.com)\r
  * Date: 14.07.11 13:17\r
  */\r
  * Created by Eugene Petrenko (eugene.petrenko@gmail.com)\r
  * Date: 14.07.11 13:17\r
  */\r
-public class PackageInfo {\r
+public class SourcePackageInfo {\r
   private final String mySource;\r
   private final String myPackageId;\r
   private final String myVersion;\r
 \r
   private final String mySource;\r
   private final String myPackageId;\r
   private final String myVersion;\r
 \r
-  public PackageInfo(@NotNull final String source,\r
-                     @NotNull final String packageId,\r
-                     @NotNull final String version) {\r
+  public SourcePackageInfo(@NotNull final String source,\r
+                           @NotNull final String packageId,\r
+                           @NotNull final String version) {\r
     mySource = source;\r
     myPackageId = packageId;\r
     myVersion = version;\r
     mySource = source;\r
     myPackageId = packageId;\r
     myVersion = version;\r
@@ -52,7 +52,7 @@ public class PackageInfo {
 \r
   @Override\r
   public String toString() {\r
 \r
   @Override\r
   public String toString() {\r
-    return "PackageInfo{" +\r
+    return "SourcePackageInfo{" +\r
             "mySource='" + mySource + '\'' +\r
             ", myPackageId='" + myPackageId + '\'' +\r
             ", myVersion='" + myVersion + '\'' +\r
             "mySource='" + mySource + '\'' +\r
             ", myPackageId='" + myPackageId + '\'' +\r
             ", myVersion='" + myVersion + '\'' +\r
index 5ba574fe2decc71adc1f2c3a4d04f8a200ab48d4..ce9679f91a2e0cce20896c2e5847227e01d62c09 100644 (file)
@@ -3,7 +3,7 @@ package jetbrains.buildServer.nuget.server.trigger;
 import jetbrains.buildServer.buildTriggers.BuildTriggerDescriptor;\r
 import jetbrains.buildServer.buildTriggers.BuildTriggerException;\r
 import jetbrains.buildServer.nuget.server.exec.ListPackagesCommand;\r
 import jetbrains.buildServer.buildTriggers.BuildTriggerDescriptor;\r
 import jetbrains.buildServer.buildTriggers.BuildTriggerException;\r
 import jetbrains.buildServer.nuget.server.exec.ListPackagesCommand;\r
-import jetbrains.buildServer.nuget.server.exec.PackageInfo;\r
+import jetbrains.buildServer.nuget.server.exec.SourcePackageInfo;\r
 import jetbrains.buildServer.serverSide.CustomDataStorage;\r
 import jetbrains.buildServer.util.StringUtil;\r
 import org.jetbrains.annotations.NotNull;\r
 import jetbrains.buildServer.serverSide.CustomDataStorage;\r
 import jetbrains.buildServer.util.StringUtil;\r
 import org.jetbrains.annotations.NotNull;\r
@@ -43,7 +43,7 @@ public class NamedPackagesUpdateChecker implements TriggerUpdateChecker {
       throw new BuildTriggerException("Failed to find NuGet.exe at: " + nugetPath);\r
     }\r
 \r
       throw new BuildTriggerException("Failed to find NuGet.exe at: " + nugetPath);\r
     }\r
 \r
-    Collection<PackageInfo> result;\r
+    Collection<SourcePackageInfo> result;\r
     try {\r
       result = myCommand.checkForChanges(nugetPath, source, pkgId, version);\r
     } catch (Throwable t) {\r
     try {\r
       result = myCommand.checkForChanges(nugetPath, source, pkgId, version);\r
     } catch (Throwable t) {\r
@@ -61,10 +61,10 @@ public class NamedPackagesUpdateChecker implements TriggerUpdateChecker {
     return null;\r
   }\r
 \r
     return null;\r
   }\r
 \r
-  private String serializeHashcode(@NotNull final Collection<PackageInfo> _packages) {\r
-    List<PackageInfo> sorted = new ArrayList<PackageInfo>(_packages);\r
-    Collections.sort(sorted, new Comparator<PackageInfo>() {\r
-      public int compare(PackageInfo o1, PackageInfo o2) {\r
+  private String serializeHashcode(@NotNull final Collection<SourcePackageInfo> _packages) {\r
+    List<SourcePackageInfo> sorted = new ArrayList<SourcePackageInfo>(_packages);\r
+    Collections.sort(sorted, new Comparator<SourcePackageInfo>() {\r
+      public int compare(SourcePackageInfo o1, SourcePackageInfo o2) {\r
         int i;\r
         if (0 != (i = o1.getSource().compareTo(o2.getSource()))) return i;\r
         if (0 != (i = o1.getPackageId().compareTo(o2.getPackageId()))) return i;\r
         int i;\r
         if (0 != (i = o1.getSource().compareTo(o2.getSource()))) return i;\r
         if (0 != (i = o1.getPackageId().compareTo(o2.getPackageId()))) return i;\r
@@ -74,7 +74,7 @@ public class NamedPackagesUpdateChecker implements TriggerUpdateChecker {
     });\r
 \r
     StringBuilder sb = new StringBuilder();\r
     });\r
 \r
     StringBuilder sb = new StringBuilder();\r
-    for (PackageInfo info : sorted) {\r
+    for (SourcePackageInfo info : sorted) {\r
       sb.append("|s:").append(info.getSource());\r
       sb.append("|p:").append(info.getPackageId());\r
       sb.append("|v:").append(info.getVersion());\r
       sb.append("|s:").append(info.getSource());\r
       sb.append("|p:").append(info.getPackageId());\r
       sb.append("|v:").append(info.getVersion());\r
index 0877e2270b87da1d53a612037b890aad8bdafb13..874c0580e14f808cee4278a5ab9e162e388a858b 100644 (file)
@@ -18,7 +18,7 @@ package jetbrains.buildServer.nuget.tests.server;
 \r
 import jetbrains.buildServer.BaseTestCase;\r
 import jetbrains.buildServer.nuget.server.exec.ListPackagesCommandProcessor;\r
 \r
 import jetbrains.buildServer.BaseTestCase;\r
 import jetbrains.buildServer.nuget.server.exec.ListPackagesCommandProcessor;\r
-import jetbrains.buildServer.nuget.server.exec.PackageInfo;\r
+import jetbrains.buildServer.nuget.server.exec.SourcePackageInfo;\r
 import org.testng.Assert;\r
 import org.testng.annotations.BeforeMethod;\r
 import org.testng.annotations.Test;\r
 import org.testng.Assert;\r
 import org.testng.annotations.BeforeMethod;\r
 import org.testng.annotations.Test;\r
@@ -68,9 +68,9 @@ public class ListPackagesCommandProcessorTest extends BaseTestCase {
   public void test_parse_service_message() {\r
     p.onStdOutput("##teamcity[nuget-package Id='NUnit' Version='2.5.10.11092']");\r
 \r
   public void test_parse_service_message() {\r
     p.onStdOutput("##teamcity[nuget-package Id='NUnit' Version='2.5.10.11092']");\r
 \r
-    Collection<PackageInfo> result = p.getResult();\r
+    Collection<SourcePackageInfo> result = p.getResult();\r
     Assert.assertEquals(result.size(), 1);\r
     Assert.assertEquals(result.size(), 1);\r
-    PackageInfo next = result.iterator().next();\r
+    SourcePackageInfo next = result.iterator().next();\r
 \r
     Assert.assertEquals(next.getSource(), "source5");\r
     Assert.assertEquals(next.getPackageId(), "NUnit");\r
 \r
     Assert.assertEquals(next.getSource(), "source5");\r
     Assert.assertEquals(next.getPackageId(), "NUnit");\r
@@ -82,10 +82,10 @@ public class ListPackagesCommandProcessorTest extends BaseTestCase {
     p.onStdOutput("##teamcity[nuget-package Id='NUnit' Version='2.5.10.11092']");\r
     p.onStdOutput("##teamcity[nuget-package Id='JUnit' Version='1.2.0.92']");\r
 \r
     p.onStdOutput("##teamcity[nuget-package Id='NUnit' Version='2.5.10.11092']");\r
     p.onStdOutput("##teamcity[nuget-package Id='JUnit' Version='1.2.0.92']");\r
 \r
-    Collection<PackageInfo> result = p.getResult();\r
+    Collection<SourcePackageInfo> result = p.getResult();\r
     Assert.assertEquals(result.size(), 2);\r
     Assert.assertEquals(result.size(), 2);\r
-    Iterator<PackageInfo> it = result.iterator();\r
-    PackageInfo next = it.next();\r
+    Iterator<SourcePackageInfo> it = result.iterator();\r
+    SourcePackageInfo next = it.next();\r
 \r
     Assert.assertEquals(next.getSource(), "source5");\r
     Assert.assertEquals(next.getPackageId(), "NUnit");\r
 \r
     Assert.assertEquals(next.getSource(), "source5");\r
     Assert.assertEquals(next.getPackageId(), "NUnit");\r
index 1420f7c2a1774d3611bf163a49da08a03ddd43b9..31032167193304436a38895750aa4a5de393e294 100644 (file)
@@ -48,7 +48,7 @@ public class ListPackagesCommandTest extends BaseTestCase {
     final List<String> list = new ArrayList<String>(Arrays.<String>asList(cmd));\r
     m.checking(new Expectations(){{\r
       oneOf(exec).executeNuGet(with(any(File.class)), with(equal(list)), with(any(ListPackagesCommandProcessor.class)));\r
     final List<String> list = new ArrayList<String>(Arrays.<String>asList(cmd));\r
     m.checking(new Expectations(){{\r
       oneOf(exec).executeNuGet(with(any(File.class)), with(equal(list)), with(any(ListPackagesCommandProcessor.class)));\r
-      will(returnValue(Collections.<PackageInfo>emptyList()));\r
+      will(returnValue(Collections.<SourcePackageInfo>emptyList()));\r
     }});\r
   }\r
 \r
     }});\r
   }\r
 \r
index 208e265b9d50454090364f5739280b30cb209d93..ebb15bbc90f84950de68cf2a7411e7dd529b6537 100644 (file)
@@ -20,7 +20,7 @@ import jetbrains.buildServer.BaseTestCase;
 import jetbrains.buildServer.buildTriggers.BuildTriggerDescriptor;\r
 import jetbrains.buildServer.buildTriggers.BuildTriggerException;\r
 import jetbrains.buildServer.nuget.server.exec.ListPackagesCommand;\r
 import jetbrains.buildServer.buildTriggers.BuildTriggerDescriptor;\r
 import jetbrains.buildServer.buildTriggers.BuildTriggerException;\r
 import jetbrains.buildServer.nuget.server.exec.ListPackagesCommand;\r
-import jetbrains.buildServer.nuget.server.exec.PackageInfo;\r
+import jetbrains.buildServer.nuget.server.exec.SourcePackageInfo;\r
 import jetbrains.buildServer.nuget.server.trigger.NamedPackagesUpdateChecker;\r
 import jetbrains.buildServer.nuget.server.trigger.TriggerConstants;\r
 import jetbrains.buildServer.nuget.tests.integration.Paths;\r
 import jetbrains.buildServer.nuget.server.trigger.NamedPackagesUpdateChecker;\r
 import jetbrains.buildServer.nuget.server.trigger.TriggerConstants;\r
 import jetbrains.buildServer.nuget.tests.integration.Paths;\r
@@ -75,7 +75,7 @@ public class NamedPackagesUpdateCheckerTest extends BaseTestCase {
   public void test_check_first_time_should_not_trigger() {\r
     m.checking(new Expectations(){{\r
       oneOf(cmd).checkForChanges(nugetFakePath, null, "NUnit", null);\r
   public void test_check_first_time_should_not_trigger() {\r
     m.checking(new Expectations(){{\r
       oneOf(cmd).checkForChanges(nugetFakePath, null, "NUnit", null);\r
-      will(returnValue(Arrays.asList(new PackageInfo("src", "pkg", "5.6.87"))));\r
+      will(returnValue(Arrays.asList(new SourcePackageInfo("src", "pkg", "5.6.87"))));\r
 \r
       oneOf(store).getValue("hash"); will(returnValue(null));\r
       oneOf(store).putValue(with(equal("hash")), with(any(String.class)));\r
 \r
       oneOf(store).getValue("hash"); will(returnValue(null));\r
       oneOf(store).putValue(with(equal("hash")), with(any(String.class)));\r
@@ -88,10 +88,10 @@ public class NamedPackagesUpdateCheckerTest extends BaseTestCase {
   public void test_check_should_not_trigger_twice() {\r
     m.checking(new Expectations(){{\r
       oneOf(cmd).checkForChanges(nugetFakePath, null, "NUnit", null);\r
   public void test_check_should_not_trigger_twice() {\r
     m.checking(new Expectations(){{\r
       oneOf(cmd).checkForChanges(nugetFakePath, null, "NUnit", null);\r
-      will(returnValue(Arrays.asList(new PackageInfo("src", "pkg", "5.6.87"))));\r
+      will(returnValue(Arrays.asList(new SourcePackageInfo("src", "pkg", "5.6.87"))));\r
 \r
       oneOf(cmd).checkForChanges(nugetFakePath, null, "NUnit", null);\r
 \r
       oneOf(cmd).checkForChanges(nugetFakePath, null, "NUnit", null);\r
-      will(returnValue(Arrays.asList(new PackageInfo("src", "pkg", "5.6.87"))));\r
+      will(returnValue(Arrays.asList(new SourcePackageInfo("src", "pkg", "5.6.87"))));\r
 \r
       oneOf(store).getValue("hash"); will(returnValue("aaa"));\r
       oneOf(store).putValue("hash", "|s:src|p:pkg|v:5.6.87");\r
 \r
       oneOf(store).getValue("hash"); will(returnValue("aaa"));\r
       oneOf(store).putValue("hash", "|s:src|p:pkg|v:5.6.87");\r