提交 c8806c99 编写于 作者: J Jesse Glick

Merge pull request #1532 from jglick/death-to-groovy-long-live-the-new-test

Convert UpdateCenter2Test to Java
...@@ -21,15 +21,15 @@ ...@@ -21,15 +21,15 @@
* OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
* THE SOFTWARE. * THE SOFTWARE.
*/ */
package hudson.model package hudson.model;
import org.jvnet.hudson.test.JenkinsRule import hudson.model.UpdateCenter.DownloadJob;
import org.jvnet.hudson.test.RandomlyFails import hudson.model.UpdateCenter.DownloadJob.Success;
import org.junit.Rule import static org.junit.Assert.*;
import org.junit.Test import org.junit.Rule;
import static org.junit.Assert.* import org.junit.Test;
import hudson.model.UpdateCenter.DownloadJob.Success import org.jvnet.hudson.test.JenkinsRule;
import hudson.model.UpdateSite import org.jvnet.hudson.test.RandomlyFails;
/** /**
* *
...@@ -44,18 +44,18 @@ public class UpdateCenter2Test { ...@@ -44,18 +44,18 @@ public class UpdateCenter2Test {
* Makes sure a plugin installs fine. * Makes sure a plugin installs fine.
*/ */
@RandomlyFails("SocketTimeoutException from goTo due to GET http://localhost:…/update-center.json?…") @RandomlyFails("SocketTimeoutException from goTo due to GET http://localhost:…/update-center.json?…")
@Test void install() { @Test public void install() throws Exception {
UpdateSite.neverUpdate = false; UpdateSite.neverUpdate = false;
j.createWebClient().goTo("") // load the metadata j.createWebClient().goTo(""); // load the metadata
def job = j.jenkins.updateCenter.getPlugin("changelog-history").deploy().get(); // this seems like one of the smallest plugin DownloadJob job = (DownloadJob) j.jenkins.getUpdateCenter().getPlugin("changelog-history").deploy().get(); // this seems like one of the smallest plugin
println job.status; System.out.println(job.status);
assertTrue(job.status instanceof Success) assertTrue(job.status instanceof Success);
} }
@Test void getLastUpdatedString() { @Test public void getLastUpdatedString() {
UpdateSite.neverUpdate = false UpdateSite.neverUpdate = false;
assertTrue(j.jenkins.updateCenter.getById("default").due) assertTrue(j.jenkins.getUpdateCenter().getById("default").isDue());
assertEquals(hudson.model.Messages.UpdateCenter_n_a(), j.jenkins.updateCenter.lastUpdatedString) assertEquals(Messages.UpdateCenter_n_a(), j.jenkins.getUpdateCenter().getLastUpdatedString());
} }
} }
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册