package at.kugel.tool.buildtray.action;
import org.junit.Test;
import at.kugel.tool.buildtray.config.IntegrationTestConfig;
import at.kugel.tool.buildtray.status.IntegrationStatusResult;
import at.kugel.tool.buildtray.status.Status;
import static org.junit.Assert.assertEquals;
import static org.junit.Assert.assertNull;
public class HudsonTest extends AbstractHtmlRegularExpressionActionsTestCase {
private IntegrationTestConfig createConfig() {
return createConfig("./config/Hudson-1.2.properties");
}
@Test
public void testFailedNewest() {
IntegrationTestConfig mockConf = createConfig();
mockConf.setServerlUrl4Test(getTestDataUrl("hudson-1.2_failed.xml"));
IntegrationStatusResult res = refreshWith(mockConf);
assertNull(res.error);
assertEquals("Krimi Trunk ANT-M2 for Bea 10 #9", res.projectName);
assertEquals(Status.FAILED, res.status);
assertEquals("2009-03-03T06:18:53Z", res.date);
}
@Test
public void testSuccess() {
IntegrationTestConfig mockConf = createConfig();
mockConf.setServerlUrl4Test(getTestDataUrl("hudson-1.2_success.xml"));
IntegrationStatusResult res = refreshWith(mockConf);
assertNull(res.error);
assertEquals("Krimi Trunk ANT-M2 for Bea 8 #48", res.projectName);
assertEquals(Status.OK, res.status);
assertEquals("2009-03-09T12:11:12Z", res.date);
}
@Test
public void testBusy() {
IntegrationTestConfig mockConf = createConfig();
mockConf.setServerlUrl4Test(getTestDataUrl("hudson-1.2_busy.xml"));
IntegrationStatusResult res = refreshWith(mockConf);
assertNull(res.error);
assertEquals("Krimi Trunk ANT-M2 for Bea 10 #9", res.projectName);
assertEquals(Status.BUSY, res.status);
assertNull(res.date);
}
}