mirror of
https://github.com/jenkinsci/jenkins.git
synced 2026-11-16 05:22:22 +00:00
adding the first cut of update center capability. UI needs to follow.
git-svn-id: https://hudson.dev.java.net/svn/hudson/trunk/hudson/main@9691 71c3de6d-444a-0410-be80-ed276b4c234a
This commit is contained in:
1 parent
8513ec9b2b
commit
80e78e1a08
6 files changed
+218
-1
No files matched your search
@@ -0,0 +1,26 @@
|
||||
package hudson.model;
|
||||
|
||||
import junit.framework.TestCase;
|
||||
import net.sf.json.JSONObject;
|
||||
import org.apache.commons.io.IOUtils;
|
||||
|
||||
import java.io.IOException;
|
||||
import java.net.URL;
|
||||
|
||||
/**
|
||||
* Quick test for {@link UpdateCenter}.
|
||||
*
|
||||
* @author Kohsuke Kawaguchi
|
||||
*/
|
||||
public class UpdateCenterTest extends TestCase {
|
||||
public void testData() throws IOException {
|
||||
URL url = new URL("https://hudson.dev.java.net/update-center.json?version=build");
|
||||
String jsonp = IOUtils.toString(url.openStream());
|
||||
String json = jsonp.substring(jsonp.indexOf('(')+1,jsonp.lastIndexOf(')'));
|
||||
|
||||
UpdateCenter.Data data = new UpdateCenter.Data(JSONObject.fromObject(json));
|
||||
assertTrue(data.core.url.startsWith("https://hudson.dev.java.net/"));
|
||||
assertTrue(data.plugins.containsKey("rake"));
|
||||
System.out.println(data.core.url);
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user