--- /dev/null
+<component name="libraryTable">\r
+ <library name="commons-http">\r
+ <CLASSES>\r
+ <root url="jar://$PROJECT_DIR$/lib/httpcomponents-client/httpclient-cache-4.1.2.jar!/" />\r
+ <root url="jar://$PROJECT_DIR$/lib/httpcomponents-client/httpclient-4.1.2.jar!/" />\r
+ <root url="jar://$PROJECT_DIR$/lib/httpcomponents-client/httpcore-4.1.2.jar!/" />\r
+ <root url="jar://$PROJECT_DIR$/lib/httpcomponents-client/httpmime-4.1.2.jar!/" />\r
+ <root url="jar://$PROJECT_DIR$/lib/httpcomponents-client/commons-codec-1.4.jar!/" />\r
+ </CLASSES>\r
+ <JAVADOC />\r
+ <SOURCES>\r
+ <root url="jar://$PROJECT_DIR$/lib/httpcomponents-client/src/httpcomponents-client-4.1.2-src.zip!/httpcomponents-client-4.1.2/httpmime/src/main/java" />\r
+ <root url="jar://$PROJECT_DIR$/lib/httpcomponents-client/src/httpcomponents-client-4.1.2-src.zip!/httpcomponents-client-4.1.2/httpclient-contrib/src/main/java" />\r
+ <root url="jar://$PROJECT_DIR$/lib/httpcomponents-client/src/httpcomponents-client-4.1.2-src.zip!/httpcomponents-client-4.1.2/httpclient-benchmark/src/main/java" />\r
+ <root url="jar://$PROJECT_DIR$/lib/httpcomponents-client/src/httpcomponents-client-4.1.2-src.zip!/httpcomponents-client-4.1.2/httpclient/src/main/java" />\r
+ <root url="jar://$PROJECT_DIR$/lib/httpcomponents-client/src/httpcomponents-core-4.1.2-src.zip!/httpcomponents-core-4.1.2/httpcore/src/main/java" />\r
+ <root url="jar://$PROJECT_DIR$/lib/httpcomponents-client/src/httpcomponents-core-4.1.2-src.zip!/httpcomponents-core-4.1.2/httpcore-nio/src/main/java" />\r
+ <root url="jar://$PROJECT_DIR$/lib/httpcomponents-client/src/httpcomponents-core-4.1.2-src.zip!/httpcomponents-core-4.1.2/httpcore-contrib/src/main/java" />\r
+ <root url="jar://$PROJECT_DIR$/lib/httpcomponents-client/src/httpcomponents-core-4.1.2-src.zip!/httpcomponents-core-4.1.2/httpcore-benchmark/src/main/java" />\r
+ <root url="jar://$PROJECT_DIR$/lib/httpcomponents-client/src/httpcomponents-core-4.1.2-src.zip!/httpcomponents-core-4.1.2/httpcore-ab/src/main/java" />\r
+ </SOURCES>\r
+ </library>\r
+</component>
\ No newline at end of file
<orderEntry type="library" name="Servlet Api" level="project" />\r
<orderEntry type="module" module-name="nuget-common" />\r
<orderEntry type="library" name="Common-Impl" level="project" />\r
+ <orderEntry type="library" name="commons-http" level="project" />\r
</component>\r
</module>\r
\r
\r
<bean class="jetbrains.buildServer.nuget.server.publish.PublishRunTypeRegistrar"/>\r
<bean class="jetbrains.buildServer.nuget.server.publish.PublishRunType"/>\r
+\r
+\r
+ <bean class="jetbrains.buildServer.nuget.server.feed.reader.FeedClient" destroy-method="dispose"/>\r
+ <bean class="jetbrains.buildServer.nuget.server.feed.reader.NuGetFeedReader"/>\r
+\r
</beans>
\ No newline at end of file
--- /dev/null
+/*\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.server.feed.reader;\r
+\r
+import org.apache.http.client.HttpClient;\r
+import org.apache.http.impl.client.DefaultHttpClient;\r
+import org.apache.http.impl.conn.tsccm.ThreadSafeClientConnManager;\r
+import org.apache.http.params.HttpConnectionParams;\r
+import org.jetbrains.annotations.NotNull;\r
+\r
+/**\r
+ * Created by Eugene Petrenko (eugene.petrenko@gmail.com)\r
+ * Date: 11.08.11 16:24\r
+ */\r
+public class FeedClient {\r
+ private final HttpClient myClient;\r
+\r
+ public FeedClient() {\r
+ myClient = new DefaultHttpClient(new ThreadSafeClientConnManager());\r
+ HttpConnectionParams.setConnectionTimeout(myClient.getParams(), 10000);\r
+ HttpConnectionParams.setSoTimeout(myClient.getParams(), 10000);\r
+ }\r
+\r
+ @NotNull\r
+ public HttpClient getClient() {\r
+ return myClient;\r
+ }\r
+\r
+ public void dispose() {\r
+ myClient.getConnectionManager().shutdown();\r
+ }\r
+\r
+}\r
--- /dev/null
+/*\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.server.feed.reader;\r
+\r
+/**\r
+ * Created by Eugene Petrenko (eugene.petrenko@gmail.com)\r
+ * Date: 11.08.11 16:04\r
+ */\r
+public class FeedConstants {\r
+ public static final String FEED_URL = "https://go.microsoft.com/fwlink/?LinkID=206669";\r
+}\r
--- /dev/null
+/*\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.server.feed.reader;\r
+\r
+import org.apache.http.HttpHeaders;\r
+import org.apache.http.HttpResponse;\r
+import org.apache.http.client.methods.HttpGet;\r
+import org.jetbrains.annotations.NotNull;\r
+\r
+import java.io.IOException;\r
+\r
+/**\r
+ * Created by Eugene Petrenko (eugene.petrenko@gmail.com)\r
+ * Date: 11.08.11 15:42\r
+ */\r
+public class NuGetFeedReader {\r
+ private FeedClient myClient;\r
+\r
+ public NuGetFeedReader(FeedClient client) {\r
+ myClient = client;\r
+ }\r
+\r
+ public void queryPackage(@NotNull String feedUrl,\r
+ @NotNull String packageId) throws IOException {\r
+ HttpGet get = new HttpGet(feedUrl + "/Packages()");\r
+ get.getParams().setParameter("$filter", "Id eq '" + packageId + "'");\r
+ get.setHeader(HttpHeaders.ACCEPT_ENCODING, "application/xml");\r
+ final HttpResponse execute = myClient.getClient().execute(get);\r
+\r
+ System.out.println(execute);\r
+ execute.getEntity().writeTo(System.out);\r
+ }\r
+}\r
--- /dev/null
+/*\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.tests.integration;\r
+\r
+import jetbrains.buildServer.BaseTestCase;\r
+import jetbrains.buildServer.nuget.server.feed.reader.FeedClient;\r
+import jetbrains.buildServer.nuget.server.feed.reader.FeedConstants;\r
+import jetbrains.buildServer.nuget.server.feed.reader.NuGetFeedReader;\r
+import org.testng.annotations.AfterMethod;\r
+import org.testng.annotations.BeforeMethod;\r
+import org.testng.annotations.Test;\r
+\r
+import java.io.IOException;\r
+\r
+/**\r
+ * Created by Eugene Petrenko (eugene.petrenko@gmail.com)\r
+ * Date: 11.08.11 16:04\r
+ */\r
+public class FeedReaderTest extends BaseTestCase {\r
+ private NuGetFeedReader myReader;\r
+ private FeedClient myClient;\r
+\r
+ @BeforeMethod\r
+ @Override\r
+ protected void setUp() throws Exception {\r
+ super.setUp();\r
+ myClient = new FeedClient();\r
+ myReader = new NuGetFeedReader(myClient);\r
+ }\r
+\r
+ @AfterMethod\r
+ @Override\r
+ protected void tearDown() throws Exception {\r
+ super.tearDown();\r
+ myClient.dispose();\r
+ }\r
+\r
+ @Test\r
+ public void testRead() throws IOException {\r
+ myReader.queryPackage(FeedConstants.FEED_URL, "NuGet.CommandLine");\r
+ }\r
+}\r