Browse files

support NuGet v2 feeds

  • Loading branch information...
1 parent 6a91424 commit 9e7e08f4a5c1ab7390f6ae2fa83392732832b750 @jonnyzzz jonnyzzz committed Dec 15, 2011
View
6 nuget-common/src/jetbrains/buildServer/nuget/common/FeedConstants.java
@@ -21,8 +21,10 @@
* Date: 11.08.11 16:04
*/
public class FeedConstants {
- public static final String MS_REF_FEED = "https://go.microsoft.com/fwlink/?LinkID=206669";
- public static final String NUGET_FEED = "http://packages.nuget.org/v1/FeedService.svc";
+ public static final String MS_REF_FEED_V1 = "https://go.microsoft.com/fwlink/?LinkID=206669";
+ public static final String MS_REF_FEED_V2 = "https://go.microsoft.com/fwlink/?LinkID=230477";
+ public static final String NUGET_FEED_V1 = "http://packages.nuget.org/api/v1/FeedService.svc";
+ public static final String NUGET_FEED_V2 = "http://packages.nuget.org/api/v2";
public static final String NUGET_COMMANDLINE = "NuGet.CommandLine";
}
View
4 ...ver/src/jetbrains/buildServer/nuget/server/toolRegistry/impl/AvailableToolsStateImpl.java
@@ -34,6 +34,8 @@
import java.util.Arrays;
import java.util.Collection;
+import static jetbrains.buildServer.nuget.common.FeedConstants.*;
+
/**
* Created by Eugene Petrenko (eugene.petrenko@gmail.com)
* Date: 15.08.11 16:33
@@ -82,7 +84,7 @@ public FeedPackage findTool(@NotNull final String id) {
private Collection<InstallableTool> fetchAvailable() throws FetchException {
FetchException exception = null;
- for (String feedUrl : Arrays.asList(FeedConstants.MS_REF_FEED, FeedConstants.NUGET_FEED)) {
+ for (String feedUrl : Arrays.asList(MS_REF_FEED_V2, MS_REF_FEED_V1, NUGET_FEED_V2, NUGET_FEED_V1)) {
try {
final Collection<FeedPackage> packages = myReader.queryPackageVersions(feedUrl, FeedConstants.NUGET_COMMANDLINE);
return CollectionsUtil.filterAndConvertCollection(
View
2 nuget-server/src/jetbrains/buildServer/nuget/server/trigger/impl/PackageCheckerTeamCity.java
@@ -58,7 +58,7 @@ public boolean accept(@NotNull PackageCheckRequest request) {
@NotNull
private String getUri(@NotNull SourcePackageReference request) {
String uri = request.getSource();
- if (uri == null) uri = FeedConstants.MS_REF_FEED;
+ if (uri == null) uri = FeedConstants.MS_REF_FEED_V2;
return uri;
}
View
32 nuget-tests/src/jetbrains/buildServer/nuget/tests/integration/FeedReaderTest.java
@@ -23,9 +23,11 @@
import jetbrains.buildServer.nuget.server.feed.reader.impl.*;
import jetbrains.buildServer.util.FileUtil;
import jetbrains.buildServer.util.SimpleHttpServerBase;
+import org.jetbrains.annotations.NotNull;
import org.testng.Assert;
import org.testng.annotations.AfterMethod;
import org.testng.annotations.BeforeMethod;
+import org.testng.annotations.DataProvider;
import org.testng.annotations.Test;
import java.io.*;
@@ -58,15 +60,20 @@ protected void tearDown() throws Exception {
myClient.dispose();
}
- @Test
- public void testRead_MS() throws IOException {
- enableDebug();
- readFeed(FeedConstants.MS_REF_FEED);
+ @DataProvider(name = "nuget-feeds")
+ public Object[][] nugetFeedsProvider() {
+ return new Object[][] {
+ {FeedConstants.MS_REF_FEED_V1},
+ {FeedConstants.MS_REF_FEED_V2},
+ {FeedConstants.NUGET_FEED_V1},
+ {FeedConstants.NUGET_FEED_V2},
+ };
}
- @Test
- public void testRead_NUGET() throws IOException {
- readFeed(FeedConstants.NUGET_FEED);
+ @Test(dataProvider = "nuget-feeds")
+ public void testReadFeed(@NotNull final String feed) throws IOException {
+ enableDebug();
+ readFeed(feed);
}
private void readFeed(String msRefFeed) throws IOException {
@@ -81,14 +88,9 @@ private void readFeed(String msRefFeed) throws IOException {
}
}
- @Test
- public void testDownloadLatest_MS() throws IOException {
- downloadLatest(FeedConstants.MS_REF_FEED);
- }
-
- @Test
- public void testDownloadLatest_NUGET() throws IOException {
- downloadLatest(FeedConstants.NUGET_FEED);
+ @Test(dataProvider = "nuget-feeds")
+ public void testDownloadLatest(@NotNull final String feed) throws IOException {
+ downloadLatest(feed);
}
private void downloadLatest(String feed) throws IOException {

0 comments on commit 9e7e08f

Please sign in to comment.