From 0a004cade8a736465d0db3c73408b5cb91ef5edc Mon Sep 17 00:00:00 2001
From: Steffen Pingel
Date: Sat, 14 Jan 2012 14:56:59 +0100
Subject: update Hudson example
---
.../pom.xml | 6 ++---
.../examples/hudson/standalone/HudsonExample.java | 31 +++++-----------------
2 files changed, 9 insertions(+), 28 deletions(-)
diff --git a/org.eclipse.mylyn.examples.hudson.standalone/pom.xml b/org.eclipse.mylyn.examples.hudson.standalone/pom.xml
index 25a94569..68dfd71c 100644
--- a/org.eclipse.mylyn.examples.hudson.standalone/pom.xml
+++ b/org.eclipse.mylyn.examples.hudson.standalone/pom.xml
@@ -84,12 +84,12 @@
org.eclipse.mylyn.commons
- org.eclipse.mylyn.commons.net
- 3.7.0-SNAPSHOT
+ org.eclipse.mylyn.commons.repositories.core
+ 0.9.0-SNAPSHOT
org.eclipse.mylyn.commons
- org.eclipse.mylyn.commons.repositories
+ org.eclipse.mylyn.commons.repositories.http.core
0.9.0-SNAPSHOT
diff --git a/org.eclipse.mylyn.examples.hudson.standalone/src/main/java/org/eclipse/mylyn/internal/examples/hudson/standalone/HudsonExample.java b/org.eclipse.mylyn.examples.hudson.standalone/src/main/java/org/eclipse/mylyn/internal/examples/hudson/standalone/HudsonExample.java
index efb48e4d..f157942b 100644
--- a/org.eclipse.mylyn.examples.hudson.standalone/src/main/java/org/eclipse/mylyn/internal/examples/hudson/standalone/HudsonExample.java
+++ b/org.eclipse.mylyn.examples.hudson.standalone/src/main/java/org/eclipse/mylyn/internal/examples/hudson/standalone/HudsonExample.java
@@ -11,22 +11,6 @@
package org.eclipse.mylyn.internal.examples.hudson.standalone;
import java.util.List;
-import java.util.UUID;
-
-import org.eclipse.core.runtime.CoreException;
-import org.eclipse.mylyn.builds.core.IBuildPlan;
-import org.eclipse.mylyn.builds.core.spi.BuildServerBehaviour;
-import org.eclipse.mylyn.builds.core.spi.BuildServerConfiguration;
-import org.eclipse.mylyn.commons.net.WebLocation;
-import org.eclipse.mylyn.commons.repositories.RepositoryLocation;
-import org.eclipse.mylyn.internal.commons.net.CommonsNetPlugin;
-import org.eclipse.mylyn.internal.commons.repositories.InMemoryCredentialsStore;
-import org.eclipse.mylyn.internal.hudson.core.HudsonConnector;
-import org.eclipse.mylyn.internal.hudson.core.client.HudsonConfigurationCache;
-import org.eclipse.mylyn.internal.hudson.core.client.HudsonException;
-import org.eclipse.mylyn.internal.hudson.core.client.RestfulHudsonClient;
-import org.eclipse.mylyn.internal.hudson.model.HudsonModelJob;
-import org.eclipse.osgi.util.NLS;
/**
* @author Steffen Pingel
@@ -48,14 +32,10 @@ public class HudsonExample {
private static void framworkApiExample() throws CoreException {
RepositoryLocation location = new RepositoryLocation();
- location.setProperty(RepositoryLocation.PROPERTY_ID, UUID.randomUUID().toString());
- location.setCredentialsStore(new InMemoryCredentialsStore(null));
-
- location.setProperty(RepositoryLocation.PROPERTY_URL, "http://ci.mylyn.org/");
-// AuthenticationCredentials credentials = new UsernamePasswordCredentials("username", "password");
-// location.setCredentials(org.eclipse.mylyn.commons.repositories.auth.AuthenticationType.REPOSITORY, credentials);
+ location.setUrl("http://ci.mylyn.org/");
+ //location.setCredentials(AuthenticationType.REPOSITORY, new UserCredentials("username", "password"));
- HudsonConnector connector = new HudsonConnector();
+ BuildConnector connector = HudsonCore.createConnector(null);
BuildServerBehaviour behavior = connector.getBehaviour(location);
System.out.println(NLS.bind("= Listing all jobs on {0} =", location.getUrl()));
@@ -66,8 +46,9 @@ public class HudsonExample {
}
private static void hudsonApiExample() throws HudsonException {
- WebLocation location = new WebLocation("http://ci.mylyn.org/");
-// location.setCredentials(AuthenticationType.HTTP, "username", "password");
+ RepositoryLocation location = new RepositoryLocation();
+ location.setUrl("http://mylyn.org/jenkins-latest");
+ //location.setCredentials(AuthenticationType.REPOSITORY, new UserCredentials("username", "password"));
RestfulHudsonClient client = new RestfulHudsonClient(location, new HudsonConfigurationCache());
--
cgit v1.2.3